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 are given a positive integer N.\r\nIf there are integers x and y such... | [
{
"input": "324\n",
"output": "Yes\n"
},
{
"input": "5\n",
"output": "No\n"
},
{
"input": "32\n",
"output": "Yes\n"
},
{
"input": "37748736\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 300 |
[
{
"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 sent a string T consisting of lowercase English letters to Aoki... | [
{
"input": "5 ababc\nababc\nbabc\nabacbc\nabdbc\nabbac\n",
"output": "4\n1 2 3 4\n"
},
{
"input": "1 aoki\ntakahashi\n",
"output": "0\n\n"
},
{
"input": "9 atcoder\natoder\natcode\nathqcoder\natcoder\ntacoder\njttcoder\natoder\natceoder\natcoer\n",
"output": "6\n1 2 4 7 8 9\n"
}
] | code_livecodebenchv6 | 301 |
[
{
"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 digits.\nFind the numb... | [
{
"input": "4\n4320\n",
"output": "2\n"
},
{
"input": "3\n010\n",
"output": "2\n"
},
{
"input": "13\n8694027811503\n",
"output": "840\n"
}
] | code_livecodebenchv6 | 302 |
[
{
"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 strings S_1, S_2, \\ldots, S_N consisting of lowercase En... | [
{
"input": "3 bac\nabba\nbcb\naaca\n",
"output": "3\n"
},
{
"input": "5 xx\nx\nx\nx\nx\nx\n",
"output": "25\n"
},
{
"input": "1 y\nx\n",
"output": "0\n"
},
{
"input": "10 ms\nmkgn\nm\nhlms\nvmsle\nmxsm\nnnzdhi\numsavxlb\nffnsybomr\nyvmm\nnaouel\n",
"output": "68\n"
}
] | code_livecodebenchv6 | 303 |
[
{
"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 directed graph with N vertices and M edges. Each edge has two ... | [
{
"input": "5 7\n1 2 3 6\n1 3 9 5\n2 3 1 5\n2 4 5 3\n2 5 1 9\n3 4 4 8\n4 5 2 7\n",
"output": "0.7500000000000000\n"
},
{
"input": "3 3\n1 3 1 1\n1 3 2 1\n1 3 3 1\n",
"output": "3.0000000000000000\n"
},
{
"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 ... | code_livecodebenchv6 | 304 |
[
{
"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: \nKeyence has a culture of addressing everyone with the honorific \"san,\" ... | [
{
"input": "Takahashi Chokudai\n",
"output": "Takahashi san\n"
},
{
"input": "K Eyence\n",
"output": "K san\n"
}
] | code_livecodebenchv6 | 305 |
[
{
"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: \nKeyence has N bases worldwide, numbered 1 to N.\r\nBase i has W_i employe... | [
{
"input": "3\n5 0\n3 3\n2 18\n",
"output": "8\n"
},
{
"input": "2\n1 10\n1000000 20\n",
"output": "1000000\n"
},
{
"input": "6\n31 3\n20 8\n11 5\n4 3\n47 14\n1 18\n",
"output": "67\n"
}
] | code_livecodebenchv6 | 306 |
[
{
"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 zero or more sensors placed on a grid of H rows and W columns. ... | [
{
"input": "5 6\n.##...\n...#..\n....##\n#.#...\n..#...\n",
"output": "3\n"
},
{
"input": "3 3\n#.#\n.#.\n#.#\n",
"output": "1\n"
},
{
"input": "4 2\n..\n..\n..\n..\n",
"output": "0\n"
},
{
"input": "5 47\n.#..#..#####..#...#..#####..#...#...###...#####\n.#.#...#.......#.#...... | code_livecodebenchv6 | 307 |
[
{
"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 products labeled 1 to N flowing on a conveyor belt.\r\nA Keye... | [
{
"input": "5\n1 1\n1 1\n2 1\n1 2\n1 4\n",
"output": "4\n"
},
{
"input": "2\n1 1\n1000000000000000000 1000000000000000000\n",
"output": "2\n"
},
{
"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"
}
] | code_livecodebenchv6 | 308 |
[
{
"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 cities in a certain country.\nYou will travel from your offic... | [
{
"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"
},
{
"input": "3 1 1000000 1000000\n0 10 1\n10 0 10\n1 10 0\n",
"output": "1\n"
},
{
"input": "5 954257 954213 814214\n0 84251 214529 10017 373342\n84251 0 91926 32336 164457\n214529 91926 0 108914 57762\n1... | code_livecodebenchv6 | 309 |
[
{
"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: \nAs the factory manager of Keyence, you want to monitor several sections o... | [
{
"input": "3\n3 5 10\n4 3 3\n2 2 6\n",
"output": "17\n"
},
{
"input": "3\n3 5 10\n4 3 3\n2 2 3\n",
"output": "-1\n"
},
{
"input": "2\n4 8\n3 1 100\n4 10000 100\n",
"output": "5\n"
}
] | code_livecodebenchv6 | 310 |
[
{
"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 in a building with 100 floors.\nHe uses the stairs for movin... | [
{
"input": "1 4\n",
"output": "No\n"
},
{
"input": "99 96\n",
"output": "Yes\n"
},
{
"input": "100 1\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 311 |
[
{
"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 326-like number is a three-digit positive integer where the product of ... | [
{
"input": "320\n",
"output": "326\n"
},
{
"input": "144\n",
"output": "144\n"
},
{
"input": "516\n",
"output": "600\n"
}
] | code_livecodebenchv6 | 312 |
[
{
"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 placed N gifts on a number line. The i-th gift is placed at... | [
{
"input": "8 6\n2 3 5 7 11 13 17 19\n",
"output": "4\n"
},
{
"input": "10 1\n3 1 4 1 5 9 2 6 5 3\n",
"output": "2\n"
},
{
"input": "10 998244353\n100000007 0 1755647 998244353 495 1000000000 1755648 503 1755649 998244853\n",
"output": "7\n"
}
] | code_livecodebenchv6 | 313 |
[
{
"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 and strings R and C of length N consisting of ... | [
{
"input": "5\nABCBC\nACAAB\n",
"output": "Yes\nAC..B\n.BA.C\nC.BA.\nBA.C.\n..CBA\n"
},
{
"input": "3\nAAA\nBBB\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 314 |
[
{
"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: \nAoki, an employee at AtCoder Inc., has his salary for this month determin... | [
{
"input": "3\n3 2 6\n",
"output": "776412280\n"
},
{
"input": "1\n998244352\n",
"output": "998244352\n"
},
{
"input": "9\n3 14 159 2653 58979 323846 2643383 27950288 419716939\n",
"output": "545252774\n"
}
] | code_livecodebenchv6 | 315 |
[
{
"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 lowercase English lett... | [
{
"input": "3\nabc\n",
"output": "Yes\n"
},
{
"input": "2\nba\n",
"output": "Yes\n"
},
{
"input": "7\natcoder\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 316 |
[
{
"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 B.\nIf there exists a positive integer A such th... | [
{
"input": "27\n",
"output": "3\n"
},
{
"input": "100\n",
"output": "-1\n"
},
{
"input": "10000000000\n",
"output": "10\n"
}
] | code_livecodebenchv6 | 317 |
[
{
"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 9\\times 9 grid A, where each cell contains an integer between... | [
{
"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"
},
{
"input": "1 2 3 4 5 6 7 8 9\n2 3 4 5 6 7 8 9 1\n3 4 5 6 7 8 9 1 2\n4 5 6 7 8 9 1 2 3\n5 6 7... | code_livecodebenchv6 | 318 |
[
{
"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 pair of sequences of length M consisting of positive integers at most N... | [
{
"input": "3 2\n1 2\n2 3\n",
"output": "Yes\n"
},
{
"input": "3 3\n1 2 3\n2 3 1\n",
"output": "No\n"
},
{
"input": "10 1\n1\n1\n",
"output": "No\n"
},
{
"input": "7 8\n1 6 2 7 5 4 2 2\n3 2 7 2 1 2 3 3\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 319 |
[
{
"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 participated in N contests and earned a performance P_i in the ... | [
{
"input": "3\n1000 600 1200\n",
"output": "256.735020470879931\n"
},
{
"input": "3\n600 1000 1200\n",
"output": "261.423219407873376\n"
},
{
"input": "1\n100\n",
"output": "-1100.000000000000000\n"
}
] | code_livecodebenchv6 | 320 |
[
{
"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 programming contest with N problems. For each i = 1, 2, \\ldot... | [
{
"input": "6 200\n100 675 201 200 199 328\n",
"output": "499\n"
},
{
"input": "8 675\n675 675 675 675 675 675 675 675\n",
"output": "5400\n"
},
{
"input": "8 674\n675 675 675 675 675 675 675 675\n",
"output": "0\n"
}
] | code_livecodebenchv6 | 321 |
[
{
"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: \nAtCoder Kingdom uses a calendar whose year has N months.\nMonth i (1\\leq... | [
{
"input": "12\n31 29 31 30 31 30 31 31 30 31 30 31\n",
"output": "13\n"
},
{
"input": "10\n10 1 2 3 4 5 6 7 8 100\n",
"output": "1\n"
},
{
"input": "30\n73 8 55 26 97 48 37 47 35 55 5 17 62 2 60 23 99 73 34 75 7 46 82 84 29 41 32 31 52 32\n",
"output": "15\n"
}
] | code_livecodebenchv6 | 322 |
[
{
"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_1S_2\\ldots S_N of length N consisting of lo... | [
{
"input": "11 4\nmississippi\n3 9\n4 10\n4 6\n7 7\n",
"output": "2\n2\n0\n0\n"
},
{
"input": "5 1\naaaaa\n1 5\n",
"output": "4\n"
}
] | code_livecodebenchv6 | 323 |
[
{
"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 three different characters: A, B, ... | [
{
"input": "BAABCBCCABCAC\n",
"output": "BCAC\n"
},
{
"input": "ABCABC\n",
"output": "\n"
},
{
"input": "AAABCABCABCAABCABCBBBAABCBCCCAAABCBCBCC\n",
"output": "AAABBBCCC\n"
}
] | code_livecodebenchv6 | 324 |
[
{
"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 simple connected undirected graph with N vertice... | [
{
"input": "5 6 328\n1 2 99\n1 3 102\n2 3 86\n2 4 94\n2 5 95\n3 4 81\n",
"output": "33\n"
},
{
"input": "6 5 998244353\n1 2 337361568\n1 6 450343304\n2 3 61477244\n2 5 745383438\n4 5 727360840\n",
"output": "325437688\n"
},
{
"input": "8 28 936294041850197\n1 2 473294720906780\n1 3 74303... | code_livecodebenchv6 | 325 |
[
{
"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 uppercase English letters. Separat... | [
{
"input": "ABC\n",
"output": "A B C\n"
},
{
"input": "ZZZZZZZ\n",
"output": "Z Z Z Z Z Z Z\n"
},
{
"input": "OOXXOO\n",
"output": "O O X X O O\n"
}
] | code_livecodebenchv6 | 326 |
[
{
"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, \\ldots, A_N. Find the largest among t... | [
{
"input": "5\n2 1 3 3 2\n",
"output": "2\n"
},
{
"input": "4\n4 3 2 1\n",
"output": "3\n"
},
{
"input": "8\n22 22 18 16 22 18 18 22\n",
"output": "18\n"
}
] | code_livecodebenchv6 | 327 |
[
{
"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 lowercase English lett... | [
{
"input": "6\naaabaa\n",
"output": "4\n"
},
{
"input": "1\nx\n",
"output": "1\n"
},
{
"input": "12\nssskkyskkkky\n",
"output": "8\n"
}
] | code_livecodebenchv6 | 328 |
[
{
"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 election to choose one winner from N candidates with candidat... | [
{
"input": "3 7\n1 2 2 3 1 3 3\n",
"output": "1\n1\n2\n2\n1\n1\n3\n"
},
{
"input": "100 5\n100 90 80 70 60\n",
"output": "100\n90\n80\n70\n60\n"
},
{
"input": "9 8\n8 8 2 2 8 8 2 2\n",
"output": "8\n8\n8\n2\n8\n8\n8\n2\n"
}
] | code_livecodebenchv6 | 329 |
[
{
"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, which consists of uppercase English letters... | [
{
"input": "7 3\nABCBABC\nABC\n",
"output": "Yes\n"
},
{
"input": "7 3\nABBCABC\nABC\n",
"output": "No\n"
},
{
"input": "12 2\nXYXXYXXYYYXY\nXY\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 330 |
[
{
"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 boxes numbered 1, 2, \\ldots, N. Initially, box i contains on... | [
{
"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"
},
{
"input": "5 3\n2 4 2 4 2\n3 1\n2 5\n3 2\n",
"output": "1\n2\n0\n"
}
] | code_livecodebenchv6 | 331 |
[
{
"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 people labeled 1,2,\\dots,N took an exam, and person i scored A_i point... | [
{
"input": "5 60\n60 20 100 90 40\n",
"output": "3\n"
},
{
"input": "4 80\n79 78 77 76\n",
"output": "0\n"
},
{
"input": "10 50\n31 41 59 26 53 58 97 93 23 84\n",
"output": "6\n"
}
] | code_livecodebenchv6 | 332 |
[
{
"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,\\ldots,A_N) of length N and... | [
{
"input": "5 4 7\n3 1 4 9 7\n",
"output": "4 4 4 7 7\n"
},
{
"input": "3 10 10\n11 10 9\n",
"output": "10 10 10\n"
}
] | code_livecodebenchv6 | 333 |
[
{
"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 D.\nFind the minimum value of |x^2+y^2-D... | [
{
"input": "21\n",
"output": "1\n"
},
{
"input": "998244353\n",
"output": "0\n"
},
{
"input": "264428617\n",
"output": "32\n"
}
] | code_livecodebenchv6 | 334 |
[
{
"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 N \\times N grid. Let (i,j) denote the cell in the i-th ... | [
{
"input": "3\nooo\noxx\nxxo\n",
"output": "4\n"
},
{
"input": "4\noxxx\nxoxx\nxxox\nxxxo\n",
"output": "0\n"
},
{
"input": "15\nxooxxooooxxxoox\noxxoxoxxxoxoxxo\noxxoxoxxxoxoxxx\nooooxooooxxoxxx\noxxoxoxxxoxoxxx\noxxoxoxxxoxoxxo\noxxoxooooxxxoox\nxxxxxxxxxxxxxxx\nxooxxxooxxxooox\noxxoxo... | code_livecodebenchv6 | 335 |
[
{
"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.\r\nRespond t... | [
{
"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"
}
] | code_livecodebenchv6 | 336 |
[
{
"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 calendar of AtCoder Kingdom, a year consists of M months from mont... | [
{
"input": "12 30\n2023 12 30\n",
"output": "2024 1 1\n"
},
{
"input": "36 72\n6789 23 45\n",
"output": "6789 23 46\n"
},
{
"input": "12 30\n2012 6 20\n",
"output": "2012 6 21\n"
}
] | code_livecodebenchv6 | 337 |
[
{
"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 supermarket sells egg packs.\nA pack of 6 eggs costs S yen, a pack of 8... | [
{
"input": "16 120 150 200\n",
"output": "300\n"
},
{
"input": "10 100 50 10\n",
"output": "10\n"
},
{
"input": "99 600 800 1200\n",
"output": "10000\n"
}
] | code_livecodebenchv6 | 338 |
[
{
"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.\nFor each i=1,\... | [
{
"input": "5\n1 4 1 4 2\n",
"output": "10 0 10 0 8\n"
},
{
"input": "10\n31 42 59 26 53 58 97 93 23 54\n",
"output": "456 414 190 487 361 249 0 97 513 307\n"
},
{
"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",
"o... | code_livecodebenchv6 | 339 |
[
{
"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 10^9 by 10^9 squares. Let (i, j) denote the square a... | [
{
"input": "3 2\nWWB\nBBW\nWBW\n1 2 3 4\n0 3 4 5\n",
"output": "4\n7\n"
},
{
"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",
"out... | code_livecodebenchv6 | 340 |
[
{
"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: \nAtCoder cafeteria sells meals consisting of a main dish and a side dish.\... | [
{
"input": "2 3 3\n2 1\n10 30 20\n1 2\n2 1\n2 3\n",
"output": "31\n"
},
{
"input": "2 1 0\n1000000000 1\n1000000000\n",
"output": "2000000000\n"
},
{
"input": "10 10 10\n47718 21994 74148 76721 98917 73766 29598 59035 69293 29127\n7017 46004 16086 62644 74928 57404 32168 45794 19493 7159... | code_livecodebenchv6 | 341 |
[
{
"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: \nAtCoder Inc. sells merchandise through its online shop.\nTakahashi has de... | [
{
"input": "2 2000 500\n1000 1\n100 6\n",
"output": "2100\n"
},
{
"input": "3 2000 500\n1000 1\n100 6\n5000 1\n",
"output": "6600\n"
},
{
"input": "2 2000 500\n1000 1\n1000 1\n",
"output": "2000\n"
}
] | code_livecodebenchv6 | 342 |
[
{
"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: \nAtCoder Inc. sells glasses and mugs.\nTakahashi has a glass with a capaci... | [
{
"input": "5 300 500\n",
"output": "200 500\n"
},
{
"input": "5 100 200\n",
"output": "0 0\n"
}
] | code_livecodebenchv6 | 343 |
[
{
"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: \nAtCoder Inc. sells T-shirts with its logo.\nYou are given Takahashi's sch... | [
{
"input": "6 1\n112022\n",
"output": "2\n"
},
{
"input": "3 1\n222\n",
"output": "3\n"
},
{
"input": "2 1\n01\n",
"output": "0\n"
}
] | code_livecodebenchv6 | 344 |
[
{
"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, A and B, each with H rows and W columns.\nFor ea... | [
{
"input": "4 5\n1 2 3 4 5\n6 7 8 9 10\n11 12 13 14 15\n16 17 18 19 20\n1 3 2 5 4\n11 13 12 15 14\n6 8 7 10 9\n16 18 17 20 19\n",
"output": "3\n"
},
{
"input": "2 2\n1 1\n1 1\n1 1\n1 1000000000\n",
"output": "-1\n"
},
{
"input": "3 3\n8 1 6\n3 5 7\n4 9 2\n8 1 6\n3 5 7\n4 9 2\n",
"out... | code_livecodebenchv6 | 345 |
[
{
"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 between 1 and 9, inclusive, as input.\nConcate... | [
{
"input": "3\n",
"output": "333\n"
},
{
"input": "9\n",
"output": "999999999\n"
}
] | code_livecodebenchv6 | 346 |
[
{
"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 regular pentagon P is shown in the figure below.\n\nDetermine whether t... | [
{
"input": "AC\nEC\n",
"output": "Yes\n"
},
{
"input": "DA\nEA\n",
"output": "No\n"
},
{
"input": "BD\nBD\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 347 |
[
{
"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 repunit is an integer whose digits are all 1 in decimal representation.... | [
{
"input": "5\n",
"output": "113\n"
},
{
"input": "19\n",
"output": "2333\n"
},
{
"input": "333\n",
"output": "112222222233\n"
}
] | code_livecodebenchv6 | 348 |
[
{
"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: vertex 1, vertex 2, \\ldots, vertex... | [
{
"input": "9\n1 2\n2 3\n2 4\n2 5\n1 6\n6 7\n7 8\n7 9\n",
"output": "5\n"
},
{
"input": "6\n1 2\n2 3\n2 4\n3 5\n3 6\n",
"output": "1\n"
},
{
"input": "24\n3 6\n7 17\n7 20\n7 11\n14 18\n17 21\n6 19\n5 22\n9 24\n11 14\n6 23\n8 17\n9 12\n4 17\n2 15\n1 17\n3 9\n10 16\n7 13\n2 16\n1 16\n5 7\n... | code_livecodebenchv6 | 349 |
[
{
"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 embark on an adventure.\nDuring the adventure, N events wi... | [
{
"input": "13\n1 2\n1 3\n1 1\n1 3\n1 2\n2 3\n1 3\n1 3\n2 3\n1 3\n2 2\n2 3\n2 1\n",
"output": "3\n1 1 1 0 0 1 0 1\n"
},
{
"input": "4\n2 3\n1 4\n2 1\n1 2\n",
"output": "-1\n"
},
{
"input": "30\n1 25\n1 2\n1 10\n1 18\n2 18\n1 11\n2 11\n1 21\n1 6\n2 2\n2 10\n1 11\n1 24\n1 11\n1 3\n1 2\n1 1... | code_livecodebenchv6 | 350 |
[
{
"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, a young baseball enthusiast, has been a very good boy this yea... | [
{
"input": "300 100\n",
"output": "Bat\n"
},
{
"input": "334 343\n",
"output": "Glove\n"
}
] | code_livecodebenchv6 | 351 |
[
{
"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 road that stretches infinitely to the east and west, and the c... | [
{
"input": "5 3 -1 6\n",
"output": "3\n"
},
{
"input": "-2 2 1 1\n",
"output": "0\n"
},
{
"input": "-177018739841739480 2436426 -80154573737296504 585335723211047198\n",
"output": "273142010859\n"
}
] | code_livecodebenchv6 | 352 |
[
{
"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 pairs of socks, and the i-th pair consists of two socks o... | [
{
"input": "4 2\n1 3\n",
"output": "2\n"
},
{
"input": "5 1\n2\n",
"output": "0\n"
},
{
"input": "8 5\n1 2 4 7 8\n",
"output": "2\n"
}
] | code_livecodebenchv6 | 353 |
[
{
"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 sleighs numbered 1,2,\\ldots, N.\nR_i reindeer are required t... | [
{
"input": "4 3\n5 3 11 8\n16\n7\n1000\n",
"output": "3\n1\n4\n"
},
{
"input": "6 6\n1 2 3 4 5 6\n1\n2\n3\n4\n5\n6\n",
"output": "1\n1\n2\n2\n2\n3\n"
},
{
"input": "2 2\n1000000000 1000000000\n200000000000000\n1\n",
"output": "2\n0\n"
}
] | code_livecodebenchv6 | 354 |
[
{
"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 problem has a similar setting to Problem G. Differences in the probl... | [
{
"input": "3 3\n##.\n#.#\n#..\n",
"output": "499122178\n"
},
{
"input": "4 5\n..#..\n.###.\n#####\n..#..\n",
"output": "598946613\n"
},
{
"input": "3 4\n#...\n.#.#\n..##\n",
"output": "285212675\n"
}
] | code_livecodebenchv6 | 355 |
[
{
"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 digi... | [
{
"input": "hello2023\n",
"output": "hello2024\n"
},
{
"input": "worldtourfinals2023\n",
"output": "worldtourfinals2024\n"
},
{
"input": "2023\n",
"output": "2024\n"
},
{
"input": "20232023\n",
"output": "20232024\n"
}
] | code_livecodebenchv6 | 356 |
[
{
"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.\nPrint all triples of non-negative integers (... | [
{
"input": "3\n",
"output": "0 0 0\n0 0 1\n0 0 2\n0 0 3\n0 1 0\n0 1 1\n0 1 2\n0 2 0\n0 2 1\n0 3 0\n1 0 0\n1 0 1\n1 0 2\n1 1 0\n1 1 1\n1 2 0\n2 0 0\n2 0 1\n2 1 0\n3 0 0\n"
},
{
"input": "4\n",
"output": "0 0 0\n0 0 1\n0 0 2\n0 0 3\n0 0 4\n0 1 0\n0 1 1\n0 1 2\n0 1 3\n0 2 0\n0 2 1\n0 2 2\n0 3 0\n0 ... | code_livecodebenchv6 | 357 |
[
{
"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 created a game where the player controls a dragon on a coor... | [
{
"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"
}
] | code_livecodebenchv6 | 358 |
[
{
"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 N rows and N columns, where N is an odd number at mo... | [
{
"input": "5\n",
"output": "1 2 3 4 5\n16 17 18 19 6\n15 24 T 20 7\n14 23 22 21 8\n13 12 11 10 9\n"
}
] | code_livecodebenchv6 | 359 |
[
{
"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 a positive integer X, the Dragon String of level X is a string of len... | [
{
"input": "3\n",
"output": "Looong\n"
},
{
"input": "1\n",
"output": "Long\n"
}
] | code_livecodebenchv6 | 360 |
[
{
"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 a positive integer X, let \\text{ctz}(X) be the (maximal) number of c... | [
{
"input": "2024\n",
"output": "3\n"
},
{
"input": "18\n",
"output": "1\n"
},
{
"input": "5\n",
"output": "0\n"
}
] | code_livecodebenchv6 | 361 |
[
{
"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 non-negative integer n is called a good integer when it satisfies the f... | [
{
"input": "8\n",
"output": "24\n"
},
{
"input": "133\n",
"output": "2024\n"
},
{
"input": "31415926535\n",
"output": "2006628868244228\n"
}
] | code_livecodebenchv6 | 362 |
[
{
"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 a positive integer k, the Pyramid Sequence of size k is a sequence of... | [
{
"input": "5\n2 2 3 1 1\n",
"output": "2\n"
},
{
"input": "5\n1 2 3 4 5\n",
"output": "3\n"
},
{
"input": "1\n1000000000\n",
"output": "1\n"
}
] | code_livecodebenchv6 | 363 |
[
{
"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 played N matches.\r\nIn the i-th match (1\\l... | [
{
"input": "4\n10 2\n10 1\n10 2\n3 2\n",
"output": "Takahashi\n"
},
{
"input": "6\n5 4\n4 5\n2 4\n1 6\n7 1\n3 2\n",
"output": "Draw\n"
},
{
"input": "4\n0 0\n10 10\n50 50\n0 100\n",
"output": "Aoki\n"
}
] | code_livecodebenchv6 | 364 |
[
{
"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: \nWe define Extended A strings, Extended B strings, Extended C strings, and... | [
{
"input": "AAABBBCCCCCCC\n",
"output": "Yes\n"
},
{
"input": "ACABABCBC\n",
"output": "No\n"
},
{
"input": "A\n",
"output": "Yes\n"
},
{
"input": "ABBBBBBBBBBBBBCCCCCC\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 365 |
[
{
"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 standing in a line: person 1, person 2, \\ldots, perso... | [
{
"input": "6\n4 1 -1 5 3 2\n",
"output": "3 5 4 1 2 6\n"
},
{
"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"
},
{
"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... | code_livecodebenchv6 | 366 |
[
{
"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": "3 4 3\nxo.x\n..o.\nxx.o\n",
"output": "2\n"
},
{
"input": "4 2 3\n.o\n.o\n.o\n.o\n",
"output": "0\n"
},
{
"input": "3 3 3\nx..\n..x\n.x.\n",
"output": "-1\n"
},
{
"input": "10 12 6\n......xo.o..\nx...x.....o.\nx...........\n..o...x.....\n.....oo.....\no.........x.... | code_livecodebenchv6 | 367 |
[
{
"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 (a type of problem where your program inte... | [
{
"input": "3 1\n",
"output": "2\n1 2 \n1 3 \n2\n"
}
] | code_livecodebenchv6 | 368 |
[
{
"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 non-empty string S consisting of uppercase and lowercase ... | [
{
"input": "Capitalized\n",
"output": "Yes\n"
},
{
"input": "AtCoder\n",
"output": "No\n"
},
{
"input": "yes\n",
"output": "No\n"
},
{
"input": "A\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 369 |
[
{
"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. Find th... | [
{
"input": "frequency\n",
"output": "e\n"
},
{
"input": "atcoder\n",
"output": "a\n"
},
{
"input": "pseudopseudohypoparathyroidism\n",
"output": "o\n"
}
] | code_livecodebenchv6 | 370 |
[
{
"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: \nYour refrigerator has N kinds of ingredients. Let us call them ingredient... | [
{
"input": "2\n800 300\n100 100\n200 10\n",
"output": "5\n"
},
{
"input": "2\n800 300\n100 0\n0 10\n",
"output": "38\n"
},
{
"input": "2\n800 300\n801 300\n800 301\n",
"output": "0\n"
},
{
"input": "10\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1... | code_livecodebenchv6 | 371 |
[
{
"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 Archipelago consists of N islands connected by N bridges.\nTh... | [
{
"input": "3 3\n1 3 2\n",
"output": "2\n"
},
{
"input": "4 5\n2 4 2 4 2\n",
"output": "8\n"
},
{
"input": "163054 10\n62874 19143 77750 111403 29327 56303 6659 18896 64175 26369\n",
"output": "390009\n"
}
] | code_livecodebenchv6 | 372 |
[
{
"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 2N points placed at equal intervals on a circle, numbered 1 to ... | [
{
"input": "3\n1 3\n4 2\n5 6\n",
"output": "Yes\n"
},
{
"input": "3\n6 1\n4 3\n2 5\n",
"output": "No\n"
},
{
"input": "4\n2 4\n3 7\n8 6\n5 1\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 373 |
[
{
"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 weighted simple directed graph with N vertices and M edges.\r\... | [
{
"input": "3 4\n1 2 5\n2 1 -3\n2 3 -4\n3 1 100\n",
"output": "-2\n"
},
{
"input": "3 2\n1 2 0\n2 1 0\n",
"output": "No\n"
},
{
"input": "5 9\n1 2 -246288\n4 5 -222742\n3 1 246288\n3 4 947824\n5 2 -178721\n4 3 -947824\n5 4 756570\n2 5 707902\n5 1 36781\n",
"output": "-449429\n"
}
] | code_livecodebenchv6 | 374 |
[
{
"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 the ... | [
{
"input": "atcoder.jp\n",
"output": "jp\n"
},
{
"input": "translate.google.com\n",
"output": "com\n"
},
{
"input": ".z\n",
"output": "z\n"
},
{
"input": "..........txt\n",
"output": "txt\n"
}
] | code_livecodebenchv6 | 375 |
[
{
"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 5\n",
"output": ".#..\n##..\n....\n"
},
{
"input": "2 2 1000\n",
"output": "..\n..\n"
},
{
"input": "10 10 10\n",
"output": "##........\n##........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n#........#\n"
}
] | code_livecodebenchv6 | 376 |
[
{
"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 bus is in operation. The number of passengers on the bus is always a no... | [
{
"input": "4\n3 -5 7 -4\n",
"output": "3\n"
},
{
"input": "5\n0 0 0 0 0\n",
"output": "0\n"
},
{
"input": "4\n-1 1000000000 1000000000 1000000000\n",
"output": "3000000000\n"
}
] | code_livecodebenchv6 | 377 |
[
{
"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 each cell is either empty or contains... | [
{
"input": "5\n....#\n#..#.\n.P...\n..P..\n....#\n",
"output": "3\n"
},
{
"input": "2\nP#\n#P\n",
"output": "-1\n"
},
{
"input": "10\n..........\n..........\n..........\n..........\n....P.....\n.....P....\n..........\n..........\n..........\n..........\n",
"output": "10\n"
}
] | code_livecodebenchv6 | 378 |
[
{
"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: \nPrint an arithmetic sequence with first term A, last term B, and common d... | [
{
"input": "3 9 2\n",
"output": "3 5 7 9\n"
},
{
"input": "10 10 1\n",
"output": "10\n"
}
] | code_livecodebenchv6 | 379 |
[
{
"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 A. There are Q queries given, and you need to ... | [
{
"input": "5\n1 20\n1 30\n2 1\n1 40\n2 3\n",
"output": "30\n20\n"
}
] | code_livecodebenchv6 | 380 |
[
{
"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 single integer N written on a blackboard.\r\nTakahashi will re... | [
{
"input": "3\n",
"output": "5\n"
},
{
"input": "340\n",
"output": "2888\n"
},
{
"input": "100000000000000000\n",
"output": "5655884811924144128\n"
}
] | code_livecodebenchv6 | 381 |
[
{
"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 playing a game.\nThe game consists of N stages numbered 1,2,... | [
{
"input": "5\n100 200 3\n50 10 1\n100 200 5\n150 1 2\n",
"output": "350\n"
},
{
"input": "10\n1000 10 9\n1000 10 10\n1000 10 2\n1000 10 3\n1000 10 4\n1000 10 5\n1000 10 6\n1000 10 7\n1000 10 8\n",
"output": "90\n"
},
{
"input": "6\n1000000000 1000000000 1\n1000000000 1000000000 1\n10000... | code_livecodebenchv6 | 382 |
[
{
"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 boxes numbered 0 to N-1. Initially, box i contains A_i balls.... | [
{
"input": "5 3\n1 2 3 4 5\n2 4 0\n",
"output": "0 4 2 7 2\n"
},
{
"input": "3 10\n1000000000 1000000000 1000000000\n0 1 0 1 0 1 0 1 0 1\n",
"output": "104320141 45436840 2850243019\n"
},
{
"input": "1 4\n1\n0 0 0 0\n",
"output": "1\n"
}
] | code_livecodebenchv6 | 383 |
[
{
"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 positive integer N, print a string of N zeros and N+1 ones where ... | [
{
"input": "4\n",
"output": "101010101\n"
},
{
"input": "1\n",
"output": "101\n"
},
{
"input": "10\n",
"output": "101010101010101010101\n"
}
] | code_livecodebenchv6 | 384 |
[
{
"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 countries numbered 1 to N. For each i = 1, 2, \\ldots, N, Tak... | [
{
"input": "4\n5 7 0 3\n2 2\n4 3\n5 2\n",
"output": "5\n"
},
{
"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"
}
] | code_livecodebenchv6 | 385 |
[
{
"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.\nEach cell of the grid is land... | [
{
"input": "6 7 5\nLULDR\n#######\n#...#.#\n##...##\n#.#...#\n#...#.#\n#######\n",
"output": "2\n"
},
{
"input": "13 16 9\nULURDLURD\n################\n##..##.#..####.#\n###.#..#.....#.#\n#..##..#####.###\n#...#..#......##\n###.##.#..#....#\n##.#####....##.#\n###.###.#.#.#..#\n######.....##..#\n#...... | code_livecodebenchv6 | 386 |
[
{
"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 positive integers N, M, and K. Here, N and M are diff... | [
{
"input": "2 3 5\n",
"output": "9\n"
},
{
"input": "1 2 3\n",
"output": "5\n"
},
{
"input": "100000000 99999999 10000000000\n",
"output": "500000002500000000\n"
}
] | code_livecodebenchv6 | 387 |
[
{
"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 consisting of 0 and 1 is called a good string if two consecutive... | [
{
"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"
},
{
"input": "1 2\n1\n1 1 1\n2 1 1\n",
"output": "Yes\n"
}
] | code_livecodebenchv6 | 388 |
[
{
"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 simple undirected graph consisting of N vertices and M ed... | [
{
"input": "6 6\n1 2\n2 3\n3 1\n3 4\n1 5\n5 6\n9 2 3 1 4 4\n1 0 0 0 0 1\n",
"output": "5\n"
},
{
"input": "2 1\n1 2\n1 2\n0 0\n",
"output": "0\n"
},
{
"input": "10 20\n4 8\n1 10\n1 7\n5 9\n9 10\n8 10\n7 5\n1 4\n7 3\n8 7\n2 8\n5 8\n4 2\n5 1\n7 2\n8 3\n3 4\n8 9\n7 10\n2 3\n25 5 1 1 16 5 98... | code_livecodebenchv6 | 389 |
[
{
"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. The len... | [
{
"input": "yay\n",
"output": "2\n"
},
{
"input": "egg\n",
"output": "1\n"
},
{
"input": "zzzzzwz\n",
"output": "6\n"
}
] | code_livecodebenchv6 | 390 |
[
{
"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 standing in a line. The person standing at the i-th po... | [
{
"input": "3\n2 1 3\n3\n2 3\n1 2\n1 3\n",
"output": "2\n2\n1\n"
},
{
"input": "7\n3 7 2 1 6 5 4\n13\n2 3\n1 2\n1 3\n3 6\n3 7\n2 4\n3 7\n1 3\n4 7\n1 6\n2 4\n1 3\n1 3\n",
"output": "3\n2\n3\n3\n3\n2\n3\n3\n7\n1\n2\n3\n3\n"
}
] | code_livecodebenchv6 | 391 |
[
{
"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 lowercase English lett... | [
{
"input": "7\natcoder\n4\nr a\nt e\nd v\na r\n",
"output": "recover\n"
},
{
"input": "3\nabc\n4\na a\ns k\nn n\nz b\n",
"output": "abc\n"
},
{
"input": "34\nsupercalifragilisticexpialidocious\n20\ng c\nl g\ng m\nc m\nr o\ns e\na a\no f\nf s\ne t\nt l\nd v\np k\nv h\nx i\nh n\nn j\ni r\n... | code_livecodebenchv6 | 392 |
[
{
"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 non-negative integers A=(A_1,\\ldots,A_N) of ... | [
{
"input": "5\n0 3 2 8 12\n",
"output": "6\n"
},
{
"input": "8\n2 2 4 6 3 100 100 25\n",
"output": "7\n"
}
] | code_livecodebenchv6 | 393 |
[
{
"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 country of AtCoder, there are N stations: station 1, station 2, \\... | [
{
"input": "6 7\n10 5 10 3 1 3\n13 5 10 2 3 4\n15 5 10 7 4 6\n3 10 2 4 2 5\n7 10 2 3 5 6\n5 3 18 2 2 3\n6 3 20 4 2 1\n",
"output": "55\n56\n58\n60\n17\n"
},
{
"input": "5 5\n1000000000 1000000000 1000000000 1000000000 1 5\n5 9 2 6 2 3\n10 4 1 6 2 3\n1 1 1 1 3 5\n3 1 4 1 5 1\n",
"output": "100000... | code_livecodebenchv6 | 394 |
[
{
"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 A and B, each between 0 and 9, inclusive.\nPri... | [
{
"input": "2 5\n",
"output": "2\n"
},
{
"input": "0 0\n",
"output": "9\n"
},
{
"input": "7 1\n",
"output": "4\n"
}
] | code_livecodebenchv6 | 395 |
[
{
"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 simple undirected graph G with N vertices labeled with numbers... | [
{
"input": "4\n0 1 1 0\n1 0 0 1\n1 0 0 0\n0 1 0 0\n",
"output": "2 3\n1 4\n1\n2\n"
},
{
"input": "2\n0 0\n0 0\n",
"output": "\n\n"
},
{
"input": "5\n0 1 0 1 1\n1 0 0 1 0\n0 0 0 0 1\n1 1 0 0 1\n1 0 1 1 0\n",
"output": "2 4 5\n1 4\n5\n1 2 5\n1 3 4\n"
}
] | code_livecodebenchv6 | 396 |
[
{
"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 N.\nFind the maximum value of a palindro... | [
{
"input": "345\n",
"output": "343\n"
},
{
"input": "6\n",
"output": "1\n"
},
{
"input": "123456789012345\n",
"output": "1334996994331\n"
}
] | code_livecodebenchv6 | 397 |
[
{
"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 hosting a contest with N players numbered 1 to N. \nThe play... | [
{
"input": "3 4\n1 10\n3 20\n2 10\n2 10\n",
"output": "2\n3\n2\n2\n"
},
{
"input": "1 3\n1 3\n1 4\n1 3\n",
"output": "1\n1\n1\n"
},
{
"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"
}
] | code_livecodebenchv6 | 398 |
[
{
"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 coordinate space, we want to place three cubes with a side length of... | [
{
"input": "840 84 7\n",
"output": "Yes\n0 0 0 0 6 0 6 0 0\n"
},
{
"input": "343 34 3\n",
"output": "No\n"
}
] | code_livecodebenchv6 | 399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.