messages listlengths 1 1 | ground_truth listlengths 0 6 | dataset stringclasses 1 value | question_id int64 0 527 |
|---|---|---|---|
[
{
"role": "user",
"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### Question: \nYou initially have an empty string S.\r\nAdditionally, there are bags 1, ... | [
{
"input": "abcde\n3\n3 ab abc abcd\n4 f c cd bcde\n2 e de\n",
"output": "2\n"
},
{
"input": "abcde\n3\n2 ab abc\n3 f c bcde\n1 e\n",
"output": "-1\n"
},
{
"input": "aaabbbbcccc\n6\n2 aa aaa\n2 dd ddd\n2 ab aabb\n4 bbaa bbbc bbb bbcc\n2 cc bcc\n3 ccc cccc ccccc\n",
"output": "4\n"
... | code_livecodebenchv6 | 400 |
[
{
"role": "user",
"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### Question: \nYou are given a string S consisting of lowercase English letters and |. S... | [
{
"input": "atcoder|beginner|contest\n",
"output": "atcodercontest\n"
},
{
"input": "|spoiler|\n",
"output": "\n"
},
{
"input": "||xyz\n",
"output": "xyz\n"
}
] | code_livecodebenchv6 | 401 |
[
{
"role": "user",
"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### Question: \nYou are given three sequences A=(A_1,\\ldots,A_N), B=(B_1,\\ldots,B_M), a... | [
{
"input": "3\n1 2 3\n2\n2 4\n6\n1 2 4 8 16 32\n4\n1 5 10 50\n",
"output": "No\nYes\nYes\nNo\n"
}
] | code_livecodebenchv6 | 402 |
[
{
"role": "user",
"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### Question: \nYou are given N integers A_1,A_2,\\dots,A_N, one per line, over N lines. ... | [
{
"input": "3\n2\n1\n0\n",
"output": "0\n1\n2\n3\n"
},
{
"input": "0\n",
"output": "0\n"
},
{
"input": "123\n456\n789\n987\n654\n321\n0\n",
"output": "0\n321\n654\n987\n789\n456\n123\n"
}
] | code_livecodebenchv6 | 403 |
[
{
"role": "user",
"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### Question: \nYou are given a sequence A=(A_1,\\ldots,A_N) of length N. The elements of... | [
{
"input": "4\n2 1 4 3\n4\n2 1\n1 4 5\n2 2\n1 5 1\n",
"output": "4 5 1 3\n"
},
{
"input": "6\n3 1 4 5 9 2\n7\n2 5\n1 3 5\n1 9 7\n2 9\n2 3\n1 2 3\n2 4\n",
"output": "5 1 7 2 3\n"
}
] | code_livecodebenchv6 | 404 |
[
{
"role": "user",
"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### Question: \nThere is a grid of H rows and W columns, each cell having a side length o... | [
{
"input": "5 5 5\n1 1\n3 3\n4 4\n2 3\n2 5\n",
"output": "Yes\n"
},
{
"input": "1 1 2\n2 3\n",
"output": "No\n"
},
{
"input": "1 2 2\n1 1\n",
"output": "No\n"
},
{
"input": "5 3 3\n1 1\n2 2\n2 2\n2 2\n2 2\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 405 |
[
{
"role": "user",
"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### Question: \nGiven an integer X between -10^{18} and 10^{18}, inclusive, print \\left\... | [
{
"input": "27\n",
"output": "3\n"
},
{
"input": "-13\n",
"output": "-1\n"
},
{
"input": "40\n",
"output": "4\n"
},
{
"input": "-20\n",
"output": "-2\n"
},
{
"input": "123456789123456789\n",
"output": "12345678912345679\n"
}
] | code_livecodebenchv6 | 406 |
[
{
"role": "user",
"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### Question: \nYou are given a string S of length N consisting of 0 and 1.\nA string T o... | [
{
"input": "5\n00011\n3 9 2 6 4\n",
"output": "7\n"
},
{
"input": "4\n1001\n1 2 3 4\n",
"output": "0\n"
},
{
"input": "11\n11111100111\n512298012 821282085 543342199 868532399 690830957 973970164 928915367 954764623 923012648 540375785 925723427\n",
"output": "2286846953\n"
}
] | code_livecodebenchv6 | 407 |
[
{
"role": "user",
"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### Question: \nThere is an infinitely long piano keyboard.\nIs there a continuous segmen... | [
{
"input": "3 2\n",
"output": "Yes\n"
},
{
"input": "3 0\n",
"output": "No\n"
},
{
"input": "92 66\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 408 |
[
{
"role": "user",
"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### Question: \nThere is a grid with H rows and W columns. Initially, all cells are paint... | [
{
"input": "3 4 4\n1 2 5\n2 4 0\n1 3 3\n1 3 2\n",
"output": "3\n0 5\n2 4\n5 3\n"
},
{
"input": "1 1 5\n1 1 1\n1 1 10\n2 1 100\n1 1 1000\n2 1 10000\n",
"output": "1\n10000 1\n"
},
{
"input": "5 5 10\n1 1 1\n1 2 2\n1 3 3\n1 4 4\n1 5 5\n2 1 6\n2 2 7\n2 3 8\n2 4 9\n2 5 10\n",
"output": "... | code_livecodebenchv6 | 409 |
[
{
"role": "user",
"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### Question: \nYou are given N integers A_1, A_2, \\dots, A_N.\r\nAlso, define B_i = A_i... | [
{
"input": "3\n3 4 6\n",
"output": "12 24\n"
},
{
"input": "5\n22 75 26 45 72\n",
"output": "1650 1950 1170 3240\n"
}
] | code_livecodebenchv6 | 410 |
[
{
"role": "user",
"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### Question: \nYou are given a sequence of positive integers A=(A_1,A_2,\\dots,A_N) of l... | [
{
"input": "4 5\n1 6 3 1\n",
"output": "11\n"
},
{
"input": "1 3\n346\n",
"output": "6\n"
},
{
"input": "10 158260522\n877914575 24979445 623690081 262703497 24979445 1822804784 1430302156 1161735902 923078537 1189330739\n",
"output": "12523196466007058\n"
}
] | code_livecodebenchv6 | 411 |
[
{
"role": "user",
"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### Question: \nIn the Kingdom of AtCoder, a week consists of A+B days, with the first th... | [
{
"input": "3 2 5\n1 2 9\n",
"output": "Yes\n"
},
{
"input": "2 5 10\n10 15\n",
"output": "No\n"
},
{
"input": "4 347 347\n347 700 705 710\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 412 |
[
{
"role": "user",
"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### Question: \nYou are given positive integers N and K, and a sequence of length N, A=(A... | [
{
"input": "5 2\n2 5 6 7 10\n",
"output": "1 3 5\n"
},
{
"input": "3 1\n3 4 7\n",
"output": "3 4 7\n"
},
{
"input": "5 10\n50 51 54 60 65\n",
"output": "5 6\n"
}
] | code_livecodebenchv6 | 413 |
[
{
"role": "user",
"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### Question: \nThere is an integer sequence A=(A_1,A_2,\\ldots,A_N) of length N, where a... | [
{
"input": "3 4\n1 3 3 2\n",
"output": "6 2 2\n"
},
{
"input": "4 6\n1 2 3 2 4 2\n",
"output": "15 9 12 7\n"
}
] | code_livecodebenchv6 | 414 |
[
{
"role": "user",
"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### Question: \nYou are given a string S consisting of lowercase English letters. How man... | [
{
"input": "yay\n",
"output": "5\n"
},
{
"input": "aababc\n",
"output": "17\n"
},
{
"input": "abracadabra\n",
"output": "54\n"
}
] | code_livecodebenchv6 | 415 |
[
{
"role": "user",
"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### Question: \nThere are N types of beans, one bean of each type. The i-th type of bean ... | [
{
"input": "4\n100 1\n20 5\n30 5\n40 1\n",
"output": "40\n"
},
{
"input": "10\n68 3\n17 2\n99 2\n92 4\n82 4\n10 3\n100 2\n78 1\n3 1\n35 4\n",
"output": "35\n"
}
] | code_livecodebenchv6 | 416 |
[
{
"role": "user",
"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### Question: \nOn the xy-plane, there are N points with ID numbers from 1 to N. Point i ... | [
{
"input": "4\n0 0\n2 4\n5 0\n3 4\n",
"output": "3\n3\n1\n1\n"
},
{
"input": "6\n3 2\n1 6\n4 5\n1 3\n5 5\n9 8\n",
"output": "6\n6\n6\n6\n6\n4\n"
}
] | code_livecodebenchv6 | 417 |
[
{
"role": "user",
"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### Question: \nTakahashi will have N penalty kicks in a soccer match.\nFor the i-th pena... | [
{
"input": "7\n",
"output": "ooxooxo\n"
},
{
"input": "9\n",
"output": "ooxooxoox\n"
}
] | code_livecodebenchv6 | 418 |
[
{
"role": "user",
"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### Question: \nThere is a grid with H rows and W columns. Let (i, j) denote the cell at ... | [
{
"input": "4 4\nS...\n#..#\n#...\n..#T\n4\n1 1 3\n1 3 5\n3 2 1\n2 3 1\n",
"output": "Yes\n"
},
{
"input": "2 2\nS.\nT.\n1\n1 2 4\n",
"output": "No\n"
},
{
"input": "4 5\n..#..\n.S##.\n.##T.\n.....\n3\n3 1 5\n1 2 3\n2 2 1\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 419 |
[
{
"role": "user",
"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### Question: \nYou are given a tree with N vertices. The vertices are numbered 1 to N, a... | [
{
"input": "4\n1 2\n1 3\n2 4\n1 1 1 2\n",
"output": "5\n"
},
{
"input": "2\n2 1\n1 1000000000\n",
"output": "1\n"
},
{
"input": "7\n7 3\n2 5\n2 4\n3 1\n3 6\n2 1\n2 7 6 9 3 4 6\n",
"output": "56\n"
}
] | code_livecodebenchv6 | 420 |
[
{
"role": "user",
"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### Question: \nA string T of length 3 consisting of uppercase English letters is an airp... | [
{
"input": "narita\nNRT\n",
"output": "Yes\n"
},
{
"input": "losangeles\nLAX\n",
"output": "Yes\n"
},
{
"input": "snuke\nRNG\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 421 |
[
{
"role": "user",
"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### Question: \nThere are N people labeled 1 to N, who have played several one-on-one gam... | [
{
"input": "4\n1 -2 -1\n",
"output": "2\n"
},
{
"input": "3\n0 0\n",
"output": "0\n"
},
{
"input": "6\n10 20 30 40 50\n",
"output": "-150\n"
}
] | code_livecodebenchv6 | 422 |
[
{
"role": "user",
"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### Question: \nA string S consisting of lowercase English letters is a good string if an... | [
{
"input": "commencement\n",
"output": "Yes\n"
},
{
"input": "banana\n",
"output": "No\n"
},
{
"input": "ab\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 423 |
[
{
"role": "user",
"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### Question: \nFor non-negative integers l and r (l < r), let S(l, r) denote the sequenc... | [
{
"input": "3 19\n",
"output": "5\n3 4\n4 8\n8 16\n16 18\n18 19\n"
},
{
"input": "0 1024\n",
"output": "1\n0 1024\n"
},
{
"input": "3940649673945088 11549545024454656\n",
"output": "8\n3940649673945088 3940649673949184\n3940649673949184 4503599627370496\n4503599627370496 900719925474... | code_livecodebenchv6 | 424 |
[
{
"role": "user",
"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### Question: \nThere is a 3 \\times 3 grid. Let (i, j) denote the cell at the i-th row f... | [
{
"input": "0 0 0\n0 1 0\n0 0 0\n",
"output": "Takahashi\n"
},
{
"input": "-1 1 0\n-4 -2 -5\n-4 -1 -5\n",
"output": "Aoki\n"
}
] | code_livecodebenchv6 | 425 |
[
{
"role": "user",
"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### Question: \nYou are given a string S of length 6. It is guaranteed that the first thr... | [
{
"input": "ABC349\n",
"output": "Yes\n"
},
{
"input": "ABC350\n",
"output": "No\n"
},
{
"input": "ABC316\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 426 |
[
{
"role": "user",
"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### Question: \nYou are given an integer N. You can perform the following two types of op... | [
{
"input": "3 2 10 20\n",
"output": "20.000000000000000\n"
},
{
"input": "3 2 20 20\n",
"output": "32.000000000000000\n"
},
{
"input": "314159265358979323 4 223606797 173205080\n",
"output": "6418410657.7408381\n"
}
] | code_livecodebenchv6 | 427 |
[
{
"role": "user",
"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### Question: \nTakahashi has N teeth, one in each of the holes numbered 1, 2, \\dots, N.... | [
{
"input": "30 6\n2 9 18 27 18 9\n",
"output": "28\n"
},
{
"input": "1 7\n1 1 1 1 1 1 1\n",
"output": "0\n"
},
{
"input": "9 20\n9 5 1 2 2 2 8 9 2 1 6 2 6 5 8 7 8 5 9 8\n",
"output": "5\n"
}
] | code_livecodebenchv6 | 428 |
[
{
"role": "user",
"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### Question: \nThere is an SNS used by N users, labeled with numbers from 1 to N.\nIn th... | [
{
"input": "4 3\n1 2\n2 3\n1 4\n",
"output": "3\n"
},
{
"input": "3 0\n",
"output": "0\n"
},
{
"input": "10 8\n1 2\n2 3\n3 4\n4 5\n6 7\n7 8\n8 9\n9 10\n",
"output": "12\n"
}
] | code_livecodebenchv6 | 430 |
[
{
"role": "user",
"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### Question: \nTeam Takahashi and Team Aoki are playing a baseball game, with Team Takah... | [
{
"input": "0 1 0 1 2 2 0 0 1\n1 1 0 0 0 0 1 0\n",
"output": "5\n"
},
{
"input": "0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0\n",
"output": "1\n"
}
] | code_livecodebenchv6 | 431 |
[
{
"role": "user",
"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### Question: \nYou are given two grids, each with N rows and N columns, referred to as g... | [
{
"input": "3\nabc\ndef\nghi\nabc\nbef\nghi\n",
"output": "2 1\n"
},
{
"input": "1\nf\nq\n",
"output": "1 1\n"
},
{
"input": "10\neixfumagit\nvtophbepfe\npxbfgsqcug\nugpugtsxzq\nbvfhxyehfk\nuqyfwtmglr\njaitenfqiq\nacwvufpfvv\njhaddglpva\naacxsyqvoj\neixfumagit\nvtophbepfe\npxbfgsqcug\nug... | code_livecodebenchv6 | 432 |
[
{
"role": "user",
"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### Question: \nOn a coordinate plane, there are N points P_1, P_2, \\ldots, P_N, where p... | [
{
"input": "3\n0 0\n1 3\n5 6\n",
"output": "3\n"
},
{
"input": "5\n0 5\n1 7\n2 9\n3 8\n4 6\n",
"output": "11\n"
}
] | code_livecodebenchv6 | 433 |
[
{
"role": "user",
"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### Question: \nYou are given an integer sequence A = (A_1, A_2, \\dots, A_N).\r\nCalcula... | [
{
"input": "3\n2 5 3\n",
"output": "4\n"
},
{
"input": "10\n5 9 3 0 4 8 7 5 4 0\n",
"output": "58\n"
}
] | code_livecodebenchv6 | 434 |
[
{
"role": "user",
"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### Question: \nYou have an empty sequence and N balls. The size of the i-th ball (1 \\le... | [
{
"input": "7\n2 1 1 3 5 3 3\n",
"output": "3\n"
},
{
"input": "5\n0 0 0 1 2\n",
"output": "4\n"
}
] | code_livecodebenchv6 | 435 |
[
{
"role": "user",
"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### Question: \nThere is a grid of H rows and W columns. Some cells (possibly zero) conta... | [
{
"input": "3 5\n.#...\n.....\n.#..#\n",
"output": "9\n"
},
{
"input": "3 3\n..#\n#..\n..#\n",
"output": "1\n"
}
] | code_livecodebenchv6 | 436 |
[
{
"role": "user",
"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### Question: \nYou are given a weighted undirected graph G with N vertices, numbered 1 t... | [
{
"input": "4 3\n3 3\n1 2 3\n2 2\n1 2\n3 4\n1 3 4\n",
"output": "9\n"
},
{
"input": "3 2\n2 1\n1 2\n2 1\n1 2\n",
"output": "-1\n"
},
{
"input": "10 5\n6 158260522\n1 3 6 8 9 10\n10 877914575\n1 2 3 4 5 6 7 8 9 10\n4 602436426\n2 6 7 9\n6 24979445\n2 3 4 5 8 10\n4 861648772\n2 4 8 9\n",
... | code_livecodebenchv6 | 437 |
[
{
"role": "user",
"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### Question: \nThe AtCoder railway line has N stations, numbered 1, 2, \\ldots, N.\nOn t... | [
{
"input": "7 6 1 3\n",
"output": "Yes\n"
},
{
"input": "10 3 2 9\n",
"output": "No\n"
},
{
"input": "100 23 67 45\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 438 |
[
{
"role": "user",
"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### Question: \nThere are N giants, named 1 to N. When giant i stands on the ground, thei... | [
{
"input": "3\n4 10\n5 8\n2 9\n",
"output": "18\n"
},
{
"input": "5\n1 1\n1 1\n1 1\n1 1\n1 1\n",
"output": "5\n"
},
{
"input": "10\n690830957 868532399\n741145463 930111470\n612846445 948344128\n540375785 925723427\n723092548 925021315\n928915367 973970164\n563314352 832796216\n562681294... | code_livecodebenchv6 | 439 |
[
{
"role": "user",
"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### Question: \nTakahashi tried to type a string S consisting of lowercase English letter... | [
{
"input": "abc\naxbxyc\n",
"output": "1 3 6\n"
},
{
"input": "aaaa\nbbbbaaaa\n",
"output": "5 6 7 8\n"
},
{
"input": "atcoder\natcoder\n",
"output": "1 2 3 4 5 6 7\n"
}
] | code_livecodebenchv6 | 440 |
[
{
"role": "user",
"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### Question: \nYou are given a permutation P = (P_1, P_2, \\dots, P_N) of (1, 2, \\dots,... | [
{
"input": "4 2\n2 3 1 4\n",
"output": "1\n"
},
{
"input": "4 1\n2 3 1 4\n",
"output": "0\n"
},
{
"input": "10 5\n10 1 6 8 7 2 5 9 3 4\n",
"output": "5\n"
}
] | code_livecodebenchv6 | 441 |
[
{
"role": "user",
"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### Question: \nFor positive integers x and y, define f(x, y) as the remainder of (x + y)... | [
{
"input": "3\n3 50000001 50000002\n",
"output": "100000012\n"
},
{
"input": "5\n1 3 99999999 99999994 1000000\n",
"output": "303999988\n"
}
] | code_livecodebenchv6 | 442 |
[
{
"role": "user",
"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### Question: \nThe AtCoder amusement park has an attraction that can accommodate K peopl... | [
{
"input": "7 6\n2 5 1 4 1 2 3\n",
"output": "4\n"
},
{
"input": "7 10\n1 10 1 10 1 10 1\n",
"output": "7\n"
},
{
"input": "15 100\n73 8 55 26 97 48 37 47 35 55 5 17 62 2 60\n",
"output": "8\n"
}
] | code_livecodebenchv6 | 443 |
[
{
"role": "user",
"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### Question: \nThere are N buildings aligned in a row. The i-th building from the left h... | [
{
"input": "4\n3 2 5 2\n",
"output": "3\n"
},
{
"input": "3\n4 3 2\n",
"output": "-1\n"
},
{
"input": "7\n10 5 10 2 10 13 15\n",
"output": "6\n"
}
] | code_livecodebenchv6 | 444 |
[
{
"role": "user",
"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### Question: \nFor strings x and y, define f(x, y) as follows:\n\n- f(x, y) is the lengt... | [
{
"input": "3\nab abc arc\n",
"output": "4\n"
},
{
"input": "11\nab bb aaa bba baba babb aaaba aabbb a a b\n",
"output": "32\n"
}
] | code_livecodebenchv6 | 445 |
[
{
"role": "user",
"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### Question: \nFor positive integers x and y, define f(x, y) as follows:\n\n- Interpret ... | [
{
"input": "3\n3 14 15\n",
"output": "2044\n"
},
{
"input": "5\n1001 5 1000000 1000000000 100000\n",
"output": "625549048\n"
}
] | code_livecodebenchv6 | 446 |
[
{
"role": "user",
"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### Question: \nN AtCoder users have gathered to play AtCoder RPS 2. The i-th user's name... | [
{
"input": "3\ntakahashi 2\naoki 6\nsnuke 5\n",
"output": "snuke\n"
},
{
"input": "3\ntakahashi 2813\ntakahashixx 1086\ntakahashix 4229\n",
"output": "takahashix\n"
}
] | code_livecodebenchv6 | 447 |
[
{
"role": "user",
"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### Question: \nTakahashi is growing a plant. Its height at the time of germination is 0\... | [
{
"input": "54\n",
"output": "6\n"
},
{
"input": "7\n",
"output": "4\n"
},
{
"input": "262144\n",
"output": "19\n"
}
] | code_livecodebenchv6 | 448 |
[
{
"role": "user",
"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### Question: \nTakahashi and Aoki are playing a game using N cards. The front side of th... | [
{
"input": "5\n1 9\n2 5\n4 9\n1 4\n2 5\n",
"output": "Aoki\n"
},
{
"input": "9\n3 2\n1 7\n4 1\n1 8\n5 2\n9 8\n2 1\n6 8\n5 2\n",
"output": "Takahashi\n"
}
] | code_livecodebenchv6 | 449 |
[
{
"role": "user",
"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### Question: \nTakahashi has N cards from the card game \"AtCoder Magics.\" The i-th car... | [
{
"input": "3\n2 4\n1 1\n3 2\n",
"output": "2\n2 3\n"
},
{
"input": "5\n1 1\n10 2\n100 3\n1000 4\n10000 5\n",
"output": "5\n1 2 3 4 5\n"
},
{
"input": "6\n32 101\n65 78\n2 29\n46 55\n103 130\n52 40\n",
"output": "4\n2 3 5 6\n"
}
] | code_livecodebenchv6 | 450 |
[
{
"role": "user",
"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### Question: \nThe pattern of AtCoder's wallpaper can be represented on the xy-plane as ... | [
{
"input": "0 0 3 3\n",
"output": "10\n"
},
{
"input": "-1 -2 1 3\n",
"output": "11\n"
},
{
"input": "-1000000000 -1000000000 1000000000 1000000000\n",
"output": "4000000000000000000\n"
}
] | code_livecodebenchv6 | 451 |
[
{
"role": "user",
"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### Question: \nThis is an interactive problem (where your program interacts with the jud... | [
{
"input": "3 1 5\n31 41 59 26 53 58 97 93\n3\n",
"output": "37\n"
}
] | code_livecodebenchv6 | 452 |
[
{
"role": "user",
"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### Question: \nYou are given a sequence A=(A_1,A_2,\\dots,A_N) of length N and a sequenc... | [
{
"input": "3 2\n3 2 5\n4 1\n",
"output": "Yes\n"
},
{
"input": "3 2\n3 1 5\n4 2\n",
"output": "No\n"
},
{
"input": "1 1\n1\n2\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 453 |
[
{
"role": "user",
"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### Question: \nThere is an N \\times N grid, where the cell at the i-th row from the top... | [
{
"input": "3 5\n5 1 8 9 7\n",
"output": "4\n"
},
{
"input": "3 5\n4 2 9 7 5\n",
"output": "-1\n"
},
{
"input": "4 12\n13 9 6 5 2 7 16 14 8 3 10 11\n",
"output": "9\n"
}
] | code_livecodebenchv6 | 454 |
[
{
"role": "user",
"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### Question: \nTakahashi's cake has been eaten by someone. There are three suspects: per... | [
{
"input": "1 2\n",
"output": "3\n"
},
{
"input": "1 1\n",
"output": "-1\n"
},
{
"input": "3 1\n",
"output": "2\n"
}
] | code_livecodebenchv6 | 455 |
[
{
"role": "user",
"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### Question: \nYou are given N intervals of real numbers. The i-th (1 \\leq i \\leq N) i... | [
{
"input": "3\n1 5\n7 8\n3 7\n",
"output": "2\n"
},
{
"input": "3\n3 4\n2 5\n1 6\n",
"output": "3\n"
},
{
"input": "2\n1 2\n3 4\n",
"output": "0\n"
}
] | code_livecodebenchv6 | 456 |
[
{
"role": "user",
"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### Question: \nYou are given an array apple of size n and an array capacity of size m.\n... | [] | code_livecodebenchv6 | 457 |
[
{
"role": "user",
"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### Question: \nYou are given an array happiness of length n, and a positive integer k.\n... | [] | code_livecodebenchv6 | 458 |
[
{
"role": "user",
"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### Question: \nYou are given an array arr of size n consisting of non-empty strings.\nFi... | [] | code_livecodebenchv6 | 459 |
[
{
"role": "user",
"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### Question: \nYou are given a 0-indexed array of integers nums of length n, and a posit... | [] | code_livecodebenchv6 | 460 |
[
{
"role": "user",
"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### Question: \nGiven a string s, find any substring of length 2 which is also present in... | [] | code_livecodebenchv6 | 461 |
[
{
"role": "user",
"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### Question: \nYou are given a string s and a character c. Return the total number of su... | [] | code_livecodebenchv6 | 462 |
[
{
"role": "user",
"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### Question: \nYou are given a string word and an integer k.\nWe consider word to be k-s... | [] | code_livecodebenchv6 | 463 |
[
{
"role": "user",
"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### Question: \nYou are given a binary array nums of length n, a positive integer k and a... | [] | code_livecodebenchv6 | 464 |
[
{
"role": "user",
"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### Question: \nGiven a string s, return the maximum length of a substring such that it c... | [] | code_livecodebenchv6 | 465 |
[
{
"role": "user",
"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### Question: \nYou are given a positive integer k. Initially, you have an array nums = [... | [] | code_livecodebenchv6 | 466 |
[
{
"role": "user",
"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### Question: \nThe problem involves tracking the frequency of IDs in a collection that c... | [] | code_livecodebenchv6 | 467 |
[
{
"role": "user",
"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### Question: \nYou are given two arrays of strings wordsContainer and wordsQuery.\nFor e... | [] | code_livecodebenchv6 | 468 |
[
{
"role": "user",
"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### Question: \nAn integer divisible by the sum of its digits is said to be a Harshad num... | [] | code_livecodebenchv6 | 469 |
[
{
"role": "user",
"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### Question: \nYou are given a binary array nums.\nWe call a subarray alternating if no ... | [] | code_livecodebenchv6 | 470 |
[
{
"role": "user",
"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### Question: \nYou are given a array points representing integer coordinates of some poi... | [] | code_livecodebenchv6 | 471 |
[
{
"role": "user",
"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### Question: \nYou are given an array of integers nums. Return the length of the longest... | [] | code_livecodebenchv6 | 472 |
[
{
"role": "user",
"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### Question: \nYou are given a string s and an integer k.\nDefine a function distance(s_... | [] | code_livecodebenchv6 | 473 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums and a non-negative integer k. In one ... | [] | code_livecodebenchv6 | 474 |
[
{
"role": "user",
"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### Question: \nYou are given a string s representing a 12-hour format time where some of... | [] | code_livecodebenchv6 | 475 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums.\nReturn an integer that is the maxim... | [] | code_livecodebenchv6 | 476 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array coins representing coins of different deno... | [] | code_livecodebenchv6 | 477 |
[
{
"role": "user",
"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### Question: \nYou are given two arrays nums and andValues of length n and m respectivel... | [] | code_livecodebenchv6 | 478 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums containing positive integers. We defi... | [] | code_livecodebenchv6 | 479 |
[
{
"role": "user",
"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### Question: \nYou are given a 0-indexed array nums of size n consisting of positive int... | [] | code_livecodebenchv6 | 480 |
[
{
"role": "user",
"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### Question: \nYou are given a string s. s[i] is either a lowercase English letter or '?... | [] | code_livecodebenchv6 | 481 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums of length n and a positive integer k.... | [] | code_livecodebenchv6 | 482 |
[
{
"role": "user",
"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### Question: \nYou are given an array nums of non-negative integers and an integer k.\nA... | [] | code_livecodebenchv6 | 483 |
[
{
"role": "user",
"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### Question: \nYou are given a binary array possible of length n.\nAlice and Bob are pla... | [] | code_livecodebenchv6 | 484 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums of length n, and a positive integer k... | [] | code_livecodebenchv6 | 485 |
[
{
"role": "user",
"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### Question: \nYou are given a string s. The score of a string is defined as the sum of ... | [] | code_livecodebenchv6 | 486 |
[
{
"role": "user",
"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### Question: \nYou are given an array of positive integers nums.\nReturn the number of s... | [] | code_livecodebenchv6 | 487 |
[
{
"role": "user",
"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### Question: \nYou are given a string word. A letter is called special if it appears bot... | [] | code_livecodebenchv6 | 488 |
[
{
"role": "user",
"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### Question: \nYou are given two arrays of equal length, nums1 and nums2.\nEach element ... | [] | code_livecodebenchv6 | 489 |
[
{
"role": "user",
"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### Question: \nYou are given two integers n and x. You have to construct an array of pos... | [] | code_livecodebenchv6 | 490 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums. The uniqueness array of nums is the ... | [] | code_livecodebenchv6 | 491 |
[
{
"role": "user",
"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### Question: \nA word is considered valid if:\n\nIt contains a minimum of 3 characters.\... | [] | code_livecodebenchv6 | 492 |
[
{
"role": "user",
"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### Question: \nYou are given a string word of size n, and an integer k such that k divid... | [] | code_livecodebenchv6 | 493 |
[
{
"role": "user",
"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### Question: \nYou are given a string s, which is known to be a concatenation of anagram... | [] | code_livecodebenchv6 | 494 |
[
{
"role": "user",
"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### Question: \nYou are given an integer array nums and two integers cost1 and cost2. You... | [] | code_livecodebenchv6 | 495 |
[
{
"role": "user",
"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### Question: \nYou are given a 2D matrix grid of size 3 x 3 consisting only of character... | [] | code_livecodebenchv6 | 496 |
[
{
"role": "user",
"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### Question: \nYou are given a 2D boolean matrix grid.\nReturn an integer that is the nu... | [] | code_livecodebenchv6 | 497 |
[
{
"role": "user",
"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### Question: \nYou are given 3 positive integers zero, one, and limit.\nA binary array a... | [] | code_livecodebenchv6 | 498 |
[
{
"role": "user",
"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### Question: \nYou are given two strings s and t such that every character occurs at mos... | [] | code_livecodebenchv6 | 499 |
[
{
"role": "user",
"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### Question: \nIn a mystic dungeon, n magicians are standing in a line. Each magician ha... | [] | code_livecodebenchv6 | 500 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.