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:\nYou are given an 0-indexed integer array prices where prices[i] denotes th... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an 0-indexed integer array prices where prices[i] denotes the number of coins needed to purchase the (i +... | [
"assert candidate(prices=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(prices=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums.\nYou can perform any number ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums.
You can perform any number of operations, where each operation involves s... | [
"assert candidate(nums=[1, 2, 4, 3, 5]) == 4",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20",
"assert candidate(nums=[7, 7, 7, 7, 7]) == 5",
"assert candidate(nums=[100000, 100000, 100000, 100000, 100000]) == 5",
"assert candidate(nums=[100, 10, 20, 30, 40, 50, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 4, 3, 5]) == 4",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 20",
"assert candidate(nums=[7, 7, 7, 7, 7]) == 5",
"assert candidate(nums=[100000, 100000, 100000, 100000, 100000]) == 5",
"assert candidate(nu... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s and a positive integer k.\nLet vowels and consona... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s and a positive integer k.
Let vowels and consonants be the number of vowels and consonants in ... | [
"assert candidate(s='b', k=1) == 0",
"assert candidate(s='a', k=1) == 0",
"assert candidate(s='aaeeiioouubbbccddffgg', k=10) == 1",
"assert candidate(s='bcdfg', k=1) == 0",
"assert candidate(s='aeiouaeiouaeiouaeiou', k=25) == 0",
"assert candidate(s='xylophoneaeiouaeiou', k=12) == 1",
"assert candidate(... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='b', k=1) == 0",
"assert candidate(s='a', k=1) == 0",
"assert candidate(s='aaeeiioouubbbccddffgg', k=10) == 1",
"assert candidate(s='bcdfg', k=1) == 0",
"assert candidate(s='aeiouaeiouaeiouaeiou', k=25) == 0",
"assert candidate(s='xylophoneaeiouaeiou', k=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed array of positive integers nums and a positive 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 array of positive integers nums and a positive integer limit.
In one operation, you can choos... | [
"assert candidate(nums=[5, 9, 2, 8, 1, 7, 3, 6, 4, 10], limit=3) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"assert candidate(nums=[7, 7, 7, 7, 7, 7, 7, 7, 7, 7], limit=1) == [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]",
"assert candidate(nums=[10, 20, 30, 40, 50], limit=5) == [10, 20, 30, 40, 50]",
"assert candidate(nums=[1, 3... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 9, 2, 8, 1, 7, 3, 6, 4, 10], limit=3) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"assert candidate(nums=[7, 7, 7, 7, 7, 7, 7, 7, 7, 7], limit=1) == [7, 7, 7, 7, 7, 7, 7, 7, 7, 7]",
"assert candidate(nums=[10, 20, 30, 40, 50], limit=5) == [10, 20, 30, 40, 50]",
"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nEach character of the English alphabet has been mapped to a digit as shown... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Each character of the English alphabet has been mapped to a digit as shown below.
A string is divisible if the sum of ... | [
"assert candidate(word='rotor') == 5",
"assert candidate(word='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij') == 232",
"assert candidate(word='pneumonoultramicroscopicsilicovolcanoconiosis') == 134",
"assert candidate(word='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='rotor') == 5",
"assert candidate(word='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij') == 232",
"assert candidate(word='pneumonoultramicroscopicsilicovolcanoconiosis') == 134",
"assert candidate(word='zzzzzzzzzzzzzzzzzzzzzzz... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 coins, representing the values 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 coins, representing the values of the coins available, and an integer target.
A... | [
"assert candidate(coins=[1, 1, 2, 2, 5, 5, 10, 10], target=50) == 1",
"assert candidate(coins=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512], target=1023) == 0",
"assert candidate(coins=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100], target=100) == 3",
"assert candidate(coins=[2, 6,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(coins=[1, 1, 2, 2, 5, 5, 10, 10], target=50) == 1",
"assert candidate(coins=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512], target=1023) == 0",
"assert candidate(coins=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100], target=100) == 3",
"as... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string word and an integer k.\nA substring s of word is co... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string word and an integer k.
A substring s of word is complete if:
Each character in s occurs exactly... | [
"assert candidate(word='abcabcabcabcabcabc', k=3) == 10",
"assert candidate(word='abcdabcdeabcdabcde', k=2) == 0",
"assert candidate(word='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', k=1) == 50",
"assert candidate(word='a', k=1) == 1",
"assert candidate(word='aaaabbbbcccc', k=4) == 6",
"assert ca... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='abcabcabcabcabcabc', k=3) == 10",
"assert candidate(word='abcdabcdeabcdabcde', k=2) == 0",
"assert candidate(word='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', k=1) == 50",
"assert candidate(word='a', k=1) == 1",
"assert candidate(word='aaaabbbbcc... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 2D array of integers queries, wh... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed string s, and a 2D array of integers queries, where queries[i] = [li, ri] indicates a substri... | [
"assert candidate(s='abacabadabacaba', queries=[[0, 14], [2, 10], [5, 7], [8, 12], [0, 6]]) == [50, 20, 3, 8, 14]",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', queries=[[0, 25], [26, 51], [0, 51], [13, 25], [28, 40], [10, 30]]) == [26, 26, 78, 13, 13, 21]",
"assert candidate(s='a... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abacabadabacaba', queries=[[0, 14], [2, 10], [5, 7], [8, 12], [0, 6]]) == [50, 20, 3, 8, 14]",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', queries=[[0, 25], [26, 51], [0, 51], [13, 25], [28, 40], [10, 30]]) == [26, 26, 78, 13, 13, 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:\nThere is a company with n branches across the country, some of which are c... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is a company with n branches across the country, some of which are connected by roads. Initially, all branches ar... | [
"assert candidate(n=9, maxDistance=15, roads=[[0, 1, 5], [0, 2, 6], [0, 3, 7], [1, 4, 2], [1, 5, 3], [2, 4, 4], [2, 6, 5], [3, 5, 1], [3, 7, 2], [4, 6, 3], [4, 8, 4], [5, 7, 6], [6, 8, 7], [7, 8, 1]]) == 198",
"assert candidate(n=6, maxDistance=7, roads=[[0, 1, 2], [0, 2, 3], [1, 3, 1], [2, 4, 2], [3, 4, 2], [3, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=9, maxDistance=15, roads=[[0, 1, 5], [0, 2, 6], [0, 3, 7], [1, 4, 2], [1, 5, 3], [2, 4, 4], [2, 6, 5], [3, 5, 1], [3, 7, 2], [4, 6, 3], [4, 8, 4], [5, 7, 6], [6, 8, 7], [7, 8, 1]]) == 198",
"assert candidate(n=6, maxDistance=7, roads=[[0, 1, 2], [0, 2, 3], [1, 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:\nGiven a 0-indexed integer array nums and an integer d, return the number o... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a 0-indexed integer array nums and an integer d, return the number of triplets (i, j, k) such that i < j < k and ... | [
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], d=10) == 0",
"assert candidate(nums=[8, 16, 24, 32, 40, 48, 56, 64, 72, 80], d=8) == 120",
"assert candidate(nums=[123, 456, 789, 1011, 1213, 1415], d=11) == 1",
"assert candidate(nums=[33, 66, 99, 132, 165, 198, 231, 264, 29... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], d=10) == 0",
"assert candidate(nums=[8, 16, 24, 32, 40, 48, 56, 64, 72, 80], d=8) == 120",
"assert candidate(nums=[123, 456, 789, 1011, 1213, 1415], d=11) == 1",
"assert candidate(nums=[33, 66, 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 nums of size n where n is a multiple of 3 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 nums of size n where n is a multiple of 3 and a positive integer k.
Divide the array num... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], k=2) == [[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]]",
"assert candidate(nums=[7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], k=2) == [[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]]",
"assert candidate(nums=[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 a 0-indexed integer array nums having length n.\nYou are all... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums having length n.
You are allowed to perform a special move any number of t... | [
"assert candidate(nums=[123, 456, 789, 101, 202]) == 1021",
"assert candidate(nums=[123456789, 987654321, 123456789, 987654321, 123456789]) == 1728402596",
"assert candidate(nums=[123, 321, 456, 654, 789, 987, 1010, 1111, 2222, 3333]) == 6320",
"assert candidate(nums=[1, 2, 3, 4, 5]) == 6",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[123, 456, 789, 101, 202]) == 1021",
"assert candidate(nums=[123456789, 987654321, 123456789, 987654321, 123456789]) == 1728402596",
"assert candidate(nums=[123, 321, 456, 654, 789, 987, 1010, 1111, 2222, 3333]) == 6320",
"assert candidate(nums=[1, 2, 3, 4, 5]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are at a fruit market with different types of exotic fruits on display... | You are an expert Python programmer. 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 at a fruit market with different types of exotic fruits on display.
You are given a 1-indexed array prices, whe... | [
"assert candidate(prices=[2, 3, 4, 5, 6]) == 6",
"assert candidate(prices=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 8",
"assert candidate(prices=[7, 4, 1, 6, 5, 8, 2, 3, 4, 1]) == 10",
"assert candidate(prices=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 4",
"asser... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(prices=[2, 3, 4, 5, 6]) == 6",
"assert candidate(prices=[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 8",
"assert candidate(prices=[7, 4, 1, 6, 5, 8, 2, 3, 4, 1]) == 10",
"assert candidate(prices=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed array of positive integers nums.\nA subarray 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 array of positive integers nums.
A subarray of nums is called incremovable if nums becomes st... | [
"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]) == 325",
"assert candidate(nums=[5, 6, 7, 8, 9, 10, 8, 9, 10]) == 22",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4]) == 31",
"assert... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == 325",
"assert candidate(nums=[5, 6, 7, 8, 9, 10, 8, 9, 10]) == 22",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 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 undirected tree with n nodes labeled from 0 to n - 1, 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 undirected tree with n nodes labeled from 0 to n - 1, and rooted at node 0. You are given a 2D integer... | [
"assert candidate(edges=[[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11]], cost=[100, 50, 200, -10, -20, 300, 150, -5, -30, 25, 40, 60]) == [9000000, 9000000, 3600000, 7500, 15000, 720000, 1, 1, 1, 1, 1, 1]",
"assert candidate(edges=[[0, 1], [0, 2], [0, 3], [1, 4], [1, 5],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(edges=[[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [4, 9], [5, 10], [5, 11]], cost=[100, 50, 200, -10, -20, 300, 150, -5, -30, 25, 40, 60]) == [9000000, 9000000, 3600000, 7500, 15000, 720000, 1, 1, 1, 1, 1, 1]",
"assert candidate(edges=[[0, 1], [0, 2], ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s that consists of lowercase English letters.\nA st... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s that consists of lowercase English letters.
A string is called special if it is made up of onl... | [
"assert candidate(s='zzzzyzzzz') == 3",
"assert candidate(s='aaabbaaabbaa') == 2",
"assert candidate(s='abcdefabcdefabcdef') == 1",
"assert candidate(s='aaabbbcccddd') == 1",
"assert candidate(s='ppppqpppqqqpppp') == 3",
"assert candidate(s='aaabbbaaabbbaaabb') == 3",
"assert candidate(s='abcddcbaabcddc... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='zzzzyzzzz') == 3",
"assert candidate(s='aaabbaaabbaa') == 2",
"assert candidate(s='abcdefabcdefabcdef') == 1",
"assert candidate(s='aaabbbcccddd') == 1",
"assert candidate(s='ppppqpppqqqpppp') == 3",
"assert candidate(s='aaabbbaaabbbaaabb') == 3",
"a... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s that consists of lowercase English letters.\nA st... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s that consists of lowercase English letters.
A string is called special if it is made up of onl... | [
"assert candidate(s='aabbccddeeefff') == 1",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz') == -1",
"assert candidate(s='abcdabcabcd') == 1",
"assert candidate(s='abcdef') == -1",
"assert candidate(s='abcabcabc') == 1",
"assert candidate(s='abacabadabacaba') == 1",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aabbccddeeefff') == 1",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz') == -1",
"assert candidate(s='abcdabcabcd') == 1",
"assert candidate(s='abcdef') == -1",
"assert candidate(s='abcabcabc') == 1",
"assert candidate(s='abaca... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 having an even length n.\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 a 0-indexed string s having an even length n.
You are also given a 0-indexed 2D integer array, queries, w... | [
"assert candidate(s='thisisanoddlengthstring', queries=[[0, 4, 14, 19]]) == [False]",
"assert candidate(s='noonnoon', queries=[[0, 2, 5, 7], [1, 3, 4, 6]]) == [True, True]",
"assert candidate(s='abcdedcbaa', queries=[[0, 1, 8, 9], [2, 3, 6, 7], [1, 4, 5, 8]]) == [False, False, False]",
"assert candidate(s='ab... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='thisisanoddlengthstring', queries=[[0, 4, 14, 19]]) == [False]",
"assert candidate(s='noonnoon', queries=[[0, 2, 5, 7], [1, 3, 4, 6]]) == [True, True]",
"assert candidate(s='abcdedcbaa', queries=[[0, 1, 8, 9], [2, 3, 6, 7], [1, 4, 5, 8]]) == [False, False, False]",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums and a positive integer k.\nYo... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums and a positive integer k.
You can apply the following operation on the arr... | [
"assert candidate(nums=[1234567, 7654321, 111222333, 333222111, 444555666], k=987654321) == 20",
"assert candidate(nums=[1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1], k=1048575) == 1",
"assert candidate(nums=[3, 6, 9, 12, 15, 18, 21, 24, 27... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1234567, 7654321, 111222333, 333222111, 444555666], k=987654321) == 20",
"assert candidate(nums=[1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1], k=1048575) == 1",
"assert candidate(nums=[3, 6, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two positive integers x and y.\nIn one operation, you can do... | You are an expert Python programmer. 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 positive integers x and y.
In one operation, you can do one of the four following operations:
Divide... | [
"assert candidate(x=1234, y=88) == 27",
"assert candidate(x=1100, y=50) == 8",
"assert candidate(x=1111, y=5555) == 4444",
"assert candidate(x=2000, y=10000) == 8000",
"assert candidate(x=26, y=1) == 3",
"assert candidate(x=24, y=29) == 5",
"assert candidate(x=88, y=13) == 6",
"assert candidate(x=9876... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(x=1234, y=88) == 27",
"assert candidate(x=1100, y=50) == 8",
"assert candidate(x=1111, y=5555) == 4444",
"assert candidate(x=2000, y=10000) == 8000",
"assert candidate(x=26, y=1) == 3",
"assert candidate(x=24, y=29) == 5",
"assert candidate(x=88, y=13) ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is a 1-indexed 8 x 8 chessboard containing 3 pieces.\nYou are given ... | You are an expert Python programmer. 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 1-indexed 8 x 8 chessboard containing 3 pieces.
You are given 6 integers a, b, c, d, e, and f where:
(a, b)... | [
"assert candidate(a=1, b=1, c=7, d=7, e=5, f=5) == 1",
"assert candidate(a=1, b=1, c=3, d=5, e=7, f=7) == 2",
"assert candidate(a=3, b=3, c=6, d=6, e=5, f=5) == 1",
"assert candidate(a=2, b=2, c=5, d=5, e=3, f=3) == 1",
"assert candidate(a=1, b=8, c=8, d=1, e=5, f=5) == 2",
"assert candidate(a=3, b=3, c=6... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(a=1, b=1, c=7, d=7, e=5, f=5) == 1",
"assert candidate(a=1, b=1, c=3, d=5, e=7, f=7) == 2",
"assert candidate(a=3, b=3, c=6, d=6, e=5, f=5) == 1",
"assert candidate(a=2, b=2, c=5, d=5, e=3, f=3) == 1",
"assert candidate(a=1, b=8, c=8, d=1, e=5, f=5) == 2",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two 0-indexed integer arrays nums1 and nums2 of even 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 even length n.
You must remove n / 2 elements from nums1 ... | [
"assert candidate(nums1=[5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7], nums2=[1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3]) == 6",
"assert candidate(nums1=[1, 3, 5, 7, 9, 11], nums2=[2, 4, 6, 8, 10, 12]) == 6",
"assert candidate(nums1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], nu... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7], nums2=[1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3]) == 6",
"assert candidate(nums1=[1, 3, 5, 7, 9, 11], nums2=[2, 4, 6, 8, 10, 12]) == 6",
"assert candidate(nums1=[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 string s and an integer k.\nFirst, you are allowed to chan... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s and an integer k.
First, you are allowed to change at most one index in s to another lowercase... | [
"assert candidate(s='abcdefabcdef', k=4) == 3",
"assert candidate(s='abcdefghij', k=1) == 10",
"assert candidate(s='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', k=1) == 3",
"assert candidate(s='abcdefg', k=2) == 4",
"assert candidate(s='abcdefghij', k=5) == 2",
"assert candidate(s='abcabcabcabcabcabc', k=3) == 3"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcdefabcdef', k=4) == 3",
"assert candidate(s='abcdefghij', k=1) == 10",
"assert candidate(s='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', k=1) == 3",
"assert candidate(s='abcdefg', k=2) == 4",
"assert candidate(s='abcdefghij', k=5) == 2",
"assert candidate(s='... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 2D integer array edges representing a tree with n nodes, 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 2D integer array edges representing a tree with n nodes, numbered from 0 to n - 1, rooted at node 0, wh... | [
"assert candidate(edges=[[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11]], colors=[1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6]) == 1",
"assert candidate(edges=[[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [4, 11], [6, 12], [6, 13], [8, 14], [8, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(edges=[[0, 1], [1, 2], [1, 3], [2, 4], [2, 5], [3, 6], [3, 7], [4, 8], [5, 9], [6, 10], [7, 11]], colors=[1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6]) == 1",
"assert candidate(edges=[[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9], [4, 10], [4, 11], [6, 12],... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed string s, a string a, a string b, and an 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 string s, a string a, a string b, and an integer k.
An index i is beautiful if:
0 <= i <= s.... | [
"assert candidate(s='mississippi', a='issi', b='sip', k=4) == [4]",
"assert candidate(s='thisisaverylongstringwithmultiplesubstrings', a='long', b='string', k=10) == [11]",
"assert candidate(s='squirrelmysquirrelhouseohmysquirrel', a='squirrel', b='house', k=20) == [0, 10, 27]",
"assert candidate(s='mississip... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='mississippi', a='issi', b='sip', k=4) == [4]",
"assert candidate(s='thisisaverylongstringwithmultiplesubstrings', a='long', b='string', k=10) == [11]",
"assert candidate(s='squirrelmysquirrelhouseohmysquirrel', a='squirrel', b='house', k=20) == [0, 10, 27]",
"as... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed string s, a string a, a string b, and an 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 string s, a string a, a string b, and an integer k.
An index i is beautiful if:
0 <= i <= s.... | [
"assert candidate(s='abcdefghijabcdefghij', a='abc', b='def', k=10) == [0, 10]",
"assert candidate(s='xyzzxyzzxyzzxyzz', a='zz', b='xy', k=4) == [2, 6, 10, 14]",
"assert candidate(s='mississippi', a='iss', b='sis', k=2) == [1, 4]",
"assert candidate(s='qwertyuiopqwertyuiop', a='qwerty', b='uiop', k=4) == [10]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcdefghijabcdefghij', a='abc', b='def', k=10) == [0, 10]",
"assert candidate(s='xyzzxyzzxyzzxyzz', a='zz', b='xy', k=4) == [2, 6, 10, 14]",
"assert candidate(s='mississippi', a='iss', b='sis', k=2) == [1, 4]",
"assert candidate(s='qwertyuiopqwertyuiop', a='qwer... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 line chart consisting of n points connected by line segments. 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 a line chart consisting of n points connected by line segments. You are given a 1-indexed integer array y. The... | [
"assert candidate(y=[5, 3, 1, 3, 5, 3, 1, 3, 5, 3, 1, 3, 5, 3, 1, 3, 5, 3, 1, 3]) == 10",
"assert candidate(y=[1, 3, 5, 4, 6, 7, 8, 6, 4, 2, 3, 5, 7, 9]) == 5",
"assert candidate(y=[1, 1000000000, 2, 999999999, 3, 999999998, 4, 999999997, 5, 999999996]) == 9",
"assert candidate(y=[1, 2, 3, 4, 5, 6, 7, 8, 9, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(y=[5, 3, 1, 3, 5, 3, 1, 3, 5, 3, 1, 3, 5, 3, 1, 3, 5, 3, 1, 3]) == 10",
"assert candidate(y=[1, 3, 5, 4, 6, 7, 8, 6, 4, 2, 3, 5, 7, 9]) == 5",
"assert candidate(y=[1, 1000000000, 2, 999999999, 3, 999999998, 4, 999999997, 5, 999999996]) == 9",
"assert candidate(y=[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 containing positive integers.... | You are an expert Python programmer. 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 containing positive integers.
Your task is to minimize the length of nums ... | [
"assert candidate(nums=[2, 3, 4]) == 1",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 5",
"assert candidate(nums=[7, 14, 28, 35]) == 1",
"assert candidate(nums=[17, 17, 17, 34, 34, 34, 51, 51, 51, 68, 68, 68, 85, 85, 85, 102, 102, 102]) == 2",
"assert candidate(nums=[7, 13, 19, 25, 31, 37, 43, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 3, 4]) == 1",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 5",
"assert candidate(nums=[7, 14, 28, 35]) == 1",
"assert candidate(nums=[17, 17, 17, 34, 34, 34, 51, 51, 51, 68, 68, 68, 85, 85, 85, 102, 102, 102]) == 2",
"assert candidate(nums... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed array of integers nums of length n, and two posi... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed array of integers nums of length n, and two positive integers k and dist.
The cost of an arra... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k=10, dist=10) == 55",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], k=15, dist=15) == 120",
"assert candidate(nums=[1, 10, 2,... | 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], k=10, dist=10) == 55",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], k=15, dist=15) == 120",
"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 three positive integers n, x, and y.\nIn a city, there exist... | You are an expert Python programmer. 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 three positive integers n, x, and y.
In a city, there exist houses numbered 1 to n connected by n streets... | [
"assert candidate(n=2, x=1, y=2) == [2, 0]",
"assert candidate(n=5, x=2, y=4) == [10, 8, 2, 0, 0]",
"assert candidate(n=64, x=7, y=57) == [128, 132, 138, 144, 150, 156, 162, 166, 166, 164, 162, 160, 158, 156, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 52, 44, 36, 28, 20, 12, 4, 0, 0, 0, 0, 0, 0, 0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=2, x=1, y=2) == [2, 0]",
"assert candidate(n=5, x=2, y=4) == [10, 8, 2, 0, 0]",
"assert candidate(n=64, x=7, y=57) == [128, 132, 138, 144, 150, 156, 162, 166, 166, 164, 162, 160, 158, 156, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 52, 44, 36, 28, 20, 12,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string word containing lowercase English letters.\nTelepho... | You are an expert Python programmer. 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 word containing lowercase English letters.
Telephone keypads have keys mapped with distinct coll... | [
"assert candidate(word='ababababababababababababababababababababab') == 42",
"assert candidate(word='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzzzzzzzzzzzzzzzzz') == 136",
"assert candidate(word='abcdefghijklmnopqrstuvwxyzzzzzzzzzzzzzzzzzzzzzzzz') == 79",
"assert candidate(word='ppppppppppppp... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='ababababababababababababababababababababab') == 42",
"assert candidate(word='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzzzzzzzzzzzzzzzzzzzzzzzzz') == 136",
"assert candidate(word='abcdefghijklmnopqrstuvwxyzzzzzzzzzzzzzzzzzzzzzzzz') == 79",
"assert ca... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given three positive integers n, x, and y.\nIn a city, there exist... | You are an expert Python programmer. 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 three positive integers n, x, and y.
In a city, there exist houses numbered 1 to n connected by n streets... | [
"assert candidate(n=80, x=5, y=75) == [160, 164, 170, 176, 182, 186, 186, 184, 182, 180, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 36, 28, 20, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=80, x=5, y=75) == [160, 164, 170, 176, 182, 186, 186, 184, 182, 180, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 36, 28, 20, 12, 4, 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 an array of positive integers nums.\nYou need to select a su... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of positive integers nums.
You need to select a subset of nums which satisfies the following con... | [
"assert candidate(nums=[16, 4, 2, 8, 1, 32, 64, 128, 256, 512]) == 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, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]) == 1",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[16, 4, 2, 8, 1, 32, 64, 128, 256, 512]) == 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, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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.\nIn one ope... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed integer array nums and an integer k.
In one operation, you can pick any index i of nums such ... | [
"assert candidate(nums=[2147483647, 2147483647, 2147483647, 2147483647, 2147483647], k=100000) == 0",
"assert candidate(nums=[1, 3, 5, 7, 9, 11], k=3) == 1",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], k=10) == 7",
"assert candidate(nums=[1000, 2000, 3000, 4000, 5000, 6000,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2147483647, 2147483647, 2147483647, 2147483647, 2147483647], k=100000) == 0",
"assert candidate(nums=[1, 3, 5, 7, 9, 11], k=3) == 1",
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29], k=10) == 7",
"assert candidate(nums=[1000, 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 nums of length n and a positive integer k.\nA subar... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array nums of length n and a positive integer k.
A subarray of nums is called good if the absolute dif... | [
"assert candidate(nums=[5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=1) == 29",
"assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10], k=50) == 450",
"assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40], k=100) == 550",
"assert candidate(nums=[5, 5, 5, 5, 5], k=0) ==... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=1) == 29",
"assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10], k=50) == 450",
"assert candidate(nums=[100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0, -10, -20, -30, -40], k=100) == 550",
"assert candidate(nu... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 2D array points of size n x 2 representing integer coordin... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 2D array points of size n x 2 representing integer coordinates of some points on a 2D-plane, where poin... | [
"assert candidate(points=[[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [1, 8], [2, 8], [3, 8], [4, 8], [5, 8]]) == 22",
"assert candidate(points=[[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5]]) == 4",
"assert candidate(points=[[-1, -1], [-2, -2], [-3, -3], [-4, -4], [-5, -5... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(points=[[1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [1, 9], [2, 9], [3, 9], [4, 9], [5, 9], [1, 8], [2, 8], [3, 8], [4, 8], [5, 8]]) == 22",
"assert candidate(points=[[-1, 1], [-2, 2], [-3, 3], [-4, 4], [-5, 5]]) == 4",
"assert candidate(points=[[-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 a 0-indexed string word and an integer k.\nAt every second, ... | You are an expert Python programmer. 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 word and an integer k.
At every second, you must perform the following operations:
Re... | [
"assert candidate(word='repeatedrepeated', k=8) == 1",
"assert candidate(word='abcabcabc', k=3) == 1",
"assert candidate(word='qwertyuiopqwertyuiopqwertyuiop', k=8) == 4",
"assert candidate(word='abacabadabacabadabacabad', k=5) == 5",
"assert candidate(word='abcdefgabcdefg', k=3) == 5",
"assert candidate(... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='repeatedrepeated', k=8) == 1",
"assert candidate(word='abcabcabc', k=3) == 1",
"assert candidate(word='qwertyuiopqwertyuiopqwertyuiop', k=8) == 4",
"assert candidate(word='abacabadabacabadabacabad', k=5) == 5",
"assert candidate(word='abcdefgabcdefg', k=3... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed string word and an integer k.\nAt every second, ... | You are an expert Python programmer. 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 word and an integer k.
At every second, you must perform the following operations:
Re... | [
"assert candidate(word='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij', k=13) == 6",
"assert candidate(word='abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd', k=13) == 4",
"assert candidate(word='abcabcabcabcabcabcabcabcabcabcabcabc', k=5) == 3",
"assert candi... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij', k=13) == 6",
"assert candidate(word='abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd', k=13) == 4",
"assert candidate(word='abcabcabcabcabcabcabcabcabcabcabcabc', k=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums of size n, and a 0-indexed 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 of size n, and a 0-indexed integer array pattern of size m consisting of i... | [
"assert candidate(nums=[5, 3, 5, 3, 5, 3, 5, 3, 5, 3], pattern=[1, -1, 1, -1, 1, -1, 1, -1]) == 1",
"assert candidate(nums=[1, 3, 2, 3, 4, 5, 4, 3, 2], pattern=[1, -1, 1, 1, -1, -1, 1]) == 0",
"assert candidate(nums=[1, 3, 5, 3, 1, 3, 5, 3, 1], pattern=[1, -1, 1, -1, 1, -1, 1, -1]) == 0",
"assert candidate(nu... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 3, 5, 3, 5, 3, 5, 3, 5, 3], pattern=[1, -1, 1, -1, 1, -1, 1, -1]) == 1",
"assert candidate(nums=[1, 3, 2, 3, 4, 5, 4, 3, 2], pattern=[1, -1, 1, 1, -1, -1, 1]) == 0",
"assert candidate(nums=[1, 3, 5, 3, 1, 3, 5, 3, 1], pattern=[1, -1, 1, -1, 1, -1, 1, -1]) == 0... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed string array words having length n and containin... | You are an expert Python programmer. 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 array words having length n and containing 0-indexed strings.
You are allowed to perfo... | [
"assert candidate(words=['xyz', 'zyx', 'abc', 'cba', 'aaa', 'bbb']) == 6",
"assert candidate(words=['zzzz', 'yyyy', 'xxxx', 'wwww', 'vvvv', 'uuuu', 'tttt', 'ssss', 'rrrr', 'qqqq', 'pppp', 'oooo', 'nnnn', 'mmmm', 'llll', 'kkkk', 'jjjj', 'iiii', 'hhhh', 'gggg', 'ffffff']) == 21",
"assert candidate(words=['aabbcc'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['xyz', 'zyx', 'abc', 'cba', 'aaa', 'bbb']) == 6",
"assert candidate(words=['zzzz', 'yyyy', 'xxxx', 'wwww', 'vvvv', 'uuuu', 'tttt', 'ssss', 'rrrr', 'qqqq', 'pppp', 'oooo', 'nnnn', 'mmmm', 'llll', 'kkkk', 'jjjj', 'iiii', 'hhhh', 'gggg', 'ffffff']) == 21",
"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 integer array nums of size n, and a 0-indexed 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 of size n, and a 0-indexed integer array pattern of size m consisting of i... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2], pattern=[1, 1, 1, -1, -1, -1, 1]) == 0",
"assert candidate(nums=[1, 1, 1, 1, 1], pattern=[0, 0]) == 3",
"assert candidate(nums=[1, 2, 3, 2, 1, 2, 3, 2, 1, 2], pattern=[1, -1, 1, -1, 1]) == 0",
"assert candidate(nums=[1, 2, 3, 4, 5, 6], pattern=[1, 1]) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2], pattern=[1, 1, 1, -1, -1, -1, 1]) == 0",
"assert candidate(nums=[1, 1, 1, 1, 1], pattern=[0, 0]) == 3",
"assert candidate(nums=[1, 2, 3, 2, 1, 2, 3, 2, 1, 2], pattern=[1, -1, 1, -1, 1]) == 0",
"assert candidate(nums=[1, 2, 3, 4,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s.\nConsider performing the following operation unt... | You are an expert Python programmer. 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.
Consider performing the following operation until s becomes empty:
For every alphabet charac... | [
"assert candidate(s='uniquecharacterswithoutrepeats') == 'et'",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcbaabcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba') == 'zyxwvutsrqponmlkjihgfedcba'",
"assert candidate(s='repeatedrepeatedrepeatedrepeatedrepeatedrepeatedrepeatedrepeatedr... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='uniquecharacterswithoutrepeats') == 'et'",
"assert candidate(s='abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcbaabcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba') == 'zyxwvutsrqponmlkjihgfedcba'",
"assert candidate(s='repeatedrepeatedrepeatedrepeatedrepeated... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 arrays with positive integers arr1 and arr2.\nA prefix 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 arrays with positive integers arr1 and arr2.
A prefix of a positive integer is an integer formed by o... | [
"assert candidate(arr1=[100000, 99999, 88888], arr2=[10000, 9999, 8888]) == 5",
"assert candidate(arr1=[987654321, 876543210, 765432109], arr2=[9876543210, 8765432100, 7654321090]) == 9",
"assert candidate(arr1=[10101010, 101010, 1010], arr2=[101010101, 1010101, 101]) == 8",
"assert candidate(arr1=[123456, 23... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr1=[100000, 99999, 88888], arr2=[10000, 9999, 8888]) == 5",
"assert candidate(arr1=[987654321, 876543210, 765432109], arr2=[9876543210, 8765432100, 7654321090]) == 9",
"assert candidate(arr1=[10101010, 101010, 1010], arr2=[101010101, 1010101, 101]) == 8",
"assert... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a m x n 0-indexed 2D matrix mat. From every cell, you can cr... | You are an expert Python programmer. 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 0-indexed 2D matrix mat. From every cell, you can create numbers in the following way:
There cou... | [
"assert candidate(mat=[[7]]) == -1",
"assert candidate(mat=[[3, 3, 3], [3, 3, 3], [3, 3, 3]]) == -1",
"assert candidate(mat=[[3, 1, 4, 1, 5, 9], [2, 6, 5, 3, 5, 8], [9, 7, 9, 3, 2, 3], [8, 4, 6, 2, 6, 4], [3, 3, 8, 3, 2, 7], [9, 5, 0, 2, 8, 8]]) == 53",
"assert candidate(mat=[[7, 3, 5, 2, 9], [8, 6, 4, 1, 7],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(mat=[[7]]) == -1",
"assert candidate(mat=[[3, 3, 3], [3, 3, 3], [3, 3, 3]]) == -1",
"assert candidate(mat=[[3, 1, 4, 1, 5, 9], [2, 6, 5, 3, 5, 8], [9, 7, 9, 3, 2, 3], [8, 4, 6, 2, 6, 4], [3, 3, 8, 3, 2, 7], [9, 5, 0, 2, 8, 8]]) == 53",
"assert candidate(mat=[[7, 3,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed string array words.\nLet's define a boolean func... | You are an expert Python programmer. 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 array words.
Let's define a boolean function isPrefixAndSuffix that takes two strings,... | [
"assert candidate(words=['x', 'xx', 'xxx', 'xxxx']) == 6",
"assert candidate(words=['unique', 'uniqueword', 'uniquewordunique', 'uniq']) == 1",
"assert candidate(words=['xyzyxyzyx', 'xyzyx', 'zyxzyx', 'xyz', 'zyx', 'yzy', 'zyzy', 'yzyxyzyx', 'yzyxyzyxyzyxyzyx']) == 1",
"assert candidate(words=['abc', 'abcabc'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['x', 'xx', 'xxx', 'xxxx']) == 6",
"assert candidate(words=['unique', 'uniqueword', 'uniquewordunique', 'uniq']) == 1",
"assert candidate(words=['xyzyxyzyx', 'xyzyx', 'zyxzyx', 'xyz', 'zyx', 'yzy', 'zyzy', 'yzyxyzyx', 'yzyxyzyxyzyxyzyx']) == 1",
"assert candi... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere exist n rectangles in a 2D plane with edges parallel to the x and 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 exist n rectangles in a 2D plane with edges parallel to the x and y axis. You are given two 2D integer arrays bot... | [
"assert candidate(bottomLeft=[[1, 1], [5, 5], [9, 9], [13, 13]], topRight=[[3, 3], [7, 7], [11, 11], [15, 15]]) == 0",
"assert candidate(bottomLeft=[[1, 1], [2, 2], [3, 1]], topRight=[[3, 3], [4, 4], [6, 6]]) == 1",
"assert candidate(bottomLeft=[[1, 1], [1, 1]], topRight=[[2, 2], [2, 2]]) == 1",
"assert candi... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(bottomLeft=[[1, 1], [5, 5], [9, 9], [13, 13]], topRight=[[3, 3], [7, 7], [11, 11], [15, 15]]) == 0",
"assert candidate(bottomLeft=[[1, 1], [2, 2], [3, 1]], topRight=[[3, 3], [4, 4], [6, 6]]) == 1",
"assert candidate(bottomLeft=[[1, 1], [1, 1]], topRight=[[2, 2], [2, 2]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two 1-indexed integer arrays, nums and, changeIndices, havin... | You are an expert Python programmer. 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 1-indexed integer arrays, nums and, changeIndices, having lengths n and m, respectively.
Initially, a... | [
"assert candidate(nums=[2, 3, 5, 7, 11, 13], changeIndices=[1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]) == -1",
"assert candidate(nums=[5, 4, 3], changeIndices=[1, 2, 3, 1, 2, 3, 1, 2, 3]) == -1",
"assert candidate(nums=[0, 0, 0, 0, 0, 0, 0], changeIndices=[1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]) ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 3, 5, 7, 11, 13], changeIndices=[1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]) == -1",
"assert candidate(nums=[5, 4, 3], changeIndices=[1, 2, 3, 1, 2, 3, 1, 2, 3]) == -1",
"assert candidate(nums=[0, 0, 0, 0, 0, 0, 0], changeIndices=[1, 2, 3, 4, 5, 6, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed integer array nums, and an integer k.\nYou are 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 are allowed to perform some operations on nums, whe... | [
"assert candidate(nums=[999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991, 999999990], k=1999999988) == 5",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], k=1500) == 7",
"assert candidate(nums=[5, 6, 7], k=14) == 2",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991, 999999990], k=1999999988) == 5",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], k=1500) == 7",
"assert candidate(nums=[5, 6, 7], k=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 unrooted weighted tree with n vertices representing serve... | You are an expert Python programmer. 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 unrooted weighted tree with n vertices representing servers numbered from 0 to n - 1, an array edges w... | [
"assert candidate(edges=[[0, 1, 12], [0, 2, 24], [1, 3, 36], [1, 4, 48], [2, 5, 60], [2, 6, 72], [3, 7, 84], [3, 8, 96], [4, 9, 108], [4, 10, 120], [5, 11, 132], [5, 12, 144], [6, 13, 156], [6, 14, 168]], signalSpeed=12) == [49, 57, 57, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0]",
"assert candidate(edges=[[0, 1, 1],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(edges=[[0, 1, 12], [0, 2, 24], [1, 3, 36], [1, 4, 48], [2, 5, 60], [2, 6, 72], [3, 7, 84], [3, 8, 96], [4, 9, 108], [4, 10, 120], [5, 11, 132], [5, 12, 144], [6, 13, 156], [6, 14, 168]], signalSpeed=12) == [49, 57, 57, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0]",
"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:\nThere exists an undirected tree with n nodes numbered 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 exists an undirected tree with n nodes numbered 0 to n - 1. You are given a 0-indexed 2D integer array edges of l... | [
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], k=3, 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]]) == 89",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=1, edges=[[0, 1], [0, 2], [0, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], k=3, 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]]) == 89",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k=1, edge... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 n x n grid where n is odd, and grid[r][c] is 0, ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed n x n grid where n is odd, and grid[r][c] is 0, 1, or 2.
We say that a cell belongs to the Le... | [
"assert candidate(grid=[[2, 0, 1, 0, 2], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [2, 0, 1, 0, 2]]) == 11",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1, 1, 1, 1, 1, 1, 1, 2, 0], [0, 2, 2, 1, 1, 1, 1, 1, 2, 2, 0], [0, 2, 2, 2, 1, 1, 1, 2, 2, 2, 0], [0, 2, 2, 2, 2, 1, 2, 2, 2, 2, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[2, 0, 1, 0, 2], [0, 1, 0, 1, 0], [1, 0, 2, 0, 1], [0, 1, 0, 1, 0], [2, 0, 1, 0, 2]]) == 11",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1, 1, 1, 1, 1, 1, 1, 2, 0], [0, 2, 2, 1, 1, 1, 1, 1, 2, 2, 0], [0, 2, 2, 2, 1, 1, 1, 2, 2, 2, 0], [0, 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 a 1-indexed array of integers nums of length n.\nWe define 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 1-indexed array of integers nums of length n.
We define a function greaterCount such that greaterCount(... | [
"assert candidate(nums=[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]",
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]",
"assert candidate(nums=[10, 20, 15, 10, 5, 25, 30, 5, 15, 25]) == [10,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]",
"assert candidate(nums=[5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]",
"assert candidate(nums=[10, 20, 15, 10, 5, 25... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums, return the maximum value of a triplet (i, j, k) such ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array nums, return the maximum value of a triplet (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k... | [
"assert candidate(nums=[50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0",
"assert candidate(nums=[3, 1, 6, 4, 5, 2]) == 4",
"assert candidate(nums=[1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 9",
"assert candidate(nums=[100, 50, 90, 20, 70, 30, 60, 40, 80, 10]) == 70",
"assert candid... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 0",
"assert candidate(nums=[3, 1, 6, 4, 5, 2]) == 4",
"assert candidate(nums=[1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]) == 9",
"assert candidate(nums=[100, 50, 90, 20, 70, 30, 60, 40, 80, 10... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array arr of size n consisting of non-empty strings.\nFin... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array arr of size n consisting of non-empty strings.
Find a string array answer of size n such that:
... | [
"assert candidate(arr=['cab', 'ad', 'bad', 'c']) == ['ab', '', 'ba', '']",
"assert candidate(arr=['abcdabcd', 'bcdbcdbd', 'cdabcdab', 'dabcdabc', 'abcdabca']) == ['bcdabcd', 'bd', 'cdabcda', 'dabcdabc', 'ca']",
"assert candidate(arr=['mississippi', 'missouri', 'missed', 'miss', 'mississippi']) == ['', 'o', 'd',... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(arr=['cab', 'ad', 'bad', 'c']) == ['ab', '', 'ba', '']",
"assert candidate(arr=['abcdabcd', 'bcdbcdbd', 'cdabcdab', 'dabcdabc', 'abcdabca']) == ['bcdabcd', 'bd', 'cdabcda', 'dabcdabc', 'ca']",
"assert candidate(arr=['mississippi', 'missouri', 'missed', 'miss', 'mississ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of integers nums with length n, and a positive odd ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of integers nums with length n, and a positive odd integer k.
Select exactly k disjoint subarray... | [
"assert candidate(nums=[0, 0, 0, 0, 0], k=5) == 0",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500], k=11) == 20400",
"assert candidate(nums=[-10, 20, -30, 40, -50, 60, -70, 80, -90, 100, -110, 120, -130, 140, -150], k=9) == 3900",
"assert candidate(num... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[0, 0, 0, 0, 0], k=5) == 0",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500], k=11) == 20400",
"assert candidate(nums=[-10, 20, -30, 40, -50, 60, -70, 80, -90, 100, -110, 120, -130, 140, -150], k=9) == 3900"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 matrix board and a 2D character matrix pattern.... | You are an expert Python programmer. 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 matrix board and a 2D character matrix pattern. Where 0 <= board[r][c] <= 9 and each element... | [
"assert candidate(board=[[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], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]], pattern=['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee']) == [-1, -1]",
"assert candidate(board=[[5, 5, 5], [5, 5, 5], [5, 5, 5]], ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(board=[[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], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]], pattern=['aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee']) == [-1, -1]",
"assert candidate(board=[[5, 5, 5], ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 0-indexed array nums of size n consisting of positive inte... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a 0-indexed array nums of size n consisting of positive integers.
You are also given a 2D array queries o... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], queries=[[0, 5], [5, 5], [10, 5], [15, 5]]) == [189, 144, 74, 0]",
"assert candidate(nums=[5, 5, 5, 5, 5], queries=[[0, 2], [1, 1], [2, 3]]) == [10, 5, 0]",
"assert candidate(nums=[5, 1, 4, 2, 3, 6, 7, 8, 9, 10], que... | 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], queries=[[0, 5], [5, 5], [10, 5], [15, 5]]) == [189, 144, 74, 0]",
"assert candidate(nums=[5, 5, 5, 5, 5], queries=[[0, 2], [1, 1], [2, 3]]) == [10, 5, 0]",
"assert candidate(nums=[5, 1, 4, 2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s. s[i] is either a lowercase English letter or '?'... | You are an expert Python programmer. 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. s[i] is either a lowercase English letter or '?'.
For a string t having length m containing o... | [
"assert candidate(s='????????') == 'abcdefgh'",
"assert candidate(s='zzzzzzzzzz???') == 'zzzzzzzzzzabc'",
"assert candidate(s='abacabadabacaba') == 'abacabadabacaba'",
"assert candidate(s='abc?de?') == 'abcfdeg'",
"assert candidate(s='xyz?xyz?xyz?') == 'xyzaxyzbxyzc'",
"assert candidate(s='aabbccddeeffggh... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='????????') == 'abcdefgh'",
"assert candidate(s='zzzzzzzzzz???') == 'zzzzzzzzzzabc'",
"assert candidate(s='abacabadabacaba') == 'abacabadabacaba'",
"assert candidate(s='abc?de?') == 'abcfdeg'",
"assert candidate(s='xyz?xyz?xyz?') == 'xyzaxyzbxyzc'",
"asse... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums of length n and a positive integer k.\... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums of length n and a positive integer k.
The power of an array of integers is defined ... | [
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500], k=4500) == 310464",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k=100) == 26176512",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500], k=4500) == 310464",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k=100) == 26176512",
"assert candidate(nums=[100, 200, 300, 400, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s and a character c. Return the total number of sub... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s and a character c. Return the total number of substrings of s that start and end with c.
Con... | [
"assert candidate(s='lkjlkjlkjlkj', c='l') == 10",
"assert candidate(s='bababababababa', c='b') == 28",
"assert candidate(s='hellohellobyehello', c='o') == 6",
"assert candidate(s='bbbbbbbbbb', c='b') == 55",
"assert candidate(s='hello', c='l') == 3",
"assert candidate(s='abcabcabc', c='c') == 6",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='lkjlkjlkjlkj', c='l') == 10",
"assert candidate(s='bababababababa', c='b') == 28",
"assert candidate(s='hellohellobyehello', c='o') == 6",
"assert candidate(s='bbbbbbbbbb', c='b') == 55",
"assert candidate(s='hello', c='l') == 3",
"assert candidate(s='ab... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 word and an integer k.\nWe consider word to be k-sp... | You are an expert Python programmer. 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 word and an integer k.
We consider word to be k-special if |freq(word[i]) - freq(word[j])| <= k ... | [
"assert candidate(word='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', k=0) == 0",
"assert candidate(word='lkjghwertyuiopasdfghjklzxcvbnmlkjhgfdwsazxcvbnmlkjhgfdwsazxcvbnmlkjhgfdwsa', k=15) == 0",
"assert candidate(word='abacabadabacaba', k=1) == 6",
"assert candidate(word='aabcccdddd', k=1) == 2",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz', k=0) == 0",
"assert candidate(word='lkjghwertyuiopasdfghjklzxcvbnmlkjhgfdwsazxcvbnmlkjhgfdwsazxcvbnmlkjhgfdwsa', k=15) == 0",
"assert candidate(word='abacabadabacaba', k=1) == 6",
"assert candidate(word='... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a binary array nums of length n, a positive integer k and 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 binary array nums of length n, a positive integer k and a non-negative integer maxChanges.
Alice plays ... | [
"assert candidate(nums=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], k=10, maxChanges=0) == 50",
"assert candidate(nums=[0, 0, 0, 0], k=2, maxChanges=3) == 4",
"assert candidate(nums=[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], k=10, maxChanges=0) == 50",
"assert candidate(nums=[0, 0, 0, 0], k=2, maxChanges=3) == 4",
"assert candidate(nums=[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWe call a string s of even length n an anti-palindrome if for each index 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:
We call a string s of even length n an anti-palindrome if for each index 0 <= i < n, s[i] != s[n - i - 1].
Given a stri... | [
"assert candidate(s='aaaabbbbccccdddd') == 'aaaabbbbccccdddd'",
"assert candidate(s='zyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyx') == 'xxxxxxxxxxxxxxxxxxxyyyyyyyyyzzzzzzzzzzyyyyyyyyyyzzzzzzzzz'",
"assert candidate(s='abacab') == 'aaabbc'",
"assert candidate(s='aaabbbcccdddeeefffggghhhiiiijjjjkkk... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aaaabbbbccccdddd') == 'aaaabbbbccccdddd'",
"assert candidate(s='zyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyxzyx') == 'xxxxxxxxxxxxxxxxxxxyyyyyyyyyzzzzzzzzzzyyyyyyyyyyzzzzzzzzz'",
"assert candidate(s='abacab') == 'aaabbc'",
"assert candidate(s='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:\nYou are given a positive integer k. Initially, you have an array nums = [1... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a positive integer k. Initially, you have an array nums = [1].
You can perform any of the following opera... | [
"assert candidate(k=11) == 5",
"assert candidate(k=1023) == 62",
"assert candidate(k=9999) == 198",
"assert candidate(k=75000) == 546",
"assert candidate(k=6) == 3",
"assert candidate(k=87500) == 590",
"assert candidate(k=1024) == 62",
"assert candidate(k=31) == 10",
"assert candidate(k=128) == 21",... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(k=11) == 5",
"assert candidate(k=1023) == 62",
"assert candidate(k=9999) == 198",
"assert candidate(k=75000) == 546",
"assert candidate(k=6) == 3",
"assert candidate(k=87500) == 590",
"assert candidate(k=1024) == 62",
"assert candidate(k=31) == 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:\nThe problem involves tracking the frequency of IDs in a collection that ch... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The problem involves tracking the frequency of IDs in a collection that changes over time. You have two integer arrays,... | [
"assert candidate(nums=[1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3], freq=[1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1]) == [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], freq=[-10, 9, -8, 7, -6, 5, -4, 3, -2, 1]) == [-10, 9, 9, 9, 9, 9, 9, 9, 9, 9]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3], freq=[1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1]) == [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], freq=[-10, 9, -8, 7, -6, 5, -4, 3, -2, 1]) == [-10, 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 binary array possible of length n.\nAlice and Bob are play... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a binary array possible of length n.
Alice and Bob are playing a game that consists of n levels. Some of ... | [
"assert candidate(possible=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1",
"assert candidate(possible=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1",
"assert candidate(possible=[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1",
"assert candidate(possible=[1, 1, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(possible=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1",
"assert candidate(possible=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 1",
"assert candidate(possible=[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]) == 1",
"assert... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array nums of non-negative integers and an integer k.\nAn... | You are an expert Python programmer. 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 non-negative integers and an integer k.
An array is called special if the bitwise OR of ... | [
"assert candidate(nums=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], k=1) == 1",
"assert candidate(nums=[5, 5, 5, 5, 5], k=5) == 1",
"assert candidate(nums=[2, 1, 8], k=10) == 3",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2147483647], k=2147483647) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], k=1) == 1",
"assert candidate(nums=[5, 5, 5, 5, 5], k=5) == 1",
"assert candidate(nums=[2, 1, 8], k=10) == 3",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 214... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums of length n, and a positive integer k.... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums of length n, and a positive integer k.
The power of a subsequence is defined as the... | [
"assert candidate(nums=[5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5], k=7) == 330",
"assert candidate(nums=[-10, -5, 0, 5, 10], k=4) == 25",
"assert candidate(nums=[-100, -90, -80, -70, -60, -50, -40, -30, -20, -10], k=4) == 2460",
"assert candidate(nums=[1, 1, 1, 1, 1], k=3) == 0",
"assert candidate(nums=[0, 0, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5], k=7) == 330",
"assert candidate(nums=[-10, -5, 0, 5, 10], k=4) == 25",
"assert candidate(nums=[-100, -90, -80, -70, -60, -50, -40, -30, -20, -10], k=4) == 2460",
"assert candidate(nums=[1, 1, 1, 1, 1], k=3) == 0",
"a... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array points representing integer coordinates of some poi... | You are an expert Python programmer. 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 points representing integer coordinates of some points on a 2D plane, where points[i] = [xi, yi]... | [
"assert candidate(points=[[1, 10], [10, 1], [5, 5], [3, 3], [8, 8], [2, 2], [7, 7], [4, 4], [6, 6], [9, 9]]) == 14",
"assert candidate(points=[[1, 1], [100000000, 100000000], [2, 2], [3, 3], [4, 4], [5, 5]]) == 8",
"assert candidate(points=[[1, 2], [4, 6], [7, 8], [2, 1], [5, 5], [8, 4]]) == 9",
"assert candi... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(points=[[1, 10], [10, 1], [5, 5], [3, 3], [8, 8], [2, 2], [7, 7], [4, 4], [6, 6], [9, 9]]) == 14",
"assert candidate(points=[[1, 1], [100000000, 100000000], [2, 2], [3, 3], [4, 4], [5, 5]]) == 8",
"assert candidate(points=[[1, 2], [4, 6], [7, 8], [2, 1], [5, 5], [8, 4]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, your task is to find the length of the longest self-cont... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, your task is to find the length of the longest self-contained substring of s.
A substring t of a stri... | [
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzxy') == 51",
"assert candidate(s='aabbcc') == 4",
"assert candidate(s='abcdefgabcdefg') == -1",
"assert candidate(s='abcabcabcabcabcabcabcabcabc') == -1",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyz') == 50"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzxy') == 51",
"assert candidate(s='aabbcc') == 4",
"assert candidate(s='abcdefgabcdefg') == -1",
"assert candidate(s='abcabcabcabcabcabcabcabcabc') == -1",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnoop... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 a non-negative integer k. In one 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 an integer array nums and a non-negative integer k. In one operation, you can increase or decrease any el... | [
"assert candidate(nums=[10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9], k=10) == 0",
"assert candidate(nums=[1, 1000000000, 2, 999999999, 3], k=500000000) == 499999997",
"assert candidate(nums=[1, 2, 3, 4, 5, 6], k=4) == 0",
"assert candidate(nums=[999999999, 999999999, 999999999, 999999999, 9... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9], k=10) == 0",
"assert candidate(nums=[1, 1000000000, 2, 999999999, 3], k=500000000) == 499999997",
"assert candidate(nums=[1, 2, 3, 4, 5, 6], k=4) == 0",
"assert candidate(nums=[999999999, 9999999... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 weighted graph with n vertices labeled from 0 to 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:
There is an undirected weighted graph with n vertices labeled from 0 to n - 1.
You are given the integer n and an array... | [
"assert candidate(n=4, edges=[], query=[[0, 1], [1, 2], [2, 3], [3, 0]]) == [-1, -1, -1, -1]",
"assert candidate(n=10, edges=[[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 7, 7], [7, 8, 8], [8, 9, 9]], query=[[0, 9], [1, 8], [2, 7]]) == [0, 0, 0]",
"assert candidate(n=8, edges=[[0, 1, 8]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=4, edges=[], query=[[0, 1], [1, 2], [2, 3], [3, 0]]) == [-1, -1, -1, -1]",
"assert candidate(n=10, edges=[[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 7, 7], [7, 8, 8], [8, 9, 9]], query=[[0, 9], [1, 8], [2, 7]]) == [0, 0, 0]",
"assert candid... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 2D integer array points, where points[i] = [xi, yi]. 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 a 2D integer array points, where points[i] = [xi, yi]. You are also given an integer w. Your task is to c... | [
"assert candidate(points=[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]], w=4) == 3",
"assert candidate(points=[[0, 10], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10]], w=2) == 4",
"assert candidate(points=[[1, 100], [2, 150]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(points=[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11]], w=4) == 3",
"assert candidate(points=[[0, 10], [1, 10], [2, 10], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [8, 10], [9, 10]], w=2) == 4",
"assert candidate(p... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 of n nodes. You are given a 2D array edges, w... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is an undirected graph of n nodes. You are given a 2D array edges, where edges[i] = [ui, vi, lengthi] describes a... | [
"assert candidate(n=8, edges=[[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [0, 7, 1]], disappear=[2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 2, 3, 4, 3, 2, 1]",
"assert candidate(n=8, edges=[[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 7, 7], [0, 3, 15], [3, 6, 10]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=8, edges=[[0, 1, 1], [1, 2, 1], [2, 3, 1], [3, 4, 1], [4, 5, 1], [5, 6, 1], [6, 7, 1], [0, 7, 1]], disappear=[2, 3, 4, 5, 6, 7, 8, 9]) == [0, 1, 2, 3, 4, 3, 2, 1]",
"assert candidate(n=8, edges=[[0, 1, 1], [1, 2, 2], [2, 3, 3], [3, 4, 4], [4, 5, 5], [5, 6, 6], [6, 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:\nYou are given an array of positive integers nums.\nReturn the number of su... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of positive integers nums.
Return the number of subarrays of nums, where the first and the last ... | [
"assert candidate(nums=[2, 1, 2, 3, 2, 1, 2]) == 9",
"assert candidate(nums=[5, 6, 5, 7, 5, 6, 5, 8, 5, 9, 5, 10, 5, 11, 5, 12, 5, 13, 5, 14, 5]) == 21",
"assert candidate(nums=[2, 1, 2]) == 4",
"assert candidate(nums=[1, 3, 2, 3, 1, 3, 1]) == 10",
"assert candidate(nums=[1, 2, 3, 4, 3, 2, 1, 4, 3, 2, 1, 4,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 1, 2, 3, 2, 1, 2]) == 9",
"assert candidate(nums=[5, 6, 5, 7, 5, 6, 5, 8, 5, 9, 5, 10, 5, 11, 5, 12, 5, 13, 5, 14, 5]) == 21",
"assert candidate(nums=[2, 1, 2]) == 4",
"assert candidate(nums=[1, 3, 2, 3, 1, 3, 1]) == 10",
"assert candidate(nums=[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 two arrays nums and andValues of length n and m respectively... | You are an expert Python programmer. 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 arrays nums and andValues of length n and m respectively.
The value of an array is equal to the last ... | [
"assert candidate(nums=[6, 6, 6, 6, 6, 6, 6, 6, 6], andValues=[6, 6, 6, 6]) == 24",
"assert candidate(nums=[8, 12, 14, 15, 9, 10, 12], andValues=[8, 14, 10]) == -1",
"assert candidate(nums=[255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 63, 127, 255], andValues=[255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[6, 6, 6, 6, 6, 6, 6, 6, 6], andValues=[6, 6, 6, 6]) == 24",
"assert candidate(nums=[8, 12, 14, 15, 9, 10, 12], andValues=[8, 14, 10]) == -1",
"assert candidate(nums=[255, 127, 63, 31, 15, 7, 3, 1, 0, 1, 3, 7, 15, 31, 63, 127, 255], andValues=[255, 127, 63, 31, 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 a string word. A letter c is called special if it appears bo... | You are an expert Python programmer. 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 word. A letter c is called special if it appears both in lowercase and uppercase in word, and ev... | [
"assert candidate(word='Aa') == 0",
"assert candidate(word='AbBCab') == 0",
"assert candidate(word='aAbBcCdDeEfFgG') == 7",
"assert candidate(word='aBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb') == 0",
"assert candidate(word='aAaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsT... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='Aa') == 0",
"assert candidate(word='AbBCab') == 0",
"assert candidate(word='aAbBcCdDeEfFgG') == 7",
"assert candidate(word='aBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb') == 0",
"assert candidate(word='aAaBbCcDdEe... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 matrix grid of size m x n. In one operation, you can ch... | You are an expert Python programmer. 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 matrix grid of size m x n. In one operation, you can change the value of any cell to any non-negativ... | [
"assert candidate(grid=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 18",
"assert candidate(grid=[[1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2]]) == 6",
"assert candidate(grid=[[9, 8, 7], [6, 5, 4], [3, 2, 1], [0, 9, 8], [7, 6, 5]]) == 12",
"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 0], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 18",
"assert candidate(grid=[[1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2]]) == 6",
"assert candidate(grid=[[9, 8, 7], [6, 5, 4], [3, 2, 1], [0, 9, 8]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an undirected weighted graph of n nodes numbered from 0 to 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 an undirected weighted graph of n nodes numbered from 0 to n - 1. The graph consists of m edges represent... | [
"assert candidate(n=7, edges=[[0, 1, 5], [0, 2, 3], [1, 3, 2], [2, 3, 1], [3, 4, 4], [4, 5, 2], [5, 6, 1], [2, 4, 6], [0, 5, 7], [1, 6, 8]]) == [False, False, False, False, False, False, True, False, True, False]",
"assert candidate(n=5, edges=[[0, 1, 2], [0, 2, 3], [1, 2, 1], [1, 3, 4], [2, 3, 2], [3, 4, 1]]) ==... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=7, edges=[[0, 1, 5], [0, 2, 3], [1, 3, 2], [2, 3, 1], [3, 4, 4], [4, 5, 2], [5, 6, 1], [2, 4, 6], [0, 5, 7], [1, 6, 8]]) == [False, False, False, False, False, False, True, False, True, False]",
"assert candidate(n=5, edges=[[0, 1, 2], [0, 2, 3], [1, 2, 1], [1, 3, 4], [2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer n, return the maximum integer x such that x <= n, and the... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer n, return the maximum integer x such that x <= n, and the bitwise AND of all the numbers in the range ... | [
"assert candidate(n=1048575) == 524287",
"assert candidate(n=123456789012345) == 70368744177663",
"assert candidate(n=70368744177663) == 35184372088831",
"assert candidate(n=17179869183) == 8589934591",
"assert candidate(n=8191) == 4095",
"assert candidate(n=268435455) == 134217727",
"assert candidate(n... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=1048575) == 524287",
"assert candidate(n=123456789012345) == 70368744177663",
"assert candidate(n=70368744177663) == 35184372088831",
"assert candidate(n=17179869183) == 8589934591",
"assert candidate(n=8191) == 4095",
"assert candidate(n=268435455) == 13... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a 2D boolean matrix grid.\nA collection of 3 elements of gri... | You are an expert Python programmer. 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 boolean matrix grid.
A collection of 3 elements of grid is a right triangle if one of its elements i... | [
"assert candidate(grid=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [1, 0, 0, 0, 1]]) == 4",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 8",
"assert candidate(grid=[[1, 1, 0, 0], [1, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [1, 0, 0, 0, 1]]) == 4",
"assert candidate(grid=[[0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 8",
"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 3 positive integers zero, one, and limit.\nA binary 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 3 positive integers zero, one, and limit.
A binary array arr is called stable if:
The number of occurren... | [
"assert candidate(zero=10, one=15, limit=3) == 378412",
"assert candidate(zero=9, one=11, limit=2) == 5344",
"assert candidate(zero=10, one=5, limit=3) == 546",
"assert candidate(zero=75, one=25, limit=5) == 769798783",
"assert candidate(zero=7, one=5, limit=2) == 114",
"assert candidate(zero=20, one=10, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(zero=10, one=15, limit=3) == 378412",
"assert candidate(zero=9, one=11, limit=2) == 5344",
"assert candidate(zero=10, one=5, limit=3) == 546",
"assert candidate(zero=75, one=25, limit=5) == 769798783",
"assert candidate(zero=7, one=5, limit=2) == 114",
"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 two integer arrays nums1 and nums2.\nFrom nums1 two elements... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two integer arrays nums1 and nums2.
From nums1 two elements have been removed, and all other elements hav... | [
"assert candidate(nums1=[10, 20, 30, 40, 50, 60, 70, 80, 90], nums2=[20, 30, 40]) == -10",
"assert candidate(nums1=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50], nums2=[15, 20, 25]) == 0",
"assert candidate(nums1=[10, 20, 30, 40, 50, 60, 70], nums2=[30, 40, 50]) == 0",
"assert candidate(nums1=[15, 30, 45, 60, 75, 9... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[10, 20, 30, 40, 50, 60, 70, 80, 90], nums2=[20, 30, 40]) == -10",
"assert candidate(nums1=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50], nums2=[15, 20, 25]) == 0",
"assert candidate(nums1=[10, 20, 30, 40, 50, 60, 70], nums2=[30, 40, 50]) == 0",
"assert candidate(n... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two integers n and x. You have to construct an array of posi... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two integers n and x. You have to construct an array of positive integers nums of size n where for every ... | [
"assert candidate(n=100000, x=1) == 199999",
"assert candidate(n=50, x=512) == 561",
"assert candidate(n=4, x=3) == 15",
"assert candidate(n=15, x=1024) == 1038",
"assert candidate(n=5, x=1023) == 5119",
"assert candidate(n=1, x=1024) == 1024",
"assert candidate(n=10, x=256) == 265",
"assert candidate... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=100000, x=1) == 199999",
"assert candidate(n=50, x=512) == 561",
"assert candidate(n=4, x=3) == 15",
"assert candidate(n=15, x=1024) == 1038",
"assert candidate(n=5, x=1023) == 5119",
"assert candidate(n=1, x=1024) == 1024",
"assert candidate(n=10, x=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums. The uniqueness array of nums is the s... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums. The uniqueness array of nums is the sorted array that contains the number of disti... | [
"assert candidate(nums=[1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18, 17, 19, 18, 20]) == 7",
"assert candidate(nums=[1]) == 1",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]) == 5"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18, 17, 19, 18, 20]) == 7",
"assert candidate(nums=[1]) == 1",
"assert candidate(nums=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two strings initial and target, your task is to modify initial by pe... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two strings initial and target, your task is to modify initial by performing a series of operations to make it eq... | [
"assert candidate(initial='abcabcabcabc', target='bcabcbcabcbc') == 14",
"assert candidate(initial='abcabc', target='abc') == 3",
"assert candidate(initial='algorithm', target='rhythm') == 9",
"assert candidate(initial='abcd', target='dabc') == 2",
"assert candidate(initial='programming', target='grammingp'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(initial='abcabcabcabc', target='bcabcbcabcbc') == 14",
"assert candidate(initial='abcabc', target='abc') == 3",
"assert candidate(initial='algorithm', target='rhythm') == 9",
"assert candidate(initial='abcd', target='dabc') == 2",
"assert candidate(initial='pro... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 word of size n, and an integer k such that k divide... | You are an expert Python programmer. 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 word of size n, and an integer k such that k divides n.
In one operation, you can pick any two i... | [
"assert candidate(word='leetcoleet', k=2) == 3",
"assert candidate(word='abababab', k=2) == 0",
"assert candidate(word='abcabcabcabcabcabc', k=3) == 0",
"assert candidate(word='abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcda... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='leetcoleet', k=2) == 3",
"assert candidate(word='abababab', k=2) == 0",
"assert candidate(word='abcabcabcabcabcabc', k=3) == 0",
"assert candidate(word='abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 two integers cost1 and cost2. 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 integer array nums and two integers cost1 and cost2. You are allowed to perform either of the followin... | [
"assert candidate(nums=[100, 200, 300, 400, 500], cost1=10, cost2=15) == 7500",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], cost1=1, cost2=2) == 45",
"assert candidate(nums=[1, 2, 3], cost1=3, cost2=2) == 5",
"assert candidate(nums=[1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3], cost1=4, c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[100, 200, 300, 400, 500], cost1=10, cost2=15) == 7500",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], cost1=1, cost2=2) == 45",
"assert candidate(nums=[1, 2, 3], cost1=3, cost2=2) == 5",
"assert candidate(nums=[1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums and an integer m, with each element nums[i] satisfying... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array nums and an integer m, with each element nums[i] satisfying 0 <= nums[i] < 2m, return an array answer. T... | [
"assert candidate(nums=[31, 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], m=5) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]",
"assert candidate(nums=[2, 5, 10, 17, 26, 37, 50, 65, 82, 101, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[31, 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], m=5) == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]",
"assert candidate(nums=[2, 5, 10, 17, 26,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nIn a mystic dungeon, n magicians are standing in a line. Each magician has... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
In a mystic dungeon, n magicians are standing in a line. Each magician has an attribute that gives you energy. Some mag... | [
"assert candidate(energy=[-100, 200, -300, 400, -500, 600, -700, 800, -900, 1000], k=5) == 1000",
"assert candidate(energy=[1000, -900, 800, -700, 600, -500, 400, -300, 200, -100], k=7) == 700",
"assert candidate(energy=[-10, 20, -30, 40, -50, 60, -70, 80], k=4) == 120",
"assert candidate(energy=[10, 20, -30,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(energy=[-100, 200, -300, 400, -500, 600, -700, 800, -900, 1000], k=5) == 1000",
"assert candidate(energy=[1000, -900, 800, -700, 600, -500, 400, -300, 200, -100], k=7) == 700",
"assert candidate(energy=[-10, 20, -30, 40, -50, 60, -70, 80], k=4) == 120",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an m x n matrix grid consisting of positive integers. You ca... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an m x n matrix grid consisting of positive integers. You can move from a cell in the matrix to any other... | [
"assert candidate(grid=[[5, 10, 15, 20, 25, 30], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [7, 14, 21, 28, 35, 42], [8, 16, 24, 32, 40, 48], [9, 18, 27, 36, 45, 54]]) == 53",
"assert candidate(grid=[[5, 1, 2, 3], [4, 6, 1, 5], [7, 1, 8, 9], [3, 2, 6, 4]]) == 8",
"assert candidate(grid=[[2, 2, 2, 2, 2, 2, 2, 2, 2,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[5, 10, 15, 20, 25, 30], [1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1], [7, 14, 21, 28, 35, 42], [8, 16, 24, 32, 40, 48], [9, 18, 27, 36, 45, 54]]) == 53",
"assert candidate(grid=[[5, 1, 2, 3], [4, 6, 1, 5], [7, 1, 8, 9], [3, 2, 6, 4]]) == 8",
"assert candidate(grid=[[2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array nums which is a permutation of [0, 1, 2, ..., n - 1... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array nums which is a permutation of [0, 1, 2, ..., n - 1]. The score of any permutation of [0, 1, 2, ... | [
"assert candidate(nums=[0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13]) == [0, 8, 3, 9, 5, 10, 12, 6, 11, 13, 14, 7, 4, 2, 1]",
"assert candidate(nums=[7, 0, 1, 2, 3, 4, 5, 6, 14, 13, 12, 11, 8, 9, 10]) == [0, 1, 2, 3, 4, 5, 6, 7, 12, 9, 13, 10, 11, 14, 8]",
"assert candidate(nums=[3, 6, 13, 7, 11, 0, 8, 12,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13]) == [0, 8, 3, 9, 5, 10, 12, 6, 11, 13, 14, 7, 4, 2, 1]",
"assert candidate(nums=[7, 0, 1, 2, 3, 4, 5, 6, 14, 13, 12, 11, 8, 9, 10]) == [0, 1, 2, 3, 4, 5, 6, 7, 12, 9, 13, 10, 11, 14, 8]",
"assert candidate(nums=[3... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nAn array is considered special if every pair of its adjacent elements cont... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
An array is considered special if every pair of its adjacent elements contains two numbers with different parity.
You a... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], queries=[[0, 29], [1, 28], [2, 27], [3, 26], [4, 25], [5, 24], [6, 23], [7, 22], [8, 21], [9, 20]]) == [True, True, True, True, True, True, True, True, True, True]",
"assert cand... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], queries=[[0, 29], [1, 28], [2, 27], [3, 26], [4, 25], [5, 24], [6, 23], [7, 22], [8, 21], [9, 20]]) == [True, True, True, True, True, True, True, True, True, T... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a non-negative integer k. There exists a staircase with 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 non-negative integer k. There exists a staircase with an infinite number of stairs, with the lowest sta... | [
"assert candidate(k=536870912) == 1",
"assert candidate(k=50) == 0",
"assert candidate(k=500) == 0",
"assert candidate(k=60000000) == 0",
"assert candidate(k=30000000) == 0",
"assert candidate(k=1048576) == 1",
"assert candidate(k=5000) == 0",
"assert candidate(k=16777216) == 1",
"assert candidate(k... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(k=536870912) == 1",
"assert candidate(k=50) == 0",
"assert candidate(k=500) == 0",
"assert candidate(k=60000000) == 0",
"assert candidate(k=30000000) == 0",
"assert candidate(k=1048576) == 1",
"assert candidate(k=5000) == 0",
"assert candidate(k=167... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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, an integer array queries, and an inte... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums, an integer array queries, and an integer x.
For each queries[i], you need to find ... | [
"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], queries=[1, 11, 21, 31, 41, 51], x=1) == [0, -1, -1, -1, -1, -1]",
"assert candidate(nums=[4, 4, 4, 4], queries=[1, 2, 3, 4, 5], x=4) == [0, 1, 2, 3, -1]",
"assert candidate(nums=[5, 3, 5, 2, 5,... | newfacade/LeetCodeDataset | {
"constraints": [
"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], queries=[1, 11, 21, 31, 41, 51], x=1) == [0, -1, -1, -1, -1, -1]",
"assert candidate(nums=[4, 4, 4, 4], queries=[1, 2, 3, 4, 5], x=4) == [0, 1, 2, 3, -1]",
"assert candi... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere exists an infinite number line, with its origin at 0 and extending 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 infinite number line, with its origin at 0 and extending towards the positive x-axis.
You are given a 2... | [
"assert candidate(queries=[[2, 10, 5], [1, 3], [1, 7], [2, 10, 5], [2, 10, 2]]) == [True, False, True]",
"assert candidate(queries=[[1, 5], [1, 3], [2, 6, 2], [2, 6, 4]]) == [True, False]",
"assert candidate(queries=[[1, 1], [2, 2, 2], [1, 3], [1, 4], [1, 5], [2, 5, 4], [2, 5, 1]]) == [False, False, True]",
"... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(queries=[[2, 10, 5], [1, 3], [1, 7], [2, 10, 5], [2, 10, 2]]) == [True, False, True]",
"assert candidate(queries=[[1, 5], [1, 3], [2, 6, 2], [2, 6, 4]]) == [True, False]",
"assert candidate(queries=[[1, 1], [2, 2, 2], [1, 3], [1, 4], [1, 5], [2, 5, 4], [2, 5, 1]]) == [... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string word, compress it using the following algorithm:\n\nBegin w... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string word, compress it using the following algorithm:
Begin with an empty string comp. While word is not emp... | [
"assert candidate(word='a') == '1a'",
"assert candidate(word='aabbcc') == '2a2b2c'",
"assert candidate(word='abcde') == '1a1b1c1d1e'",
"assert candidate(word='aaabbbcccddd') == '3a3b3c3d'",
"assert candidate(word='aaaaaaaaaabbbbbbbbbccccccccddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjj... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word='a') == '1a'",
"assert candidate(word='aabbcc') == '2a2b2c'",
"assert candidate(word='abcde') == '1a1b1c1d1e'",
"assert candidate(word='aaabbbcccddd') == '3a3b3c3d'",
"assert candidate(word='aaaaaaaaaabbbbbbbbbccccccccddddddddeeeeeeeeeeffffffffffgggggggggg... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will 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 2 integer arrays nums1 and nums2 of lengths n and m respecti... | You are an expert Python programmer. 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 2 integer arrays nums1 and nums2 of lengths n and m respectively. You are also given a positive integer k... | [
"assert candidate(nums1=[1000000, 1000000, 1000000], nums2=[1, 10, 100, 1000], k=100) == 12",
"assert candidate(nums1=[101, 202, 303, 404, 505, 606, 707, 808, 909], nums2=[1, 10, 100, 1000], k=1) == 9",
"assert candidate(nums1=[1, 1, 1, 1, 1], nums2=[1, 1, 1, 1, 1], k=1) == 25",
"assert candidate(nums1=[7, 14... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[1000000, 1000000, 1000000], nums2=[1, 10, 100, 1000], k=100) == 12",
"assert candidate(nums1=[101, 202, 303, 404, 505, 606, 707, 808, 909], nums2=[1, 10, 100, 1000], k=1) == 9",
"assert candidate(nums1=[1, 1, 1, 1, 1], nums2=[1, 1, 1, 1, 1], k=1) == 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:\nYou are given an array nums consisting of integers. You are also given a 2... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array nums consisting of integers. You are also given a 2D array queries, where queries[i] = [posi, xi... | [
"assert candidate(nums=[5, 1, 5, 1, 5, 1, 5, 1, 5, 1], queries=[[0, 10], [1, 20], [2, 30], [3, 40], [4, 50], [5, 60], [6, 70], [7, 80], [8, 90], [9, 100]]) == 1331",
"assert candidate(nums=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50], queries=[[0, 15], [1, 10], [2, 5], [3, 0], [4, -5], [5, -10], [6, -15], [7, -20], [8... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 1, 5, 1, 5, 1, 5, 1, 5, 1], queries=[[0, 10], [1, 20], [2, 30], [3, 40], [4, 50], [5, 60], [6, 70], [7, 80], [8, 90], [9, 100]]) == 1331",
"assert candidate(nums=[5, 10, 15, 20, 25, 30, 35, 40, 45, 50], queries=[[0, 15], [1, 10], [2, 5], [3, 0], [4, -5], [5, -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 string compressed representing a compressed version of a s... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string compressed representing a compressed version of a string. The format is a character followed by ... | [
"assert candidate(compressed='a9b8a7b6a5b4a3b2a1b1') == 'a25b21'",
"assert candidate(compressed='x1y2x1y3x1y4x1y5x1y6x1y7x1y8x1y9x1y10') == 'x9y54'",
"assert candidate(compressed='a100b99c98d97e96f95g94h93i92j91k90l89m88n87o86p85q84r83s82t81u80v79w78x77y76z75') == 'a100b99c98d97e96f95g94h93i92j91k90l89m88n87o86... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(compressed='a9b8a7b6a5b4a3b2a1b1') == 'a25b21'",
"assert candidate(compressed='x1y2x1y3x1y4x1y5x1y6x1y7x1y8x1y9x1y10') == 'x9y54'",
"assert candidate(compressed='a100b99c98d97e96f95g94h93i92j91k90l89m88n87o86p85q84r83s82t81u80v79w78x77y76z75') == 'a100b99c98d97e96f95g9... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.