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 a string s containing an out-of-order English representation of digi... | You are an expert Python 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 containing an out-of-order English representation of digits 0-9, return the digits in ascending order.... | [
"assert candidate(s='fivefourseveneightonesixninezero') == '01456789'",
"assert candidate(s='zeroseveneightfivefourthreeonetwoeighttwozeroonetwothreefour') == '001122233445788'",
"assert candidate(s='oneeighttwothree') == '1238'",
"assert candidate(s='onezerozeroonetwothreefourfivesixseveneightnine') == '0011... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='fivefourseveneightonesixninezero') == '01456789'",
"assert candidate(s='zeroseveneightfivefourthreeonetwoeighttwozeroonetwothreefour') == '001122233445788'",
"assert candidate(s='oneeighttwothree') == '1238'",
"assert candidate(s='onezerozeroonetwothreefourfives... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 strings words, return all the word squares you ca... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of unique strings words, return all the word squares you can build from words. The same word from words ... | [
"assert candidate(words=['berry', 'beery', 'brill', 'brine', 'briny', 'brisk', 'brisk', 'brisk', 'brisk']) == []",
"assert candidate(words=['abac', 'abad', 'abae', 'abaf', 'abag', 'abah', 'abai', 'abaj']) == []",
"assert candidate(words=['lazar', 'laser', 'layer', 'lazar', 'larva', 'lapse', 'laced', 'latch', 'l... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['berry', 'beery', 'brill', 'brine', 'briny', 'brisk', 'brisk', 'brisk', 'brisk']) == []",
"assert candidate(words=['abac', 'abad', 'abae', 'abaf', 'abag', 'abah', 'abai', 'abaj']) == []",
"assert candidate(words=['lazar', 'laser', 'layer', 'lazar', 'larva', 'lap... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 gene string can be represented by an 8-character long string, with choic... | You are an expert Python 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 gene string can be represented by an 8-character long string, with choices from 'A', 'C', 'G', and 'T'.
Suppose we ne... | [
"assert candidate(startGene='AACCGGTT', endGene='GACCGGTA', bank=['AACCGGCA', 'GACCGGTA', 'AACCGGCT', 'AACCGGAA', 'AACCGGAT', 'AACCGGTT']) == -1",
"assert candidate(startGene='AACCGGTT', endGene='TTTTTTTT', bank=['AACCGGCA', 'AACCGGTA', 'AAACGGTA', 'AACCGGAC', 'TTTTTTTA', 'TTTTTTTT']) == -1",
"assert candidate(... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(startGene='AACCGGTT', endGene='GACCGGTA', bank=['AACCGGCA', 'GACCGGTA', 'AACCGGCT', 'AACCGGAA', 'AACCGGAT', 'AACCGGTT']) == -1",
"assert candidate(startGene='AACCGGTT', endGene='TTTTTTTT', bank=['AACCGGCA', 'AACCGGTA', 'AAACGGTA', 'AACCGGAC', 'TTTTTTTA', 'TTTTTTTT']) == -1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of intervals, where intervals[i] = [starti, endi] a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of intervals, where intervals[i] = [starti, endi] and each starti is unique.
The right interval ... | [
"assert candidate(intervals=[[-5, 0], [-4, 1], [-3, 2], [-2, 3], [-1, 4], [0, 5], [1, 6], [2, 7], [3, 8], [4, 9], [5, 10], [6, 11], [7, 12], [8, 13], [9, 14]]) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1]",
"assert candidate(intervals=[[1, 20], [21, 30], [31, 40], [41, 50], [51, 60]]) == [1, 2, 3, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(intervals=[[-5, 0], [-4, 1], [-3, 2], [-2, 3], [-1, 4], [0, 5], [1, 6], [2, 7], [3, 8], [4, 9], [5, 10], [6, 11], [7, 12], [8, 13], [9, 14]]) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1]",
"assert candidate(intervals=[[1, 20], [21, 30], [31, 40], [41, 50], [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 the root of a binary tree and an integer targetSum, return the numbe... | You are an expert Python 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 and an integer targetSum, return the number of paths where the sum of the values along ... | [
"assert candidate(root=tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1, None, None, 2, None, None, None, None, 3]), targetSum=22) == 3",
"assert candidate(root=tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, 0, 1, None, -1]), targetSum=8) == 4",
"assert candidate(root=tree_node([10, -2, 3, 4, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1, None, None, 2, None, None, None, None, 3]), targetSum=22) == 3",
"assert candidate(root=tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, 0, 1, None, -1]), targetSum=8) == 4",
"assert candidate(root=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 s and p, return an array of all the start indices of p'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 two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in ... | [
"assert candidate(s='zazazazazaz', p='aaa') == []",
"assert candidate(s='abababababababababab', p='abab') == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]",
"assert candidate(s='xxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzz', p='xxyyzz') == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='zazazazazaz', p='aaa') == []",
"assert candidate(s='abababababababababab', p='abab') == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]",
"assert candidate(s='xxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzz', p='xxyyzz') == [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:\nGiven a string expression representing arbitrarily nested ternary expressi... | You are an expert Python 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 representing arbitrarily nested ternary expressions, evaluate the expression, and return the ... | [
"assert candidate(expression='F?F?F?F?F?F?F?F?9:8:7:6:5:4:3:2:1') == '1'",
"assert candidate(expression='F?F?F?F:1:2:3?4:5?6:7') == '7'",
"assert candidate(expression='F?F?F:2:3?4:5') == '5'",
"assert candidate(expression='T?F?T?9:8:7:6?5:4') == '7'",
"assert candidate(expression='F?F?F:5:T') == 'T'",
"as... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(expression='F?F?F?F?F?F?F?F?9:8:7:6:5:4:3:2:1') == '1'",
"assert candidate(expression='F?F?F?F:1:2:3?4:5?6:7') == '7'",
"assert candidate(expression='F?F?F:2:3?4:5') == '5'",
"assert candidate(expression='T?F?T?9:8:7:6?5:4') == '7'",
"assert candidate(expressio... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two integers n and k, return the kth lexicographically smallest 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:
Given two integers n and k, return the kth lexicographically smallest integer in the range [1, n].
Constraints:
1 <=... | [
"assert candidate(n=100000, k=75000) == 77498",
"assert candidate(n=876543210, k=432109876) == 488898887",
"assert candidate(n=100000000, k=10000000) == 18999998",
"assert candidate(n=987654321, k=456789012) == 511110104",
"assert candidate(n=897654321, k=123456789) == 211111103",
"assert candidate(n=1000... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=100000, k=75000) == 77498",
"assert candidate(n=876543210, k=432109876) == 488898887",
"assert candidate(n=100000000, k=10000000) == 18999998",
"assert candidate(n=987654321, k=456789012) == 511110104",
"assert candidate(n=897654321, k=123456789) == 211111103... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 of length n where all the integers of nums are... | You are an expert Python 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 of length n where all the integers of nums are in the range [1, n] and each integer appears... | [
"assert candidate(nums=[4, 3, 2, 7, 8, 2, 3, 1]) == [3, 2]",
"assert candidate(nums=[5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14]) == [5, 10, 6, 7, 8, 9]",
"assert candidate(nums=[5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == [3, 6, 5, 7, 2, 8, 4, 9, 1, 10]",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[4, 3, 2, 7, 8, 2, 3, 1]) == [3, 2]",
"assert candidate(nums=[5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14]) == [5, 10, 6, 7, 8, 9]",
"assert candidate(nums=[5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == [3, 6, 5, 7, 2, 8, 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 integer array nums of length n where nums is a permutatio... | You are an expert Python 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 where nums is a permutation of the integers in the range [1, n]. You ar... | [
"assert candidate(nums=[1, 3, 2, 4, 5], sequences=[[1, 3], [3, 2], [2, 4], [4, 5], [1, 5]]) == True",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], sequences=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 4], [4, 7], [7, 10]]) == True",
"assert candidate(nums=[1, 2, 3, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 3, 2, 4, 5], sequences=[[1, 3], [3, 2], [2, 4], [4, 5], [1, 5]]) == True",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], sequences=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [1, 4], [4, 7], [7, 10]]) == True",
"assert c... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two non-empty linked lists representing two non-negative int... | You are an expert Python 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 non-empty linked lists representing two non-negative integers. The most significant digit comes first... | [
"assert is_same_list(candidate(l1=list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]), l2=list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])), list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]))",
"assert is_same_list(candidate(l1=list_node([1, 0, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(l1=list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]), l2=list_node([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5])), list_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]))",
"assert is_same_list(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, return the number of all the arithmetic subse... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums, return the number of all the arithmetic subsequences of nums.
A sequence of numbers is cal... | [
"assert candidate(nums=[5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 72",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 344",
"assert candidate(nums=[1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == 17",
"assert candidate(nums=[1, 7, 10, 15, 27, 29, 33, 37, 41, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 72",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 344",
"assert candidate(nums=[1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) == 17",
"assert candidate(nums=[1, 7, 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:\nYou are given n points in the plane that are all distinct, where points[i]... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given n points in the plane that are all distinct, where points[i] = [xi, yi]. A boomerang is a tuple of points... | [
"assert candidate(points=[[0, 0], [1, 0], [2, 0], [3, 0], [0, 1], [1, 1], [2, 1], [3, 1], [0, 2], [1, 2], [2, 2], [3, 2]]) == 164",
"assert candidate(points=[[0, 0], [1, 0], [0, 1], [1, 1]]) == 8",
"assert candidate(points=[[0, 0], [1, 0], [2, 0], [3, 0], [0, 1]]) == 6",
"assert candidate(points=[[100, 100], ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(points=[[0, 0], [1, 0], [2, 0], [3, 0], [0, 1], [1, 1], [2, 1], [3, 1], [0, 2], [1, 2], [2, 2], [3, 2]]) == 164",
"assert candidate(points=[[0, 0], [1, 0], [0, 1], [1, 1]]) == 8",
"assert candidate(points=[[0, 0], [1, 0], [2, 0], [3, 0], [0, 1]]) == 6",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, sort it in decreasing order based on the frequency of th... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is... | [
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzAABBCCDDEEFFGGHHIİJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ') == 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzAABBCCDDEEFFGGHHKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZIİJ'",
"assert candidate(s='2a554442f544asfasss') == '44444ssssaaa55522ff'",
"ass... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzAABBCCDDEEFFGGHHIİJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ') == 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzAABBCCDDEEFFGGHHKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZIİJ'",
"assert candidate(s='2a554442f544asfasss') == '44444s... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 some spherical balloons taped onto a flat wall that represents 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 some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as ... | [
"assert candidate(points=[[1, 5], [5, 9], [9, 13], [13, 17], [17, 21], [21, 25], [25, 29], [29, 33], [33, 37]]) == 5",
"assert candidate(points=[[1, 5], [5, 10], [10, 15], [15, 20], [20, 25]]) == 3",
"assert candidate(points=[[3, 9], [7, 12], [3, 8], [6, 8], [9, 10], [2, 9], [0, 9], [3, 9], [0, 6], [2, 8]]) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(points=[[1, 5], [5, 9], [9, 13], [13, 17], [17, 21], [21, 25], [25, 29], [29, 33], [33, 37]]) == 5",
"assert candidate(points=[[1, 5], [5, 10], [10, 15], [15, 20], [20, 25]]) == 3",
"assert candidate(points=[[3, 9], [7, 12], [3, 8], [6, 8], [9, 10], [2, 9], [0, 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:\nGiven an array of n integers nums, a 132 pattern is a subsequence of three... | You are an expert Python 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, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such t... | [
"assert candidate(nums=[3, 1, 4, 2, 5, 0]) == True",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == False",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5]) == False",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[3, 1, 4, 2, 5, 0]) == True",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4]) == False",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -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:\nGiven an integer array nums of size n, return the minimum number of moves ... | You are an expert Python 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 of size n, return the minimum number of moves required to make all array elements equal.
In... | [
"assert candidate(nums=[1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3]) == 10",
"assert candidate(nums=[100, 101, 102, 103, 104]) == 6",
"assert candidate(nums=[100, 200, 300, 400, 500]) == 600",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2]) == 7",
"assert candidate(nums=[10, 10, 10, 10, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3]) == 10",
"assert candidate(nums=[100, 101, 102, 103, 104]) == 6",
"assert candidate(nums=[100, 200, 300, 400, 500]) == 600",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2]) == 7",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nIn the \"100 game\" two players take turns adding, to a running total, any... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
In the "100 game" two players take turns adding, to a running total, any integer from 1 to 10. The player who first cau... | [
"assert candidate(maxChoosableInteger=7, desiredTotal=15) == False",
"assert candidate(maxChoosableInteger=11, desiredTotal=33) == True",
"assert candidate(maxChoosableInteger=18, desiredTotal=130) == True",
"assert candidate(maxChoosableInteger=16, desiredTotal=60) == True",
"assert candidate(maxChoosableI... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(maxChoosableInteger=7, desiredTotal=15) == False",
"assert candidate(maxChoosableInteger=11, desiredTotal=33) == True",
"assert candidate(maxChoosableInteger=18, desiredTotal=130) == True",
"assert candidate(maxChoosableInteger=16, desiredTotal=60) == True",
"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:\nWe define str = [s, n] as the string str which consists of the string s co... | You are an expert Python 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 define str = [s, n] as the string str which consists of the string s concatenated n times.
For example, str == ["ab... | [
"assert candidate(s1='acb', n1=10, s2='acbacb', n2=1) == 5",
"assert candidate(s1='abcabcabcabc', n1=12, s2='abcabc', n2=2) == 12",
"assert candidate(s1='ababababab', n1=20, s2='abab', n2=5) == 10",
"assert candidate(s1='aaaaaa', n1=1000000, s2='aa', n2=100000) == 30",
"assert candidate(s1='abcdefg', n1=500... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s1='acb', n1=10, s2='acbacb', n2=1) == 5",
"assert candidate(s1='abcabcabcabc', n1=12, s2='abcabc', n2=2) == 12",
"assert candidate(s1='ababababab', n1=20, s2='abab', n2=5) == 10",
"assert candidate(s1='aaaaaa', n1=1000000, s2='aa', n2=100000) == 30",
"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:\nWe define the string base to be the infinite wraparound string of \"abcdef... | You are an expert Python 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 define the string base to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so base will look like ... | [
"assert candidate(s='zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba') == 26",
"assert candidate(s='abcdzabcde') == 21",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz') == 305... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba') == 26",
"assert candidate(s='abcdzabcde') == 21",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 queryIP, return \"IPv4\" if IP is a valid IPv4 address, \"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 queryIP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" ... | [
"assert candidate(queryIP='2001:0db8:85a3:0:0:8A2E:0370:7334:0000:0000:0000:00000') == 'Neither'",
"assert candidate(queryIP='2001:0db8:85a3:0:0:8A2E:0370:7334:abcd') == 'Neither'",
"assert candidate(queryIP='1.2.3') == 'Neither'",
"assert candidate(queryIP='192.168.1.abc') == 'Neither'",
"assert candidate(... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(queryIP='2001:0db8:85a3:0:0:8A2E:0370:7334:0000:0000:0000:00000') == 'Neither'",
"assert candidate(queryIP='2001:0db8:85a3:0:0:8A2E:0370:7334:abcd') == 'Neither'",
"assert candidate(queryIP='1.2.3') == 'Neither'",
"assert candidate(queryIP='192.168.1.abc') == 'Neit... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of points on the X-Y plane points where points[i] =... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of points on the X-Y plane points where points[i] = [xi, yi]. The points form a polygon when joi... | [
"assert candidate(points=[[1, 0], [2, 2], [3, 1], [2, -1], [1, -1], [0, 1]]) == False",
"assert candidate(points=[[-2, -2], [-2, 2], [2, 2], [2, -2], [0, 1]]) == False",
"assert candidate(points=[[0, 0], [1, 1], [2, 0], [2, 2], [1, 3], [0, 2]]) == False",
"assert candidate(points=[[1, 2], [3, 4], [5, 3], [4, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(points=[[1, 0], [2, 2], [3, 1], [2, -1], [1, -1], [0, 1]]) == False",
"assert candidate(points=[[-2, -2], [-2, 2], [2, 2], [2, -2], [0, 1]]) == False",
"assert candidate(points=[[0, 0], [1, 1], [2, 0], [2, 2], [1, 3], [0, 2]]) == False",
"assert candidate(points=[[... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of strings words (without duplicates), return all the conca... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of strings words (without duplicates), return all the concatenated words in the given list of words.
A c... | [
"assert candidate(words=['prefix', 'suffix', 'prefixsuffix', 'suffixprefix', 'prefixsuffixprefix', 'suffixprefixsuffix', 'prefixsuffixsuffixprefix', 'suffixprefixprefixsuffix']) == ['prefixsuffix', 'suffixprefix', 'prefixsuffixprefix', 'suffixprefixsuffix', 'prefixsuffixsuffixprefix', 'suffixprefixprefixsuffix']",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['prefix', 'suffix', 'prefixsuffix', 'suffixprefix', 'prefixsuffixprefix', 'suffixprefixsuffix', 'prefixsuffixsuffixprefix', 'suffixprefixprefixsuffix']) == ['prefixsuffix', 'suffixprefix', 'prefixsuffixprefix', 'suffixprefixsuffix', 'prefixsuffixsuffixprefix', 'suffixpr... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 matchsticks where matchsticks[i] is the len... | You are an expert Python 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 matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use al... | [
"assert candidate(matchsticks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True",
"assert candidate(matchsticks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1]) == False",
"assert candidate(matchsticks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == True",
"assert candidate(matchstic... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(matchsticks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True",
"assert candidate(matchsticks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1]) == False",
"assert candidate(matchsticks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) == True",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 binary strings strs and two integers m and n.\nR... | You are an expert Python 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 binary strings strs and two integers m and n.
Return the size of the largest subset of strs s... | [
"assert candidate(strs=['101', '0011', '1000', '1100', '0100', '0000'], m=5, n=5) == 2",
"assert candidate(strs=['10', '0001', '111001', '1', '0'], m=5, n=3) == 4",
"assert candidate(strs=['1100', '1010', '0011', '0101', '1111', '0000', '1000', '0111', '1101', '1011'], m=6, n=6) == 3",
"assert candidate(strs=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(strs=['101', '0011', '1000', '1100', '0100', '0000'], m=5, n=5) == 2",
"assert candidate(strs=['10', '0001', '111001', '1', '0'], m=5, n=3) == 4",
"assert candidate(strs=['1100', '1010', '0011', '0101', '1111', '0000', '1000', '0111', '1101', '1011'], m=6, n=6) == 3",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWinter is coming! During the contest, your first job is to design a standa... | You are an expert Python 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:
Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm al... | [
"assert candidate(houses=[1, 5, 9, 15, 20, 25, 30, 35, 40], heaters=[10, 20, 30]) == 10",
"assert candidate(houses=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], heaters=[5, 10, 15, 20]) == 4",
"assert candidate(houses=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], heaters=[2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(houses=[1, 5, 9, 15, 20, 25, 30, 35, 40], heaters=[10, 20, 30]) == 10",
"assert candidate(houses=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], heaters=[5, 10, 15, 20]) == 4",
"assert candidate(houses=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 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:\nThe Hamming distance between two integers is the number of positions at 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:
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Giv... | [
"assert candidate(nums=[134217727, 134217726, 134217725, 134217724, 134217723, 134217722, 134217721, 134217720]) == 48",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200]) == 304",
"assert candidate(nums=[8388607, 8388606, 8388605, 8388604, 8388603, 8388602]) == 25",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[134217727, 134217726, 134217725, 134217724, 134217723, 134217722, 134217721, 134217720]) == 48",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200]) == 304",
"assert candidate(nums=[8388607, 8388606, 8388605, 8388604, 8388603, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 median is the middle value in an ordered integer list. If the size of ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. S... | [
"assert candidate(nums=[1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1], k=3) == [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=7) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1], k=3) == [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=7) == [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:\nA magical string s consists of only '1' and '2' and obeys the following ru... | You are an expert Python 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 magical string s consists of only '1' and '2' and obeys the following rules:
The string s is magical because concate... | [
"assert candidate(n=75000) == 37487",
"assert candidate(n=20) == 10",
"assert candidate(n=3) == 1",
"assert candidate(n=9999) == 4995",
"assert candidate(n=80000) == 39982",
"assert candidate(n=5) == 3",
"assert candidate(n=50001) == 24986",
"assert candidate(n=32000) == 15996",
"assert candidate(n=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=75000) == 37487",
"assert candidate(n=20) == 10",
"assert candidate(n=3) == 1",
"assert candidate(n=9999) == 4995",
"assert candidate(n=80000) == 39982",
"assert candidate(n=5) == 3",
"assert candidate(n=50001) == 24986",
"assert candidate(n=32000... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 permutation perm of n integers of all the integers in the range [1, n] 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:
A permutation perm of n integers of all the integers in the range [1, n] can be represented as a string s of length n -... | [
"assert candidate(s='IIDDDIIDID') == [1, 2, 6, 5, 4, 3, 7, 9, 8, 11, 10]",
"assert candidate(s='IDDDIIIDDIID') == [1, 5, 4, 3, 2, 6, 7, 10, 9, 8, 11, 13, 12]",
"assert candidate(s='IDDDDDDDDDDDDD') == [1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]",
"assert candidate(s='IDIDIDIDIDIDIDDD') == [1, 3, 2, 5,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='IIDDDIIDID') == [1, 2, 6, 5, 4, 3, 7, 9, 8, 11, 10]",
"assert candidate(s='IDDDIIIDDIID') == [1, 5, 4, 3, 2, 6, 7, 10, 9, 8, 11, 13, 12]",
"assert candidate(s='IDDDDDDDDDDDDD') == [1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]",
"assert candidate(s='IDIDIDI... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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. Two players are playing a game with t... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2.
Player 1 an... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True",
"assert candidate(nums=[10000000, 1, 10000000, 1, 10000000, 1, 10000000, 1]) == True",
"assert candidate(nums=[5, 10, 15, 20, 25, 30, 35]) == True",
"assert candidate(nums=[1, 3, 1]) == False",
"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]) == True",
"assert candidate(nums=[10000000, 1, 10000000, 1, 10000000, 1, 10000000, 1]) == True",
"assert candidate(nums=[5, 10, 15, 20, 25, 30, 35]) == True",
"assert candidate(nums=[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:\nGiven a binary array nums, return the maximum number of consecutive 1's 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 a binary array nums, return the maximum number of consecutive 1's in the array if you can flip at most one 0.
C... | [
"assert candidate(nums=[0, 0, 0, 0, 0]) == 1",
"assert candidate(nums=[0, 0, 0, 0]) == 1",
"assert candidate(nums=[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]) == 11",
"assert candidate(nums=[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, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[0, 0, 0, 0, 0]) == 1",
"assert candidate(nums=[0, 0, 0, 0]) == 1",
"assert candidate(nums=[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]) == 11",
"assert candidate(nums=[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:\nGiven an integer array nums, return the number of reverse pairs in the 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:
Given an integer array nums, return the number of reverse pairs in the array.
A reverse pair is a pair (i, j) where:
0... | [
"assert candidate(nums=[10, 20, 30, 40, 50, 5, 15, 25, 35, 45]) == 6",
"assert candidate(nums=[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 25",
"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]) == 0",
"assert candidate(nums=[0, 2, 4, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 20, 30, 40, 50, 5, 15, 25, 35, 45]) == 6",
"assert candidate(nums=[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 25",
"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]) == 0",
"asser... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums and an integer target.\nYou want to bu... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums and an integer target.
You want to build an expression out of nums by adding one of... | [
"assert candidate(nums=[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5], target=15) == 1062",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], target=0) == 184756",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], target=10) == 15504",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5], target=15) == 1062",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], target=0) == 184756",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], targ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 ball in a maze with empty spaces (represented as 0) and walls (... | You are an expert Python 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 ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through th... | [
"assert candidate(maze=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(maze=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 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 circular integer array nums (i.e., the next element of nums[nums.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 a circular integer array nums (i.e., the next element of nums[nums.length - 1] is nums[0]), return the next great... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == [2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 2, 3, 4, 5, 6]",
"assert candidate(nums=[3, 8, 4, 1, 2]) == [8, -1, 8, 2, 3]",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11]) == [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -1]",
"assert candid... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]) == [2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 2, 3, 4, 5, 6]",
"assert candidate(nums=[3, 8, 4, 1, 2]) == [8, -1, 8, 2, 3]",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11]) == [11, 11, 11, 11, 11, 11, 11, 11, 11, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is a ball in a maze with empty spaces (represented as 0) and walls (... | You are an expert Python 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 ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through th... | [
"assert candidate(maze=[[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0, 0]], start=[0, 0], destination=[5, 7]) == 12",
"assert candidate(maze=[[0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(maze=[[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0, 0, 0]], start=[0, 0], destination=[5, 7]) == 12",
"assert candidate(maze=[[0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 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 the root of a binary tree, return the most frequent subtree sum. If ... | You are an expert Python 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 most frequent subtree sum. If there is a tie, return all the values with th... | [
"assert candidate(root=tree_node([5, 3, 2, 1, -1, -2, -3])) == [-3]",
"assert candidate(root=tree_node([10, 10, -10, 10, -10, 10, -10])) == [10]",
"assert candidate(root=tree_node([0, 1, 1, 0, 0, 0, 0])) == [0]",
"assert candidate(root=tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, None, 1, -1, -1, 0, 0])) == [... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([5, 3, 2, 1, -1, -2, -3])) == [-3]",
"assert candidate(root=tree_node([10, 10, -10, 10, -10, 10, -10])) == [10]",
"assert candidate(root=tree_node([0, 1, 1, 0, 0, 0, 0])) == [0]",
"assert candidate(root=tree_node([10, 5, -3, 3, 2, None, 11, 3, -2, 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:\nIn the video game Fallout 4, the quest \"Road to Freedom\" requires player... | You are an expert Python 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:
In the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Tra... | [
"assert candidate(ring='abcdefg', key='fa') == 6",
"assert candidate(ring='iaejfhfihjdghfihdddddddhddcfjghjgddf', key='did') == 9",
"assert candidate(ring='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', key='zyxwvutsrqponmlkjihgfedcba') == 52",
"assert candidate(ring='thisisaverylongstringthatweneedto... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(ring='abcdefg', key='fa') == 6",
"assert candidate(ring='iaejfhfihjdghfihdddddddhddcfjghjgddf', key='did') == 9",
"assert candidate(ring='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', key='zyxwvutsrqponmlkjihgfedcba') == 52",
"assert candidate(ring='thisis... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 an array of the largest value in 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 the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
Constraint... | [
"assert candidate(root=tree_node([-10, -5, -3, -6, -20, 0, 5, None, None, -8, None, -15, -1])) == [-10, -3, 5, -1]",
"assert candidate(root=tree_node([1, 3, 2, 5, 3, None, 9, 6, 7, None, None, None, 8])) == [1, 3, 9, 8]",
"assert candidate(root=tree_node([2147483647, -2147483648, None, 2147483647])) == [2147483... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([-10, -5, -3, -6, -20, 0, 5, None, None, -8, None, -15, -1])) == [-10, -3, 5, -1]",
"assert candidate(root=tree_node([1, 3, 2, 5, 3, None, 9, 6, 7, None, None, None, 8])) == [1, 3, 9, 8]",
"assert candidate(root=tree_node([2147483647, -2147483648, 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 s, find the longest palindromic subsequence's length in 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 string s, find the longest palindromic subsequence's length in s.
A subsequence is a sequence that can be deriv... | [
"assert candidate(s='xyzyxzyxzyxzyxzyx') == 13",
"assert candidate(s='aabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccdd') == 26",
"assert candidate(s='abcba') == 5",
"assert candidate(s='mamad') == 3",
"assert candidate(s='forgeeksskeegfor') == 12",
"assert candidate(s='agbdba') == 5",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='xyzyxzyxzyxzyxzyx') == 13",
"assert candidate(s='aabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccddeeaabbccdd') == 26",
"assert candidate(s='abcba') == 5",
"assert candidate(s='mamad') == 3",
"assert candidate(s='forgeeksskeegfor') == 12",
"asser... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou have n super washing machines on a line. Initially, each washing machi... | You are an expert Python 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 n super washing machines on a line. Initially, each washing machine has some dresses or is empty.
For each mov... | [
"assert candidate(machines=[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 0",
"assert candidate(machines=[9, 1, 8, 8, 9]) == 4",
"assert candidate(machines=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1",
"assert candidate(machines=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(machines=[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 0",
"assert candidate(machines=[9, 1, 8, 8, 9]) == 4",
"assert candidate(machines=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1",
"assert candidate(machines=[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 given an integer array coins representing coins of different denom... | You are an expert Python 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 coins representing coins of different denominations and an integer amount representing a... | [
"assert candidate(amount=3000, coins=[4, 9, 15, 25, 30, 50, 75]) == 816870821",
"assert candidate(amount=2000, coins=[7, 11, 13, 17, 19, 23]) == 40067247",
"assert candidate(amount=3000, coins=[1, 3, 5, 10, 25, 50]) == 11669586691",
"assert candidate(amount=6000, coins=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512])... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(amount=3000, coins=[4, 9, 15, 25, 30, 50, 75]) == 816870821",
"assert candidate(amount=2000, coins=[7, 11, 13, 17, 19, 23]) == 40067247",
"assert candidate(amount=3000, coins=[1, 3, 5, 10, 25, 50]) == 11669586691",
"assert candidate(amount=6000, coins=[1, 2, 4, 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 integer array nums and an integer k, return true if nums has a go... | You are an expert Python 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 true if nums has a good subarray or false otherwise.
A good subarr... | [
"assert candidate(nums=[9, 10, 7, 3, 9, 6, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=6) == True",
"assert candidate(nums=[0, 1, 0, 3, 0, 4, 0, 5, 0, 6], k=2) == True",
"assert candidate(nums=[23, 2, 4, 6, 7, 5, 3, 9, 10, 15, 20, 25, 30, 35, 40], k=17) == True",
"assert candida... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[9, 10, 7, 3, 9, 6, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=6) == True",
"assert candidate(nums=[0, 1, 0, 3, 0, 4, 0, 5, 0, 6], k=2) == True",
"assert candidate(nums=[23, 2, 4, 6, 7, 5, 3, 9, 10, 15, 20, 25, 30, 35, 40], k=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:\nGiven a string s and a string array dictionary, return the longest string ... | You are an expert Python 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 a string array dictionary, return the longest string in the dictionary that can be formed by delet... | [
"assert candidate(s='abcdefghijklmnopqrstuvwxyz', dictionary=['zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxy']) == 'abcdefghijklmnopqrstuvwxyz'",
"assert candidate(s='mississippi', dictionary=['mis', 'issi', 'issip', 'ippi', 'ppi', 'pip', 'pis', 'is', 'i']) == 'issip'",
"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcdefghijklmnopqrstuvwxyz', dictionary=['zyxwvutsrqponmlkjihgfedcba', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxy']) == 'abcdefghijklmnopqrstuvwxyz'",
"assert candidate(s='mississippi', dictionary=['mis', 'issi', 'issip', 'ippi', 'ppi', 'pip', 'pis', 'is',... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a binary array nums, return the maximum length of a contiguous subar... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.
Constr... | [
"assert candidate(nums=[1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == 20",
"assert candidate(nums=[1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == 20",
"assert candidate(nums=[0, 0, 1, 0, 0, 0, 1, 1, 1, 1]) == 10",
"assert candidate(nums=[0, 1, 1, 1, 1, 1, 0, 0, 0]) == 6",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1]) == 20",
"assert candidate(nums=[1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) == 20",
"assert candidate(nums=[0, 0, 1, 0, 0, 0, 1, 1, 1, 1]) == 10",
"assert candidate(nums=[0, 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:\nSuppose you have n integers labeled 1 through n. A permutation of those 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:
Suppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a bea... | [
"assert candidate(n=12) == 4010",
"assert candidate(n=10) == 700",
"assert candidate(n=6) == 36",
"assert candidate(n=2) == 2",
"assert candidate(n=5) == 10",
"assert candidate(n=13) == 4237",
"assert candidate(n=9) == 250",
"assert candidate(n=4) == 8",
"assert candidate(n=15) == 24679",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=12) == 4010",
"assert candidate(n=10) == 700",
"assert candidate(n=6) == 36",
"assert candidate(n=2) == 2",
"assert candidate(n=5) == 10",
"assert candidate(n=13) == 4237",
"assert candidate(n=9) == 250",
"assert candidate(n=4) == 8",
"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 array of distinct strings words, return the minimal possible abbr... | You are an expert Python 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 distinct strings words, return the minimal possible abbreviations for every word.
The following are t... | [
"assert candidate(words=['communication', 'commune', 'communal', 'comment', 'commerce', 'commodity', 'commit', 'committee', 'common', 'communist']) == ['c11n', 'c5e', 'c6l', 'c5t', 'c6e', 'c7y', 'c4t', 'c7e', 'c4n', 'c7t']",
"assert candidate(words=['supercalifragilisticexpialidocious', 'supercalifragilisticexpia... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['communication', 'commune', 'communal', 'comment', 'commerce', 'commodity', 'commit', 'committee', 'common', 'communist']) == ['c11n', 'c5e', 'c6l', 'c5t', 'c6e', 'c7y', 'c4t', 'c7e', 'c4n', 'c7t']",
"assert candidate(words=['supercalifragilisticexpialidocious', 'su... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nLet's play the minesweeper game (Wikipedia, online game)!\nYou are given 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:
Let's play the minesweeper game (Wikipedia, online game)!
You are given an m x n char matrix board representing the gam... | [
"assert candidate(board=[['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'M', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E']], click=[2, 2]) == [['B', 'B', 'B', 'B',... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(board=[['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'M', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E']], click=[2, 2]) == ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an m x n picture consisting of black 'B' and white 'W' pixels, 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 an m x n picture consisting of black 'B' and white 'W' pixels, return the number of black lonely pixels.
A black ... | [
"assert candidate(picture=[['B', 'W', 'W', 'B'], ['W', 'W', 'W', 'W'], ['W', 'W', 'W', 'W'], ['B', 'W', 'W', 'B']]) == 0",
"assert candidate(picture=[['W', 'W', 'W', 'W', 'W', 'W', 'W'], ['W', 'W', 'W', 'W', 'W', 'W', 'W'], ['W', 'W', 'B', 'W', 'W', 'W', 'W'], ['W', 'W', 'W', 'W', 'W', 'W', 'W'], ['W', 'W', 'W', ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(picture=[['B', 'W', 'W', 'B'], ['W', 'W', 'W', 'W'], ['W', 'W', 'W', 'W'], ['B', 'W', 'W', 'B']]) == 0",
"assert candidate(picture=[['W', 'W', 'W', 'W', 'W', 'W', 'W'], ['W', 'W', 'W', 'W', 'W', 'W', 'W'], ['W', 'W', 'B', 'W', 'W', 'W', 'W'], ['W', 'W', 'W', 'W', 'W', 'W',... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 and an integer k, return the number of uni... | You are an expert Python 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 and an integer k, return the number of unique k-diff pairs in the array.
A k-diff pair ... | [
"assert candidate(nums=[1, 1, 2, 2, 3, 3], k=1) == 2",
"assert candidate(nums=[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10], k=1) == 9",
"assert candidate(nums=[0, 0, 0, 0, 0], k=0) == 1",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 2, 2, 3, 3], k=1) == 2",
"assert candidate(nums=[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10], k=1) == 9",
"assert candidate(nums=[0, 0, 0, 0, 0], k=0) == 1",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 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 picture consisting of black 'B' and white 'W' pixels and an... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an m x n picture consisting of black 'B' and white 'W' pixels and an integer target, return the number of black l... | [
"assert candidate(picture=[['W', 'W', 'W', 'B'], ['B', 'W', 'W', 'B'], ['W', 'B', 'W', 'B'], ['W', 'W', 'W', 'B']], target=2) == 0",
"assert candidate(picture=[['W', 'B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W', 'B'], ['W', 'B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W', 'B']], target=2) == 4",
"assert candidate(picture=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(picture=[['W', 'W', 'W', 'B'], ['B', 'W', 'W', 'B'], ['W', 'B', 'W', 'B'], ['W', 'W', 'W', 'B']], target=2) == 0",
"assert candidate(picture=[['W', 'B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W', 'B'], ['W', 'B', 'W', 'B', 'W'], ['B', 'W', 'B', 'W', 'B']], target=2) == 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 need to construct a binary tree from a string consisting of parenthesi... | You are an expert Python 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 need to construct a binary tree from a string consisting of parenthesis and integers.
The whole input represents a ... | [
"assert is_same_tree(candidate(s='9(8(7(6(5(4(3(2(1))))))))'), tree_node([9, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))",
"assert is_same_tree(candidate(s='1(2(3))'), tree_node([1, 2, None, 3]))",
"assert is_same_tree(candidate(s='1(2(3)(4))(5(6)(7))'), tree_node([1, 2, 5, 3, 4, 6, 7]))... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(s='9(8(7(6(5(4(3(2(1))))))))'), tree_node([9, 8, None, 7, None, 6, None, 5, None, 4, None, 3, None, 2, None, 1]))",
"assert is_same_tree(candidate(s='1(2(3))'), tree_node([1, 2, None, 3]))",
"assert is_same_tree(candidate(s='1(2(3)(4))(5(6)(7))'), 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:\nGiven the root of a Binary Search Tree (BST), convert it to a Greater Tree... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is c... | [
"assert is_same_tree(candidate(root=tree_node([8, 3, 10, 1, 6, None, 14, None, 4, 7, 9, 13, None, None, None, None, None, None, None, 12, 15])), tree_node([72, 97, 64, 102, 87, None, 14, None, 101, 94, 81, 42, None, None, None, None, None, None, None, 54, 29]))",
"assert is_same_tree(candidate(root=tree_node([30,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(root=tree_node([8, 3, 10, 1, 6, None, 14, None, 4, 7, 9, 13, None, None, None, None, None, None, None, 12, 15])), tree_node([72, 97, 64, 102, 87, None, 14, None, 101, 94, 81, 42, None, None, None, None, None, None, None, 54, 29]))",
"assert is_same_tree(candid... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 list of 24-hour clock time points in \"HH:MM\" format, return 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 a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time... | [
"assert candidate(timePoints=['12:34', '12:35', '12:36', '12:37', '12:38', '12:39', '12:40', '12:41', '12:42', '12:43', '12:44', '12:45', '12:46', '12:47', '12:48', '12:49', '12:50', '12:51', '12:52', '12:53', '12:54', '12:55', '12:56', '12:57', '12:58', '12:59']) == 1",
"assert candidate(timePoints=['23:58', '00... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(timePoints=['12:34', '12:35', '12:36', '12:37', '12:38', '12:39', '12:40', '12:41', '12:42', '12:43', '12:44', '12:45', '12:46', '12:47', '12:48', '12:49', '12:50', '12:51', '12:52', '12:53', '12:54', '12:55', '12:56', '12:57', '12:58', '12:59']) == 1",
"assert candidate(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 a sorted array consisting of only integers where every 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:
You are given a sorted array consisting of only integers where every element appears exactly twice, except for one elem... | [
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 5",
"assert candidate(nums=[1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21]) == 21",
"assert candidate(nums=[2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9]) == 5",
"assert candidate(nums=[1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21]) == 21",
"assert candidate(nums=[2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 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 m x n binary matrix mat, return the distance of the nearest 0 for... | You are an expert Python 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 mat, return the distance of the nearest 0 for each cell.
The distance between two cells sh... | [
"assert candidate(mat=[[0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 2, 1, 0], [1, 2, 3, 3, 2, 1], [2, 3, 4, 4, 3, 2], [1, 2, 3, 3, 2, 1], [0, 1, 2, 2, 1, 0]]",
"assert candidate(mat=[[0, 0, 0, 1, 1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0, 1, 1, 1, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(mat=[[0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0]]) == [[0, 1, 2, 2, 1, 0], [1, 2, 3, 3, 2, 1], [2, 3, 4, 4, 3, 2], [1, 2, 3, 3, 2, 1], [0, 1, 2, 2, 1, 0]]",
"assert candidate(mat=[[0, 0, 0, 1, 1, 0, 1, 1, 1, 1], [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:\nThe boundary of a binary tree is the concatenation of the root, the left b... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The boundary of a binary tree is the concatenation of the root, the left boundary, the leaves ordered from left-to-righ... | [
"assert candidate(root=tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14])) == [1, 2, 4, 6, 8, 10, 12, 14, 13, 11, 9, 7, 5, 3]",
"assert candidate(root=tree_node([1, None, 2, 3, 4, 5, 6, None, 7, None, None, None, 8, None, 9, None, 10, None,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None, 10, None, 11, None, 12, None, 13, None, 14])) == [1, 2, 4, 6, 8, 10, 12, 14, 13, 11, 9, 7, 5, 3]",
"assert candidate(root=tree_node([1, None, 2, 3, 4, 5, 6, None, 7, None, None, None, 8, 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 several boxes with different colors represented by different... | You are an expert Python 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 several boxes with different colors represented by different positive numbers.
You may experience several... | [
"assert candidate(boxes=[5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1, 1, 1]) == 74",
"assert candidate(boxes=[16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19]) == 142",
"assert candidate(boxes=[1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) == 45",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(boxes=[5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1, 1, 1]) == 74",
"assert candidate(boxes=[16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19]) == 142",
"assert candidate(boxes=[1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 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:\nThere are n cities. Some of them are connected, while some are not. If cit... | You are an expert Python 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 cities. Some of them are connected, while some are not. If city a is connected directly with city b, and ci... | [
"assert candidate(isConnected=[[1, 1, 0, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 1, 1, 0], [0, 1, 0, 0, 1]]) == 1",
"assert candidate(isConnected=[[1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(isConnected=[[1, 1, 0, 1, 0], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 1, 1, 0], [0, 1, 0, 0, 1]]) == 1",
"assert candidate(isConnected=[[1, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 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 an integer array nums of length n, return true if there is a triplet... | You are an expert Python 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 of length n, return true if there is a triplet (i, j, k) which satisfies the following cond... | [
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False",
"assert candidate(nums=[1, 3, 2, 4, 1, 3, 2, 4, 1, 3, 2, 4, 1, 3, 2, 4, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == False",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == False",
"assert candidate(nums=[1, 3, 2, 4, 1, 3, 2, 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 the root of a binary tree, return the length of the longest consecut... | You are an expert Python 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 length of the longest consecutive path in the tree.
A consecutive path is a... | [
"assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 13, 17, None, None, None, None, None, None, None, 14, 16, 19, 12])) == 3",
"assert candidate(root=tree_node([1, 2, 3, 2, 3, 4, 5, None, None, 1, 2, 3, 4, 5, 6])) == 3",
"assert candidate(root=tree_node([5, 2, 6, 1, 3, None, None, None, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18, 1, None, 6, 8, 13, 17, None, None, None, None, None, None, None, 14, 16, 19, 12])) == 3",
"assert candidate(root=tree_node([1, 2, 3, 2, 3, 4, 5, None, None, 1, 2, 3, 4, 5, 6])) == 3",
"assert candidate(root=tree_node([5, 2, 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:\nAn attendance record for a student can be represented as a string where ea... | You are an expert Python 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 attendance record for a student can be represented as a string where each character signifies whether the student wa... | [
"assert candidate(n=300) == 921822362",
"assert candidate(n=5) == 94",
"assert candidate(n=20) == 2947811",
"assert candidate(n=3) == 19",
"assert candidate(n=200) == 110821862",
"assert candidate(n=10) == 3536",
"assert candidate(n=100) == 985598218",
"assert candidate(n=4) == 43",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=300) == 921822362",
"assert candidate(n=5) == 94",
"assert candidate(n=20) == 2947811",
"assert candidate(n=3) == 19",
"assert candidate(n=200) == 110821862",
"assert candidate(n=10) == 3536",
"assert candidate(n=100) == 985598218",
"assert candid... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is a rectangular brick wall in front of you with n rows of bricks. T... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is a rectangular brick wall in front of you with n rows of bricks. The ith row has some number of bricks each of ... | [
"assert candidate(wall=[[1, 2, 2], [2, 2, 1], [2, 1, 2]]) == 1",
"assert candidate(wall=[[3, 2, 1, 2, 3], [1, 1, 3, 2, 3], [2, 3, 1, 3, 1], [1, 2, 3, 2, 1], [3, 1, 2, 1, 2]]) == 1",
"assert candidate(wall=[[1, 2], [2, 1], [3]]) == 2",
"assert candidate(wall=[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(wall=[[1, 2, 2], [2, 2, 1], [2, 1, 2]]) == 1",
"assert candidate(wall=[[3, 2, 1, 2, 3], [1, 1, 3, 2, 3], [2, 3, 1, 3, 1], [1, 2, 3, 2, 1], [3, 1, 2, 1, 2]]) == 1",
"assert candidate(wall=[[1, 2], [2, 1], [3]]) == 2",
"assert candidate(wall=[[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 an m x n binary matrix mat, return the length of the longest line of... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an m x n binary matrix mat, return the length of the longest line of consecutive one in the matrix.
The line coul... | [
"assert candidate(mat=[[1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 9",
"assert candidate(mat=[[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(mat=[[1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 9",
"assert candidate(mat=[[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string n representing an integer, return the closest integer (not ... | You are an expert Python 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 n representing an integer, return the closest integer (not including itself), which is a palindrome. If ... | [
"assert candidate(n='888888888888888888') == '888888887788888888'",
"assert candidate(n='1000000000') == '999999999'",
"assert candidate(n='999999999999999999999') == '1000000000000000000001'",
"assert candidate(n='987654321') == '987656789'",
"assert candidate(n='2345678987654321') == '2345678998765432'",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n='888888888888888888') == '888888887788888888'",
"assert candidate(n='1000000000') == '999999999'",
"assert candidate(n='999999999999999999999') == '1000000000000000000001'",
"assert candidate(n='987654321') == '987656789'",
"assert candidate(n='23456789876543... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 where nums is a permutatio... | You are an expert Python 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 where nums is a permutation of the numbers in the range [0, n - 1].
You... | [
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2",
"assert candidate(nums=[1, 4, 3, 0, 2]) == 5",
"assert candidate(nums=[0, 2, 1, 3, 5, 4, 7, 6, 8, 10, 9]) == 2",
"assert candidate(nums=[2, 3, 1, 0, 5, 6, 4]) == 4",
"assert candidate(nums=[8, 2, 0, 7, 3, 1, 6, 5, 4]) == 8",
"assert candida... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 2",
"assert candidate(nums=[1, 4, 3, 0, 2]) == 5",
"assert candidate(nums=[0, 2, 1, 3, 5, 4, 7, 6, 8, 10, 9]) == 2",
"assert candidate(nums=[2, 3, 1, 0, 5, 6, 4]) == 4",
"assert candidate(nums=[8, 2, 0, 7, 3, 1, 6, 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 two strings s1 and s2, return true if s2 contains a permutation of 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 two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.
In other words, return... | [
"assert candidate(s1='aaaa', s2='aaabaaaa') == True",
"assert candidate(s1='abacabadabacaba', s2='badacababacabadaba') == True",
"assert candidate(s1='aaaaabbbbb', s2='ababababab') == True",
"assert candidate(s1='z', s2='abcz') == True",
"assert candidate(s1='characters', s2='tcsrhaec') == False",
"assert... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s1='aaaa', s2='aaabaaaa') == True",
"assert candidate(s1='abacabadabacaba', s2='badacababacabadaba') == True",
"assert candidate(s1='aaaaabbbbb', s2='ababababab') == True",
"assert candidate(s1='z', s2='abcz') == True",
"assert candidate(s1='characters', s2='tc... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nLeetCode wants to give one of its best employees the option to travel amon... | You are an expert Python 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:
LeetCode wants to give one of its best employees the option to travel among n cities to collect algorithm problems. But... | [
"assert candidate(flights=[[0, 1, 1, 1, 0], [1, 0, 1, 0, 1], [1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 1, 0, 0, 0]], days=[[6, 0, 0, 0, 7], [0, 6, 0, 0, 7], [0, 0, 6, 0, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7]]) == 25",
"assert candidate(flights=[[0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(flights=[[0, 1, 1, 1, 0], [1, 0, 1, 0, 1], [1, 1, 0, 0, 0], [1, 0, 0, 0, 0], [0, 1, 0, 0, 0]], days=[[6, 0, 0, 0, 7], [0, 6, 0, 0, 7], [0, 0, 6, 0, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7]]) == 25",
"assert candidate(flights=[[0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 1, 0], [0, 1, 0, 0... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two integers height and width representing a garden 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 two integers height and width representing a garden of size height x width. You are also given:
an array... | [
"assert candidate(height=30, width=30, tree=[15, 15], squirrel=[29, 29], nuts=[[14, 14], [16, 16], [15, 14], [15, 16], [14, 15], [16, 15]]) == 40",
"assert candidate(height=8, width=8, tree=[4, 4], squirrel=[7, 0], nuts=[[1, 1], [2, 2], [3, 3], [5, 5], [6, 6], [7, 7], [0, 0], [1, 7], [7, 1], [3, 6]]) == 89",
"a... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(height=30, width=30, tree=[15, 15], squirrel=[29, 29], nuts=[[14, 14], [16, 16], [15, 14], [15, 16], [14, 15], [16, 15]]) == 40",
"assert candidate(height=8, width=8, tree=[4, 4], squirrel=[7, 0], nuts=[[1, 1], [2, 2], [3, 3], [5, 5], [6, 6], [7, 7], [0, 0], [1, 7], [7, 1]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is an m x n grid with a ball. The ball is initially at the position ... | You are an expert Python 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 grid with a ball. The ball is initially at the position [startRow, startColumn]. You are allowed to m... | [
"assert candidate(m=20, n=20, maxMove=30, startRow=0, startColumn=0) == 698347833",
"assert candidate(m=45, n=45, maxMove=30, startRow=20, startColumn=20) == 875006271",
"assert candidate(m=25, n=25, maxMove=50, startRow=24, startColumn=24) == 310332047",
"assert candidate(m=15, n=15, maxMove=20, startRow=0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(m=20, n=20, maxMove=30, startRow=0, startColumn=0) == 698347833",
"assert candidate(m=45, n=45, maxMove=30, startRow=20, startColumn=20) == 875006271",
"assert candidate(m=25, n=25, maxMove=50, startRow=24, startColumn=24) == 310332047",
"assert candidate(m=15, n=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 array nums, you need to find one continuous subarray such... | You are an expert Python 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, you need to find one continuous subarray such that if you only sort this subarray in non-d... | [
"assert candidate(nums=[1, 9, 10, 2, 3, 4, 5, 6, 7, 8]) == 9",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 2]) == 9",
"assert candidate(nums=[5, 6, 3, 7, 8, 2, 9, 10, 11, 12]) == 6",
"assert candidate(nums=[2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 2",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 9, 10, 2, 3, 4, 5, 6, 7, 8]) == 9",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 2]) == 9",
"assert candidate(nums=[5, 6, 3, 7, 8, 2, 9, 10, 11, 12]) == 6",
"assert candidate(nums=[2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 n processes forming a rooted tree structure. You are given two 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:
You have n processes forming a rooted tree structure. You are given two integer arrays pid and ppid, where pid[i] is th... | [
"assert candidate(pid=[1, 2, 3, 4, 5], ppid=[0, 1, 1, 2, 2], kill=2) == [2, 4, 5]",
"assert candidate(pid=[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], ppid=[0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(pid=[1, 2, 3, 4, 5], ppid=[0, 1, 1, 2, 2], kill=2) == [2, 4, 5]",
"assert candidate(pid=[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], ppid=[0, 1, 1, 2, 2, 3, 3, 4, 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 two strings word1 and word2, return the minimum number of steps requ... | You are an expert Python 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 word1 and word2, return the minimum number of steps required to make word1 and word2 the same.
In one... | [
"assert candidate(word1='abcd', word2='abef') == 4",
"assert candidate(word1='dabc', word2='dcba') == 4",
"assert candidate(word1='dynamicprogramming', word2='dynamicprogram') == 4",
"assert candidate(word1='thequickbrownfoxjumpsoverthelazydog', word2='packmyboxwithfivedozenliquorjugs') == 43",
"assert cand... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word1='abcd', word2='abef') == 4",
"assert candidate(word1='dabc', word2='dcba') == 4",
"assert candidate(word1='dynamicprogramming', word2='dynamicprogram') == 4",
"assert candidate(word1='thequickbrownfoxjumpsoverthelazydog', word2='packmyboxwithfivedozenliquorju... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 representing an expression of fraction addition ... | You are an expert Python 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 representing an expression of fraction addition and subtraction, return the calculation resul... | [
"assert candidate(expression='1/5+2/5+3/5-4/5-3/5-2/5-1/5') == '-4/5'",
"assert candidate(expression='7/8-1/2+3/4-1/4+2/5') == '51/40'",
"assert candidate(expression='5/9-2/3+1/6-1/12+1/18') == '1/36'",
"assert candidate(expression='1/3-1/6+1/9-1/12+1/15-1/18+1/21-1/24+1/27-1/30') == '1627/7560'",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(expression='1/5+2/5+3/5-4/5-3/5-2/5-1/5') == '-4/5'",
"assert candidate(expression='7/8-1/2+3/4-1/4+2/5') == '51/40'",
"assert candidate(expression='5/9-2/3+1/6-1/12+1/18') == '1/36'",
"assert candidate(expression='1/3-1/6+1/9-1/12+1/15-1/18+1/21-1/24+1/27-1/30') =... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 four points in 2D space p1, p2, p3 and p4, 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 four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square.
... | [
"assert candidate(p1=[5, 5], p2=[6, 6], p3=[7, 7], p4=[8, 8]) == False",
"assert candidate(p1=[-5, 2], p2=[-2, 5], p3=[1, 2], p4=[-2, -1]) == True",
"assert candidate(p1=[5, 5], p2=[8, 5], p3=[8, 8], p4=[5, 8]) == True",
"assert candidate(p1=[0, 0], p2=[1, 1], p3=[1, 2], p4=[2, 1]) == False",
"assert candid... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(p1=[5, 5], p2=[6, 6], p3=[7, 7], p4=[8, 8]) == False",
"assert candidate(p1=[-5, 2], p2=[-2, 5], p3=[1, 2], p4=[-2, -1]) == True",
"assert candidate(p1=[5, 5], p2=[8, 5], p3=[8, 8], p4=[5, 8]) == True",
"assert candidate(p1=[0, 0], p2=[1, 1], p3=[1, 2], p4=[2, 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 positive integer n, return the number of the integers in the range... | You are an expert Python 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, return the number of the integers in the range [0, n] whose binary representations do not c... | [
"assert candidate(n=100000000) == 514229",
"assert candidate(n=1000000000) == 2178309",
"assert candidate(n=888888888) == 2178309",
"assert candidate(n=2147483647) == 3524578",
"assert candidate(n=5) == 5",
"assert candidate(n=555555555) == 1496319",
"assert candidate(n=314159265) == 1149851",
"assert... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=100000000) == 514229",
"assert candidate(n=1000000000) == 2178309",
"assert candidate(n=888888888) == 2178309",
"assert candidate(n=2147483647) == 3524578",
"assert candidate(n=5) == 5",
"assert candidate(n=555555555) == 1496319",
"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:\nGiven the root node of a binary tree, your task is to create a string repr... | You are an expert Python 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 node of a binary tree, your task is to create a string representation of the tree following a specific s... | [
"assert candidate(root=tree_node([1, 2, 3, None, 4, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12])) == '1(2()(4()(6(7()(8)))))(3(5))'",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 14, None, 16, 17, 18, 19, No... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, 2, 3, None, 4, 5, None, None, 6, None, None, 7, None, None, 8, None, None, 9, None, None, 10, None, None, 11, None, None, 12])) == '1(2()(4()(6(7()(8)))))(3(5))'",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, None, None, None, None, 14, 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:\nGiven a list paths of directory info, including the directory path, and al... | You are an expert Python 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 list paths of directory info, including the directory path, and all the files with contents in this directory, ... | [
"assert candidate(paths=['root/a/b 1.txt(abcd) 2.txt(efgh)', 'root/a/b/c 3.txt(abcd)', 'root/a/b/c/d 4.txt(efgh)', 'root/a/b/e 5.txt(efgh)', 'root/f/g 6.txt(abcd)']) == [['root/a/b/1.txt', 'root/a/b/c/3.txt', 'root/f/g/6.txt'], ['root/a/b/2.txt', 'root/a/b/c/d/4.txt', 'root/a/b/e/5.txt']]",
"assert candidate(path... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(paths=['root/a/b 1.txt(abcd) 2.txt(efgh)', 'root/a/b/c 3.txt(abcd)', 'root/a/b/c/d 4.txt(efgh)', 'root/a/b/e 5.txt(efgh)', 'root/f/g 6.txt(abcd)']) == [['root/a/b/1.txt', 'root/a/b/c/3.txt', 'root/f/g/6.txt'], ['root/a/b/2.txt', 'root/a/b/c/d/4.txt', 'root/a/b/e/5.txt']]",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 CPU tasks, each labeled with a letter from A 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:
You are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be i... | [
"assert candidate(tasks=['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D'], n=5) == 28",
"assert candidate(tasks=['X', 'X', 'X', 'Y', 'Y', 'Y', 'Z', 'Z', 'W', 'W', 'W', 'W', 'W', 'V', 'V', 'V', 'V', 'V'], n=5) == 26",
"assert candidate(tasks=['A', 'A', 'A', 'A',... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(tasks=['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D'], n=5) == 28",
"assert candidate(tasks=['X', 'X', 'X', 'Y', 'Y', 'Y', 'Z', 'Z', 'W', 'W', 'W', 'W', 'W', 'V', 'V', 'V', 'V', 'V'], n=5) == 26",
"assert candidate(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:\nGiven the root of a binary tree and two integers val and depth, add a row ... | You are an expert Python 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 and two integers val and depth, add a row of nodes with value val at the given depth de... | [
"assert is_same_tree(candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7]), val=0, depth=2), tree_node([1, 0, 0, 2, None, None, 3, 4, 5, 6, 7]))",
"assert is_same_tree(candidate(root=tree_node([1]), val=2, depth=1), tree_node([2, 1]))",
"assert is_same_tree(candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7]), val=3, dept... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7]), val=0, depth=2), tree_node([1, 0, 0, 2, None, None, 3, 4, 5, 6, 7]))",
"assert is_same_tree(candidate(root=tree_node([1]), val=2, depth=1), tree_node([2, 1]))",
"assert is_same_tree(candidate(root=tree_node([1, 2, 3, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given m arrays, where each array is sorted in ascending order.\nYo... | You are an expert Python 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 m arrays, where each array is sorted in ascending order.
You can pick up two integers from two different ... | [
"assert candidate(arrays=[[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]]) == 29",
"assert candidate(arrays=[[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993], [9, 992], [10, 991], [11, 990], [12, 989], [13, 988], [... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arrays=[[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]]) == 29",
"assert candidate(arrays=[[1, 1000], [2, 999], [3, 998], [4, 997], [5, 996], [6, 995], [7, 994], [8, 993], [9, 992], [10, 991], [11, 990], ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 num, return the smallest positive integer x whose... | You are an expert Python 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 num, return the smallest positive integer x whose multiplication of each digit equals num. If ... | [
"assert candidate(num=5184) == 8899",
"assert candidate(num=1024) == 2888",
"assert candidate(num=12345678) == 0",
"assert candidate(num=111111111) == 0",
"assert candidate(num=180) == 459",
"assert candidate(num=231) == 0",
"assert candidate(num=4294967295) == 0",
"assert candidate(num=65535) == 0",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(num=5184) == 8899",
"assert candidate(num=1024) == 2888",
"assert candidate(num=12345678) == 0",
"assert candidate(num=111111111) == 0",
"assert candidate(num=180) == 459",
"assert candidate(num=231) == 0",
"assert candidate(num=4294967295) == 0",
"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere are n different online courses numbered from 1 to n. You are given 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 are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [durationi... | [
"assert candidate(courses=[[5, 20], [10, 25], [15, 30]]) == 3",
"assert candidate(courses=[[100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300]]) == 3",
"assert candidate(courses=[[500, 700], [600, 1200], [100, 600], [400,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(courses=[[5, 20], [10, 25], [15, 30]]) == 3",
"assert candidate(courses=[[100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300], [100, 300]]) == 3",
"assert candidate(courses=[[500, 700], [600,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 c, decide whether there're two integers a and... | You are an expert Python 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 c, decide whether there're two integers a and b such that a2 + b2 = c.
Constraints:
0 <... | [
"assert candidate(c=675) == False",
"assert candidate(c=250000000) == True",
"assert candidate(c=16777216) == True",
"assert candidate(c=1000000) == True",
"assert candidate(c=3249000000) == True",
"assert candidate(c=2147483600) == True",
"assert candidate(c=4) == True",
"assert candidate(c=846456943... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(c=675) == False",
"assert candidate(c=250000000) == True",
"assert candidate(c=16777216) == True",
"assert candidate(c=1000000) == True",
"assert candidate(c=3249000000) == True",
"assert candidate(c=2147483600) == True",
"assert candidate(c=4) == True"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nIn combinatorial mathematics, a derangement is a permutation of the elemen... | You are an expert Python 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:
In combinatorial mathematics, a derangement is a permutation of the elements of a set, such that no element appears in ... | [
"assert candidate(n=3) == 2",
"assert candidate(n=1000000) == 102701088",
"assert candidate(n=9) == 133496",
"assert candidate(n=500000) == 243851595",
"assert candidate(n=1) == 0",
"assert candidate(n=20) == 927799753",
"assert candidate(n=100000) == 183389504",
"assert candidate(n=999999) == 1855591... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=3) == 2",
"assert candidate(n=1000000) == 102701088",
"assert candidate(n=9) == 133496",
"assert candidate(n=500000) == 243851595",
"assert candidate(n=1) == 0",
"assert candidate(n=20) == 927799753",
"assert candidate(n=100000) == 183389504",
"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:\nOn a single-threaded CPU, we execute a program containing n functions. Eac... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1.... | [
"assert candidate(n=3, logs=['0:start:0', '0:start:1', '1:start:2', '1:end:3', '2:start:4', '2:start:5', '2:end:6', '1:start:7', '1:end:8', '0:end:9']) == [2, 4, 4]",
"assert candidate(n=3, logs=['0:start:0', '0:start:2', '1:start:3', '1:end:4', '1:start:5', '1:end:6', '0:end:7', '0:start:8', '0:end:9']) == [6, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=3, logs=['0:start:0', '0:start:1', '1:start:2', '1:end:3', '2:start:4', '2:start:5', '2:end:6', '1:start:7', '1:end:8', '0:end:9']) == [2, 4, 4]",
"assert candidate(n=3, logs=['0:start:0', '0:start:2', '1:start:3', '1:end:4', '1:start:5', '1:end:6', '0:end:7', '0:start: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:\nIn LeetCode Store, there are n items to sell. Each item has a price. Howev... | You are an expert Python 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:
In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a spec... | [
"assert candidate(price=[2, 4, 6, 8, 10, 12], special=[[1, 1, 1, 1, 1, 1, 30], [2, 2, 2, 2, 2, 2, 50], [0, 0, 1, 0, 0, 0, 6]], needs=[1, 2, 3, 4, 5, 6]) == 170",
"assert candidate(price=[2, 3, 4, 5, 6], special=[[1, 1, 0, 0, 0, 10], [0, 0, 1, 1, 0, 12], [1, 0, 1, 0, 1, 15], [0, 1, 0, 1, 1, 17]], needs=[5, 5, 5, 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(price=[2, 4, 6, 8, 10, 12], special=[[1, 1, 1, 1, 1, 1, 30], [2, 2, 2, 2, 2, 2, 50], [0, 0, 1, 0, 0, 0, 6]], needs=[1, 2, 3, 4, 5, 6]) == 170",
"assert candidate(price=[2, 3, 4, 5, 6], special=[[1, 1, 0, 0, 0, 10], [0, 0, 1, 1, 0, 12], [1, 0, 1, 0, 1, 15], [0, 1, 0, 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:\nA message containing letters from A-Z can be encoded into numbers using th... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
A message containing letters from A-Z can be encoded into numbers using the following mapping:
'A' -> "1"
'B' -> "2"
.... | [
"assert candidate(s='*28*') == 99",
"assert candidate(s='22222222222222222222*') == 139104",
"assert candidate(s='262*1*') == 576",
"assert candidate(s='12*12*12*12*12*12*') == 311447616",
"assert candidate(s='1234567890*1234567890') == 0",
"assert candidate(s='*0000000000000000000000000000000000000000000... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='*28*') == 99",
"assert candidate(s='22222222222222222222*') == 139104",
"assert candidate(s='262*1*') == 576",
"assert candidate(s='12*12*12*12*12*12*') == 311447616",
"assert candidate(s='1234567890*1234567890') == 0",
"assert candidate(s='*000000000000... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nSolve a given equation and return the value of 'x' in the form of a string... | You are an expert Python 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:
Solve a given equation and return the value of 'x' in the form of a string "x=#value". The equation contains only '+', ... | [
"assert candidate(equation='10x-20=5x-5+3x') == 'x=7'",
"assert candidate(equation='-3x+9x=9x-3x') == 'Infinite solutions'",
"assert candidate(equation='5=5') == 'Infinite solutions'",
"assert candidate(equation='5-2x=3x+6') == 'x=-1'",
"assert candidate(equation='2x-2x=0') == 'Infinite solutions'",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(equation='10x-20=5x-5+3x') == 'x=7'",
"assert candidate(equation='-3x+9x=9x-3x') == 'Infinite solutions'",
"assert candidate(equation='5=5') == 'Infinite solutions'",
"assert candidate(equation='5-2x=3x+6') == 'x=-1'",
"assert candidate(equation='2x-2x=0') == '... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums consisting of n elements, and an 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:
You are given an integer array nums consisting of n elements, and an integer k.
Find a contiguous subarray whose length... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=7) == 11.999998092651367",
"assert candidate(nums=[-100, 100, -100, 100, -100, 100, -100, 100, -100, 100], k=6) == 14.28571343421936",
"assert candidate(nums=[1, -2, 3, -4, 5, -6, 7, -8, 9, -10], k=3) == 2.666663646697998",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=7) == 11.999998092651367",
"assert candidate(nums=[-100, 100, -100, 100, -100, 100, -100, 100, -100, 100], k=6) == 14.28571343421936",
"assert candidate(nums=[1, -2, 3, -4, 5, -6, 7, -8, 9, -10], k=3) == 2.666... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of n pairs pairs where pairs[i] = [lefti, righti] a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of n pairs pairs where pairs[i] = [lefti, righti] and lefti < righti.
A pair p2 = [c, d] follows... | [
"assert candidate(pairs=[[-5, 0], [-4, -3], [-2, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8]]) == 4",
"assert candidate(pairs=[[1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [13, 15], [14, 16], [17, 19], [18, 20]]) == 5",
"assert candidate(pairs=[[-5, -3], [-4, -2], [-3, -1], [-2, 0], [-1, 1]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(pairs=[[-5, 0], [-4, -3], [-2, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 8]]) == 4",
"assert candidate(pairs=[[1, 3], [2, 4], [5, 7], [6, 8], [9, 11], [10, 12], [13, 15], [14, 16], [17, 19], [18, 20]]) == 5",
"assert candidate(pairs=[[-5, -3], [-4, -2], [... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, return the number of palindromic substrings in it.\nA st... | You are an expert Python 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, return the number of palindromic substrings in it.
A string is a palindrome when it reads the same ba... | [
"assert candidate(s='civicciviccivic') == 36",
"assert candidate(s='rotorrotorrotorrotor') == 58",
"assert candidate(s='abacabadabacaba') == 32",
"assert candidate(s='abaaabbaaabaaa') == 35",
"assert candidate(s='deified') == 10",
"assert candidate(s='xxyyyxyxx') == 17",
"assert candidate(s='abcdeedcba'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='civicciviccivic') == 36",
"assert candidate(s='rotorrotorrotorrotor') == 58",
"assert candidate(s='abacabadabacaba') == 32",
"assert candidate(s='abaaabbaaabaaa') == 35",
"assert candidate(s='deified') == 10",
"assert candidate(s='xxyyyxyxx') == 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:\nIn English, we have a concept called root, which can be followed by some 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:
In English, we have a concept called root, which can be followed by some other word to form another longer word - let's... | [
"assert candidate(dictionary=['bat', 'banana', 'band', 'bandana', 'bandwidth'], sentence='bandanna batman band bandana bandwidth') == 'band bat band band band'",
"assert candidate(dictionary=['dog', 'cat'], sentence='caterpillar catalog dogmatic') == 'cat cat dog'",
"assert candidate(dictionary=['inter', 'inter... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(dictionary=['bat', 'banana', 'band', 'bandana', 'bandwidth'], sentence='bandanna batman band bandana bandwidth') == 'band bat band band band'",
"assert candidate(dictionary=['dog', 'cat'], sentence='caterpillar catalog dogmatic') == 'cat cat dog'",
"assert candidate(di... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 only one character 'A' on the screen of a notepad. You can perfor... | You are an expert Python 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 only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for e... | [
"assert candidate(n=361) == 38",
"assert candidate(n=2) == 2",
"assert candidate(n=961) == 62",
"assert candidate(n=343) == 21",
"assert candidate(n=81) == 12",
"assert candidate(n=30) == 10",
"assert candidate(n=729) == 18",
"assert candidate(n=14) == 9",
"assert candidate(n=13) == 13",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=361) == 38",
"assert candidate(n=2) == 2",
"assert candidate(n=961) == 62",
"assert candidate(n=343) == 21",
"assert candidate(n=81) == 12",
"assert candidate(n=30) == 10",
"assert candidate(n=729) == 18",
"assert candidate(n=14) == 9",
"asser... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree, construct a 0-indexed m x n string matrix... | You are an expert Python 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, construct a 0-indexed m x n string matrix res that represents a formatted layout of th... | [
"assert candidate(root=tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9, 10, 11])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, 2, 3, 4, 5, None, None, 6, 7, None, None, 8, 9, 10, 11])) == [['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '2', '', '', '', '', '', '', '', '', '',... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array coins (1-indexed) of length n and an intege... | You are an expert Python 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 coins (1-indexed) of length n and an integer maxJump. You can jump to any index i of the... | [
"assert candidate(coins=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], maxJump=3) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"assert candidate(coins=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxJump=3) == [1, 4, 7, 10]",
"assert candidate(coins=[5, 3, 1, -1, 10, 7, 6, 8, 5, 1], maxJump=4) == [1, 3, 7, 10]",
"assert candidate(coins=[1, 2, -... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(coins=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], maxJump=3) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"assert candidate(coins=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxJump=3) == [1, 4, 7, 10]",
"assert candidate(coins=[5, 3, 1, -1, 10, 7, 6, 8, 5, 1], maxJump=4) == [1, 3, 7, 10]",
"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 arr, two integers k and x, return the k close... | You are an expert Python 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 arr, two integers k and x, return the k closest integers to x in the array. The result sho... | [
"assert candidate(arr=[-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90], k=5, x=-99) == [-100, -99, -98, -97, -96]",
"assert candidate(arr=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2], k=5, x=1) == [1, 1, 1, 1, 1]",
"assert candidate(arr=[1, 3, 5, 7, 9], k=5, x=8) == [1, 3, 5, 7, 9]",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[-100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90], k=5, x=-99) == [-100, -99, -98, -97, -96]",
"assert candidate(arr=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2], k=5, x=1) == [1, 1, 1, 1, 1]",
"assert candidate(arr=[1, 3, 5, 7, 9], k=5, x=8) == [1, 3, 5, 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:\nYou are given an integer array nums that is sorted in non-decreasing order... | You are an expert Python 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 that is sorted in non-decreasing order.
Determine if it is possible to split nums i... | [
"assert candidate(nums=[1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 29, 29, 30]) == True",
"assert candidate(nums=[1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13]) == F... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 29, 29, 30]) == True",
"assert candidate(nums=[1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 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:\nStart from integer 1, remove any integer that contains 9 such as 9, 19, 29... | You are an expert Python 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:
Start from integer 1, remove any integer that contains 9 such as 9, 19, 29...
Now, you will have a new integer sequence... | [
"assert candidate(n=8888) == '13165'",
"assert candidate(n=456789) == '765533'",
"assert candidate(n=20) == '22'",
"assert candidate(n=75000000) == '166111583'",
"assert candidate(n=8) == '8'",
"assert candidate(n=87654321) == '202838110'",
"assert candidate(n=80000000) == '176472328'",
"assert candid... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=8888) == '13165'",
"assert candidate(n=456789) == '765533'",
"assert candidate(n=20) == '22'",
"assert candidate(n=75000000) == '166111583'",
"assert candidate(n=8) == '8'",
"assert candidate(n=87654321) == '202838110'",
"assert candidate(n=80000000) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.