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:\nGiven an integer n, return the number of prime numbers that are strictly l...
You are an expert Python 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 number of prime numbers that are strictly less than n.   Constraints: 0 <= n <= 5 * 106...
[ "assert candidate(n=5) == 2", "assert candidate(n=104729) == 9999", "assert candidate(n=3000000) == 216816", "assert candidate(n=7890123) == 532888", "assert candidate(n=789654) == 63183", "assert candidate(n=10) == 4", "assert candidate(n=5000001) == 348513", "assert candidate(n=1234567) == 95360", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=5) == 2", "assert candidate(n=104729) == 9999", "assert candidate(n=3000000) == 216816", "assert candidate(n=7890123) == 532888", "assert candidate(n=789654) == 63183", "assert candidate(n=10) == 4", "assert candidate(n=5000001) == 348513", "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:\nThere are a total of numCourses courses you have to take, labeled from 0 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 are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prer...
[ "assert candidate(numCourses=8, prerequisites=[[1, 0], [2, 6], [1, 7], [6, 4], [7, 0], [0, 5]]) == True", "assert candidate(numCourses=8, prerequisites=[[1, 0], [2, 0], [3, 0], [4, 1], [5, 1], [6, 2], [7, 2], [4, 6], [5, 7]]) == True", "assert candidate(numCourses=9, prerequisites=[[1, 0], [2, 1], [3, 2], [4, 3...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(numCourses=8, prerequisites=[[1, 0], [2, 6], [1, 7], [6, 4], [7, 0], [0, 5]]) == True", "assert candidate(numCourses=8, prerequisites=[[1, 0], [2, 0], [3, 0], [4, 1], [5, 1], [6, 2], [7, 2], [4, 6], [5, 7]]) == True", "assert candidate(numCourses=9, prerequisites=[[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 are a total of numCourses courses you have to take, labeled from 0 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 are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prer...
[ "assert candidate(numCourses=3, prerequisites=[[1, 0], [2, 1]]) == [0, 1, 2]", "assert candidate(numCourses=14, prerequisites=[[1, 0], [2, 0], [3, 0], [4, 0], [5, 1], [6, 2], [7, 3], [8, 4], [9, 5], [10, 6], [11, 7], [12, 8], [13, 9], [13, 10], [13, 11], [13, 12]]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(numCourses=3, prerequisites=[[1, 0], [2, 1]]) == [0, 1, 2]", "assert candidate(numCourses=14, prerequisites=[[1, 0], [2, 0], [3, 0], [4, 0], [5, 1], [6, 2], [7, 3], [8, 4], [9, 5], [10, 6], [11, 7], [12, 8], [13, 9], [13, 10], [13, 11], [13, 12]]) == [0, 1, 2, 3, 4, 5, 6, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n board of characters and a list of strings words, return all...
You are an expert Python 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 m x n board of characters and a list of strings words, return all words on the board. Each word must be constr...
[ "assert candidate(board=[['a', 'a', 'a', 'a'], ['a', 'a', 'a', 'a'], ['a', 'a', 'a', 'a'], ['a', 'a', 'a', 'a']], words=['aaaaaaaaaa', 'aaaaaaaab', 'aaaaaaaac']) == ['aaaaaaaaaa']", "assert candidate(board=[['h', 'o', 'l', 'a'], ['o', 'n', 'k', 'n'], ['r', 'l', 'd', 't'], ['d', 't', 'a', 'e']], words=['hola', 'no...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(board=[['a', 'a', 'a', 'a'], ['a', 'a', 'a', 'a'], ['a', 'a', 'a', 'a'], ['a', 'a', 'a', 'a']], words=['aaaaaaaaaa', 'aaaaaaaab', 'aaaaaaaac']) == ['aaaaaaaaaa']", "assert candidate(board=[['h', 'o', 'l', 'a'], ['o', 'n', 'k', 'n'], ['r', 'l', 'd', 't'], ['d', 't', 'a', 'e...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 a professional robber planning to rob houses along a street. Each ...
You are an expert Python 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 a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. ...
[ "assert candidate(nums=[999, 0, 999, 0, 999, 0, 999, 0, 999, 0]) == 4995", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 63", "assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 110", "assert candidate(nums=[2, 3, 2]) == 3", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[999, 0, 999, 0, 999, 0, 999, 0, 999, 0]) == 4995", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == 63", "assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 110", "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:\nGiven an integer array nums and an integer k, return the kth largest eleme...
You are an expert Python 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 kth largest element in the array. Note that it is the kth larg...
[ "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], k=17) == 14", "assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k=14) == 7", "assert candidate(nums=[9, 3, 7, 6, 2, 5, 8, 4, 1, 10...
newfacade/LeetCodeDataset
{ "constraints": [ "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], k=17) == 14", "assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k=14) == 7", "assert candidate(nums=[9, 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:\nFind all valid combinations of k numbers that sum up to n such that the fo...
You are an expert Python 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: Find all valid combinations of k numbers that sum up to n such that the following conditions are true: Only numbers 1 ...
[ "assert candidate(k=5, n=15) == [[1, 2, 3, 4, 5]]", "assert candidate(k=7, n=40) == [[1, 4, 5, 6, 7, 8, 9], [2, 3, 5, 6, 7, 8, 9]]", "assert candidate(k=4, n=28) == [[4, 7, 8, 9], [5, 6, 8, 9]]", "assert candidate(k=7, n=49) == []", "assert candidate(k=6, n=25) == [[1, 2, 3, 4, 6, 9], [1, 2, 3, 4, 7, 8], [1...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(k=5, n=15) == [[1, 2, 3, 4, 5]]", "assert candidate(k=7, n=40) == [[1, 4, 5, 6, 7, 8, 9], [2, 3, 5, 6, 7, 8, 9]]", "assert candidate(k=4, n=28) == [[4, 7, 8, 9], [5, 6, 8, 9]]", "assert candidate(k=7, n=49) == []", "assert candidate(k=6, n=25) == [[1, 2, 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:\nA city's skyline is the outer contour of the silhouette formed by all 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: A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a dis...
[ "assert candidate(buildings=[[1, 10, 5], [2, 6, 7], [3, 15, 8], [4, 12, 12], [5, 9, 10], [6, 14, 9], [7, 13, 11], [8, 11, 13]]) == [[1, 5], [2, 7], [3, 8], [4, 12], [8, 13], [11, 12], [12, 11], [13, 9], [14, 8], [15, 0]]", "assert candidate(buildings=[[1, 2, 10], [2, 3, 10], [3, 4, 10], [4, 5, 10], [5, 6, 10], [6...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(buildings=[[1, 10, 5], [2, 6, 7], [3, 15, 8], [4, 12, 12], [5, 9, 10], [6, 14, 9], [7, 13, 11], [8, 11, 13]]) == [[1, 5], [2, 7], [3, 8], [4, 12], [8, 13], [11, 12], [12, 11], [13, 9], [14, 8], [15, 0]]", "assert candidate(buildings=[[1, 2, 10], [2, 3, 10], [3, 4, 10], [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 m x n binary matrix filled with 0's and 1's, find the largest squ...
You are an expert Python 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 m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. ...
[ "assert candidate(matrix=[['0', '0', '0', '0', '0'], ['0', '1', '1', '1', '0'], ['0', '1', '1', '1', '0'], ['0', '1', '1', '1', '0'], ['0', '0', '0', '0', '0']]) == 9", "assert candidate(matrix=[['1', '1', '1', '1', '1', '1', '1', '1', '1', '1'], ['1', '0', '0', '0', '0', '0', '0', '0', '0', '1'], ['1', '0', '1',...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(matrix=[['0', '0', '0', '0', '0'], ['0', '1', '1', '1', '0'], ['0', '1', '1', '1', '0'], ['0', '1', '1', '1', '0'], ['0', '0', '0', '0', '0']]) == 9", "assert candidate(matrix=[['1', '1', '1', '1', '1', '1', '1', '1', '1', '1'], ['1', '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 the coordinates of two rectilinear rectangles in a 2D plane, return ...
You are an expert Python 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 coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles....
[ "assert candidate(ax1=1, ay1=1, ax2=4, ay2=4, bx1=2, by1=2, bx2=5, by2=5) == 14", "assert candidate(ax1=-50, ay1=-50, ax2=50, ay2=50, bx1=-60, by1=-60, bx2=60, by2=60) == 14400", "assert candidate(ax1=-100, ay1=100, ax2=0, ay2=200, bx1=-50, by1=150, bx2=50, by2=250) == 17500", "assert candidate(ax1=-5, ay1=-5...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(ax1=1, ay1=1, ax2=4, ay2=4, bx1=2, by1=2, bx2=5, by2=5) == 14", "assert candidate(ax1=-50, ay1=-50, ax2=50, ay2=50, bx1=-60, by1=-60, bx2=60, by2=60) == 14400", "assert candidate(ax1=-100, ay1=100, ax2=0, ay2=200, bx1=-50, by1=150, bx2=50, by2=250) == 17500", "asse...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s representing a valid expression, implement a basic calcul...
You are an expert Python 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 string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of...
[ "assert candidate(s='10 + (2 * (6 / 3))') == 21", "assert candidate(s='(1 + (2 - 3) * (4 + 5) - 6)') == -15", "assert candidate(s='((1 + 2) * (3 + (4 * (5 + 6))))') == 21", "assert candidate(s='3 + 5 * ( 2 - 8 )') == 2", "assert candidate(s='-1 + (-2 + (-3 + (-4 + (-5))))') == -15", "assert candidate(s='(...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='10 + (2 * (6 / 3))') == 21", "assert candidate(s='(1 + (2 - 3) * (4 + 5) - 6)') == -15", "assert candidate(s='((1 + 2) * (3 + (4 * (5 + 6))))') == 21", "assert candidate(s='3 + 5 * ( 2 - 8 )') == 2", "assert candidate(s='-1 + (-2 + (-3 + (-4 + (-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 a string s which represents an expression, evaluate this expression ...
You are an expert Python 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 string s which represents an expression, evaluate this expression and return its value.  The integer division s...
[ "assert candidate(s=' 7 + 14 / 7 - 3 + 6 * 2') == 18", "assert candidate(s='2*3+4/5') == 6", "assert candidate(s='33 + 22 * 11 - 44 / 11 + 55') == 326", "assert candidate(s='100 * 2 + 3 * 5 / 15 - 10') == 191", "assert candidate(s=' 8 * 5 / 4 + 3 - 1') == 12", "assert candidate(s='100000 + 100000 - 5...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s=' 7 + 14 / 7 - 3 + 6 * 2') == 18", "assert candidate(s='2*3+4/5') == 6", "assert candidate(s='33 + 22 * 11 - 44 / 11 + 55') == 326", "assert candidate(s='100 * 2 + 3 * 5 / 15 - 10') == 191", "assert candidate(s=' 8 * 5 / 4 + 3 - 1') == 12", "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:\nGiven the root of a binary search tree, and an integer k, return the kth 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: Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values o...
[ "assert candidate(root=tree_node([75, 50, 100, 25, 60, 85, 125, 15, 35, 55, 65, 90, 110, 130, 150]), k=13) == 130", "assert candidate(root=tree_node([50, 25, 75, 15, 35, 60, 85, 10, 20, 30, 40, 55, 65, 80, 90]), k=12) == 75", "assert candidate(root=tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]),...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([75, 50, 100, 25, 60, 85, 125, 15, 35, 55, 65, 90, 110, 130, 150]), k=13) == 130", "assert candidate(root=tree_node([50, 25, 75, 15, 35, 60, 85, 10, 20, 30, 40, 55, 65, 80, 90]), k=12) == 75", "assert candidate(root=tree_node([8, 4, 12, 2, 6, 10, 14, 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 an integer n, count the total number of digit 1 appearing in all non...
You are an expert Python 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, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.  ...
[ "assert candidate(n=100100100) == 80150223", "assert candidate(n=50123) == 30057", "assert candidate(n=303030303) == 342822161", "assert candidate(n=50001) == 30001", "assert candidate(n=100100) == 50122", "assert candidate(n=50000000) == 45000000", "assert candidate(n=5001) == 2501", "assert candidat...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=100100100) == 80150223", "assert candidate(n=50123) == 30057", "assert candidate(n=303030303) == 342822161", "assert candidate(n=50001) == 30001", "assert candidate(n=100100) == 50122", "assert candidate(n=50000000) == 45000000", "assert candidate(n=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 a binary tree, find the lowest common ancestor (LCA) of two given 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: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition ...
[ "assert candidate(root=tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5]), p=3, q=5) == None", "assert candidate(root=tree_node([2, 1]), p=2, q=1) == None", "assert candidate(root=tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4]), p=6, q=4) == None", "assert candidate(root=tree_node([3, 1, 4, None, 2]), p=2,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5]), p=3, q=5) == None", "assert candidate(root=tree_node([2, 1]), p=2, q=1) == None", "assert candidate(root=tree_node([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4]), p=6, q=4) == None", "assert candidate(root=tree_nod...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of integers nums, there is a sliding window of size...
You are an expert Python 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 integers nums, there is a sliding window of size k which is moving from the very left of the ...
[ "assert candidate(nums=[5, 3, 8, 1, 9, 2, 7, 4, 6, 0], k=3) == [8, 8, 9, 9, 9, 7, 7, 6]", "assert candidate(nums=[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10], k=3) == [-1, -2, -3, -4, -5, -6, -7, -8]", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=5) == [5, 6, 7, 8, 9, 10]", "assert candidate(nums=[2...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[5, 3, 8, 1, 9, 2, 7, 4, 6, 0], k=3) == [8, 8, 9, 9, 9, 7, 7, 6]", "assert candidate(nums=[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10], k=3) == [-1, -2, -3, -4, -5, -6, -7, -8]", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=5) == [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 a string expression of numbers and operators, return all possible 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: Given a string expression of numbers and operators, return all possible results from computing all the different possib...
[ "assert candidate(expression='44-22*3+55/5-66*7+88') == []", "assert candidate(expression='100-25*4+30/6') == []", "assert candidate(expression='9*8+7*6-5*4+3*2-1') == [-1755, -2385, -1755, -2385, -3645, -999, -1125, -1755, -999, -2637, -3897, -1125, -3897, -2385, 513, 639, 513, 639, 891, -621, -495, 513, 639, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(expression='44-22*3+55/5-66*7+88') == []", "assert candidate(expression='100-25*4+30/6') == []", "assert candidate(expression='9*8+7*6-5*4+3*2-1') == [-1755, -2385, -1755, -2385, -3645, -999, -1125, -1755, -999, -2637, -3897, -1125, -3897, -2385, 513, 639, 513, 639, 89...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 strings low and high that represent two integers low and high 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: Given two strings low and high that represent two integers low and high where low <= high, return the number of strobog...
[ "assert candidate(low='200000000000000', high='300000000000000') == 0", "assert candidate(low='696969696969696969', high='696969696969696969') == 1", "assert candidate(low='100000000', high='1000000000') == 1500", "assert candidate(low='1111', high='1111') == 1", "assert candidate(low='1001', high='10000000...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(low='200000000000000', high='300000000000000') == 0", "assert candidate(low='696969696969696969', high='696969696969696969') == 1", "assert candidate(low='100000000', high='1000000000') == 1500", "assert candidate(low='1111', high='1111') == 1", "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:\nGiven the root of a binary tree, return the number of uni-value subtrees.\...
You are an expert Python 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, return the number of uni-value subtrees. A uni-value subtree means all nodes of the su...
[ "assert candidate(root=tree_node([1, 2, 2, 2, 2, 2, 2, None, None, 2, None, 2, None, None, 2])) == 9", "assert candidate(root=tree_node([11, 12, 13, 11, None, 12, 13, None, 11, None, 12, None, 13, None, 11])) == 7", "assert candidate(root=tree_node([100, 100, 100, 100, 100, 100, 100, None, 100, 100, None, None,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([1, 2, 2, 2, 2, 2, 2, None, None, 2, None, 2, None, None, 2])) == 9", "assert candidate(root=tree_node([11, 12, 13, 11, None, 12, 13, None, 11, None, 12, None, 13, None, 11])) == 7", "assert candidate(root=tree_node([100, 100, 100, 100, 100, 100, 100, No...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 meeting time intervals intervals where intervals[i] = [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: Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of co...
[ "assert candidate(intervals=[[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]]) == 0", "assert candidate(intervals=[[2, 11], [6, 16], [11, 16]]) == 2", "assert candidate(intervals=[[1, 10], [11, 20]...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(intervals=[[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1], [1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5], [7, 4], [8, 3], [9, 2], [10, 1]]) == 0", "assert candidate(intervals=[[2, 11], [6, 16], [11, 16]]) == 2", "assert candidate(int...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 unique integers preorder, return true if it is the corre...
You are an expert Python 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 unique integers preorder, return true if it is the correct preorder traversal sequence of a binary se...
[ "assert candidate(preorder=[15, 10, 5, 1, 7, 20, 18, 17, 19, 30, 25, 27, 35, 40]) == True", "assert candidate(preorder=[7, 4, 3, 2, 5, 6, 9, 8, 10]) == True", "assert candidate(preorder=[2, 1, 3]) == True", "assert candidate(preorder=[1, 3, 2]) == True", "assert candidate(preorder=[10, 5, 3, 1, 4, 7, 6, 8, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(preorder=[15, 10, 5, 1, 7, 20, 18, 17, 19, 30, 25, 27, 35, 40]) == True", "assert candidate(preorder=[7, 4, 3, 2, 5, 6, 9, 8, 10]) == True", "assert candidate(preorder=[2, 1, 3]) == True", "assert candidate(preorder=[1, 3, 2]) == True", "assert candidate(preord...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 row of n houses, where each house can be painted one of three 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: There is a row of n houses, where each house can be painted one of three colors: red, blue, or green. The cost of paint...
[ "assert candidate(costs=[[20, 1, 19], [19, 20, 1], [1, 19, 20], [20, 1, 19], [19, 20, 1], [1, 19, 20], [20, 1, 19], [19, 20, 1], [1, 19, 20], [20, 1, 19]]) == 10", "assert candidate(costs=[[11, 5, 3], [7, 9, 4], [12, 8, 6], [6, 5, 7], [14, 12, 11], [10, 13, 9]]) == 42", "assert candidate(costs=[[7, 6, 2]]) == 2...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(costs=[[20, 1, 19], [19, 20, 1], [1, 19, 20], [20, 1, 19], [19, 20, 1], [1, 19, 20], [20, 1, 19], [19, 20, 1], [1, 19, 20], [20, 1, 19]]) == 10", "assert candidate(costs=[[11, 5, 3], [7, 9, 4], [12, 8, 6], [6, 5, 7], [14, 12, 11], [10, 13, 9]]) == 42", "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:\nGiven an array of n integers nums and an integer target, find the 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: Given an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k ...
[ "assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], target=200) == 89", "assert candidate(nums=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], target=-3) == 0", "assert candidate(nums=[0, 0, 0, 0], target=1) == 4", "assert candidate(nums=[5, 2, 6, 4, 5, 1, 6], target=13) == 19", "assert candidate(nu...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], target=200) == 89", "assert candidate(nums=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], target=-3) == 0", "assert candidate(nums=[0, 0, 0, 0], target=1) == 4", "assert candidate(nums=[5, 2, 6, 4, 5, 1, 6], target=13) == ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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, in which exactly two elements appear only onc...
You are an expert Python 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, in which exactly two elements appear only once and all the other elements appear exactly t...
[ "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, 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, 31]) == [31, 30]", "assert candidate(nums=[0, 1]) == [1, 0]", "assert ...
newfacade/LeetCodeDataset
{ "constraints": [ "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, 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, 31]) == [31, 30]", "assert candidate(nums=[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:\nYou have a graph of n nodes labeled from 0 to n - 1. You are given an inte...
You are an expert Python 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 a graph of n nodes labeled from 0 to n - 1. You are given an integer n and a list of edges where edges[i] = [a...
[ "assert candidate(n=5, edges=[[0, 1], [0, 2], [0, 3], [1, 4]]) == True", "assert candidate(n=9, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [7, 8]]) == False", "assert candidate(n=8, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [1, 3]]) == False", "assert c...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=5, edges=[[0, 1], [0, 2], [0, 3], [1, 4]]) == True", "assert candidate(n=9, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [7, 8]]) == False", "assert candidate(n=8, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], [1, 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:\nAn ugly number is a positive integer whose prime factors are limited to 2,...
You are an expert Python 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 ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, return the nth...
[ "assert candidate(n=1550) == 1093500000", "assert candidate(n=1500) == 859963392", "assert candidate(n=1400) == 516560652", "assert candidate(n=10) == 12", "assert candidate(n=1575) == 1230187500", "assert candidate(n=7) == 8", "assert candidate(n=550) == 1555200", "assert candidate(n=1) == 1", "ass...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=1550) == 1093500000", "assert candidate(n=1500) == 859963392", "assert candidate(n=1400) == 516560652", "assert candidate(n=10) == 12", "assert candidate(n=1575) == 1230187500", "assert candidate(n=7) == 8", "assert candidate(n=550) == 1555200", "...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 new alien language that uses the English alphabet. However, 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: There is a new alien language that uses the English alphabet. However, the order of the letters is unknown to you. You ...
[ "assert candidate(words=['zyx', 'zyxw', 'zyxwa', 'zyxwb', 'zyxwc', 'zyxwd', 'zyxwe', 'zyxwf', 'zyxwg', 'zyxwh', 'zyxwi', 'zyxwj', 'zyxwk', 'zyxwl', 'zyxwm', 'zyxwn', 'zyxwo', 'zyxwp', 'zyxwq', 'zyxwr', 'zyxws', 'zyxwt', 'zyxwu', 'zyxwv', 'zyxww', 'zyxwx', 'zyxwy', 'zyxwz']) == 'abcdefghijklmnopqrstuvwxyz'", "asse...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(words=['zyx', 'zyxw', 'zyxwa', 'zyxwb', 'zyxwc', 'zyxwd', 'zyxwe', 'zyxwf', 'zyxwg', 'zyxwh', 'zyxwi', 'zyxwj', 'zyxwk', 'zyxwl', 'zyxwm', 'zyxwn', 'zyxwo', 'zyxwp', 'zyxwq', 'zyxwr', 'zyxws', 'zyxwt', 'zyxwu', 'zyxwv', 'zyxww', 'zyxwx', 'zyxwy', 'zyxwz']) == 'abcdefghijklmnop...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 search tree, a target value, and an integer k, ...
You are an expert Python 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 search tree, a target value, and an integer k, return the k values in the BST that are close...
[ "assert candidate(root=tree_node([1]), target=0.0, k=1) == [1]", "assert candidate(root=tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 180]), target=105.6, k=6) == [75, 90, 100, 110, 125, 140]", "assert candidate(root=tree_node([10, 5, 15, 2, 7, 12, 18, 1, 3, 6, 8, 11, 13, 16, 19]), t...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([1]), target=0.0, k=1) == [1]", "assert candidate(root=tree_node([100, 50, 150, 25, 75, 125, 175, 10, 40, 60, 90, 110, 140, 160, 180]), target=105.6, k=6) == [75, 90, 100, 110, 125, 140]", "assert candidate(root=tree_node([10, 5, 15, 2, 7, 12, 18, 1, 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:\nConvert a non-negative integer num to its English words representation.\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: Convert a non-negative integer num to its English words representation.   Constraints: 0 <= num <= 231 - 1 ### Format...
[ "assert candidate(num=123000456) == 'One Hundred Twenty Three Million Four Hundred Fifty Six'", "assert candidate(num=100000) == 'One Hundred Thousand'", "assert candidate(num=1010101010) == 'One Billion Ten Million One Hundred One Thousand Ten'", "assert candidate(num=123) == 'One Hundred Twenty Three'", "...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(num=123000456) == 'One Hundred Twenty Three Million Four Hundred Fifty Six'", "assert candidate(num=100000) == 'One Hundred Thousand'", "assert candidate(num=1010101010) == 'One Billion Ten Million One Hundred One Thousand Ten'", "assert candidate(num=123) == 'One ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 citations where citations[i] is the 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 an array of integers citations where citations[i] is the number of citations a researcher received for their ith ...
[ "assert candidate(citations=[34, 23, 12, 45, 67, 89, 100, 99, 88, 77, 66, 55, 44, 33, 22, 11, 0]) == 14", "assert candidate(citations=[150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 14", "assert candidate(citations=[1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12]) == 6", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(citations=[34, 23, 12, 45, 67, 89, 100, 99, 88, 77, 66, 55, 44, 33, 22, 11, 0]) == 14", "assert candidate(citations=[150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == 14", "assert candidate(citations=[1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 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:\nGiven an array of integers citations where citations[i] is the 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 an array of integers citations where citations[i] is the number of citations a researcher received for their ith ...
[ "assert candidate(citations=[10, 20, 30, 40, 50, 60, 70, 80, 90, 1000]) == 10", "assert candidate(citations=[10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10", "assert candidate(citations=[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]) == 10", "assert candidate(ci...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(citations=[10, 20, 30, 40, 50, 60, 70, 80, 90, 1000]) == 10", "assert candidate(citations=[10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 10", "assert candidate(citations=[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]) == 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 n, return the least number of perfect square numbers that...
You are an expert Python 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 least number of perfect square numbers that sum to n. A perfect square is an integer tha...
[ "assert candidate(n=78) == 3", "assert candidate(n=3) == 3", "assert candidate(n=31) == 4", "assert candidate(n=1234) == 2", "assert candidate(n=3125) == 2", "assert candidate(n=28) == 4", "assert candidate(n=4369) == 2", "assert candidate(n=12345) == 3", "assert candidate(n=144) == 1", "assert ca...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=78) == 3", "assert candidate(n=3) == 3", "assert candidate(n=31) == 4", "assert candidate(n=1234) == 2", "assert candidate(n=3125) == 2", "assert candidate(n=28) == 4", "assert candidate(n=4369) == 2", "assert candidate(n=12345) == 3", "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, reorder it such that nums[0] <= nums[1] >= nu...
You are an expert Python 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, reorder it such that nums[0] <= nums[1] >= nums[2] <= nums[3].... You may assume the input...
[ "assert candidate(nums=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4]) == None", "assert candidate(nums=[4, 2, 3, 1]) == None", "assert candidate(nums=[10, 9, 8, 7, 6, 5]) == None", "assert candidate(nums=[1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == None", "assert candidate(nums=[4,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4]) == None", "assert candidate(nums=[4, 2, 3, 1]) == None", "assert candidate(nums=[10, 9, 8, 7, 6, 5]) == None", "assert candidate(nums=[1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14]) == 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 a string num that contains only digits and an integer target, return...
You are an expert Python 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 string num that contains only digits and an integer target, return all possibilities to insert the binary opera...
[ "assert candidate(num='987654321', target=100) == ['9+8+7+6*5+43+2+1', '9+8+7-6-5+43*2+1', '9+8+7*6+5+4+32*1', '9+8+7*6-5+43+2+1', '9+8+7*6*5-4*32+1', '9+8+7+65+4+3*2+1', '9+8+7+65+4*3-2+1', '9+8-7+65+4*3*2+1', '9+8*7+6+5+4*3*2*1', '9+8*7+6*5+4+3-2*1', '9+8*7-6+5+4+32*1', '9+8*7-6-5+43+2+1', '9+8+76+5+4-3+2-1', '9+...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(num='987654321', target=100) == ['9+8+7+6*5+43+2+1', '9+8+7-6-5+43*2+1', '9+8+7*6+5+4+32*1', '9+8+7*6-5+43+2+1', '9+8+7*6*5-4*32+1', '9+8+7+65+4+3*2+1', '9+8+7+65+4*3-2+1', '9+8-7+65+4*3*2+1', '9+8*7+6+5+4*3*2*1', '9+8*7+6*5+4+3-2*1', '9+8*7-6+5+4+32*1', '9+8*7-6-5+43+2+1', '9...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 rooms initialized with these three possible va...
You are an expert Python 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 rooms initialized with these three possible values. -1 A wall or an obstacle. 0 A gate. IN...
[ "assert candidate(rooms=[[2147483647, 2147483647, 2147483647, 2147483647], [2147483647, 2147483647, 2147483647, 2147483647], [2147483647, 2147483647, 2147483647, 2147483647], [0, 2147483647, 2147483647, 2147483647], [2147483647, -1, 0, 2147483647], [2147483647, 2147483647, 2147483647, -1]]) == None", "assert cand...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(rooms=[[2147483647, 2147483647, 2147483647, 2147483647], [2147483647, 2147483647, 2147483647, 2147483647], [2147483647, 2147483647, 2147483647, 2147483647], [0, 2147483647, 2147483647, 2147483647], [2147483647, -1, 0, 2147483647], [2147483647, 2147483647, 2147483647, -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 an array of integers nums containing n + 1 integers where each 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: Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is...
[ "assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]) == 1", "assert candidate(nums=[5, 4, 3, 2, 1, 6, 5, 7, 8, 9, 10]) == 5", "assert candidate(nums=[10, 8, 9, 6, 3, 1, 2, 7, 4, 10, 5]) == 10", "assert candidate(nums=[3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 3]) == 3", "assert candidate(nums=[7, 7, 7, 7, 7, 7, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]) == 1", "assert candidate(nums=[5, 4, 3, 2, 1, 6, 5, 7, 8, 9, 10]) == 5", "assert candidate(nums=[10, 8, 9, 6, 3, 1, 2, 7, 4, 10, 5]) == 10", "assert candidate(nums=[3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 3]) == 3", "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:\nAccording to Wikipedia's article: \"The Game of Life, also known simply as...
You are an expert Python 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: According to Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the ...
[ "assert candidate(board=[[0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0]]) == None", "assert candidate(board=[[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) == None", "assert candidate(board=[[0, 0, 0, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(board=[[0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0]]) == None", "assert candidate(board=[[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) == None", "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:\nGiven a pattern and a string s, return true if s matches the pattern.\nA 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: Given a pattern and a string s, return true if s matches the pattern. A string s matches a pattern if there is some bij...
[ "assert candidate(pattern='abab', s='aabb') == False", "assert candidate(pattern='abc', s='bent') == True", "assert candidate(pattern='ababab', s='dogcatdogcatdogcat') == True", "assert candidate(pattern='abacabac', s='onetwothreeonetwothreeonetwothreeonetwothree') == True", "assert candidate(pattern='ababa...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(pattern='abab', s='aabb') == False", "assert candidate(pattern='abc', s='bent') == True", "assert candidate(pattern='ababab', s='dogcatdogcatdogcat') == True", "assert candidate(pattern='abacabac', s='onetwothreeonetwothreeonetwothreeonetwothree') == True", "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:\nYou are playing a Flip Game with your friend.\nYou are given a string curr...
You are an expert Python 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 playing a Flip Game with your friend. You are given a string currentState that contains only '+' and '-'. You a...
[ "assert candidate(currentState='--++++++--++++++--++++++--') == True", "assert candidate(currentState='++-++-++-++-++-++-++-++-++-++-++-++') == False", "assert candidate(currentState='-+++++++-++++++-') == True", "assert candidate(currentState='-++++++-++++++-++++++-++++++-++++++') == True", "assert candida...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(currentState='--++++++--++++++--++++++--') == True", "assert candidate(currentState='++-++-++-++-++-++-++-++-++-++-++-++') == False", "assert candidate(currentState='-+++++++-++++++-') == True", "assert candidate(currentState='-++++++-++++++-++++++-++++++-++++++') ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n binary grid grid where each 1 marks the home of one friend,...
You are an expert Python 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 m x n binary grid grid where each 1 marks the home of one friend, return the minimal total travel distance. Th...
[ "assert candidate(grid=[[1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[[1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 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:\nYou are playing the Bulls and Cows game with your friend.\nYou write down ...
You are an expert Python 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 playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess w...
[ "assert candidate(secret='0011001100', guess='1100110011') == '0A8B'", "assert candidate(secret='1223344556', guess='6554433221') == '0A10B'", "assert candidate(secret='1123', guess='0111') == '1A1B'", "assert candidate(secret='1234567890', guess='9876543210') == '2A8B'", "assert candidate(secret='0000', gu...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(secret='0011001100', guess='1100110011') == '0A8B'", "assert candidate(secret='1223344556', guess='6554433221') == '0A10B'", "assert candidate(secret='1123', guess='0111') == '1A1B'", "assert candidate(secret='1234567890', guess='9876543210') == '2A8B'", "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 integer array nums, return the length of the longest strictly inc...
You are an expert Python 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 length of the longest strictly increasing subsequence.   Constraints: 1 <= num...
[ "assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 1", "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, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]) == 1", "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, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 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:\nYou are given an empty 2D binary grid grid of size m x n. The grid represe...
You are an expert Python 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 empty 2D binary grid grid of size m x n. The grid represents a map where 0's represent water and 1's r...
[ "assert candidate(m=4, n=4, positions=[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3]]) == [1, 1, 1, 1, 2, 2, 2, 2]", "assert candidate(m=8, n=8, positions=[[3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5], [5, 3], [5, 4], [5, 5], [2, 2], [2, 3], [2, 4], [3, 2], [4, 2], [5, 2], [2, 5], [3, 6], [4, 6...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(m=4, n=4, positions=[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3], [3, 2], [3, 3]]) == [1, 1, 1, 1, 2, 2, 2, 2]", "assert candidate(m=8, n=8, positions=[[3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5], [5, 3], [5, 4], [5, 5], [2, 2], [2, 3], [2, 4], [3, 2], [4, 2], [5, 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:\nAn additive number is a string whose digits can form an additive sequence....
You are an expert Python 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 additive number is a string whose digits can form an additive sequence. A valid additive sequence should contain at ...
[ "assert candidate(num='1212243660100961962968965936565601271879009877665776613593530136146765122399774777472502727500') == False", "assert candidate(num='1212243660100961962968965936565601271879009877665776613593530136146765122399774777472502727500222') == False", "assert candidate(num='101020305081321345588143...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(num='1212243660100961962968965936565601271879009877665776613593530136146765122399774777472502727500') == False", "assert candidate(num='1212243660100961962968965936565601271879009877665776613593530136146765122399774777472502727500222') == False", "assert candidate(num=...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 prices where prices[i] is the price of a given stoc...
You are an expert Python 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 prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you...
[ "assert candidate(prices=[3, 2, 6, 5, 0, 3, 1, 4, 5, 4, 7, 8, 9, 3, 2, 1, 0, 12, 14, 16, 18, 20, 19, 18, 17, 16, 15, 14]) == 33", "assert candidate(prices=[1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2]) == 6", "assert candidate(prices=[7, 1, 5, 3, 6, 4, 9, 2, 5, 8]) == 12", "assert candidate(prices=[8, 6, 4, 3, 3, 2, 3...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(prices=[3, 2, 6, 5, 0, 3, 1, 4, 5, 4, 7, 8, 9, 3, 2, 1, 0, 12, 14, 16, 18, 20, 19, 18, 17, 16, 15, 14]) == 33", "assert candidate(prices=[1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2]) == 6", "assert candidate(prices=[7, 1, 5, 3, 6, 4, 9, 2, 5, 8]) == 12", "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:\nA tree is an undirected graph in which any two vertices are connected by 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: A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connecte...
[ "assert candidate(n=13, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 10], [11, 12]]) == []", "assert candidate(n=9, edges=[[0, 1], [0, 2], [0, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8]]) == [0]", "assert candidate(n=20, edges=[[0, 1], [0, 2], [1,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=13, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11], [8, 12], [9, 10], [11, 12]]) == []", "assert candidate(n=9, edges=[[0, 1], [0, 2], [0, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8]]) == [0]", "assert candidate(n=20, e...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 sparse matrices mat1 of size m x k and mat2 of size k x n, retur...
You are an expert Python 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 sparse matrices mat1 of size m x k and mat2 of size k x n, return the result of mat1 x mat2. You may assume t...
[ "assert candidate(mat1=[[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7], [3, 4, 5, 6, 7, 8]], mat2=[[6, 5, 4, 3, 2, 1], [7, 6, 5, 4, 3, 2], [8, 7, 6, 5, 4, 3], [9, 8, 7, 6, 5, 4], [10, 9, 8, 7, 6, 5], [11, 10, 9, 8, 7, 6]]) == [[196, 175, 154, 133, 112, 91], [247, 220, 193, 166, 139, 112], [298, 265, 232, 199, 166, 133]]", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(mat1=[[1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7], [3, 4, 5, 6, 7, 8]], mat2=[[6, 5, 4, 3, 2, 1], [7, 6, 5, 4, 3, 2], [8, 7, 6, 5, 4, 3], [9, 8, 7, 6, 5, 4], [10, 9, 8, 7, 6, 5], [11, 10, 9, 8, 7, 6]]) == [[196, 175, 154, 133, 112, 91], [247, 220, 193, 166, 139, 112], [298, 265, 23...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 super ugly number is a positive integer whose prime factors are in the 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: A super ugly number is a positive integer whose prime factors are in the array primes. Given an integer n and an array ...
[ "assert candidate(n=75, primes=[3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == 231", "assert candidate(n=75, primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 76", "assert candidate(n=500, primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == 928", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=75, primes=[3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]) == 231", "assert candidate(n=75, primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]) == 76", "assert candidate(n=500, primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 an integer array counts where counts[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: Given an integer array nums, return an integer array counts where counts[i] is the number of smaller elements to the ri...
[ "assert candidate(nums=[3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2]) == [10, 8, 8, 6, 6, 4, 4, 2, 2, 0, 0]", "assert candidate(nums=[10000, -10000, 5000, 0, 5000]) == [4, 0, 1, 0, 0]", "assert candidate(nums=[5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]", "assert candidate(nums=[1, 2,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2]) == [10, 8, 8, 6, 6, 4, 4, 2, 2, 0, 0]", "assert candidate(nums=[10000, -10000, 5000, 0, 5000]) == [4, 0, 1, 0, 0]", "assert candidate(nums=[5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]", "a...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, remove duplicate letters so that every letter appears on...
You are an expert Python 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 string s, remove duplicate letters so that every letter appears once and only once. You must make sure your res...
[ "assert candidate(s='abcdefghxyzzyxwvutsrqponmlkjihgfedcba') == 'abcdefghxyzwvutsrqponmlkji'", "assert candidate(s='thisisareallylongstringwithsomerepeatedcharacters') == 'aelyginwhompdcrts'", "assert candidate(s='xyzzyxwvutsrqponmlkjihgfedcbazyxzyxwvutsrqponmlkjihgfedcba') == 'axzywvutsrqponmlkjihgfedcb'", "...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='abcdefghxyzzyxwvutsrqponmlkjihgfedcba') == 'abcdefghxyzwvutsrqponmlkji'", "assert candidate(s='thisisareallylongstringwithsomerepeatedcharacters') == 'aelyginwhompdcrts'", "assert candidate(s='xyzzyxwvutsrqponmlkjihgfedcbazyxzyxwvutsrqponmlkjihgfedcba') == 'axzywvut...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string array words, return the maximum value of length(word[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: Given a string array words, return the maximum value of length(word[i]) * length(word[j]) where the two words do not sh...
[ "assert candidate(words=['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', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', 'xx', 'yy', 'zz']) == 4...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(words=['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', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', '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:\nThere are n bulbs that are initially off. You first turn on all the bulbs,...
You are an expert Python 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 bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the ...
[ "assert candidate(n=9) == 3", "assert candidate(n=10000000) == 3162", "assert candidate(n=100000) == 316", "assert candidate(n=1600) == 40", "assert candidate(n=576) == 24", "assert candidate(n=789456) == 888", "assert candidate(n=2209) == 47", "assert candidate(n=1000000000) == 31622", "assert cand...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=9) == 3", "assert candidate(n=10000000) == 3162", "assert candidate(n=100000) == 316", "assert candidate(n=1600) == 40", "assert candidate(n=576) == 24", "assert candidate(n=789456) == 888", "assert candidate(n=2209) == 47", "assert candidate(n=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 word's generalized abbreviation can be constructed by taking any number ...
You are an expert Python 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 word's generalized abbreviation can be constructed by taking any number of non-overlapping and non-adjacent substring...
[ "assert candidate(word='aabbcc') == ['aabbcc', 'aabbc1', 'aabb1c', 'aabb2', 'aab1cc', 'aab1c1', 'aab2c', 'aab3', 'aa1bcc', 'aa1bc1', 'aa1b1c', 'aa1b2', 'aa2cc', 'aa2c1', 'aa3c', 'aa4', 'a1bbcc', 'a1bbc1', 'a1bb1c', 'a1bb2', 'a1b1cc', 'a1b1c1', 'a1b2c', 'a1b3', 'a2bcc', 'a2bc1', 'a2b1c', 'a2b2', 'a3cc', 'a3c1', 'a4c...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(word='aabbcc') == ['aabbcc', 'aabbc1', 'aabb1c', 'aabb2', 'aab1cc', 'aab1c1', 'aab2c', 'aab3', 'aa1bcc', 'aa1bc1', 'aa1b1c', 'aa1b2', 'aa2cc', 'aa2c1', 'aa3c', 'aa4', 'a1bbcc', 'a1bbc1', 'a1bb1c', 'a1bb2', 'a1b1cc', 'a1b1c1', 'a1b2c', 'a1b3', 'a2bcc', 'a2bc1', 'a2b1c', 'a2b2',...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 of lengths m and n respec...
You are an expert Python 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 of lengths m and n respectively. nums1 and nums2 represent the digits ...
[ "assert candidate(nums1=[5, 5, 5, 5], nums2=[6, 6, 6, 6], k=7) == [6, 6, 6, 6, 5, 5, 5]", "assert candidate(nums1=[5, 5, 5, 5], nums2=[5, 5, 5, 5], k=7) == [5, 5, 5, 5, 5, 5, 5]", "assert candidate(nums1=[9, 9, 9, 9, 9], nums2=[1, 2, 3, 4, 5], k=9) == [9, 9, 9, 9, 9, 2, 3, 4, 5]", "assert candidate(nums1=[3, ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums1=[5, 5, 5, 5], nums2=[6, 6, 6, 6], k=7) == [6, 6, 6, 6, 5, 5, 5]", "assert candidate(nums1=[5, 5, 5, 5], nums2=[5, 5, 5, 5], k=7) == [5, 5, 5, 5, 5, 5, 5]", "assert candidate(nums1=[9, 9, 9, 9, 9], nums2=[1, 2, 3, 4, 5], k=9) == [9, 9, 9, 9, 9, 2, 3, 4, 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 nums, reorder it such that nums[0] < nums[1] > 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: Given an integer array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... You may assume the input ar...
[ "assert candidate(nums=[1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == None", "assert candidate(nums=[5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == None", "assert candidate(nums=[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) =...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1]) == None", "assert candidate(nums=[5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]) == None", "assert candidate(nums=[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 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:\nGiven an integer array nums and two integers lower and upper, return the 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: Given an integer array nums and two integers lower and upper, return the number of range sums that lie in [lower, upper...
[ "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], lower=15, upper=30) == 31", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], lower=5, upper=15) == 19", "assert candidate(nums=[5, -5, 5, -5, 5, -5, 5, -5, 5, -5], lower=-10, upper=10) == 55", "assert candid...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], lower=15, upper=30) == 31", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], lower=5, upper=15) == 19", "assert candidate(nums=[5, -5, 5, -5, 5, -5, 5, -5, 5, -5], lower=-10, upper=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 the head of a singly linked list, group all the nodes with odd indic...
You are an expert Python 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 head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even i...
[ "assert is_same_list(candidate(head=list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([10, 8, 6, 4, 2, 9, 7, 5, 3, 1]))", "assert is_same_list(candidate(head=list_node([1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5])), list_node([1, 2, 3, 4, 4, 5, 5, 5, 2, 3, 3, 4, 4, 5, 5]))", "assert is_same_list(candidate...
newfacade/LeetCodeDataset
{ "constraints": [ "assert is_same_list(candidate(head=list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])), list_node([10, 8, 6, 4, 2, 9, 7, 5, 3, 1]))", "assert is_same_list(candidate(head=list_node([1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5])), list_node([1, 2, 3, 4, 4, 5, 5, 5, 2, 3, 3, 4, 4, 5, 5]))", "asse...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 sorted integer array nums and an integer n, add/patch elements to ...
You are an expert Python 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 sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [...
[ "assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536], n=100000000) == 10", "assert candidate(nums=[1, 2, 8, 16, 32, 64, 128], n=256) == 2", "assert candidate(nums=[1, 2, 4, 13], n=30) == 2", "assert candidate(nums=[1, 2, 3, 6, 12, 24, 48, 96, 192, 384, 76...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536], n=100000000) == 10", "assert candidate(nums=[1, 2, 8, 16, 32, 64, 128], n=256) == 2", "assert candidate(nums=[1, 2, 4, 13], n=30) == 2", "assert candidate(nums=[1, 2, 3, 6, 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:\nOne way to serialize a binary tree is to use preorder traversal. When we 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: One way to serialize a binary tree is to use preorder traversal. When we encounter a non-null node, we record the node'...
[ "assert candidate(preorder='5,#,#,6,7,#,#,#') == False", "assert candidate(preorder='1,2,3,4,5,#,#,6,7,#,8,9,#,#,10,#,#,11,12,#,#,13,#,#') == False", "assert candidate(preorder='5,1,#,#,4,3,6,#,#,#,2,#,7,#,#') == True", "assert candidate(preorder='100,50,25,#,#,75,#,#,150,125,#,#,175,#,#') == True", "assert...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(preorder='5,#,#,6,7,#,#,#') == False", "assert candidate(preorder='1,2,3,4,5,#,#,6,7,#,8,9,#,#,10,#,#,11,12,#,#,13,#,#') == False", "assert candidate(preorder='5,1,#,#,4,3,6,#,#,#,2,#,7,#,#') == True", "assert candidate(preorder='100,50,25,#,#,75,#,#,150,125,#,#,17...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 list of airline tickets where tickets[i] = [fromi, toi] 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 a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airport...
[ "assert candidate(tickets=[['JFK', 'SFO'], ['SFO', 'DSM'], ['DSM', 'JFK'], ['JFK', 'SFO'], ['SFO', 'LAX'], ['LAX', 'JFK'], ['JFK', 'SFO'], ['SFO', 'DSM']]) == ['JFK', 'SFO', 'DSM', 'JFK', 'SFO', 'LAX', 'JFK', 'SFO', 'DSM']", "assert candidate(tickets=[['JFK', 'KUL'], ['KUL', 'LAX'], ['LAX', 'JFK'], ['JFK', 'DUB']...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(tickets=[['JFK', 'SFO'], ['SFO', 'DSM'], ['DSM', 'JFK'], ['JFK', 'SFO'], ['SFO', 'LAX'], ['LAX', 'JFK'], ['JFK', 'SFO'], ['SFO', 'DSM']]) == ['JFK', 'SFO', 'DSM', 'JFK', 'SFO', 'LAX', 'JFK', 'SFO', 'DSM']", "assert candidate(tickets=[['JFK', 'KUL'], ['KUL', 'LAX'], ['LAX',...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 largest subtree, which is also 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 the root of a binary tree, find the largest subtree, which is also a Binary Search Tree (BST), where the largest ...
[ "assert candidate(root=tree_node([10, 5, 15, 1, 8, None, 20, 0, None, None, 9, 16, 25])) == 10", "assert candidate(root=tree_node([10, 5, 15, 1, 8, None, 7, 0, 4, 6, 9, None, None, 16, 17, None, None, 18, 19, 20])) == 1", "assert candidate(root=tree_node([10, 5, 15, 1, None, 6, 20])) == 3", "assert candidate(...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([10, 5, 15, 1, 8, None, 20, 0, None, None, 9, 16, 25])) == 10", "assert candidate(root=tree_node([10, 5, 15, 1, 8, None, 7, 0, 4, 6, 9, None, None, 16, 17, None, None, 18, 19, 20])) == 1", "assert candidate(root=tree_node([10, 5, 15, 1, None, 6, 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:\nGiven an integer array nums, return true if there exists a triple of indic...
You are an expert Python 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 true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] ...
[ "assert candidate(nums=[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True", "assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100, 1]) == False", "assert candidate(nums=[2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == True", "assert candidate...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True", "assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40, -50, -60, -70, -80, -90, -100, 1]) == False", "assert candidate(nums=[2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == T...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of integers distance.\nYou start at the point (0, 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: You are given an array of integers distance. You start at the point (0, 0) on an X-Y plane, and you move distance[0] me...
[ "assert candidate(distance=[1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == True", "assert candidate(distance=[1, 2, 3, 4, 5, 4, 3, 3, 2, 2, 1, 1]) == True", "assert candidate(distance=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == T...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(distance=[1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]) == True", "assert candidate(distance=[1, 2, 3, 4, 5, 4, 3, 3, 2, 2, 1, 1]) == True", "assert candidate(distance=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed array of unique strings words.\nA palindrome pai...
You are an expert Python 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 0-indexed array of unique strings words. A palindrome pair is a pair of integers (i, j) such that: 0 <...
[ "assert candidate(words=['ab', 'ba', 'abc', 'cba', 'abcd', 'dcba', 'abcde', 'edcba', 'abcdef', 'fedcba']) == [[0, 1], [1, 0], [2, 1], [2, 3], [0, 3], [3, 2], [4, 3], [4, 5], [2, 5], [5, 4], [6, 5], [6, 7], [4, 7], [7, 6], [8, 7], [8, 9], [6, 9], [9, 8]]", "assert candidate(words=['abcde', 'edcba', '', '', 'abcdee...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(words=['ab', 'ba', 'abc', 'cba', 'abcd', 'dcba', 'abcde', 'edcba', 'abcdef', 'fedcba']) == [[0, 1], [1, 0], [2, 1], [2, 3], [0, 3], [3, 2], [4, 3], [4, 5], [2, 5], [5, 4], [6, 5], [6, 7], [4, 7], [7, 6], [8, 7], [8, 9], [6, 9], [9, 8]]", "assert candidate(words=['abcde', '...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 thief has found himself a new place for his thievery again. There is 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: The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root. B...
[ "assert candidate(root=tree_node([10, 5, 15, 2, 7, None, 20, 1, None, 6, 8, None, None, None, 9])) == 55", "assert candidate(root=tree_node([2, 1, 3, None, 4, None, 5, None, 6])) == 13", "assert candidate(root=tree_node([6, 3, 7, 2, 5, None, 8, 1, 4, None, None, None, None, None, 9])) == 32", "assert candidat...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([10, 5, 15, 2, 7, None, 20, 1, None, 6, 8, None, None, None, 9])) == 55", "assert candidate(root=tree_node([2, 1, 3, None, 4, None, 5, None, 6])) == 13", "assert candidate(root=tree_node([6, 3, 7, 2, 5, None, 8, 1, 4, None, None, None, None, None, 9])) =...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s and an integer k, return the length of the longest substr...
You are an expert Python 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 string s and an integer k, return the length of the longest substring of s that contains at most k distinct cha...
[ "assert candidate(s='xyzzzzxyzzzxyzz', k=2) == 5", "assert candidate(s='abcd', k=0) == 0", "assert candidate(s='aabbccddeeffgg', k=4) == 8", "assert candidate(s='aabacbebebe', k=3) == 7", "assert candidate(s='abcdefgabcdefgabcdefg', k=5) == 5", "assert candidate(s='abacabadabacaba', k=1) == 1", "assert ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='xyzzzzxyzzzxyzz', k=2) == 5", "assert candidate(s='abcd', k=0) == 0", "assert candidate(s='aabbccddeeffgg', k=4) == 8", "assert candidate(s='aabacbebebe', k=3) == 7", "assert candidate(s='abcdefgabcdefgabcdefg', k=5) == 5", "assert candidate(s='abacabada...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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, break it into the sum of k positive integers, where k ...
You are an expert Python 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, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integ...
[ "assert candidate(n=10) == 36", "assert candidate(n=20) == 1458", "assert candidate(n=13) == 108", "assert candidate(n=37) == 708588", "assert candidate(n=42) == 4782969", "assert candidate(n=28) == 26244", "assert candidate(n=47) == 28697814", "assert candidate(n=19) == 972", "assert candidate(n=53...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=10) == 36", "assert candidate(n=20) == 1458", "assert candidate(n=13) == 108", "assert candidate(n=37) == 708588", "assert candidate(n=42) == 4782969", "assert candidate(n=28) == 26244", "assert candidate(n=47) == 28697814", "assert candidate(n=19...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 k most frequent 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 array nums and an integer k, return the k most frequent elements. You may return the answer in any ord...
[ "assert candidate(nums=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8], k=3) == [8, 7, 6]", "assert candidate(nums=[5, 3, 1, 1, 1, 3, 5, 2, 2, 2, 4, 4, 4, 4], k=3) == [4, 1, 2]", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=5) == [1, 2...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8], k=3) == [8, 7, 6]", "assert candidate(nums=[5, 3, 1, 1, 1, 3, 5, 2, 2, 2, 4, 4, 4, 4], k=3) == [4, 1, 2]", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7,...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 n points on a 2D plane, find if there is such a line parallel to 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: Given n points on a 2D plane, find if there is such a line parallel to the y-axis that reflects the given points symmet...
[ "assert candidate(points=[[-10, 5], [-9, 4], [-8, 3], [-7, 2], [-6, 1], [-5, 0], [-4, -1], [-3, -2], [-2, -3], [-1, -4], [0, -5]]) == False", "assert candidate(points=[[1, 2], [2, 2], [3, 2]]) == True", "assert candidate(points=[[-5, 1], [-4, 2], [-3, 3], [-2, 4], [-1, 5], [0, 6], [1, 5], [2, 4], [3, 3], [4, 2]...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(points=[[-10, 5], [-9, 4], [-8, 3], [-7, 2], [-6, 1], [-5, 0], [-4, -1], [-3, -2], [-2, -3], [-1, -4], [0, -5]]) == False", "assert candidate(points=[[1, 2], [2, 2], [3, 2]]) == True", "assert candidate(points=[[-5, 1], [-4, 2], [-3, 3], [-2, 4], [-1, 5], [0, 6], [1, 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 a string s and an integer k, rearrange s such that the same characte...
You are an expert Python 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 string s and an integer k, rearrange s such that the same characters are at least distance k from each other. I...
[ "assert candidate(s='aabaaaabaaabaaab', k=4) == ''", "assert candidate(s='aabbccddeeffgghhii', k=1) == 'abcdefghiabcdefghi'", "assert candidate(s='mnopqrstuvwxyzmnopqrstuvwxyz', k=27) == ''", "assert candidate(s='ababab', k=2) == 'ababab'", "assert candidate(s='aabbbccddeeefff', k=3) == 'befabcdefabcdef'", ...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='aabaaaabaaabaaab', k=4) == ''", "assert candidate(s='aabbccddeeffgghhii', k=1) == 'abcdefghiabcdefghi'", "assert candidate(s='mnopqrstuvwxyzmnopqrstuvwxyz', k=27) == ''", "assert candidate(s='ababab', k=2) == 'ababab'", "assert candidate(s='aabbbccddeeefff',...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 sorted integer array nums and three integers a, b and c, apply a q...
You are an expert Python 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 sorted integer array nums and three integers a, b and c, apply a quadratic function of the form f(x) = ax2 + bx...
[ "assert candidate(nums=[-5, -4, -3, -2, -1], a=-1, b=0, c=0) == [-25, -16, -9, -4, -1]", "assert candidate(nums=[-50, -25, 0, 25, 50], a=-3, b=0, c=100) == [-7400, -7400, -1775, -1775, 100]", "assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], a=-2, b=4, c=-6) == [-652, -516, -396, -292, -204, -132, -76...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[-5, -4, -3, -2, -1], a=-1, b=0, c=0) == [-25, -16, -9, -4, -1]", "assert candidate(nums=[-50, -25, 0, 25, 50], a=-3, b=0, c=100) == [-7400, -7400, -1775, -1775, 100]", "assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], a=-2, b=4, c=-6) == [-652, -516, -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 an m x n matrix grid where each cell is either a wall 'W', an enemy ...
You are an expert Python 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 m x n matrix grid where each cell is either a wall 'W', an enemy 'E' or empty '0', return the maximum enemies ...
[ "assert candidate(grid=[['E', 'E', 'E', 'E'], ['E', '0', 'E', 'E'], ['E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E']]) == 7", "assert candidate(grid=[['E', 'E', 'E', 'E', 'E'], ['0', 'W', 'W', 'W', '0'], ['E', 'E', '0', 'E', 'E'], ['0', 'W', 'W', 'W', '0'], ['E', 'E', 'E', 'E', 'E']]) == 4", "as...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(grid=[['E', 'E', 'E', 'E'], ['E', '0', 'E', 'E'], ['E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E']]) == 7", "assert candidate(grid=[['E', 'E', 'E', 'E', 'E'], ['0', 'W', 'W', 'W', '0'], ['E', 'E', '0', 'E', 'E'], ['0', 'W', 'W', 'W', '0'], ['E', 'E', 'E', '...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n matrix matrix and an integer k, return the max sum of a rec...
You are an expert Python 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 m x n matrix matrix and an integer k, return the max sum of a rectangle in the matrix such that its sum is no ...
[ "assert candidate(matrix=[[-5, 10, -20, 15, 25], [-1, 2, 3, -4, 5], [20, -25, 30, -35, 40], [-10, 15, 20, -25, 30]], k=10) == 10", "assert candidate(matrix=[[-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]], k=-50) == -50", "assert cand...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(matrix=[[-5, 10, -20, 15, 25], [-1, 2, 3, -4, 5], [20, -25, 30, -35, 40], [-10, 15, 20, -25, 30]], k=10) == 10", "assert candidate(matrix=[[-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]], k=-50) ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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, collect a tree's nodes as if you were doi...
You are an expert Python 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, collect a tree's nodes as if you were doing this: Collect all the leaf nodes. Remove ...
[ "assert candidate(root=tree_node([1, 2, 3, None, None, 4, 5, None, 6, None, None, 7, 8, None, 9, None, None, 10, 11, None, None, 12, 13, None, None, 14, 15, None, None, 16, 17, None, None, 18, 19, None, None, 20, 21, None, None, 22, 23, None, None, 24, 25, None, None, 26, 27, None, None, 28, 29, None, None, 30, 31]...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(root=tree_node([1, 2, 3, None, None, 4, 5, None, 6, None, None, 7, 8, None, 9, None, None, 10, 11, None, None, 12, 13, None, None, 14, 15, None, None, 16, 17, None, None, 18, 19, None, None, 20, 21, None, None, 22, 23, None, None, 24, 25, None, None, 26, 27, None, None, 28, 29...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 set of distinct positive integers nums, return the largest 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: Given a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answe...
[ "assert candidate(nums=[5, 10, 20, 25, 50, 100, 125, 200, 250, 500, 1000]) == [1000, 500, 250, 125, 25, 5]", "assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == [524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[5, 10, 20, 25, 50, 100, 125, 200, 250, 500, 1000]) == [1000, 500, 250, 125, 25, 5]", "assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == [524288, 262144, 131072, 65536, 32768, 16384, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 non-negative integer represented as a linked list of digits, plus ...
You are an expert Python 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 non-negative integer represented as a linked list of digits, plus one to the integer. The digits are stored suc...
[ "assert is_same_list(candidate(head=list_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 0])), list_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 1]))", "assert is_same_list(candidate(head=list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 2]))", "assert is_same_list(candidate(head=list_node([1, 2, 3])), lis...
newfacade/LeetCodeDataset
{ "constraints": [ "assert is_same_list(candidate(head=list_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 0])), list_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 1]))", "assert is_same_list(candidate(head=list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 2]))", "assert is_same_list(candidate(head=l...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 the sum of the two integers without usi...
You are an expert Python 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 the sum of the two integers without using the operators + and -.   Constraints: -10...
[ "assert candidate(a=345, b=678) == 1023", "assert candidate(a=-1, b=0) == -1", "assert candidate(a=-5, b=-5) == -10", "assert candidate(a=-999, b=999) == 0", "assert candidate(a=0, b=1000) == 1000", "assert candidate(a=999, b=1) == 1000", "assert candidate(a=1234, b=-5678) == -4444", "assert candidate...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(a=345, b=678) == 1023", "assert candidate(a=-1, b=0) == -1", "assert candidate(a=-5, b=-5) == -10", "assert candidate(a=-999, b=999) == 0", "assert candidate(a=0, b=1000) == 1000", "assert candidate(a=999, b=1) == 1000", "assert candidate(a=1234, b=-567...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 sorted in non-decreasing ...
You are an expert Python 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 sorted in non-decreasing order and an integer k. Define a pair (u, v) ...
[ "assert candidate(nums1=[1, 2, 3, 4, 5], nums2=[1, 2, 3, 4, 5], k=1) == [[1, 1]]", "assert candidate(nums1=[5, 8, 8, 10], nums2=[1, 7, 11, 11], k=10) == [[5, 1], [8, 1], [8, 1], [10, 1], [5, 7], [8, 7], [8, 7], [5, 11], [5, 11], [10, 7]]", "assert candidate(nums1=[1, 1, 1, 1, 1], nums2=[1, 1, 1, 1, 1], k=10) ==...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums1=[1, 2, 3, 4, 5], nums2=[1, 2, 3, 4, 5], k=1) == [[1, 1]]", "assert candidate(nums1=[5, 8, 8, 10], nums2=[1, 7, 11, 11], k=10) == [[5, 1], [8, 1], [8, 1], [10, 1], [5, 7], [8, 7], [8, 7], [5, 11], [5, 11], [10, 7]]", "assert candidate(nums1=[1, 1, 1, 1, 1], nums2=...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 are playing the Guessing Game. The game will work as follows:\n\nI pick...
You are an expert Python 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 are playing the Guessing Game. The game will work as follows: I pick a number between 1 and n. You guess a number. ...
[ "assert candidate(n=199) == 946", "assert candidate(n=160) == 743", "assert candidate(n=12) == 21", "assert candidate(n=50) == 172", "assert candidate(n=130) == 585", "assert candidate(n=5) == 6", "assert candidate(n=30) == 79", "assert candidate(n=4) == 4", "assert candidate(n=155) == 718", "asse...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=199) == 946", "assert candidate(n=160) == 743", "assert candidate(n=12) == 21", "assert candidate(n=50) == 172", "assert candidate(n=130) == 585", "assert candidate(n=5) == 6", "assert candidate(n=30) == 79", "assert candidate(n=4) == 4", "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:\nA wiggle sequence is a sequence where the differences between successive 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 wiggle sequence is a sequence where the differences between successive numbers strictly alternate between positive an...
[ "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1", "assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5]) == 4", "assert candidate(nums=[10, 20, 10, 20, 30, 20, 30, 40, 30, 40, 50, 40, 50, 60]) == 10", "assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9]) =...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1", "assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5]) == 4", "assert candidate(nums=[10, 20, 10, 20, 30, 20, 30, 40, 30, 40, 50, 40, 50, 60]) == 10", "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:\nGiven an n x n matrix where each of the rows and columns is sorted in asce...
You are an expert Python 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 matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element ...
[ "assert candidate(matrix=[[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36]], k=23) == 23", "assert candidate(matrix=[[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23], [24, 2...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(matrix=[[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36]], k=23) == 23", "assert candidate(matrix=[[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17], [18, 19, ...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 all the numbers in the range [1, n] sorted in l...
You are an expert Python 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 all the numbers in the range [1, n] sorted in lexicographical order. You must write an algor...
[ "assert candidate(n=1024) == [1, 10, 100, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 101, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 102, 1020, 1021, 1022, 1023, 1024, 103, 104, 105, 106, 107, 108, 109, 11, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 12, 120, 121, 122, 123, 1...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=1024) == [1, 10, 100, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 101, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 102, 1020, 1021, 1022, 1023, 1024, 103, 104, 105, 106, 107, 108, 109, 11, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 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:\nYou have a list arr of all integers in the range [1, n] sorted in a strict...
You are an expert Python 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 a list arr of all integers in the range [1, n] sorted in a strictly increasing order. Apply the following algo...
[ "assert candidate(n=59) == 32", "assert candidate(n=999999999) == 534765056", "assert candidate(n=2) == 2", "assert candidate(n=9999) == 5984", "assert candidate(n=100) == 54", "assert candidate(n=5000) == 2014", "assert candidate(n=119) == 56", "assert candidate(n=31) == 16", "assert candidate(n=12...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=59) == 32", "assert candidate(n=999999999) == 534765056", "assert candidate(n=2) == 2", "assert candidate(n=9999) == 5984", "assert candidate(n=100) == 54", "assert candidate(n=5000) == 2014", "assert candidate(n=119) == 56", "assert candidate(n=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 an array rectangles where rectangles[i] = [xi, yi, ai, bi] represent...
You are an expert Python 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 rectangles where rectangles[i] = [xi, yi, ai, bi] represents an axis-aligned rectangle. The bottom-left ...
[ "assert candidate(rectangles=[[-100000, -100000, 100000, 100000]]) == True", "assert candidate(rectangles=[[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [0, 1, 3, 2], [0, 2, 3, 3], [0, 3, 3, 4]]) == True", "assert candidate(rectangles=[[1, 1, 5, 5], [1, 5, 3, 7], [3, 5, 5, 7], [1, 7, 3, 9], [3, 7, 5, 9]]) == True",...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(rectangles=[[-100000, -100000, 100000, 100000]]) == True", "assert candidate(rectangles=[[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [0, 1, 3, 2], [0, 2, 3, 3], [0, 3, 3, 4]]) == True", "assert candidate(rectangles=[[1, 1, 5, 5], [1, 5, 3, 7], [3, 5, 5, 7], [1, 7, 3, 9],...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 data representing the data, return whether it 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: Given an integer array data representing the data, return whether it is a valid UTF-8 encoding (i.e. it translates to a...
[ "assert candidate(data=[11111000, 10000000, 10000000, 10000000, 10000000]) == False", "assert candidate(data=[240, 144, 144, 144, 144]) == False", "assert candidate(data=[192, 128, 192, 128, 192, 128, 192, 128]) == True", "assert candidate(data=[240, 145, 145, 145, 240, 145, 145, 145]) == True", "assert can...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(data=[11111000, 10000000, 10000000, 10000000, 10000000]) == False", "assert candidate(data=[240, 144, 144, 144, 144]) == False", "assert candidate(data=[192, 128, 192, 128, 192, 128, 192, 128]) == True", "assert candidate(data=[240, 145, 145, 145, 240, 145, 145, 14...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 encoded string, return its decoded string.\nThe encoding rule is:...
You are an expert Python 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 encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string i...
[ "assert candidate(s='3[2[3[a2[b]]]]') == 'abbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabb'", "assert candidate(s='2[2[2[2[2[abc]]]]]') == 'abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc'", "assert candidate(s='3[2[a]b]') == 'aabaabaab'", "assert candida...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='3[2[3[a2[b]]]]') == 'abbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabb'", "assert candidate(s='2[2[2[2[2[abc]]]]]') == 'abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc'", "assert candidate(s='3[2[a]b]') == 'aabaa...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s and an integer k, return the length of the longest substr...
You are an expert Python 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 string s and an integer k, return the length of the longest substring of s such that the frequency of each char...
[ "assert candidate(s='abcabcabcabc', k=3) == 12", "assert candidate(s='zzzzzaaazzzzzzzzzz', k=5) == 10", "assert candidate(s='zzzzzzzz', k=5) == 8", "assert candidate(s='thisisjustaverylongteststring', k=3) == 0", "assert candidate(s='ppppppqqqqrrrssstttuuuvvvvwwwwwxxxxxyyyyyzzzz', k=5) == 15", "assert can...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(s='abcabcabcabc', k=3) == 12", "assert candidate(s='zzzzzaaazzzzzzzzzz', k=5) == 10", "assert candidate(s='zzzzzzzz', k=5) == 8", "assert candidate(s='thisisjustaverylongteststring', k=3) == 0", "assert candidate(s='ppppppqqqqrrrssstttuuuvvvvwwwwwxxxxxyyyyyzzzz...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums of length n.\nAssume arrk to be an arr...
You are an expert Python 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 of length n. Assume arrk to be an array obtained by rotating nums by k positions cl...
[ "assert candidate(nums=[4, 3, 2, 6]) == 26", "assert candidate(nums=[100, -50, 200, -25, 300, -75]) == 2000", "assert candidate(nums=[50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 2250", "assert candidate(nums=[100, 0, -100, 50, 0, -50, 25, 0, -25, 12]) == 746", "assert candidate(nums=[-1, -2, -3, -4, -5, -6,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[4, 3, 2, 6]) == 26", "assert candidate(nums=[100, -50, 200, -25, 300, -75]) == 2000", "assert candidate(nums=[50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == 2250", "assert candidate(nums=[100, 0, -100, 50, 0, -50, 25, 0, -25, 12]) == 746", "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 a positive integer n, you can apply one of the following operations:...
You are an expert Python 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 positive integer n, you can apply one of the following operations: If n is even, replace n with n / 2. If n is...
[ "assert candidate(n=16383) == 15", "assert candidate(n=123) == 9", "assert candidate(n=16777215) == 25", "assert candidate(n=1023) == 11", "assert candidate(n=99) == 9", "assert candidate(n=2147483647) == 32", "assert candidate(n=1048575) == 21", "assert candidate(n=65535) == 17", "assert candidate(...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(n=16383) == 15", "assert candidate(n=123) == 9", "assert candidate(n=16777215) == 25", "assert candidate(n=1023) == 11", "assert candidate(n=99) == 9", "assert candidate(n=2147483647) == 32", "assert candidate(n=1048575) == 21", "assert candidate(n=...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 variable pairs equations and an array of real nu...
You are an expert Python 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 variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] a...
[ "assert candidate(equations=[['node1', 'node2'], ['node2', 'node3'], ['node3', 'node4'], ['node4', 'node1'], ['node1', 'node5']], values=[3.0, 4.0, 5.0, 6.0, 7.0], queries=[['node1', 'node5'], ['node5', 'node1'], ['node2', 'node4'], ['node3', 'node2'], ['node4', 'node3'], ['node1', 'node6']]) == [7.0, 0.14285714285...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(equations=[['node1', 'node2'], ['node2', 'node3'], ['node3', 'node4'], ['node4', 'node1'], ['node1', 'node5']], values=[3.0, 4.0, 5.0, 6.0, 7.0], queries=[['node1', 'node5'], ['node5', 'node1'], ['node2', 'node4'], ['node3', 'node2'], ['node4', 'node3'], ['node1', 'node6']]) =...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 string num representing a non-negative integer num, and an integer k...
You are an expert Python 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 string num representing a non-negative integer num, and an integer k, return the smallest possible integer after ...
[ "assert candidate(num='10001', k=1) == '1'", "assert candidate(num='5959595959', k=5) == '55555'", "assert candidate(num='999999999999', k=6) == '999999'", "assert candidate(num='999999999999', k=11) == '9'", "assert candidate(num='999888777666', k=6) == '777666'", "assert candidate(num='1234512345', k=5)...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(num='10001', k=1) == '1'", "assert candidate(num='5959595959', k=5) == '55555'", "assert candidate(num='999999999999', k=6) == '999999'", "assert candidate(num='999999999999', k=11) == '9'", "assert candidate(num='999888777666', k=6) == '777666'", "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:\nA frog is crossing a river. The river is divided into some number of units...
You are an expert Python 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 frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exis...
[ "assert candidate(stones=[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 299, 323, 348, 374, 401, 429]) == True", "assert candidate(stones=[0, 1, 4, 8, 16]) == False", "assert candidate(stones=[0, 1, 4, 7, 11, 16, 22, 29, 37, 46, 56, 67, 79, 92, 106, 121, 1...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(stones=[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 299, 323, 348, 374, 401, 429]) == True", "assert candidate(stones=[0, 1, 4, 8, 16]) == False", "assert candidate(stones=[0, 1, 4, 7, 11, 16, 22, 29, 37, 46, 56...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 people, people, which are the attributes of some...
You are an expert Python 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 people, people, which are the attributes of some people in a queue (not necessarily in order)...
[ "assert candidate(people=[[15, 0], [15, 1], [15, 2], [15, 3], [14, 0], [14, 1], [14, 2], [13, 0], [13, 1], [13, 2], [13, 3], [12, 0], [12, 1], [12, 2], [12, 3], [11, 0], [11, 1], [11, 2], [11, 3]]) == [[11, 0], [11, 1], [11, 2], [11, 3], [12, 0], [12, 1], [12, 2], [12, 3], [13, 0], [13, 1], [13, 2], [13, 3], [14, 0...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(people=[[15, 0], [15, 1], [15, 2], [15, 3], [14, 0], [14, 1], [14, 2], [13, 0], [13, 1], [13, 2], [13, 3], [12, 0], [12, 1], [12, 2], [12, 3], [11, 0], [11, 1], [11, 2], [11, 3]]) == [[11, 0], [11, 1], [11, 2], [11, 3], [12, 0], [12, 1], [12, 2], [12, 3], [13, 0], [13, 1], [13...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n integer matrix heightMap representing the height of each un...
You are an expert Python 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 m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the vol...
[ "assert candidate(heightMap=[[5, 5, 5, 1], [5, 1, 1, 5], [5, 1, 1, 5], [5, 5, 5, 1]]) == 16", "assert candidate(heightMap=[[5, 5, 5, 5, 5, 5], [5, 1, 2, 3, 4, 5], [5, 2, 3, 4, 5, 5], [5, 3, 4, 5, 5, 5], [5, 4, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]) == 20", "assert candidate(heightMap=[[5, 15, 25, 35, 45], [5, 10, 10...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(heightMap=[[5, 5, 5, 1], [5, 1, 1, 5], [5, 1, 1, 5], [5, 5, 5, 1]]) == 16", "assert candidate(heightMap=[[5, 5, 5, 5, 5, 5], [5, 1, 2, 3, 4, 5], [5, 2, 3, 4, 5, 5], [5, 3, 4, 5, 5, 5], [5, 4, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]) == 20", "assert candidate(heightMap=[[5, 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:\nGiven an integer array nums, return true if you can partition the array 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 an integer array nums, return true if you can partition the array into two subsets such that the sum of the eleme...
[ "assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == False", "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1]) == True", "assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190,...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == False", "assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1]) == True", "assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140,...
[ { "role": "user", "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is an m x n rectangular island that borders both the Pacific Ocean 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: There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches ...
[ "assert candidate(heights=[[1, 2, 2, 3, 5, 6], [3, 2, 3, 4, 4, 5], [2, 4, 5, 3, 1, 2], [6, 7, 1, 4, 5, 3], [5, 1, 1, 2, 4, 1], [4, 3, 2, 1, 1, 1]]) == [(0, 5), (1, 5), (3, 0), (3, 1), (4, 0), (5, 0)]", "assert candidate(heights=[[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]])...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(heights=[[1, 2, 2, 3, 5, 6], [3, 2, 3, 4, 4, 5], [2, 4, 5, 3, 1, 2], [6, 7, 1, 4, 5, 3], [5, 1, 1, 2, 4, 1], [4, 3, 2, 1, 1, 1]]) == [(0, 5), (1, 5), (3, 0), (3, 1), (4, 0), (5, 0)]", "assert candidate(heights=[[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 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 rows x cols screen and a sentence represented as a list of strings...
You are an expert Python 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 rows x cols screen and a sentence represented as a list of strings, return the number of times the given senten...
[ "assert candidate(sentence=['programming', 'problems', 'are', 'fun'], rows=20, cols=50) == 33", "assert candidate(sentence=['hello', 'world'], rows=10000, cols=5000) == 4165000", "assert candidate(sentence=['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yz'], rows=25, cols=20) == 14", "assert candidate(sent...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(sentence=['programming', 'problems', 'are', 'fun'], rows=20, cols=50) == 33", "assert candidate(sentence=['hello', 'world'], rows=10000, cols=5000) == 4165000", "assert candidate(sentence=['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yz'], rows=25, cols=20) == 14",...
[ { "role": "user", "content": "You are an expert Python programmer. You will 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 m x n matrix board where each cell is a battleship 'X' or empty '...
You are an expert Python 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 m x n matrix board where each cell is a battleship 'X' or empty '.', return the number of the battleships on b...
[ "assert candidate(board=[['X', '.', '.', 'X'], ['.', '.', '.', 'X'], ['.', '.', '.', 'X']]) == 2", "assert candidate(board=[['X', 'X', 'X', '.', 'X'], ['X', '.', 'X', 'X', '.'], ['.', '.', '.', 'X', 'X'], ['X', 'X', '.', 'X', '.']]) == 3", "assert candidate(board=[['X', '.', '.', '.', '.'], ['X', '.', '.', '.',...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(board=[['X', '.', '.', 'X'], ['.', '.', '.', 'X'], ['.', '.', '.', 'X']]) == 2", "assert candidate(board=[['X', 'X', 'X', '.', 'X'], ['X', '.', 'X', 'X', '.'], ['.', '.', '.', 'X', 'X'], ['X', 'X', '.', 'X', '.']]) == 3", "assert candidate(board=[['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 password is considered strong if the below conditions are all met:\n\nIt...
You are an expert Python 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 password is considered strong if the below conditions are all met: It has at least 6 characters and at most 20 chara...
[ "assert candidate(password='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA') == 19", "assert candidate(password='Aa!b@c#d$e%f^g&h*i(j)k') == 3", "assert candidate(password='abcdefgHIJKLmnopQR1234567890!@#$%^&*()') == 18", "assert candidate(password='123456789012345678901234567890') == 12", "assert candidate(password='!@...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(password='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA') == 19", "assert candidate(password='Aa!b@c#d$e%f^g&h*i(j)k') == 3", "assert candidate(password='abcdefgHIJKLmnopQR1234567890!@#$%^&*()') == 18", "assert candidate(password='123456789012345678901234567890') == 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 integer array nums, return the maximum result of nums[i] XOR 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: Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n.   Constraints: 1...
[ "assert candidate(nums=[100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000, 800000000, 900000000, 1000000000]) == 1047472896", "assert candidate(nums=[1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071]) == 130048", "assert candidate(nums=[1000000000, 500000000, 250000000, 125000000, 6...
newfacade/LeetCodeDataset
{ "constraints": [ "assert candidate(nums=[100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000, 800000000, 900000000, 1000000000]) == 1047472896", "assert candidate(nums=[1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071]) == 130048", "assert candidate(nums=[1000000000, 500000000...