prompt
listlengths
1
1
query
stringlengths
578
3.33k
constraints
listlengths
10
10
data_source
stringclasses
1 value
extra_info
dict
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nStrings s1 and s2 are k-similar (for some non-negative integer k) if we ca...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Strings s1 and s2 are k-similar (for some non-negative integer k) if we can swap the positions of two letters in s1 exa...
[ "assert candidate(s1='aabbccddeeff', s2='ffeeddccbaab') == 7", "assert candidate(s1='abcbca', s2='bcbaca') == 2", "assert candidate(s1='abcdefg', s2='gfedcba') == 3", "assert candidate(s1='abcabc', s2='cbabac') == 2", "assert candidate(s1='abcdefabc', s2='cbadefabc') == 1", "assert candidate(s1='aabbcc', ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s1='aabbccddeeff', s2='ffeeddccbaab') == 7", "assert candidate(s1='abcbca', s2='bcbaca') == 2", "assert candidate(s1='abcdefg', s2='gfedcba') == 3", "assert candidate(s1='abcabc', s2='cbabac') == 2", "assert candidate(s1='abcdefabc', s2='cbadefabc') == 1", ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 balanced parentheses string s, return the score of the string.\nTh...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given a balanced parentheses string s, return the score of the string. The score of a balanced parentheses string is ba...
[ "assert candidate(s='((()()()))') == 12", "assert candidate(s='()(())(())') == 5", "assert candidate(s='()(())') == 3", "assert candidate(s='()()') == 2", "assert candidate(s='(()(())(()))') == 10", "assert candidate(s='(()())(()())') == 8", "assert candidate(s='(()(()()(())))') == 18", "assert candid...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='((()()()))') == 12", "assert candidate(s='()(())(())') == 5", "assert candidate(s='()(())') == 3", "assert candidate(s='()()') == 2", "assert candidate(s='(()(())(()))') == 10", "assert candidate(s='(()())(()())') == 8", "assert candidate(s='(()(()()...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 workers. You are given two integer arrays quality and wage whe...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worke...
[ "assert candidate(quality=[20, 30, 10, 40, 50], wage=[100, 150, 50, 200, 250], k=4) == 500.0", "assert candidate(quality=[3, 6, 15, 20, 12], wage=[9, 18, 45, 60, 36], k=3) == 63.0", "assert candidate(quality=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], wage=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(quality=[20, 30, 10, 40, 50], wage=[100, 150, 50, 200, 250], k=4) == 500.0", "assert candidate(quality=[3, 6, 15, 20, 12], wage=[9, 18, 45, 60, 36], k=3) == 63.0", "assert candidate(quality=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], wage=[10, 20, 30, 40, 50, 60, 70...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 special square room with mirrors on each of the four walls. Exc...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are recep...
[ "assert candidate(p=1000, q=333) == 2", "assert candidate(p=500, q=200) == 0", "assert candidate(p=20, q=3) == 2", "assert candidate(p=97, q=42) == 0", "assert candidate(p=997, q=333) == 1", "assert candidate(p=75, q=33) == 1", "assert candidate(p=500, q=125) == 2", "assert candidate(p=500, q=450) == ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(p=1000, q=333) == 2", "assert candidate(p=500, q=200) == 0", "assert candidate(p=20, q=3) == 2", "assert candidate(p=97, q=42) == 0", "assert candidate(p=997, q=333) == 1", "assert candidate(p=75, q=33) == 1", "assert candidate(p=500, q=125) == 2", ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n binary matrix grid.\nA move consists of choosing an...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an m x n binary matrix grid. A move consists of choosing any row or column and toggling each value in tha...
[ "assert candidate(grid=[[1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 418", "assert candidate(grid=[[1, 1, 1, 0, 1], [0, 0, 0, 0, 1], [1, 1, 0, 1, 1], [0, 0, 1, 0, 0]]) == 113", "assert candidate(grid=[[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1], ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[[1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 418", "assert candidate(grid=[[1, 1, 1, 0, 1], [0, 0, 0, 0, 1], [1, 1, 0, 1, 1], [0, 0, 1, 0, 0]]) == 113", "assert candidate(grid=[[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0,...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums and an integer k, return the length of the sho...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum o...
[ "assert candidate(nums=[100, -25, 25, -25, 25, -25, 25, -25, 25], k=50) == 1", "assert candidate(nums=[-1, 2], k=2) == 1", "assert candidate(nums=[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10], k=-15) == 1", "assert candidate(nums=[10, 20, -30, 40, 50, -60, 70, -80], k=150) == -1", "assert candidate(nums=[2, -2,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[100, -25, 25, -25, 25, -25, 25, -25, 25], k=50) == 1", "assert candidate(nums=[-1, 2], k=2) == 1", "assert candidate(nums=[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10], k=-15) == 1", "assert candidate(nums=[10, 20, -30, 40, 50, -60, 70, -80], k=150) == -1", "...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n grid grid where:\n\n'.' is an empty cell.\n'#' is a...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an m x n grid grid where: '.' is an empty cell. '#' is a wall. '@' is the starting point. Lowercase lett...
[ "assert candidate(grid=['@.aBc', '###D.', 'E...F', 'G#b.H', '....I']) == -1", "assert candidate(grid=['@...a', '.#.b.', '....A', '#..B.', '....b', 'c...#', '...C.']) == -1", "assert candidate(grid=['@...a', '###.#', 'b.A.B', '###.#', '....b', 'C...c', 'D...d', 'E...e', 'F...f']) == -1", "assert candidate(grid...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=['@.aBc', '###D.', 'E...F', 'G#b.H', '....I']) == -1", "assert candidate(grid=['@...a', '.#.b.', '....A', '#..B.', '....b', 'c...#', '...C.']) == -1", "assert candidate(grid=['@...a', '###.#', 'b.A.B', '###.#', '....b', 'C...c', 'D...d', 'E...e', 'F...f']) == -1",...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the root of a binary tree, the depth of each node is the shortest di...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given the root of a binary tree, the depth of each node is the shortest distance to the root. Return the smallest subtr...
[ "assert is_same_tree(candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14])), tree_node([14]))", "assert is_same_tree(candidate(root=tree_node([0, 1, 3, None, 2, None, None, None, 4, None, None, None, None, None, None, None, 5])), tree_node([4]))", "assert is_sam...
newfacade/LeetCodeDataset
{ "constraints": [ "assert is_same_tree(candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, None, 14])), tree_node([14]))", "assert is_same_tree(candidate(root=tree_node([0, 1, 3, None, 2, None, None, None, 4, None, None, None, None, None, None, None, 5])), tree_node([...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer n, return the smallest prime palindrome greater than or e...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer n, return the smallest prime palindrome greater than or equal to n. An integer is prime if it has exac...
[ "assert candidate(n=6) == 7", "assert candidate(n=100) == 101", "assert candidate(n=100003) == 1003001", "assert candidate(n=989) == 10301", "assert candidate(n=9999) == 10301", "assert candidate(n=1000003) == 1003001", "assert candidate(n=10) == 11", "assert candidate(n=99999999) == 100030001", "as...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=6) == 7", "assert candidate(n=100) == 101", "assert candidate(n=100003) == 1003001", "assert candidate(n=989) == 10301", "assert candidate(n=9999) == 10301", "assert candidate(n=1000003) == 1003001", "assert candidate(n=10) == 11", "assert candida...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 integer arrays nums1 and nums2 both of the same length. ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given two integer arrays nums1 and nums2 both of the same length. The advantage of nums1 with respect to nums2 ...
[ "assert candidate(nums1=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], nums2=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]", "assert candidate(nums1=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10], nums2=[95, 85, 75, 65, 55, 45, 35, 25, 15, 5]) == [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]", "assert candidate(num...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums1=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], nums2=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]", "assert candidate(nums1=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10], nums2=[95, 85, 75, 65, 55, 45, 35, 25, 15, 5]) == [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]", ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 car travels from a starting position to a destination which is target mi...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A car travels from a starting position to a destination which is target miles east of the starting position. There are ...
[ "assert candidate(target=1000, startFuel=1, stations=[[10, 100], [20, 200], [30, 300], [40, 400], [50, 500], [60, 600], [70, 700], [80, 800], [90, 900]]) == -1", "assert candidate(target=100, startFuel=90, stations=[[10, 10], [20, 10], [30, 10], [40, 10], [50, 10], [60, 10], [70, 10], [80, 10], [90, 10]]) == 1", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(target=1000, startFuel=1, stations=[[10, 100], [20, 200], [30, 300], [40, 400], [50, 500], [60, 600], [70, 700], [80, 800], [90, 900]]) == -1", "assert candidate(target=100, startFuel=90, stations=[[10, 10], [20, 10], [30, 10], [40, 10], [50, 10], [60, 10], [70, 10], [80, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 robot on an infinite XY-plane starts at point (0, 0) facing north. The r...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot receives an array of integers commands, ...
[ "assert candidate(commands=[8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8], obstacles=[[-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 145", "assert candidate(commands=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(commands=[8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8, -1, 8], obstacles=[[-5, -5], [-4, -4], [-3, -3], [-2, -2], [-1, -1], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 145", "assert candidate(commands=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 5, 5, 5, 5, 5, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nAlice and Bob play a game with piles of stones. There are an even number o...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Alice and Bob play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has ...
[ "assert candidate(piles=[3, 7, 2, 3]) == True", "assert candidate(piles=[10, 20, 30, 40, 50, 60, 70, 80]) == True", "assert candidate(piles=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == True", "assert candidate(piles=[8, 6, 5, 1, 7, 9]) == True", "assert candidate(pil...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(piles=[3, 7, 2, 3]) == True", "assert candidate(piles=[10, 20, 30, 40, 50, 60, 70, 80]) == True", "assert candidate(piles=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == True", "assert candidate(piles=[8, 6, 5, 1, 7, 9]) == Tru...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 group of n members, and a list of various crimes they could com...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There is a group of n members, and a list of various crimes they could commit. The ith crime generates a profit[i] and ...
[ "assert candidate(n=4, minProfit=4, group=[4], profit=[5]) == 1", "assert candidate(n=95, minProfit=55, group=[8, 16, 24, 32, 40, 48, 56, 64, 72, 80], profit=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 11", "assert candidate(n=100, minProfit=80, group=[10, 20, 30, 40, 50, 60, 70, 80, 90, 10], profit=[5, 15, 25,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=4, minProfit=4, group=[4], profit=[5]) == 1", "assert candidate(n=95, minProfit=55, group=[8, 16, 24, 32, 40, 48, 56, 64, 72, 80], profit=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50]) == 11", "assert candidate(n=100, minProfit=80, group=[10, 20, 30, 40, 50, 60, 70, 80, 90...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 encoded string s. To decode the string to a tape, the enc...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time a...
[ "assert candidate(s='xyz2abc3def4', k=85) == 'a'", "assert candidate(s='z9y8x7w6v5u4t3s2r1', k=362880) == 'z'", "assert candidate(s='abc2def3ghi4', k=60) == 'i'", "assert candidate(s='abc3def2ghi4', k=40) == 'a'", "assert candidate(s='a2b3c4', k=10) == 'c'", "assert candidate(s='abcdefg8', k=1000000000) =...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='xyz2abc3def4', k=85) == 'a'", "assert candidate(s='z9y8x7w6v5u4t3s2r1', k=362880) == 'z'", "assert candidate(s='abc2def3ghi4', k=60) == 'i'", "assert candidate(s='abc3def2ghi4', k=40) == 'a'", "assert candidate(s='a2b3c4', k=10) == 'c'", "assert candidat...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array people where people[i] is the weight of the ith per...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where ea...
[ "assert candidate(people=[1, 1, 2, 2, 3, 3], limit=4) == 3", "assert candidate(people=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], limit=30) == 16", "assert candidate(people=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], limit=10) == 8", "...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(people=[1, 1, 2, 2, 3, 3], limit=4) == 3", "assert candidate(people=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], limit=30) == 16", "assert candidate(people=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 (the \"original graph\") with n nodes la...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an undirected graph (the "original graph") with n nodes labeled from 0 to n - 1. You decide to subdivide ...
[ "assert candidate(edges=[[0, 1, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 0, 10]], maxMoves=50, n=10) == 101", "assert candidate(edges=[[0, 1, 3], [0, 2, 2], [1, 2, 1]], maxMoves=5, n=3) == 9", "assert candidate(edges=[[0, 1, 5], [1, 2, 5], [2, 3, 5...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(edges=[[0, 1, 10], [1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6, 7, 10], [7, 8, 10], [8, 9, 10], [9, 0, 10]], maxMoves=50, n=10) == 101", "assert candidate(edges=[[0, 1, 3], [0, 2, 2], [1, 2, 1]], maxMoves=5, n=3) == 9", "assert candidate(edges=[[0, 1...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 want to split a group of n people (labeled from 1 to n) into two groups...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some ot...
[ "assert candidate(n=8, dislikes=[[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6], [3, 7], [4, 8]]) == True", "assert candidate(n=3, dislikes=[[1, 2], [1, 3], [2, 3]]) == False", "assert candidate(n=1, dislikes=[]) == True", "assert candidate(n=7, dislikes=[[1, 2], [1, 3], [2, 4]...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=8, dislikes=[[1, 2], [3, 4], [5, 6], [7, 8], [1, 3], [2, 4], [5, 7], [6, 8], [1, 5], [2, 6], [3, 7], [4, 8]]) == True", "assert candidate(n=3, dislikes=[[1, 2], [1, 3], [2, 3]]) == False", "assert candidate(n=1, dislikes=[]) == True", "assert candidate(n=7, disli...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 k identical eggs and you have access to a building with n fl...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given k identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there...
[ "assert candidate(k=50, n=7000) == 13", "assert candidate(k=7, n=5000) == 13", "assert candidate(k=10, n=1000) == 10", "assert candidate(k=90, n=9000) == 14", "assert candidate(k=50, n=5000) == 13", "assert candidate(k=4, n=20) == 5", "assert candidate(k=3, n=1234) == 20", "assert candidate(k=50, n=75...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(k=50, n=7000) == 13", "assert candidate(k=7, n=5000) == 13", "assert candidate(k=10, n=1000) == 10", "assert candidate(k=90, n=9000) == 14", "assert candidate(k=50, n=5000) == 13", "assert candidate(k=4, n=20) == 5", "assert candidate(k=3, n=1234) == 20...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 width of a sequence is the difference between the maximum and minimum ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: The width of a sequence is the difference between the maximum and minimum elements in the sequence. Given an array of i...
[ "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 393234", "assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == 713034816", "assert candidate(nums=[2, 1, 3]) == 6", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 393234", "assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20]) == 713034816", "assert candidate...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of strings of the same length words.\nIn one move, ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of strings of the same length words. In one move, you can swap any two even indexed characters o...
[ "assert candidate(words=['abcdefg', 'gfedcba', 'cdabefg', 'efgabcd', 'fedcbag', 'bacdefg']) == 4", "assert candidate(words=['abcdef', 'bacdef', 'cbadef', 'defabc', 'fedcba', 'efdcba', 'fabced']) == 5", "assert candidate(words=['abcde', 'edcba', 'acebd', 'decab', 'bdeca', 'cabed']) == 4", "assert candidate(wor...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(words=['abcdefg', 'gfedcba', 'cdabefg', 'efgabcd', 'fedcbag', 'bacdefg']) == 4", "assert candidate(words=['abcdef', 'bacdef', 'cbadef', 'defabc', 'fedcba', 'efdcba', 'fabced']) == 5", "assert candidate(words=['abcde', 'edcba', 'acebd', 'decab', 'bdeca', 'cabed']) == 4"...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array arr, return the number of distinct bitwise ORs of a...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array arr, return the number of distinct bitwise ORs of all the non-empty subarrays of arr. The bitwis...
[ "assert candidate(arr=[1, 3, 7, 15, 31, 63, 127, 255]) == 8", "assert candidate(arr=[2, 1, 0, 3, 2]) == 4", "assert candidate(arr=[8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == 55", "assert candidate(arr=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]) == 78", "assert candidate(arr=[10, 20, 30, 40...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[1, 3, 7, 15, 31, 63, 127, 255]) == 8", "assert candidate(arr=[2, 1, 0, 3, 2]) == 4", "assert candidate(arr=[8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]) == 55", "assert candidate(arr=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]) == 78", "assert ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s and an integer k. You can choose one of the first...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given a string s and an integer k. You can choose one of the first k letters of s and append it at the end of t...
[ "assert candidate(s='pqrsqponmlkjihgfedcba', k=1) == 'apqrsqponmlkjihgfedcb'", "assert candidate(s='leetcodeleetcode', k=5) == 'ccddeeeeeelloott'", "assert candidate(s='zyx', k=1) == 'xzy'", "assert candidate(s='aaaabbbb', k=1) == 'aaaabbbb'", "assert candidate(s='xyzxyzxyz', k=3) == 'xxxyyyzzz'", "assert...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='pqrsqponmlkjihgfedcba', k=1) == 'apqrsqponmlkjihgfedcb'", "assert candidate(s='leetcodeleetcode', k=5) == 'ccddeeeeeelloott'", "assert candidate(s='zyx', k=1) == 'xzy'", "assert candidate(s='aaaabbbb', k=1) == 'aaaabbbb'", "assert candidate(s='xyzxyzxyz', k=...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 where s[i] is either:\n\n'D' means de...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given a string s of length n where s[i] is either: 'D' means decreasing, or 'I' means increasing. A permutati...
[ "assert candidate(s='IDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDD') == 211646917", "assert candidate(s='DDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIII') == 553551576", "assert candidate(s='IDID') == 16", "assert candidate(s='IIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIIDIIIIID') ==...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='IDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDD') == 211646917", "assert candidate(s='DDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIIIDDDDDIIIII') == 553551576", "assert candidate(s='IDID') == 16", "assert candidate(s='IIIIIDIIIIIDIIIIIDIIIIIDIIIIIDII...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 visiting a farm that has a single row of fruit trees arranged from...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by ...
[ "assert candidate(fruits=[0, 0, 0, 0, 0]) == 5", "assert candidate(fruits=[1, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 1]) == 9", "assert candidate(fruits=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 10", "assert candidate(fruits=[1, 2, 1, 2, 1, 3, 3, 3, 2, 2, 2, 1, 1, 1, 2, 2, 2]) == 9", "assert cand...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(fruits=[0, 0, 0, 0, 0]) == 5", "assert candidate(fruits=[1, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 1]) == 9", "assert candidate(fruits=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 10", "assert candidate(fruits=[1, 2, 1, 2, 1, 3, 3, 3, 2, 2, 2, 1, 1, 1, 2, 2...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nLet's say a positive integer is a super-palindrome if it is a palindrome, ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome. Gi...
[ "assert candidate(left='484', right='576') == 1", "assert candidate(left='123', right='123456789012345678') == 66", "assert candidate(left='80000000000', right='90000000000') == 0", "assert candidate(left='888888888888888888', right='999999999999999999') == 0", "assert candidate(left='111111111', right='222...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(left='484', right='576') == 1", "assert candidate(left='123', right='123456789012345678') == 66", "assert candidate(left='80000000000', right='90000000000') == 0", "assert candidate(left='888888888888888888', right='999999999999999999') == 0", "assert candidate...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of integers arr, find the sum of min(b), where b ranges ove...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since t...
[ "assert candidate(arr=[2, 4, 2, 6, 2, 8, 2, 10]) == 92", "assert candidate(arr=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 22000", "assert candidate(arr=[10, 20, 10, 30, 10, 40, 10, 50, 10, 60]) == 700", "assert candidate(arr=[1, 3, 5, 2, 4, 6]) == 49", "assert candidate(arr=[1, 3, 5, 7, 9, 11, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[2, 4, 2, 6, 2, 8, 2, 10]) == 92", "assert candidate(arr=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 22000", "assert candidate(arr=[10, 20, 10, 30, 10, 40, 10, 50, 10, 60]) == 700", "assert candidate(arr=[1, 3, 5, 2, 4, 6]) == 49", "assert candi...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums and an integer k.\nFor each index i wh...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an integer array nums and an integer k. For each index i where 0 <= i < nums.length, change nums[i] to be...
[ "assert candidate(nums=[1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000], k=100) == 0", "assert candidate(nums=[2, 5, 1, 8, 9, 10, 11, 12, 15, 20], k=5) == 9", "assert candidate(nums=[500, 1000, 1500, 2000, 2500, 3000], k=300) == 1900", "assert candidate(nums=[4, 9, 6], k=2) == 2", "assert candid...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000], k=100) == 0", "assert candidate(nums=[2, 5, 1, 8, 9, 10, 11, 12, 15, 20], k=5) == 9", "assert candidate(nums=[500, 1000, 1500, 2000, 2500, 3000], k=300) == 1900", "assert candidate(nums=[4, 9, 6], k...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 game on an undirected graph is played by two players, Mouse and Cat, who...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follo...
[ "assert candidate(graph=[[1, 2], [0], [0]]) == 1", "assert candidate(graph=[[1, 2, 3, 4], [0, 2, 3, 5], [0, 1, 3, 4, 5, 6, 7], [0, 1, 2, 4, 5, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 3, 4, 6, 7], [2, 4, 5, 7], [2, 4, 5, 6]]) == 1", "assert candidate(graph=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 2, 11, 12, 13, 14, 15...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(graph=[[1, 2], [0], [0]]) == 1", "assert candidate(graph=[[1, 2, 3, 4], [0, 2, 3, 5], [0, 1, 3, 4, 5, 6, 7], [0, 1, 2, 4, 5, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 3, 4, 6, 7], [2, 4, 5, 7], [2, 4, 5, 6]]) == 1", "assert candidate(graph=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums, partition it into two (contiguous) subarrays ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array nums, partition it into two (contiguous) subarrays left and right so that: Every element in lef...
[ "assert candidate(nums=[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 31", "assert candidate(nums=[5, 1, 4, 3, 2, 6, 7, 8, 10, 9]) == 5", "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == 15", "assert candidate(nums...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 31", "assert candidate(nums=[5, 1, 4, 3, 2, 6, 7, 8, 10, 9]) == 5", "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]) == 15",...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 string arrays words1 and words2.\nA string b is a subset...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given two string arrays words1 and words2. A string b is a subset of string a if every letter in b occurs in a ...
[ "assert candidate(words1=['aaaaa', 'bbbbbb', 'cccccc', 'dddddddd', 'eeeeeeee'], words2=['aa', 'bb', 'cc', 'dd', 'ee', 'abcd']) == []", "assert candidate(words1=['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz'], words2=['xyz', 'zyx', 'aaa', 'zzz', ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(words1=['aaaaa', 'bbbbbb', 'cccccc', 'dddddddd', 'eeeeeeee'], words2=['aa', 'bb', 'cc', 'dd', 'ee', 'abcd']) == []", "assert candidate(words1=['abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba', 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz'], words2=['xyz'...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 circular integer array nums of length n, return the maximum possib...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given a circular integer array nums of length n, return the maximum possible sum of a non-empty subarray of nums. A cir...
[ "assert candidate(nums=[-5, 1, 5, 0, -7, 3, -1, 2]) == 6", "assert candidate(nums=[8, -1, 3, 4, -2, -3, 6, 1]) == 21", "assert candidate(nums=[10, -2, 5, 1, -4, 3, -1]) == 16", "assert candidate(nums=[1, -10, 3, 4, -5, 2, 6, -1, 4]) == 14", "assert candidate(nums=[9, -4, 7, 3, -2]) == 17", "assert candida...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[-5, 1, 5, 0, -7, 3, -1, 2]) == 6", "assert candidate(nums=[8, -1, 3, 4, -2, -3, 6, 1]) == 21", "assert candidate(nums=[10, -2, 5, 1, -4, 3, -1]) == 16", "assert candidate(nums=[1, -10, 3, 4, -5, 2, 6, -1, 4]) == 14", "assert candidate(nums=[9, -4, 7, 3, -...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 music player contains n different songs. You want to listen to goal s...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your ...
[ "assert candidate(n=40, goal=50, k=20) == 73692427", "assert candidate(n=50, goal=75, k=30) == 167112607", "assert candidate(n=25, goal=35, k=12) == 371031271", "assert candidate(n=3, goal=4, k=1) == 18", "assert candidate(n=1, goal=1, k=0) == 1", "assert candidate(n=30, goal=40, k=15) == 213845140", "a...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=40, goal=50, k=20) == 73692427", "assert candidate(n=50, goal=75, k=30) == 167112607", "assert candidate(n=25, goal=35, k=12) == 371031271", "assert candidate(n=3, goal=4, k=1) == 18", "assert candidate(n=1, goal=1, k=0) == 1", "assert candidate(n=30, goa...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 parentheses string is valid if and only if:\n\nIt is the empty string,\n...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B),...
[ "assert candidate(s='(()())((()))') == 0", "assert candidate(s='(()(()))()()(()(()()()(()())())') == 1", "assert candidate(s='())') == 1", "assert candidate(s='(()()(()))(()(()(()))(()(()))))') == 1", "assert candidate(s='()))(((((()))))())') == 2", "assert candidate(s=')(()))()()') == 2", "assert candi...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='(()())((()))') == 0", "assert candidate(s='(()(()))()()(()(()()()(()())())') == 1", "assert candidate(s='())') == 1", "assert candidate(s='(()()(()))(()(()(()))(()(()))))') == 1", "assert candidate(s='()))(((((()))))())') == 2", "assert candidate(s=')(()...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array arr, and an integer target, return the number of tu...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] +...
[ "assert candidate(arr=[0, 0, 0], target=0) == 1", "assert candidate(arr=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], target=150) == 10", "assert candidate(arr=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10], target=20) == 210", "assert candidate(arr=[1, 1, 2, 2, 2, 3, 3, 3, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[0, 0, 0], target=0) == 1", "assert candidate(arr=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], target=150) == 10", "assert candidate(arr=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10], target=20) == 210", "assert candidate(ar...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 network of n nodes represented as an n x n adjacency matri...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given a network of n nodes represented as an n x n adjacency matrix graph, where the ith node is directly conne...
[ "assert candidate(graph=[[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]], initial=[1, 3, 5, 7]) == 1", "assert candidate(graph=[[1, 0, 0, 0], [0, 1, 0, 0]...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(graph=[[1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1]], initial=[1, 3, 5, 7]) == 1", "assert candidate(graph=[[1,...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 binary string is monotone increasing if it consists of some number of 0'...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A binary string is monotone increasing if it consists of some number of 0's (possibly none), followed by some number of...
[ "assert candidate(s='1100010100111001') == 6", "assert candidate(s='101010101010101010101010') == 12", "assert candidate(s='1111111111100000000000000000') == 11", "assert candidate(s='00001111110000111111000011') == 8", "assert candidate(s='01010101010101') == 6", "assert candidate(s='11111111111111110000...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='1100010100111001') == 6", "assert candidate(s='101010101010101010101010') == 12", "assert candidate(s='1111111111100000000000000000') == 11", "assert candidate(s='00001111110000111111000011') == 8", "assert candidate(s='01010101010101') == 6", "assert ca...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array arr which consists of only zeros and ones, divide t...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array arr which consists of only zeros and ones, divide the array into three non-empty parts such that...
[ "assert candidate(arr=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]", "assert candidate(arr=[0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]) == [-1, -1]", "assert candidate(arr=[0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) ==...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == [-1, -1]", "assert candidate(arr=[0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]) == [-1, -1]", "assert candidate(arr=[0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0,...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 network of n nodes represented as an n x n adjacency matri...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given a network of n nodes represented as an n x n adjacency matrix graph, where the ith node is directly conne...
[ "assert candidate(graph=[[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]], initial=[0, 1, 5]) == 0", "assert candidate(graph=[[1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 1], [0, 1, 1, 0, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(graph=[[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1]], initial=[0, 1, 5]) == 0", "assert candidate(graph=[[1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 binary array nums and an integer goal, return the number of non-em...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal. A subarray is ...
[ "assert candidate(nums=[0, 1, 1, 0, 0, 1], goal=2) == 7", "assert candidate(nums=[0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], goal=5) == 45", "assert candidate(nums=[1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1], goal=4) == 19", "assert candidate(nums=[1, 1, 1, 1,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[0, 1, 1, 0, 0, 1], goal=2) == 7", "assert candidate(nums=[0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], goal=5) == 45", "assert candidate(nums=[1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1], goal=4) == 19", "assert ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an n x n array of integers matrix, return the minimum sum of any fal...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix. A falling path star...
[ "assert candidate(matrix=[[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == -18", "assert candidate(matrix=[[-50, -40, -30, -20, -10], [-10, 0, 10, 20, 30], [30, 20, 10, 0, -10], [-10, -20, -30, -40, -50], [50, 40, 30, 20, 10]]) == -70", "assert candidate(matrix=[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(matrix=[[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == -18", "assert candidate(matrix=[[-50, -40, -30, -20, -10], [-10, 0, 10, 20, 30], [30, 20, 10, 0, -10], [-10, -20, -30, -40, -50], [50, 40, 30, 20, 10]]) == -70", "assert candidate(matrix=[[1, 2, 3, 4], [5, 6, 7, 8],...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 x n binary matrix grid where 1 represents land and 0 re...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an n x n binary matrix grid where 1 represents land and 0 represents water. An island is a 4-directionall...
[ "assert candidate(grid=[[1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 4", "assert candidate(grid=[[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 3", "assert candidate(grid=[[1, 0, 0, 0, 0, 0, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[[1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 4", "assert candidate(grid=[[1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]) == 3", "assert candidate(...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 chess knight has a unique movement, it may move two squares vertically...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: The chess knight has a unique movement, it may move two squares vertically and one square horizontally, or two squares ...
[ "assert candidate(n=2) == 20", "assert candidate(n=1600) == 585618181", "assert candidate(n=4999) == 659158877", "assert candidate(n=4750) == 955420830", "assert candidate(n=2500) == 851996060", "assert candidate(n=100) == 540641702", "assert candidate(n=50) == 267287516", "assert candidate(n=3131) ==...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=2) == 20", "assert candidate(n=1600) == 585618181", "assert candidate(n=4999) == 659158877", "assert candidate(n=4750) == 955420830", "assert candidate(n=2500) == 851996060", "assert candidate(n=100) == 540641702", "assert candidate(n=50) == 267287516...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 stamp and target. Initially, there is a string s...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given two strings stamp and target. Initially, there is a string s of length target.length with all s[i] == '?'...
[ "assert candidate(stamp='abc', target='?????') == []", "assert candidate(stamp='abcdefg', target='abcdefgabcdefgabcdefgabcdefg') == [20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 6, 5, 4, 3, 2, 1, 21, 14, 7, 0]", "assert candidate(stamp='mnopqr', target='mnopqrnopqrmonpqrnonqrmpnoqrmnoprqmnopqr') == []", "ass...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(stamp='abc', target='?????') == []", "assert candidate(stamp='abcdefg', target='abcdefgabcdefgabcdefgabcdefg') == [20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 6, 5, 4, 3, 2, 1, 21, 14, 7, 0]", "assert candidate(stamp='mnopqr', target='mnopqrnopqrmonpqrnonqrmpnoqrmnop...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of logs. Each log is a space-delimited string of wo...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. ...
[ "assert candidate(logs=['d1 5 6 7', 'c1 abc def', 'd2 4 3 2', 'c2 abc def ghi', 'd3 1 2 3', 'c3 abc def', 'c4 xyz']) == ['c1 abc def', 'c3 abc def', 'c2 abc def ghi', 'c4 xyz', 'd1 5 6 7', 'd2 4 3 2', 'd3 1 2 3']", "assert candidate(logs=['x1 abc def', 'x2 abc', 'x3 def', 'x4 def', 'x5 abc', 'x6 def', 'x7 def', '...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(logs=['d1 5 6 7', 'c1 abc def', 'd2 4 3 2', 'c2 abc def ghi', 'd3 1 2 3', 'c3 abc def', 'c4 xyz']) == ['c1 abc def', 'c3 abc def', 'c2 abc def ghi', 'c4 xyz', 'd1 5 6 7', 'd2 4 3 2', 'd3 1 2 3']", "assert candidate(logs=['x1 abc def', 'x2 abc', 'x3 def', 'x4 def', 'x5 abc'...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of points in the X-Y plane points where points[i] =...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of points in the X-Y plane points where points[i] = [xi, yi]. Return the minimum area of a recta...
[ "assert candidate(points=[[0, 0], [0, 15], [15, 0], [15, 15], [5, 5], [5, 10], [10, 5], [10, 10], [3, 3], [3, 12], [12, 3], [12, 12]]) == 25", "assert candidate(points=[[5, 5], [5, 8], [8, 5], [8, 8], [10, 10], [10, 15], [15, 10], [15, 15], [3, 3], [3, 6], [6, 3], [6, 6]]) == 9", "assert candidate(points=[[1, 2...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(points=[[0, 0], [0, 15], [15, 0], [15, 15], [5, 5], [5, 10], [10, 5], [10, 10], [3, 3], [3, 12], [12, 3], [12, 12]]) == 25", "assert candidate(points=[[5, 5], [5, 8], [8, 5], [8, 8], [10, 10], [10, 15], [15, 10], [15, 15], [3, 3], [3, 6], [6, 3], [6, 6]]) == 9", "asser...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of strings words, return the smallest string that contains ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an array of strings words, return the smallest string that contains each string in words as a substring. If there...
[ "assert candidate(words=['abcdefgh', 'ghijklmn', 'mnopqrst', 'rstuvwxy', 'xyzabcde']) == 'ghijklmnopqrstuvwxyzabcdefgh'", "assert candidate(words=['aabb', 'bbcc', 'ccdd', 'ddee', 'eeff', 'ffgg', 'ggaa', 'aacc', 'ccbb', 'ddeeff', 'ffggaa', 'aabbcc']) == 'aaccddeeffggaabbccbb'", "assert candidate(words=['abcdef',...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(words=['abcdefgh', 'ghijklmn', 'mnopqrst', 'rstuvwxy', 'xyzabcde']) == 'ghijklmnopqrstuvwxyzabcdefgh'", "assert candidate(words=['aabb', 'bbcc', 'ccdd', 'ddee', 'eeff', 'ffgg', 'ggaa', 'aacc', 'ccbb', 'ddeeff', 'ffggaa', 'aabbcc']) == 'aaccddeeffggaabbccbb'", "assert c...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums. In one move, you can pick an index i ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums...
[ "assert candidate(nums=[5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11]) == 163", "assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0", "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1]) == 21", "assert candidate(nums=[100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105]) == 36", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11]) == 163", "assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 0", "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1]) == 21", "assert candidate(nums=[100, 100, 101, 101, 102, 102, 103, 103, 104...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 two integer arrays pushed and popped each with distinct values, retu...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of...
[ "assert candidate(pushed=[5, 1, 2, 4, 3], popped=[5, 3, 4, 2, 1]) == True", "assert candidate(pushed=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], popped=[1, 3, 2, 5, 4, 8, 7, 6, 10, 9]) == True", "assert candidate(pushed=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], popped=[30, 20, 40, 60, 50, 100, 90, 80, 70, 10]) == True", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(pushed=[5, 1, 2, 4, 3], popped=[5, 3, 4, 2, 1]) == True", "assert candidate(pushed=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], popped=[1, 3, 2, 5, 4, 8, 7, 6, 10, 9]) == True", "assert candidate(pushed=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], popped=[30, 20, 40, 60, 50, 100, 90...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 2D plane, we place n stones at some integer coordinate points. Each c...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: On a 2D plane, we place n stones at some integer coordinate points. Each coordinate point may have at most one stone. A...
[ "assert candidate(stones=[[1, 1], [2, 2], [3, 3], [4, 4], [1, 2], [2, 3], [3, 4], [4, 5], [1, 3], [2, 4], [3, 5], [4, 6]]) == 11", "assert candidate(stones=[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 3", "assert candidate(stones=[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 4], [4, 0], [...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(stones=[[1, 1], [2, 2], [3, 3], [4, 4], [1, 2], [2, 3], [3, 4], [4, 5], [1, 3], [2, 4], [3, 5], [4, 6]]) == 11", "assert candidate(stones=[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == 3", "assert candidate(stones=[[0, 0], [1, 1], [2, 2], [3, 3], ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 start with an initial power of power, an initial score of 0, and a bag...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, ...
[ "assert candidate(tokens=[1000, 900, 800, 700, 600, 500, 400, 300, 200, 100], power=300) == 4", "assert candidate(tokens=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], power=500) == 4", "assert candidate(tokens=[25, 50, 75, 100, 125, 150, 175, 200], power=100) == 3", "assert candidate(tokens=[1, 1, 1, 1...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(tokens=[1000, 900, 800, 700, 600, 500, 400, 300, 200, 100], power=300) == 4", "assert candidate(tokens=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], power=500) == 4", "assert candidate(tokens=[25, 50, 75, 100, 125, 150, 175, 200], power=100) == 3", "assert c...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array deck. There is a deck of cards where every ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the...
[ "assert candidate(deck=[1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == [1, 12, 2, 9, 3, 14, 4, 10, 5, 13, 6, 11, 7, 15, 8]", "assert candidate(deck=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == [100, 1200, 200, 900, 300, 1400, 400, 1000, 500, 1300, 600, 1100, 700, 1...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(deck=[1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == [1, 12, 2, 9, 3, 14, 4, 10, 5, 13, 6, 11, 7, 15, 8]", "assert candidate(deck=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == [100, 1200, 200, 900, 300, 1400, 400, 1000, 500, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 binary tree T, we can define a flip operation as follows: choose any...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subt...
[ "assert candidate(root1=tree_node([1, 2, 3, 4, 5, 6, None, None, None, 7, 8]), root2=tree_node([1, 3, 2, None, 6, 4, 5, None, None, None, None, 8, 7])) == True", "assert candidate(root1=tree_node([2, 3, 5, None, 8, None, 7, 4, 9, None, 1, None, None, None, None, 6]), root2=tree_node([2, 5, 3, 7, None, None, 8, 1,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root1=tree_node([1, 2, 3, 4, 5, 6, None, None, None, 7, 8]), root2=tree_node([1, 3, 2, None, 6, 4, 5, None, None, None, None, 8, 7])) == True", "assert candidate(root1=tree_node([2, 3, 5, None, 8, None, 7, 4, 9, None, 1, None, None, None, None, 6]), root2=tree_node([2, 5, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array of even length arr, return true if it is possible t...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array of even length arr, return true if it is possible to reorder arr such that arr[2 * i + 1] = 2 * ...
[ "assert candidate(arr=[-1, 1, -2, 2, -3, 3, -4, 4, -6, 6, -12, 12, -24, 24, -48, 48]) == False", "assert candidate(arr=[1, -1, 2, -2, 4, -4, 8, -8]) == True", "assert candidate(arr=[1, 2, 3, 6, 5, 10, 15, 30, 4, 8, 12, 24, 20, 40, 60, 120, 7, 14, 21, 42]) == True", "assert candidate(arr=[-100000, 100000, -500...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[-1, 1, -2, 2, -3, 3, -4, 4, -6, 6, -12, 12, -24, 24, -48, 48]) == False", "assert candidate(arr=[1, -1, 2, -2, 4, -4, 8, -8]) == True", "assert candidate(arr=[1, 2, 3, 6, 5, 10, 15, 30, 4, 8, 12, 24, 20, 40, 60, 120, 7, 14, 21, 42]) == True", "assert candidate...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of n strings strs, all of the same length.\nWe may ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of n strings strs, all of the same length. We may choose any deletion indices, and we delete all...
[ "assert candidate(strs=['zzzz', 'zzyz', 'zzyy', 'zzyx']) == 2", "assert candidate(strs=['apple', 'apply', 'appla', 'apple', 'applq']) == 1", "assert candidate(strs=['zzz', 'zyz', 'zxz']) == 1", "assert candidate(strs=['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx']) == 0", "assert candidate(strs=['fed', 'dbc', 'c...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(strs=['zzzz', 'zzyz', 'zzyy', 'zzyx']) == 2", "assert candidate(strs=['apple', 'apply', 'appla', 'apple', 'applq']) == 1", "assert candidate(strs=['zzz', 'zyz', 'zxz']) == 1", "assert candidate(strs=['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx']) == 0", "assert can...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 installing a billboard and want it to have the largest height. The...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one ...
[ "assert candidate(rods=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 232", "assert candidate(rods=[10, 20, 30, 40, 50]) == 70", "assert candidate(rods=[10, 15, 20, 25, 30, 35, 40, 45, 50]) == 135", "assert candidate(rods=[100, 200, 300, 400...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(rods=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 232", "assert candidate(rods=[10, 20, 30, 40, 50]) == 70", "assert candidate(rods=[10, 15, 20, 25, 30, 35, 40, 45, 50]) == 135", "assert candida...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 8 prison cells in a row and each cell is either occupied or vaca...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There are 8 prison cells in a row and each cell is either occupied or vacant. Each day, whether the cell is occupied or...
[ "assert candidate(cells=[0, 0, 1, 1, 1, 1, 0, 0], n=20) == [0, 1, 1, 1, 1, 1, 1, 0]", "assert candidate(cells=[1, 0, 1, 0, 0, 1, 0, 1], n=60) == [0, 0, 1, 1, 1, 1, 0, 0]", "assert candidate(cells=[1, 1, 0, 1, 0, 1, 0, 0], n=200) == [0, 1, 0, 1, 1, 0, 1, 0]", "assert candidate(cells=[0, 0, 0, 1, 1, 0, 0, 0], n...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(cells=[0, 0, 1, 1, 1, 1, 0, 0], n=20) == [0, 1, 1, 1, 1, 1, 1, 0]", "assert candidate(cells=[1, 0, 1, 0, 0, 1, 0, 1], n=60) == [0, 0, 1, 1, 1, 1, 0, 0]", "assert candidate(cells=[1, 1, 0, 1, 0, 1, 0, 0], n=200) == [0, 1, 0, 1, 1, 0, 1, 0]", "assert candidate(cells=...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the root of a binary tree, determine if it is a complete binary tree...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given the root of a binary tree, determine if it is a complete binary tree. In a complete binary tree, every level, exc...
[ "assert candidate(root=tree_node([1, 2, 3, None, 5])) == False", "assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7])) == True", "assert candidate(root=tree_node([1, 2, 3, 4, None, None, 7, 8, None, None, 11, 12, None, None, 16])) == False", "assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([1, 2, 3, None, 5])) == False", "assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7])) == True", "assert candidate(root=tree_node([1, 2, 3, 4, None, None, 7, 8, None, None, 11, 12, None, None, 16])) == False", "assert candidate(root=tree_node([1, 2...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of n strings strs, all of the same length.\nWe may ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of n strings strs, all of the same length. We may choose any deletion indices, and we delete all...
[ "assert candidate(strs=['abcde', 'edcba', 'fghij', 'jihgf', 'klmno', 'onmlk', 'pqrst', 'tsrqp', 'uvwxy', 'yxwvu', 'z', 'z', 'z', 'z', 'z']) == 4", "assert candidate(strs=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']) == 0", "as...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(strs=['abcde', 'edcba', 'fghij', 'jihgf', 'klmno', 'onmlk', 'pqrst', 'tsrqp', 'uvwxy', 'yxwvu', 'z', 'z', 'z', 'z', 'z']) == 4", "assert candidate(strs=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 ramp in an integer array nums is a pair (i, j) for which i < j and nums[...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A ramp in an integer array nums is a pair (i, j) for which i < j and nums[i] <= nums[j]. The width of such a ramp is j ...
[ "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 18", "assert candidate(nums=[1, 2, 3, 2, 1]) == 4", "assert candidate(nums=[0, 10000, 0, 9999, 0, 9998, 0, 9997, 0, 9996, 0, 9995, 0, 9994, 0, 9993, 0, 9992, 0, 9991]) == 19", "assert candidate(nums=[1, 3, 2, 2, 3, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 18", "assert candidate(nums=[1, 2, 3, 2, 1]) == 4", "assert candidate(nums=[0, 10000, 0, 9999, 0, 9998, 0, 9997, 0, 9996, 0, 9995, 0, 9994, 0, 9993, 0, 9992, 0, 9991]) == 19", "assert cand...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of points in the X-Y plane points where points[i] =...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of points in the X-Y plane points where points[i] = [xi, yi]. Return the minimum area of any rec...
[ "assert candidate(points=[[-1, -1], [1, 1], [1, -1], [-1, 1], [0, 0], [0, 2], [2, 0]]) == 2.0000000000000004", "assert candidate(points=[[0, 0], [4, 4], [4, 0], [0, 4], [1, 1], [3, 3], [3, 1], [1, 3]]) == 4.0", "assert candidate(points=[[0, 0], [0, 1], [1, 1], [1, 0], [2, 2], [3, 3], [4, 4], [5, 5]]) == 1.0", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(points=[[-1, -1], [1, 1], [1, -1], [-1, 1], [0, 0], [0, 2], [2, 0]]) == 2.0000000000000004", "assert candidate(points=[[0, 0], [4, 4], [4, 0], [0, 4], [1, 1], [3, 3], [3, 1], [1, 3]]) == 4.0", "assert candidate(points=[[0, 0], [0, 1], [1, 1], [1, 0], [2, 2], [3, 3], [4...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 single positive integer x, we will write an expression of the form...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given a single positive integer x, we will write an expression of the form x (op1) x (op2) x (op3) x ... where each ope...
[ "assert candidate(x=8, target=2048) == 11", "assert candidate(x=19, target=923521) == 65", "assert candidate(x=11, target=275) == 6", "assert candidate(x=19, target=361) == 1", "assert candidate(x=8, target=56789) == 31", "assert candidate(x=25, target=10000000) == 38", "assert candidate(x=7, target=491...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(x=8, target=2048) == 11", "assert candidate(x=19, target=923521) == 65", "assert candidate(x=11, target=275) == 6", "assert candidate(x=19, target=361) == 1", "assert candidate(x=8, target=56789) == 31", "assert candidate(x=25, target=10000000) == 38", ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 wordlist, we want to implement a spellchecker that converts a quer...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word. For a given query...
[ "assert candidate(wordlist=['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv'], queries=['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv', 'fantasticv', 'fantastivv', 'Fantastiv', 'fantasticIv', 'FANTASTIc']) == ['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv', '', '', '...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(wordlist=['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv'], queries=['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', 'Fantastiv', 'fantasticv', 'fantastivv', 'Fantastiv', 'fantasticIv', 'FANTASTIc']) == ['fantastic', 'Fantastic', 'FANTASTIC', 'fantastiv', '...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 two integers n and k, return an array of all the integers of length ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given two integers n and k, return an array of all the integers of length n where the difference between every two cons...
[ "assert candidate(n=9, k=8) == [191919191, 808080808, 919191919]", "assert candidate(n=3, k=6) == [171, 282, 393, 606, 717, 828, 939]", "assert candidate(n=4, k=8) == [1919, 8080, 9191]", "assert candidate(n=2, k=8) == [19, 80, 91]", "assert candidate(n=9, k=9) == [909090909]", "assert candidate(n=9, k=5)...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=9, k=8) == [191919191, 808080808, 919191919]", "assert candidate(n=3, k=6) == [171, 282, 393, 606, 717, 828, 939]", "assert candidate(n=4, k=8) == [1919, 8080, 9191]", "assert candidate(n=2, k=8) == [19, 80, 91]", "assert candidate(n=9, k=9) == [909090909]", ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the root of a binary tree. We install cameras on the tree no...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor i...
[ "assert candidate(root=tree_node([0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0])) == 4", "assert candidate(root=tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4", "assert candidate(root=tree_node([0, 0, 0, 0, 0, 0, None, None, 0, 0, 0, None, None, 0, 0, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([0, 0, 0, 0, 0, None, None, 0, 0, None, None, 0, 0])) == 4", "assert candidate(root=tree_node([0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0, None, 0])) == 4", "assert candidate(root=tree_node([0, 0, 0, 0, 0, 0, None, None, 0,...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of integers arr, sort the array by performing a series of p...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an array of integers arr, sort the array by performing a series of pancake flips. In one pancake flip we do the f...
[ "assert candidate(arr=[5, 1, 4, 2, 3]) == [5, 3, 4, 2, 3, 2]", "assert candidate(arr=[8, 1, 2, 3, 4, 5, 6, 7]) == [8, 7]", "assert candidate(arr=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10]", "assert candidate(arr=[6, 3, 5, 1, 2, 4]) == [6, 4, 5, 2, 4]", "assert candidate(arr=[6, 3, 5, 4, 2, 1]) == [6, 4, 5, 3,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[5, 1, 4, 2, 3]) == [5, 3, 4, 2, 3, 2]", "assert candidate(arr=[8, 1, 2, 3, 4, 5, 6, 7]) == [8, 7]", "assert candidate(arr=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [10]", "assert candidate(arr=[6, 3, 5, 1, 2, 4]) == [6, 4, 5, 2, 4]", "assert candidate(arr=[6, 3,...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 three integers x, y, and bound, return a list of all the powerful in...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given three integers x, y, and bound, return a list of all the powerful integers that have a value less than or equal t...
[ "assert candidate(x=2, y=2, bound=10) == [2, 3, 4, 5, 6, 8, 9, 10]", "assert candidate(x=2, y=5, bound=256) == [129, 2, 3, 5, 6, 7, 133, 9, 13, 141, 17, 21, 153, 26, 27, 29, 157, 33, 37, 41, 57, 189, 65, 69, 89, 253, 126, 127]", "assert candidate(x=1, y=1, bound=10) == [2]", "assert candidate(x=2, y=3, bound=...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(x=2, y=2, bound=10) == [2, 3, 4, 5, 6, 8, 9, 10]", "assert candidate(x=2, y=5, bound=256) == [129, 2, 3, 5, 6, 7, 133, 9, 13, 141, 17, 21, 153, 26, 27, 29, 157, 33, 37, 41, 57, 189, 65, 69, 89, 253, 126, 127]", "assert candidate(x=1, y=1, bound=10) == [2]", "assert...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums and an integer k, return the number of non-emp...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k. ...
[ "assert candidate(nums=[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], k=3) == 64", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=13) == 12", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=4) == 10", "assert candidate(nums=[2, 3, 5, 8, 13, 21, 34, 55, 8...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], k=3) == 64", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=13) == 12", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=4) == 10", "assert candidate(nums=[2,...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array arr. From some starting index, you can make...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an integer array arr. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) ...
[ "assert candidate(arr=[2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 3", "assert candidate(arr=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50]) == 6", "assert candidate(arr=[5, 1, 3, 4, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19]) == 3", "assert candidate(arr=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50]) == 6", "assert candidate(arr=[5, 1, 3, 4, 2, 6, 7, 8, 9, 10, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array arr, return the length of a maximum size turbulent ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if t...
[ "assert candidate(arr=[8, 10, 6, 5, 7, 9, 3, 1, 2, 4, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]) == 3", "assert candidate(arr=[1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2]) == 3", "assert candidate(arr=[0, 8, 45, 88, 48, 68, 28, 55, 17, 24]) == 8", "assert candidate(arr=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(arr=[8, 10, 6, 5, 7, 9, 3, 1, 2, 4, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]) == 3", "assert candidate(arr=[1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2]) == 3", "assert candidate(arr=[0, 8, 45, 88, 48, 68, 28, 55, 17, 24]) == 8", "assert candidate(arr=[1,...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the root of a binary tree with n nodes where each node in th...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins ...
[ "assert candidate(root=tree_node([0, 0, 0, 0, 0, 0, 7])) == 16", "assert candidate(root=tree_node([0, 0, 0, 0, 0, 0, 4, 0, 0, 3, 0, 0, 0, 0, 0])) == 23", "assert candidate(root=tree_node([1, 0, 0, None, 3, 0, 0])) == 8", "assert candidate(root=tree_node([1, 0, 0, None, 3, 0, 2])) == 6", "assert candidate(ro...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([0, 0, 0, 0, 0, 0, 7])) == 16", "assert candidate(root=tree_node([0, 0, 0, 0, 0, 0, 4, 0, 0, 3, 0, 0, 0, 0, 0])) == 23", "assert candidate(root=tree_node([1, 0, 0, None, 3, 0, 0])) == 8", "assert candidate(root=tree_node([1, 0, 0, None, 3, 0, 2])) ==...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n integer array grid where grid[i][j] could be:\n\n1 ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an m x n integer array grid where grid[i][j] could be: 1 representing the starting square. There is exac...
[ "assert candidate(grid=[[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, 2]]) == 378", "assert candidate(grid=[[1, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, -1, 2]]) == 1", "assert candidate(grid=[[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 2...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[[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, 2]]) == 378", "assert candidate(grid=[[1, 0, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, -1, 2]]) == 1", "assert candidate(grid=[[1, 0, 0, 0], [0, 0, 0, 0...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums, return the number of AND triples.\nAn AND tri...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array nums, return the number of AND triples. An AND triple is a triple of indices (i, j, k) such that...
[ "assert candidate(nums=[1, 0, 1, 0, 1, 0]) == 189", "assert candidate(nums=[15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 16231", "assert candidate(nums=[15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == 0", "assert candidate(num...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 0, 1, 0, 1, 0]) == 189", "assert candidate(nums=[15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 16231", "assert candidate(nums=[15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == 0"...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 planned some train traveling one year in advance. The days of the...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You have planned some train traveling one year in advance. The days of the year in which you will travel are given as a...
[ "assert candidate(days=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 63, 95, 127, 159, 191, 223, 255, 287, 319, 351, 365], costs=[3, 7, 20]) == 56", "assert candidate(days=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], costs=[2, 7, 15...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(days=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 63, 95, 127, 159, 191, 223, 255, 287, 319, 351, 365], costs=[3, 7, 20]) == 56", "assert candidate(days=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 2...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 two integers a and b, return any string s such that:\n\ns has length...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given two integers a and b, return any string s such that: s has length a + b and contains exactly a 'a' letters, and ...
[ "assert candidate(a=4, b=6) == 'bbabbaabab'", "assert candidate(a=3, b=7) == 'bbabbabbab'", "assert candidate(a=85, b=15) == 'aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", "assert candidate(a=1, b=2) == 'bba'", "assert candidate(a=70, b=30) == 'aabaa...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(a=4, b=6) == 'bbabbaabab'", "assert candidate(a=3, b=7) == 'bbabbabbab'", "assert candidate(a=85, b=15) == 'aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", "assert candidate(a=1, b=2) == 'bba'", "assert ca...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums and an array queries where queries[i] ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an integer array nums and an array queries where queries[i] = [vali, indexi]. For each query i, first, ap...
[ "assert candidate(nums=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20], queries=[[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [108, 106, 100, 96, 86, 80, 66, 58, 40, 30]", "assert candidate(nums=[5, 10, 15, 20, 25, 30], queries=[[5, 0], [-10, 1], [15, 2], [-20, 3], [25, 4], ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20], queries=[[-1, 0], [-2, 1], [-3, 2], [-4, 3], [-5, 4], [-6, 5], [-7, 6], [-8, 7], [-9, 8], [-10, 9]]) == [108, 106, 100, 96, 86, 80, 66, 58, 40, 30]", "assert candidate(nums=[5, 10, 15, 20, 25, 30], queries=[[5, 0], [-10, 1], [15, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 lists of closed intervals, firstList and secondList, whe...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given two lists of closed intervals, firstList and secondList, where firstList[i] = [starti, endi] and secondLi...
[ "assert candidate(firstList=[[1, 2], [3, 5], [6, 7]], secondList=[[2, 3], [5, 6]]) == [[2, 2], [3, 3], [5, 5], [6, 6]]", "assert candidate(firstList=[[1, 50], [100, 150], [200, 250], [300, 350]], secondList=[[25, 75], [125, 175], [225, 275], [325, 375]]) == [[25, 50], [125, 150], [225, 250], [325, 350]]", "asse...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(firstList=[[1, 2], [3, 5], [6, 7]], secondList=[[2, 3], [5, 6]]) == [[2, 2], [3, 3], [5, 5], [6, 6]]", "assert candidate(firstList=[[1, 50], [100, 150], [200, 250], [300, 350]], secondList=[[25, 75], [125, 175], [225, 275], [325, 375]]) == [[25, 50], [125, 150], [225, 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:\nGiven the root of a binary tree, calculate the vertical order traversal of...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given the root of a binary tree, calculate the vertical order traversal of the binary tree. For each node at position (...
[ "assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 16, 20, 14, 19])) == [[14], [1], [3, 19], [5, 6], [10, 7], [15, 8, 16], [18], [20]]", "assert candidate(root=tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == [[15], [7], [3, 16, 17, 19], [1, 8, 9, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 16, 20, 14, 19])) == [[14], [1], [3, 19], [5, 6], [10, 7], [15, 8, 16], [18], [20]]", "assert candidate(root=tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])) == [[15], [7], [3, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the root of a binary tree where each node has a value in the...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given the root of a binary tree where each node has a value in the range [0, 25] representing the letters 'a' t...
[ "assert candidate(root=tree_node([0, 2, 1, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 'igeba'", "assert candidate(root=tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11])) == 'ltxz'", "assert candidate(root=tree_node([3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([0, 2, 1, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9])) == 'igeba'", "assert candidate(root=tree_node([25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11])) == 'ltxz'", "assert candidate(root=tree_node([3, 2, 2, 1, 1, 0, 0, 0, 0, 0, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of strings equations that represent relationships b...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an array of strings equations that represent relationships between variables where each string equations[...
[ "assert candidate(equations=['a!=a']) == False", "assert candidate(equations=['a==b', 'c==d', 'e==f', 'g==h']) == True", "assert candidate(equations=['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==m', 'm!=n']) == False", "assert candidate(equations=...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(equations=['a!=a']) == False", "assert candidate(equations=['a==b', 'c==d', 'e==f', 'g==h']) == True", "assert candidate(equations=['m==n', 'n==o', 'o==p', 'p==q', 'q==r', 'r==s', 's==t', 't==u', 'u==v', 'v==w', 'w==x', 'x==y', 'y==z', 'z==m', 'm!=n']) == False", "...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 broken calculator that has the integer startValue on its displa...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There is a broken calculator that has the integer startValue on its display initially. In one operation, you can: mult...
[ "assert candidate(startValue=9, target=18) == 1", "assert candidate(startValue=31, target=15) == 16", "assert candidate(startValue=12, target=32) == 6", "assert candidate(startValue=2, target=1024) == 9", "assert candidate(startValue=1000000, target=10000000) == 375004", "assert candidate(startValue=50000...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(startValue=9, target=18) == 1", "assert candidate(startValue=31, target=15) == 16", "assert candidate(startValue=12, target=32) == 6", "assert candidate(startValue=2, target=1024) == 9", "assert candidate(startValue=1000000, target=10000000) == 375004", "as...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums and an integer k, return the number of good su...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer array nums and an integer k, return the number of good subarrays of nums. A good array is an array whe...
[ "assert candidate(nums=[1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10], k=10) == 237", "assert candidate(nums=[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], k=3) == 190", "assert candidate(nums=[1, 2, 2, 1, 3, 1, 4, 2], k=3...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10], k=10) == 237", "assert candidate(nums=[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], k=3) == 190", "assert candidate(nums=[1, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n grid where each cell can have one of three values:\...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing...
[ "assert candidate(grid=[[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == -1", "assert candidate(grid=[[1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [2, 0, 1, 0, 2], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1]]) == -1", "assert candidate(grid=[[2, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[[1, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) == -1", "assert candidate(grid=[[1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [2, 0, 1, 0, 2], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1]]) == -1", "assert candidate(grid=[[2, 1, 0, 0, 0, 1], [0, 0, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a binary array nums and an integer k.\nA k-bit flip is choos...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given a binary array nums and an integer k. A k-bit flip is choosing a subarray of length k from nums and simul...
[ "assert candidate(nums=[1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0], k=5) == -1", "assert candidate(nums=[0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], k=5) == 9", "assert candidate(nums=[1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0], k=2) == 4", "assert candidate(nums=[1, 1, 1, 1, 1, 1, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0], k=5) == -1", "assert candidate(nums=[0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], k=5) == 9", "assert candidate(nums=[1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0], k=2) == 4", "assert candida...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nAn array is squareful if the sum of every pair of adjacent elements is a p...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: An array is squareful if the sum of every pair of adjacent elements is a perfect square. Given an integer array nums, r...
[ "assert candidate(nums=[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]) == 12", "assert candidate(nums=[4, 6, 15, 33, 50]) == 0", "assert candidate(nums=[16, 9, 0, 4, 25, 1]) == 0", "assert candidate(nums=[1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 0", "assert candidate(nums=[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]) == 12", "assert candidate(nums=[4, 6, 15, 33, 50]) == 0", "assert candidate(nums=[16, 9, 0, 4, 25, 1]) == 0", "assert candidate(nums=[1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13]) == 0", "assert candidate(nums=[0, 0...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 piles of stones arranged in a row. The ith pile has stones[i] ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There are n piles of stones arranged in a row. The ith pile has stones[i] stones. A move consists of merging exactly k ...
[ "assert candidate(stones=[9, 8, 7, 6, 5, 4, 3, 2, 1], k=3) == 87", "assert candidate(stones=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60], k=10) == -1", "assert candidate(stones=[10, 20, 30, 40, 50, 60], k=3) == -1", "assert candidate(ston...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(stones=[9, 8, 7, 6, 5, 4, 3, 2, 1], k=3) == 87", "assert candidate(stones=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60], k=10) == -1", "assert candidate(stones=[10, 20, 30, 40, 50, 60], k=3) == -1",...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 2D grid of size n x n where each cell of this grid has a lamp t...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: There is a 2D grid of size n x n where each cell of this grid has a lamp that is initially turned off. You are given a ...
[ "assert candidate(n=100, lamps=[[0, 0], [99, 99], [49, 49], [25, 25], [75, 75]], queries=[[50, 50], [25, 25], [49, 49], [75, 75], [99, 99], [0, 0]]) == [1, 1, 1, 1, 1, 1]", "assert candidate(n=9, lamps=[[0, 0], [0, 8], [8, 0], [8, 8], [4, 4]], queries=[[4, 4], [4, 5], [4, 3], [5, 4], [3, 4]]) == [1, 0, 0, 0, 0]",...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=100, lamps=[[0, 0], [99, 99], [49, 49], [25, 25], [75, 75]], queries=[[50, 50], [25, 25], [49, 49], [75, 75], [99, 99], [0, 0]]) == [1, 1, 1, 1, 1, 1]", "assert candidate(n=9, lamps=[[0, 0], [0, 8], [8, 0], [8, 8], [4, 4]], queries=[[4, 4], [4, 5], [4, 3], [5, 4], [3, 4]...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 binary array nums and an integer k, return the maximum number of c...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip a...
[ "assert candidate(nums=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], k=5) == 5", "assert candidate(nums=[1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0], k=5) == 18", "assert candidate(nums=[1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], k=3) == 8", "assert candidate(...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], k=5) == 5", "assert candidate(nums=[1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0], k=5) == 18", "assert candidate(nums=[1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], k=3) ==...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 factorial of a positive integer n is the product of all positive integ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: The factorial of a positive integer n is the product of all positive integers less than or equal to n. For example, fa...
[ "assert candidate(n=50) == 52", "assert candidate(n=500) == 501", "assert candidate(n=99) == 98", "assert candidate(n=9999) == 9998", "assert candidate(n=17) == 19", "assert candidate(n=24) == 25", "assert candidate(n=31) == 30", "assert candidate(n=10) == 12", "assert candidate(n=2) == 2", "asser...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=50) == 52", "assert candidate(n=500) == 501", "assert candidate(n=99) == 98", "assert candidate(n=9999) == 9998", "assert candidate(n=17) == 19", "assert candidate(n=24) == 25", "assert candidate(n=31) == 30", "assert candidate(n=10) == 12", "...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of integers preorder, which represents the preorder travers...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), const...
[ "assert is_same_tree(candidate(preorder=[10, 5, 2, 1, 3, 7, 6, 8, 15, 12, 11, 13, 18, 17, 20]), tree_node([10, 5, 15, 2, 7, 12, 18, 1, 3, 6, 8, 11, 13, 17, 20]))", "assert is_same_tree(candidate(preorder=[50, 30, 20, 10, 15, 25, 35, 40, 45, 70, 60, 55, 58, 65, 80, 75, 72, 73, 78, 85, 82, 83, 87, 90, 95, 92, 93, 9...
newfacade/LeetCodeDataset
{ "constraints": [ "assert is_same_tree(candidate(preorder=[10, 5, 2, 1, 3, 7, 6, 8, 15, 12, 11, 13, 18, 17, 20]), tree_node([10, 5, 15, 2, 7, 12, 18, 1, 3, 6, 8, 11, 13, 17, 20]))", "assert is_same_tree(candidate(preorder=[50, 30, 20, 10, 15, 25, 35, 40, 45, 70, 60, 55, 58, 65, 80, 75, 72, 73, 78, 85, 82, 83...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 conveyor belt has packages that must be shipped from one port to another...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: A conveyor belt has packages that must be shipped from one port to another within days days. The ith package on the con...
[ "assert candidate(weights=[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], days=10) == 3", "assert candidate(weights=[47, 2, 20, 7, 2, 19, 23, 30, 6, 12, 9, 4, 30, 26, 8, 7], days=10) == 47", "assert candidate(weights=[9, 8, 7, 6, 5, 4, 3, 2, 1], days=5) == 11", "assert candidate(weights=[500, 500, 500, 500, 50...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(weights=[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], days=10) == 3", "assert candidate(weights=[47, 2, 20, 7, 2, 19, 23, 30, 6, 12, 9, 4, 30, 26, 8, 7], days=10) == 47", "assert candidate(weights=[9, 8, 7, 6, 5, 4, 3, 2, 1], days=5) == 11", "assert candidate(weig...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array values where values[i] represents the value...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing...
[ "assert candidate(values=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100]) == 100", "assert candidate(values=[1000, 1, 1000, 1, 1000]) == 1998", "assert candidate(values=[1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93]) == 197", "assert candidate(values=[500, 400, 300, 200, 100, 50, 25,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(values=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100]) == 100", "assert candidate(values=[1000, 1, 1000, 1, 1000]) == 1998", "assert candidate(values=[1, 100, 2, 99, 3, 98, 4, 97, 5, 96, 6, 95, 7, 94, 8, 93]) == 197", "assert candidate(values=[500, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer n, return a binary string representing its representation...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an integer n, return a binary string representing its representation in base -2. Note that the returned string sh...
[ "assert candidate(n=255) == '100000011'", "assert candidate(n=1024) == '10000000000'", "assert candidate(n=333333333) == '10100001000100100011101010101'", "assert candidate(n=999999993) == '1001100111011111101111000001001'", "assert candidate(n=104730) == '1101110100101101110'", "assert candidate(n=31) ==...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=255) == '100000011'", "assert candidate(n=1024) == '10000000000'", "assert candidate(n=333333333) == '10100001000100100011101010101'", "assert candidate(n=999999993) == '1001100111011111101111000001001'", "assert candidate(n=104730) == '1101110100101101110'",...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the head of a linked list with n nodes.\nFor each node in th...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given the head of a linked list with n nodes. For each node in the list, find the value of the next greater nod...
[ "assert candidate(head=list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]", "assert candidate(head=list_node([1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5])) == [2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(head=list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) == [0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0]", "assert candidate(head=list_node([1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5])) == [2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n binary matrix grid, where 0 represents a sea cell a...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell. A move consists ...
[ "assert candidate(grid=[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0", "assert candidate(grid=[[0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0]]) == 0", "assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0", "assert candidate(grid=[[0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0]]) == 0", "assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of strings queries and a string pattern, return a boolean a...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an array of strings queries and a string pattern, return a boolean array answer where answer[i] is true if querie...
[ "assert candidate(queries=['OpenAI', 'Open_Artificial_Intelligence', 'O_A_I', 'OpenA', 'OpenAIAI'], pattern='OAI') == [True, False, False, False, False]", "assert candidate(queries=['CamelCase', 'CamelCasePattern', 'Camel', 'Case'], pattern='CCP') == [False, True, False, False]", "assert candidate(queries=['Cam...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(queries=['OpenAI', 'Open_Artificial_Intelligence', 'O_A_I', 'OpenA', 'OpenAIAI'], pattern='OAI') == [True, False, False, False, False]", "assert candidate(queries=['CamelCase', 'CamelCasePattern', 'Camel', 'Case'], pattern='CCP') == [False, True, False, False]", "asser...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 series of video clips from a sporting event that lasted ti...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: You are given a series of video clips from a sporting event that lasted time seconds. These video clips can be overlapp...
[ "assert candidate(clips=[[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], [8, 92], [9, 91], [10, 90], [11, 89], [12, 88], [13, 87], [14, 86], [15, 85]], time=95) == 1", "assert candidate(clips=[[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], [8, 92], [9, 91], [10, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(clips=[[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], [8, 92], [9, 91], [10, 90], [11, 89], [12, 88], [13, 87], [14, 86], [15, 85]], time=95) == 1", "assert candidate(clips=[[0, 100], [1, 99], [2, 98], [3, 97], [4, 96], [5, 95], [6, 94], [7, 93], ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the root of a binary tree, find the maximum value v for which there ...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given the root of a binary tree, find the maximum value v for which there exist different nodes a and b where v = |a.va...
[ "assert candidate(root=tree_node([1, None, 3, None, None, 2, 4, None, None, None, 5])) == 2", "assert candidate(root=tree_node([9, 4, 17, 3, 6, 15, 22, 2, 5, 12, 18, None, None, None, None, 16, 20, None, None, None, None, None, 24, 27])) == 25", "assert candidate(root=tree_node([1, None, 2, None, 0, 3])) == 3",...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([1, None, 3, None, None, 2, 4, None, None, None, 5])) == 2", "assert candidate(root=tree_node([9, 4, 17, 3, 6, 15, 22, 2, 5, 12, 18, None, None, None, None, 16, 20, None, None, None, None, None, 24, 27])) == 25", "assert candidate(root=tree_node([1, None...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums of integers, return the length of the longest arithmet...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: Given an array nums of integers, return the length of the longest arithmetic subsequence in nums. Note that: A subsequ...
[ "assert candidate(nums=[7, 7, 7, 11, 11, 11, 15]) == 3", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30", "assert candidate(nums=[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45]) == 12", "assert candidate(nums=[1, 5, 9...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[7, 7, 7, 11, 11, 11, 15]) == 3", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30", "assert candidate(nums=[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45]) == 12", "ass...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 run a preorder depth-first search (DFS) on the root of a binary tree.\n...
You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. ### Question: We run a preorder depth-first search (DFS) on the root of a binary tree. At each node in this traversal, we output D da...
[ "assert is_same_tree(candidate(traversal='1-2--3----4-----5------6-------7--------8'), tree_node([1, 2, None, 3]))", "assert is_same_tree(candidate(traversal='1-2--3-4-5'), tree_node([1, 2, 4, 3]))", "assert is_same_tree(candidate(traversal='1-2--3--4----5------6----7---8-9----10--11'), tree_node([1, 2, None, 3...
newfacade/LeetCodeDataset
{ "constraints": [ "assert is_same_tree(candidate(traversal='1-2--3----4-----5------6-------7--------8'), tree_node([1, 2, None, 3]))", "assert is_same_tree(candidate(traversal='1-2--3-4-5'), tree_node([1, 2, 4, 3]))", "assert is_same_tree(candidate(traversal='1-2--3--4----5------6----7---8-9----10--11'),...