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:\nThere is an undirected tree with n nodes labeled from 0 to n - 1. You are ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array ed... | [
"assert candidate(n=7, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]], values=[1, 2, 3, 4, 5, 6, 7]) == 27",
"assert candidate(n=12, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11]], values=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 7",
"assert candidate(n=5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=7, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]], values=[1, 2, 3, 4, 5, 6, 7]) == 27",
"assert candidate(n=12, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [3, 8], [4, 9], [4, 10], [5, 11]], values=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 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 a 0-indexed m x n binary matrix grid.\nA 0-indexed m x n dif... | You are an expert Python programmer. 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 m x n binary matrix grid.
A 0-indexed m x n difference matrix diff is created with the follow... | [
"assert candidate(grid=[[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]) == [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]",
"assert candidate(grid=[[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == [[1, -1, 1, -1], [1, -1, 1, -1], [1, -1, 1, -1], [1, -1, 1, -1], [1, -1, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]) == [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]",
"assert candidate(grid=[[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == [[1, -1, 1, -1], [1, -1, 1, -1], [1, -1, 1, -1], [... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given the customer visit log of a shop represented by a 0-indexed ... | You are an expert Python programmer. 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 customer visit log of a shop represented by a 0-indexed string customers consisting only of character... | [
"assert candidate(customers='YYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYY') == 2",
"assert candidate(customers='NYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYN') == 0",
"assert candidate(customers='YYYYYYYYYY') == 10",
"assert candidate(customers='YYYYYYYYYYYYYYYYYYY... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(customers='YYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYYNNYY') == 2",
"assert candidate(customers='NYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYNYNNYN') == 0",
"assert candidate(customers='YYYYYYYYYY') == 10",
"assert candidate(cus... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 of digits s, return the number of palindromic subsequences ... | You are an expert Python programmer. 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 of digits s, return the number of palindromic subsequences of s having length 5. Since the answer may be... | [
"assert candidate(s='01234567899876543210') == 240",
"assert candidate(s='1010101010') == 68",
"assert candidate(s='12345678909876543210') == 204",
"assert candidate(s='543210000012345') == 121",
"assert candidate(s='12345678900987654321') == 240",
"assert candidate(s='123456789012345678901234567890123456... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='01234567899876543210') == 240",
"assert candidate(s='1010101010') == 68",
"assert candidate(s='12345678909876543210') == 204",
"assert candidate(s='543210000012345') == 121",
"assert candidate(s='12345678900987654321') == 240",
"assert candidate(s='12345... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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.\nRemove every node which has a no... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given the head of a linked list.
Remove every node which has a node with a greater value anywhere to the right ... | [
"assert is_same_list(candidate(head=list_node([10, 20, 10, 30, 20, 40, 30, 50, 40, 60, 50, 70, 60, 80, 70, 90, 80, 100, 90])), list_node([100, 90]))",
"assert is_same_list(candidate(head=list_node([10, 20, 30, 25, 35, 40, 38, 45, 42, 48, 47, 50])), list_node([50]))",
"assert is_same_list(candidate(head=list_nod... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([10, 20, 10, 30, 20, 40, 30, 50, 40, 60, 50, 70, 60, 80, 70, 90, 80, 100, 90])), list_node([100, 90]))",
"assert is_same_list(candidate(head=list_node([10, 20, 30, 25, 35, 40, 38, 45, 42, 48, 47, 50])), list_node([50]))",
"assert is_same_lis... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 of size n consisting of distinct integers from... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array nums of size n consisting of distinct integers from 1 to n and a positive integer k.
Return the ... | [
"assert candidate(nums=[12, 14, 10, 15, 13, 11, 9, 8, 7, 6, 5, 4, 3, 2, 1], k=10) == 9",
"assert candidate(nums=[1, 11, 5, 9, 7, 2, 6, 3, 8, 10, 4], k=6) == 25",
"assert candidate(nums=[5, 1, 3, 2, 4, 6, 8, 7, 10, 9], k=5) == 3",
"assert candidate(nums=[5, 1, 3, 2, 4, 8, 6, 7, 9, 10], k=6) == 10",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[12, 14, 10, 15, 13, 11, 9, 8, 7, 6, 5, 4, 3, 2, 1], k=10) == 9",
"assert candidate(nums=[1, 11, 5, 9, 7, 2, 6, 3, 8, 10, 4], k=6) == 25",
"assert candidate(nums=[5, 1, 3, 2, 4, 6, 8, 7, 10, 9], k=5) == 3",
"assert candidate(nums=[5, 1, 3, 2, 4, 8, 6, 7, 9, 10... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a binary string s, and two integers num1 and num2. num1 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:
You are given a binary string s, and two integers num1 and num2. num1 and num2 are coprime numbers.
A ratio substring i... | [
"assert candidate(s='000111000111000111000111000111000111000111000111000111', num1=2, num2=3) == 47",
"assert candidate(s='000000111111000000111111', num1=1, num2=1) == 34",
"assert candidate(s='11111111110000000000', num1=4, num2=5) == 2",
"assert candidate(s='000111000111000111000111000111000111000111000', ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='000111000111000111000111000111000111000111000111000111', num1=2, num2=3) == 47",
"assert candidate(s='000000111111000000111111', num1=1, num2=1) == 34",
"assert candidate(s='11111111110000000000', num1=4, num2=5) == 2",
"assert candidate(s='000111000111000111000... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a positive integer array skill of even length n where skill[... | You are an expert Python programmer. 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 positive integer array skill of even length n where skill[i] denotes the skill of the ith player. Divid... | [
"assert candidate(skill=[1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]) == 40",
"assert candidate(skill=[250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250]) == 375000",
"assert candidate(skill=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 110",
"assert candidate(skill=[999, 1, 998, 2, 997, 3, 996, 4, 995, 5,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(skill=[1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]) == 40",
"assert candidate(skill=[250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250]) == 375000",
"assert candidate(skill=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 110",
"assert candidate(skill=[999, 1, 998,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a positive integer n representing n cities numbered 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:
You are given a positive integer n representing n cities numbered from 1 to n. You are also given a 2D array roads wher... | [
"assert candidate(n=20, roads=[[1, 2, 100], [2, 3, 200], [3, 4, 300], [4, 5, 400], [5, 6, 500], [6, 7, 600], [7, 8, 700], [8, 9, 800], [9, 10, 900], [10, 11, 1000], [11, 12, 1100], [12, 13, 1200], [13, 14, 1300], [14, 15, 1400], [15, 16, 1500], [16, 17, 1600], [17, 18, 1700], [18, 19, 1800], [19, 20, 1900], [20, 1,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=20, roads=[[1, 2, 100], [2, 3, 200], [3, 4, 300], [4, 5, 400], [5, 6, 500], [6, 7, 600], [7, 8, 700], [8, 9, 800], [9, 10, 900], [10, 11, 1000], [11, 12, 1100], [12, 13, 1200], [13, 14, 1300], [14, 15, 1400], [15, 16, 1500], [16, 17, 1600], [17, 18, 1700], [18, 19, 1800], [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 positive integer n representing the number of nodes in an ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a positive integer n representing the number of nodes in an undirected graph. The nodes are labeled from ... | [
"assert candidate(n=15, edges=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]]) == 15",
"assert candidate(n=9, edges=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 9",
"assert candidate(n=3, edges=[[1, 2], [2, 3], [... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=15, edges=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]]) == 15",
"assert candidate(n=9, edges=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]]) == 9",
"assert candidate(n=3,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a 0-indexed integer array nums, return the number of subarrays of 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 a 0-indexed integer array nums, return the number of subarrays of nums having an even product.
Constraints:
1 ... | [
"assert candidate(nums=[100000, 99999, 99998, 99997]) == 8",
"assert candidate(nums=[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 11",
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2]) == 21",
"assert candidate(nums=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 55",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[100000, 99999, 99998, 99997]) == 8",
"assert candidate(nums=[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 11",
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2]) == 21",
"assert candidate(nums=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20])... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array stones sorted in strictly increasi... | You are an expert Python programmer. 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 integer array stones sorted in strictly increasing order representing the positions of stones... | [
"assert candidate(stones=[0, 2, 5, 8, 13, 21, 28, 35, 40]) == 15",
"assert candidate(stones=[0, 10, 25, 45, 70, 100, 135, 175, 220, 270]) == 95",
"assert candidate(stones=[0, 1, 2, 4, 7, 11, 16, 22, 29, 37, 46, 56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326, 352, 379, 407, 436, 466, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(stones=[0, 2, 5, 8, 13, 21, 28, 35, 40]) == 15",
"assert candidate(stones=[0, 10, 25, 45, 70, 100, 135, 175, 220, 270]) == 95",
"assert candidate(stones=[0, 1, 2, 4, 7, 11, 16, 22, 29, 37, 46, 56, 67, 79, 92, 106, 121, 137, 154, 172, 191, 211, 232, 254, 277, 301, 326, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 nums1 and nums2, of equal lengt... | You are an expert Python programmer. 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 nums1 and nums2, of equal length n.
In one operation, you can swap the value... | [
"assert candidate(nums1=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], nums2=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], nums2=[1, 2, 3, 4, 5, 6, 7, 8, 9, 9]) == 36",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], nums2=[1, 2, 3, 4, 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], nums2=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) == 0",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], nums2=[1, 2, 3, 4, 5, 6, 7, 8, 9, 9]) == 36",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 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:\nYou are given an integer array nums. A subsequence of nums is called a squ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums. A subsequence of nums is called a square streak if:
The length of the subsequence... | [
"assert candidate(nums=[12, 144, 20736, 429981696, 182687704666496, 334701674048290625]) == 4",
"assert candidate(nums=[4, 16, 256, 65536, 2]) == 5",
"assert candidate(nums=[18, 324, 5832, 104976, 1889568, 34012224, 612220032, 11019960576]) == 4",
"assert candidate(nums=[7, 49, 343, 2401, 16807, 117649, 82354... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[12, 144, 20736, 429981696, 182687704666496, 334701674048290625]) == 4",
"assert candidate(nums=[4, 16, 256, 65536, 2]) == 5",
"assert candidate(nums=[18, 324, 5832, 104976, 1889568, 34012224, 612220032, 11019960576]) == 4",
"assert candidate(nums=[7, 49, 343,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 value of the bitwise OR of the sum... | You are an expert Python programmer. 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 value of the bitwise OR of the sum of all possible subsequences in the array.
A... | [
"assert candidate(nums=[2147483647, 0, 1, 2147483646]) == 4294967295",
"assert candidate(nums=[987654321, 876543210, 765432109, 654321098, 543210987, 432109876, 321098765]) == 8589934591",
"assert candidate(nums=[3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 255",
"assert candidate(nums=[1024, 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2147483647, 0, 1, 2147483646]) == 4294967295",
"assert candidate(nums=[987654321, 876543210, 765432109, 654321098, 543210987, 432109876, 321098765]) == 8589934591",
"assert candidate(nums=[3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]) == 255",
"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:\nYou are given a positive integer n.\nContinuously replace n with 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:
You are given a positive integer n.
Continuously replace n with the sum of its prime factors.
Note that if a prime fac... | [
"assert candidate(n=3) == 3",
"assert candidate(n=2310) == 11",
"assert candidate(n=3125) == 7",
"assert candidate(n=100000) == 7",
"assert candidate(n=841) == 31",
"assert candidate(n=84) == 5",
"assert candidate(n=104729) == 104729",
"assert candidate(n=6857) == 6857",
"assert candidate(n=720) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=3) == 3",
"assert candidate(n=2310) == 11",
"assert candidate(n=3125) == 7",
"assert candidate(n=100000) == 7",
"assert candidate(n=841) == 31",
"assert candidate(n=84) == 5",
"assert candidate(n=104729) == 104729",
"assert candidate(n=6857) == 68... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 consisting of n nodes numbered from 1 to n. Y... | You are an expert Python programmer. 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 consisting of n nodes numbered from 1 to n. You are given the integer n and a 2D array edg... | [
"assert candidate(n=14, edges=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]]) == True",
"assert candidate(n=12, edges=[[1, 2], [2, 3], [3, 4], [4, 1], [5, 6], [6, 7], [7, 8], [8, 5], [9, 10], [10, 11], [11, 12], [12, 9]]) == True",
"assert candi... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=14, edges=[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14]]) == True",
"assert candidate(n=12, edges=[[1, 2], [2, 3], [3, 4], [4, 1], [5, 6], [6, 7], [7, 8], [8, 5], [9, 10], [10, 11], [11, 12], [12, 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 integer n. There is a complete binary tree with 2n - 1 no... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer n. There is a complete binary tree with 2n - 1 nodes. The root of that tree is the node with t... | [
"assert candidate(n=4, queries=[[8, 4], [7, 3], [1, 14]]) == [2, 2, 4]",
"assert candidate(n=10, queries=[[511, 256], [255, 128], [127, 64], [63, 32], [31, 16], [15, 8], [7, 4], [3, 2], [1, 2]]) == [17, 15, 13, 11, 9, 7, 5, 3, 2]",
"assert candidate(n=10, queries=[[511, 256], [1023, 512], [768, 384], [255, 128]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=4, queries=[[8, 4], [7, 3], [1, 14]]) == [2, 2, 4]",
"assert candidate(n=10, queries=[[511, 256], [255, 128], [127, 64], [63, 32], [31, 16], [15, 8], [7, 4], [3, 2], [1, 2]]) == [17, 15, 13, 11, 9, 7, 5, 3, 2]",
"assert candidate(n=10, queries=[[511, 256], [1023, 512... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two string arrays positive_feedback and negative_feedback, 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:
You are given two string arrays positive_feedback and negative_feedback, containing the words denoting positive and neg... | [
"assert candidate(positive_feedback=['diligent', 'persevering', 'tenacious'], negative_feedback=['lazy', 'indolent', 'procrastinating'], report=['the student is diligent and persevering', 'the student is indolent', 'the student is tenacious but lazy'], student_id=[7001, 7002, 7003], k=2) == [7001, 7003]",
"assert... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(positive_feedback=['diligent', 'persevering', 'tenacious'], negative_feedback=['lazy', 'indolent', 'procrastinating'], report=['the student is diligent and persevering', 'the student is indolent', 'the student is tenacious but lazy'], student_id=[7001, 7002, 7003], k=2) == [70... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWe have two arrays arr1 and arr2 which are initially empty. You need to ad... | You are an expert Python programmer. 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 have two arrays arr1 and arr2 which are initially empty. You need to add positive integers to them such that they sa... | [
"assert candidate(divisor1=30, divisor2=42, uniqueCnt1=50000000, uniqueCnt2=50000000) == 100478468",
"assert candidate(divisor1=100000, divisor2=200000, uniqueCnt1=50000000, uniqueCnt2=50000000) == 100000500",
"assert candidate(divisor1=100000, divisor2=50000, uniqueCnt1=50000000, uniqueCnt2=40000000) == 900009... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(divisor1=30, divisor2=42, uniqueCnt1=50000000, uniqueCnt2=50000000) == 100478468",
"assert candidate(divisor1=100000, divisor2=200000, uniqueCnt1=50000000, uniqueCnt2=50000000) == 100000500",
"assert candidate(divisor1=100000, divisor2=50000, uniqueCnt1=50000000, uniqu... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s consisting of the characters 'a', 'b', and 'c' an... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s consisting of the characters 'a', 'b', and 'c' and a non-negative integer k. Each minute, you ... | [
"assert candidate(s='abacabadabacabadabacabad', k=4) == -1",
"assert candidate(s='cccccccccccbcccccccccc', k=3) == -1",
"assert candidate(s='ccccccbbbbaaa', k=2) == 7",
"assert candidate(s='cccaaaabbbccc', k=3) == 9",
"assert candidate(s='abcabcabcabcabcabcabcabcabcabc', k=5) == 15",
"assert candidate(s='... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abacabadabacabadabacabad', k=4) == -1",
"assert candidate(s='cccccccccccbcccccccccc', k=3) == -1",
"assert candidate(s='ccccccbbbbaaa', k=2) == 7",
"assert candidate(s='cccaaaabbbccc', k=3) == 9",
"assert candidate(s='abcabcabcabcabcabcabcabcabcabc', k=5) ==... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums and a positive integer k.\nWe... | You are an expert Python programmer. 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 integer array nums and a positive integer k.
We call an index i k-big if the following condit... | [
"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], k=5) == 0",
"assert candidate(nums=[1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20], k=5) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], k=5) == 0",
"assert candidate(nums=[1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 20], k=5) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 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:\nYou are given a 0-indexed integer array nums.\nThe effective value of thre... | You are an expert Python programmer. 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 integer array nums.
The effective value of three indices i, j, and k is defined as ((nums[i] ... | [
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1",
"assert candidate(nums=[31, 14, 7, 3, 1]) == 20",
"assert candidate(nums=[2147483647, 1073741823, 536870911, 268435455, 134217727, 67108863, 33554431, 16777215, 8388607, 4194303, 2097151, 1048575, 524287, 262143, 131071]) == 1431699455... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1",
"assert candidate(nums=[31, 14, 7, 3, 1]) == 20",
"assert candidate(nums=[2147483647, 1073741823, 536870911, 268435455, 134217727, 67108863, 33554431, 16777215, 8388607, 4194303, 2097151, 1048575, 524287, 26214... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array stations of length n, where statio... | You are an expert Python programmer. 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 integer array stations of length n, where stations[i] represents the number of power stations... | [
"assert candidate(stations=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], r=1, k=5) == 2",
"assert candidate(stations=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], r=3, k=15) == 27",
"assert candidate(stations=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], r=9, k=20) == 20",
"assert candidate(stations=[1, 1, 1, 1, 1, 1, 1,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(stations=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], r=1, k=5) == 2",
"assert candidate(stations=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], r=3, k=15) == 27",
"assert candidate(stations=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], r=9, k=20) == 20",
"assert candidate(sta... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums and an integer k. You have 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 a 0-indexed integer array nums and an integer k. You have a starting score of 0.
In one operation:
choos... | [
"assert candidate(nums=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2], k=10) == 20",
"assert candidate(nums=[1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120], k=15) == 799",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k=20) == 227",
"assert candidate(nums=[15, 21,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2], k=10) == 20",
"assert candidate(nums=[1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120], k=15) == 799",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k=20) == 227",
"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:\nThere are k workers who want to move n boxes from the right (old) warehous... | You are an expert Python programmer. 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 k workers who want to move n boxes from the right (old) warehouse to the left (new) warehouse. You are given ... | [
"assert candidate(n=15, k=3, time=[[5, 1, 2, 1], [2, 1, 5, 2], [1, 1, 1, 1]]) == 106",
"assert candidate(n=18, k=7, time=[[5, 3, 4, 2], [2, 1, 2, 1], [3, 2, 3, 2], [1, 5, 1, 5], [4, 4, 4, 4], [6, 6, 6, 6], [7, 7, 7, 7]]) == 210",
"assert candidate(n=25, k=4, time=[[1, 1, 1, 1], [1, 2, 2, 1], [1, 3, 3, 1], [1, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=15, k=3, time=[[5, 1, 2, 1], [2, 1, 5, 2], [1, 1, 1, 1]]) == 106",
"assert candidate(n=18, k=7, time=[[5, 3, 4, 2], [2, 1, 2, 1], [3, 2, 3, 2], [1, 5, 1, 5], [4, 4, 4, 4], [6, 6, 6, 6], [7, 7, 7, 7]]) == 210",
"assert candidate(n=25, k=4, time=[[1, 1, 1, 1], [1, 2, 2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given four integers minLength, maxLength, oneGroup and zeroGroup.\... | You are an expert Python programmer. 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 four integers minLength, maxLength, oneGroup and zeroGroup.
A binary string is good if it satisfies the f... | [
"assert candidate(minLength=5, maxLength=10, oneGroup=5, zeroGroup=5) == 6",
"assert candidate(minLength=15, maxLength=25, oneGroup=3, zeroGroup=9) == 32",
"assert candidate(minLength=20, maxLength=30, oneGroup=6, zeroGroup=7) == 21",
"assert candidate(minLength=25000, maxLength=75000, oneGroup=50, zeroGroup=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(minLength=5, maxLength=10, oneGroup=5, zeroGroup=5) == 6",
"assert candidate(minLength=15, maxLength=25, oneGroup=3, zeroGroup=9) == 32",
"assert candidate(minLength=20, maxLength=30, oneGroup=6, zeroGroup=7) == 21",
"assert candidate(minLength=25000, maxLength=750... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 numbered from 0 to n - 1 and a door. Each person can 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:
There are n persons numbered from 0 to n - 1 and a door. Each person can enter or exit through the door once, taking on... | [
"assert candidate(arrival=[0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3], state=[1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1]) == [0, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 15, 16, 17, 18, 19, 20, 7, 8, 9]",
"assert candidate(arrival=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arrival=[0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3], state=[1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1]) == [0, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 15, 16, 17, 18, 19, 20, 7, 8, 9]",
"assert candidate(arrival=[0, 1, 2, 3, 4, 5, 6, 7... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two 0-indexed integer arrays nums1 and nums2 of equal length... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two 0-indexed integer arrays nums1 and nums2 of equal length n and a positive integer k. You must choose ... | [
"assert candidate(nums1=[10, 20, 30, 40, 50], nums2=[50, 40, 30, 20, 10], k=5) == 1500",
"assert candidate(nums1=[100000, 0, 0, 0, 0, 0, 0, 0, 0, 0], nums2=[1, 100000, 1, 100000, 1, 100000, 1, 100000, 1, 100000], k=5) == 100000",
"assert candidate(nums1=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], nums2=[100, 90,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[10, 20, 30, 40, 50], nums2=[50, 40, 30, 20, 10], k=5) == 1500",
"assert candidate(nums1=[100000, 0, 0, 0, 0, 0, 0, 0, 0, 0], nums2=[1, 100000, 1, 100000, 1, 100000, 1, 100000, 1, 100000], k=5) == 100000",
"assert candidate(nums1=[10, 20, 30, 40, 50, 60, 70, 80, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere exists an infinitely large grid. You are currently at point (1, 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:
There exists an infinitely large grid. You are currently at point (1, 1), and you need to reach the point (targetX, tar... | [
"assert candidate(targetX=65536, targetY=129) == True",
"assert candidate(targetX=511, targetY=256) == True",
"assert candidate(targetX=255, targetY=1023) == False",
"assert candidate(targetX=13, targetY=39) == False",
"assert candidate(targetX=19, targetY=23) == True",
"assert candidate(targetX=256, targ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(targetX=65536, targetY=129) == True",
"assert candidate(targetX=511, targetY=256) == True",
"assert candidate(targetX=255, targetY=1023) == False",
"assert candidate(targetX=13, targetY=39) == False",
"assert candidate(targetX=19, targetY=23) == True",
"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:\nThere is a class with m students and n exams. You are given a 0-indexed m ... | You are an expert Python programmer. 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 class with m students and n exams. You are given a 0-indexed m x n integer matrix score, where each row repr... | [
"assert candidate(score=[[100, 90, 80, 70], [60, 50, 40, 30], [20, 10, 0, 100]], k=1) == [[100, 90, 80, 70], [60, 50, 40, 30], [20, 10, 0, 100]]",
"assert candidate(score=[[100, 200, 300, 400, 500], [90, 190, 290, 390, 490], [80, 180, 280, 380, 480], [70, 170, 270, 370, 470], [60, 160, 260, 360, 460]], k=2) == [[... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(score=[[100, 90, 80, 70], [60, 50, 40, 30], [20, 10, 0, 100]], k=1) == [[100, 90, 80, 70], [60, 50, 40, 30], [20, 10, 0, 100]]",
"assert candidate(score=[[100, 200, 300, 400, 500], [90, 190, 290, 390, 490], [80, 180, 280, 380, 480], [70, 170, 270, 370, 470], [60, 160, 260,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two 0-indexed binary strings s and target of the same length... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two 0-indexed binary strings s and target of the same length n. You can do the following operation on s a... | [
"assert candidate(s='0101010101', target='1010101011') == True",
"assert candidate(s='10101010101010101010', target='11111111111111111111') == True",
"assert candidate(s='111000', target='000111') == True",
"assert candidate(s='1111111111', target='1111111111') == True",
"assert candidate(s='111110000000000... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='0101010101', target='1010101011') == True",
"assert candidate(s='10101010101010101010', target='11111111111111111111') == True",
"assert candidate(s='111000', target='000111') == True",
"assert candidate(s='1111111111', target='1111111111') == 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 nums and an integer k.\nSplit the array int... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums and an integer k.
Split the array into some number of non-empty subarrays. The cost... | [
"assert candidate(nums=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6], k=8) == 27",
"assert candidate(nums=[5, 4, 3, 2, 1], k=3) == 3",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=10) == 30",
"assert candidate(nums=[1, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6], k=8) == 27",
"assert candidate(nums=[5, 4, 3, 2, 1], k=3) == 3",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=10) == 30",
"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 2D integer array items where items[i] = [pricei, weighti] ... | You are an expert Python programmer. 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 items where items[i] = [pricei, weighti] denotes the price and weight of the ith item,... | [
"assert candidate(items=[[8, 2], [16, 4], [24, 6], [32, 8], [40, 10]], capacity=20) == 80.0",
"assert candidate(items=[[500, 250], [400, 200], [300, 150], [200, 100], [100, 50]], capacity=600) == 1200.0",
"assert candidate(items=[[100, 1], [200, 2], [300, 3], [400, 4], [500, 5], [600, 6], [700, 7], [800, 8], [9... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(items=[[8, 2], [16, 4], [24, 6], [32, 8], [40, 10]], capacity=20) == 80.0",
"assert candidate(items=[[500, 250], [400, 200], [300, 150], [200, 100], [100, 50]], capacity=600) == 1200.0",
"assert candidate(items=[[100, 1], [200, 2], [300, 3], [400, 4], [500, 5], [600, 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 have k bags. You are given a 0-indexed integer array weights where wei... | You are an expert Python programmer. 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 k bags. You are given a 0-indexed integer array weights where weights[i] is the weight of the ith marble. You ... | [
"assert candidate(weights=[5, 15, 25, 35, 45, 55, 65, 75, 85, 95], k=3) == 280",
"assert candidate(weights=[1, 3, 5, 1], k=2) == 4",
"assert candidate(weights=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200], k=7) == 6000",
"assert candidate(weights=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(weights=[5, 15, 25, 35, 45, 55, 65, 75, 85, 95], k=3) == 280",
"assert candidate(weights=[1, 3, 5, 1], k=2) == 4",
"assert candidate(weights=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200], k=7) == 6000",
"assert candidate(weights=[1, 1, 1, 1, 1, 1,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a 0-indexed integer array nums of size n containing all numbers from... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a 0-indexed integer array nums of size n containing all numbers from 1 to n, return the number of increasing quad... | [
"assert candidate(nums=[1, 3, 5, 7, 9, 2, 4, 6, 8, 10]) == 35",
"assert candidate(nums=[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0",
"assert candidate(nums=[5, 2, 8, 3, 7, 4, 10, 6, 1, 9]) == 17",
"assert candidate(nums=[3, 2, 1, 6, 5, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 3, 5, 7, 9, 2, 4, 6, 8, 10]) == 35",
"assert candidate(nums=[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0",
"assert candidate(nums=[5, 2, 8, 3, 7, 4, 10, 6, 1, 9]) == 17",
"assert cand... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array banned and two integers n and maxSum. You 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 integer array banned and two integers n and maxSum. You are choosing some number of integers following... | [
"assert candidate(banned=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], n=100, maxSum=1500) == 51",
"assert candidate(banned=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], n=15, maxSum=50) == 4",
"assert candidate(banned=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], n=20, maxSum=100) == 9",
"assert candidate(banned=[15, 30, 45, 60, 75]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(banned=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], n=100, maxSum=1500) == 51",
"assert candidate(banned=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], n=15, maxSum=50) == 4",
"assert candidate(banned=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], n=20, maxSum=100) == 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:\nThere are some prizes on the X-axis. You are given an integer array prizeP... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There are some prizes on the X-axis. You are given an integer array prizePositions that is sorted in non-decreasing ord... | [
"assert candidate(prizePositions=[1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], k=4) == 24",
"assert candidate(prizePositions=[1, 2, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 10], k=4) == 15",
"assert candidate(prizePositions=[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(prizePositions=[1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], k=4) == 24",
"assert candidate(prizePositions=[1, 2, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 10], k=4) == 15",
"assert candidate(prizePositions=[1, 2, 2, 3, 3,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed m x n binary matrix grid. You can move from a ce... | You are an expert Python programmer. 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 m x n binary matrix grid. You can move from a cell (row, col) to any of the cells (row + 1, c... | [
"assert candidate(grid=[[1, 1, 1, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 1, 1, 1]]) == True",
"assert candidate(grid=[[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 1, 1, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 1, 1, 1]]) == True",
"assert candidate(grid=[[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 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 several consecutive houses along a street, each of which has som... | You are an expert Python programmer. 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 consecutive houses along a street, each of which has some money inside. There is also a robber, who w... | [
"assert candidate(nums=[10, 2, 8, 4, 7, 3, 9, 5, 6, 1], k=4) == 4",
"assert candidate(nums=[1, 2, 100, 3, 4, 100, 5, 6, 100, 7, 8, 100, 9, 10, 100], k=5) == 9",
"assert candidate(nums=[10, 5, 15, 20, 25, 30, 35, 40], k=4) == 35",
"assert candidate(nums=[9, 4, 1, 7, 3, 8, 5, 2, 6, 0], k=4) == 3",
"assert can... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 2, 8, 4, 7, 3, 9, 5, 6, 1], k=4) == 4",
"assert candidate(nums=[1, 2, 100, 3, 4, 100, 5, 6, 100, 7, 8, 100, 9, 10, 100], k=5) == 9",
"assert candidate(nums=[10, 5, 15, 20, 25, 30, 35, 40], k=4) == 35",
"assert candidate(nums=[9, 4, 1, 7, 3, 8, 5, 2, 6, 0]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou have two fruit baskets containing n fruits each. You are given two 0-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 have two fruit baskets containing n fruits each. You are given two 0-indexed integer arrays basket1 and basket2 rep... | [
"assert candidate(basket1=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], basket2=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 5",
"assert candidate(basket1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], basket2=[12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0",
"assert candidate(basket1=[3, 3, 3, 3, 3, 3], basket2=[1, 1, 1, 1, 1, 1]) == 3",
"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(basket1=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], basket2=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 5",
"assert candidate(basket1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], basket2=[12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0",
"assert candidate(basket1=[3, 3, 3, 3, 3, 3], basket2=[1, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a 0-indexed integer array nums of size n and two integers lower 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 0-indexed integer array nums of size n and two integers lower and upper, return the number of fair pairs.
A pai... | [
"assert candidate(nums=[1, 2, 3, 4, 5], lower=5, upper=8) == 7",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], lower=1, upper=38) == 45",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], lower=2, upper=2) == 45",
"assert candidate(nums=[1, 2, 3, 4, 5], lower=3, upper=9) == 10",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5], lower=5, upper=8) == 7",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19], lower=1, upper=38) == 45",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], lower=2, upper=2) == 45",
"assert candidate(nums=[1, 2, 3, 4, 5], lower=3, u... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a binary string s, and a 2D integer array queries where quer... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a binary string s, and a 2D integer array queries where queries[i] = [firsti, secondi].
For the ith query... | [
"assert candidate(s='1010101010101010101010101010101010101010101010101010101010101010', queries=[[511, 510], [255, 254], [127, 126], [63, 62], [31, 30], [15, 14], [7, 6]]) == [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]",
"assert candidate(s='11001100110011001100110011001100110011001100110011001100110... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='1010101010101010101010101010101010101010101010101010101010101010', queries=[[511, 510], [255, 254], [127, 126], [63, 62], [31, 30], [15, 14], [7, 6]]) == [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]",
"assert candidate(s='110011001100110011001100110011001100... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two strings s and t.\nYou are allowed to remove any number o... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two strings s and t.
You are allowed to remove any number of characters from the string t.
The score of t... | [
"assert candidate(s='solvingproblems', t='problemsolving') == 6",
"assert candidate(s='mississippi', t='ppisissam') == 6",
"assert candidate(s='abcdabcdabcd', t='ddddccbbbaaa') == 9",
"assert candidate(s='optimization', t='ttttiiiooonnnssss') == 15",
"assert candidate(s='aaaaabbbbbccccc', t='abcabcabcabc') ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='solvingproblems', t='problemsolving') == 6",
"assert candidate(s='mississippi', t='ppisissam') == 6",
"assert candidate(s='abcdabcdabcd', t='ddddccbbbaaa') == 9",
"assert candidate(s='optimization', t='ttttiiiooonnnssss') == 15",
"assert candidate(s='aaaaabb... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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.\n\nThe low score of nums is the minim... | You are an expert Python programmer. 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.
The low score of nums is the minimum absolute difference between any two integers... | [
"assert candidate(nums=[1, 2, 1000000000, 2, 1000000000, 3, 1000000000, 4, 1000000000, 5]) == 999999998",
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 3",
"assert candidate(nums=[1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140]) == 119",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 1000000000, 2, 1000000000, 3, 1000000000, 4, 1000000000, 5]) == 999999998",
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) == 3",
"assert candidate(nums=[1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140]) == 119",
"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 a 0-indexed integer array nums.\nWe say that an integer x 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 a 0-indexed integer array nums.
We say that an integer x is expressible from nums if there exist some int... | [
"assert candidate(nums=[10, 20, 30, 40]) == 1",
"assert candidate(nums=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1",
"assert candidate(nums=[1024, 2048, 4096, 8192]) == 1",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 20, 30, 40]) == 1",
"assert candidate(nums=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]) == 1",
"assert candidate(nums=[1024, 2048, 4096, 8192]) == 1",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 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:\nYou are given two 0-indexed arrays nums1 and nums2 and a 2D array queries ... | You are an expert Python programmer. 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 arrays nums1 and nums2 and a 2D array queries of queries. There are three types of queries:... | [
"assert candidate(nums1=[1, 1, 1, 1], nums2=[0, 0, 0, 0], queries=[[2, 1, 0], [3, 0, 0], [1, 0, 1], [2, 2, 0], [3, 0, 0]]) == [4, 8]",
"assert candidate(nums1=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], nums2=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], queries=[[1, 0, 9], [2, 5, 0], [3, 0, 0], [1, 2, 7], [2, 2, 0], [3, 0, 0],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[1, 1, 1, 1], nums2=[0, 0, 0, 0], queries=[[2, 1, 0], [3, 0, 0], [1, 0, 1], [2, 2, 0], [3, 0, 0]]) == [4, 8]",
"assert candidate(nums1=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], nums2=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], queries=[[1, 0, 9], [2, 5, 0], [3, 0, 0], [1, 2, 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:\nWe define the lcp matrix of any 0-indexed string word of n lowercase Engli... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
We define the lcp matrix of any 0-indexed string word of n lowercase English letters as an n x n grid such that:
lcp[i... | [
"assert candidate(lcp=[[2, 1], [1, 2]]) == ''",
"assert candidate(lcp=[[3, 3, 2, 1], [3, 3, 2, 1], [2, 2, 2, 1], [1, 1, 1, 1]]) == ''",
"assert candidate(lcp=[[7, 1, 0, 0, 0, 0, 0], [1, 7, 1, 0, 0, 0, 0], [0, 1, 7, 1, 0, 0, 0], [0, 0, 1, 7, 1, 0, 0], [0, 0, 0, 1, 7, 1, 0], [0, 0, 0, 0, 1, 7, 1], [0, 0, 0, 0, 0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(lcp=[[2, 1], [1, 2]]) == ''",
"assert candidate(lcp=[[3, 3, 2, 1], [3, 3, 2, 1], [2, 2, 2, 1], [1, 1, 1, 1]]) == ''",
"assert candidate(lcp=[[7, 1, 0, 0, 0, 0, 0], [1, 7, 1, 0, 0, 0, 0], [0, 1, 7, 1, 0, 0, 0], [0, 0, 1, 7, 1, 0, 0], [0, 0, 0, 1, 7, 1, 0], [0, 0, 0, 0, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a m x n matrix grid consisting of non-negative integers 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 a m x n matrix grid consisting of non-negative integers where grid[row][col] represents the minimum time ... | [
"assert candidate(grid=[[0, 1, 2], [3, 1, 1], [2, 1, 0]]) == 4",
"assert candidate(grid=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 0], [... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[0, 1, 2], [3, 1, 1], [2, 1, 0]]) == 4",
"assert candidate(grid=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 2, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere exists an infinitely large two-dimensional grid of uncolored unit ce... | You are an expert Python programmer. 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 exists an infinitely large two-dimensional grid of uncolored unit cells. You are given a positive integer n, indi... | [
"assert candidate(n=2500) == 12495001",
"assert candidate(n=5000) == 49990001",
"assert candidate(n=500) == 499001",
"assert candidate(n=99998) == 19999000013",
"assert candidate(n=1000) == 1998001",
"assert candidate(n=10) == 181",
"assert candidate(n=4) == 25",
"assert candidate(n=50) == 4901",
"a... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=2500) == 12495001",
"assert candidate(n=5000) == 49990001",
"assert candidate(n=500) == 499001",
"assert candidate(n=99998) == 19999000013",
"assert candidate(n=1000) == 1998001",
"assert candidate(n=10) == 181",
"assert candidate(n=4) == 25",
"as... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nAlice has an undirected tree with n nodes labeled from 0 to n - 1. The 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:
Alice has an undirected tree with n nodes labeled from 0 to n - 1. The tree is represented as a 2D integer array edges ... | [
"assert candidate(edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]], guesses=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]], k=6) == 4",
"assert candidate(edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]], guesses=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]], k=6) == 4",
"assert candidate(edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [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 the root of a binary tree and a positive integer k.\nThe lev... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given the root of a binary tree and a positive integer k.
The level sum in the tree is the sum of the values of... | [
"assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18]), k=2) == 20",
"assert candidate(root=tree_node([6, 10, 2, None, 8, 3, 3, None, None, 1, 5, None, None, 9, 7, None, 4, 6, None, None, None, 2]), k=3) == 12",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18]), k=2) == 20",
"assert candidate(root=tree_node([6, 10, 2, None, 8, 3, 3, None, None, 1, 5, None, None, 9, 7, None, 4, 6, None, None, None, 2]), k=3) == 12",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 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 are given a 0-indexed integer array nums of length n.\nA split at an 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 0-indexed integer array nums of length n.
A split at an index i where 0 <= i <= n - 2 is called valid i... | [
"assert candidate(nums=[3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049]) == -1",
"assert candidate(nums=[999983, 999979, 999961, 999959, 999953, 999943]) == 0",
"assert candidate(nums=[60, 1, 2, 3]) == -1",
"assert candidate(nums=[1000000, 2000000, 3000000, 4000000, 5000000, 6000000]) == -1",
"assert cand... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049]) == -1",
"assert candidate(nums=[999983, 999979, 999961, 999959, 999953, 999943]) == 0",
"assert candidate(nums=[60, 1, 2, 3]) == -1",
"assert candidate(nums=[1000000, 2000000, 3000000, 4000000, 5000000, 60000... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums. You can rearrange the elemen... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums. You can rearrange the elements of nums to any order (including the given ... | [
"assert candidate(nums=[1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991]) == 10",
"assert candidate(nums=[1000000, -1000000, 1000000, -1000000, 0]) == 4",
"assert candidate(nums=[-1000000, 1000000, -2000000, 2000000, -3000000, 3000000, -1500000, 1500000]) == 7",
"assert candida... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1000000, 999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991]) == 10",
"assert candidate(nums=[1000000, -1000000, 1000000, -1000000, 0]) == 4",
"assert candidate(nums=[-1000000, 1000000, -2000000, 2000000, -3000000, 3000000, -1500000, 1500000])... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums. You are allowed to permute 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:
You are given a 0-indexed integer array nums. You are allowed to permute nums into a new array perm of your choosing.
W... | [
"assert candidate(nums=[1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16]) == 19",
"assert candidate(nums=[3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 11, 20, 12, 19, 13, 18, 14, 17, 15, 16]) == 19",
"assert candidate(nums=[3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 18",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 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 array nums consisting of positive integers.\nStarting wit... | You are an expert Python programmer. 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 consisting of positive integers.
Starting with score = 0, apply the following algorithm:
C... | [
"assert candidate(nums=[5, 4, 3, 2, 1, 1, 2, 3, 4, 5]) == 15",
"assert candidate(nums=[2, 3, 5, 1, 3, 2, 5, 1, 3, 2, 5, 1, 3, 2, 5]) == 11",
"assert candidate(nums=[1000000, 1, 1000000, 1, 1000000, 1]) == 3",
"assert candidate(nums=[999999, 999998, 999997, 999996, 999995, 999994, 999993, 999992, 999991, 99999... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 4, 3, 2, 1, 1, 2, 3, 4, 5]) == 15",
"assert candidate(nums=[2, 3, 5, 1, 3, 2, 5, 1, 3, 2, 5, 1, 3, 2, 5]) == 11",
"assert candidate(nums=[1000000, 1, 1000000, 1, 1000000, 1]) == 3",
"assert candidate(nums=[999999, 999998, 999997, 999996, 999995, 999994, 99... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 ranks representing the ranks of some mechan... | You are an expert Python programmer. 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 ranks representing the ranks of some mechanics. ranksi is the rank of the ith mechanic. ... | [
"assert candidate(ranks=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], cars=10000) == 1250000",
"assert candidate(ranks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], cars=100000) == 99181681",
"assert candidate(ranks=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10], cars=1000000) == 39... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(ranks=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], cars=10000) == 1250000",
"assert candidate(ranks=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], cars=100000) == 99181681",
"assert candidate(ranks=[100, 90, 80, 70, 60, 50, 40, 30, 20,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums and an integer value.\nIn one... | You are an expert Python programmer. 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 integer array nums and an integer value.
In one operation, you can add or subtract value from... | [
"assert candidate(nums=[0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19], value=3) == 19",
"assert candidate(nums=[-100, -200, -300, -400, -500, -600, -700, -800, -900, -1000], value=100) == 1",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19], value=3) == 19",
"assert candidate(nums=[-100, -200, -300, -400, -500, -600, -700, -800, -900, -1000], value=100) == 1",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums. You can apply the following ... | You are an expert Python programmer. 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 integer array nums. You can apply the following operation any number of times:
Pick any elem... | [
"assert candidate(nums=[1, -1, 2, -2, 3, -3, 4, -4]) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5]) == 0",
"assert candidate(nums=[10, -20, 30, -40, 50, -60, 70, -80, 90, -100, 110, -120, 130, -140, 150]) == 2",
"assert candidate(nums=[1000000000, -500000000, 500000000, -250000000, 250000000, -125000000, 1250... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, -1, 2, -2, 3, -3, 4, -4]) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5]) == 0",
"assert candidate(nums=[10, -20, 30, -40, 50, -60, 70, -80, 90, -100, 110, -120, 130, -140, 150]) == 2",
"assert candidate(nums=[1000000000, -500000000, 500000000, -250000000, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums of length n.\nYou can perform... | You are an expert Python programmer. 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 integer array nums of length n.
You can perform the following operation as many times as you ... | [
"assert candidate(nums=[11, 22, 33, 44, 55, 66]) == True",
"assert candidate(nums=[89, 97, 83, 79, 88, 85]) == True",
"assert candidate(nums=[11, 13, 15, 17, 19, 21, 23]) == True",
"assert candidate(nums=[45, 55, 65, 75, 85, 95, 105]) == True",
"assert candidate(nums=[15, 18, 21, 25]) == True",
"assert ca... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[11, 22, 33, 44, 55, 66]) == True",
"assert candidate(nums=[89, 97, 83, 79, 88, 85]) == True",
"assert candidate(nums=[11, 13, 15, 17, 19, 21, 23]) == True",
"assert candidate(nums=[45, 55, 65, 75, 85, 95, 105]) == True",
"assert candidate(nums=[15, 18, 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:\nYou are given an array nums consisting of positive integers.\nYou are also... | You are an expert Python programmer. 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 consisting of positive integers.
You are also given an integer array queries of size m. For... | [
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], queries=[55, 45, 65, 35, 75]) == [250, 260, 260, 290, 290]",
"assert candidate(nums=[999999999, 1, 999999998, 2, 999999997, 3, 999999996, 4, 999999995, 5], queries=[999999999, 1, 500000000, 1000000000]) == [4999999990, 4999999990, 4999999970, 50000... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], queries=[55, 45, 65, 35, 75]) == [250, 260, 260, 290, 290]",
"assert candidate(nums=[999999999, 1, 999999998, 2, 999999997, 3, 999999996, 4, 999999995, 5], queries=[999999999, 1, 500000000, 1000000000]) == [4999999990, 499999... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 exists an undirected and unrooted tree with n nodes indexed from 0 t... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There exists an undirected and unrooted tree with n nodes indexed from 0 to n - 1. You are given an integer n and a 2D ... | [
"assert candidate(coins=[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19]]) == 22",
"assert candidate(coins=[1, 0, 0, 0, 0, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(coins=[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19]]) == 22",
"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:\nThere are n hens and m grains on a line. You are given the initial positio... | You are an expert Python programmer. 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 hens and m grains on a line. You are given the initial positions of the hens and the grains in two integer ... | [
"assert candidate(hens=[100, 300, 500, 700, 900, 1100, 1300, 1500, 1700, 1900], grains=[50, 150, 250, 350, 450, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1550, 1650, 1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2550, 2650, 2750, 2850, 2950]) == 1050",
"assert candidate(hens=[1, 2, 3], grains=[0, 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(hens=[100, 300, 500, 700, 900, 1100, 1300, 1500, 1700, 1900], grains=[50, 150, 250, 350, 450, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1550, 1650, 1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2550, 2650, 2750, 2850, 2950]) == 1050",
"assert candidate(hens=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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, a string chars of distinct characters and an int... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s, a string chars of distinct characters and an integer array vals of the same length as chars.
... | [
"assert candidate(s='zzzzzzzzzzzzzzzzzzzzzzzzzz', chars='z', vals=[1000]) == 26000",
"assert candidate(s='abcdefgxyz', chars='xyz', vals=[100, 100, 100]) == 328",
"assert candidate(s='programming', chars='pg', vals=[-5, -10]) == 91",
"assert candidate(s='zzzzzzzzzzzzzzzzzzzz', chars='z', vals=[-5]) == 0",
"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='zzzzzzzzzzzzzzzzzzzzzzzzzz', chars='z', vals=[1000]) == 26000",
"assert candidate(s='abcdefgxyz', chars='xyz', vals=[100, 100, 100]) == 328",
"assert candidate(s='programming', chars='pg', vals=[-5, -10]) == 91",
"assert candidate(s='zzzzzzzzzzzzzzzzzzzz', chars... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array arr and an integer k. The array 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:
You are given a 0-indexed integer array arr and an integer k. The array arr is circular. In other words, the first elem... | [
"assert candidate(arr=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=15) == 0",
"assert candidate(arr=[9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5], k=13) == 70",
"assert candidate(arr=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=15) == 0",
"assert candidate(arr=[9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5], k=13) == 70",
"assert candidate(arr=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 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 bi-directional graph with n vertices, where each vertex is labe... | You are an expert Python programmer. 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 bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph a... | [
"assert candidate(n=12, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0], [0, 6], [1, 7], [2, 8], [3, 9], [4, 10], [5, 11]]) == 4",
"assert candidate(n=15, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=12, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 0], [0, 6], [1, 7], [2, 8], [3, 9], [4, 10], [5, 11]]) == 4",
"assert candidate(n=15, edges=[[0, 1], [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:\nYou are given two 0-indexed integer arrays nums1 and nums2 of the same len... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two 0-indexed integer arrays nums1 and nums2 of the same length. A pair of indices (i,j) is called beauti... | [
"assert candidate(nums1=[10, 5, 7, 3, 8, 6], nums2=[6, 8, 4, 5, 7, 9]) == [1, 5]",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], nums2=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == [0, 1]",
"assert candidate(nums1=[1, 3, 5, 7, 9, 11, 13], nums2=[2, 4, 6, 8, 10, 12, 14]) == [0, 1]",
"assert candidate... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[10, 5, 7, 3, 8, 6], nums2=[6, 8, 4, 5, 7, 9]) == [1, 5]",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], nums2=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11]) == [0, 1]",
"assert candidate(nums1=[1, 3, 5, 7, 9, 11, 13], nums2=[2, 4, 6, 8, 10, 12, 14]) == [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 0-indexed integer array nums. There exists an array arr 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:
You are given a 0-indexed integer array nums. There exists an array arr of length nums.length, where arr[i] is the sum ... | [
"assert candidate(nums=[1, 1, 1, 1, 1]) == [10, 7, 6, 7, 10]",
"assert candidate(nums=[9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 1]) == [10, 7, 6, 7, 10]",
"assert candidate(nums=[9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 3... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums and an integer p. Find p pair... | You are an expert Python programmer. 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 integer array nums and an integer p. Find p pairs of indices of nums such that the maximum di... | [
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10], p=5) == 0",
"assert candidate(nums=[1, 1, 1, 1, 1, 1], p=2) == 0",
"assert candidate(nums=[1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991], p=5) == 1",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10], p=5) == 0",
"assert candidate(nums=[1, 1, 1, 1, 1, 1], p=2) == 0",
"assert candidate(nums=[1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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, which contains distinct elements 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:
You are given an integer array nums, which contains distinct elements and an integer k.
A subset is called a k-Free sub... | [
"assert candidate(nums=[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45], k=3) == 1597",
"assert candidate(nums=[4, 8, 12, 16, 20, 24, 28, 32, 36, 40], k=4) == 144",
"assert candidate(nums=[1, 3, 5, 7, 9, 11], k=2) == 21",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45], k=3) == 1597",
"assert candidate(nums=[4, 8, 12, 16, 20, 24, 28, 32, 36, 40], k=4) == 144",
"assert candidate(nums=[1, 3, 5, 7, 9, 11], k=2) == 21",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWe define the conversion array conver of an array arr as follows:\n\nconve... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
We define the conversion array conver of an array arr as follows:
conver[i] = arr[i] + max(arr[0..i]) where max(arr[0.... | [
"assert candidate(nums=[1, 2, 3, 4, 5]) == [2, 6, 12, 20, 30]",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [20, 39, 57, 74, 90, 105, 119, 132, 144, 155]",
"assert candidate(nums=[5, 3, 9, 2, 8, 1, 7, 6, 4, 10]) == [10, 18, 36, 47, 64, 74, 90, 105, 118, 138]",
"assert candidate(nums=[25, 24, 23... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5]) == [2, 6, 12, 20, 30]",
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [20, 39, 57, 74, 90, 105, 119, 132, 144, 155]",
"assert candidate(nums=[5, 3, 9, 2, 8, 1, 7, 6, 4, 10]) == [10, 18, 36, 47, 64, 74, 90, 105, 118, 138]",
"assert... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string word to which you can insert letters \"a\", \"b\" or \"c\" ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string word to which you can insert letters "a", "b" or "c" anywhere and any number of times, return the minimu... | [
"assert candidate(word='aab') == 3",
"assert candidate(word='acbacbacb') == 9",
"assert candidate(word='aabcbc') == 3",
"assert candidate(word='bcaabc') == 3",
"assert candidate(word='bbbb') == 8",
"assert candidate(word='bbbbbb') == 12",
"assert candidate(word='aaabbbccc') == 12",
"assert candidate(w... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='aab') == 3",
"assert candidate(word='acbacbacb') == 9",
"assert candidate(word='aabcbc') == 3",
"assert candidate(word='bcaabc') == 3",
"assert candidate(word='bbbb') == 8",
"assert candidate(word='bbbbbb') == 12",
"assert candidate(word='aaabbbcc... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 exists an undirected and unrooted tree with n nodes indexed from 0 t... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There exists an undirected and unrooted tree with n nodes indexed from 0 to n - 1. You are given the integer n and a 2D... | [
"assert candidate(n=7, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]], price=[100, 200, 300, 400, 500, 600, 700], trips=[[0, 3], [1, 6], [2, 4], [3, 5], [4, 6]]) == 4350",
"assert candidate(n=8, edges=[[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7]], price=[2, 4, 6, 8, 10, 12, 14, 16], trips=[[0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=7, edges=[[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]], price=[100, 200, 300, 400, 500, 600, 700], trips=[[0, 3], [1, 6], [2, 4], [3, 5], [4, 6]]) == 4350",
"assert candidate(n=8, edges=[[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7]], price=[2, 4, 6, 8, 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:\nYou are given an integer n. Consider an equilateral triangle of side lengt... | You are an expert Python programmer. 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 n. Consider an equilateral triangle of side length n, broken up into n2 unit equilateral trian... | [
"assert candidate(n=30) == [[1, 1], [30, 1], [30, 3], [30, 5], [30, 7], [30, 9], [30, 11], [30, 13], [30, 15], [30, 17], [30, 19], [30, 21], [30, 23], [30, 25], [30, 27], [30, 29], [30, 31], [30, 33], [30, 35], [30, 37], [30, 39], [30, 41], [30, 43], [30, 45], [30, 47], [30, 49], [30, 51], [30, 53], [30, 55], [30, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=30) == [[1, 1], [30, 1], [30, 3], [30, 5], [30, 7], [30, 9], [30, 11], [30, 13], [30, 15], [30, 17], [30, 19], [30, 21], [30, 23], [30, 25], [30, 27], [30, 29], [30, 31], [30, 33], [30, 35], [30, 37], [30, 39], [30, 41], [30, 43], [30, 45], [30, 47], [30, 49], [30, 51], [30,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums containing n integers, find the beauty of each... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums containing n integers, find the beauty of each subarray of size k.
The beauty of a subarray... | [
"assert candidate(nums=[0, -1, 1, -2, 2, -3, 3, -4, 4], k=4, x=2) == [-1, -1, -2, -2, -3, -3]",
"assert candidate(nums=[49, 48, 47, 46, 45, 44, 43, 42, 41, 40], k=5, x=2) == [0, 0, 0, 0, 0, 0]",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=3, x=2) == [0, 0, 0, 0, 0, 0, 0, 0]",
"assert candidate(n... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[0, -1, 1, -2, 2, -3, 3, -4, 4], k=4, x=2) == [-1, -1, -2, -2, -3, -3]",
"assert candidate(nums=[49, 48, 47, 46, 45, 44, 43, 42, 41, 40], k=5, x=2) == [0, 0, 0, 0, 0, 0]",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=3, x=2) == [0, 0, 0, 0, 0, 0, 0, 0... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed array nums consisiting of positive integers. 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 are given a 0-indexed array nums consisiting of positive integers. You can do the following operation on the array ... | [
"assert candidate(nums=[3, 6, 9, 12, 15, 18, 21]) == -1",
"assert candidate(nums=[4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256]) == 15",
"assert candidate(nums=[5, 5, 5, 5]) == -1",
"assert candidate(nums=[1, 1, 1, 1]) == 0",
"assert candidate(nums=[5, 10, 15, 20, 25, 30]) == -1",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[3, 6, 9, 12, 15, 18, 21]) == -1",
"assert candidate(nums=[4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256]) == 15",
"assert candidate(nums=[5, 5, 5, 5]) == -1",
"assert candidate(nums=[1, 1, 1, 1]) == 0",
"assert candidate(nums=[5, 10, 15,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer n which is the length of a 0-indexed array 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 n which is the length of a 0-indexed array nums, and a 0-indexed 2D-array ranges, which is a l... | [
"assert candidate(n=1000000, ranges=[[0, 100000], [200000, 300000], [400000, 500000], [600000, 700000], [800000, 900000]]) == [[100001, 199999], [300001, 399999], [500001, 599999], [700001, 799999], [900001, 999999]]",
"assert candidate(n=1000, ranges=[[0, 100], [200, 300], [400, 500], [600, 700], [800, 900], [95... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=1000000, ranges=[[0, 100000], [200000, 300000], [400000, 500000], [600000, 700000], [800000, 900000]]) == [[100001, 199999], [300001, 399999], [500001, 599999], [700001, 799999], [900001, 999999]]",
"assert candidate(n=1000, ranges=[[0, 100], [200, 300], [400, 500], [600... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed 2D matrix grid of size m x n, where (r, c) repre... | You are an expert Python programmer. 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 2D matrix grid of size m x n, where (r, c) represents:
A land cell if grid[r][c] = 0, or
A w... | [
"assert candidate(grid=[[10, 0, 10], [0, 0, 0], [10, 0, 10]]) == 10",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 0], [0, 6, 7, 8, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 45",
"assert candidate(grid=[[0, 0, 0, 0, 0], [0, 0, 9, 0, 0], [0, 9, 0, 9, 0], [0, 0, 9, 0, 0], [0, 0, 0, 0, 0]]) == 9",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[10, 0, 10], [0, 0, 0], [10, 0, 10]]) == 10",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 0], [0, 6, 7, 8, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) == 45",
"assert candidate(grid=[[0, 0, 0, 0, 0], [0, 0, 9, 0, 0], [0, 9, 0, 9, 0], [0, 0, 9, 0, 0], ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums containing distinct numbers, and you 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:
You are given an integer array nums containing distinct numbers, and you can perform the following operations until the... | [
"assert candidate(nums=[5, 2, 6, 1, 4]) == 11",
"assert candidate(nums=[5, 1, 9, 3, 7]) == 9",
"assert candidate(nums=[1000000000, -1000000000, 500000000, -500000000]) == 7",
"assert candidate(nums=[10, -5, 3, 8, 2]) == 9",
"assert candidate(nums=[-5, 10, 0, 7, -3]) == 9",
"assert candidate(nums=[7, 14, 2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 2, 6, 1, 4]) == 11",
"assert candidate(nums=[5, 1, 9, 3, 7]) == 9",
"assert candidate(nums=[1000000000, -1000000000, 500000000, -500000000]) == 7",
"assert candidate(nums=[10, -5, 3, 8, 2]) == 9",
"assert candidate(nums=[-5, 10, 0, 7, -3]) == 9",
"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array arr, and an m x n integer matrix m... | You are an expert Python programmer. 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 integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers... | [
"assert candidate(arr=[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], mat=[[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]]) == 4",
"assert candidate(arr=[25, 1, 24, 2, 23, 3, 22, 4, 21, 5, 20, 6, 19, 7, 18, 8, 17, 9,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=[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], mat=[[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]]) == 4",
"assert candidate(arr=[25, 1, 24, 2, 23, 3, 22, 4, 21, 5, 20, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array start where start = [startX, startY] represents 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 are given an array start where start = [startX, startY] represents your initial position (startX, startY) in a 2D s... | [
"assert candidate(start=[5, 5], target=[150, 150], specialRoads=[[10, 10, 15, 15, 10], [15, 15, 20, 20, 12], [20, 20, 25, 25, 14], [25, 25, 30, 30, 16], [30, 30, 35, 35, 18], [35, 35, 40, 40, 20], [40, 40, 45, 45, 22], [45, 45, 50, 50, 24], [50, 50, 55, 55, 26], [55, 55, 60, 60, 28], [60, 60, 65, 65, 30], [65, 65, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(start=[5, 5], target=[150, 150], specialRoads=[[10, 10, 15, 15, 10], [15, 15, 20, 20, 12], [20, 20, 25, 25, 14], [25, 25, 30, 30, 16], [30, 30, 35, 35, 18], [35, 35, 40, 40, 20], [40, 40, 45, 45, 22], [45, 45, 50, 50, 24], [50, 50, 55, 55, 26], [55, 55, 60, 60, 28], [60, 60, 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:\nA string is beautiful if:\n\nIt consists of the first k letters of the Eng... | You are an expert Python programmer. 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 string is beautiful if:
It consists of the first k letters of the English lowercase alphabet.
It does not contain an... | [
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', k=26) == 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyzab'",
"assert candidate(s='zzzz', k=4) == ''",
"assert candidate(s='zzzzzzzzzz', k=26) == ''",
"assert candidate(s='xyz', k=26) == 'xza'",
"assert candidate(s='abcdcba', k=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', k=26) == 'aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyzab'",
"assert candidate(s='zzzz', k=4) == ''",
"assert candidate(s='zzzzzzzzzz', k=26) == ''",
"assert candidate(s='xyz', k=26) == 'xza'",
"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 two positive integers m and n which are the height and width of a 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:
Given two positive integers m and n which are the height and width of a 0-indexed 2D-array board, a pair of positive in... | [
"assert candidate(m=4, n=5, r=1, c=1) == [[-1, -1, -1, -1, -1], [-1, 0, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]",
"assert candidate(m=3, n=5, r=1, c=0) == [[-1, -1, -1, -1, -1], [0, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]",
"assert candidate(m=4, n=4, r=3, c=3) == [[-1, -1, -1, -1], [-1, -1, -1,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(m=4, n=5, r=1, c=1) == [[-1, -1, -1, -1, -1], [-1, 0, -1, -1, -1], [-1, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]",
"assert candidate(m=3, n=5, r=1, c=0) == [[-1, -1, -1, -1, -1], [0, -1, -1, -1, -1], [-1, -1, -1, -1, -1]]",
"assert candidate(m=4, n=4, r=3, c=3) == [[-1, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer n representing an array colors of length n where ... | You are an expert Python programmer. 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 n representing an array colors of length n where all elements are set to 0's meaning uncolored... | [
"assert candidate(n=5, queries=[[0, 1], [1, 1], [2, 1], [3, 1], [4, 1]]) == [0, 1, 2, 3, 4]",
"assert candidate(n=20, queries=[[0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [9, 5], [10, 5], [11, 5], [12, 5], [13, 5], [14, 5], [15, 5], [16, 5], [17, 5], [18, 5], [19, 5]]) == [0, 1, 2, 3, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=5, queries=[[0, 1], [1, 1], [2, 1], [3, 1], [4, 1]]) == [0, 1, 2, 3, 4]",
"assert candidate(n=20, queries=[[0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [9, 5], [10, 5], [11, 5], [12, 5], [13, 5], [14, 5], [15, 5], [16, 5], [17, 5], [18, 5], [19... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer n representing the number of nodes in a perfect b... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer n representing the number of nodes in a perfect binary tree consisting of nodes numbered from ... | [
"assert candidate(n=63, cost=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]) =... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=63, cost=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 5... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed 2D integer array nums. Initially, your score 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 a 0-indexed 2D integer array nums. Initially, your score is 0. Perform the following operations until the... | [
"assert candidate(nums=[[99, 98, 97], [96, 95, 94], [93, 92, 91], [90, 89, 88], [87, 86, 85]]) == 294",
"assert candidate(nums=[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 4",
"assert candidate(nums=[[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",
"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[[99, 98, 97], [96, 95, 94], [93, 92, 91], [90, 89, 88], [87, 86, 85]]) == 294",
"assert candidate(nums=[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 4",
"assert candidate(nums=[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums of length n and an integer k.... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums of length n and an integer k. In an operation, you can choose an element a... | [
"assert candidate(nums=[1000000000, 500000000, 250000000, 125000000, 62500000], k=7) == 128312147936",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500], k=4) == 24572",
"assert candidate(nums=[999999999, 999999999, 999999999, 999999999], k=15) == 327684529... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1000000000, 500000000, 250000000, 125000000, 62500000], k=7) == 128312147936",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500], k=4) == 24572",
"assert candidate(nums=[999999999, 999999999, 999999999, 99999... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums representing the strength 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:
You are given a 0-indexed integer array nums representing the strength of some heroes. The power of a group of heroes i... | [
"assert candidate(nums=[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == 161550",
"assert candidate(nums=[1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 473671145",
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 169593000",
"assert candidate(nums=[5, 15, 25, 35, 45, 5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]) == 161550",
"assert candidate(nums=[1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]) == 473671145",
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 169593000",
"assert candidate... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nA 0-indexed array derived with length n is derived by computing the bitwis... | You are an expert Python programmer. 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 0-indexed array derived with length n is derived by computing the bitwise XOR (⊕) of adjacent values in a binary arra... | [
"assert candidate(derived=[1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]) == True",
"assert candidate(derived=[1, 0, 1, 1, 0, 1, 1, 0]) == False",
"assert candidate(derived=[0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1]) == True",
"assert candidate(derived=[0, 0, 0, 0, 0, 0, 0, 0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(derived=[1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]) == True",
"assert candidate(derived=[1, 0, 1, 1, 0, 1, 1, 0]) == False",
"assert candidate(derived=[0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1]) == True",
"assert candidate(derive... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 m x n matrix grid consisting of positive integer... | You are an expert Python programmer. 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 m x n matrix grid consisting of positive integers.
You can start at any cell in the first col... | [
"assert candidate(grid=[[1, 2, 3, 4, 5], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15], [20, 19, 18, 17, 16], [21, 22, 23, 24, 25]]) == 4",
"assert candidate(grid=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1], [2, 4, 6, 8, 10, 1, 3, 5,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 2, 3, 4, 5], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15], [20, 19, 18, 17, 16], [21, 22, 23, 24, 25]]) == 4",
"assert candidate(grid=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1], [2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer n. There is an undirected graph with n vertices, ... | You are an expert Python programmer. 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 n. There is an undirected graph with n vertices, numbered from 0 to n - 1. You are given a 2D ... | [
"assert candidate(n=20, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 6], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 12]]) == 0",
"assert candidate(n=30, edges=[[0, 1], [1, 2], [2, 0], [3, 4], [4, 5], [5, 3], [6, 7], [7, 8], ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=20, edges=[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 6], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [19, 12]]) == 0",
"assert candidate(n=30, edges=[[0, 1], [1, 2], [2, 0], [3, 4], [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:\nYou are given an undirected weighted connected graph containing n nodes la... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an undirected weighted connected graph containing n nodes labeled from 0 to n - 1, and an integer array e... | [
"assert candidate(n=8, edges=[[0, 1, 2], [1, 2, -1], [2, 3, 3], [3, 4, -1], [4, 5, -1], [5, 6, -1], [6, 7, -1], [7, 0, -1], [0, 4, -1], [1, 5, -1], [2, 6, -1], [3, 7, -1]], source=0, destination=6, target=25) == [[0, 1, 2], [1, 2, 1], [2, 3, 3], [3, 4, 1], [4, 5, 1], [5, 6, 17], [6, 7, 2000000000], [7, 0, 200000000... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=8, edges=[[0, 1, 2], [1, 2, -1], [2, 3, 3], [3, 4, -1], [4, 5, -1], [5, 6, -1], [6, 7, -1], [7, 0, -1], [0, 4, -1], [1, 5, -1], [2, 6, -1], [3, 7, -1]], source=0, destination=6, target=25) == [[0, 1, 2], [1, 2, 1], [2, 3, 3], [3, 4, 1], [4, 5, 1], [5, 6, 17], [6, 7, 20000000... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums and two integers x and y. In ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums and two integers x and y. In one operation, you must choose an index i suc... | [
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], x=300, y=100) == 6",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], x=2, y=1) == 7",
"assert candidate(nums=[500000000, 400000000, 300000000, 200000000, 100000000], x=1000000000, y=1) == 5",
"assert candidate(nums=[3, 6, 9, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], x=300, y=100) == 6",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], x=2, y=1) == 7",
"assert candidate(nums=[500000000, 400000000, 300000000, 200000000, 100000000], x=1000000000, y=1) == 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 a 0-indexed string s and a dictionary of words dictionary. Y... | You are an expert Python programmer. 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 and a dictionary of words dictionary. You have to break s into one or more non-overl... | [
"assert candidate(s='abc', dictionary=['a', 'b', 'c']) == 0",
"assert candidate(s='sayhelloworld', dictionary=['hello', 'world']) == 3",
"assert candidate(s='helloworld', dictionary=['hello', 'wor', 'ld', 'hell', 'world', 'owor', 'orl', 'rld', 'hel', 'wo', 'rld', 'worl', 'hello', 'world', 'worldly', 'or', 'wor'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abc', dictionary=['a', 'b', 'c']) == 0",
"assert candidate(s='sayhelloworld', dictionary=['hello', 'world']) == 3",
"assert candidate(s='helloworld', dictionary=['hello', 'wor', 'ld', 'hell', 'world', 'owor', 'orl', 'rld', 'hel', 'wo', 'rld', 'worl', 'hello', 'world... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 integer array nums representing the score of stu... | You are an expert Python programmer. 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 integer array nums representing the score of students in an exam. The teacher would like to f... | [
"assert candidate(nums=[-1, 0, 1]) == 1",
"assert candidate(nums=[0, 0, 0, 0, 0, 0, 0]) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4]) == 8709120",
"assert candidate(nums=[-1, 0, 0, 0, 0, 0, -2]) == 2",
"assert candidate(nums=[9, -9, 8, -8, 7, -7]) == 36288",
"assert candidate(... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[-1, 0, 1]) == 1",
"assert candidate(nums=[0, 0, 0, 0, 0, 0, 0]) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4]) == 8709120",
"assert candidate(nums=[-1, 0, 0, 0, 0, 0, -2]) == 2",
"assert candidate(nums=[9, -9, 8, -8, 7, -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 a 2D grid of size m x n, you should find the matrix answer of size m... | You are an expert Python programmer. 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 2D grid of size m x n, you should find the matrix answer of size m x n.
The cell answer[r][c] is calculated by ... | [
"assert candidate(grid=[[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]) == [[4, 3, 2, 1, 0], [3, 2, 1, 0, 1], [2, 1, 0, 1, 2], [1, 0, 1, 2, 3], [0, 1, 2, 3, 4]]",
"assert candidate(grid=[[7, 6, 5, 4], [8, 7, 6, 5], [9, 8, 7, 6], [10, 9, 8, 7]]) == [[1, 1, 1, 0], [1, 0, 0, 1],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7], [4, 5, 6, 7, 8], [5, 6, 7, 8, 9]]) == [[4, 3, 2, 1, 0], [3, 2, 1, 0, 1], [2, 1, 0, 1, 2], [1, 0, 1, 2, 3], [0, 1, 2, 3, 4]]",
"assert candidate(grid=[[7, 6, 5, 4], [8, 7, 6, 5], [9, 8, 7, 6], [10, 9, 8, 7]]) == [[1, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed binary string s of length n on which you can app... | You are an expert Python programmer. 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 binary string s of length n on which you can apply two types of operations:
Choose an index ... | [
"assert candidate(s='1111000011110000111100001111000011110000111100001111000011110000') == 256",
"assert candidate(s='010101010101010101010101010101') == 225",
"assert candidate(s='1001001001') == 16",
"assert candidate(s='00000000000000000000') == 0",
"assert candidate(s='111111000000111111') == 12",
"as... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='1111000011110000111100001111000011110000111100001111000011110000') == 256",
"assert candidate(s='010101010101010101010101010101') == 225",
"assert candidate(s='1001001001') == 16",
"assert candidate(s='00000000000000000000') == 0",
"assert candidate(s='11111... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a positive integer n which is the number of nodes of a 0-ind... | You are an expert Python programmer. 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 positive integer n which is the number of nodes of a 0-indexed undirected weighted connected graph and ... | [
"assert candidate(n=20, edges=[[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 11, 1], [11, 12, 1], [12, 13, 1], [13, 14, 1], [14, 15, 1], [15, 16, 1], [16, 17, 1], [17, 18, 1], [18, 19, 1], [0, 19, 5], [5, 14, 3], [7, 13, 2], [9, 11, 4], [1, 18, 6... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=20, edges=[[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [7, 8, 1], [8, 9, 1], [9, 10, 1], [10, 11, 1], [11, 12, 1], [12, 13, 1], [13, 14, 1], [14, 15, 1], [15, 16, 1], [16, 17, 1], [17, 18, 1], [18, 19, 1], [0, 19, 5], [5, 14, 3], [7, 13, 2], ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer n and a 0-indexed 2D array queries where queries[... | You are an expert Python programmer. 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 n and a 0-indexed 2D array queries where queries[i] = [typei, indexi, vali].
Initially, there ... | [
"assert candidate(n=3, queries=[[0, 0, 10], [1, 0, 20], [0, 1, 30], [1, 1, 40], [0, 2, 50], [1, 2, 60], [0, 0, 70], [1, 0, 80]]) == 590",
"assert candidate(n=10, queries=[[0, 0, 100], [1, 1, 200], [0, 2, 300], [1, 3, 400], [0, 4, 500], [1, 0, 600], [0, 5, 700], [1, 2, 800], [0, 6, 900], [1, 3, 1000]]) == 43100",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=3, queries=[[0, 0, 10], [1, 0, 20], [0, 1, 30], [1, 1, 40], [0, 2, 50], [1, 2, 60], [0, 0, 70], [1, 0, 80]]) == 590",
"assert candidate(n=10, queries=[[0, 0, 100], [1, 1, 200], [0, 2, 300], [1, 3, 400], [0, 4, 500], [1, 0, 600], [0, 5, 700], [1, 2, 800], [0, 6, 900], [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 digit string s that consists of digits from 0 to 9.\nA str... | You are an expert Python programmer. 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 digit string s that consists of digits from 0 to 9.
A string is called semi-repetitive if there is at m... | [
"assert candidate(s='12345543211234554321') == 10",
"assert candidate(s='656565656565656') == 15",
"assert candidate(s='00112233445566778899') == 4",
"assert candidate(s='0000000000000000000000000000000000000000') == 2",
"assert candidate(s='5544332211001122334455667788990011223344556677889900') == 4",
"a... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='12345543211234554321') == 10",
"assert candidate(s='656565656565656') == 15",
"assert candidate(s='00112233445566778899') == 4",
"assert candidate(s='0000000000000000000000000000000000000000') == 2",
"assert candidate(s='5544332211001122334455667788990011223... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.