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: \nThere is an undirected graph with N vertices numbered 1 through N, and in...
[ { "input": "3 7\n1 1 2\n1 1 3\n1 2 3\n2 1\n1 1 2\n2 2\n1 1 2\n", "output": "1\n0\n0\n1\n0\n3\n1\n" }, { "input": "2 1\n2 1\n", "output": "2\n" } ]
code_livecodebenchv6
200
[ { "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 blackboard, there are N sets S_1,S_2,\\dots,S_N consisting of intege...
[ { "input": "3 5\n2\n1 2\n2\n2 3\n3\n3 4 5\n", "output": "2\n" }, { "input": "1 2\n2\n1 2\n", "output": "0\n" }, { "input": "3 5\n2\n1 3\n2\n2 4\n3\n2 4 5\n", "output": "-1\n" }, { "input": "4 8\n3\n1 3 5\n2\n1 2\n3\n2 4 7\n4\n4 6 7 8\n", "output": "2\n" } ]
code_livecodebenchv6
201
[ { "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: \nTwo characters x and y are called similar characters if and only if one o...
[ { "input": "3\nl0w\n1ow\n", "output": "Yes\n" }, { "input": "3\nabc\narc\n", "output": "No\n" }, { "input": "4\nnok0\nn0ko\n", "output": "Yes\n" } ]
code_livecodebenchv6
202
[ { "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 numbered 1,2,\\ldots,N were in M photos. In each of the photos,...
[ { "input": "4 2\n1 2 3 4\n4 3 1 2\n", "output": "2\n" }, { "input": "3 3\n1 2 3\n3 1 2\n1 2 3\n", "output": "0\n" }, { "input": "10 10\n4 10 7 2 8 3 9 1 6 5\n3 6 2 9 1 8 10 7 4 5\n9 3 4 5 7 10 1 8 2 6\n7 3 1 8 4 9 5 6 2 10\n5 2 1 4 10 7 9 8 3 6\n5 8 1 6 9 3 2 4 7 10\n8 10 3 4 5 7 2 9 6 1...
code_livecodebenchv6
203
[ { "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 two-dimensional plane, Takahashi is initially at point (0, 0), and h...
[ { "input": "4 2 3 1\nRUDL\n-1 -1\n1 0\n", "output": "Yes\n" }, { "input": "5 2 1 5\nLDRLD\n0 0\n-1 -1\n", "output": "No\n" } ]
code_livecodebenchv6
204
[ { "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 computer has a keyboard with three keys: 'a' key, Shift key, and Cap...
[ { "input": "1 3 3\nAAaA\n", "output": "9\n" }, { "input": "1 1 100\naAaAaA\n", "output": "6\n" }, { "input": "1 2 4\naaAaAaaAAAAaAaaAaAAaaaAAAAA\n", "output": "40\n" } ]
code_livecodebenchv6
205
[ { "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 graph with (k+1) vertices and k edges is called a level-k\\ (k\\geq 2) ...
[ { "input": "6\n1 2\n2 3\n3 4\n4 5\n5 6\n", "output": "2 2\n" }, { "input": "9\n3 9\n7 8\n8 6\n4 6\n4 1\n5 9\n7 3\n5 2\n", "output": "2 2 2\n" }, { "input": "20\n8 3\n8 18\n2 19\n8 20\n9 17\n19 7\n8 7\n14 12\n2 15\n14 10\n2 13\n2 16\n2 1\n9 5\n10 15\n14 6\n2 4\n2 11\n5 12\n", "output"...
code_livecodebenchv6
206
[ { "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 numbered 1, 2, \\ldots, N, sitting in this clockwise o...
[ { "input": "5\nalice 31\nbob 41\ncarol 5\ndave 92\nellen 65\n", "output": "carol\ndave\nellen\nalice\nbob\n" }, { "input": "2\ntakahashi 1000000000\naoki 999999999\n", "output": "aoki\ntakahashi\n" } ]
code_livecodebenchv6
207
[ { "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.\r\nPrint an approximation of N according to t...
[ { "input": "20230603\n", "output": "20200000\n" }, { "input": "0\n", "output": "0\n" }, { "input": "304\n", "output": "304\n" }, { "input": "500600\n", "output": "500000\n" } ]
code_livecodebenchv6
208
[ { "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 numbered 1, 2, \\ldots, N on a two-dimensional plane, ...
[ { "input": "4 5\n2 -1\n3 1\n8 8\n0 5\n", "output": "Yes\nYes\nNo\nYes\n" }, { "input": "3 1\n0 0\n-1000 -1000\n1000 1000\n", "output": "Yes\nNo\nNo\n" }, { "input": "9 4\n3 2\n6 -1\n1 6\n6 5\n-2 -3\n5 3\n2 -3\n2 1\n2 6\n", "output": "Yes\nNo\nNo\nYes\nYes\nYes\nYes\nYes\nNo\n" } ]
code_livecodebenchv6
209
[ { "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 rectangular cake with some strawberries on the xy-plane. The c...
[ { "input": "7 6\n5\n6 1\n3 1\n4 2\n1 5\n6 2\n2\n2 5\n2\n3 4\n", "output": "0 2\n" }, { "input": "4 4\n4\n1 1\n3 1\n3 3\n1 3\n1\n2\n1\n2\n", "output": "1 1\n" } ]
code_livecodebenchv6
210
[ { "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 undirected graph G with N vertices and M edges.\r\nFor i...
[ { "input": "6 6\n1 2\n2 3\n2 3\n3 1\n5 4\n5 5\n3\n1 5\n2 6\n4 3\n4\n2 5\n2 6\n5 6\n5 4\n", "output": "No\nNo\nYes\nYes\n" } ]
code_livecodebenchv6
211
[ { "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 ultramarathon course totaling 100\\;\\mathrm{km}.\r\nWater st...
[ { "input": "53\n", "output": "55\n" }, { "input": "21\n", "output": "20\n" }, { "input": "100\n", "output": "100\n" } ]
code_livecodebenchv6
212
[ { "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 7 points A, B, C, D, E, F, and G on a straight line, in this or...
[ { "input": "A C\n", "output": "4\n" }, { "input": "G B\n", "output": "20\n" }, { "input": "C F\n", "output": "10\n" } ]
code_livecodebenchv6
213
[ { "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 square a...
[ { "input": "5 6\n......\n..#.#.\n..###.\n..###.\n......\n", "output": "2 4\n" }, { "input": "3 2\n#.\n##\n##\n", "output": "1 2\n" }, { "input": "6 6\n..####\n..##.#\n..####\n..####\n..####\n......\n", "output": "2 5\n" } ]
code_livecodebenchv6
214
[ { "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 keeps a sleep log.\r\nThe log is represented as an odd-length s...
[ { "input": "7\n0 240 720 1320 1440 1800 2160\n3\n480 1920\n720 1200\n0 2160\n", "output": "480\n0\n960\n" }, { "input": "21\n0 20 62 192 284 310 323 324 352 374 409 452 486 512 523 594 677 814 838 946 1000\n10\n77 721\n255 541\n478 970\n369 466\n343 541\n42 165\n16 618\n222 592\n730 983\n338 747\n",...
code_livecodebenchv6
215
[ { "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 with N vertices and M edges, where ver...
[ { "input": "5 5 2\n1 2\n2 3\n2 4\n3 5\n1 5\n1 1\n5 2\n", "output": "4\n1 2 3 5\n" }, { "input": "3 0 1\n2 3\n", "output": "1\n2\n" }, { "input": "10 10 2\n2 1\n5 1\n6 1\n2 4\n2 5\n2 10\n8 5\n8 6\n9 6\n7 9\n3 4\n8 2\n", "output": "7\n1 2 3 5 6 8 9\n" } ]
code_livecodebenchv6
216
[ { "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": "8\nbeginner\n", "output": "bbeeggiinnnneerr\n" }, { "input": "3\naaa\n", "output": "aaaaaa\n" } ]
code_livecodebenchv6
217
[ { "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_0,A_1,\\dots,A_{63}) of length 64 consistin...
[ { "input": "1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "13\n" }, { "input": "1 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 1 0 0 ...
code_livecodebenchv6
218
[ { "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_{3N}) of length 3N where eac...
[ { "input": "3\n1 1 3 2 3 2 2 3 1\n", "output": "1 3 2\n" }, { "input": "1\n1 1 1\n", "output": "1\n" }, { "input": "4\n2 3 4 3 4 1 3 1 1 4 2 2\n", "output": "3 4 1 2\n" } ]
code_livecodebenchv6
219
[ { "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 decided to enjoy a wired full-course meal consisting of N c...
[ { "input": "5\n1 100\n1 300\n0 -200\n1 500\n1 300\n", "output": "600\n" }, { "input": "4\n0 -1\n1 -2\n0 -3\n1 -4\n", "output": "0\n" }, { "input": "15\n1 900000000\n0 600000000\n1 -300000000\n0 -700000000\n1 200000000\n1 300000000\n0 -600000000\n1 -900000000\n1 600000000\n1 -100000000\n1...
code_livecodebenchv6
220
[ { "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 have a sequence A=(A_1,A_2,\\dots,A_N) of length N. Initially, all th...
[ { "input": "4 2 10\n1 5\n2 1\n3 3\n4 2\n2 10\n1 0\n4 0\n3 1\n2 0\n3 0\n", "output": "5\n6\n8\n8\n15\n13\n13\n11\n1\n0\n" } ]
code_livecodebenchv6
221
[ { "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 recorded the number of steps he walked for N weeks. He walk...
[ { "input": "2\n1000 2000 3000 4000 5000 6000 7000 2000 3000 4000 5000 6000 7000 8000\n", "output": "28000 35000\n" }, { "input": "3\n14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 6286 20899 86280 34825 34211 70679 82148\n", "output": "314333 419427 335328\n"...
code_livecodebenchv6
222
[ { "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 Engli...
[ { "input": "5\nab\nccef\nda\na\nfe\n", "output": "Yes\n" }, { "input": "3\na\nb\naba\n", "output": "No\n" }, { "input": "2\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "Yes\n" } ]
code_livecodebenchv6
223
[ { "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 two sheets A and B, each composed of black squares and tran...
[ { "input": "3 5\n#.#..\n.....\n.#...\n2 2\n#.\n.#\n5 3\n...\n#.#\n.#.\n.#.\n...\n", "output": "Yes\n" }, { "input": "2 2\n#.\n.#\n2 2\n#.\n.#\n2 2\n##\n##\n", "output": "No\n" }, { "input": "1 1\n#\n1 2\n##\n1 1\n#\n", "output": "No\n" }, { "input": "3 3\n###\n...\n...\n3 3\n...
code_livecodebenchv6
224
[ { "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": "8\na(b(d))c\n", "output": "ac\n" }, { "input": "5\na(b)(\n", "output": "a(\n" }, { "input": "2\n()\n", "output": "\n" }, { "input": "6\n)))(((\n", "output": ")))(((\n" } ]
code_livecodebenchv6
225
[ { "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 numbered from 1 to N standing in a circle. Person 1 is...
[ { "input": "3 3\n", "output": "6\n" }, { "input": "4 2\n", "output": "2\n" }, { "input": "987654 456789\n", "output": "778634319\n" } ]
code_livecodebenchv6
226
[ { "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 eight integers S_1,S_2,\\dots, and S_8,\r\nprint Yes if they satisf...
[ { "input": "125 175 250 300 400 525 600 650\n", "output": "Yes\n" }, { "input": "100 250 300 400 325 575 625 675\n", "output": "No\n" }, { "input": "0 23 24 145 301 413 631 632\n", "output": "No\n" } ]
code_livecodebenchv6
227
[ { "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 ate N plates of sushi at a sushi restaurant. The color of the ...
[ { "input": "3 2\nred green blue\nblue red\n800 1600 2800\n", "output": "5200\n" }, { "input": "3 2\ncode queen atcoder\nking queen\n10 1 1\n", "output": "21\n" } ]
code_livecodebenchv6
228
[ { "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 numbered 1 through N tossed a coin several times. We know that ...
[ { "input": "3\n1 3\n3 1\n2 2\n", "output": "2 3 1\n" }, { "input": "2\n1 3\n2 6\n", "output": "1 2\n" }, { "input": "4\n999999999 1000000000\n333333333 999999999\n1000000000 999999997\n999999998 1000000000\n", "output": "3 1 4 2\n" } ]
code_livecodebenchv6
229
[ { "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 have a grid with H horizontal rows and W vertical columns.\r\nWe denot...
[ { "input": "2 3\nsns\neuk\n", "output": "Yes\n" }, { "input": "2 2\nab\ncd\n", "output": "No\n" }, { "input": "5 7\nskunsek\nnukesnu\nukeseku\nnsnnesn\nuekukku\n", "output": "Yes\n" } ]
code_livecodebenchv6
230
[ { "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 length-N sequence A=(A_1,A_2,\\dots,A_N) consisting of 0,...
[ { "input": "4\n1 1 0 2\nMEEX\n", "output": "3\n" }, { "input": "3\n0 0 0\nXXX\n", "output": "0\n" }, { "input": "15\n1 1 2 0 0 2 0 2 0 0 0 0 0 2 2\nEXMMXXXEMEXEXMM\n", "output": "13\n" } ]
code_livecodebenchv6
231
[ { "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 in a store to buy N items. The regular price of the i-th item is...
[ { "input": "3 3\n4 3 1\n4 4 2\n2 3 1\n", "output": "4\n" }, { "input": "10 5\n9 7 1 5 2 2 5 5 7 6\n7 2 7 8 2\n3 2 4 1 2\n", "output": "37\n" } ]
code_livecodebenchv6
232
[ { "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 have the following 3 \\times 3 board with integers from 1 through 9 wr...
[ { "input": "7 8\n", "output": "Yes\n" }, { "input": "1 9\n", "output": "No\n" }, { "input": "3 4\n", "output": "No\n" } ]
code_livecodebenchv6
233
[ { "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 grid with N rows and N columns. An integer A_{i, j} is w...
[ { "input": "4\n0101\n1101\n1111\n0000\n", "output": "1010\n1101\n0111\n0001\n" }, { "input": "2\n11\n11\n", "output": "11\n11\n" }, { "input": "5\n01010\n01001\n10110\n00110\n01010\n", "output": "00101\n11000\n00111\n00110\n10100\n" } ]
code_livecodebenchv6
234
[ { "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: \nSnuke the doctor prescribed N kinds of medicine for Takahashi. For the n...
[ { "input": "4 8\n6 3\n2 5\n1 9\n4 2\n", "output": "3\n" }, { "input": "4 100\n6 3\n2 5\n1 9\n4 2\n", "output": "1\n" }, { "input": "15 158260522\n877914575 2436426\n24979445 61648772\n623690081 33933447\n476190629 62703497\n211047202 71407775\n628894325 31963982\n822804784 50968417\n4303...
code_livecodebenchv6
235
[ { "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 have an undirected graph with (N_1+N_2) vertices and M edges. For i=1...
[ { "input": "3 4 6\n1 2\n2 3\n4 5\n4 6\n1 3\n6 7\n", "output": "5\n" }, { "input": "7 5 20\n10 11\n4 5\n10 12\n1 2\n1 5\n5 6\n2 4\n3 5\n9 10\n2 5\n1 4\n11 12\n9 12\n8 9\n5 7\n3 7\n3 6\n3 4\n8 12\n9 11\n", "output": "4\n" } ]
code_livecodebenchv6
236
[ { "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 family consisting of person 1, person 2, \\ldots, and person N...
[ { "input": "7 3\n1 2 1 3 3 3\n1 1\n1 2\n4 3\n", "output": "4\n" }, { "input": "10 10\n1 1 3 1 2 3 3 5 7\n2 1\n5 1\n4 3\n6 3\n2 1\n7 3\n9 2\n1 2\n6 2\n8 1\n", "output": "10\n" } ]
code_livecodebenchv6
237
[ { "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 wants a beverage called AtCoder Drink in a restaurant.\r\nIt ca...
[ { "input": "3 100 50\n60 20 40\n", "output": "70\n" }, { "input": "3 100 50\n60000 20000 40000\n", "output": "100\n" } ]
code_livecodebenchv6
238
[ { "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 Shop has N products.\r\nThe price of the i-th product (1\\leq i\\...
[ { "input": "5 6\n10000 2 1 3\n15000 3 1 2 4\n30000 3 1 3 5\n35000 2 1 5\n100000 6 1 2 3 4 5 6\n", "output": "Yes\n" }, { "input": "4 4\n3 1 1\n3 1 2\n3 1 2\n4 2 2 3\n", "output": "No\n" }, { "input": "20 10\n72036 3 3 4 9\n7716 4 1 2 3 6\n54093 5 1 6 7 8 10\n25517 7 3 4 5 6 7 9 10\n96930...
code_livecodebenchv6
239
[ { "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 sticks with several balls stuck onto them. Each ball has a lo...
[ { "input": "6\na\nabc\nde\ncba\nde\nabc\n", "output": "3\n" } ]
code_livecodebenchv6
240
[ { "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 sports players.\nAmong them, there are M incompatible pairs. ...
[ { "input": "5 2 2\n1 3\n3 4\n", "output": "4\n" }, { "input": "5 1 2\n1 3\n3 4\n", "output": "0\n" }, { "input": "6 4 0\n", "output": "65\n" }, { "input": "10 6 8\n5 9\n1 4\n3 8\n1 6\n4 10\n5 7\n5 6\n3 7\n", "output": "8001\n" } ]
code_livecodebenchv6
241
[ { "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.\r\nIt describ...
[ { "input": "5\n00110\n", "output": "9\n" }, { "input": "30\n101010000100101011010011000010\n", "output": "326\n" } ]
code_livecodebenchv6
242
[ { "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 have N dice.\r\nFor each i = 1, 2, \\ldots, N, when the i-th die is th...
[ { "input": "4\n1 7 2 9\n", "output": "942786334\n" }, { "input": "7\n1 10 100 1000 10000 100000 1000000\n", "output": "996117877\n" } ]
code_livecodebenchv6
243
[ { "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 A, B, and C. S is guaranteed to co...
[ { "input": "5\nACABB\n", "output": "4\n" }, { "input": "4\nCABC\n", "output": "3\n" }, { "input": "30\nAABABBBABABBABABCABACAABCBACCA\n", "output": "17\n" } ]
code_livecodebenchv6
244
[ { "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 numbered 1 to N.\r\nYou are given their schedule for t...
[ { "input": "3 5\nxooox\noooxx\noooxo\n", "output": "2\n" }, { "input": "3 3\noxo\noxo\noxo\n", "output": "1\n" }, { "input": "3 3\noox\noxo\nxoo\n", "output": "0\n" }, { "input": "1 7\nooooooo\n", "output": "7\n" }, { "input": "5 15\noxooooooooooooo\noxooxoooooooo...
code_livecodebenchv6
245
[ { "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 N edges.\r\nThe i-th edge g...
[ { "input": "7\n6 7 2 1 3 4 5\n", "output": "4\n7 5 3 2\n" }, { "input": "2\n2 1\n", "output": "2\n1 2\n" }, { "input": "8\n3 7 4 7 3 3 8 2\n", "output": "3\n2 7 8\n" } ]
code_livecodebenchv6
246
[ { "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 M grid and a player standing on it.\r\nLet (i,j) de...
[ { "input": "6 6\n######\n#....#\n#.#..#\n#..#.#\n#....#\n######\n", "output": "12\n" }, { "input": "21 25\n#########################\n#..............###...####\n#..............#..#...###\n#........###...#...#...##\n#........#..#..#........#\n#...##...#..#..#...#....#\n#..#..#..###...#..#.....#\n#..#...
code_livecodebenchv6
247
[ { "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 square a...
[ { "input": "2 3 1\n2 3\n", "output": "6\n" }, { "input": "3 2 6\n1 1\n1 2\n2 1\n2 2\n3 1\n3 2\n", "output": "0\n" }, { "input": "1 1 0\n", "output": "1\n" }, { "input": "3000 3000 0\n", "output": "9004500500\n" } ]
code_livecodebenchv6
248
[ { "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 length-3 string S consisting of uppercase English letters, print ...
[ { "input": "ABC\n", "output": "No\n" }, { "input": "FAC\n", "output": "Yes\n" }, { "input": "XYX\n", "output": "No\n" } ]
code_livecodebenchv6
249
[ { "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 invented Tak Code, a two-dimensional code. A TaK Code satisfie...
[ { "input": "19 18\n###......###......\n###......###......\n###..#...###..#...\n..............#...\n..................\n..................\n......###......###\n......###......###\n......###......###\n.###..............\n.###......##......\n.###..............\n............###...\n...##.......###...\n...##.......#...
code_livecodebenchv6
250
[ { "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 sellers and M buyers in an apple market.\nThe i-th seller may...
[ { "input": "3 4\n110 90 120\n100 80 120 10000\n", "output": "110\n" }, { "input": "5 2\n100000 100000 100000 100000 100000\n100 200\n", "output": "201\n" }, { "input": "3 2\n100 100 100\n80 120\n", "output": "100\n" } ]
code_livecodebenchv6
251
[ { "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 (, ), and ?.\r\nThere ar...
[ { "input": "(???(?\n", "output": "2\n" }, { "input": ")))))\n", "output": "0\n" }, { "input": "??????????????(????????(??????)?????????(?(??)\n", "output": "603032273\n" } ]
code_livecodebenchv6
252
[ { "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 rectangular cuboids in a three-dimensional space.\nThese cubo...
[ { "input": "4\n0 0 0 1 1 1\n0 0 1 1 1 2\n1 1 1 2 2 2\n3 3 3 4 4 4\n", "output": "1\n1\n0\n0\n" }, { "input": "3\n0 0 10 10 10 20\n3 4 1 15 6 10\n0 9 6 1 20 10\n", "output": "2\n1\n1\n" }, { "input": "8\n0 0 0 1 1 1\n0 0 1 1 1 2\n0 1 0 1 2 1\n0 1 1 1 2 2\n1 0 0 2 1 1\n1 0 1 2 1 2\n1 1 0 2...
code_livecodebenchv6
253
[ { "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 items.\r\nEach of these is one of a pull-tab can, a regular c...
[ { "input": "8 4\n0 6\n0 6\n1 3\n1 5\n1 15\n2 1\n2 10\n2 100\n", "output": "27\n" }, { "input": "5 5\n1 5\n1 5\n1 5\n1 5\n1 5\n", "output": "0\n" }, { "input": "12 6\n2 2\n0 1\n0 9\n1 3\n1 5\n1 3\n0 4\n2 1\n1 8\n2 1\n0 1\n0 4\n", "output": "30\n" } ]
code_livecodebenchv6
254
[ { "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 numbered 1 through N.\nEach person has a integer score...
[ { "input": "4\n5 15 2 10\n", "output": "11\n" }, { "input": "4\n15 5 2 10\n", "output": "0\n" }, { "input": "3\n100 100 100\n", "output": "1\n" } ]
code_livecodebenchv6
255
[ { "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 competitive programmers numbered person 1, person 2, \\ldots,...
[ { "input": "3 2\n1 2\n2 3\n", "output": "1\n" }, { "input": "3 2\n1 3\n2 3\n", "output": "-1\n" }, { "input": "6 6\n1 6\n6 5\n6 2\n2 3\n4 3\n4 2\n", "output": "-1\n" } ]
code_livecodebenchv6
256
[ { "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\nYou can perf...
[ { "input": "4\n4 7 3 7\n", "output": "3\n" }, { "input": "1\n313\n", "output": "0\n" }, { "input": "10\n999999997 999999999 4 3 2 4 999999990 8 999999991 999999993\n", "output": "2499999974\n" } ]
code_livecodebenchv6
257
[ { "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 number pi to the 100-th decimal place is\n3.1415926535897932384626433...
[ { "input": "2\n", "output": "3.14\n" }, { "input": "32\n", "output": "3.14159265358979323846264338327950\n" }, { "input": "100\n", "output": "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679\n" } ]
code_livecodebenchv6
258
[ { "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, person 1, person 2, \\ldots, person N, are playing roulette.\r\...
[ { "input": "4\n3\n7 19 20\n4\n4 19 24 0\n2\n26 10\n3\n19 31 24\n19\n", "output": "2\n1 4\n" }, { "input": "3\n1\n1\n1\n2\n1\n3\n0\n", "output": "0\n\n" } ]
code_livecodebenchv6
259
[ { "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": "8 3\napzbqrcs\n1 2 3 1 2 2 1 2\n", "output": "cszapqbr\n" }, { "input": "2 1\naa\n1 1\n", "output": "aa\n" } ]
code_livecodebenchv6
260
[ { "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 uppercase and lowercas...
[ { "input": "7\nAtCoder\n5\n1 4 i\n3 0 a\n1 5 b\n2 0 a\n1 4 Y\n", "output": "atcYber\n" }, { "input": "35\nTheQuickBrownFoxJumpsOverTheLazyDog\n10\n2 0 a\n1 19 G\n1 13 m\n1 2 E\n1 21 F\n2 0 a\n1 27 b\n3 0 a\n3 0 a\n1 15 i\n", "output": "TEEQUICKBROWMFiXJUGPFOVERTBELAZYDOG\n" } ]
code_livecodebenchv6
261
[ { "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 roulette wheels.\nThe i-th (1\\leq i\\leq N) wheel has P _ i ...
[ { "input": "3 14\n100 2 5 9\n50 4 1 2 4 8\n70 5 2 4 2 8 8\n", "output": "215.913355350494384765625\n" }, { "input": "2 100\n1 2 1 2\n10 6 0 0 0 0 0 100\n", "output": "60\n" }, { "input": "20 90\n3252 9 0 4 2 7 3 2 3 2 4\n2147 1 1\n4033 8 0 4 1 7 5 2 5 0\n3795 6 6 6 2 3 2 2\n3941 7 2 4 4 ...
code_livecodebenchv6
262
[ { "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 players, player 1, player 2, ..., player N, participate in a game tourn...
[ { "input": "5\n1 2\n4 3\n5 3\n1 4\n", "output": "698771048 698771048 964969543 964969543 133099248\n" }, { "input": "15\n9 2\n8 10\n13 6\n12 11\n7 10\n4 10\n14 2\n5 4\n1 15\n15 2\n6 9\n8 11\n6 3\n2 8\n", "output": "43970290 310168785 806914186 501498951 950708909 272140427 335124893 168750835 31...
code_livecodebenchv6
263
[ { "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.\r\nRemo...
[ { "input": "atcoder\n", "output": "tcdr\n" }, { "input": "xyz\n", "output": "xyz\n" }, { "input": "aaaabbbbcccc\n", "output": "bbbbcccc\n" } ]
code_livecodebenchv6
264
[ { "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 AtCoderLand, a year consists of M months: month 1, mon...
[ { "input": "12\n31 28 31 30 31 30 31 31 30 31 30 31\n", "output": "7 2\n" }, { "input": "1\n1\n", "output": "1 1\n" }, { "input": "6\n3 1 4 1 5 9\n", "output": "5 3\n" } ]
code_livecodebenchv6
265
[ { "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 have N cups of ice cream.\r\nThe flavor and deliciousness of the i-th ...
[ { "input": "4\n1 4\n2 10\n2 8\n3 6\n", "output": "16\n" }, { "input": "4\n4 10\n3 2\n2 4\n4 12\n", "output": "17\n" } ]
code_livecodebenchv6
266
[ { "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 H \\times W cookies in H rows and W columns.\nThe color of the ...
[ { "input": "4 3\naaa\naaa\nabc\nabd\n", "output": "2\n" }, { "input": "2 5\naaaaa\nabcde\n", "output": "4\n" }, { "input": "3 3\nooo\nooo\nooo\n", "output": "0\n" } ]
code_livecodebenchv6
267
[ { "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 have N books numbered 1 to N.\r\nBook i assumes that you have read C_i...
[ { "input": "6\n3 2 3 4\n2 3 5\n0\n1 5\n0\n0\n", "output": "5 3 4 2\n" }, { "input": "6\n1 2\n1 3\n1 4\n1 5\n1 6\n0\n", "output": "6 5 4 3 2\n" }, { "input": "8\n1 5\n1 6\n1 7\n1 8\n0\n0\n0\n0\n", "output": "5\n" } ]
code_livecodebenchv6
268
[ { "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 race through checkpoints 1,2,\\dots,N in this order on a coord...
[ { "input": "6\n0 0\n1 1\n2 0\n0 1\n1 0\n2 1\n", "output": "5.82842712474619009753\n" }, { "input": "10\n1 8\n3 7\n9 4\n4 9\n6 1\n7 5\n0 0\n1 3\n6 8\n6 4\n", "output": "24.63441361516795872523\n" }, { "input": "10\n34 24\n47 60\n30 31\n12 97\n87 93\n64 46\n82 50\n14 7\n17 24\n3 78\n", ...
code_livecodebenchv6
269
[ { "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 likes full moons.\nLet today be day 1. The first day on or afte...
[ { "input": "13 3 5\n", "output": "3\n" }, { "input": "5 6 6\n", "output": "0\n" }, { "input": "200000 314 318\n", "output": "628\n" } ]
code_livecodebenchv6
270
[ { "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 rectangular sheets spread out on a coordinate plane.\nEach si...
[ { "input": "3\n0 5 1 3\n1 4 0 5\n2 5 2 4\n", "output": "20\n" }, { "input": "2\n0 100 0 100\n0 100 0 100\n", "output": "10000\n" }, { "input": "3\n0 1 0 1\n0 3 0 5\n5 10 0 10\n", "output": "65\n" } ]
code_livecodebenchv6
271
[ { "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 planning an N-day train trip.\nFor each day, he can pay the ...
[ { "input": "5 2 10\n7 1 6 3 6\n", "output": "20\n" }, { "input": "3 1 10\n1 2 3\n", "output": "6\n" }, { "input": "8 3 1000000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "3000000000\n" } ]
code_livecodebenchv6
272
[ { "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 complete graph with N vertices number...
[ { "input": "4\n1 5 4\n7 8\n6\n", "output": "13\n" }, { "input": "3\n1 2\n3\n", "output": "3\n" }, { "input": "16\n5 6 5 2 1 7 9 7 2 5 5 2 4 7 6\n8 7 7 9 8 1 9 6 10 8 8 6 10 3\n10 5 8 1 10 7 8 4 8 6 5 1 10\n7 4 1 4 5 4 5 10 1 5 1 2\n2 9 9 7 6 2 2 8 3 5 2\n9 10 3 1 1 2 10 7 7 5\n10 6 1 8 9...
code_livecodebenchv6
273
[ { "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 of length N: A=(A_1,A_2,\\l...
[ { "input": "5\n1 2 1 3 2\n", "output": "3\n" }, { "input": "7\n1 2 3 4 5 6 7\n", "output": "0\n" }, { "input": "13\n9 7 11 7 3 8 1 13 11 11 11 6 13\n", "output": "20\n" } ]
code_livecodebenchv6
274
[ { "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. Print a string of length (N+1), s_0s_...
[ { "input": "12\n", "output": "1-643-2-346-1\n" }, { "input": "7\n", "output": "17777771\n" }, { "input": "1\n", "output": "11\n" } ]
code_livecodebenchv6
275
[ { "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\\times3 grid with numbers between 1 and 9, inclusive, writte...
[ { "input": "3 1 9\n2 5 6\n2 7 1\n", "output": "0.666666666666666666666666666667\n" }, { "input": "7 7 6\n8 6 8\n7 7 6\n", "output": "0.004982363315696649029982363316\n" }, { "input": "3 6 7\n1 9 7\n5 7 5\n", "output": "0.4\n" } ]
code_livecodebenchv6
276
[ { "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 displaying a sentence with N words in a window.\r\nAll words...
[ { "input": "13 3\n9 5 2 7 1 8 8 2 1 5 2 3 6\n", "output": "26\n" }, { "input": "10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "10000000009\n" }, { "input": "30 8\n8 55 26 97 48 37 47 35 55 5 17 62 2 60 23...
code_livecodebenchv6
277
[ { "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 initially at his house and is about to visit Aoki's house.\n...
[ { "input": "4 2 3\n5 4\n6 6\n3 1\n7\n13\n0\n710511029\n136397527\n763027379\n644706927\n447672230\n", "output": "34\n22\n710511052\n136397548\n763027402\n644706946\n447672250\n" } ]
code_livecodebenchv6
278
[ { "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 A and B.\r\nPrint the value A^B+B^A.\n\nI...
[ { "input": "2 8\n", "output": "320\n" }, { "input": "9 9\n", "output": "774840978\n" }, { "input": "5 6\n", "output": "23401\n" } ]
code_livecodebenchv6
279
[ { "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.\r\nFind the maximum length of a contiguous subs...
[ { "input": "TOYOTA\n", "output": "5\n" }, { "input": "ABCDEFG\n", "output": "1\n" }, { "input": "AAAAAAAAAA\n", "output": "10\n" } ]
code_livecodebenchv6
280
[ { "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 is an easier version of Problem G.\n\nThere is a slot machin...
[ { "input": "10\n1937458062\n8124690357\n2385760149\n", "output": "6\n" }, { "input": "20\n01234567890123456789\n01234567890123456789\n01234567890123456789\n", "output": "20\n" }, { "input": "5\n11111\n22222\n33333\n", "output": "-1\n" } ]
code_livecodebenchv6
281
[ { "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 numbered 1 to N on a coordinate plane.\r\nPerson 1 is ...
[ { "input": "3 2\n1 2 2 1\n1 3 -1 -2\n", "output": "0 0\n2 1\n-1 -2\n" }, { "input": "3 2\n2 1 -2 -1\n2 3 -3 -3\n", "output": "0 0\n2 1\n-1 -2\n" }, { "input": "5 7\n1 2 0 0\n1 2 0 0\n2 3 0 0\n3 1 0 0\n2 1 0 0\n3 2 0 0\n4 5 0 0\n", "output": "0 0\n0 0\n0 0\nundecidable\nundecidable\n"...
code_livecodebenchv6
282
[ { "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 gathered for an event called Flowing Noodles. The peop...
[ { "input": "3 5\n1 1 3\n2 10 100\n4 100 10000\n10 1000 1000000000\n100 1000000000 1\n", "output": "101\n10\n1000\n" }, { "input": "3 1\n1 1 1\n", "output": "1\n0\n0\n" }, { "input": "1 8\n1 1 1\n2 2 2\n3 3 3\n4 4 4\n5 5 5\n6 6 6\n7 7 7\n8 8 8\n", "output": "15\n" } ]
code_livecodebenchv6
283
[ { "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 positive integer x is called a 321-like Number when it satisfies the fo...
[ { "input": "321\n", "output": "Yes\n" }, { "input": "123\n", "output": "No\n" }, { "input": "1\n", "output": "Yes\n" }, { "input": "86411\n", "output": "No\n" } ]
code_livecodebenchv6
284
[ { "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 exam structured as follows.\n\n- The exam consists of N round...
[ { "input": "5 180\n40 60 80 50\n", "output": "70\n" }, { "input": "3 100\n100 100\n", "output": "0\n" }, { "input": "5 200\n0 0 99 99\n", "output": "-1\n" }, { "input": "10 480\n59 98 88 54 70 24 8 94 46\n", "output": "45\n" } ]
code_livecodebenchv6
285
[ { "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 positive integer x is called a 321-like Number when it satisfies the fo...
[ { "input": "15\n", "output": "32\n" }, { "input": "321\n", "output": "9610\n" }, { "input": "777\n", "output": "983210\n" } ]
code_livecodebenchv6
286
[ { "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 offers N main dishes and M side dishes. The price of th...
[ { "input": "2 2 7\n3 5\n6 1\n", "output": "24\n" }, { "input": "1 3 2\n1\n1 1 1\n", "output": "6\n" }, { "input": "7 12 25514963\n2436426 24979445 61648772 23690081 33933447 76190629 62703497\n11047202 71407775 28894325 31963982 22804784 50968417 30302156 82631932 61735902 80895728 23078...
code_livecodebenchv6
287
[ { "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 tree with N vertices numbered 1 to N.\r\nFor each i\\ (2 \\leq...
[ { "input": "5\n10 2 0\n10 2 1\n10 2 2\n10 2 3\n10 2 4\n", "output": "1\n3\n4\n2\n0\n" }, { "input": "10\n822981260158260522 52 20\n760713016476190629 2314654 57\n1312150450968417 1132551176249851 7\n1000000000000000000 1083770654 79\n234122432773361868 170290518806790 23\n536187734191890310 61862 14...
code_livecodebenchv6
288
[ { "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 A, B, and C.\nFind the...
[ { "input": "8\nABABCABC\n", "output": "3\n" }, { "input": "3\nACB\n", "output": "-1\n" }, { "input": "20\nBBAAABBACAACABCBABAB\n", "output": "13\n" } ]
code_livecodebenchv6
289
[ { "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 consisting of lowercase English letters...
[ { "input": "3 7\nabc\nabcdefg\n", "output": "1\n" }, { "input": "3 4\nabc\naabc\n", "output": "2\n" }, { "input": "3 3\nabc\nxyz\n", "output": "3\n" }, { "input": "3 3\naaa\naaa\n", "output": "0\n" } ]
code_livecodebenchv6
290
[ { "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 Kingdom holds a festival for N days. On M of these days, name...
[ { "input": "3 2\n2 3\n", "output": "1\n0\n0\n" }, { "input": "8 5\n1 3 4 7 8\n", "output": "0\n1\n0\n0\n2\n1\n0\n0\n" } ]
code_livecodebenchv6
291
[ { "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 polyomino is a puzzle piece in the shape of a connected polygon made by...
[ { "input": "....\n###.\n.#..\n....\n....\n.###\n.##.\n....\n..#.\n.##.\n.##.\n.##.\n", "output": "Yes\n" }, { "input": "###.\n#.#.\n##..\n....\n....\n..#.\n....\n....\n####\n##..\n#...\n#...\n", "output": "Yes\n" }, { "input": "##..\n#..#\n####\n....\n....\n##..\n.##.\n....\n.#..\n.#..\n...
code_livecodebenchv6
292
[ { "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. is planning to develop a product. The product has K paramete...
[ { "input": "4 3 5\n5 3 0 2\n3 1 2 3\n3 2 4 0\n1 0 1 4\n", "output": "9\n" }, { "input": "7 3 5\n85 1 0 1\n37 1 1 0\n38 2 0 0\n45 0 2 2\n67 1 1 0\n12 2 2 0\n94 2 2 1\n", "output": "-1\n" } ]
code_livecodebenchv6
293
[ { "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 16 consisting of 0 and 1.\nIf the i-th...
[ { "input": "1001000000001010\n", "output": "No\n" }, { "input": "1010100000101000\n", "output": "Yes\n" }, { "input": "1111111111111111\n", "output": "No\n" } ]
code_livecodebenchv6
294
[ { "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 players numbered 1 to N, who have played a round-robin tourna...
[ { "input": "3\n-xx\no-x\noo-\n", "output": "3 2 1\n" }, { "input": "7\n-oxoxox\nx-xxxox\noo-xoox\nxoo-ooo\nooxx-ox\nxxxxx-x\noooxoo-\n", "output": "4 7 3 1 5 2 6\n" } ]
code_livecodebenchv6
295
[ { "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 programming contest World Tour Finals is underway, where N players ar...
[ { "input": "3 4\n1000 500 700 2000\nxxxo\nooxx\noxox\n", "output": "0\n1\n1\n" }, { "input": "5 5\n1000 1500 2000 2000 2500\nxxxxx\noxxxx\nxxxxx\noxxxx\noxxxx\n", "output": "1\n1\n1\n1\n0\n" }, { "input": "7 8\n500 500 500 500 500 500 500 500\nxxxxxxxx\noxxxxxxx\nooxxxxxx\noooxxxxx\noooo...
code_livecodebenchv6
296
[ { "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: \nInitially, there are N sizes of slimes.\nSpecifically, for each 1\\leq i\...
[ { "input": "3\n3 3\n5 1\n6 1\n", "output": "3\n" }, { "input": "3\n1 1\n2 1\n3 1\n", "output": "3\n" }, { "input": "1\n1000000000 1000000000\n", "output": "13\n" } ]
code_livecodebenchv6
297
[ { "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 a playlist with N songs.\nSong i (1 \\leq i \\leq N) lasts ...
[ { "input": "3 6\n3 5 6\n", "output": "369720131\n" }, { "input": "5 0\n1 2 1 2 1\n", "output": "598946612\n" }, { "input": "5 10000\n1 2 3 4 5\n", "output": "586965467\n" } ]
code_livecodebenchv6
298
[ { "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.\nIf their values are ...
[ { "input": "3\n3 2 4\n", "output": "No\n" }, { "input": "4\n3 3 3 3\n", "output": "Yes\n" }, { "input": "10\n73 8 55 26 97 48 37 47 35 55\n", "output": "No\n" } ]
code_livecodebenchv6
299