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 the root of a binary tree, return the maximum width of the given tre... | You are an expert Python programmer. 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 maximum width of the given tree.
The maximum width of a tree is the maximum... | [
"assert candidate(root=tree_node([1, None, 2, 3, None, 4, 5, 6, None, 7, None, 8, None, 9, None, 10])) == 5",
"assert candidate(root=tree_node([1, 3, 2, 5, 4, None, 9, None, None, 6, 7, 8, 9])) == 6",
"assert candidate(root=tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, None, 9, None, 10, None, 11, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, None, 2, 3, None, 4, 5, 6, None, 7, None, 8, None, 9, None, 10])) == 5",
"assert candidate(root=tree_node([1, 3, 2, 5, 4, None, 9, None, None, 6, 7, 8, 9])) == 6",
"assert candidate(root=tree_node([1, 3, 2, 5, None, None, 9, 6, None, 7, None, 8, 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 the root of a binary tree, return true if you can partition the tree... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree, return true if you can partition the tree into two trees with equal sums of values aft... | [
"assert candidate(root=tree_node([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])) == False",
"assert candidate(root=tree_node([1, -1, 2, -2, 3, -3, 4, -4])) == False",
"assert candidate(root=tree_node([10000, -5000, -5000, 2500, 2500, 2500, 2500, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([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])) == False",
"assert candidate(root=tree_node([1, -1, 2, -2, 3, -3, 4, -4])) == False",
"assert candidate(root=tree_node([10000, -5000, -5000,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums with n integers, your task is to check if it could bec... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most one e... | [
"assert candidate(nums=[1, 2, 3, 3, 2, 2, 3, 4]) == False",
"assert candidate(nums=[1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19]) == False",
"assert candidate(nums=[100, 200, 150, 250, 300, 350, 400, 450, 500, 550, 600]) == True",
"assert candidate(nums=[1, 3, 2, 3, 2, 2, 3]) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 3, 2, 2, 3, 4]) == False",
"assert candidate(nums=[1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19]) == False",
"assert candidate(nums=[100, 200, 150, 250, 300, 350, 400, 450, 500, 550, 600]) == True",
"assert candidate(nums... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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, construct a list answer that contains n differ... | You are an expert Python programmer. 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, construct a list answer that contains n different positive integers ranging from 1 to n and... | [
"assert candidate(n=9, k=5) == [1, 9, 2, 8, 3, 4, 5, 6, 7]",
"assert candidate(n=750, k=375) == [1, 750, 2, 749, 3, 748, 4, 747, 5, 746, 6, 745, 7, 744, 8, 743, 9, 742, 10, 741, 11, 740, 12, 739, 13, 738, 14, 737, 15, 736, 16, 735, 17, 734, 18, 733, 19, 732, 20, 731, 21, 730, 22, 729, 23, 728, 24, 727, 25, 726, 2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=9, k=5) == [1, 9, 2, 8, 3, 4, 5, 6, 7]",
"assert candidate(n=750, k=375) == [1, 750, 2, 749, 3, 748, 4, 747, 5, 746, 6, 745, 7, 744, 8, 743, 9, 742, 10, 741, 11, 740, 12, 739, 13, 738, 14, 737, 15, 736, 16, 735, 17, 734, 18, 733, 19, 732, 20, 731, 21, 730, 22, 729, 23, 7... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary search tree and the lowest and highest boundari... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all... | [
"assert is_same_tree(candidate(root=tree_node([1, None, 2, None, 3, None, 4]), low=3, high=4), tree_node([3, None, 4]))",
"assert is_same_tree(candidate(root=tree_node([10, 5, 15, 3, 7, None, 18]), low=7, high=15), tree_node([10, 7, 15]))",
"assert is_same_tree(candidate(root=tree_node([1, None, 2, None, 3, Non... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(root=tree_node([1, None, 2, None, 3, None, 4]), low=3, high=4), tree_node([3, None, 4]))",
"assert is_same_tree(candidate(root=tree_node([10, 5, 15, 3, 7, None, 18]), low=7, high=15), tree_node([10, 7, 15]))",
"assert is_same_tree(candidate(root=tree_node(... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer num. You can swap two digits at most once to get ... | You are an expert Python programmer. 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 num. You can swap two digits at most once to get the maximum valued number.
Return the maximum... | [
"assert candidate(num=898989898) == 998989888",
"assert candidate(num=12) == 21",
"assert candidate(num=2376) == 7326",
"assert candidate(num=333322221111) == 333322221111",
"assert candidate(num=1099511625) == 9091511625",
"assert candidate(num=323232323) == 333232322",
"assert candidate(num=999999991)... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(num=898989898) == 998989888",
"assert candidate(num=12) == 21",
"assert candidate(num=2376) == 7326",
"assert candidate(num=333322221111) == 333322221111",
"assert candidate(num=1099511625) == 9091511625",
"assert candidate(num=323232323) == 333232322",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 room with n bulbs labeled from 1 to n that all are turned on 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:
There is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall. Each o... | [
"assert candidate(n=100, presses=7) == 8",
"assert candidate(n=12, presses=9) == 8",
"assert candidate(n=25, presses=10) == 8",
"assert candidate(n=3, presses=2) == 7",
"assert candidate(n=10, presses=3) == 8",
"assert candidate(n=7, presses=2) == 7",
"assert candidate(n=100, presses=10) == 8",
"asser... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=100, presses=7) == 8",
"assert candidate(n=12, presses=9) == 8",
"assert candidate(n=25, presses=10) == 8",
"assert candidate(n=3, presses=2) == 7",
"assert candidate(n=10, presses=3) == 8",
"assert candidate(n=7, presses=2) == 7",
"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 an integer array nums, return the number of longest increasing 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 longest increasing subsequences.
Notice that the sequence has to be s... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 1",
"assert candidate(nums=[1, 3, 5, 4, 7]) == 2",
"assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1",
"assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, ... | 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]) == 1",
"assert candidate(nums=[1, 3, 5, 4, 7]) == 2",
"assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == 1",
"assert candidate(nums=[20, 19, 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 asked to cut off all the trees in a forest for a golf event. The f... | You are an expert Python programmer. 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 asked to cut off all the trees in a forest for a golf event. The forest is represented as an m x n matrix. In t... | [
"assert candidate(forest=[[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]]) == 40",
"assert candidate(forest=[[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, 0, 0, 0], [0, 0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(forest=[[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]]) == 40",
"assert candidate(forest=[[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 only three types of characters: '(', ')' 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 string s containing only three types of characters: '(', ')' and '*', return true if s is valid.
The following ... | [
"assert candidate(s='(((())))**(**)***') == True",
"assert candidate(s='*()') == True",
"assert candidate(s='(()*(()))') == True",
"assert candidate(s='((((*((*)))))') == True",
"assert candidate(s='((((*)))()*)*') == True",
"assert candidate(s='(())*') == True",
"assert candidate(s='((*)(*))(())((**))'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='(((())))**(**)***') == True",
"assert candidate(s='*()') == True",
"assert candidate(s='(()*(()))') == True",
"assert candidate(s='((((*((*)))))') == True",
"assert candidate(s='((((*)))()*)*') == True",
"assert candidate(s='(())*') == True",
"assert... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array cards of length 4. You have four cards, 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:
You are given an integer array cards of length 4. You have four cards, each containing a number in the range [1, 9]. Yo... | [
"assert candidate(cards=[9, 5, 6, 3]) == True",
"assert candidate(cards=[6, 1, 1, 1]) == False",
"assert candidate(cards=[7, 9, 3, 1]) == True",
"assert candidate(cards=[2, 8, 4, 1]) == True",
"assert candidate(cards=[1, 6, 6, 6]) == True",
"assert candidate(cards=[1, 10, 1, 10]) == False",
"assert cand... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(cards=[9, 5, 6, 3]) == True",
"assert candidate(cards=[6, 1, 1, 1]) == False",
"assert candidate(cards=[7, 9, 3, 1]) == True",
"assert candidate(cards=[2, 8, 4, 1]) == True",
"assert candidate(cards=[1, 6, 6, 6]) == True",
"assert candidate(cards=[1, 10, 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 time represented in the format \"HH:MM\", form the next closest ti... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no l... | [
"assert candidate(time='00:00') == '00:00'",
"assert candidate(time='14:55') == '15:11'",
"assert candidate(time='22:55') == '22:22'",
"assert candidate(time='04:20') == '04:22'",
"assert candidate(time='11:11') == '11:11'",
"assert candidate(time='14:59') == '15:11'",
"assert candidate(time='00:01') ==... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(time='00:00') == '00:00'",
"assert candidate(time='14:55') == '15:11'",
"assert candidate(time='22:55') == '22:22'",
"assert candidate(time='04:20') == '04:22'",
"assert candidate(time='11:11') == '11:11'",
"assert candidate(time='14:59') == '15:11'",
"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 bulbs in a row numbered from 1 to n. Initially, all the bulbs 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 have n bulbs in a row numbered from 1 to n. Initially, all the bulbs are turned off. We turn on exactly one bulb ev... | [
"assert candidate(bulbs=[3, 1, 2, 5, 6, 4, 7, 10, 8, 9], k=2) == 8",
"assert candidate(bulbs=[1, 5, 3, 7, 9, 2, 4, 6, 8, 10], k=3) == 2",
"assert candidate(bulbs=[8, 6, 9, 7, 10, 3, 5, 1, 4, 2], k=4) == -1",
"assert candidate(bulbs=[15, 8, 2, 11, 4, 13, 7, 6, 3, 1, 5, 12, 10, 9, 14], k=5) == 3",
"assert can... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(bulbs=[3, 1, 2, 5, 6, 4, 7, 10, 8, 9], k=2) == 8",
"assert candidate(bulbs=[1, 5, 3, 7, 9, 2, 4, 6, 8, 10], k=3) == 2",
"assert candidate(bulbs=[8, 6, 9, 7, 10, 3, 5, 1, 4, 2], k=4) == -1",
"assert candidate(bulbs=[15, 8, 2, 11, 4, 13, 7, 6, 3, 1, 5, 12, 10, 9, 14]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nIn this problem, a tree is an undirected graph that is connected and has 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:
In this problem, a tree is an undirected graph that is connected and has no cycles.
You are given a graph that started ... | [
"assert candidate(edges=[[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [9, 15]]) == [8, 9]",
"assert candidate(edges=[[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(edges=[[1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11], [6, 12], [6, 13], [7, 14], [7, 15], [8, 9], [10, 11], [12, 13], [14, 15], [9, 15]]) == [8, 9]",
"assert candidate(edges=[[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9],... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two strings a and b, return the minimum number of times you should r... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two strings a and b, return the minimum number of times you should repeat string a so that string b is a substrin... | [
"assert candidate(a='abcdabcd', b='cdabcdabcdabcd') == 2",
"assert candidate(a='aaaaaaaaaaaaaaaaaaaaaab', b='ba') == 2",
"assert candidate(a='abcdefgh', b='habcdefghabc') == 3",
"assert candidate(a='algorithm', b='rithmalgorith') == 2",
"assert candidate(a='xy', b='yxyxyxyxyxyxyx') == 8",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(a='abcdabcd', b='cdabcdabcdabcd') == 2",
"assert candidate(a='aaaaaaaaaaaaaaaaaaaaaab', b='ba') == 2",
"assert candidate(a='abcdefgh', b='habcdefghabc') == 3",
"assert candidate(a='algorithm', b='rithmalgorith') == 2",
"assert candidate(a='xy', b='yxyxyxyxyxyxy... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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, find three non-overlapping s... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and ret... | [
"assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k=5) == [0, 5, 10]",
"assert candidate(nums=[9, 4, 3, 7, 9, 1, 4, 7, 9, 7, 1, 8, 3, 1, 8, 1, 6, 8, 1, 8, 5, 9, 5, 7, 5, 8, 5, 8, 9, 3, 4, 8, 2, 7, 8, 3, 8, 4, 3, 7, 6, 9, 2, 4, 5, 8, 3, 7, 5, 9], k=7) == [3, 17, 25]",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k=5) == [0, 5, 10]",
"assert candidate(nums=[9, 4, 3, 7, 9, 1, 4, 7, 9, 7, 1, 8, 3, 1, 8, 1, 6, 8, 1, 8, 5, 9, 5, 7, 5, 8, 5, 8, 9, 3, 4, 8, 2, 7, 8, 3, 8, 4, 3, 7, 6, 9, 2, 4, 5, 8, 3, 7, 5, 9],... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of strings words and an integer k, return the k most freque... | You are an expert Python programmer. 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 and an integer k, return the k most frequent strings.
Return the answer sorted by the f... | [
"assert candidate(words=['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'kiwi', 'kiwi', 'kiwi'], k=3) == ['apple', 'kiwi', 'banana']",
"assert candidate(words=['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['apple', 'banana', 'apple', 'orange', 'banana', 'apple', 'kiwi', 'kiwi', 'kiwi'], k=3) == ['apple', 'kiwi', 'banana']",
"assert candidate(words=['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'alpha', 'beta', 'gamma', 'de... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an m x n binary matrix grid. An island is a group of 1's (re... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (h... | [
"assert candidate(grid=[[1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 2",
"assert candidate(grid=[[1, 1, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1], [0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]]) == 2",
"assert candidate(grid=[[1, 1, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 0, 0... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums and an integer k, return true if it is possibl... | You are an expert Python programmer. 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 it is possible to divide this array into k non-empty subse... | [
"assert candidate(nums=[10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000], k=8) == True",
"assert candidate(nums=[3, 1, 2, 2, 3, 3, 2, 2, 1, 3, 3, 3, 2, 1, 2, 2], k=6) == False",
"assert candidate(nums=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], k=16) == True",
"assert candidate(nums=[10, 20, 30, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000], k=8) == True",
"assert candidate(nums=[3, 1, 2, 2, 3, 3, 2, 2, 1, 3, 3, 3, 2, 1, 2, 2], k=6) == False",
"assert candidate(nums=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], k=16) == 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:\nThere are several squares being dropped onto the X-axis of a 2D plane.\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:
There are several squares being dropped onto the X-axis of a 2D plane.
You are given a 2D integer array positions where... | [
"assert candidate(positions=[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [1, 2, 5, 9, 14]",
"assert candidate(positions=[[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"assert candidate(positions=[[1, 200], [200, 100], [150, 50], [50, 25], [... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(positions=[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]) == [1, 2, 5, 9, 14]",
"assert candidate(positions=[[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"assert candidate(positions=[[1, 200], [200, 100... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given the root node of a binary search tree (BST) and a value to 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 the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of ... | [
"assert is_same_tree(candidate(root=tree_node([45, 30, 60, 10, 35, 50, 70, 5, 20, None, 40, None, None, 33, None]), val=42), tree_node([45, 30, 60, 10, 35, 50, 70, 5, 20, None, 40, None, None, 33, None, None, None, None, None, None, 42]))",
"assert is_same_tree(candidate(root=tree_node([10, 5, 15, 2, 7, None, 20,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(root=tree_node([45, 30, 60, 10, 35, 50, 70, 5, 20, None, 40, None, None, 33, None]), val=42), tree_node([45, 30, 60, 10, 35, 50, 70, 5, 20, None, 40, None, None, 33, None, None, None, None, None, None, 42]))",
"assert is_same_tree(candidate(root=tree_node([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 an m x n binary matrix grid. An island is a group of 1's (re... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (h... | [
"assert candidate(grid=[[1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0]]) == 1",
"assert candidate(grid=[[0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 1], [1, 1, 0, 1, 1, 1], [0, 0, 0, 0, 1, 0], [0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0]]) == 1",
"assert candidate(grid=[[0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 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 an array of integers nums and an integer k, return the number of con... | You are an expert Python programmer. 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 contiguous subarrays where the product of all th... | [
"assert candidate(nums=[8, 2, 6, 5, 1, 2, 3, 4, 5, 6, 7], k=100) == 32",
"assert candidate(nums=[1, 2, 3, 4, 5], k=1) == 0",
"assert candidate(nums=[31, 37, 41, 43, 47, 53, 59, 61, 67, 71], k=1000000) == 27",
"assert candidate(nums=[7, 3, 2, 2, 1], k=12) == 9",
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[8, 2, 6, 5, 1, 2, 3, 4, 5, 6, 7], k=100) == 32",
"assert candidate(nums=[1, 2, 3, 4, 5], k=1) == 0",
"assert candidate(nums=[31, 37, 41, 43, 47, 53, 59, 61, 67, 71], k=1000000) == 27",
"assert candidate(nums=[7, 3, 2, 2, 1], k=12) == 9",
"assert candidate... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array prices where prices[i] is the price of a given stoc... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee represen... | [
"assert candidate(prices=[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], fee=10) == 0",
"assert candidate(prices=[8, 6, 4, 2, 10, 8, 6, 14, 12, 10, 18, 16, 14, 20, 18, 22], fee=4) == 16",
"assert candidate(prices=[1, 10, 3, 100, 4, 101, 5, 102, 6,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(prices=[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], fee=10) == 0",
"assert candidate(prices=[8, 6, 4, 2, 10, 8, 6, 14, 12, 10, 18, 16, 14, 20, 18, 22], fee=4) == 16",
"assert candidate(prices=[1, 10, 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 two integer arrays nums1 and nums2, return the maximum length of a 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 integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays.
Constr... | [
"assert candidate(nums1=[1, 2, 3, 2, 1, 4, 5, 6], nums2=[4, 5, 6, 1, 2, 3, 2, 1]) == 5",
"assert candidate(nums1=[1, 2, 3, 2, 1], nums2=[1, 2, 3, 2, 1]) == 5",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], nums2=[11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[1, 2, 3, 2, 1, 4, 5, 6], nums2=[4, 5, 6, 1, 2, 3, 2, 1]) == 5",
"assert candidate(nums1=[1, 2, 3, 2, 1], nums2=[1, 2, 3, 2, 1]) == 5",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], nums2=[11, 12, 13, 14, 15, 16,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 distance of a pair of integers a and b is defined as the absolute diff... | You are an expert Python programmer. 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 distance of a pair of integers a and b is defined as the absolute difference between a and b.
Given an integer arra... | [
"assert candidate(nums=[10, 20, 30, 40, 50], k=5) == 20",
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200], k=190) == 190",
"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,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 20, 30, 40, 50], k=5) == 20",
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200], k=190) == 190",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 representing an English Dictionary, 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 an array of strings words representing an English Dictionary, return the longest word in words that can be built ... | [
"assert candidate(words=['m', 'mo', 'moc', 'moch', 'mocha', 'mochas', 'mochahu', 'mochahuu', 'mochahuuu']) == 'mochas'",
"assert candidate(words=['w', 'wo', 'wor', 'worl', 'world', 'worldly', 'worldlyy', 'worldlyyy', 'worldlyyyy', 'worldlyyyyy', 'worldlyyyyyy', 'worldlyyyyyyy', 'worldlyyyyyyyy', 'worldlyyyyyyyyy'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['m', 'mo', 'moc', 'moch', 'mocha', 'mochas', 'mochahu', 'mochahuu', 'mochahuuu']) == 'mochas'",
"assert candidate(words=['w', 'wo', 'wor', 'worl', 'world', 'worldly', 'worldlyy', 'worldlyyy', 'worldlyyyy', 'worldlyyyyy', 'worldlyyyyyy', 'worldlyyyyyyy', 'worldlyyyyy... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 accounts where each element accounts[i] is a list of strin... | You are an expert Python programmer. 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 accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is... | [
"assert candidate(accounts=[['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com'], ['Eve', 'eve6@example.com'], ['Eve', 'eve7@example.com'], ['Eve', 'eve8@example.com'], ['Eve', 'eve9@example.com'], ['Eve', 'eve10@example.com'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(accounts=[['Eve', 'eve1@example.com'], ['Eve', 'eve2@example.com'], ['Eve', 'eve3@example.com'], ['Eve', 'eve4@example.com'], ['Eve', 'eve5@example.com'], ['Eve', 'eve6@example.com'], ['Eve', 'eve7@example.com'], ['Eve', 'eve8@example.com'], ['Eve', 'eve9@example.com'], ['Eve'... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 strings s1 and s2, return the minimum contiguous substring part 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 strings s1 and s2, return the minimum contiguous substring part of s1, so that s2 is a subsequence of the part.
I... | [
"assert candidate(s1='abcdabcdabcdabcdabcdabcdabcdabcdabcd', s2='abdc') == 'abcdabc'",
"assert candidate(s1='aaaaaaabbbbbbcccccc', s2='abc') == 'abbbbbbc'",
"assert candidate(s1='abcdefghijklijkabc', s2='abc') == 'abc'",
"assert candidate(s1='onetwothreefourfivesixseveneightnineten', s2='onetwothree') == 'one... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s1='abcdabcdabcdabcdabcdabcdabcdabcdabcd', s2='abdc') == 'abcdabc'",
"assert candidate(s1='aaaaaaabbbbbbcccccc', s2='abc') == 'abbbbbbc'",
"assert candidate(s1='abcdefghijklijkabc', s2='abc') == 'abc'",
"assert candidate(s1='onetwothreefourfivesixseveneightnineten'... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 different non-empty palindromic sub... | You are an expert Python programmer. 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 different non-empty palindromic subsequences in s. Since the answer may be very ... | [
"assert candidate(s='abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc') == 320443980",
"assert candidate(s='abababababababababababab') == 1216",
"assert candidate(s='abcdabcdaabbccbddc') == 184",
"assert candidate(s='aabbaabbaabb') == 44",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc') == 320443980",
"assert candidate(s='abababababababababababab') == 1216",
"assert candidate(s='abcdabcdaabbccbddc') == 184",
"assert candidate(... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWe are given an array asteroids of integers representing asteroids in a ro... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
We are given an array asteroids of integers representing asteroids in a row. The indices of the asteriod in the array r... | [
"assert candidate(asteroids=[8, -2, 9, -3, 4, -1, 7, -5, 6, -4]) == [8, 9, 4, 7, 6]",
"assert candidate(asteroids=[1000, -1000]) == []",
"assert candidate(asteroids=[-1000, 1000]) == [-1000, 1000]",
"assert candidate(asteroids=[1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10]) == [-2, -3, -... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(asteroids=[8, -2, 9, -3, 4, -1, 7, -5, 6, -4]) == [8, 9, 4, 7, 6]",
"assert candidate(asteroids=[1000, -1000]) == []",
"assert candidate(asteroids=[-1000, 1000]) == [-1000, 1000]",
"assert candidate(asteroids=[1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWe can represent a sentence as an array of words, for example, the sentenc... | You are an expert Python programmer. 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 can represent a sentence as an array of words, for example, the sentence "I am happy with leetcode" can be represent... | [
"assert candidate(sentence1=['coding', 'is', 'fun'], sentence2=['programming', 'is', 'fun'], similarPairs=[['coding', 'programming'], ['coding', 'programming']]) == True",
"assert candidate(sentence1=['unique', 'set', 'of', 'words'], sentence2=['distinct', 'collection', 'of', 'terminology'], similarPairs=[['uniqu... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(sentence1=['coding', 'is', 'fun'], sentence2=['programming', 'is', 'fun'], similarPairs=[['coding', 'programming'], ['coding', 'programming']]) == True",
"assert candidate(sentence1=['unique', 'set', 'of', 'words'], sentence2=['distinct', 'collection', 'of', 'terminology']... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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. You want to maximize the number of po... | You are an expert Python programmer. 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. You want to maximize the number of points you get by performing the following oper... | [
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 169",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5530",
"assert candidate(nums=[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 60",
"assert candidate(n... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]) == 169",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]) == 5530",
"assert candidate(nums=[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 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:\nYou are given an n x n grid representing a field of cherries, each cell is... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an n x n grid representing a field of cherries, each cell is one of three possible integers.
0 means the... | [
"assert candidate(grid=[[1, 1, 0, 0, 0, 0], [1, -1, 1, 1, -1, 1], [0, 1, -1, 0, 1, 0], [0, 0, 1, 0, 0, 0], [0, -1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1]]) == 10",
"assert candidate(grid=[[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, -1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 16",
"assert candidate(grid=[[1, 0, 0, 0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 1, 0, 0, 0, 0], [1, -1, 1, 1, -1, 1], [0, 1, -1, 0, 1, 0], [0, 0, 1, 0, 0, 0], [0, -1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1]]) == 10",
"assert candidate(grid=[[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, -1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 16",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a network of n nodes, labeled from 1 to n. You are also give... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed e... | [
"assert candidate(times=[[1, 2, 4], [1, 3, 2], [2, 4, 7], [2, 5, 3], [3, 4, 5], [3, 5, 4], [4, 6, 2], [5, 6, 3]], n=6, k=1) == 9",
"assert candidate(times=[[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 11, 10], [11, 12, 11], [12, 13, 12], [13, 14, 13], [1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(times=[[1, 2, 4], [1, 3, 2], [2, 4, 7], [2, 5, 3], [3, 4, 5], [3, 5, 4], [4, 6, 2], [5, 6, 3]], n=6, k=1) == 9",
"assert candidate(times=[[1, 2, 1], [2, 3, 2], [3, 4, 3], [4, 5, 4], [5, 6, 5], [6, 7, 6], [7, 8, 7], [8, 9, 8], [9, 10, 9], [10, 11, 10], [11, 12, 11], [12, 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:\nA virus is spreading rapidly, and your task is to quarantine the infected ... | You are an expert Python programmer. 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 virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.
The world is modele... | [
"assert candidate(isInfected=[[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(isInfected=[[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [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 an m x n integer matrix grid where each entry is only 0 or 1, 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 an m x n integer matrix grid where each entry is only 0 or 1, return the number of corner rectangles.
A corner re... | [
"assert candidate(grid=[[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1]]) == 19",
"assert candidate(grid=[[1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0]]) == 5",
"assert candidate(grid=[[1,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1]]) == 19",
"assert candidate(grid=[[1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0]]) == 5",
"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:\nYou have a lock in front of you with 4 circular wheels. Each wheel has 10 ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7'... | [
"assert candidate(deadends=['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999', '0000'], target='1234') == -1",
"assert candidate(deadends=['0001', '0010', '0100', '1000', '0111', '1110', '1101', '1011', '2220', '2202', '2022', '0222'], target='0202') == 6",
"assert candidate(deadends=['0009... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(deadends=['1111', '2222', '3333', '4444', '5555', '6666', '7777', '8888', '9999', '0000'], target='1234') == -1",
"assert candidate(deadends=['0001', '0010', '0100', '1000', '0111', '1110', '1101', '1011', '2220', '2202', '2022', '0222'], target='0202') == 6",
"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:\nThere is a safe protected by a password. The password is a sequence of n d... | You are an expert Python programmer. 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 safe protected by a password. The password is a sequence of n digits where each digit can be in the range [0... | [
"assert candidate(n=1, k=3) == '210'",
"assert candidate(n=1, k=4) == '3210'",
"assert candidate(n=3, k=2) == '0011101000'",
"assert candidate(n=4, k=4) == '000333323233223222233312331323122313133212321322122213121213311231132112211311121111333023301330323022301230313021301130303320232013203220222012203120212... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=1, k=3) == '210'",
"assert candidate(n=1, k=4) == '3210'",
"assert candidate(n=3, k=2) == '0011101000'",
"assert candidate(n=4, k=4) == '000333323233223222233312331323122313133212321322122213121213311231132112211311121111333023301330323022301230313021301130303320... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 standing at position 0 on an infinite number line. There is a dest... | You are an expert Python programmer. 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 standing at position 0 on an infinite number line. There is a destination at position target.
You can make some... | [
"assert candidate(target=500000001) == 31625",
"assert candidate(target=-987654) == 1407",
"assert candidate(target=-999999999) == 44721",
"assert candidate(target=12345) == 157",
"assert candidate(target=500000) == 1000",
"assert candidate(target=5000) == 100",
"assert candidate(target=3) == 2",
"ass... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(target=500000001) == 31625",
"assert candidate(target=-987654) == 1407",
"assert candidate(target=-999999999) == 44721",
"assert candidate(target=12345) == 157",
"assert candidate(target=500000) == 1000",
"assert candidate(target=5000) == 100",
"assert ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an elevation map represents as an integer array heights wher... | You are an expert Python programmer. 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 elevation map represents as an integer array heights where heights[i] representing the height of the t... | [
"assert candidate(heights=[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], volume=40, k=7) == [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5]",
"assert candidate(heights=[1, 1, 1, 1, 1, 1, 1], volume=7, k=3) == [2, 2, 2, 2, 2, 2, 2]",
"assert candidate(heights=[4, 2, 1, 3, 2, 1, 2, 3, 4, 3, 2, 1], volume=20, k=6) =... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(heights=[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], volume=40, k=7) == [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5]",
"assert candidate(heights=[1, 1, 1, 1, 1, 1, 1], volume=7, k=3) == [2, 2, 2, 2, 2, 2, 2]",
"assert candidate(heights=[4, 2, 1, 3, 2, 1, 2, 3, 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:\nYou are stacking blocks to form a pyramid. Each block has a color, which 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 stacking blocks to form a pyramid. Each block has a color, which is represented by a single letter. Each row of... | [
"assert candidate(bottom='AAAAAA', allowed=['AAA', 'AAB', 'ABA', 'ABB', 'BAA', 'BAB', 'BBA', 'BBB', 'AAC', 'ACA', 'ACC', 'BAC', 'BCA', 'BCB', 'BBC', 'BCC', 'CCC', 'CCA', 'CCC', 'BCC', 'CCC', 'CCC']) == True",
"assert candidate(bottom='ABC', allowed=['ABD', 'BCE', 'DEF', 'FFF', 'GHI']) == True",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(bottom='AAAAAA', allowed=['AAA', 'AAB', 'ABA', 'ABB', 'BAA', 'BAB', 'BBA', 'BBB', 'AAC', 'ACA', 'ACC', 'BAC', 'BCA', 'BCB', 'BBC', 'BCC', 'CCC', 'CCA', 'CCC', 'BCC', 'CCC', 'CCC']) == True",
"assert candidate(bottom='ABC', allowed=['ABD', 'BCE', 'DEF', 'FFF', 'GHI']) == Tr... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 2D integer array intervals where intervals[i] = [starti, 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:
You are given a 2D integer array intervals where intervals[i] = [starti, endi] represents all the integers from starti ... | [
"assert candidate(intervals=[[1, 3], [3, 6], [6, 9], [9, 12], [12, 15]]) == 6",
"assert candidate(intervals=[[1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2]]) == 2",
"assert candidate(intervals=[[1, 50], [2, 49], [3, 48], [4, 47], [5, 46], [6, 45], [7, 44], [8, 43], [9, 42], [10, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(intervals=[[1, 3], [3, 6], [6, 9], [9, 12], [12, 15]]) == 6",
"assert candidate(intervals=[[1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2]]) == 2",
"assert candidate(intervals=[[1, 50], [2, 49], [3, 48], [4, 47], [5, 46], [6, 45], [7, 44]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 keywords words and a string s, make all appearances of a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of keywords words and a string s, make all appearances of all keywords words[i] in s bold. Any letters b... | [
"assert candidate(words=['aaa', 'aa', 'a'], s='aaaaaaaaa') == '<b>aaaaaaaaa</b>'",
"assert candidate(words=['cat', 'dog'], s='the cat and the dog went to the market') == 'the <b>cat</b> and the <b>dog</b> went to the market'",
"assert candidate(words=['short', 'shorter', 'shortest'], s='shortshortershortest') =... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['aaa', 'aa', 'a'], s='aaaaaaaaa') == '<b>aaaaaaaaa</b>'",
"assert candidate(words=['cat', 'dog'], s='the cat and the dog went to the market') == 'the <b>cat</b> and the <b>dog</b> went to the market'",
"assert candidate(words=['short', 'shorter', 'shortest'], s=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nSpecial binary strings are binary strings with the following two propertie... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Special binary strings are binary strings with the following two properties:
The number of 0's is equal to the number ... | [
"assert candidate(s='1110101001010100') == '1110101001010100'",
"assert candidate(s='111001110000') == '111100011000'",
"assert candidate(s='1100') == '1100'",
"assert candidate(s='11111000001010') == '11111000001010'",
"assert candidate(s='11001111110000111100001100') == '1100'",
"assert candidate(s='111... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='1110101001010100') == '1110101001010100'",
"assert candidate(s='111001110000') == '111100011000'",
"assert candidate(s='1100') == '1100'",
"assert candidate(s='11111000001010') == '11111000001010'",
"assert candidate(s='11001111110000111100001100') == '1100'... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s. We want to partition the string into as many par... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in... | [
"assert candidate(s='abababab') == [8]",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz') == [52]",
"assert candidate(s='abcdcba') == [7]",
"assert candidate(s='abcdefghihgfedcba') == [17]",
"assert candidate(s='mnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba') ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abababab') == [8]",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz') == [52]",
"assert candidate(s='abcdcba') == [7]",
"assert candidate(s='abcdefghihgfedcba') == [17]",
"assert candidate(s='mnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 couples sitting in 2n seats arranged in a row and want to hold... | You are an expert Python programmer. 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 couples sitting in 2n seats arranged in a row and want to hold hands.
The people and seats are represented ... | [
"assert candidate(row=[0, 1, 4, 5, 2, 3, 6, 7, 10, 11, 8, 9, 12, 13, 14, 15]) == 0",
"assert candidate(row=[3, 2, 0, 1]) == 0",
"assert candidate(row=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11]) == 7",
"assert candidate(row=[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 1, 3, 5, 7, 9, 11, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(row=[0, 1, 4, 5, 2, 3, 6, 7, 10, 11, 8, 9, 12, 13, 14, 15]) == 0",
"assert candidate(row=[3, 2, 0, 1]) == 0",
"assert candidate(row=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11]) == 7",
"assert candidate(row=[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array arr.\nWe split arr into some number of chun... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array arr.
We split arr into some number of chunks (i.e., partitions), and individually sort e... | [
"assert candidate(arr=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10",
"assert candidate(arr=[3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10]) == 4",
"assert candidate(arr=[1, 5, 3, 4, 2, 6, 8, 7, 9, 10]) == 6",
"assert candidate(arr=[1, 1, 0, 0, 1]) == 2",
"assert candidate(arr=[5, 2, 6, 3, 7, 4, 8, 1, 9, 0, 11, 12, 13, 14,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == 10",
"assert candidate(arr=[3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10]) == 4",
"assert candidate(arr=[1, 5, 3, 4, 2, 6, 8, 7, 9, 10]) == 6",
"assert candidate(arr=[1, 1, 0, 0, 1]) == 2",
"assert candidate(arr=[5, 2, 6, 3, 7, 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 expression such as expression = \"e + 8 - a + 5\" and an evaluati... | You are an expert Python programmer. 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 expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of eval... | [
"assert candidate(expression='100 * ( 2 + 12 )', evalvars=[], evalints=[]) == ['1400']",
"assert candidate(expression='(a + b + c) * (d + e + f) * (g + h + i)', evalvars=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], evalints=[1, -1, 2, -2, 3, -3, 4, -4, 5]) == ['-20']",
"assert candidate(expression='(a + b) * ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(expression='100 * ( 2 + 12 )', evalvars=[], evalints=[]) == ['1400']",
"assert candidate(expression='(a + b + c) * (d + e + f) * (g + h + i)', evalvars=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], evalints=[1, -1, 2, -2, 3, -3, 4, -4, 5]) == ['-20']",
"assert candida... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nImplement a basic calculator to evaluate a simple expression string.\nThe ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Implement a basic calculator to evaluate a simple expression string.
The expression string contains only non-negative i... | [
"assert candidate(s='(9 - (4 + 3) * 2) / 5 + 1') == 0",
"assert candidate(s='((2+3)*4)/5') == 4",
"assert candidate(s='1 - (3 + (5 - 2))') == -5",
"assert candidate(s='10+20/((5+5)*2)+10-(3+2)*2+5') == 16",
"assert candidate(s='((1+2)*3-4/(2+3)*5)+6*(7-8/2)+9') == 36",
"assert candidate(s='3*2+2*(1+5*10-2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='(9 - (4 + 3) * 2) / 5 + 1') == 0",
"assert candidate(s='((2+3)*4)/5') == 4",
"assert candidate(s='1 - (3 + (5 - 2))') == -5",
"assert candidate(s='10+20/((5+5)*2)+10-(3+2)*2+5') == 16",
"assert candidate(s='((1+2)*3-4/(2+3)*5)+6*(7-8/2)+9') == 36",
"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:\nOn an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of c... | [
"assert candidate(board=[[5, 4, 3], [2, 1, 0]]) == 14",
"assert candidate(board=[[2, 5, 3], [1, 4, 0]]) == -1",
"assert candidate(board=[[3, 2, 0], [1, 5, 4]]) == 13",
"assert candidate(board=[[2, 1, 3], [4, 5, 0]]) == -1",
"assert candidate(board=[[4, 3, 1], [5, 0, 2]]) == 9",
"assert candidate(board=[[1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(board=[[5, 4, 3], [2, 1, 0]]) == 14",
"assert candidate(board=[[2, 5, 3], [1, 4, 0]]) == -1",
"assert candidate(board=[[3, 2, 0], [1, 5, 4]]) == 13",
"assert candidate(board=[[2, 1, 3], [4, 5, 0]]) == -1",
"assert candidate(board=[[4, 3, 1], [5, 0, 2]]) == 9",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an n x n integer matrix grid where each value grid[i][j] rep... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j).
T... | [
"assert candidate(grid=[[4, 0, 7, 6, 5], [3, 9, 8, 1, 2], [16, 15, 14, 13, 10], [11, 12, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24",
"assert candidate(grid=[[7, 1, 4, 0, 5], [2, 3, 6, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24",
"assert candidate(grid=[[3, 17, 12, 4, 16], [1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[4, 0, 7, 6, 5], [3, 9, 8, 1, 2], [16, 15, 14, 13, 10], [11, 12, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24",
"assert candidate(grid=[[7, 1, 4, 0, 5], [2, 3, 6, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24",
"assert candidate(gri... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 build a table of n rows (1-indexed). We start by writing 0 in the 1st r... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
We build a table of n rows (1-indexed). We start by writing 0 in the 1st row. Now in every subsequent row, we look at t... | [
"assert candidate(n=5, k=19) == 0",
"assert candidate(n=30, k=1073741824) == 1",
"assert candidate(n=25, k=33554431) == 0",
"assert candidate(n=23, k=8388607) == 0",
"assert candidate(n=8, k=255) == 1",
"assert candidate(n=5, k=16) == 0",
"assert candidate(n=5, k=17) == 0",
"assert candidate(n=15, k=1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=5, k=19) == 0",
"assert candidate(n=30, k=1073741824) == 1",
"assert candidate(n=25, k=33554431) == 0",
"assert candidate(n=23, k=8388607) == 0",
"assert candidate(n=8, k=255) == 1",
"assert candidate(n=5, k=16) == 0",
"assert candidate(n=5, 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 four integers sx, sy, tx, and ty, return true if it is possible to c... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, t... | [
"assert candidate(sx=1, sy=1, tx=1000000000, ty=1) == True",
"assert candidate(sx=21, sy=34, tx=55, ty=89) == True",
"assert candidate(sx=1, sy=10, tx=100, ty=91) == False",
"assert candidate(sx=7, sy=9, tx=161, ty=208) == False",
"assert candidate(sx=2, sy=3, tx=10, ty=15) == False",
"assert candidate(sx... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(sx=1, sy=1, tx=1000000000, ty=1) == True",
"assert candidate(sx=21, sy=34, tx=55, ty=89) == True",
"assert candidate(sx=1, sy=10, tx=100, ty=91) == False",
"assert candidate(sx=7, sy=9, tx=161, ty=208) == False",
"assert candidate(sx=2, sy=3, tx=10, ty=15) == F... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 forest with an unknown number of rabbits. We asked n rabbits \"... | You are an expert Python programmer. 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 forest with an unknown number of rabbits. We asked n rabbits "How many rabbits have the same color as you?" ... | [
"assert candidate(answers=[0, 0, 1, 1, 1]) == 6",
"assert candidate(answers=[4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 10",
"assert candidate(answers=[1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == 37",
"assert candidate(answers=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(answers=[0, 0, 1, 1, 1]) == 6",
"assert candidate(answers=[4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) == 10",
"assert candidate(answers=[1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7]) == 37",
"assert candidate(answers=[1, 1, 1, 1,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an n x n binary grid board. In each move, you can swap any 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 n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns w... | [
"assert candidate(board=[[0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == 2",
"assert candidate(board=[[1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1]]) == 5",
"assert candidate(board=[[0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(board=[[0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == 2",
"assert candidate(board=[[1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1]]) == 5",
"ass... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, you can transform every letter individually to be lowerc... | You are an expert Python programmer. 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, you can transform every letter individually to be lowercase or uppercase to create another string.
Re... | [
"assert candidate(s='123') == ['123']",
"assert candidate(s='A1bC2dE3') == ['A1bC2dE3', 'A1bC2de3', 'A1bC2De3', 'A1bC2DE3', 'A1bc2DE3', 'A1bc2De3', 'A1bc2de3', 'A1bc2dE3', 'A1Bc2dE3', 'A1Bc2de3', 'A1Bc2De3', 'A1Bc2DE3', 'A1BC2DE3', 'A1BC2De3', 'A1BC2de3', 'A1BC2dE3', 'a1BC2dE3', 'a1BC2de3', 'a1BC2De3', 'a1BC2DE3'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='123') == ['123']",
"assert candidate(s='A1bC2dE3') == ['A1bC2dE3', 'A1bC2de3', 'A1bC2De3', 'A1bC2DE3', 'A1bc2DE3', 'A1bc2De3', 'A1bc2de3', 'A1bc2dE3', 'A1Bc2dE3', 'A1Bc2de3', 'A1Bc2De3', 'A1Bc2DE3', 'A1BC2DE3', 'A1BC2De3', 'A1BC2de3', 'A1BC2dE3', 'a1BC2dE3', 'a1BC2de3',... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is an undirected graph with n nodes, where each node is numbered bet... | You are an expert Python programmer. 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 undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array gr... | [
"assert candidate(graph=[[1, 2], [0], [0], [4], [3], [6, 7, 8], [5], [5, 8], [5, 7], [10, 11, 12], [9], [9], [9], [14], [13]]) == False",
"assert candidate(graph=[[1, 3, 4, 6], [0, 2, 5, 7], [1, 3, 5, 8], [0, 2, 6, 9], [0, 7, 8, 9], [1, 2, 6, 7, 8, 9], [0, 1, 3, 5, 7, 8, 9], [1, 4, 5, 6, 8, 9], [2, 4, 5, 6, 7, 9]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(graph=[[1, 2], [0], [0], [4], [3], [6, 7, 8], [5], [5, 8], [5, 7], [10, 11, 12], [9], [9], [9], [14], [13]]) == False",
"assert candidate(graph=[[1, 3, 4, 6], [0, 2, 5, 7], [1, 3, 5, 8], [0, 2, 6, 9], [0, 7, 8, 9], [1, 2, 6, 7, 8, 9], [0, 1, 3, 5, 7, 8, 9], [1, 4, 5, 6, 8,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a sorted integer array arr containing 1 and prime numbers, w... | You are an expert Python programmer. 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 integer array arr containing 1 and prime numbers, where all the integers of arr are unique. You ... | [
"assert candidate(arr=[1, 5, 13, 29, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 35... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[1, 5, 13, 29, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 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 connected by some number of flights. You are given an 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 cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, ... | [
"assert candidate(n=10, flights=[[0, 1, 50], [1, 2, 30], [2, 3, 20], [3, 4, 10], [4, 5, 15], [5, 6, 25], [6, 7, 10], [7, 8, 5], [8, 9, 10]], src=0, dst=9, k=3) == -1",
"assert candidate(n=8, flights=[[0, 1, 10], [0, 2, 20], [1, 2, 5], [1, 3, 30], [2, 3, 25], [3, 4, 50], [4, 5, 20], [5, 6, 10], [6, 7, 15]], src=0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=10, flights=[[0, 1, 50], [1, 2, 30], [2, 3, 20], [3, 4, 10], [4, 5, 15], [5, 6, 25], [6, 7, 10], [7, 8, 5], [8, 9, 10]], src=0, dst=9, k=3) == -1",
"assert candidate(n=8, flights=[[0, 1, 10], [0, 2, 20], [1, 2, 5], [1, 3, 30], [2, 3, 25], [3, 4, 50], [4, 5, 20], [5, 6, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nAn integer x is a good if after rotating each digit individually by 180 de... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
An integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is differen... | [
"assert candidate(n=8080) == 1690",
"assert candidate(n=3500) == 975",
"assert candidate(n=2) == 1",
"assert candidate(n=2500) == 780",
"assert candidate(n=500) == 130",
"assert candidate(n=1111) == 360",
"assert candidate(n=8765) == 1888",
"assert candidate(n=7654) == 1661",
"assert candidate(n=666... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=8080) == 1690",
"assert candidate(n=3500) == 975",
"assert candidate(n=2) == 1",
"assert candidate(n=2500) == 780",
"assert candidate(n=500) == 130",
"assert candidate(n=1111) == 360",
"assert candidate(n=8765) == 1888",
"assert candidate(n=7654) ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 two types of tiles: a 2 x 1 domino shape and a tromino shape. You... | You are an expert Python programmer. 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 two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes.
Given an integer n... | [
"assert candidate(n=600) == 771568221",
"assert candidate(n=500) == 603582422",
"assert candidate(n=1) == 1",
"assert candidate(n=4) == 11",
"assert candidate(n=750) == 533845494",
"assert candidate(n=5) == 24",
"assert candidate(n=3) == 5",
"assert candidate(n=6) == 53",
"assert candidate(n=200) ==... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=600) == 771568221",
"assert candidate(n=500) == 603582422",
"assert candidate(n=1) == 1",
"assert candidate(n=4) == 11",
"assert candidate(n=750) == 533845494",
"assert candidate(n=5) == 24",
"assert candidate(n=3) == 5",
"assert candidate(n=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:\nYou are given two strings order and s. All the characters of order are 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:
You are given two strings order and s. All the characters of order are unique and were sorted in some custom order prev... | [
"assert candidate(order='qaz', s='abcdefghijklmnopqrstuvwxyz') == 'bcdefghijklmnopqrstuvwxyaz'",
"assert candidate(order='abcdef', s='fedcbafghijklmnopqrstuvwxyz') == 'aghijklmnopqrstuvwxyzbcdeff'",
"assert candidate(order='xyzabc', s='fedcba') == 'fedabc'",
"assert candidate(order='abcd', s='dbcaabcd') == 'a... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(order='qaz', s='abcdefghijklmnopqrstuvwxyz') == 'bcdefghijklmnopqrstuvwxyaz'",
"assert candidate(order='abcdef', s='fedcbafghijklmnopqrstuvwxyz') == 'aghijklmnopqrstuvwxyzbcdeff'",
"assert candidate(order='xyzabc', s='fedcba') == 'fedabc'",
"assert candidate(order=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 f(x) be the number of zeroes at the end of x!. Recall that x! = 1 * 2 ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Let f(x) be the number of zeroes at the end of x!. Recall that x! = 1 * 2 * 3 * ... * x and by convention, 0! = 1.
For... | [
"assert candidate(k=123456) == 5",
"assert candidate(k=249) == 5",
"assert candidate(k=1) == 5",
"assert candidate(k=999999999) == 5",
"assert candidate(k=50000001) == 5",
"assert candidate(k=3) == 5",
"assert candidate(k=750000) == 5",
"assert candidate(k=4) == 5",
"assert candidate(k=1000030) == 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(k=123456) == 5",
"assert candidate(k=249) == 5",
"assert candidate(k=1) == 5",
"assert candidate(k=999999999) == 5",
"assert candidate(k=50000001) == 5",
"assert candidate(k=3) == 5",
"assert candidate(k=750000) == 5",
"assert candidate(k=4) == 5",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums and two integers left and right, return the nu... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums and two integers left and right, return the number of contiguous non-empty subarrays such t... | [
"assert candidate(nums=[2, 1, 4, 3], left=2, right=3) == 3",
"assert candidate(nums=[1000000000, 999999999, 1000000000, 999999999, 1000000000], left=500000000, right=1500000000) == 15",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13], left=4, right=10) == 12",
"assert candidate(nums=[8, 7, 6, 5, 4, 3, 2, 1], l... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 1, 4, 3], left=2, right=3) == 3",
"assert candidate(nums=[1000000000, 999999999, 1000000000, 999999999, 1000000000], left=500000000, right=1500000000) == 15",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13], left=4, right=10) == 12",
"assert candidate(nums=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, f... | You are an expert Python programmer. 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 directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n ... | [
"assert candidate(graph=[[1, 3], [2], [3], []]) == [[0, 3], [0, 1, 2, 3]]",
"assert candidate(graph=[[1], [2, 3, 4], [3, 4], [4], []]) == [[0, 1, 4], [0, 1, 2, 4], [0, 1, 3, 4], [0, 1, 2, 3, 4]]",
"assert candidate(graph=[[1, 2, 3], [4, 5], [4, 5], [5], [], [], []]) == []",
"assert candidate(graph=[[1, 2, 3],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(graph=[[1, 3], [2], [3], []]) == [[0, 3], [0, 1, 2, 3]]",
"assert candidate(graph=[[1], [2, 3, 4], [3, 4], [4], []]) == [[0, 1, 4], [0, 1, 2, 4], [0, 1, 3, 4], [0, 1, 2, 3, 4]]",
"assert candidate(graph=[[1, 2, 3], [4, 5], [4, 5], [5], [], [], []]) == []",
"assert ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array nums. You can rotate it by a non-negative integer k... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array nums. You can rotate it by a non-negative integer k so that the array becomes [nums[k], nums[k +... | [
"assert candidate(nums=[4, 3, 2, 1, 0]) == 0",
"assert candidate(nums=[3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0",
"assert candidate(nums=[0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9]) == 0",
"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, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[4, 3, 2, 1, 0]) == 0",
"assert candidate(nums=[3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 0",
"assert candidate(nums=[0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9]) == 0",
"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, 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 two integer arrays of the same length nums1 and nums2. In on... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two integer arrays of the same length nums1 and nums2. In one operation, you are allowed to swap nums1[i]... | [
"assert candidate(nums1=[5, 10, 15, 20, 25, 30, 35, 40], nums2=[6, 11, 14, 21, 24, 29, 36, 41]) == 0",
"assert candidate(nums1=[3, 2, 1], nums2=[6, 5, 4]) == 1",
"assert candidate(nums1=[0, 2, 2, 3, 5, 6, 8, 9, 11], nums2=[1, 1, 3, 4, 4, 7, 7, 10, 12]) == 3",
"assert candidate(nums1=[9, 8, 7, 6, 5, 4], nums2=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[5, 10, 15, 20, 25, 30, 35, 40], nums2=[6, 11, 14, 21, 24, 29, 36, 41]) == 0",
"assert candidate(nums1=[3, 2, 1], nums2=[6, 5, 4]) == 1",
"assert candidate(nums1=[0, 2, 2, 3, 5, 6, 8, 9, 11], nums2=[1, 1, 3, 4, 4, 7, 7, 10, 12]) == 3",
"assert candidate(nums1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an m x n binary grid, where each 1 represents a brick and 0 ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an m x n binary grid, where each 1 represents a brick and 0 represents an empty space. A brick is stable ... | [
"assert candidate(grid=[[1, 0, 1, 1, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]], hits=[[0, 1], [1, 2], [3, 3], [4, 4]]) == [0, 0, 0, 0]",
"assert candidate(grid=[[1], [1], [1], [1], [1]], hits=[[2, 0], [3, 0]]) == [2, 0]",
"assert candidate(grid=[[1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 0, 1, 1, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1]], hits=[[0, 1], [1, 2], [3, 3], [4, 4]]) == [0, 0, 0, 0]",
"assert candidate(grid=[[1], [1], [1], [1], [1]], hits=[[2, 0], [3, 0]]) == [2, 0]",
"assert candidate(grid=[[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:\nYou are given an integer array nums.\nYou should move each element of nums... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums.
You should move each element of nums into one of the two arrays A and B such that ... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8]) == True",
"assert candidate(nums=[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040]) == False",
"assert candidate(nums=[2, 2, 2, 2]) == True",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8]) == True",
"assert candidate(nums=[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040]) == False",
"assert candidate(nums=[2, 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:\nThere is a city composed of n x n blocks, where each block contains a sing... | You are an expert Python programmer. 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 city composed of n x n blocks, where each block contains a single building shaped like a vertical square pri... | [
"assert candidate(grid=[[9, 9, 9, 9], [9, 0, 0, 9], [9, 0, 0, 9], [9, 9, 9, 9]]) == 36",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0], [0, 100, 0, 0, 0, 0, 0], [0, 0, 100, 0, 0, 0, 0], [0, 0, 0, 100, 0, 0, 0], [0, 0, 0, 0, 100, 0, 0], [0, 0, 0, 0, 0, 100, 0], [0, 0, 0, 0, 0, 0, 100]]) == 3000",
"assert candida... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[9, 9, 9, 9], [9, 0, 0, 9], [9, 0, 0, 9], [9, 9, 9, 9]]) == 36",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0], [0, 100, 0, 0, 0, 0, 0], [0, 0, 100, 0, 0, 0, 0], [0, 0, 0, 100, 0, 0, 0], [0, 0, 0, 0, 100, 0, 0], [0, 0, 0, 0, 0, 100, 0], [0, 0, 0, 0, 0, 0, 100]]) == 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 two types of soup: type A and type B. Initially, we have n ml 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:
There are two types of soup: type A and type B. Initially, we have n ml of each type of soup. There are four kinds of o... | [
"assert candidate(n=999999999) == 1",
"assert candidate(n=123456789) == 1",
"assert candidate(n=3333) == 0.9998851608898072",
"assert candidate(n=375) == 0.88482666015625",
"assert candidate(n=875000000) == 1",
"assert candidate(n=500) == 0.916344165802002",
"assert candidate(n=250) == 0.82763671875",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=999999999) == 1",
"assert candidate(n=123456789) == 1",
"assert candidate(n=3333) == 0.9998851608898072",
"assert candidate(n=375) == 0.88482666015625",
"assert candidate(n=875000000) == 1",
"assert candidate(n=500) == 0.916344165802002",
"assert cand... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nSometimes people repeat letters to represent extra feeling. For example:\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:
Sometimes people repeat letters to represent extra feeling. For example:
"hello" -> "heeellooo"
"hi" -> "hiiii"
In th... | [
"assert candidate(s='nnnnooouuuuuuuuu', words=['no', 'noon', 'nou', 'noou', 'noonnouuuu', 'nnoooouuuuuuuu', 'nnooouuuuuuuuu', 'nnnooouuuuuuuuu']) == 4",
"assert candidate(s='ppppqqqqrrrssss', words=['pqr', 'ppqqrrsss', 'pppqqqrrrrssss', 'ppqqrrsssss', 'ppqqrrr']) == 1",
"assert candidate(s='aabbcc', words=['aab... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='nnnnooouuuuuuuuu', words=['no', 'noon', 'nou', 'noou', 'noonnouuuu', 'nnoooouuuuuuuu', 'nnooouuuuuuuuu', 'nnnooouuuuuuuuu']) == 4",
"assert candidate(s='ppppqqqqrrrssss', words=['pqr', 'ppqqrrsss', 'pppqqqrrrrssss', 'ppqqrrsssss', 'ppqqrrr']) == 1",
"assert candidat... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of integers nums represents the numbers written on ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of integers nums represents the numbers written on a chalkboard.
Alice and Bob take turns erasin... | [
"assert candidate(nums=[1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == False",
"assert candidate(nums=[1, 1, 1, 1, 1]) == False",
"assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == True",
"assert candidate(nums=[16, 16, 16,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == False",
"assert candidate(nums=[1, 1, 1, 1, 1]) == False",
"assert candidate(nums=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]) == True",
"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:\nA website domain \"discuss.leetcode.com\" consists of various subdomains. ... | You are an expert Python programmer. 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 website domain "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next le... | [
"assert candidate(cpdomains=['1234 a.b.c.d.e.f.com', '5678 g.h.i.j.k.com', '9101 l.m.n.o.p.q.r.com', '1112 m.n.o.p.q.r.com', '1314 n.o.p.q.r.com']) == ['1234 a.b.c.d.e.f.com', '1234 b.c.d.e.f.com', '1234 c.d.e.f.com', '1234 d.e.f.com', '1234 e.f.com', '1234 f.com', '18439 com', '5678 g.h.i.j.k.com', '5678 h.i.j.k.c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(cpdomains=['1234 a.b.c.d.e.f.com', '5678 g.h.i.j.k.com', '9101 l.m.n.o.p.q.r.com', '1112 m.n.o.p.q.r.com', '1314 n.o.p.q.r.com']) == ['1234 a.b.c.d.e.f.com', '1234 b.c.d.e.f.com', '1234 c.d.e.f.com', '1234 d.e.f.com', '1234 e.f.com', '1234 f.com', '18439 com', '5678 g.h.i.j.k.... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums and an integer k. You can partition th... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums and an integer k. You can partition the array into at most k non-empty adjacent sub... | [
"assert candidate(nums=[4, 5, 6, 7, 8, 9, 10, 11, 12, 13], k=3) == 32.5",
"assert candidate(nums=[100, 10, 1, 10, 100, 100, 1, 10, 100, 100, 1, 10, 100], k=5) == 370.14285714285717",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=10) == 55.0",
"assert candidate(nums=[9, 7, 5, 3, 1, 2, 4, 6, 8, 10],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[4, 5, 6, 7, 8, 9, 10, 11, 12, 13], k=3) == 32.5",
"assert candidate(nums=[100, 10, 1, 10, 100, 100, 1, 10, 100, 100, 1, 10, 100], k=5) == 370.14285714285717",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=10) == 55.0",
"assert candidate(nums=[9, 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 array routes representing bus routes where routes[i] is a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever.
... | [
"assert candidate(routes=[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [5, 10, 15, 20], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]], source=1, target=20) == 2",
"assert candidate(routes=[[1, 10, 15, 20], [2, 10, 12], [10, 15, 25], [5, 15, 30], [1, 5]], source=1, target=25) == 2",
"assert candidate(routes=[[10, 11, 12, 13... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(routes=[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [5, 10, 15, 20], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]], source=1, target=20) == 2",
"assert candidate(routes=[[1, 10, 15, 20], [2, 10, 12], [10, 15, 25], [5, 15, 30], [1, 5]], source=1, target=25) == 2",
"assert candidat... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given the head of a linked list containing unique integer values 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 the head of a linked list containing unique integer values and an integer array nums that is a subset of ... | [
"assert candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), nums=[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20]) == 7",
"assert candidate(head=list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), nums=[1, 2, 4, 6, 8, 10]) == 5",
"assert candidate(head=list_node([5, 6, 2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), nums=[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20]) == 7",
"assert candidate(head=list_node([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), nums=[1, 2, 4, 6, 8, 10]) == 5",
"assert candidat... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nA valid encoding of an array of words is any reference string s and array ... | You are an expert Python programmer. 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 valid encoding of an array of words is any reference string s and array of indices indices such that:
words.length =... | [
"assert candidate(words=['a', 'ab', 'abc', 'abcd', 'abcde']) == 20",
"assert candidate(words=['aaaaaa', 'aaaaa', 'aaaa', 'aaa', 'aa', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa']) == 7",
"assert candidate(words=['xyz', 'zyx', 'yzx', 'yxz', 'zxy', 'xzy', 'zy', 'yx', 'xz', 'zx', 'xy']) == 24",
"assert candidate... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['a', 'ab', 'abc', 'abcd', 'abcde']) == 20",
"assert candidate(words=['aaaaaa', 'aaaaa', 'aaaa', 'aaa', 'aa', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa']) == 7",
"assert candidate(words=['xyz', 'zyx', 'yzx', 'yxz', 'zxy', 'xzy', 'zy', 'yx', 'xz', 'zx', 'xy']) ==... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 0-indexed integer arrays fronts and backs of length n, w... | You are an expert Python programmer. 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 0-indexed integer arrays fronts and backs of length n, where the ith card has the positive integer fr... | [
"assert candidate(fronts=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4], backs=[4, 3, 3, 2, 2, 2, 1, 1, 1, 1]) == 1",
"assert candidate(fronts=[500, 500, 500, 500, 500], backs=[500, 501, 502, 503, 504]) == 501",
"assert candidate(fronts=[1000, 2000], backs=[2000, 1000]) == 1000",
"assert candidate(fronts=[1, 1, 1, 2, 2, 3], ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(fronts=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4], backs=[4, 3, 3, 2, 2, 2, 1, 1, 1, 1]) == 1",
"assert candidate(fronts=[500, 500, 500, 500, 500], backs=[500, 501, 502, 503, 504]) == 501",
"assert candidate(fronts=[1000, 2000], backs=[2000, 1000]) == 1000",
"assert candidate(... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of unique integers, arr, where each integer arr[i] is stric... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1.
We make a binary tree usi... | [
"assert candidate(arr=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1500, 1600, 1800, 2000, 2100, 2400, 2500, 2700, 2800, 3000, 3100, 3500, 4000, 4200, 4500, 5000, 5200, 5400, 6000, 6300, 6500, 7000, 7500, 8000, 8400, 9000, 9100, 9500, 10000]) == 42",
"assert candidate(arr=[100, 200, 300, 400, 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1500, 1600, 1800, 2000, 2100, 2400, 2500, 2700, 2800, 3000, 3100, 3500, 4000, 4200, 4500, 5000, 5200, 5400, 6000, 6300, 6500, 7000, 7500, 8000, 8400, 9000, 9100, 9500, 10000]) == 42",
"assert candidate(arr... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 persons on a social media website. You are given an integer ar... | You are an expert Python programmer. 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 persons on a social media website. You are given an integer array ages where ages[i] is the age of the ith ... | [
"assert candidate(ages=[16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 56",
"assert candidate(ages=[16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]) == 326",
"assert candidate(ages=[50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 6... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(ages=[16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 56",
"assert candidate(ages=[16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]) == 326",
"assert candidate(ages=[50, 51, 52, 53, 54, 55, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 jobs and m workers. You are given three arrays: difficulty, pro... | You are an expert Python programmer. 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 jobs and m workers. You are given three arrays: difficulty, profit, and worker where:
difficulty[i] and pro... | [
"assert candidate(difficulty=[100], profit=[100], worker=[100]) == 100",
"assert candidate(difficulty=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], profit=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], worker=[20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 100",
"assert candidate(difficulty=[5, 2, 1, 8, 3, 7, 4, 6, 9, 10], profit=[50, 2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(difficulty=[100], profit=[100], worker=[100]) == 100",
"assert candidate(difficulty=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], profit=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], worker=[20, 18, 16, 14, 12, 10, 8, 6, 4, 2]) == 100",
"assert candidate(difficulty=[5, 2, 1, 8, 3, 7, 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 n x n binary matrix grid. You are allowed to change at mo... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an n x n binary matrix grid. You are allowed to change at most one 0 to be 1.
Return the size of the larg... | [
"assert candidate(grid=[[1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1]]) == 14",
"assert candidate(grid=[[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], [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, 0]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1]]) == 14",
"assert candidate(grid=[[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], [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:\nLet's define a function countUniqueChars(s) that returns 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:
Let's define a function countUniqueChars(s) that returns the number of unique characters in s.
For example, calling co... | [
"assert candidate(s='ZABZACZADBZADCZADEZAEFZAFGZAFHZAGIZAHJZAKZALZAMZANZAOZAPZAQZARZASZATAUAVAWAXAYAZ') == 22977",
"assert candidate(s='AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYZZ') == 1422",
"assert candidate(s='REALLYLONGSTRINGWITHVARYINGCHARACTERFREQUENCIES') == 6279",
"assert candidate(s='DATASTRU... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='ZABZACZADBZADCZADEZAEFZAFGZAFHZAGIZAHJZAKZALZAMZANZAOZAPZAQZARZASZATAUAVAWAXAYAZ') == 22977",
"assert candidate(s='AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYZZ') == 1422",
"assert candidate(s='REALLYLONGSTRINGWITHVARYINGCHARACTERFREQUENCIES') == 6279",
"a... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer n, return the number of ways you can write n as the sum o... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer n, return the number of ways you can write n as the sum of consecutive positive integers.
Constraint... | [
"assert candidate(n=500) == 4",
"assert candidate(n=999999999) == 20",
"assert candidate(n=2019) == 4",
"assert candidate(n=1500) == 8",
"assert candidate(n=10000) == 5",
"assert candidate(n=2147483647) == 2",
"assert candidate(n=89123456) == 4",
"assert candidate(n=25) == 3",
"assert candidate(n=98... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=500) == 4",
"assert candidate(n=999999999) == 20",
"assert candidate(n=2019) == 4",
"assert candidate(n=1500) == 8",
"assert candidate(n=10000) == 5",
"assert candidate(n=2147483647) == 2",
"assert candidate(n=89123456) == 4",
"assert candidate(n=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a personal information string s, representing either an emai... | You are an expert Python programmer. 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 personal information string s, representing either an email address or a phone number. Return the maske... | [
"assert candidate(s='USER.NAME@DOMAIN.COM') == 'u*****e@domain.com'",
"assert candidate(s='+91 12345 67890') == '+**-***-***-7890'",
"assert candidate(s='(123)-456-78901') == '+*-***-***-8901'",
"assert candidate(s='++1-123-456-7890') == '+*-***-***-7890'",
"assert candidate(s='+31(0)123456789') == '+**-***... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='USER.NAME@DOMAIN.COM') == 'u*****e@domain.com'",
"assert candidate(s='+91 12345 67890') == '+**-***-***-7890'",
"assert candidate(s='(123)-456-78901') == '+*-***-***-8901'",
"assert candidate(s='++1-123-456-7890') == '+*-***-***-7890'",
"assert candidate(s='... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed string s that you must perform k replacement ope... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed string s that you must perform k replacement operations on. The replacement operations are gi... | [
"assert candidate(s='abracadabra', indices=[0, 3, 7, 10], sources=['abra', 'cad', 'abr', 'a'], targets=['1', '2', '3', '4']) == '1cad34'",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnoopp', indices=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], sources=['bb', 'dd', 'ff', 'hh', 'jj', 'll', 'nn', 'pp'], targets=['XX', '... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abracadabra', indices=[0, 3, 7, 10], sources=['abra', 'cad', 'abr', 'a'], targets=['1', '2', '3', '4']) == '1cad34'",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnoopp', indices=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], sources=['bb', 'dd', 'ff', 'hh', 'jj', 'll', 'nn', ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 images, img1 and img2, represented as binary, square mat... | You are an expert Python programmer. 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 images, img1 and img2, represented as binary, square matrices of size n x n. A binary matrix has only... | [
"assert candidate(img1=[[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [1, 0, 0, 1]], img2=[[0, 0, 1, 0], [0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 0, 1]]) == 3",
"assert candidate(img1=[[1, 0], [0, 1]], img2=[[1, 1], [1, 1]]) == 2",
"assert candidate(img1=[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], img2=[[0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(img1=[[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [1, 0, 0, 1]], img2=[[0, 0, 1, 0], [0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 0, 1]]) == 3",
"assert candidate(img1=[[1, 0], [0, 1]], img2=[[1, 1], [1, 1]]) == 2",
"assert candidate(img1=[[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:\nThere are n dominoes in a line, and we place each domino vertically uprigh... | You are an expert Python programmer. 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 dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push s... | [
"assert candidate(dominoes='R.R.R.R.R.R.R.R.R.R.R') == 'RRRRRRRRRRRRRRRRRRRRR'",
"assert candidate(dominoes='L.R.R.L.L.R.R.L.L.R') == 'L.RRR.LLL.RRR.LLL.R'",
"assert candidate(dominoes='R.L.R.L.R.L.R.L.R.L.R') == 'R.L.R.L.R.L.R.L.R.L.R'",
"assert candidate(dominoes='R.....L.....R.....L') == 'RRR.LLL.....RRR.L... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(dominoes='R.R.R.R.R.R.R.R.R.R.R') == 'RRRRRRRRRRRRRRRRRRRRR'",
"assert candidate(dominoes='L.R.R.L.L.R.R.L.L.R') == 'L.RRR.LLL.RRR.LLL.R'",
"assert candidate(dominoes='R.L.R.L.R.L.R.L.R.L.R') == 'R.L.R.L.R.L.R.L.R.L.R'",
"assert candidate(dominoes='R.....L.....R...... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nTwo strings, X and Y, are considered similar if either they are identical ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Two strings, X and Y, are considered similar if either they are identical or we can make them equivalent by swapping at... | [
"assert candidate(strs=['zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(strs=['zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 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:
A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diag... | [
"assert candidate(grid=[[5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5]]) == 0",
"assert candidate(gri... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5]]) == 0",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string of digits num, such as \"123456579\". We can split ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string of digits num, such as "123456579". We can split it into a Fibonacci-like sequence [123, 456, 57... | [
"assert candidate(num='21123581321345589144') == []",
"assert candidate(num='0123') == []",
"assert candidate(num='352457863245986551816477364000016558014109896102208342120562338240750010987987') == []",
"assert candidate(num='1224365589144233377') == []",
"assert candidate(num='1964183178112985832713223143... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(num='21123581321345589144') == []",
"assert candidate(num='0123') == []",
"assert candidate(num='352457863245986551816477364000016558014109896102208342120562338240750010987987') == []",
"assert candidate(num='1224365589144233377') == []",
"assert candidate(num=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou may recall that an array arr is a mountain array if and only if:\n\nar... | You are an expert Python programmer. 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 may recall that an array arr is a mountain array if and only if:
arr.length >= 3
There exists some index i (0-inde... | [
"assert candidate(arr=[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 3",
"assert candidate(arr=[5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 19",
"assert candidate(arr=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 11",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]) == 3",
"assert candidate(arr=[5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 19",
"assert candidate(arr=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 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:\nYou have an undirected, connected graph of n nodes labeled from 0 to n - 1... | You are an expert Python programmer. 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 an undirected, connected graph of n nodes labeled from 0 to n - 1. You are given an array graph where graph[i]... | [
"assert candidate(graph=[[1, 2, 3], [0, 4, 5], [0, 4, 6], [0, 5, 6], [1, 2, 7, 8], [1, 3, 7, 8], [2, 3, 7, 8], [4, 5, 6, 9], [4, 5, 6, 9], [7, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13]]) == 14",
"assert candidate(graph=[[1, 5], [0, 2, 6], [1, 3, 6], [2, 4, 6], [3, 5, 6], [0, 1, 4, 6], [1, 2, 3, 4, 5]]) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(graph=[[1, 2, 3], [0, 4, 5], [0, 4, 6], [0, 5, 6], [1, 2, 7, 8], [1, 3, 7, 8], [2, 3, 7, 8], [4, 5, 6, 9], [4, 5, 6, 9], [7, 10], [9, 11], [10, 12], [11, 13], [12, 14], [13]]) == 14",
"assert candidate(graph=[[1, 5], [0, 2, 6], [1, 3, 6], [2, 4, 6], [3, 5, 6], [0, 1, 4, 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:\nYou are given an array representing a row of seats where seats[i] = 1 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:
You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and ... | [
"assert candidate(seats=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 51",
"assert candidate(seats=[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 4",
"assert can... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(seats=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == 51",
"assert candidate(seats=[0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 2D array of axis-aligned rectangles. Each rectangle[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 a 2D array of axis-aligned rectangles. Each rectangle[i] = [xi1, yi1, xi2, yi2] denotes the ith rectangle... | [
"assert candidate(rectangles=[[0, 0, 1, 1], [1, 1, 2, 2], [2, 2, 3, 3]]) == 3",
"assert candidate(rectangles=[[10, 10, 20, 20], [15, 15, 25, 25], [20, 20, 30, 30], [25, 25, 35, 35], [30, 30, 40, 40], [35, 35, 45, 45]]) == 475",
"assert candidate(rectangles=[[0, 0, 3, 3], [1, 1, 4, 4], [2, 2, 5, 5], [3, 3, 6, 6]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(rectangles=[[0, 0, 1, 1], [1, 1, 2, 2], [2, 2, 3, 3]]) == 3",
"assert candidate(rectangles=[[10, 10, 20, 20], [15, 15, 25, 25], [20, 20, 30, 30], [25, 25, 35, 35], [30, 30, 40, 40], [35, 35, 45, 45]]) == 475",
"assert candidate(rectangles=[[0, 0, 3, 3], [1, 1, 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:\nThere is a group of n people labeled from 0 to n - 1 where each person has... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is a group of n people labeled from 0 to n - 1 where each person has a different amount of money and a different ... | [
"assert candidate(richer=[[0, 1], [1, 2], [2, 3], [0, 3], [0, 4], [1, 4], [4, 5]], quiet=[3, 4, 5, 1, 2, 0]) == [0, 0, 0, 3, 4, 5]",
"assert candidate(richer=[[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 4], [9, 5], [10, 6], [11, 7], [12, 8], [13, 9], [14, 10], [15, 11], [16, 12], [17, 13], [18, 14... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(richer=[[0, 1], [1, 2], [2, 3], [0, 3], [0, 4], [1, 4], [4, 5]], quiet=[3, 4, 5, 1, 2, 0]) == [0, 0, 0, 3, 4, 5]",
"assert candidate(richer=[[1, 0], [2, 0], [3, 1], [4, 1], [5, 2], [6, 2], [7, 3], [8, 4], [9, 5], [10, 6], [11, 7], [12, 8], [13, 9], [14, 10], [15, 11], [16,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 mountain array arr of length n where the values i... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer mountain array arr of length n where the values increase to a peak element and then decrease.
... | [
"assert candidate(arr=[1, 10, 20, 30, 40, 50, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 6",
"assert candidate(arr=[10, 20, 30, 40, 50, 45, 35, 25, 15, 10]) == 4",
"assert candidate(arr=[1, 3, 5, 4, 2]) == 2",
"assert candidate(arr=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[1, 10, 20, 30, 40, 50, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5]) == 6",
"assert candidate(arr=[10, 20, 30, 40, 50, 45, 35, 25, 15, 10]) == 4",
"assert candidate(arr=[1, 3, 5, 4, 2]) == 2",
"assert candidate(arr=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 cars at given miles away from the starting mile 0, traveling 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 n cars at given miles away from the starting mile 0, traveling to reach the mile target.
You are given two in... | [
"assert candidate(target=300, position=[20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280], speed=[14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1",
"assert candidate(target=120, position=[10, 30, 50, 70, 90], speed=[10, 8, 6, 4, 2]) == 1",
"assert candidate(target=250, position=[10, 20, 30,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(target=300, position=[20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280], speed=[14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1",
"assert candidate(target=120, position=[10, 30, 50, 70, 90], speed=[10, 8, 6, 4, 2]) == 1",
"assert candidate(target=2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.