version stringclasses 1
value | style stringclasses 2
values | subset stringclasses 12
values | question_id stringlengths 9 23 | question stringlengths 27 8.13k | solution stringlengths 99 5.97k | test stringlengths 105 4.45k | test_info listlengths 0 13 | gpt_pass_sequence listlengths 1 10 | gpt_pass_trial_num int64 1 10 | gpt_difficulty stringclasses 3
values | gpt_pass_percentage float64 0.1 1 | trials dict | chosen_trial stringclasses 10
values | metadata dict | benchmark_similarity float64 0.16 0.93 | benchmark_instruction stringclasses 1
value | benchmark_task_id stringclasses 1
value | filter_reason stringclasses 1
value | base_id stringlengths 7 21 | variant stringclasses 2
values | top_function_names listlengths 2 13 | n_top_functions int64 2 13 | helper_call_edges listlengths 1 16 | n_helper_call_edges int64 1 16 | harness_functions listlengths 0 3 | structural_wrapper bool 1
class | class_names listlengths 0 5 | has_class bool 2
classes | test_kind stringclasses 1
value | test_has_solution_import bool 2
classes | third_party_imports listlengths 0 5 | stdlib_only bool 2
classes | question_norm_sha1 stringlengths 40 40 | solution_ast_sha1 stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
v1.0 | instruct | Taco | Taco_38095_I | Write a program that takes an integer n and determines if it can be expressed as the sum of two prime numbers. If it is possible, output one such pair of prime numbers. If there are multiple pairs, output the pair where the smaller prime number is the smallest among all possible pairs. If no such pairs exist, output "N... | def is_prime(num):
if num < 2:
return False
if num == 2:
return True
if num % 2 == 0:
return False
p = 3
while p * p <= num:
if num % p == 0:
return False
p += 2
return True
def find_prime_pair(n):
for i in range(2, n // 2 + 1): # Only ne... | from solution import is_prime, find_prime_pair, process_datasets
def test_is_prime():
assert is_prime(2) == True
assert is_prime(3) == True
assert is_prime(4) == False
assert is_prime(17) == True
assert is_prime(18) == False
def test_find_prime_pair():
assert find_prime_pair(10) == (3, 7)
... | [
{
"docstring": null,
"function_declaration": "def is_prime(num):",
"function_name": "is_prime",
"parameter_list": "(num)"
},
{
"docstring": null,
"function_declaration": "def find_prime_pair(n):",
"function_name": "find_prime_pair",
"parameter_list": "(n)"
},
{
"docstring... | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(n):\n if n <= 1:\n return False\n if n <= 3:\n return True\n if n % 2 == 0 or n % 3 == 0:\n return False\n i = 5\n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00038095",
"row_id": 38095,
"seed_ids": "[21370]"
} | 0.752411 | Taco_38095 | I | [
"is_prime",
"find_prime_pair",
"process_datasets"
] | 3 | [
[
"find_prime_pair",
"is_prime"
],
[
"process_datasets",
"find_prime_pair"
]
] | 2 | [
"process_datasets"
] | false | [] | false | pytest | true | [] | true | 0880323aad7884cf89d19de90cf6a7c545a51e3e | b5685b06ec8e277fda9729dd5121027734e2b145 | |||
v1.0 | instruct | Taco | Taco_38113_I | A company is trying to optimize its network of computers for better communication. Each computer is represented as a node in a graph, and a direct cable connection between two computers is represented as an undirected edge between two nodes. The network graph consists of N nodes labeled from 1 to N, and each edge has a... | def find_parent(parent, i):
if parent[i] == i:
return i
else:
return find_parent(parent, parent[i])
def union(parent, rank, x, y):
xroot = find_parent(parent, x)
yroot = find_parent(parent, y)
if rank[xroot] < rank[yroot]:
parent[xroot] = yroot
elif rank[xroot] > rank[y... | def test_minimum_cost_example():
n = 4
edges = [
(1, 2, 3),
(1, 3, 1),
(2, 3, 7),
(2, 4, 2),
(3, 4, 5)
]
assert minimum_cost_to_connect_all_computers(n, edges) == 6
def test_no_edges():
n = 4
edges = []
assert minimum_cost_to_connect_all_computers(n,... | [
{
"docstring": null,
"function_declaration": "def find_parent(parent, i):",
"function_name": "find_parent",
"parameter_list": "(parent, i)"
},
{
"docstring": null,
"function_declaration": "def union(parent, rank, x, y):",
"function_name": "union",
"parameter_list": "(parent, rank... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def find_parent(parent, i):\n if parent[i] == i:\n return i\n else:\n return find_parent(parent, parent[i])\n\ndef union(parent, rank, x, y):\n... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00038113",
"row_id": 38113,
"seed_ids": "[6611]"
} | 0.727864 | Taco_38113 | I | [
"find_parent",
"union",
"minimum_cost_to_connect_all_computers"
] | 3 | [
[
"minimum_cost_to_connect_all_computers",
"find_parent"
],
[
"minimum_cost_to_connect_all_computers",
"union"
],
[
"union",
"find_parent"
]
] | 3 | [] | false | [] | false | pytest | false | [] | true | 9b2dae5aae8b34651e1741c7e75ebce6b08a1ee6 | f9f49edbcc2545931fb762194b4dde36435f13cb | |||
v1.0 | instruct | Taco | Taco_38265_I | Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef has recently become interested in palindromic numbers. A number is called palindromic if it reads the same backwards as forwards. Chef wants to know how many palindromic numbers exist within a given range [L, R] (inclusive).
------ Inp... | def is_palindromic(number):
"""
Returns True if the number is palindromic, False otherwise.
"""
str_num = str(number)
return str_num == str_num[::-1]
def count_palindromic_numbers(L, R):
"""
Returns the count of palindromic numbers in the range [L, R].
"""
count = 0
for num in r... | from solution import is_palindromic, count_palindromic_numbers, solve
def test_is_palindromic():
assert is_palindromic(1) == True
assert is_palindromic(121) == True
assert is_palindromic(12321) == True
assert is_palindromic(123) == False
def test_count_palindromic_numbers_small_ranges():
assert co... | [
{
"docstring": "Returns True if the number is palindromic, False otherwise.",
"function_declaration": "def is_palindromic(number):",
"function_name": "is_palindromic",
"parameter_list": "(number)"
},
{
"docstring": "Returns the count of palindromic numbers in the range [L, R].",
"functio... | [
0,
0,
0,
0,
1
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def count_palindromic_numbers(L, R):\n \"\"\"\n Returns the count of palindromic numbers in the range [L, R].\n \"\"\"\n def is_palindrome(n):\n ... | trial_gpt4o_4 | {
"original_instruction": "",
"prompt_id": "00038265",
"row_id": 38265,
"seed_ids": "[6219]"
} | 0.619238 | Taco_38265 | I | [
"is_palindromic",
"count_palindromic_numbers",
"solve"
] | 3 | [
[
"count_palindromic_numbers",
"is_palindromic"
],
[
"solve",
"count_palindromic_numbers"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 2e50fa5e0b06c3aadf91060dfa756d65f45a682b | 3058234b8032ffdb1c8d95076faabfce6b11ce33 | |||
v1.0 | instruct | Taco | Taco_38278_I | You are working for a company that manages a large number of networked devices in multiple locations. As part of your job, you need to synchronize the clocks of these devices with a central server to ensure that their local times are accurate and consistent. Each device has a clock that can be out of sync with the cent... | def time_difference(server_time, device_time):
h1, m1 = map(int, server_time.split(":"))
h2, m2 = map(int, device_time.split(":"))
total_server_minutes = h1 * 60 + m1
total_device_minutes = h2 * 60 + m2
drift_minutes = total_server_minutes - total_device_minutes
return drift_minutes
def adjust_... | import pytest
from solution import time_difference, adjust_time, synchronize_clocks
def test_time_difference():
assert time_difference("12:00", "11:45") == 15
assert time_difference("12:00", "13:05") == -65
assert time_difference("12:00", "11:59") == 1
assert time_difference("23:30", "23:00") == 30
... | [
{
"docstring": null,
"function_declaration": "def time_difference(server_time, device_time):",
"function_name": "time_difference",
"parameter_list": "(server_time, device_time)"
},
{
"docstring": null,
"function_declaration": "def adjust_time(device_time, drift_minutes):",
"function_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
1
] | 1 | hard | 0.1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def synchronize_clocks(n, server_time, device_times):\n \"\"\"\n Takes the number of devices, server time and a list of device times,\n returns the adjust... | trial_gpt4o_9 | {
"original_instruction": "",
"prompt_id": "00038278",
"row_id": 38278,
"seed_ids": "[24449]"
} | 0.523145 | Taco_38278 | I | [
"time_difference",
"adjust_time",
"synchronize_clocks"
] | 3 | [
[
"synchronize_clocks",
"adjust_time"
],
[
"synchronize_clocks",
"time_difference"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 855675f4edcec1c657bdbdef173d292ba76af312 | 485c1a7e120269e557eb7673938501a759bac2c6 | |||
v1.0 | instruct | Taco | Taco_38320_I | Aman is fascinated by prime numbers and often spends his free time exploring their properties. One day, he came up with an interesting problem involving matrices and prime numbers. He needs your help to solve it.
You are given an $N \times N$ matrix filled with integers. Your task is to determine if there exists a row... | def is_prime(num):
"""
Helper function to determine if a number is prime.
"""
if num <= 1:
return False
if num == 2 or num == 3:
return True
if num % 2 == 0 or num % 3 == 0:
return False
i = 5
while i * i <= num:
if num % i == 0 or num % (i + 2) == 0:
... | from solution import check_prime_rows_and_columns
def test_prime_row():
matrix = [
[2, 3, 5],
[4, 6, 8],
[7, 11, 13]
]
assert check_prime_rows_and_columns(matrix) == "YES"
def test_no_prime_row_or_column():
matrix = [
[4, 6, 8],
[9, 10, 12],
[15, 14, 16]... | [
{
"docstring": "Helper function to determine if a number is prime.",
"function_declaration": "def is_prime(num):",
"function_name": "is_prime",
"parameter_list": "(num)"
},
{
"docstring": "Function to check if any row or column in the matrix consists only of prime numbers.",
"function_de... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(num):\n \"\"\"\n Helper function to determine if a number is prime.\n \"\"\"\n if num <= 1:\n return False\n if num == 2 or num ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00038320",
"row_id": 38320,
"seed_ids": "[10221]"
} | 0.546322 | Taco_38320 | I | [
"is_prime",
"check_prime_rows_and_columns"
] | 2 | [
[
"check_prime_rows_and_columns",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | da3a068e9de87f5b33e5a8661d4dcb4268b7db4e | a5ee92ccc9d6c7ec7e53c0b275ffc77ae5b25bce | |||
v1.0 | instruct | Taco | Taco_38364_I | You are given an undirected graph with $N$ nodes and $M$ edges. Each node is numbered from $1$ to $N$. An "island" is defined as a subset of nodes such that all nodes in this subset are connected directly or indirectly through edges, and no node in this subset is directly connected to any node outside the subset.
Your... | from collections import defaultdict
def find_islands(N, edges):
"""
Return the number of distinct islands in the graph.
Parameters:
- N (int): number of nodes
- edges (list of tuples): list of edges where each edge is represented by a tuple (u, v)
Returns:
- int: number of distinct island... | from solution import solve
def test_case_1():
input_lines = [
"2",
"5 3",
"1 2",
"2 3",
"4 5",
"4 0"
]
expected_output = [2, 4]
assert solve(input_lines) == expected_output
def test_case_2_all_connected():
input_lines = [
"1",
"5 4",
... | [
{
"docstring": "Return the number of distinct islands in the graph.\n\nParameters:\n- N (int): number of nodes\n- edges (list of tuples): list of edges where each edge is represented by a tuple (u, v)\n\nReturns:\n- int: number of distinct islands",
"function_declaration": "def find_islands(N, edges):",
... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def count_islands(N, M, edges):\n from collections import defaultdict, deque\n\n # Create an adjacency list for the graph\n graph = defaultdict(list)\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038364",
"row_id": 38364,
"seed_ids": "[11379]"
} | 0.658499 | Taco_38364 | I | [
"find_islands",
"process_test_cases",
"solve"
] | 3 | [
[
"process_test_cases",
"find_islands"
],
[
"solve",
"process_test_cases"
]
] | 2 | [
"process_test_cases"
] | false | [] | false | pytest | true | [] | true | e131ab62494cd67fb3fdacfb751a0d627f8aa0ed | 61c3ac98312178185ab63acee11dcd1441351f66 | |||
v1.0 | instruct | Taco | Taco_38423_I | Write a function that takes a list of integers and returns a new list containing all the elements of the original list that are prime numbers.
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
Examples:
```python
filter_primes([10, 15, 3, 7, 9, 11]) # should ret... | def is_prime(n):
"""
Helper function to determine if a number is prime.
"""
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
for i in range(3, int(n**0.5) + 1, 2):
if n % i == 0:
return False
return True
def filter_pr... | from solution import filter_primes
def test_filter_primes_mixed_numbers():
assert filter_primes([10, 15, 3, 7, 9, 11]) == [3, 7, 11]
def test_filter_primes_no_primes():
assert filter_primes([4, 6, 8, 10]) == []
def test_filter_primes_with_primes_only():
assert filter_primes([2, 3, 5, 7, 11, 13]) == [2, 3... | [
{
"docstring": "Helper function to determine if a number is prime.",
"function_declaration": "def is_prime(n):",
"function_name": "is_prime",
"parameter_list": "(n)"
},
{
"docstring": "Returns a list of prime numbers from the given list of integers.",
"function_declaration": "def filter_... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(n):\n \"\"\"\n Helper function to determine if a given number n is prime.\n \"\"\"\n if n <= 1:\n return False\n for i in range(... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038423",
"row_id": 38423,
"seed_ids": "[24530]"
} | 0.674641 | Taco_38423 | I | [
"is_prime",
"filter_primes"
] | 2 | [
[
"filter_primes",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | eb9ffa7d31800fae30c277b52ad0b7713daf116a | 7fffcf5b2adf84207a93fad8228c9f475e778ea8 | |||
v1.0 | instruct | Taco | Taco_38438_I | Anita is fascinated by palindromic numbers. A number is a palindrome if it reads the same forwards and backwards, such as $121$ or $9889$. Anita is also interested in prime numbers. A prime number is a natural number greater than $1$ that has no positive divisors other than $1$ and itself.
Anita starts to write out th... | def is_palindromic(n):
"""
Checks if a number is palindromic.
"""
return str(n) == str(n)[::-1]
def is_prime(n):
"""
Checks if a number is prime.
"""
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
wh... | from solution import is_palindromic, is_prime, nth_palindromic_prime, get_palindromic_primes
def test_is_palindromic():
assert is_palindromic(121) == True
assert is_palindromic(123) == False
assert is_palindromic(898) == True
def test_is_prime():
assert is_prime(2) == True
assert is_prime(3) == Tr... | [
{
"docstring": "Checks if a number is palindromic.",
"function_declaration": "def is_palindromic(n):",
"function_name": "is_palindromic",
"parameter_list": "(n)"
},
{
"docstring": "Checks if a number is prime.",
"function_declaration": "def is_prime(n):",
"function_name": "is_prime",... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import math\n\n\ndef is_prime(num):\n \"\"\"\n Check if a number is prime.\n \"\"\"\n if num <= 1:\n return False\n if num <= 3:\n ret... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038438",
"row_id": 38438,
"seed_ids": "[9473]"
} | 0.628483 | Taco_38438 | I | [
"is_palindromic",
"is_prime",
"nth_palindromic_prime",
"get_palindromic_primes"
] | 4 | [
[
"get_palindromic_primes",
"nth_palindromic_prime"
],
[
"nth_palindromic_prime",
"is_palindromic"
],
[
"nth_palindromic_prime",
"is_prime"
]
] | 3 | [] | false | [] | false | pytest | true | [] | true | 531036d8aaa62cc790bd0c83e1bb148c3fa2f2b2 | 811902576f0e67047937e3d94278cb79ddc9a192 | |||
v1.0 | instruct | Taco | Taco_38443_I | In a small town, there is a popular path between two intersections A and B. Every day, numerous townspeople travel between these intersections. We need to track the number of people who traverse this path on each day of a given week.
We represent the town's path between intersections A and B as a sequence of events. E... | def find_peak_people(events):
events.sort()
max_travelers = 0
current_travelers = 0
for event in events:
if event[1] == 'A':
current_travelers += 1
if current_travelers > max_travelers:
max_travelers = current_travelers
elif event[1] == 'D':
... | from solution import process_events
def test_example1():
event_list = ["1 A", "5 A", "8 D", "10 A", "12 D", "15 D"]
assert process_events(6, event_list) == 2
def test_example2():
event_list = ["2 A", "3 D", "4 A", "6 D"]
assert process_events(4, event_list) == 1
def test_case_all_arrivals_then_depart... | [
{
"docstring": null,
"function_declaration": "def find_peak_people(events):",
"function_name": "find_peak_people",
"parameter_list": "(events)"
},
{
"docstring": null,
"function_declaration": "def process_events(n, event_list):",
"function_name": "process_events",
"parameter_list... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def peak_travelers_on_path(n, events):\n events.sort()\n \n current_travelers = 0\n peak_travelers = 0\n \n for event in events:\n if even... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038443",
"row_id": 38443,
"seed_ids": "[8904]"
} | 0.665365 | Taco_38443 | I | [
"find_peak_people",
"process_events"
] | 2 | [
[
"process_events",
"find_peak_people"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 3dc849895e9f5df402c559b506622efaeb6d4d04 | cd141c9f5eb7d2efca9043ea506b5b420a99db65 | |||
v1.0 | instruct | Taco | Taco_38457_I | You've been tasked to create software that simulates an automated teller machine (ATM). The ATM should be able to dispense cash amounts in various denominations (e.g., 100s, 50s, 20s, 10s, 5s, and 1s) but should minimize the number of bills dispensed.
### Input
The input consists of multiple lines. Each line represent... | def dispense_cash(amount):
"""
Given an amount, this function calculates the number of each denomination (100s, 50s, 20s, 10s, 5s, 1s)
needed to dispense the amount while minimizing the number of bills.
"""
denominations = [100, 50, 20, 10, 5, 1]
bills = {}
for denom in denominations:
... | from solution import dispense_cash, process_transactions
def test_dispense_cash():
assert dispense_cash(376) == "100s: 3, 50s: 1, 20s: 1, 10s: 0, 5s: 1, 1s: 1"
assert dispense_cash(123) == "100s: 1, 50s: 0, 20s: 1, 10s: 0, 5s: 0, 1s: 3"
assert dispense_cash(6879) == "100s: 68, 50s: 1, 20s: 1, 10s: 0, 5s: 1... | [
{
"docstring": "Given an amount, this function calculates the number of each denomination (100s, 50s, 20s, 10s, 5s, 1s)\nneeded to dispense the amount while minimizing the number of bills.",
"function_declaration": "def dispense_cash(amount):",
"function_name": "dispense_cash",
"parameter_list": "(a... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def dispense_cash(amount):\n \"\"\"\n Dispenses the given amount in the smallest number of bills.\n \"\"\"\n denominations = [100, 50, 20, 10, 5, 1]\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038457",
"row_id": 38457,
"seed_ids": "[24504]"
} | 0.654828 | Taco_38457 | I | [
"dispense_cash",
"process_transactions"
] | 2 | [
[
"process_transactions",
"dispense_cash"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 367cfc21e5b470d9ec1f7893eab7e3ae358ff0c7 | 344f1b78ebff92017f5f8a40e696f7cb53fefbc5 | |||
v1.0 | instruct | Taco | Taco_38475_I | You are given a rooted tree with n nodes, where each node is uniquely numbered from 1 to n, and the root of the tree is always node 1. You need to perform q queries on this tree. Each query consists of providing two nodes u and v, and you need to determine the least common ancestor (LCA) of these two nodes.
Input
- T... | import sys
from collections import defaultdict, deque
from math import log2, ceil
sys.setrecursionlimit(200000)
def preprocess_LCA(n, tree, root=1):
log_n = ceil(log2(n))
parent = [[-1] * (log_n + 1) for _ in range(n + 1)]
level = [-1] * (n + 1)
def bfs(start):
q = deque([start])
leve... | from solution import lca_tree
def test_example_case_1():
n = 5
edges = [(1, 2), (1, 3), (2, 4), (2, 5)]
q = 3
queries = [(4, 5), (4, 3), (3, 5)]
assert lca_tree(n, edges, q, queries) == [2, 1, 1]
def test_example_case_2():
n = 6
edges = [(1, 2), (1, 3), (3, 4), (3, 5), (5, 6)]
q = 4
... | [
{
"docstring": null,
"function_declaration": "def preprocess_LCA(n, tree, root=1):",
"function_name": "preprocess_LCA",
"parameter_list": "(n, tree, root=1)"
},
{
"docstring": null,
"function_declaration": "def find_LCA(u, v, parent, level):",
"function_name": "find_LCA",
"parame... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import sys\nfrom collections import defaultdict, deque\nfrom math import log2, ceil\n\nsys.setrecursionlimit(200000)\n\ndef preprocess_LCA(n, tree, root=1):\n l... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00038475",
"row_id": 38475,
"seed_ids": "[4000]"
} | 0.568126 | Taco_38475 | I | [
"preprocess_LCA",
"find_LCA",
"lca_tree"
] | 3 | [
[
"lca_tree",
"find_LCA"
],
[
"lca_tree",
"preprocess_LCA"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | ba0531514c5966c66905c4278259f207c4a17efe | 72197ed6464136a33b3b05f16fbd43c096ecc309 | |||
v1.0 | instruct | Taco | Taco_38488_I | In a faraway kingdom, there exists an ancient game called "Number Bridges". This game involves a rectangular grid with dimensions N x M. Each cell in the grid contains a non-negative integer that represents the number of bridges that can be built from that cell.
A player can move from any cell (i, j) to its neighborin... | from collections import deque
def can_travel_by_bridges(grid, N, M):
"""
Determines if it's possible to travel from the top-left corner to the bottom-right corner
of the grid based on the game "Number Bridges" rules.
:param grid: List of lists, representing the grid
:param N: Number of rows
... | def test_can_travel_by_bridges():
# Test case 1
grid1 = [
[3, 1, 2],
[0, 2, 1],
[1, 1, 3]
]
assert can_travel_by_bridges(grid1, 3, 3) == "Impossible"
# Test case 2
grid2 = [
[1, 2, 3, 4, 5],
[5, 4, 3, 2, 1],
[2, 2, 2, 2, 2],
[9, 8, 7, ... | [
{
"docstring": "Determines if it's possible to travel from the top-left corner to the bottom-right corner\nof the grid based on the game \"Number Bridges\" rules.\n\n:param grid: List of lists, representing the grid\n:param N: Number of rows\n:param M: Number of columns\n:return: \"Possible\" or \"Impossible\""... | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_possible_to_travel(grid, N, M):\n from collections import deque\n\n def valid(x, y):\n return 0 <= x < N and 0 <= y < M\n \n directions =... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038488",
"row_id": 38488,
"seed_ids": "[4896]"
} | 0.695692 | Taco_38488 | I | [
"can_travel_by_bridges",
"number_bridges"
] | 2 | [
[
"number_bridges",
"can_travel_by_bridges"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | 3c09d1cace7091b0f30f543e5b382a31d7f2bb91 | 0791ef452760edd05b22502d52ee15940b794cd7 | |||
v1.0 | instruct | Taco | Taco_38525_I | Nikita is trying to escape from a maze, which can be represented as a grid of N rows and M columns. Some cells in the grid are blocked, and others are not. Nikita can move up, down, left, or right, but cannot move diagonally or through blocked cells. She needs to find the shortest path from her starting position to the... | from collections import deque
def shortest_path(grid, start, end):
rows, cols = len(grid), len(grid[0])
directions = [(-1, 0), (1, 0), (0, -1), (0, 1)]
queue = deque([(start[0], start[1], 0)]) # (row, col, distance)
visited = set()
visited.add((start[0], start[1]))
while queue:
row, c... | from solution import get_shortest_path_length
def test_shortest_path_basic():
grid = [
"s#...",
".#.#.",
".#...",
".###.",
"...e."
]
assert get_shortest_path_length(5, 5, grid) == 7
def test_no_path():
grid = [
"s#.",
"###",
"..e"
]
... | [
{
"docstring": null,
"function_declaration": "def shortest_path(grid, start, end):",
"function_name": "shortest_path",
"parameter_list": "(grid, start, end)"
},
{
"docstring": null,
"function_declaration": "def get_shortest_path_length(n, m, grid):",
"function_name": "get_shortest_pa... | [
0,
0,
0,
1,
0
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import deque\n\ndef shortest_path_in_maze(N, M, grid):\n def is_valid_move(x, y):\n return 0 <= x < N and 0 <= y < M and grid[x][y] != '... | trial_gpt4o_3 | {
"original_instruction": "",
"prompt_id": "00038525",
"row_id": 38525,
"seed_ids": "[5188]"
} | 0.718383 | Taco_38525 | I | [
"shortest_path",
"get_shortest_path_length"
] | 2 | [
[
"get_shortest_path_length",
"shortest_path"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 877bdcd4ab1514ff7feb209e29d5417453231bb3 | 1571898d58067cf510a42189f1c8fc1d593faaaf | |||
v1.0 | instruct | Taco | Taco_38654_I | You are instructed to develop an application that helps a university manage their course scheduling in a way that minimizes faculty workload conflicts. Specifically, you need to ensure that no faculty member is scheduled to teach more than one course at any given time.
### Problem Statement
You are given a list of co... | def can_schedule_courses(course_list):
from collections import defaultdict
def check_conflicts(schedule):
for faculty, times in schedule.items():
times.sort()
for i in range(1, len(times)):
if times[i][0] < times[i-1][1]:
return False
... | from solution import manage_course_scheduling
def test_manage_course_scheduling_no_conflict():
input_data = """
3
alice 9 12
bob 10 13
alice 12 14
0
"""
expected_output = "Yes\nalice 9 12 12 14\nbob 10 13"
assert manage_course_scheduling(input_data).strip() == expected_output.strip(... | [
{
"docstring": null,
"function_declaration": "def can_schedule_courses(course_list):",
"function_name": "can_schedule_courses",
"parameter_list": "(course_list)"
},
{
"docstring": null,
"function_declaration": "def parse_input(data):",
"function_name": "parse_input",
"parameter_l... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def can_schedule_courses(courses):\n from collections import defaultdict\n\n def no_conflict(schedule):\n # Check if there are any overlapping interva... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038654",
"row_id": 38654,
"seed_ids": "[3008]"
} | 0.663002 | Taco_38654 | I | [
"can_schedule_courses",
"parse_input",
"manage_course_scheduling"
] | 3 | [
[
"manage_course_scheduling",
"can_schedule_courses"
],
[
"manage_course_scheduling",
"parse_input"
]
] | 2 | [
"parse_input"
] | false | [] | false | pytest | true | [] | true | 92039bd181aaf98ff8f1a0c5b968e6de2797e98c | b26e74b67436b25946df550a5301b23c3ce82173 | |||
v1.0 | instruct | Taco | Taco_38682_I | Anna is passionate about puzzles and recently she came across a chessboard puzzle. Given a standard 8x8 chessboard with some squares marked with `X` to indicate obstacles, Anna needs to determine the minimum number of moves required for a knight to travel from a given start position to a given destination position. If ... | from collections import deque
def is_valid(x, y, board):
return 0 <= x < 8 and 0 <= y < 8 and board[x][y] == 0
def bfs_knight_moves(start, end, board):
directions = [
(2, 1), (2, -1), (-2, 1), (-2, -1),
(1, 2), (1, -2), (-1, 2), (-1, -2)
]
queue = deque([(start[0], start[1], 0)]) ... | import pytest
from solution import knight_moves
def test_knight_moves_no_obstacle():
T = 1
test_cases = [
{'start': (0, 0), 'end': (7, 7), 'obstacles': []}
]
result = knight_moves(T, test_cases)
assert result == [6]
def test_knight_moves_with_obstacle():
T = 1
test_cases = [
... | [
{
"docstring": null,
"function_declaration": "def is_valid(x, y, board):",
"function_name": "is_valid",
"parameter_list": "(x, y, board)"
},
{
"docstring": null,
"function_declaration": "def bfs_knight_moves(start, end, board):",
"function_name": "bfs_knight_moves",
"parameter_li... | [
0,
0,
0,
1,
1
] | 2 | medium | 0.4 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import deque\n\ndef min_knight_moves(start, end, obstacles):\n directions = [\n (2, 1), (2, -1), (-2, 1), (-2, -1),\n (1, 2), (1,... | trial_gpt4o_4 | {
"original_instruction": "",
"prompt_id": "00038682",
"row_id": 38682,
"seed_ids": "[16651]"
} | 0.711609 | Taco_38682 | I | [
"is_valid",
"bfs_knight_moves",
"knight_moves"
] | 3 | [
[
"bfs_knight_moves",
"is_valid"
],
[
"knight_moves",
"bfs_knight_moves"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 2bea84e6872d3280426d9f243f5eb579279261cc | 1c1c79a3bc55cd400f78d40199a209a67d6146d6 | |||
v1.0 | instruct | Taco | Taco_38746_I | Given an integer matrix `M` of size `N x N`, you need to find the maximum sum of elements in any submatrix of `M`.
A submatrix of `M` is a matrix that is formed by deleting several (possibly zero) rows from the top and bottom and several (possibly zero) columns from the left and right.
------ Input ------
The first ... | def maximum_sum_submatrix(matrix):
def kadane(nums):
max_sum = current_sum = nums[0]
for num in nums[1:]:
current_sum = max(num, current_sum + num)
max_sum = max(max_sum, current_sum)
return max_sum
N = len(matrix)
max_sum = float('-inf')
for lef... | from solution import parse_input, process_test_cases, process_output
def test_maximum_sum_submatrix():
input_string = "1\n3\n1 2 3\n4 5 6\n7 8 9\n"
test_cases = parse_input(input_string)
result = process_test_cases(test_cases)
output = process_output(result)
assert output == "45"
def test_maximum_... | [
{
"docstring": null,
"function_declaration": "def maximum_sum_submatrix(matrix):",
"function_name": "maximum_sum_submatrix",
"parameter_list": "(matrix)"
},
{
"docstring": null,
"function_declaration": "def process_test_cases(test_cases):",
"function_name": "process_test_cases",
... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def maximum_sum_submatrix(matrix):\n def kadane(array):\n max_sum = float('-inf')\n current_sum = 0\n for x in array:\n current_... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038746",
"row_id": 38746,
"seed_ids": "[24524]"
} | 0.673346 | Taco_38746 | I | [
"maximum_sum_submatrix",
"process_test_cases",
"parse_input",
"process_output"
] | 4 | [
[
"process_test_cases",
"maximum_sum_submatrix"
]
] | 1 | [
"process_test_cases",
"parse_input"
] | false | [] | false | pytest | true | [] | true | a6bbe5e424776313d58b622397248fc9956c4d05 | 3aa9edb02fa77ebb3aeefa37333a9849c8bc9f99 | |||
v1.0 | instruct | Taco | Taco_38786_I | Toyland is a small town with n houses numbered from 1 to n, and it is designed as a tree (all houses are connected with n-1 bidirectional roads without cycles). The mayor of Toyland wants to build a new playground for children and is looking for the optimal location for it.
The optimal location is defined as the house... | def find_centroid(n, edges):
from collections import defaultdict
# Build the tree
tree = defaultdict(list)
for u, v in edges:
tree[u].append(v)
tree[v].append(u)
# To store the size of each subtree
size = [0] * (n + 1)
# Function to compute size of subtree using DF... | from solution import optimal_house
def test_example_1():
n = 5
connections = ["1 2", "1 3", "3 4", "3 5"]
assert optimal_house(n, connections) == 3
def test_example_2():
n = 4
connections = ["1 2", "2 3", "3 4"]
assert optimal_house(n, connections) == 2
def test_single_node():
n = 1
c... | [
{
"docstring": null,
"function_declaration": "def find_centroid(n, edges):",
"function_name": "find_centroid",
"parameter_list": "(n, edges)"
},
{
"docstring": null,
"function_declaration": "def optimal_house(n, connections):",
"function_name": "optimal_house",
"parameter_list": ... | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0
] | 1 | hard | 0.1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import defaultdict, deque\n\ndef find_optimal_playground(n, roads):\n if n == 1:\n return 1\n \n # Build the graph.\n graph = d... | trial_gpt4o_6 | {
"original_instruction": "",
"prompt_id": "00038786",
"row_id": 38786,
"seed_ids": "[22685]"
} | 0.657723 | Taco_38786 | I | [
"find_centroid",
"optimal_house"
] | 2 | [
[
"optimal_house",
"find_centroid"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | d5bfb6f002669ff0127bd6f2406d80dbcc1ff277 | 04b5401c298b83ba62da3bc37a3999bc8efc7907 | |||
v1.0 | instruct | Taco | Taco_38828_I | You are given an array of integers and a set of operations. Each operation will reverse the subarray between two given indices.
You need to determine the number of inversions in the array after performing all the given operations. An inversion is a pair of indices (i, j) such that i < j and arr[i] > arr[j].
Input
Th... | def count_inversions(arr):
"""
Function to count number of inversions in the array.
"""
n = len(arr)
temp_arr = [0] * n
return merge_sort(arr, temp_arr, 0, n - 1)
def merge_sort(arr, temp_arr, left, right):
"""
Function to sort the array and count inversions.
"""
inv_count = 0
... | from solution import number_of_inversions
def test_example1():
n = 5
q = 3
arr = [6, 3, 9, 1, 7]
operations = [(1, 3), (2, 4), (1, 5)]
assert number_of_inversions(n, q, arr, operations) == 5
def test_example2():
n = 4
q = 2
arr = [10, 20, 30, 40]
operations = [(1, 4), (1, 4)]
a... | [
{
"docstring": "Function to count number of inversions in the array.",
"function_declaration": "def count_inversions(arr):",
"function_name": "count_inversions",
"parameter_list": "(arr)"
},
{
"docstring": "Function to sort the array and count inversions.",
"function_declaration": "def m... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def count_inversions(arr):\n \"\"\"\n Counts the number of inversions in the array.\n \"\"\"\n return _merge_sort_and_count(arr, 0, len(arr) - 1)\n\nde... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00038828",
"row_id": 38828,
"seed_ids": "[6051]"
} | 0.791592 | Taco_38828 | I | [
"count_inversions",
"merge_sort",
"merge",
"reverse_subarray",
"number_of_inversions"
] | 5 | [
[
"count_inversions",
"merge_sort"
],
[
"merge_sort",
"merge"
],
[
"number_of_inversions",
"count_inversions"
],
[
"number_of_inversions",
"reverse_subarray"
]
] | 4 | [] | false | [] | false | pytest | true | [] | true | 0f19bcc6c6864621af899d843b79f1cdd56295d4 | 5ea8e66d66e4148984d34b83bf49f553cc3531e5 | |||
v1.0 | instruct | Taco | Taco_38853_I | You are given a matrix with $N$ rows and $M$ columns. You need to answer $Q$ queries about the sum of values within submatrices.
For each query, you should calculate the sum of values in the submatrix starting from $(r1, c1)$ to $(r2, c2)$ (inclusive).
------ Input ------
The first line of the input contains a singl... | def calculate_prefix_sum(matrix):
"""
Calculates and returns the prefix sum matrix for the given matrix.
"""
N = len(matrix)
M = len(matrix[0])
prefix_sum = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
for j in range(1, M + 1):
prefix_sum[i][j] = (... | import pytest
from solution import solve
def test_sample_input_1():
T = 1
test_cases = [
{
'N': 3,
'M': 3,
'matrix': [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
],
'Q': 2,
'queries': [
... | [
{
"docstring": "Calculates and returns the prefix sum matrix for the given matrix.",
"function_declaration": "def calculate_prefix_sum(matrix):",
"function_name": "calculate_prefix_sum",
"parameter_list": "(matrix)"
},
{
"docstring": "Calculates the sum of the submatrix defined by (r1, c1) t... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def compute_prefix_sums(matrix, N, M):\n prefix_sums = [[0] * (M + 1) for _ in range(N + 1)]\n for i in range(1, N + 1):\n for j in range(1, M + 1):\n... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038853",
"row_id": 38853,
"seed_ids": "[18980]"
} | 0.656129 | Taco_38853 | I | [
"calculate_prefix_sum",
"sum_query",
"solve"
] | 3 | [
[
"solve",
"calculate_prefix_sum"
],
[
"solve",
"sum_query"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | aecc2fccfd5cd6325f576625b214cc9a97027a19 | e944019a56c5ce2d1fd89a19878ae9b6e4b4f218 | |||
v1.0 | instruct | Taco | Taco_38938_I | A string is considered almost-palindromic if it can become a palindrome by removing at most one character. Given a string `S`, your task is to determine if it is almost-palindromic.
Return `True` if the string can be converted to a palindrome by removing at most one character, otherwise return `False`.
Examples:
Exam... | def isPalindrome(s, left, right):
"""
Returns True if the substring s[left:right+1] is a palindrome.
"""
while left < right:
if s[left] != s[right]:
return False
left += 1
right -= 1
return True
def isAlmostPalindrome(S):
"""
Returns True if the string S ... | def test_almost_palindrome_examples():
assert isAlmostPalindrome("abca") == True
assert isAlmostPalindrome("abcdef") == False
def test_palindrome():
assert isAlmostPalindrome("racecar") == True
assert isAlmostPalindrome("madam") == True
def test_almost_palindrome_different_cases():
assert isAlmost... | [
{
"docstring": "Returns True if the substring s[left:right+1] is a palindrome.",
"function_declaration": "def isPalindrome(s, left, right):",
"function_name": "isPalindrome",
"parameter_list": "(s, left, right)"
},
{
"docstring": "Returns True if the string S can be turned into a palindrome ... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def isAlmostPalindrome(S):\n \"\"\"\n Determine if the string S is almost-palindromic, meaning it can become\n a palindrome by removing at most one charac... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00038938",
"row_id": 38938,
"seed_ids": "[8513]"
} | 0.707566 | Taco_38938 | I | [
"isPalindrome",
"isAlmostPalindrome"
] | 2 | [
[
"isAlmostPalindrome",
"isPalindrome"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | 704b00ffd8b769b846ee4d700563a842b46c260d | b528acc7ee0743dd4e409044fa1824283e6c14ba | |||
v1.0 | instruct | Taco | Taco_38976_I | In a beautiful city, there is a fantastic network of paths that connects various attractions. Each attraction is numbered and there are one-way paths between some of the attractions. Every path has a specific travel time associated with it. As a visitor, you want to minimize the time it takes to visit as many attractio... | import heapq
def dijkstra(n, edges, start):
graph = [[] for _ in range(n)]
for u, v, w in edges:
graph[u].append((w, v))
distances = [float('inf')] * n
distances[start] = 0
min_heap = [(0, start)]
while min_heap:
current_distance, u = heapq.heappop(min_heap)
... | from solution import find_shortest_paths
def test_example_case():
t = 2
test_cases = [
(4, 4, [(0, 1, 1), (0, 2, 4), (1, 2, 2), (2, 3, 1)], 0),
(3, 3, [(0, 1, 2), (1, 2, 3), (0, 2, 5)], 1)
]
result = find_shortest_paths(t, test_cases)
assert result == [
[0, 1, 3, 4],
... | [
{
"docstring": null,
"function_declaration": "def dijkstra(n, edges, start):",
"function_name": "dijkstra",
"parameter_list": "(n, edges, start)"
},
{
"docstring": null,
"function_declaration": "def find_shortest_paths(t, test_cases):",
"function_name": "find_shortest_paths",
"pa... | [
1,
1
] | 2 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import heapq\n\ndef shortest_paths(t, test_cases):\n results = []\n for case in test_cases:\n n, m, edges, s = case\n \n # Create adjace... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00038976",
"row_id": 38976,
"seed_ids": "[16824]"
} | 0.780964 | Taco_38976 | I | [
"dijkstra",
"find_shortest_paths"
] | 2 | [
[
"find_shortest_paths",
"dijkstra"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 7bd305a1e04659e89cf60c794003a712b320239f | 1e55fe9ffd1079b8a3f07e5d504d80e8dd4e4c4f | |||
v1.0 | instruct | Taco | Taco_38978_I | Given a binary tree, the task is to complete the function deepestLeafSum() which returns an integer denoting the sum of the values of the nodes at the deepest level of the binary tree.
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case start... | from collections import deque
class TreeNode:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def deepestLeafSum(root):
if not root:
return 0
queue = deque([root])
current_sum = 0
while queue:
current_sum = 0
lev... | def test_deepestLeafSum():
assert processTestCases([[1, 2, 3, 4, 5, -1, 6]]) == [15]
assert processTestCases([[10, 20, 30, -1, 40]]) == [40]
assert processTestCases([[1, 2, 3, -1, -1, 4, 5]]) == [9]
assert processTestCases([[5, 3, 8, 1, 4, 7, 10, -1, 2]]) == [2]
assert processTestCases([[7]]) == [7]... | [] | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "class Node:\n def __init__(self, data):\n self.data = data\n self.left = None\n self.right = None\n\ndef deepestLeafSum(root):\n if not ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00038978",
"row_id": 38978,
"seed_ids": "[7805]"
} | 0.705311 | Taco_38978 | I | [
"deepestLeafSum",
"buildTree",
"processTestCases"
] | 3 | [
[
"processTestCases",
"buildTree"
],
[
"processTestCases",
"deepestLeafSum"
]
] | 2 | [
"processTestCases"
] | false | [
"TreeNode"
] | true | pytest | false | [] | true | e9bc66a90500585609933a727c9b3a249e8cca94 | d6feb8e961eef68097a1e930fc9e51b65cd213cd | |||
v1.0 | instruct | Taco | Taco_39024_I | In a popular programming contest, there is a particular type of problem that involves arrays and queries. You are given an array of integers. The task is to handle multiple queries that ask for the maximum value within a specified subarray.
Disco lives in an apartment with an $N$-length corridor numbered from 1 to N, ... | def preprocess_temperatures(temperatures):
"""
Preprocess the temperature readings using a sparse table to allow
for constant time maximum range queries.
"""
import math
# Number of rooms
n = len(temperatures)
# Determine max power of 2 needed for the sparse table
max_log = ma... | def test_preprocess_temperatures():
temperatures = [1, 2, 3, 4, 5]
st = preprocess_temperatures(temperatures)
assert st[0][0] == 1
assert st[1][0] == 2
assert st[4][0] == 5
assert st[0][1] == 2
assert st[0][2] == 4
def test_query_max():
temperatures = [1, 2, 3, 4, 5]
st = prepr... | [
{
"docstring": "Preprocess the temperature readings using a sparse table to allow \nfor constant time maximum range queries.",
"function_declaration": "def preprocess_temperatures(temperatures):",
"function_name": "preprocess_temperatures",
"parameter_list": "(temperatures)"
},
{
"docstring"... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import sys\n\ndef preprocess_temperatures(temperatures):\n \"\"\"\n Preprocess the temperatures with a Sparse Table for fast range maximum queries.\n \"\"... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039024",
"row_id": 39024,
"seed_ids": "[11192]"
} | 0.746013 | Taco_39024 | I | [
"preprocess_temperatures",
"query_max",
"answer_queries"
] | 3 | [
[
"answer_queries",
"preprocess_temperatures"
],
[
"answer_queries",
"query_max"
]
] | 2 | [] | false | [] | false | pytest | false | [] | true | e60771bd21d03bfd0f663464df6aa36b39e382a0 | dbedd0f72d65a1515d44728b55258c5793d1db83 | |||
v1.0 | instruct | Taco | Taco_39028_I | Alice loves playing card games and she has decided to write a program that simulates a simplified version of poker hands assessment. In this version, each hand consists of five cards, and the following hand rankings are considered:
**One Pair**: Two cards of the same rank.
**Two Pair**: Two different pairs.
**Three of... | def card_rank_to_num(card):
rank = card[0]
if rank in '23456789':
return int(rank)
elif rank == 'T':
return 10
elif rank == 'J':
return 11
elif rank == 'Q':
return 12
elif rank == 'K':
return 13
elif rank == 'A':
return 14
def analyze_hand(han... | from solution import best_hand_rank
def test_single_hand():
n = 1
hands = ["2H 3D 5S 9C KD"]
assert best_hand_rank(n, hands) == ["High Card"]
def test_flush_hand():
n = 1
hands = ["2H 4H 5H 9H KH"]
assert best_hand_rank(n, hands) == ["Flush"]
def test_straight_flush_hand():
n = 1
hand... | [
{
"docstring": null,
"function_declaration": "def card_rank_to_num(card):",
"function_name": "card_rank_to_num",
"parameter_list": "(card)"
},
{
"docstring": null,
"function_declaration": "def analyze_hand(hand):",
"function_name": "analyze_hand",
"parameter_list": "(hand)"
},
... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def evaluate_hand(hand):\n \"\"\"\n Evaluates a poker hand and returns its best ranking.\n \n :param hand: A list of five cards, each represented as a ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039028",
"row_id": 39028,
"seed_ids": "[9367]"
} | 0.628218 | Taco_39028 | I | [
"card_rank_to_num",
"analyze_hand",
"best_hand_rank"
] | 3 | [
[
"analyze_hand",
"card_rank_to_num"
],
[
"best_hand_rank",
"analyze_hand"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 5c53782ac2927d94f3c5a914624961520f5e07cd | 4ffd970ffc34706d1bc802a411516ffd7e099510 | |||
v1.0 | instruct | Taco | Taco_39038_I | You are given a list of positive integers. Your task is to find out whether each integer can be expressed as the sum of exactly three even integers greater than zero.
Input
The first line contains a single integer t (1 ≤ t ≤ 5000), the number of test cases.
Each of the next t lines contains a single positive integer... | def find_three_evens_sum(test_cases):
results = []
for n in test_cases:
if n >= 6 and n % 2 == 0:
results.append((2, 2, n - 4)) # Any even number n >= 6 can be expressed as 2 + 2 + (n-4)
else:
results.append(-1)
return results
def process_input_and_solve(t, numbers)... | from solution import process_input_and_solve
def test_process_input_and_solve():
# Test case 1
t = 4
numbers = [12, 18, 8, 15]
result = process_input_and_solve(t, numbers)
assert result[0] == (2, 2, 8) or result[0] == (2, 4, 6) or result[0] == (4, 4, 4) or result[0] == (4, 2, 6) or result[0] == (6,... | [
{
"docstring": null,
"function_declaration": "def find_three_evens_sum(test_cases):",
"function_name": "find_three_evens_sum",
"parameter_list": "(test_cases)"
},
{
"docstring": null,
"function_declaration": "def process_input_and_solve(t, numbers):",
"function_name": "process_input_... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def find_three_evens_sum(test_cases):\n results = []\n for n in test_cases:\n if n >= 6 and n % 2 == 0:\n results.append((2, 2, n - 4)) # ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039038",
"row_id": 39038,
"seed_ids": "[15944]"
} | 0.705789 | Taco_39038 | I | [
"find_three_evens_sum",
"process_input_and_solve"
] | 2 | [
[
"process_input_and_solve",
"find_three_evens_sum"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 50fde452b0a8fec8cb216a7ea94151aa63683b98 | 92e04a7dc8cebfe0d01b794d637e2443fef29cea | |||
v1.0 | instruct | Taco | Taco_39129_I | About Sorting and Searching Algorithms
This set of challenges focuses on understanding and implementing various sorting and searching algorithms that are essential in computer science. As you work through these problems, you'll not only solidify your understanding of these concepts but also improve your problem-solvin... | def countInversions(arr):
n = len(arr)
temp_arr = [0]*n
return _mergeSort(arr, temp_arr, 0, n-1)
def _mergeSort(arr, temp_arr, left, right):
inv_count = 0
if left < right:
mid = (left + right)//2
inv_count += _mergeSort(arr, temp_arr, left, mid)
inv_count += _mergeSort(arr... | from solution import countInversions
def test_countInversions_sample():
arr = [2, 4, 1, 3, 5]
assert countInversions(arr) == 3
def test_countInversions_sorted():
arr = [1, 2, 3, 4, 5]
assert countInversions(arr) == 0
def test_countInversions_reverse():
arr = [5, 4, 3, 2, 1]
assert countInvers... | [
{
"docstring": null,
"function_declaration": "def countInversions(arr):",
"function_name": "countInversions",
"parameter_list": "(arr)"
},
{
"docstring": null,
"function_declaration": "def _mergeSort(arr, temp_arr, left, right):",
"function_name": "_mergeSort",
"parameter_list": ... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def countInversions(arr):\n def merge_and_count(arr, temp_arr, left, mid, right):\n i = left # Starting index for left subarray\n j = mid + 1 #... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039129",
"row_id": 39129,
"seed_ids": "[6149]"
} | 0.729253 | Taco_39129 | I | [
"countInversions",
"_mergeSort",
"_merge"
] | 3 | [
[
"_mergeSort",
"_merge"
],
[
"countInversions",
"_mergeSort"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 470f76719bced6840314610143ec48c95231e994 | e6582fe3d1da52d39bb3de40dae8c018c74ed18c | |||
v1.0 | instruct | Taco | Taco_39136_I | In the kingdom of Zombieland, there lives a group of friendly zombies who love to play with numbers. One day, Zombie King Zed devised a new game called "Number-Friends". In this game, two zombies are considered "number-friends" if the sum of the digits of their ages is equal. The zombies want to form the maximum number... | from collections import Counter
def sum_of_digits(n):
return sum(int(digit) for digit in str(n))
def max_number_friend_pairs(ages):
digit_sum_count = Counter(sum_of_digits(age) for age in ages)
return sum(count // 2 for count in digit_sum_count.values()) | from solution import max_number_friend_pairs
def test_example1():
assert max_number_friend_pairs([12, 21, 13, 31, 22]) == 2
def test_example2():
assert max_number_friend_pairs([18, 99, 27, 54]) == 1
def test_single_zombie():
assert max_number_friend_pairs([10]) == 0
def test_no_pairs():
assert max_n... | [
{
"docstring": null,
"function_declaration": "def sum_of_digits(n):",
"function_name": "sum_of_digits",
"parameter_list": "(n)"
},
{
"docstring": null,
"function_declaration": "def max_number_friend_pairs(ages):",
"function_name": "max_number_friend_pairs",
"parameter_list": "(ag... | [
0,
0,
0,
0,
0,
0,
0,
0,
1
] | 1 | hard | 0.111 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import defaultdict\n\ndef max_number_friends(zombie_ages):\n \"\"\"\n Returns the maximum number of number-friend pairs that can be formed\n... | trial_gpt4o_9 | {
"original_instruction": "",
"prompt_id": "00039136",
"row_id": 39136,
"seed_ids": "[16413]"
} | 0.628562 | Taco_39136 | I | [
"sum_of_digits",
"max_number_friend_pairs"
] | 2 | [
[
"max_number_friend_pairs",
"sum_of_digits"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 5d00162098b640739e85615b10bfbc6a054560f6 | 8e5b45d3d4f98cf7cd5cd0e0682b03da7483c985 | |||
v1.0 | instruct | Taco | Taco_39141_I | Alex is learning about prime numbers, but he finds it challenging to determine if a given number is a prime. He decides to write a program that will help him with this task. Your job is to assist Alex by creating a program that can check if a number is a prime number and count all the prime numbers less than or equal t... | def sieve_of_eratosthenes(n):
"""
Computes the list of prime numbers up to n using the Sieve of Eratosthenes algorithm.
"""
is_prime = [True] * (n + 1)
p = 2
while (p * p <= n):
if (is_prime[p] == True):
for i in range(p * p, n + 1, p):
is_prime[i] = False
... | from solution import sieve_of_eratosthenes, count_primes_up_to_n
def test_sieve_of_eratosthenes():
prime_counts = sieve_of_eratosthenes(20)
assert prime_counts[5] == 3
assert prime_counts[10] == 4
assert prime_counts[20] == 8
assert prime_counts[1] == 0
assert prime_counts[2] == 1
def test_cou... | [
{
"docstring": "Computes the list of prime numbers up to n using the Sieve of Eratosthenes algorithm.",
"function_declaration": "def sieve_of_eratosthenes(n):",
"function_name": "sieve_of_eratosthenes",
"parameter_list": "(n)"
},
{
"docstring": null,
"function_declaration": "def count_pr... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def count_primes_up_to_n(n, is_prime):\n \"\"\"\n Counts the number of primes up to and including n.\n \"\"\"\n count = 0\n for i in range(2, n + 1)... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039141",
"row_id": 39141,
"seed_ids": "[8287]"
} | 0.684694 | Taco_39141 | I | [
"sieve_of_eratosthenes",
"count_primes_up_to_n"
] | 2 | [
[
"count_primes_up_to_n",
"sieve_of_eratosthenes"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 33b83819f4a3abe4ad2ebd2d6e432f534a9b10a0 | 6b88607e3e27fc0be24be627cb262bcbe2374bd8 | |||
v1.0 | instruct | Taco | Taco_39155_I | A binary tree is a tree data structure in which each node has at most two children, referred to as the left child and the right child. Given the inorder and postorder traversals of a binary tree, write a function to reconstruct the binary tree and output its level-order traversal.
Example 1:
Input: inorder = [9, 3, 15... | from collections import deque
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def buildTreeFromInorderPostorder(inorder, postorder):
if not inorder or not postorder:
return None
# Create a hashmap... | from solution import buildTree
def test_example_1():
inorder = [9, 3, 15, 20, 7]
postorder = [9, 15, 7, 20, 3]
assert buildTree(inorder, postorder) == [3, 9, 20, 15, 7]
def test_example_2():
inorder = [2, 1]
postorder = [2, 1]
assert buildTree(inorder, postorder) == [1, 2]
def test_single_nod... | [] | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import deque\n\nclass TreeNode:\n def __init__(self, val=0, left=None, right=None):\n self.val = val\n self.left = left\n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039155",
"row_id": 39155,
"seed_ids": "[3879]"
} | 0.591339 | Taco_39155 | I | [
"buildTreeFromInorderPostorder",
"levelOrderTraversal",
"buildTree"
] | 3 | [
[
"buildTree",
"buildTreeFromInorderPostorder"
],
[
"buildTree",
"levelOrderTraversal"
]
] | 2 | [] | false | [
"TreeNode"
] | true | pytest | true | [] | true | f9d5a9bfdef27dc521dba2039307a3ba0673d2c1 | fd3d2a9ae51a94a16fd3ef75a9d6f9b9f36a0613 | |||
v1.0 | instruct | Taco | Taco_39174_I | You are given an array of integers representing a binary tree in a level order traversal. Each element of the array represents a node of the tree. If an element in the array is `null`, it indicates that there is no node at that position in the tree.
Your task is to determine whether the given binary tree is a valid Bi... | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def build_tree_from_level_order(level_order):
if not level_order or level_order[0] is None:
return None
root = TreeNode(level_order[0])
queue = [root... | from solution import isValidBST
def test_sample():
assert isValidBST([3, 9, 20, None, None, 15, 7]) == False
def test_large_valid_bst():
assert isValidBST([50, 30, 70, 20, 40, 60, 80]) == True
def test_invalid_bst_left_violation():
assert isValidBST([10, 5, 15, None, None, 6, 20]) == False
def test_inva... | [] | [
0,
0,
0,
1,
0
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def isValidBST(tree):\n \"\"\"\n Returns True if the given binary tree is a valid Binary Search Tree (BST), False otherwise.\n :param tree: List of intege... | trial_gpt4o_3 | {
"original_instruction": "",
"prompt_id": "00039174",
"row_id": 39174,
"seed_ids": "[23114]"
} | 0.664963 | Taco_39174 | I | [
"build_tree_from_level_order",
"isValidBST"
] | 2 | [
[
"isValidBST",
"build_tree_from_level_order"
]
] | 1 | [] | false | [
"TreeNode"
] | true | pytest | true | [] | true | eb72f7df2daeda18d1068bbdc7a4141fbf7f003a | b19daf73757d0d460882f3632dcac81f6db9a5ee | |||
v1.0 | instruct | Taco | Taco_39218_I | Write a program to simulate a game of Rock, Paper, Scissors between a player and the computer. The game should be played over multiple rounds, and after each round, the program should provide the current score. The game ends when the user types "exit". Follow these rules for the game:
* Rock beats Scissors
* Scissors ... | import random
def get_computer_choice():
return random.choice(['rock', 'paper', 'scissors'])
def determine_winner(player_choice, computer_choice):
if player_choice == computer_choice:
return 'draw'
elif (player_choice == "rock" and computer_choice == "scissors") or \
(player_choice == "sc... | from solution import determine_winner
def test_rock_beats_scissors():
assert determine_winner("rock", "scissors") == "win"
def test_scissors_lose_to_rock():
assert determine_winner("scissors", "rock") == "lose"
def test_scissors_beat_paper():
assert determine_winner("scissors", "paper") == "win"
def tes... | [
{
"docstring": null,
"function_declaration": "def get_computer_choice():",
"function_name": "get_computer_choice",
"parameter_list": "()"
},
{
"docstring": null,
"function_declaration": "def determine_winner(player_choice, computer_choice):",
"function_name": "determine_winner",
... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import random\n\ndef get_computer_choice():\n return random.choice(['rock', 'paper', 'scissors'])\n\ndef determine_winner(player_choice, computer_choice):\n ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039218",
"row_id": 39218,
"seed_ids": "[4636]"
} | 0.621493 | Taco_39218 | I | [
"get_computer_choice",
"determine_winner",
"play_game"
] | 3 | [
[
"play_game",
"determine_winner"
],
[
"play_game",
"get_computer_choice"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 3a837b170c562e2379a826143bf152976766416f | 51ba216ecf6bd0e1153bded82c8eb7a680db2d00 | |||
v1.0 | instruct | Taco | Taco_39236_I | A binary tree is a data structure in which each node has at most two children, referred to as the left child and the right child. Your task is to implement a program that constructs a binary tree given its preorder and inorder traversal sequences, and then prints its postorder traversal.
### Definitions:
- **Preorder... | class TreeNode:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def build_tree(preorder, inorder):
if not preorder or not inorder:
return None
root_value = preorder[0]
root = TreeNode(root_value)
root_index_in_inorder = inor... | def test_construct_tree_and_get_postorder():
# Test case 1
n = 7
preorder = [1, 2, 4, 5, 3, 6, 7]
inorder = [4, 2, 5, 1, 6, 3, 7]
expected_postorder = [4, 5, 2, 6, 7, 3, 1]
assert construct_tree_and_get_postorder(n, preorder, inorder) == expected_postorder
# Test case 2
n = 3
pr... | [] | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "class TreeNode:\n def __init__(self, val=0, left=None, right=None):\n self.val = val\n self.left = left\n self.right = right\n\ndef build_t... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039236",
"row_id": 39236,
"seed_ids": "[1729]"
} | 0.627895 | Taco_39236 | I | [
"build_tree",
"postorder_traversal",
"construct_tree_and_get_postorder"
] | 3 | [
[
"construct_tree_and_get_postorder",
"build_tree"
],
[
"construct_tree_and_get_postorder",
"postorder_traversal"
]
] | 2 | [] | false | [
"TreeNode"
] | true | pytest | false | [] | true | 64fb5cabe3e22e6415a54308bdb19de6c3b167c3 | 99d2ffe2ca77501a5aab0425a4643e8133b0c2f8 | |||
v1.0 | instruct | Taco | Taco_39271_I | You are given an array consisting of `N` integers. The array is initially sorted in ascending order. You can perform two types of operations on this array:
- **Type 1**: Insert a new integer into the array.
- **Type 2**: Delete an integer from the array. If the integer is not present in the array, this operation has ... | def process_queries(T, cases):
"""
Processes each test case and queries to perform operations on the sorted array.
"""
outputs = []
for case in cases:
N, arr, Q, queries = case
arr = list(arr)
for query in queries:
op_type, param = query
... | def test_process_queries():
T = 1
cases = [
(
5, [1, 2, 3, 4, 5], 6,
[(1, 6), (3, 3), (2, 4), (3, 4), (2, 6), (3, 5)]
)
]
expected_output = [3, 5, -1]
assert process_queries(T, cases) == expected_output
def test_insert_element():
arr = [1, 3, 4, 5]
... | [
{
"docstring": "Processes each test case and queries to perform operations on the sorted array.",
"function_declaration": "def process_queries(T, cases):",
"function_name": "process_queries",
"parameter_list": "(T, cases)"
},
{
"docstring": "Inserts element x into the sorted array arr.",
... | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from bisect import insort_left, bisect_left\n\ndef process_queries(N, initial_array, queries):\n results = []\n \n # The array needs to be initially sorte... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039271",
"row_id": 39271,
"seed_ids": "[2672]"
} | 0.759741 | Taco_39271 | I | [
"process_queries",
"insert_element",
"delete_element",
"find_kth_smallest"
] | 4 | [
[
"process_queries",
"delete_element"
],
[
"process_queries",
"find_kth_smallest"
],
[
"process_queries",
"insert_element"
]
] | 3 | [
"process_queries"
] | false | [] | false | pytest | false | [] | true | 3dc88cb4c8d67475337162be714aa044209ae922 | c3ba3bf5deff0852977894f4092565b958348be2 | |||
v1.0 | instruct | Taco | Taco_39279_I | Given a binary tree, your task is to determine if it is a balanced binary tree.
A balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differs by more than 1.
Write a function that checks whether a binary tree is balanced or not. Your function should take the roo... | class TreeNode:
def __init__(self, value=0, left=None, right=None):
self.value = value
self.left = left
self.right = right
def build_tree(nodes):
tree_nodes = {}
tree_nodes[1] = TreeNode(nodes[1][0])
for i in range(1, len(nodes)):
value, left, right = nodes[i]
... | from solution import is_balanced
def test_balanced_tree():
n = 3
node_list = [(1, 2, 3), (2, -1, -1), (3, -1, -1)]
assert is_balanced(n, node_list) == True
def test_unbalanced_tree():
n = 7
node_list = [(1, 2, 3), (2, 4, 5), (3, -1, 6), (4, -1, -1), (5, -1, -1), (6, 7, -1), (7, -1, -1)]
assert... | [] | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "class TreeNode:\n def __init__(self, val=0, left=-1, right=-1):\n self.val = val\n self.left = left\n self.right = right\n\ndef is_balanced... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039279",
"row_id": 39279,
"seed_ids": "[10308]"
} | 0.861722 | Taco_39279 | I | [
"build_tree",
"is_balanced_tree",
"is_balanced"
] | 3 | [
[
"is_balanced",
"build_tree"
],
[
"is_balanced",
"is_balanced_tree"
]
] | 2 | [] | false | [
"TreeNode"
] | true | pytest | true | [] | true | 3ae5fa9ae80b06a4e1f49f8e95a1cdba2578d16f | b26ca927c01cd6667886c4591cf4ee5092a9c6a4 | |||
v1.0 | instruct | Taco | Taco_39296_I | # Description
You will be creating a Sudoku solver. Sudoku is a popular number puzzle that you can learn more about [here](https://en.wikipedia.org/wiki/Sudoku).
For this question, you will be given a partially completed 9x9 Sudoku grid and your task is to complete the grid such that all rows, all columns, and all 3... | def is_valid(grid, row, col, num):
"""
Check whether it will be legal to assign num to the given row, col.
"""
# Check if the number is not repeated in the current row and column
for i in range(9):
if grid[row][i] == num or grid[i][col] == num:
return False
# Check if th... | from solution import solve_sudoku
def test_sudoku_solver():
input_grid = [
[5, 3, 0, 0, 7, 0, 0, 0, 0],
[6, 0, 0, 1, 9, 5, 0, 0, 0],
[0, 9, 8, 0, 0, 0, 0, 6, 0],
[8, 0, 0, 0, 6, 0, 0, 0, 3],
[4, 0, 0, 8, 0, 3, 0, 0, 1],
[7, 0, 0, 0, 2, 0, 0, 0, 6],
[0, 6, 0, ... | [
{
"docstring": "Check whether it will be legal to assign num to the given row, col.",
"function_declaration": "def is_valid(grid, row, col, num):",
"function_name": "is_valid",
"parameter_list": "(grid, row, col, num)"
},
{
"docstring": "Solve the Sudoku puzzle by filling the empty cells.\nM... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def solve_sudoku(grid):\n \"\"\"\n Solves the Sudoku puzzle by filling the empty cells.\n Modifies the input grid in-place.\n \"\"\"\n def is_valid(... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039296",
"row_id": 39296,
"seed_ids": "[22484]"
} | 0.6755 | Taco_39296 | I | [
"is_valid",
"solve_sudoku"
] | 2 | [
[
"solve_sudoku",
"is_valid"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | c37f0806115dd708d343d6e7cb5c2d80f1b4114a | 68d86a0ac2567d0e1af486d18c96766a3e1dac03 | |||
v1.0 | instruct | Taco | Taco_39365_I | A group of adventurers is planning a journey through a series of caves. The caves are connected by one-way tunnels, and each tunnel has a certain travel cost. The adventurers want to determine if it is possible to travel from the entrance of the cave system to the treasure located deep inside, and if so, what is the mi... | import heapq
def find_min_travel_cost(T, test_cases):
results = []
for t in range(T):
N = test_cases[t][0]
M = test_cases[t][1]
edges = test_cases[t][2]
adjacency_list = [[] for _ in range(N+1)]
for u, v, w in edges:
adjacency_list[u].append((v, w))
... | def test_solution():
# Test case 1
T = 2
test_cases = [
(5, 6, [
(1, 2, 2),
(1, 3, 3),
(2, 4, 1),
(3, 4, 1),
(4, 5, 4),
(3, 5, 2)
]),
(4, 3, [
(1, 2, 3),
(1, 3, 5),
(2, 4, 1),
... | [
{
"docstring": null,
"function_declaration": "def find_min_travel_cost(T, test_cases):",
"function_name": "find_min_travel_cost",
"parameter_list": "(T, test_cases)"
},
{
"docstring": null,
"function_declaration": "def dijkstra(N, adjacency_list):",
"function_name": "dijkstra",
"... | [
1,
0
] | 1 | medium | 0.5 | {
"trial_gpt4o_0": null,
"trial_gpt4o_1": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared1_results_combined.jsonl",
"solution_code": "import heapq\n\ndef find_min_travel_cost(T, test_cases):\n results = []\n for t in range(T):\n N = test_cases[t][0]\n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039365",
"row_id": 39365,
"seed_ids": "[14665]"
} | 0.740302 | Taco_39365 | I | [
"find_min_travel_cost",
"dijkstra",
"solution"
] | 3 | [
[
"find_min_travel_cost",
"dijkstra"
],
[
"solution",
"find_min_travel_cost"
]
] | 2 | [] | false | [] | false | pytest | false | [] | true | 688c8a736ec0b491c069b57ae72b30498bb086b1 | 5ac596c23648cd0f52bc1392fa48fae603d6f360 | |||
v1.0 | instruct | Taco | Taco_39390_I | You are given a grid of size N x M. Each cell in the grid can either contain a 0 or a 1. A cell containing a 1 is called a "block" while a cell containing a 0 is called an "empty space".
You can move vertically or horizontally from one cell to another if both cells are either empty spaces or both are blocks.
Given a... | from collections import deque
def min_moves(grid, N, M, sx, sy, tx, ty):
# Helper function to check if a cell is within grid bounds and of the same type
def is_valid(nx, ny, cell_type):
return 0 <= nx < N and 0 <= ny < M and grid[nx][ny] == cell_type and not visited[nx][ny]
visited = [[False] ... | def test_case_1():
grid = [
'0000',
'0110',
'0110',
'0000',
]
N, M = 4, 4
sx, sy, tx, ty = 0, 0, 3, 3
assert solve(grid, N, M, sx, sy, tx, ty) == 6
def test_case_2():
grid = [
'000',
'010',
'000',
]
N, M = 3, 3
sx, sy, tx, ty =... | [
{
"docstring": null,
"function_declaration": "def min_moves(grid, N, M, sx, sy, tx, ty):",
"function_name": "min_moves",
"parameter_list": "(grid, N, M, sx, sy, tx, ty)"
},
{
"docstring": null,
"function_declaration": "def solve(grid, N, M, sx, sy, tx, ty):",
"function_name": "solve"... | [
0,
0,
0,
1,
1
] | 2 | medium | 0.4 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import deque\n\ndef min_moves(grid, N, M, sx, sy, tx, ty):\n if grid[sx][sy] != grid[tx][ty]:\n return -1\n\n directions = [(-1, 0), ... | trial_gpt4o_4 | {
"original_instruction": "",
"prompt_id": "00039390",
"row_id": 39390,
"seed_ids": "[14328]"
} | 0.792191 | Taco_39390 | I | [
"min_moves",
"solve"
] | 2 | [
[
"solve",
"min_moves"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | d9b22f50eb908612d82929b10e28b09472561dbd | 7f99dc9b630ba33fffe3e162f247ab5fd36953b0 | |||
v1.0 | instruct | Taco | Taco_39395_I | You are given an array of `N` integers. You need to perform `Q` queries. In each query, find the smallest integer in the subarray from index `L_i` to `R_i` (both inclusive).
----- Constraints -----
- 1 ≤ N ≤ 100,000
- 1 ≤ Q ≤ 100,000
- 1 ≤ A[i] ≤ 10^9
- 1 ≤ L_i ≤ R_i ≤ N
----- Input -----
Input is given from Standar... | def preprocess_array_for_min(arr):
"""
Preprocess the given array to allow efficient range minimum queries.
"""
import sys
n = len(arr)
log = [0] * (n + 1)
for i in range(2, n + 1):
log[i] = log[i // 2] + 1
k = log[n] + 1
st = [[0] * k for _ in range(n)]
for i in ra... | def test_preprocess_array_for_min():
arr = [1, 2, 3, 4, 5]
st, log = preprocess_array_for_min(arr)
assert st[0][0] == 1, "Test case 1 failed"
assert st[1][0] == 2, "Test case 2 failed"
assert st[0][1] == 1, "Test case 3 failed"
assert st[1][1] == 2, "Test case 4 failed"
def test_range_minimum_q... | [
{
"docstring": "Preprocess the given array to allow efficient range minimum queries.",
"function_declaration": "def preprocess_array_for_min(arr):",
"function_name": "preprocess_array_for_min",
"parameter_list": "(arr)"
},
{
"docstring": "Answer the range minimum query using the preprocessed... | [
1,
1
] | 2 | easy | 1 | {
"trial_gpt4o_0": null,
"trial_gpt4o_1": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared1_results_combined.jsonl",
"solution_code": "def preprocess_array_for_min(arr):\n \"\"\"\n Preprocess the given array to allow efficient range minimum queries.\n \"\"\"\n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039395",
"row_id": 39395,
"seed_ids": "[19152]"
} | 0.795657 | Taco_39395 | I | [
"preprocess_array_for_min",
"range_minimum_query",
"solve"
] | 3 | [
[
"solve",
"preprocess_array_for_min"
],
[
"solve",
"range_minimum_query"
]
] | 2 | [] | false | [] | false | pytest | false | [] | true | 3cd08b3335195527e8d7e77414ea94feca2a2d6c | 1026c56d2e94ce814e58079545fefe299b79e517 | |||
v1.0 | instruct | Taco | Taco_39410_I | You are given an array of N integers and Q queries. Each query consists of two integers L and R (1-based index). For each query, you need to find the sum of the subarray from index L to index R (inclusive) and output the sum for each query.
Note:
- A subarray is a contiguous part of an array.
- The sum of an empty sub... | def preprocess_array(arr):
"""
Preprocess the array to get the prefix sums.
"""
prefix_sums = [0] * (len(arr) + 1)
for i in range(1, len(arr) + 1):
prefix_sums[i] = prefix_sums[i - 1] + arr[i - 1]
return prefix_sums
def subarray_sum(prefix_sums, L, R):
"""
Returns the sum of the... | def test_preprocess_array():
assert preprocess_array([1, 2, 3, 4, 5]) == [0, 1, 3, 6, 10, 15]
assert preprocess_array([-1, -2, -3, -4, -5]) == [0, -1, -3, -6, -10, -15]
assert preprocess_array([0, 0, 0, 0, 0]) == [0, 0, 0, 0, 0, 0]
def test_subarray_sum():
prefix_sums = preprocess_array([1, 2, 3, 4, 5]... | [
{
"docstring": "Preprocess the array to get the prefix sums.",
"function_declaration": "def preprocess_array(arr):",
"function_name": "preprocess_array",
"parameter_list": "(arr)"
},
{
"docstring": "Returns the sum of the subarray from index L to R using the prefix sums.",
"function_decl... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def subarray_sums(N, Q, array, queries):\n \"\"\"\n Returns the sum of subarrays for each query.\n \n Parameters:\n N (int): Number of elements in t... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039410",
"row_id": 39410,
"seed_ids": "[22179]"
} | 0.719314 | Taco_39410 | I | [
"preprocess_array",
"subarray_sum",
"process_queries"
] | 3 | [
[
"process_queries",
"preprocess_array"
],
[
"process_queries",
"subarray_sum"
]
] | 2 | [
"process_queries"
] | false | [] | false | pytest | false | [] | true | 93a3a6f52b738fc0a9e69ef6bcd2a7beb722aec9 | fbae4ec2da10dcd65177787f0c14f2e473fb31ca | |||
v1.0 | instruct | Taco | Taco_39411_I | Your friend gives you an equation A * X ≡ Y (mod M) and asks you to find an integer solution for X.
However, you know your friend's mischievous nature and suspect that there is no solution to such an equation. Thus, you first want to find out whether there is a solution to it.
To check whether a solution exists, you ... | def modular_inverse_exists(A, M):
"""
Checks if the modular inverse of A modulo M exists using the Extended Euclidean Algorithm.
An inverse exists if and only if A and M are coprime (i.e., gcd(A, M) = 1).
"""
def extended_gcd(a, b):
if a == 0:
return b, 0, 1
gcd, x1, y1 =... | from solution import modular_inverse_exists, solution_exists, process_cases
def test_modular_inverse_exists():
assert modular_inverse_exists(5, 7) == True # gcd(5, 7) = 1
assert modular_inverse_exists(4, 11) == True # gcd(4, 11) = 1
assert modular_inverse_exists(4, 12) == False # gcd(4, 12) != 1
def te... | [
{
"docstring": "Checks if the modular inverse of A modulo M exists using the Extended Euclidean Algorithm.\nAn inverse exists if and only if A and M are coprime (i.e., gcd(A, M) = 1).",
"function_declaration": "def modular_inverse_exists(A, M):",
"function_name": "modular_inverse_exists",
"parameter... | [
0,
0,
0,
1,
0
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def mod_inverse(A, M):\n \"\"\"\n Computes the modular inverse of A modulo M using the extended Euclidean algorithm.\n Returns the inverse if it exists, o... | trial_gpt4o_3 | {
"original_instruction": "",
"prompt_id": "00039411",
"row_id": 39411,
"seed_ids": "[20328]"
} | 0.551156 | Taco_39411 | I | [
"modular_inverse_exists",
"solution_exists",
"process_cases"
] | 3 | [
[
"process_cases",
"solution_exists"
],
[
"solution_exists",
"modular_inverse_exists"
]
] | 2 | [
"process_cases"
] | false | [] | false | pytest | true | [] | true | 8cecd656d998a1b9b0501d8e40ab15e010197e60 | 35b359f976fba8349b79c9e5fb6a8237ea4289e8 | |||
v1.0 | instruct | Taco | Taco_39432_I | Write a function `lucky_number` that takes an integer `n` and returns a list of all "lucky numbers" less than or equal to `n`.
A "lucky number" is a number that reduces to 1 when you repeatedly sum the squares of its digits. If such a reduction is not possible (i.e., the number ends in an endless cycle), then it is no... | def sum_of_squares_of_digits(num):
"""
Helper function to calculate the sum of squares of the digits of a number.
"""
return sum(int(digit) ** 2 for digit in str(num))
def is_lucky_number(num):
"""
Helper function to determine if a number is a lucky number.
"""
seen = set()
while nu... | def test_sum_of_squares_of_digits():
assert sum_of_squares_of_digits(19) == 82
assert sum_of_squares_of_digits(82) == 68
assert sum_of_squares_of_digits(68) == 100
assert sum_of_squares_of_digits(100) == 1
def test_is_lucky_number():
assert is_lucky_number(1) == True
assert is_lucky_number(7) =... | [
{
"docstring": "Helper function to calculate the sum of squares of the digits of a number.",
"function_declaration": "def sum_of_squares_of_digits(num):",
"function_name": "sum_of_squares_of_digits",
"parameter_list": "(num)"
},
{
"docstring": "Helper function to determine if a number is a l... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def sum_of_squares_of_digits(num):\n return sum(int(digit) ** 2 for digit in str(num))\n\ndef is_lucky(num):\n seen_numbers = set()\n while num != 1 and n... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039432",
"row_id": 39432,
"seed_ids": "[19179]"
} | 0.593466 | Taco_39432 | I | [
"sum_of_squares_of_digits",
"is_lucky_number",
"lucky_number"
] | 3 | [
[
"is_lucky_number",
"sum_of_squares_of_digits"
],
[
"lucky_number",
"is_lucky_number"
]
] | 2 | [] | false | [] | false | pytest | false | [] | true | df04a50944b9242034b987292f49f787db8adecd | 4e599215d5f35427fcd9e2256b085cc0bd396abf | |||
v1.0 | instruct | Taco | Taco_39485_I | A palindrome is a string that reads the same forward and backward. Palindromes are used in various applications, from data validation to search problems. For this task, we will deal with numbers and find the largest palindrome less than or equal to the given number.
Write a function that finds the largest palindrome n... | def is_palindrome(num):
"""
Checks if a number is a palindrome.
"""
s = str(num)
return s == s[::-1]
def largest_palindrome(n):
"""
Finds the largest palindrome number less than or equal to n.
"""
for num in range(n, 0, -1):
if is_palindrome(num):
return num | from solution import is_palindrome, largest_palindrome
def test_is_palindrome():
assert is_palindrome(121) == True
assert is_palindrome(123) == False
assert is_palindrome(99) == True
assert is_palindrome(10101) == True
assert is_palindrome(12321) == True
assert is_palindrome(10) == False
def t... | [
{
"docstring": "Checks if a number is a palindrome.",
"function_declaration": "def is_palindrome(num):",
"function_name": "is_palindrome",
"parameter_list": "(num)"
},
{
"docstring": "Finds the largest palindrome number less than or equal to n.",
"function_declaration": "def largest_pali... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_palindrome(num):\n \"\"\"\n Checks if a number is a palindrome.\n \"\"\"\n s = str(num)\n return s == s[::-1]\n\ndef largest_palindrome(n):\n... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039485",
"row_id": 39485,
"seed_ids": "[3483]"
} | 0.786498 | Taco_39485 | I | [
"is_palindrome",
"largest_palindrome"
] | 2 | [
[
"largest_palindrome",
"is_palindrome"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 45eb2ebf743a8b04c7901522a40a654b2e368722 | 46e0e292f5403b049100a8c6d2a1e9a667ff40e8 | |||
v1.0 | instruct | Taco | Taco_39500_I | ## Discover the Prime Indices
Given a list of integers, generate a new list that contains only the numbers from the original list whose indices are prime numbers. Recall that the index of the first element in the list is 0.
---
## Input
* A list of integers which may be positive, negative, or zero.
## Output
* A ... | def is_prime(n):
"""
Returns True if n is a prime number, otherwise False.
"""
if n < 2:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
def prime_indices(nums):
"""
Given a list of integers, returns a new list contain... | from solution import is_prime, prime_indices
def test_is_prime():
assert is_prime(0) == False
assert is_prime(1) == False
assert is_prime(2) == True
assert is_prime(3) == True
assert is_prime(4) == False
assert is_prime(5) == True
assert is_prime(9) == False
def test_prime_indices():
... | [
{
"docstring": "Returns True if n is a prime number, otherwise False.",
"function_declaration": "def is_prime(n):",
"function_name": "is_prime",
"parameter_list": "(n)"
},
{
"docstring": "Given a list of integers, returns a new list containing only the elements\nwhose indices are prime numbe... | [
0,
0,
0,
1,
1
] | 2 | medium | 0.4 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(n):\n \"\"\"Helper function to check if a number is a prime.\"\"\"\n if n <= 1:\n return False\n if n == 2:\n return True\n ... | trial_gpt4o_4 | {
"original_instruction": "",
"prompt_id": "00039500",
"row_id": 39500,
"seed_ids": "[13930]"
} | 0.658144 | Taco_39500 | I | [
"is_prime",
"prime_indices"
] | 2 | [
[
"prime_indices",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 9ae8ed001d97b17c34267d58bc9319c3db2d29ad | fbe5311b1386c80bd11b7ef887b993004bdf871e | |||
v1.0 | instruct | Taco | Taco_39526_I | You're given a binary tree with N nodes. Your task is to find the lowest common ancestor (LCA) of two given nodes in the tree. The LCA of two nodes p and q in a binary tree is the lowest (i.e., deepest) node that is an ancestor of both p and q, where we allow a node to be a descendant of itself.
Input:
The first line ... | class TreeNode:
def __init__(self, key):
self.left = None
self.right = None
self.val = key
def build_tree(nodes):
node_list = [TreeNode(i) for i in range(len(nodes)+1)]
for i, (l, r) in enumerate(nodes):
if l != 0:
node_list[i+1].left = node_list[l]
if r ... | from solution import lowest_common_ancestor
def test_case_1():
N = 5
nodes = [(2, 3), (4, 5), (0, 0), (0, 0), (0, 0)]
p = 4
q = 5
assert lowest_common_ancestor(N, nodes, p, q) == 2
def test_case_2():
N = 3
nodes = [(2, 3), (0, 0), (0, 0)]
p = 2
q = 3
assert lowest_common_ancest... | [] | [
0,
0,
0,
0,
0,
0,
0,
1,
0
] | 1 | hard | 0.111 | {
"trial_gpt4o_0": null,
"trial_gpt4o_1": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared1_results_combined.jsonl",
"solution_code": "class TreeNode:\n def __init__(self, x):\n self.val = x\n self.left = None\n self.right = None\n\ndef build_tree(n... | trial_gpt4o_8 | {
"original_instruction": "",
"prompt_id": "00039526",
"row_id": 39526,
"seed_ids": "[1822]"
} | 0.576369 | Taco_39526 | I | [
"build_tree",
"findLCA",
"lowest_common_ancestor"
] | 3 | [
[
"lowest_common_ancestor",
"build_tree"
],
[
"lowest_common_ancestor",
"findLCA"
]
] | 2 | [] | false | [
"TreeNode"
] | true | pytest | true | [] | true | b18303a953f7af6ec964a91dc59e4af9e3c1ac92 | 8a09cf9149bec23cf5ebb716795a35e1268759b8 | |||
v1.0 | instruct | Taco | Taco_39541_I | Samantha is organizing a puzzle event and is creating different square puzzles. Each puzzle consists of a grid of integers, with some marked cells that cannot be altered. To make it more challenging, Samantha wants to rotate parts of the grid clockwise by 90 degrees if a condition is met. Specifically, only the m x m s... | def rotate_subgrid(grid):
N = len(grid)
def can_rotate(x, y, m):
for i in range(m+2):
if grid[x][y+i] == 0 or grid[x+m+1][y+i] == 0 or grid[x+i][y] == 0 or grid[x+i][y+m+1] == 0:
return False
return True
def rotate_clockwise(x, y, m):
subgrid = [... | def test_example_1():
input_data = """5
1 2 3 4 5
1 0 0 0 1
1 0 8 0 1
1 0 0 0 1
1 2 3 4 5"""
expected_output = """1 2 3 4 5
1 0 0 0 1
1 0 8 0 1
1 0 0 0 1
1 2 3 4 5"""
assert puzzle_rotation(input_data) == expected_output
def test_example_2():
input_data = """4
1 1 1 1
1 2 3 1
1 4 5 1
1 1 1 1"""
exp... | [
{
"docstring": null,
"function_declaration": "def rotate_subgrid(grid):",
"function_name": "rotate_subgrid",
"parameter_list": "(grid)"
},
{
"docstring": null,
"function_declaration": "def str_to_matrix(s):",
"function_name": "str_to_matrix",
"parameter_list": "(s)"
},
{
... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def rotate_90_clockwise(puzzle):\n N = len(puzzle)\n if N == 1:\n return puzzle\n \n def is_surrounded_by_ones(i, j, m):\n # Check if the... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039541",
"row_id": 39541,
"seed_ids": "[19239]"
} | 0.770474 | Taco_39541 | I | [
"rotate_subgrid",
"str_to_matrix",
"matrix_to_str",
"puzzle_rotation"
] | 4 | [
[
"puzzle_rotation",
"matrix_to_str"
],
[
"puzzle_rotation",
"rotate_subgrid"
],
[
"puzzle_rotation",
"str_to_matrix"
]
] | 3 | [] | false | [] | false | pytest | false | [] | true | 0b9e1498ad664562b5415c1a05c029aae32f7551 | be7dec52b083da6176ad1046fb654051b7647be4 | |||
v1.0 | instruct | Taco | Taco_39545_I | You are given a grid with $\boldsymbol{n}$ rows and $\boldsymbol{m}$ columns. Each cell in the grid has a value representing the height at that cell. You need to determine the length of the longest strictly increasing path starting from any cell in the grid. A strictly increasing path is a sequence of cells such that t... | def longest_increasing_path(matrix):
if not matrix or not matrix[0]:
return 0
n, m = len(matrix), len(matrix[0])
dp = [[-1] * m for _ in range(n)]
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
def dfs(x, y):
if dp[x][y] != -1:
return dp[x][y]
max_path... | from solution import longest_increasing_path
def test_case_1():
matrix = [
[9, 9, 4],
[6, 6, 8],
[2, 1, 1]
]
assert longest_increasing_path(matrix) == 4 # Path: 1 -> 2 -> 6 -> 9
def test_case_2():
matrix = [
[1, 2, 3],
[6, 5, 4],
[7, 8, 9]
]
ass... | [
{
"docstring": null,
"function_declaration": "def longest_increasing_path(matrix):",
"function_name": "longest_increasing_path",
"parameter_list": "(matrix)"
},
{
"docstring": null,
"function_declaration": "def read_and_process_input():",
"function_name": "read_and_process_input",
... | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def longest_increasing_path(grid):\n if not grid:\n return 0\n n, m = len(grid), len(grid[0])\n dp = [[-1] * m for _ in range(n)]\n\n def dfs(x,... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039545",
"row_id": 39545,
"seed_ids": "[2448]"
} | 0.751995 | Taco_39545 | I | [
"longest_increasing_path",
"read_and_process_input"
] | 2 | [
[
"read_and_process_input",
"longest_increasing_path"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | e51bbbb32095bba504b15d7cf593047a86043b48 | b327d4a3e25d3c79ce0d67471c4d732f0c2f0a4e | |||
v1.0 | instruct | Taco | Taco_39553_I | Alex loves playing with numbers and he has recently come across palindrome numbers. A number is called a palindrome if it reads the same from left to right and right to left.
Given a positive integer N, find the smallest palindrome number P such that P is greater than N.
Constraints
* 1 ≤ N ≤ 10^6
* N is an integer.... | def is_palindrome(num):
"""
Check if a given number is a palindrome.
"""
return str(num) == str(num)[::-1]
def next_palindrome(N):
"""
Returns the smallest palindrome number greater than N.
"""
N += 1
while not is_palindrome(N):
N += 1
return N | from solution import is_palindrome, next_palindrome
def test_is_palindrome():
assert is_palindrome(121) == True
assert is_palindrome(123) == False
assert is_palindrome(1) == True
assert is_palindrome(22) == True
assert is_palindrome(202) == True
assert is_palindrome(12321) == True
assert is... | [
{
"docstring": "Check if a given number is a palindrome.",
"function_declaration": "def is_palindrome(num):",
"function_name": "is_palindrome",
"parameter_list": "(num)"
},
{
"docstring": "Returns the smallest palindrome number greater than N.",
"function_declaration": "def next_palindro... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def next_palindrome(N):\n \"\"\"\n Finds the smallest palindrome number greater than N.\n \"\"\"\n N += 1\n while True:\n if str(N) == str(N)... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039553",
"row_id": 39553,
"seed_ids": "[18921]"
} | 0.879051 | Taco_39553 | I | [
"is_palindrome",
"next_palindrome"
] | 2 | [
[
"next_palindrome",
"is_palindrome"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | f61819c008ee82eacf47d56a22e2a63db0291082 | 9b868995f475d94ab493189339d260f8ad6c06d6 | |||
v1.0 | instruct | Taco | Taco_39609_I | A binary matrix of size n x m is given, where each element is either 0 or 1. We need to find out if there is at least one submatrix of size k x k (where k is given) that contains only 1's (all 1's submatrix).
------ Input ------
The first line contains an integer T denoting the total number of test cases.
For each t... | def has_all_ones_submatrix(matrix, n, m, k):
# Iterate over each possible top-left corner of k x k submatrix
for i in range(n - k + 1):
for j in range(m - k + 1):
if all(matrix[i + x][j + y] == 1 for x in range(k) for y in range(k)):
return "YES"
return "NO"
def solve(te... | import pytest
from solution import has_all_ones_submatrix, solve, process_input
def test_has_all_ones_submatrix():
assert has_all_ones_submatrix([[1, 1, 1], [1, 1, 1], [1, 1, 1]], 3, 3, 2) == "YES"
assert has_all_ones_submatrix([[1, 1, 1, 0], [1, 1, 1, 0], [0, 0, 1, 1], [1, 1, 1, 1]], 4, 4, 3) == "NO"
def tes... | [
{
"docstring": null,
"function_declaration": "def has_all_ones_submatrix(matrix, n, m, k):",
"function_name": "has_all_ones_submatrix",
"parameter_list": "(matrix, n, m, k)"
},
{
"docstring": null,
"function_declaration": "def solve(test_cases):",
"function_name": "solve",
"param... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def has_all_ones_submatrix(T, test_cases):\n results = []\n \n for case in test_cases:\n n, m, k, matrix = case\n found = False\n \n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039609",
"row_id": 39609,
"seed_ids": "[21365]"
} | 0.674421 | Taco_39609 | I | [
"has_all_ones_submatrix",
"solve",
"process_input"
] | 3 | [
[
"solve",
"has_all_ones_submatrix"
]
] | 1 | [
"process_input"
] | false | [] | false | pytest | true | [] | true | e1d3d7637862f13f675232edd7d80d2ef09856ba | 0165c29bf0809cbbc8fb36411826d5a78a87b27c | |||
v1.0 | instruct | Taco | Taco_39646_I | Given a binary tree, write a function flattenTree() to convert the tree into a singly linked list in-place. The "linked list" should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null. The linked list should be in the same order as a p... | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def flattenTree(root):
"""
Given the root of the binary tree, this function flattens the tree into
a singly linked list in-place following the pre-order traversal... | import pytest
from solution import flattenTree, buildTree, preOrderTraversal, solution
def test_flattenTree_example1():
nodes = ['1', '2', '5', '3', '4', 'n', '6']
root = buildTree(nodes)
flattenTree(root)
assert preOrderTraversal(root) == [1, 2, 3, 4, 5, 6]
def test_flattenTree_example2():
nodes ... | [] | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "class TreeNode:\n \"\"\"\n Definition for a binary tree node.\n \"\"\"\n def __init__(self, x):\n self.val = x\n self.left = None\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039646",
"row_id": 39646,
"seed_ids": "[7855]"
} | 0.581097 | Taco_39646 | I | [
"flattenTree",
"buildTree",
"preOrderTraversal",
"solution"
] | 4 | [
[
"solution",
"buildTree"
],
[
"solution",
"flattenTree"
],
[
"solution",
"preOrderTraversal"
]
] | 3 | [] | false | [
"TreeNode"
] | true | pytest | true | [] | true | df7ca360c7958424aea71b2ec71cc73b2760f946 | e1dfe81752f6a1ddc08b18659793c89f60de221c | |||
v1.0 | instruct | Taco | Taco_39669_I | Alice has a collection of strings, each with an identifier. She wants to find the longest common prefix among a list of strings that share a common identifier. If there are multiple strings with the same longest prefix, return the one which appears first in the list. If there is no common prefix, return an empty string... | def longest_common_prefix(strings):
"""
Find the longest common prefix string amongst an array of strings.
"""
if not strings:
return ""
prefix = strings[0]
for string in strings[1:]:
while not string.startswith(prefix):
prefix = prefix[:-1]
if prefix... | def test_main():
input_data = """2
4
id1 banana
id1 bandana
id2 candy
id1 banner
id1
3
id3 apple
id3 apricot
id3 avocado
id3"""
expected_output = """ban
a"""
assert main(input_data) == expected_output
def test_no_common_prefix():
input_data = """1
3
id1 dog
id1 cat
id1 mouse
id1"""
expect... | [
{
"docstring": "Find the longest common prefix string amongst an array of strings.",
"function_declaration": "def longest_common_prefix(strings):",
"function_name": "longest_common_prefix",
"parameter_list": "(strings)"
},
{
"docstring": null,
"function_declaration": "def find_longest_co... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def longest_common_prefix(strings):\n \"\"\"\n Returns the longest common prefix from a list of strings.\n \"\"\"\n if not strings:\n return \"\... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039669",
"row_id": 39669,
"seed_ids": "[2759]"
} | 0.775916 | Taco_39669 | I | [
"longest_common_prefix",
"find_longest_common_prefix_for_identifier",
"process_input",
"main"
] | 4 | [
[
"find_longest_common_prefix_for_identifier",
"longest_common_prefix"
]
] | 1 | [
"process_input"
] | false | [] | false | pytest | false | [] | true | aac6a71c3ef1a4e8710c767d8e33956b5ce9258c | b825a9cffe413e3ba64d222a4fdefab93a7b4fa5 | |||
v1.0 | instruct | Taco | Taco_39697_I | Background
Kyouko is a software engineer working on developing an e-commerce platform. One of the key features of this platform is the ability to manage discount codes effectively. To ensure customers get the best deals, Kyouko needs to implement a feature that validates discount codes based on certain criteria.
Disc... | def is_valid_discount_code(code):
"""
Determines if a discount code is valid based on the following criteria:
- It contains at least one uppercase letter.
- It contains at least one digit.
- It does not contain any repeating characters.
Args:
code (str): The discount code to validate.
... | def test_is_valid_discount_code():
assert is_valid_discount_code("A1B2C3") == "Valid"
assert is_valid_discount_code("123456") == "Invalid"
assert is_valid_discount_code("ABCDEF") == "Invalid"
assert is_valid_discount_code("A1X") == "Valid"
assert is_valid_discount_code("AAA111") == "Invalid"
ass... | [
{
"docstring": "Determines if a discount code is valid based on the following criteria:\n- It contains at least one uppercase letter.\n- It contains at least one digit.\n- It does not contain any repeating characters.\n\nArgs:\ncode (str): The discount code to validate.\n\nReturns:\nstr: \"Valid\" if the discou... | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_valid_discount_code(code):\n \"\"\"\n This function checks if the discount code is valid based on the given criteria:\n - It contains at least one ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039697",
"row_id": 39697,
"seed_ids": "[15443]"
} | 0.655398 | Taco_39697 | I | [
"is_valid_discount_code",
"validate_discount_codes"
] | 2 | [
[
"validate_discount_codes",
"is_valid_discount_code"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | 40ab7a17ab9883e4bd97c7c36292efee8f7f744e | 4c544ed8e1681e3e3434c74672249d79add8a867 | |||
v1.0 | instruct | Taco | Taco_39737_I | A group of friends are planning a road trip and want to rent cars. Each car has a maximum seating capacity of N people. Given that there are M friends participating in the trip, determine the minimum number of cars required to accommodate all the friends comfortably.
------ Input Format ------
- The first line will ... | import math
def min_cars_needed(test_cases):
result = []
for m, n in test_cases:
result.append(math.ceil(m / n))
return result
def process_input(input_str):
lines = input_str.splitlines()
T = int(lines[0])
test_cases = [tuple(map(int, line.split())) for line in lines[1:T+1]]
return... | def test_min_cars_needed():
input_str = "3\n12 5\n9 4\n6 3"
expected_output = "3\n3\n2"
assert solve(input_str) == expected_output
def test_all_friends_fit_in_one_car():
input_str = "2\n5 5\n3 5"
expected_output = "1\n1"
assert solve(input_str) == expected_output
def test_only_one_friend():
... | [
{
"docstring": null,
"function_declaration": "def min_cars_needed(test_cases):",
"function_name": "min_cars_needed",
"parameter_list": "(test_cases)"
},
{
"docstring": null,
"function_declaration": "def process_input(input_str):",
"function_name": "process_input",
"parameter_list... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import math\n\ndef minimum_cars(T, test_cases):\n \"\"\"\n Returns the minimum number of cars required for each test case.\n \n Parameters:\n T : in... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039737",
"row_id": 39737,
"seed_ids": "[21566]"
} | 0.659763 | Taco_39737 | I | [
"min_cars_needed",
"process_input",
"process_output",
"solve"
] | 4 | [
[
"solve",
"min_cars_needed"
],
[
"solve",
"process_input"
],
[
"solve",
"process_output"
]
] | 3 | [
"process_input"
] | false | [] | false | pytest | false | [] | true | 12d5d1e8244f54aac41cdb43582eae99e80b5825 | 0fa8fe0a08531f6286a4132b36c46f3f4c13afe3 | |||
v1.0 | instruct | Taco | Taco_39740_I | A city planner needs to manage the efficient delivery of goods within a city represented by a network of bidirectional roads connecting various warehouses. The aim is to determine the shortest delivery time between certain pairs of warehouses. The roads have varying travel times, and the planner needs a tool to handle ... | import heapq
def initialize_graph(n, m, roads):
graph = {i: [] for i in range(1, n + 1)}
for u, v, t in roads:
graph[u].append((v, t))
graph[v].append((u, t))
return graph
def dijkstra(graph, start, n):
distances = {i: float('inf') for i in range(1, n + 1)}
distances[start] = 0
... | from solution import solve
def test_single_query_no_update():
n, m = 5, 6
road_list = [
(1, 2, 10),
(1, 3, 20),
(2, 3, 5),
(2, 4, 8),
(3, 4, 15),
(4, 5, 6)
]
q = 1
operations = [(2, 1, 4)]
assert solve(n, m, road_list, q, operations) == [18]
def ... | [
{
"docstring": null,
"function_declaration": "def initialize_graph(n, m, roads):",
"function_name": "initialize_graph",
"parameter_list": "(n, m, roads)"
},
{
"docstring": null,
"function_declaration": "def dijkstra(graph, start, n):",
"function_name": "dijkstra",
"parameter_list... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import heapq\n\ndef update(road_map, travel_times, n, s, d, t):\n \"\"\" Update the travel time between two warehouses (s, d) with new time t \"\"\"\n road_m... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00039740",
"row_id": 39740,
"seed_ids": "[24340]"
} | 0.762188 | Taco_39740 | I | [
"initialize_graph",
"dijkstra",
"update_graph",
"handle_operations",
"solve"
] | 5 | [
[
"handle_operations",
"dijkstra"
],
[
"handle_operations",
"update_graph"
],
[
"solve",
"handle_operations"
],
[
"solve",
"initialize_graph"
]
] | 4 | [] | false | [] | false | pytest | true | [] | true | 400937108dddbc7182478ef28a78ddc028e356a5 | 22c36b1b3eae096e6101a454bc3837f3afa0e4db | |||
v1.0 | instruct | Taco | Taco_39757_I | Given an `n x n` grid representing a city map where each cell contains either a building (`1`) or an empty plot (`0`), you need to determine the number of distinct clusters of buildings. A cluster is defined as a group of adjacent buildings (horizontally or vertically, but not diagonally).
### Input Format:
- The fir... | def find_clusters(grid):
"""
Returns the number of distinct clusters of buildings in the grid.
"""
n = len(grid)
def dfs(x, y):
stack = [(x, y)]
while stack:
cx, cy = stack.pop()
for nx, ny in [(cx-1, cy), (cx+1, cy), (cx, cy-1), (cx, cy+1)]:
... | from solution import number_of_clusters
def test_case_1():
n = 4
grid = [
"1 1 0 0",
"1 0 0 1",
"0 0 1 1",
"0 1 0 0"
]
assert number_of_clusters(n, grid) == 3
def test_case_2():
n = 1
grid = ["1"]
assert number_of_clusters(n, grid) == 1
def test_case_3():
... | [
{
"docstring": "Returns the number of distinct clusters of buildings in the grid.",
"function_declaration": "def find_clusters(grid):",
"function_name": "find_clusters",
"parameter_list": "(grid)"
},
{
"docstring": null,
"function_declaration": "def number_of_clusters(n, raw_grid):",
... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def find_clusters(grid):\n \"\"\"\n Returns the number of distinct clusters of buildings in the grid.\n \"\"\"\n n = len(grid)\n \n def dfs(x, y)... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039757",
"row_id": 39757,
"seed_ids": "[4050]"
} | 0.585979 | Taco_39757 | I | [
"find_clusters",
"number_of_clusters"
] | 2 | [
[
"number_of_clusters",
"find_clusters"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 280b4301b6832f707ce7132fadb8edc50c1d76d0 | 3b3b1866d95be7780db30e8eb61e1a1f8e4c0254 | |||
v1.0 | instruct | Taco | Taco_39796_I | You are given an array of integers and a series of queries. Each query asks for the sum of a contiguous subarray. The task is to compute the sums of the subarrays as specified by the queries efficiently.
Input
The first input line contains a single integer n (1 ≤ n ≤ 100000) — the number of elements in the array. The... | def precompute_prefix_sums(arr):
"""
Precompute prefix sums of the array.
Args:
arr (List[int]): The input array.
Returns:
List[int]: The prefix sums array.
"""
prefix_sums = [0] * (len(arr) + 1)
for i in range(1, len(arr) + 1):
prefix_sums[i] = prefix_sums[i - 1] +... | from solution import solve
def test_sum_of_subarray():
assert solve(5, [1, 2, 3, 4, 5], 3, [(1, 3), (2, 4), (1, 5)]) == [6, 9, 15]
assert solve(5, [1, -2, 3, -4, 5], 3, [(1, 3), (2, 4), (1, 5)]) == [2, -3, 3]
assert solve(3, [100000, -100000, 100000], 1, [(1, 3)]) == [100000]
assert solve(1, [42], 1, [... | [
{
"docstring": "Precompute prefix sums of the array.\n\nArgs:\narr (List[int]): The input array.\n\nReturns:\nList[int]: The prefix sums array.",
"function_declaration": "def precompute_prefix_sums(arr):",
"function_name": "precompute_prefix_sums",
"parameter_list": "(arr)"
},
{
"docstring":... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def compute_prefix_sums(arr):\n \"\"\"\n Computes the prefix sums of the given array.\n A prefix sum array is such that prefix_sums[i] = sum(arr[0] to arr... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039796",
"row_id": 39796,
"seed_ids": "[4454]"
} | 0.697493 | Taco_39796 | I | [
"precompute_prefix_sums",
"sum_of_subarray",
"solve"
] | 3 | [
[
"solve",
"precompute_prefix_sums"
],
[
"solve",
"sum_of_subarray"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | 2ad83b4eb824c4aae138caa28527c875b30d1236 | ea45b8f8202db63ddcabaeaa9e8aad1b2b4e91bf | |||
v1.0 | instruct | Taco | Taco_39809_I | Little E loves playing with permutations and prime numbers. She has a collection of the first n natural numbers (1 to n) and loves creating permutations of these numbers.
She defines the "prime distance" of a permutation as the number of pairs of elements (i, j) such that 1 ≤ i < j ≤ n, and the absolute difference bet... | def is_prime(num):
"""
Checks if a number is prime.
"""
if num <= 1:
return False
if num == 2:
return True
if num % 2 == 0:
return False
for i in range(3, int(num**0.5) + 1, 2):
if num % i == 0:
return False
return True
def generate_primes_up_... | from solution import max_prime_distance_permutation
def test_max_prime_distance_permutation_1():
assert max_prime_distance_permutation(1) == [1]
def test_max_prime_distance_permutation_4():
result = max_prime_distance_permutation(4)
assert sorted(result) == [1, 2, 3, 4]
def test_max_prime_distance_permut... | [
{
"docstring": "Checks if a number is prime.",
"function_declaration": "def is_prime(num):",
"function_name": "is_prime",
"parameter_list": "(num)"
},
{
"docstring": "Generates a list of all prime numbers up to n.",
"function_declaration": "def generate_primes_up_to(n):",
"function_n... | [
1,
1
] | 2 | easy | 1 | {
"trial_gpt4o_0": null,
"trial_gpt4o_1": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared1_results_combined.jsonl",
"solution_code": "def is_prime(num):\n \"\"\"\n Checks if a number is prime.\n \"\"\"\n if num <= 1:\n return False\n if num == 2:\n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00039809",
"row_id": 39809,
"seed_ids": "[869]"
} | 0.731239 | Taco_39809 | I | [
"is_prime",
"generate_primes_up_to",
"max_prime_distance_permutation"
] | 3 | [
[
"generate_primes_up_to",
"is_prime"
],
[
"max_prime_distance_permutation",
"generate_primes_up_to"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | b6d253b33dfae5c4f255692f4fcc8021cf276875 | d2b67169570cb2b2dd0ae6a2d2e8682a23c6a577 | |||
v1.0 | instruct | Taco | Taco_39817_I | Sarah loves playing with numbers and patterns. One day, she thought of a unique number pattern exercise for her friends. She gives them two integers `a` and `b` and asks them to create a new integer by concatenating them (in the form of "a concatenated with b") and then check if the new integer is a prime number.
—Eas... | def is_prime(n):
"""
Determines if a number is prime.
"""
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while (i * i) <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
retu... | from solution import concatenated_is_prime, is_prime
def test_is_prime():
assert is_prime(2) == True
assert is_prime(3) == True
assert is_prime(4) == False
assert is_prime(5) == True
assert is_prime(1) == False
assert is_prime(0) == False
assert is_prime(29) == True
assert is_prime(28) ... | [
{
"docstring": "Determines if a number is prime.",
"function_declaration": "def is_prime(n):",
"function_name": "is_prime",
"parameter_list": "(n)"
},
{
"docstring": "Concatenates two integers a and b, then checks if the resulting number is prime.",
"function_declaration": "def concatena... | [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] | 1 | hard | 0.1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(n):\n \"\"\"\n Helper function to check if a number is prime.\n \"\"\"\n if n <= 1:\n return False\n elif n <= 3:\n retur... | trial_gpt4o_8 | {
"original_instruction": "",
"prompt_id": "00039817",
"row_id": 39817,
"seed_ids": "[17594]"
} | 0.625053 | Taco_39817 | I | [
"is_prime",
"concatenated_is_prime"
] | 2 | [
[
"concatenated_is_prime",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 69c50d0e9079d68868b295fc4582e2ed129d05a8 | 21ef5a9966274cd7bd4ae996c3e73d4553899712 | |||
v1.0 | instruct | Taco | Taco_39852_I | In a bustling city, there are many intersections, each with different traffic lights. A new city regulation requires a control system to manage the traffic light timers. The goal is to minimize the total waiting time for vehicles at each intersection.
Each traffic light operates in a cyclical pattern, where one green ... | def calculate_min_waiting_times(N, intersections):
min_waiting_times = []
for intersection in intersections:
L_i = intersection[0]
traffic_lights = intersection[1:]
total_waiting_time = 0
for j in range(L_i):
G = traffic_lights[2 * j]
R = traffic_lights[2 ... | def test_calculate_min_waiting_times():
# Sample Input 1
N = 3
intersections = [
[2, 3, 5, 2, 6],
[3, 1, 2, 2, 1, 1, 1],
[1, 10, 15]
]
expected = [16, 8, 25]
assert calculate_min_waiting_times(N, intersections) == expected
def test_calculate_min_waiting_times_single_inte... | [
{
"docstring": null,
"function_declaration": "def calculate_min_waiting_times(N, intersections):",
"function_name": "calculate_min_waiting_times",
"parameter_list": "(N, intersections)"
},
{
"docstring": null,
"function_declaration": "def parse_input(input_data):",
"function_name": "... | [
1
] | 1 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def calculate_min_waiting_times(N, intersections):\n min_waiting_times = []\n for intersection in intersections:\n L_i = intersection[0]\n traf... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039852",
"row_id": 39852,
"seed_ids": "[10557]"
} | 0.673122 | Taco_39852 | I | [
"calculate_min_waiting_times",
"parse_input",
"get_waiting_times_from_input"
] | 3 | [
[
"get_waiting_times_from_input",
"calculate_min_waiting_times"
],
[
"get_waiting_times_from_input",
"parse_input"
]
] | 2 | [
"parse_input"
] | false | [] | false | pytest | false | [] | true | 99e142d662b0ce79bb4bfb646ec5d20b54943446 | 7251cd7cb722cca615d540960388e79067f78ccf | |||
v1.0 | instruct | Taco | Taco_39865_I | A series of ones and zeroes
You are given an array consisting of N integers (either 0 or 1), and you need to perform M operations. Each operation can either be:
1. **Flipping**: Change a 0 to 1 or a 1 to 0 at a specified index.
2. **Querying**: Count the number of consecutive 1s in the array.
To accomplish this task... | def longest_consecutive_ones(arr):
""" Helper function to find the longest sequence of consecutive ones """
max_count = 0
current_count = 0
for num in arr:
if num == 1:
current_count += 1
if current_count > max_count:
max_count = current_count
els... | from solution import longest_consecutive_ones, process_operations
def test_longest_consecutive_ones():
assert longest_consecutive_ones([1, 0, 1, 1, 0, 1]) == 2
assert longest_consecutive_ones([1, 1, 1, 1, 0, 1]) == 4
assert longest_consecutive_ones([1, 1, 1, 0, 0, 1]) == 3
assert longest_consecutive_on... | [
{
"docstring": "Helper function to find the longest sequence of consecutive ones ",
"function_declaration": "def longest_consecutive_ones(arr):",
"function_name": "longest_consecutive_ones",
"parameter_list": "(arr)"
},
{
"docstring": null,
"function_declaration": "def process_operations... | [
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | 1 | hard | 0.1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def process_operations(n, m, arr, operations):\n def flip(index):\n arr[index] = 1 - arr[index]\n\n def query():\n max_length, current_length =... | trial_gpt4o_5 | {
"original_instruction": "",
"prompt_id": "00039865",
"row_id": 39865,
"seed_ids": "[22528]"
} | 0.661258 | Taco_39865 | I | [
"longest_consecutive_ones",
"process_operations",
"handle_input"
] | 3 | [
[
"handle_input",
"process_operations"
],
[
"process_operations",
"longest_consecutive_ones"
]
] | 2 | [
"handle_input"
] | false | [] | false | pytest | true | [] | true | a57597b2132944629e7c9af6cb97e66103c0369d | 2e9a1b9cfc78c7677e96e97943397fc2f9685592 | |||
v1.0 | instruct | Taco | Taco_39934_I | John is learning about prime numbers and he wants to play a prime number game. The game involves two players who take turns choosing a prime number from a given list. Once a prime number is chosen, it is removed from the list and cannot be chosen again. The game ends when there are no more prime numbers left to pick. T... | def is_prime(n):
"""Helper function to check if n is a prime number."""
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
for i in range(3, int(n**0.5) + 1, 2):
if n % i == 0:
return False
return True
def prime_game_winner(pri... | from solution import is_prime, prime_game_winner, prime_game
def test_is_prime():
assert is_prime(2) == True
assert is_prime(3) == True
assert is_prime(4) == False
assert is_prime(11) == True
assert is_prime(15) == False
assert is_prime(1) == False
assert is_prime(0) == False
assert is_... | [
{
"docstring": "Helper function to check if n is a prime number.",
"function_declaration": "def is_prime(n):",
"function_name": "is_prime",
"parameter_list": "(n)"
},
{
"docstring": "Determines the winner of the prime number game given a list of integers.\nJohn always starts first and both p... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(n):\n \"\"\"Helper function to check if n is a prime number.\"\"\"\n if n <= 1:\n return False\n if n == 2:\n return True\n ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039934",
"row_id": 39934,
"seed_ids": "[24582]"
} | 0.680741 | Taco_39934 | I | [
"is_prime",
"prime_game_winner",
"prime_game"
] | 3 | [
[
"prime_game",
"prime_game_winner"
],
[
"prime_game_winner",
"is_prime"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | b28f1153f535c2b8cd2b85950ea77049d0ad0874 | 7e70c706c9a4bbd72ef538c33f3964d2b62940ce | |||
v1.0 | instruct | Taco | Taco_39969_I | You are given n points on a 2D plane, and your task is to find the pair of points that are closest to each other. You need to calculate the Euclidean distance between each pair of points and determine the minimum distance.
The Euclidean distance between two points (x1, y1) and (x2, y2) is calculated as:
\[ \text{dista... | from math import sqrt
def euclidean_distance(p1, p2):
"""
Returns the Euclidean distance between two points p1 and p2.
Each point is a tuple of (x, y).
"""
return sqrt((p2[0] - p1[0])**2 + (p2[1] - p1[1])**2)
def closest_pair_of_points(points):
"""
Returns the minimum distance between any ... | from solution import closest_distance
def test_example_1():
points = [(0, 0), (3, 4), (1, 1)]
assert closest_distance(points) == "1.414214"
def test_example_2():
points = [(1, 1), (4, 4), (5, 1), (3, 3), (0, 0)]
assert closest_distance(points) == "1.414214"
def test_example_3():
points = [(0, 0),... | [
{
"docstring": "Returns the Euclidean distance between two points p1 and p2.\nEach point is a tuple of (x, y).",
"function_declaration": "def euclidean_distance(p1, p2):",
"function_name": "euclidean_distance",
"parameter_list": "(p1, p2)"
},
{
"docstring": "Returns the minimum distance betw... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from math import sqrt\n\ndef euclidean_distance(p1, p2):\n \"\"\"\n Returns the Euclidean distance between two points p1 and p2.\n Each point is a tuple o... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00039969",
"row_id": 39969,
"seed_ids": "[11807]"
} | 0.782795 | Taco_39969 | I | [
"euclidean_distance",
"closest_pair_of_points",
"closest_distance"
] | 3 | [
[
"closest_distance",
"closest_pair_of_points"
],
[
"closest_pair_of_points",
"euclidean_distance"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | c5c46971574e86a380d52b3d81961b75773154c6 | ab857cb726ca096ee6764e64570643ab8d53f6a5 | |||
v1.0 | instruct | Taco | Taco_40008_I | Amara is fascinated by strings and their patterns. She has a special liking for permutations of strings. Amara wants to find out how many permutations of a given string are palindromic.
A palindromic string is one that reads the same forward and backward. Help Amara to count the number of distinct palindromic permutat... | from collections import Counter
from math import factorial
def is_palindromic_permutation_possible(string):
counter = Counter(string)
odd_count = sum(1 for count in counter.values() if count % 2 != 0)
return odd_count <= 1
def count_palindromic_permutations(string):
if not is_palindromic_permutation_p... | from solution import is_palindromic_permutation_possible, count_palindromic_permutations, count_palindromic_permutations_for_cases
def test_is_palindromic_permutation_possible():
assert is_palindromic_permutation_possible("aabb")
assert not is_palindromic_permutation_possible("abc")
assert is_palindromic_p... | [
{
"docstring": null,
"function_declaration": "def is_palindromic_permutation_possible(string):",
"function_name": "is_palindromic_permutation_possible",
"parameter_list": "(string)"
},
{
"docstring": null,
"function_declaration": "def count_palindromic_permutations(string):",
"functi... | [
0,
0,
0,
0,
1
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import Counter\nfrom math import factorial\n\ndef count_palindromic_permutations(S):\n \"\"\"\n Returns the number of distinct palindromic p... | trial_gpt4o_4 | {
"original_instruction": "",
"prompt_id": "00040008",
"row_id": 40008,
"seed_ids": "[3454]"
} | 0.796263 | Taco_40008 | I | [
"is_palindromic_permutation_possible",
"count_palindromic_permutations",
"count_palindromic_permutations_for_cases"
] | 3 | [
[
"count_palindromic_permutations",
"is_palindromic_permutation_possible"
],
[
"count_palindromic_permutations_for_cases",
"count_palindromic_permutations"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | e63dcb43df12b108549436e0559f04c7d8008bec | cc8931453981cf4628e8290f44d2fa5303e24800 | |||
v1.0 | instruct | Taco | Taco_40011_I | Given a grid of characters, determine if there exists a cycle of the same letter. A cycle is a path in the grid where the first and last letter are the same, with each letter being distinct (i.e., no letter repeats unless it is the start and endpoint). The path must consist of at least four nodes.
-----Input-----
The... | from collections import deque
def in_bounds(x, y, n, m):
return 0 <= x < n and 0 <= y < m
def bfs(grid, start, n, m):
x0, y0 = start
visited = [[False] * m for _ in range(n)]
queue = deque([(x0, y0, -1, -1)])
start_char = grid[x0][y0]
while queue:
x, y, px, py = queue.popleft()
... | from solution import solve
def test_example():
test_cases = [
(3, 4, ["aaaa", "abca", "aaaa"]),
(4, 4, ["abcd", "efgh", "ijkl", "mnop"]),
(5, 5, ["abcde", "abfde", "abfde", "abcde", "abcde"])
]
result = solve(test_cases)
assert result == ["Yes", "No", "Yes"]
def test_no_cycle_s... | [
{
"docstring": null,
"function_declaration": "def in_bounds(x, y, n, m):",
"function_name": "in_bounds",
"parameter_list": "(x, y, n, m)"
},
{
"docstring": null,
"function_declaration": "def bfs(grid, start, n, m):",
"function_name": "bfs",
"parameter_list": "(grid, start, n, m)"... | [
0,
0,
0,
0,
0,
0,
0,
1,
0,
0
] | 1 | hard | 0.1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def has_cycle_dfs(grid, visited, x, y, px, py, start_letter):\n n, m = len(grid), len(grid[0])\n visited.add((x, y))\n directions = [(-1, 0), (1, 0), (0, ... | trial_gpt4o_7 | {
"original_instruction": "",
"prompt_id": "00040011",
"row_id": 40011,
"seed_ids": "[20461]"
} | 0.768079 | Taco_40011 | I | [
"in_bounds",
"bfs",
"has_cycle",
"solve"
] | 4 | [
[
"bfs",
"in_bounds"
],
[
"has_cycle",
"bfs"
],
[
"solve",
"has_cycle"
]
] | 3 | [] | false | [] | false | pytest | true | [] | true | 77134040ee1a5e636e37830cac43895611fcec52 | 6f7c20373eee6733020c8d88c8421ff1bec70b34 | |||
v1.0 | instruct | Taco | Taco_40025_I | In this challenge, the task is to validate the given sequence of brackets to ensure they are balanced.
A sequence of brackets is considered balanced if:
1. It consists entirely of pairs of opening/closing brackets in the correct order.
2. Every closing bracket has a corresponding opening bracket of the same type.
Giv... | def is_balanced(sequence):
stack = []
matching_bracket = {')': '(', ']': '[', '}': '{'}
for char in sequence:
if char in matching_bracket.values():
stack.append(char)
elif char in matching_bracket.keys():
if stack == [] or stack.pop() != matching_bracket[char]:
... | from solution import is_balanced, check_brackets
def test_is_balanced():
assert is_balanced("()") == "YES"
assert is_balanced("([{}])") == "YES"
assert is_balanced("{[()]}") == "YES"
assert is_balanced("([)]") == "NO"
assert is_balanced("][") == "NO"
assert is_balanced("(") == "NO"
assert i... | [
{
"docstring": null,
"function_declaration": "def is_balanced(sequence):",
"function_name": "is_balanced",
"parameter_list": "(sequence)"
},
{
"docstring": null,
"function_declaration": "def check_brackets(n, sequences):",
"function_name": "check_brackets",
"parameter_list": "(n,... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_balanced_sequence(sequence):\n \"\"\"\n Returns 'YES' if the sequence of brackets is balanced, otherwise 'NO'.\n \"\"\"\n stack = []\n bracke... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040025",
"row_id": 40025,
"seed_ids": "[23786]"
} | 0.696082 | Taco_40025 | I | [
"is_balanced",
"check_brackets"
] | 2 | [
[
"check_brackets",
"is_balanced"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 9471ff7bf3c553c8a4e93fdf8edb8629210dac6b | f705d6aad15dd469b91be1fc69d5beac8b95b400 | |||
v1.0 | instruct | Taco | Taco_40051_I | Find the Shortest Path in a Weighted Grid
You are given a grid with `n` rows and `m` columns. Each cell in the grid contains a non-negative integer representing the cost to enter that cell. Your task is to find the shortest path from the top-left corner of the grid (0,0) to the bottom-right corner (n-1,m-1) while mini... | from heapq import heappop, heappush
def dijkstra(grid, n, m):
"""
Uses Dijkstra's algorithm to find the minimum cost path in a grid from (0,0) to (n-1,m-1).
"""
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
min_heap = [(grid[0][0], 0, 0)] # (cost, x, y)
distances = {(0, 0): grid[0][0]}
... | def test_dijkstra():
grid = [
[1, 3, 1],
[1, 5, 1],
[4, 2, 1]
]
n, m = 3, 3
assert dijkstra(grid, n, m) == 7
grid = [
[1, 2],
[1, 1]
]
n, m = 2, 2
assert dijkstra(grid, n, m) == 3
def test_parse_input():
input_data = """3 3
1 3 1
1 5 1
4 ... | [
{
"docstring": "Uses Dijkstra's algorithm to find the minimum cost path in a grid from (0,0) to (n-1,m-1).",
"function_declaration": "def dijkstra(grid, n, m):",
"function_name": "dijkstra",
"parameter_list": "(grid, n, m)"
},
{
"docstring": null,
"function_declaration": "def find_shorte... | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from heapq import heappop, heappush\n\ndef dijkstra(grid, n, m):\n directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]\n dist = [[float('inf')] * m for _ in rang... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040051",
"row_id": 40051,
"seed_ids": "[9374]"
} | 0.642707 | Taco_40051 | I | [
"dijkstra",
"find_shortest_paths",
"parse_input",
"main"
] | 4 | [
[
"find_shortest_paths",
"dijkstra"
]
] | 1 | [
"parse_input"
] | false | [] | false | pytest | false | [] | true | fa429ab5d9c22a4008a8e0ff83def5f99182d9f4 | e950fd7bf3f255ae1f9499aa9bdccfbe9f30ec09 | |||
v1.0 | instruct | Taco | Taco_40089_I | Ethan loves observing the night sky and cataloging stars. He has a list of stars represented by their x and y coordinates in a 2D plane. He believes that some stars may form interesting patterns like triangles or other shapes. One specific pattern he is curious about is a right-angled triangle. Given a set of stars, he... | def is_right_angle(x1, y1, x2, y2, x3, y3):
"""
Returns True if points (x1, y1), (x2, y2), and (x3, y3) form a right-angle triangle.
"""
# Calculate the square of the lengths of sides
a2 = (x2 - x1) ** 2 + (y2 - y1) ** 2
b2 = (x3 - x1) ** 2 + (y3 - y1) ** 2
c2 = (x3 - x2) ** 2 + (y3 - y2) **... | def test_detect_right_angle_triangle():
assert detect_right_angle_triangle([(1, 1), (7, 1), (1, 5), (6, 10), (7, 5)]) == "YES"
assert detect_right_angle_triangle([(0, 0), (1, 1), (2, 2), (3, 3)]) == "NO"
assert detect_right_angle_triangle([(0, 0), (3, 0), (0, 4)]) == "YES"
assert detect_right_angle_tria... | [
{
"docstring": "Returns True if points (x1, y1), (x2, y2), and (x3, y3) form a right-angle triangle.",
"function_declaration": "def is_right_angle(x1, y1, x2, y2, x3, y3):",
"function_name": "is_right_angle",
"parameter_list": "(x1, y1, x2, y2, x3, y3)"
},
{
"docstring": "Determine if any th... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_right_angle(x1, y1, x2, y2, x3, y3):\n \"\"\"\n Returns True if points (x1, y1), (x2, y2), and (x3, y3) form a right-angle triangle.\n \"\"\"\n ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00040089",
"row_id": 40089,
"seed_ids": "[22144]"
} | 0.719934 | Taco_40089 | I | [
"is_right_angle",
"detect_right_angle_triangle"
] | 2 | [
[
"detect_right_angle_triangle",
"is_right_angle"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | d4adc3864241d3bf29eba7a0717651b00222059b | 0784ca0fedb338dfe91038289f0caa5ac11980bf | |||
v1.0 | instruct | Taco | Taco_40112_I | A company is planning to build a network of servers to handle incoming client requests efficiently. The company has exactly $N$ servers, each identified by a unique integer from $1$ to $N$. The servers are connected by bidirectional communication links, forming an undirected graph. Each server can communicate with anot... | def find(parent, i):
if parent[i] == i:
return i
else:
parent[i] = find(parent, parent[i])
return parent[i]
def union(parent, rank, x, y):
xroot = find(parent, x)
yroot = find(parent, y)
if rank[xroot] < rank[yroot]:
parent[xroot] = yroot
elif rank[xroot] > ... | def test_find():
parent = [0, 1, 2, 3]
assert find(parent, 0) == 0
assert find(parent, 1) == 1
def test_union():
parent = [0, 1, 2, 3]
rank = [0, 0, 0, 0]
union(parent, rank, 0, 1)
assert find(parent, 0) == find(parent, 1)
assert parent[1] == 0
def test_min_additional_links():
asse... | [
{
"docstring": null,
"function_declaration": "def find(parent, i):",
"function_name": "find",
"parameter_list": "(parent, i)"
},
{
"docstring": null,
"function_declaration": "def union(parent, rank, x, y):",
"function_name": "union",
"parameter_list": "(parent, rank, x, y)"
},
... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def find(parent, i):\n if parent[i] == i:\n return i\n else:\n parent[i] = find(parent, parent[i])\n return parent[i]\n\ndef union(paren... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00040112",
"row_id": 40112,
"seed_ids": "[12704]"
} | 0.665152 | Taco_40112 | I | [
"find",
"union",
"min_additional_links",
"process_test_cases"
] | 4 | [
[
"min_additional_links",
"find"
],
[
"min_additional_links",
"union"
],
[
"process_test_cases",
"min_additional_links"
],
[
"union",
"find"
]
] | 4 | [
"process_test_cases"
] | false | [] | false | pytest | false | [] | true | 49519dbbcda211251e9bc8d5cab3eccc96f12b20 | 3b2773ed0f97d14be73026892ff22bee203d45fb | |||
v1.0 | instruct | Taco | Taco_40119_I | Given a sequence of $n$ integers, we want to remove elements so that the remaining sequence is strictly increasing. Specifically, for each integer $v_i$ in the sequence, either remove it or keep it such that the final sequence contains all elements sorted in strictly increasing order without changing their original pos... | def longest_increasing_subsequence_length(n, sequence):
"""
Finds the length of the longest strictly increasing subsequence.
"""
if n == 0:
return 0
# Initialize an array to store the smallest ending value for increasing subsequence of length i+1
dp = []
for num in sequence... | def test_longest_increasing_subsequence_length():
assert longest_increasing_subsequence_length(5, [1, 2, 1, 5, 3]) == 3, "Test case 1 failed"
assert longest_increasing_subsequence_length(4, [9, 4, 7, 2]) == 2, "Test case 2 failed"
assert longest_increasing_subsequence_length(6, [2, 2, 2, 2, 2, 2]) == 1, "Te... | [
{
"docstring": "Finds the length of the longest strictly increasing subsequence.",
"function_declaration": "def longest_increasing_subsequence_length(n, sequence):",
"function_name": "longest_increasing_subsequence_length",
"parameter_list": "(n, sequence)"
},
{
"docstring": "Helper function... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def length_of_lis(sequence):\n \"\"\"\n Returns the length of the longest increasing subsequence.\n \"\"\"\n if not sequence:\n return 0\n\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040119",
"row_id": 40119,
"seed_ids": "[2001]"
} | 0.784242 | Taco_40119 | I | [
"longest_increasing_subsequence_length",
"binary_search",
"process_input"
] | 3 | [
[
"longest_increasing_subsequence_length",
"binary_search"
],
[
"process_input",
"longest_increasing_subsequence_length"
]
] | 2 | [
"process_input"
] | false | [] | false | pytest | false | [] | true | 4f31dba945e4898c853190bd1ecf420e59eee6f3 | 0b3c73cdce7675fab531e28ade641dfd6fb521d4 | |||
v1.0 | instruct | Taco | Taco_40154_I | John is organizing a series of events for his friends, and he wants to make sure the schedule is balanced. He has a list of N events, each with a start time and an end time. Two events are said to overlap if they share at least one point in time. John wants to find out if he can arrange all the events such that no two ... | def can_schedule_events(test_cases):
results = []
for events in test_cases:
events.sort() # Sort events by their start time
can_schedule = True
end_time = -1
for s, e in events:
if s < end_time:
can_schedule = False
break
e... | def test_can_schedule_events():
input_str = "2\n3\n1 3\n2 5\n6 7\n2\n1 2\n3 4\n"
assert solve(input_str) == ["NO", "YES"]
def test_no_event():
input_str = "1\n0\n"
assert solve(input_str) == ["YES"]
def test_single_event():
input_str = "1\n1\n0 1\n"
assert solve(input_str) == ["YES"]
def test... | [
{
"docstring": null,
"function_declaration": "def can_schedule_events(test_cases):",
"function_name": "can_schedule_events",
"parameter_list": "(test_cases)"
},
{
"docstring": null,
"function_declaration": "def parse_input(input_str):",
"function_name": "parse_input",
"parameter_... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def can_schedule_events(test_cases):\n results = []\n for case in test_cases:\n events = case\n events.sort(key=lambda x: x[0])\n \n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040154",
"row_id": 40154,
"seed_ids": "[4006]"
} | 0.668111 | Taco_40154 | I | [
"can_schedule_events",
"parse_input",
"solve"
] | 3 | [
[
"solve",
"can_schedule_events"
],
[
"solve",
"parse_input"
]
] | 2 | [
"parse_input"
] | false | [] | false | pytest | false | [] | true | d658eecd8021d5a83ee0ccca21926f7ebe1d5464 | 52f561be4a85de4225c96b4cc8f046e18815b0d1 | |||
v1.0 | instruct | Taco | Taco_40170_I | A delivery company wants to optimize the route for their delivery van. Each day, the van starts from the warehouse and makes deliveries to $N$ different locations. For simplicity, consider the warehouse to be at location number $0$, and the $N$ delivery locations are numbered from $1$ to $N$. The delivery van must star... | from itertools import permutations
def calculate_travel_time(route, travel_times):
total_time = 0
for i in range(len(route) - 1):
total_time += travel_times[route[i]][route[i + 1]]
total_time += travel_times[route[-1]][route[0]] # returning to the warehouse
return total_time
def find_shortest... | from solution import find_shortest_route
def test_example_1():
N = 3
travel_times = [
[0, 10, 15, 20],
[10, 0, 35, 25],
[15, 35, 0, 30],
[20, 25, 30, 0]
]
assert find_shortest_route(N, travel_times) == 80
def test_example_2():
N = 4
travel_times = [
[0, ... | [
{
"docstring": null,
"function_declaration": "def calculate_travel_time(route, travel_times):",
"function_name": "calculate_travel_time",
"parameter_list": "(route, travel_times)"
},
{
"docstring": null,
"function_declaration": "def find_shortest_route(N, travel_times):",
"function_n... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import itertools\n\ndef find_shortest_route(N, travel_times):\n locations = list(range(1, N + 1))\n min_route_time = float('inf')\n \n for perm in iter... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040170",
"row_id": 40170,
"seed_ids": "[2596]"
} | 0.819356 | Taco_40170 | I | [
"calculate_travel_time",
"find_shortest_route"
] | 2 | [
[
"find_shortest_route",
"calculate_travel_time"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | fe8d45863285b0f5feee96a0495425c98db3d586 | f383809832c2050252bd8e887e4ed7f031b1af59 | |||
v1.0 | instruct | Taco | Taco_40194_I | Deepa is a software engineer and is working on a project to analyze word frequency in large texts. She needs a function that can determine if two strings are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters e... | def are_anagrams(word1, word2):
"""
Check if two words are anagrams of each other (case insensitive).
"""
return sorted(word1.lower()) == sorted(word2.lower())
def check_anagrams(pairs):
"""
Takes a list of word pairs and returns a list of "YES" or "NO" for each pair
indicating whether the... | from solution import are_anagrams, check_anagrams
def test_are_anagrams():
assert are_anagrams("listen", "silent") == True
assert are_anagrams("hello", "world") == False
assert are_anagrams("Listen", "SiLeNt") == True
assert are_anagrams("Triangle", "Integral") == True
assert are_anagrams("apple", ... | [
{
"docstring": "Check if two words are anagrams of each other (case insensitive).",
"function_declaration": "def are_anagrams(word1, word2):",
"function_name": "are_anagrams",
"parameter_list": "(word1, word2)"
},
{
"docstring": "Takes a list of word pairs and returns a list of \"YES\" or \"... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def are_anagrams(word1, word2):\n \"\"\"\n Check if two words are anagrams of each other (case insensitive).\n \"\"\"\n return sorted(word1.lower()) ==... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040194",
"row_id": 40194,
"seed_ids": "[6794]"
} | 0.604384 | Taco_40194 | I | [
"are_anagrams",
"check_anagrams"
] | 2 | [
[
"check_anagrams",
"are_anagrams"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 7eb9c1199f78cc5936957bc940d907272fac9936 | 9b55c28208f2e0f16dfc669a722ff087062489f4 | |||
v1.0 | instruct | Taco | Taco_40214_I | Given an array of integers, return an array containing only the prime numbers from the original array, in ascending order.
For example, considering the input array `[3, 12, 5, 16, 7, 11]`, the result would be `[3, 5, 7, 11]`.
`find_primes([3, 12, 5, 16, 7, 11]) = [3, 5, 7, 11]`
Write a function `find_primes(arr)` th... | def is_prime(n):
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
for i in range(3, int(n ** 0.5) + 1, 2):
if n % i == 0:
return False
return True
def find_primes(arr):
primes = [x for x in arr if is_prime(x)]
return sort... | from solution import find_primes
def test_find_primes_example():
assert find_primes([3, 12, 5, 16, 7, 11]) == [3, 5, 7, 11]
def test_find_primes_no_primes():
assert find_primes([4, 6, 8, 10, 12]) == []
def test_find_primes_all_primes():
assert find_primes([2, 3, 5, 7, 11, 13]) == [2, 3, 5, 7, 11, 13]
de... | [
{
"docstring": null,
"function_declaration": "def is_prime(n):",
"function_name": "is_prime",
"parameter_list": "(n)"
},
{
"docstring": null,
"function_declaration": "def find_primes(arr):",
"function_name": "find_primes",
"parameter_list": "(arr)"
}
] | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(n):\n \"\"\"\n Helper function to check if a number is a prime.\n \"\"\"\n if n <= 1:\n return False\n if n == 2:\n retur... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040214",
"row_id": 40214,
"seed_ids": "[4326]"
} | 0.675947 | Taco_40214 | I | [
"is_prime",
"find_primes"
] | 2 | [
[
"find_primes",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 541f6a5eb8fff4cef4e9b1dc18d476b6df69ca27 | 3e54db4274e5154fc9473661ecab3119943c366e | |||
v1.0 | instruct | Taco | Taco_40245_I | A race track has N checkpoints connected by M bidirectional roads. Each road has a fixed distance between two checkpoints. A racer wants to determine the minimum distance required to visit every checkpoint starting from any checkpoint and return to the original one, forming a cycle.
Given the checkpoints and the roads... | import sys
def tsp(N, dist):
# dp[mask][i] will be the minimum cost to reach node i with the set of nodes in mask
dp = [[sys.maxsize] * N for _ in range(1 << N)]
dp[1][0] = 0
for mask in range(1 << N):
for u in range(N):
if mask & (1 << u):
for v in range(N):
... | def test_tsp():
assert shortest_cycle(4, [(1, 2, 10), (2, 3, 15), (3, 4, 20), (4, 1, 25), (1, 3, 30), (2, 4, 35)]) == 70
assert shortest_cycle(3, [(1, 2, 10), (2, 3, 20)]) == -1
assert shortest_cycle(2, [(1, 2, 1), (2, 1, 1)]) == 2
assert shortest_cycle(5, [(1, 2, 10), (2, 3, 20), (3, 4, 30), (4, 5, 40)... | [
{
"docstring": null,
"function_declaration": "def tsp(N, dist):",
"function_name": "tsp",
"parameter_list": "(N, dist)"
},
{
"docstring": null,
"function_declaration": "def shortest_cycle(N, roads):",
"function_name": "shortest_cycle",
"parameter_list": "(N, roads)"
},
{
... | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0
] | 1 | hard | 0.1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import itertools\n\ndef floyd_warshall(n, dist):\n for k in range(n):\n for i in range(n):\n for j in range(n):\n if dist[i][j]... | trial_gpt4o_6 | {
"original_instruction": "",
"prompt_id": "00040245",
"row_id": 40245,
"seed_ids": "[18093]"
} | 0.721876 | Taco_40245 | I | [
"tsp",
"shortest_cycle",
"main"
] | 3 | [
[
"shortest_cycle",
"tsp"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | 70b69fe1b1f678f5326e1a991a86fd8d6c5c5b12 | e066e605accff22d9c82b0f70663987f4d3dd625 | |||
v1.0 | instruct | Taco | Taco_40256_I | Given an array of non-negative integers, you are tasked with arranging these integers such that they form the largest possible number. The result should be returned as a string.
You should not consider the leading zeros in the resulting string. If the result is a zero, the function should just return "0".
Input
- The... | from functools import cmp_to_key
def compare(x, y):
"""
Helper comparison function that determines the order of two strings x and y
such that the combination x + y or y + x forms a larger number.
"""
if x + y > y + x:
return -1
else:
return 1
def largest_number(arr):
"""
... | import pytest
from solution import handle_multiple_test_cases, largest_number
def test_single_case():
assert largest_number([10, 2, 9]) == "9210"
assert largest_number([3, 30, 34, 5, 9]) == "9534330"
assert largest_number([1, 0]) == "10"
assert largest_number([0, 0]) == "0"
def test_handle_multiple_te... | [
{
"docstring": "Helper comparison function that determines the order of two strings x and y\nsuch that the combination x + y or y + x forms a larger number.",
"function_declaration": "def compare(x, y):",
"function_name": "compare",
"parameter_list": "(x, y)"
},
{
"docstring": "Takes an arra... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from functools import cmp_to_key\n\ndef largest_number(test_cases):\n def custom_compare(x, y):\n return (y + x > x + y) - (y + x < x + y)\n \n res... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040256",
"row_id": 40256,
"seed_ids": "[11881]"
} | 0.688773 | Taco_40256 | I | [
"compare",
"largest_number",
"handle_multiple_test_cases"
] | 3 | [
[
"handle_multiple_test_cases",
"largest_number"
],
[
"largest_number",
"compare"
]
] | 2 | [
"handle_multiple_test_cases"
] | false | [] | false | pytest | true | [] | true | 8a995dbaefbbfe773420669a5df438da6220d4bc | f53b4ba82d3c309f3ecf8efa8d87616b382b775d | |||
v1.0 | instruct | Taco | Taco_40272_I | A long-forgotten kingdom consists of N cities connected by M bidirectional roads. Each road has a certain cost associated with it. The kingdom is attempting to rebuild its road system to ensure that there is a path between every pair of cities while minimizing the total cost of the roads.
The royal engineer has determ... | def find(parent, i):
if parent[i] == i:
return i
else:
parent[i] = find(parent, parent[i])
return parent[i]
def union(parent, rank, x, y):
root_x = find(parent, x)
root_y = find(parent, y)
if root_x != root_y:
if rank[root_x] > rank[root_y]:
parent[r... | def test_min_cost_to_connect_all_cities():
# Test case 1: standard case with multiple routes
N, M = 4, 5
roads = [
(1, 2, 3),
(1, 3, 4),
(4, 2, 2),
(4, 3, 5),
(3, 2, 6)
]
assert min_cost_to_connect_all_cities(N, M, roads) == 9
# Test case 2: impossible to... | [
{
"docstring": null,
"function_declaration": "def find(parent, i):",
"function_name": "find",
"parameter_list": "(parent, i)"
},
{
"docstring": null,
"function_declaration": "def union(parent, rank, x, y):",
"function_name": "union",
"parameter_list": "(parent, rank, x, y)"
},
... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def find(parent, i):\n if parent[i] == i:\n return i\n return find(parent, parent[i])\n\ndef union(parent, rank, x, y):\n root_x = find(parent, x)\... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040272",
"row_id": 40272,
"seed_ids": "[6084]"
} | 0.789932 | Taco_40272 | I | [
"find",
"union",
"min_cost_to_connect_all_cities"
] | 3 | [
[
"min_cost_to_connect_all_cities",
"find"
],
[
"min_cost_to_connect_all_cities",
"union"
],
[
"union",
"find"
]
] | 3 | [] | false | [] | false | pytest | false | [] | true | 1a8d3447281442b10368315bcb8e76f36cd5b75c | 2d5ef94b237daaa87c02e2b9a67189528722b5af | |||
v1.0 | instruct | Taco | Taco_40280_I | Alex has a collection of different stones numbered from 1 to N. He enjoys creating unique sequences with these stones by following a set of specific rules. Each sequence should start and end with the stone numbered 1, and every other stone in the sequence should have a number different from its immediate predecessor.
... | MOD = 10**9 + 7
def count_sequences(n, k):
if k == 1:
return 1 # Only one sequence: [1]
if k % 2 == 0:
return pow(n - 1, k // 2, MOD)
else:
return 0 # No valid sequence for odd k
def solve(test_cases):
results = []
for n, k in test_cases:
results.append(count... | from solution import count_sequences, solve, process_input
def test_count_sequences_even_k():
assert count_sequences(3, 2) == 2
assert count_sequences(4, 2) == 3
assert count_sequences(4, 4) == 9
assert count_sequences(5, 6) == 64
def test_count_sequences_odd_k():
assert count_sequences(3, 5) == 0... | [
{
"docstring": null,
"function_declaration": "def count_sequences(n, k):",
"function_name": "count_sequences",
"parameter_list": "(n, k)"
},
{
"docstring": null,
"function_declaration": "def solve(test_cases):",
"function_name": "solve",
"parameter_list": "(test_cases)"
},
{
... | [
0,
0,
0,
1,
0
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "MOD = 10**9 + 7\n\ndef count_unique_sequences(N, K):\n if K == 1:\n return 1\n if K % 2 == 0:\n return 1\n if N == 2:\n return 0\n ... | trial_gpt4o_3 | {
"original_instruction": "",
"prompt_id": "00040280",
"row_id": 40280,
"seed_ids": "[1124]"
} | 0.762981 | Taco_40280 | I | [
"count_sequences",
"solve",
"process_input"
] | 3 | [
[
"solve",
"count_sequences"
]
] | 1 | [
"process_input"
] | false | [] | false | pytest | true | [] | true | 35db92971b04939778c12d00493db9eeb1097413 | 3a513ae65508aa3e6798db716c4f3e450bf57043 | |||
v1.0 | instruct | Taco | Taco_40354_I | Prime Subsequence Sum
You are given a list of integers and asked to find the prime subsequence with the highest sum. The sequence does not have to be contiguous, but it must be a subsequence of the original list and each element in the subsequence must be a prime number. If no prime subsequence exists, return "NONE".
... | def is_prime(number):
"""
Checks if a number is prime.
"""
if number <= 1:
return False
if number == 2:
return True
if number % 2 == 0:
return False
for i in range(3, int(number**0.5) + 1, 2):
if number % i == 0:
return False
return True
def m... | from solution import is_prime, max_prime_subsequence_sum, process_input
# is_prime function tests
def test_is_prime():
assert is_prime(2) == True
assert is_prime(3) == True
assert is_prime(4) == False
assert is_prime(5) == True
assert is_prime(10) == False
assert is_prime(7) == True
assert ... | [
{
"docstring": "Checks if a number is prime.",
"function_declaration": "def is_prime(number):",
"function_name": "is_prime",
"parameter_list": "(number)"
},
{
"docstring": "Returns the sum of the prime subsequence with the highest sum, or \"NONE\" if no prime subsequence exists.",
"funct... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(num):\n \"\"\"\n Check if a number is prime.\n \"\"\"\n if num <= 1:\n return False\n if num == 2:\n return True\n if ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040354",
"row_id": 40354,
"seed_ids": "[3657]"
} | 0.625156 | Taco_40354 | I | [
"is_prime",
"max_prime_subsequence_sum",
"process_input"
] | 3 | [
[
"max_prime_subsequence_sum",
"is_prime"
],
[
"process_input",
"max_prime_subsequence_sum"
]
] | 2 | [
"process_input"
] | false | [] | false | pytest | true | [] | true | 5ce16ad51b906f895ea546ec66b1cda078eca244 | 3c78673ab0b9d222181613cb6b6268d67bed780a | |||
v1.0 | instruct | Taco | Taco_40373_I | Given a list of employees in a company where each employee has a set of skills, your task is to determine if there exists an ability to form a project team where everyone in the team is connected either directly or indirectly through at least one common skill.
-----Input-----
The input consists of:
- One line with an ... | def find(x, parent):
if parent[x] != x:
parent[x] = find(parent[x], parent)
return parent[x]
def union(x, y, parent, rank):
rootX = find(x, parent)
rootY = find(y, parent)
if rootX != rootY:
if rank[rootX] > rank[rootY]:
parent[rootY] = rootX
elif rank[rootX] < r... | import pytest
from solution import form_project_team
def test_form_project_team_sample_input():
assert form_project_team(5, [[3, 100, 200, 300], [2, 300, 400], [3, 500, 200, 600], [1, 100], [2, 400, 500]]) != "impossible"
def test_form_project_team_minimal_case_connected():
assert form_project_team(2, [[1, 1]... | [
{
"docstring": null,
"function_declaration": "def find(x, parent):",
"function_name": "find",
"parameter_list": "(x, parent)"
},
{
"docstring": null,
"function_declaration": "def union(x, y, parent, rank):",
"function_name": "union",
"parameter_list": "(x, y, parent, rank)"
},
... | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def form_project_team(n, employees_skills):\n from collections import defaultdict, deque\n\n # Create a dictionary to map each skill to the list of employees... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040373",
"row_id": 40373,
"seed_ids": "[14334]"
} | 0.647255 | Taco_40373 | I | [
"find",
"union",
"form_project_team"
] | 3 | [
[
"form_project_team",
"find"
],
[
"form_project_team",
"union"
],
[
"union",
"find"
]
] | 3 | [] | false | [] | false | pytest | true | [] | true | c401c761f85feb9d937ef5ed48e0c6f9f2c10c93 | 1cf4acf697e2a11d30e84f832669fee424d32cc4 | |||
v1.0 | instruct | Taco | Taco_40378_I | A group of scientists is studying a special type of network composed of N nodes connected by weighted edges. For their experiments, they need to find the "network efficiency" value. The efficiency of the network is defined as the sum of the weight of the edges in the minimum spanning tree (MST) of the network.
To help... | from heapq import heappop, heappush
def find(parent, i):
# Find function with path compression
if parent[i] == i:
return i
else:
parent[i] = find(parent, parent[i])
return parent[i]
def union(parent, rank, x, y):
# Union function with union by rank
root_x = find(parent, x)
... | def test_network_efficiency():
T = 2
test_cases = [
(4, 5, [(0, 1, 10), (0, 2, 6), (1, 2, 5), (2, 3, 4), (1, 3, 1)]),
(3, 3, [(0, 1, 2), (0, 2, 3), (1, 2, 1)])
]
expected_outputs = [11, 3]
results = network_efficiency(T, test_cases)
for res, exp in zip(results, expected_outputs):... | [
{
"docstring": null,
"function_declaration": "def find(parent, i):",
"function_name": "find",
"parameter_list": "(parent, i)"
},
{
"docstring": null,
"function_declaration": "def union(parent, rank, x, y):",
"function_name": "union",
"parameter_list": "(parent, rank, x, y)"
},
... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from heapq import heappop, heappush\n\ndef find(parent, i):\n # Find function with path compression\n if parent[i] == i:\n return i\n else:\n ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00040378",
"row_id": 40378,
"seed_ids": "[9859]"
} | 0.736791 | Taco_40378 | I | [
"find",
"union",
"kruskal",
"network_efficiency"
] | 4 | [
[
"kruskal",
"find"
],
[
"kruskal",
"union"
],
[
"network_efficiency",
"kruskal"
],
[
"union",
"find"
]
] | 4 | [] | false | [] | false | pytest | false | [] | true | 44a01d2a01eaca2ac5696dea0b2e16357c1e6879 | 23ae739053a5dd0d4d30aea20c3884b1f6e98a97 | |||
v1.0 | instruct | Taco | Taco_40392_I | You are given a list of strings. A string is considered "well-formed" if it contains only alphabetic characters and has equal numbers of uppercase and lowercase letters. For each string in the list, you need to determine if it is well-formed or not. If it is well-formed, your output should be the length of the string; ... | def is_well_formed(s):
"""
Check if the string is well-formed.
A string is well-formed if it contains only alphabetic characters and
has equal numbers of uppercase and lowercase letters.
"""
if not s.isalpha():
return -1
uppercase_count = sum(1 for c in s if c.isupper())
l... | from solution import is_well_formed, process_strings
def test_is_well_formed():
assert is_well_formed("aAbB") == 4
assert is_well_formed("abcD") == -1
assert is_well_formed("XYzZxy") == 6
assert is_well_formed("aA") == 2
assert is_well_formed("aAbb") == -1
assert is_well_formed("abc") == -1
... | [
{
"docstring": "Check if the string is well-formed.\n\nA string is well-formed if it contains only alphabetic characters and \nhas equal numbers of uppercase and lowercase letters.",
"function_declaration": "def is_well_formed(s):",
"function_name": "is_well_formed",
"parameter_list": "(s)"
},
{... | [
0,
0,
0,
1,
0
] | 1 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_well_formed(s):\n \"\"\"\n Returns the length of the string if it is well-formed, otherwise returns -1.\n A string is considered well-formed if it ... | trial_gpt4o_3 | {
"original_instruction": "",
"prompt_id": "00040392",
"row_id": 40392,
"seed_ids": "[19666]"
} | 0.743067 | Taco_40392 | I | [
"is_well_formed",
"process_strings"
] | 2 | [
[
"process_strings",
"is_well_formed"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | aaa8b57244c8029ff4ef8f3ec35aba7f6e8c3df0 | 62af34d3480321d93bf76be604809c70c29635ce | |||
v1.0 | instruct | Taco | Taco_40406_I | A group of scientists is studying the habits of migratory birds. They have recorded the paths of several birds, and each path can be represented as a sequence of directions: 'N' for north, 'S' for south, 'E' for east, and 'W' for west. They are trying to determine how many of these paths are cyclic. A path is considere... | def is_cyclic_path(path):
"""
Determines if a given path is cyclic (starts and ends at the same point).
Parameters:
path (str): A string representing the path taken by the bird.
Returns:
bool: True if the path is cyclic, otherwise False.
"""
x, y = 0, 0
for direction in pat... | import pytest
from solution import is_cyclic_path, count_cyclic_paths
def test_is_cyclic_path():
assert is_cyclic_path("NESW") == True
assert is_cyclic_path("NNSS") == True
assert is_cyclic_path("EW") == True
assert is_cyclic_path("NNEESWWS") == True
assert is_cyclic_path("NS") == True
assert i... | [
{
"docstring": "Determines if a given path is cyclic (starts and ends at the same point).\n\nParameters:\npath (str): A string representing the path taken by the bird.\n\nReturns:\nbool: True if the path is cyclic, otherwise False.",
"function_declaration": "def is_cyclic_path(path):",
"function_name": ... | [
1,
0,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_cyclic_path(path):\n \"\"\"\n Determines if the given path is cyclic.\n \n A path is considered cyclic if it returns to the starting point\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040406",
"row_id": 40406,
"seed_ids": "[24465]"
} | 0.625212 | Taco_40406 | I | [
"is_cyclic_path",
"count_cyclic_paths"
] | 2 | [
[
"count_cyclic_paths",
"is_cyclic_path"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 8967ba5efdc5d06aaf1f4a8985cf463a47028a0c | 58a6baf83d9b011be6c744a324a9b46f6cbe2bcb | |||
v1.0 | instruct | Taco | Taco_40470_I | You are given an array of integers a = [a_1, a_2, ..., a_n] and m queries. Each query is described by a pair of integers l_i, r_i (1 ≤ l_i ≤ r_i ≤ n). For each query, find the maximum integer in the subarray a[l_i..r_i].
Your task is to write a program to answer these queries efficiently.
-----Input-----
The first ... | def preprocess(arr, n):
"""
Preprocess the list using a sparse table for fast range_maximum queries.
"""
import math
k = int(math.log2(n)) + 1
st = [[0] * (k + 1) for _ in range(n)]
# Initialize the sparse table for the intervals with size 1
for i in range(n):
st[i][0] = arr[i]... | from solution import answer_queries
def test_example_1():
arr = [1, 2, 3, 4, 5]
queries = [(1, 3), (2, 5), (1, 5)]
expected = [3, 5, 5]
assert answer_queries(arr, queries) == expected
def test_example_2():
arr = [5, 1, 3, 7, 9, 2, 6, 8]
queries = [(3, 4), (1, 7), (2, 8), (4, 8)]
expected =... | [
{
"docstring": "Preprocess the list using a sparse table for fast range_maximum queries.",
"function_declaration": "def preprocess(arr, n):",
"function_name": "preprocess",
"parameter_list": "(arr, n)"
},
{
"docstring": "Query the maximum value in the range [l, r] using the preprocessed spar... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def preprocess_max(array):\n \"\"\"\n Preprocesses the maximum values for subarrays to allow fast querying.\n \"\"\"\n n = len(array)\n max_table = ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040470",
"row_id": 40470,
"seed_ids": "[10437]"
} | 0.749635 | Taco_40470 | I | [
"preprocess",
"range_maximum",
"answer_queries"
] | 3 | [
[
"answer_queries",
"preprocess"
],
[
"answer_queries",
"range_maximum"
]
] | 2 | [] | false | [] | false | pytest | true | [] | true | f79a343aa3d64e48e4fbf993615207ceb0ac53c1 | e86efed1371174b1dc8b91403714d79c2f29f75c | |||
v1.0 | instruct | Taco | Taco_40566_I | Henry loves collecting fish of different types and sizes. He has a sequence of N fish sizes represented as an integer array F, where F[i] is the size of the i-th fish (1-based index). Henry has a unique requirement for his collection: he only wants to keep fish that have sizes which are prime numbers.
Write a function... | import sys
import math
def is_prime(num):
if num <= 1:
return False
if num <= 3:
return True
if num % 2 == 0 or num % 3 == 0:
return False
i = 5
while i * i <= num:
if num % i == 0 or num % (i + 2) == 0:
return False
i += 6
return True
def fi... | import sys
from io import StringIO
import pytest
from solution import filter_prime_fish_sizes, is_prime
def test_is_prime():
assert is_prime(2)
assert is_prime(3)
assert not is_prime(4)
assert is_prime(5)
assert not is_prime(9)
assert is_prime(13)
assert not is_prime(1)
assert not is_pr... | [
{
"docstring": null,
"function_declaration": "def is_prime(num):",
"function_name": "is_prime",
"parameter_list": "(num)"
},
{
"docstring": null,
"function_declaration": "def filter_prime_fish_sizes(N, fish_sizes):",
"function_name": "filter_prime_fish_sizes",
"parameter_list": "... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import math\n\ndef is_prime(n):\n \"\"\"\n Returns True if n is a prime number, otherwise False.\n A prime number is a number greater than 1 that has no p... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040566",
"row_id": 40566,
"seed_ids": "[20605]"
} | 0.642866 | Taco_40566 | I | [
"is_prime",
"filter_prime_fish_sizes",
"main"
] | 3 | [
[
"filter_prime_fish_sizes",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | fc47ad2a60e1c5558cf691e9f7e2f64891557b23 | 9952e8554858ce4853b23b85927bd9fcacf51cfd | |||
v1.0 | instruct | Taco | Taco_40584_I | The Kingdom of Codesland has $N$ cities connected by $M$ bidirectional roads. Each road connects two cities and has an associated travel cost. The King wants to build new roads in such a way that there is exactly one path between any two cities (i.e., the road network is a tree).
Additionally, the King has a list of $... | def find(parent, i):
if parent[i] == i:
return i
parent[i] = find(parent, parent[i])
return parent[i]
def union(parent, rank, x, y):
rootX = find(parent, x)
rootY = find(parent, y)
if rootX != rootY:
if rank[rootX] > rank[rootY]:
parent[rootY] = rootX
elif ra... | from solution import minimum_cost_to_construct
def test_minimum_cost_case_1():
assert minimum_cost_to_construct(4, 3, [(1, 2, 3), (2, 3, 1), (3, 4, 4)], 2, [(1, 4, 2), (2, 4, 3)]) == 6
def test_minimum_cost_case_2():
assert minimum_cost_to_construct(3, 2, [(1, 2, 5), (2, 3, 10)], 1, [(1, 3, 1)]) == 6
def tes... | [
{
"docstring": null,
"function_declaration": "def find(parent, i):",
"function_name": "find",
"parameter_list": "(parent, i)"
},
{
"docstring": null,
"function_declaration": "def union(parent, rank, x, y):",
"function_name": "union",
"parameter_list": "(parent, rank, x, y)"
},
... | [
0,
0,
1
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def find_min_cost_to_construct_network(N, M, existing_roads, K, new_roads):\n parent = list(range(N + 1))\n \n def find(x):\n if parent[x] != x:\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040584",
"row_id": 40584,
"seed_ids": "[10808]"
} | 0.753487 | Taco_40584 | I | [
"find",
"union",
"minimum_cost_to_construct"
] | 3 | [
[
"minimum_cost_to_construct",
"find"
],
[
"minimum_cost_to_construct",
"union"
],
[
"union",
"find"
]
] | 3 | [] | false | [] | false | pytest | true | [] | true | 5aefa2b075e76c04eaf350d252c0f0ef662094a7 | b7f9c8c8e80d454a716c0f177692dea255242be1 | |||
v1.0 | instruct | Taco | Taco_40598_I | You are given a binary tree with N nodes. For each node, you are tasked with calculating the sum of the values of the nodes that are in the subtree of the given node (including itself).
The binary tree is defined using the following structure:
- Each of the N nodes has a unique integer value v_i.
- Each node can have ... | class TreeNode:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def build_tree(nodes_info):
nodes = {}
for u, v, l, r in nodes_info:
if u not in nodes:
nodes[u] = TreeNode(v)
else:
nodes[u].value = v
if... | from solution import TreeNode, build_tree, get_subtree_sums
def test_single_node_tree():
nodes_info = [(1, 3, -1, -1)]
root = build_tree(nodes_info)
subtree_sums = get_subtree_sums(root)
assert subtree_sums == [3]
def test_tree_with_multiple_nodes():
nodes_info = [
(1, 3, 2, 3),
(2... | [] | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "class TreeNode:\n def __init__(self, index, val):\n self.index = index\n self.val = val\n self.left = None\n self.right = None\n ... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040598",
"row_id": 40598,
"seed_ids": "[8389]"
} | 0.696493 | Taco_40598 | I | [
"build_tree",
"subtree_sum",
"get_subtree_sums",
"main"
] | 4 | [
[
"get_subtree_sums",
"subtree_sum"
]
] | 1 | [] | false | [
"TreeNode"
] | true | pytest | true | [] | true | 74863a99705b644ab03c0dd65e1d55449846b76c | 00a3b4df21f6deb3b2dc50b7d1a840b25e2dc843 | |||
v1.0 | instruct | Taco | Taco_40649_I | In an ancient city, there exists a special kind of road capable of branching out into others, forming an extensive network. Each road in this network is represented by a unique integer length. The residents of the city often take routes that pass through several roads to get from one point to another, aiming to minimiz... | import sys
from collections import defaultdict, deque
def build_tree(n, edges):
tree = defaultdict(list)
for u, v, w in edges:
tree[u].append((v, w))
tree[v].append((u, w))
return tree
def bfs(tree, start):
distances = {start: 0}
queue = deque([start])
while queue:
node... | def test_build_tree():
edges = [(1, 2, 3), (1, 3, 4), (2, 4, 2), (2, 5, 6)]
expected_tree = {
1: [(2, 3), (3, 4)],
2: [(1, 3), (4, 2), (5, 6)],
3: [(1, 4)],
4: [(2, 2)],
5: [(2, 6)]
}
assert build_tree(5, edges) == expected_tree
def test_bfs():
tree = {
... | [
{
"docstring": null,
"function_declaration": "def build_tree(n, edges):",
"function_name": "build_tree",
"parameter_list": "(n, edges)"
},
{
"docstring": null,
"function_declaration": "def bfs(tree, start):",
"function_name": "bfs",
"parameter_list": "(tree, start)"
},
{
... | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
1
] | 2 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import sys\nfrom collections import defaultdict\nimport heapq\n\ndef build_graph(n, edges):\n graph = defaultdict(list)\n for u, v, w in edges:\n grap... | trial_gpt4o_9 | {
"original_instruction": "",
"prompt_id": "00040649",
"row_id": 40649,
"seed_ids": "[4911]"
} | 0.782332 | Taco_40649 | I | [
"build_tree",
"bfs",
"answer_queries",
"solve"
] | 4 | [
[
"answer_queries",
"bfs"
],
[
"solve",
"answer_queries"
],
[
"solve",
"build_tree"
]
] | 3 | [] | false | [] | false | pytest | false | [] | true | 7fdefb14724ae8bfc022fac25b1a205b2dda0f12 | fb84822b54e1d37ee8fcea4bded43a382e73a6ce | |||
v1.0 | instruct | Taco | Taco_40670_I | Alice has a list of distinct integers $a_1, a_2, \ldots, a_n$. She wants to create a new list $b$ such that each element in $b$ is equal to the product of all elements in $a$ except the one at the same position. However, she quickly realizes that producing these products could result in very large numbers. To handle th... | def product_except_self(arr, mod=10**9+7):
n = len(arr)
if n < 2:
return []
result = [1] * n
left_product = 1
for i in range(n):
result[i] = left_product
left_product = (left_product * arr[i]) % mod
right_product = 1
for i in range(n-1, -1, -1):
result[i] =... | from solution import product_except_self, compute_products_for_all_cases, parse_input_input
def test_example_case():
test_cases = [[1, 2, 3, 4]]
expected = [[24, 12, 8, 6]]
assert compute_products_for_all_cases(test_cases) == expected
def test_case_with_single_element():
test_cases = [[1]]
expecte... | [
{
"docstring": null,
"function_declaration": "def product_except_self(arr, mod=10 ** 9 + 7):",
"function_name": "product_except_self",
"parameter_list": "(arr, mod=10 ** 9 + 7)"
},
{
"docstring": null,
"function_declaration": "def compute_products_for_all_cases(test_cases):",
"functi... | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "MOD = 10**9 + 7\n\ndef compute_b_list(test_cases):\n results = []\n for n, arr in test_cases:\n total_product = 1\n zero_count = 0\n for... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040670",
"row_id": 40670,
"seed_ids": "[24129]"
} | 0.728942 | Taco_40670 | I | [
"product_except_self",
"compute_products_for_all_cases",
"parse_input_input"
] | 3 | [
[
"compute_products_for_all_cases",
"product_except_self"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 5c68303e4c2f5fe8ddef12ed2f74314181e03af8 | 14e326e731f2de946365f9b04a17a684470fcc58 | |||
v1.0 | instruct | Taco | Taco_40697_I | Rohit's Palindrome Inquiry
Rohit is fascinated by palindromes. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward. He is currently exploring a list of strings and wants to determine which strings can be rearranged to form a palindrome.
Help Rohit by writin... | def can_form_palindrome(s):
"""
Determines if the string s can be rearranged to form a palindrome.
"""
from collections import Counter
count = Counter(s)
odd_count = sum(1 for v in count.values() if v % 2 != 0)
return odd_count <= 1
def rohits_palindrome_inquiry(n, strings):
"""
Det... | from solution import can_form_palindrome, rohits_palindrome_inquiry
def test_can_form_palindrome():
assert can_form_palindrome("aabb") == True
assert can_form_palindrome("abc") == False
assert can_form_palindrome("racecar") == True
assert can_form_palindrome("a") == True
assert can_form_palindrome(... | [
{
"docstring": "Determines if the string s can be rearranged to form a palindrome.",
"function_declaration": "def can_form_palindrome(s):",
"function_name": "can_form_palindrome",
"parameter_list": "(s)"
},
{
"docstring": "Determines for each string in a list of strings whether it can be rea... | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def can_form_palindrome(s):\n \"\"\"\n Checks if a string can be rearranged to form a palindrome.\n \"\"\"\n from collections import Counter\n \n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040697",
"row_id": 40697,
"seed_ids": "[10270]"
} | 0.769337 | Taco_40697 | I | [
"can_form_palindrome",
"rohits_palindrome_inquiry"
] | 2 | [
[
"rohits_palindrome_inquiry",
"can_form_palindrome"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | e8248d7fb0bb9e7966d1118d59b749e9a45ad07b | 94f1cb55946b30dc30617a25ec3222f9b97b6a0d | |||
v1.0 | instruct | Taco | Taco_40719_I | A transportation company is planning a new system to manage its fleet of trucks. Each truck is capable of carrying a certain load, and they need to optimize the fleet's efficiency in carrying goods between two locations. The company's fleet is organized into a hierarchical structure where each truck is either directly ... | def add_truck(fleet, subordinates, capacities, p, c, x):
capacities.append(x) # Add new truck capacity
fleet[p] = c # Set super truck relationship
if c in subordinates:
subordinates[c].append(p)
else:
subordinates[c] = [p]
def update_truck_capacity(capacities, p, x):
capacities[p-... | def test_manage_fleet():
N = 5
initial_loads = [10, 5, 8, 3, 7]
connections = [(1, 2), (1, 3), (2, 4), (2, 5)]
queries = [
('Q', 1), # Total load = 10 + 5 + 8 + 3 + 7 = 33
('Q', 2), # Total load = 5 + 3 + 7 = 15
('A', 6, 2, 1), # Add truck 6 with load 2 under truck 1
... | [
{
"docstring": null,
"function_declaration": "def add_truck(fleet, subordinates, capacities, p, c, x):",
"function_name": "add_truck",
"parameter_list": "(fleet, subordinates, capacities, p, c, x)"
},
{
"docstring": null,
"function_declaration": "def update_truck_capacity(capacities, p, ... | [
0,
0,
0,
0,
0,
1,
0,
0,
0,
1
] | 2 | hard | 0.2 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from collections import defaultdict, deque\n\nclass FleetManagement:\n def __init__(self, N, load_capacities, subordinates):\n self.truck_loads = [0] * (... | trial_gpt4o_5 | {
"original_instruction": "",
"prompt_id": "00040719",
"row_id": 40719,
"seed_ids": "[7607]"
} | 0.641363 | Taco_40719 | I | [
"add_truck",
"update_truck_capacity",
"query_total_capacity",
"manage_fleet"
] | 4 | [
[
"manage_fleet",
"add_truck"
],
[
"manage_fleet",
"query_total_capacity"
],
[
"manage_fleet",
"update_truck_capacity"
]
] | 3 | [] | false | [] | false | pytest | false | [] | true | f0a0c9616c419f4ef2c30011e4cdb66300944e71 | 87ee6810b8ee02558bea73452171790ed7812eca | |||
v1.0 | instruct | Taco | Taco_40792_I | Many ancient civilizations believed in unique forms of astronomy including intriguing patterns and shapes. A certain ancient Martian civilization has left behind encoded messages based on the arrangement of stars in the night sky. These codes are formed using sequences of different celestial symbols, specifically repre... | def decode_sequence(sequence):
"""
Decodes a sequence by replacing each letter with the letter 2 places ahead in the alphabet.
Wraps from 'z' back to 'a' and 'b'.
"""
result = []
for char in sequence:
new_char = chr(((ord(char) - ord('a') + 2) % 26) + ord('a'))
result.append(new_... | from solution import decode_sequence, decode_sequences
def test_decode_sequence():
assert decode_sequence("abc") == "cde"
assert decode_sequence("xyz") == "zab"
assert decode_sequence("mno") == "opq"
assert decode_sequence("a") == "c"
assert decode_sequence("z") == "b"
assert decode_sequence("z... | [
{
"docstring": "Decodes a sequence by replacing each letter with the letter 2 places ahead in the alphabet.\nWraps from 'z' back to 'a' and 'b'.",
"function_declaration": "def decode_sequence(sequence):",
"function_name": "decode_sequence",
"parameter_list": "(sequence)"
},
{
"docstring": "T... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def decode_sequence(sequence):\n \"\"\"\n Decodes a given sequence of lowercase letters by shifting each letter 2 places ahead in the alphabet.\n Wrapping... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040792",
"row_id": 40792,
"seed_ids": "[21089]"
} | 0.586244 | Taco_40792 | I | [
"decode_sequence",
"decode_sequences"
] | 2 | [
[
"decode_sequences",
"decode_sequence"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | ba1e79736b1521a5e9177b831abdcd7f676e96cf | 75160ccb846f63a7da064c0ea36c8232f32253f7 | |||
v1.0 | instruct | Taco | Taco_40801_I | A company tracks the daily sales of products in two different months and wants to compare the sales performance. Write a program that reads two sets of data representing the daily sales of each product for two different months and outputs the product ID and the absolute difference in total sales between the two months ... | def parse_sales_data(data):
sales_dict = {}
for line in data.splitlines():
if line.strip():
product_id, sales = map(int, line.split(","))
if product_id in sales_dict:
sales_dict[product_id] += sales
else:
sales_dict[product_id] = sales
... | from solution import compare_sales
def test_compare_sales():
data_month_1 = "101,300\n102,250\n103,500\n"
data_month_2 = "101,400\n102,300\n103,450\n"
expected_output = [(101, 100), (102, 50), (103, 50)]
assert compare_sales(data_month_1, data_month_2) == expected_output
def test_compare_sales_extra_p... | [
{
"docstring": null,
"function_declaration": "def parse_sales_data(data):",
"function_name": "parse_sales_data",
"parameter_list": "(data)"
},
{
"docstring": null,
"function_declaration": "def compare_sales(data_month_1, data_month_2):",
"function_name": "compare_sales",
"paramet... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def parse_sales_data(data):\n sales = {}\n for line in data.strip().split('\\n'):\n product_id, sales_amount = map(int, line.split(','))\n if p... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040801",
"row_id": 40801,
"seed_ids": "[18179]"
} | 0.547913 | Taco_40801 | I | [
"parse_sales_data",
"compare_sales"
] | 2 | [
[
"compare_sales",
"parse_sales_data"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | ee9e8b9425d886f97e3e498d9a6d9005f8fcb9a9 | 109ea7f1c59a8aea40bfbe9cb4338fa2aecd54a7 | |||
v1.0 | instruct | Taco | Taco_40803_I | A company stores its product information in a large data file. Each product is represented by a string consisting of alphanumeric characters and symbols. Your task is to verify if a given product name follows the company's naming convention rules.
Rules:
1. The product name must start with an uppercase alphabetic char... | import re
def is_valid_product_name(product_name):
"""
Verifies if the product name follows the given naming convention.
"""
pattern = r'^[A-Z][0-9]{3}[A-Za-z]{2}$'
return bool(re.match(pattern, product_name))
def validate_product_names(product_names):
"""
Validates a list of product names... | from solution import is_valid_product_name, validate_product_names
def test_is_valid_product_name():
assert is_valid_product_name("A123Bc") == True
assert is_valid_product_name("X567yz") == True
assert is_valid_product_name("2fgHJ") == False
assert is_valid_product_name("Q890de") == True
assert is_... | [
{
"docstring": "Verifies if the product name follows the given naming convention.",
"function_declaration": "def is_valid_product_name(product_name):",
"function_name": "is_valid_product_name",
"parameter_list": "(product_name)"
},
{
"docstring": "Validates a list of product names and prints... | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import re\n\ndef validate_product_name(product_name):\n \"\"\"\n Validates if the product name follows the company's naming convention rules.\n \n Rule... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040803",
"row_id": 40803,
"seed_ids": "[19365]"
} | 0.656033 | Taco_40803 | I | [
"is_valid_product_name",
"validate_product_names"
] | 2 | [
[
"validate_product_names",
"is_valid_product_name"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 6cf2cf469c41afa880e05a380fa7df9bf2455c6f | b20197fceb5f47ec90898066aa9acb4d3442e93d | |||
v1.0 | instruct | Taco | Taco_40921_I | Neha is an avid collector of antique books. She loves organizing her collection in various ways and wants to develop a program to aid her in creating different permutations of her books. Given a list of books she owns, she wants a way to rearrange them into distinct sequences where no book appears more than once in any... | from itertools import permutations
def permute_books(book_list):
"""
Returns all unique permutations of the books in lexicographical order.
"""
book_list = sorted(book_list) # Ensure the input list is sorted lexicographically
perm = permutations(book_list)
unique_permutations = list(dict.fromk... | from solution import permute_books, print_permutations
import pytest
def test_permute_books_single():
books = ["red"]
result = permute_books(books)
expected = [("red",)]
assert result == expected
def test_permute_books_two():
books = ["red", "blue"]
result = permute_books(books)
expected =... | [
{
"docstring": "Returns all unique permutations of the books in lexicographical order.",
"function_declaration": "def permute_books(book_list):",
"function_name": "permute_books",
"parameter_list": "(book_list)"
},
{
"docstring": "Print all unique permutations of the input books in lexicogra... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "from itertools import permutations\n\ndef list_permutations(books):\n \"\"\"\n Returns all unique permutations of the books in lexicographical order.\n \n... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00040921",
"row_id": 40921,
"seed_ids": "[1220]"
} | 0.654988 | Taco_40921 | I | [
"permute_books",
"print_permutations"
] | 2 | [
[
"print_permutations",
"permute_books"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 1f0953b4111b2037279c3f2afe0728389e7a2f59 | 3553c7a8e32cba174289e17679de12fa5415701b | |||
v1.0 | instruct | Taco | Taco_40952_I | You are given a directed graph with nodes labeled from $0$ to $n-1$. Each directed edge has a travel time associated with it. Your task is to determine if there is a path from the start node to the end node that passes through a specific required node $m$ and provide the total travel time of the shortest such path.
Co... | import heapq
def dijkstra(graph, start, n):
dist = [float('inf')] * n
dist[start] = 0
priority_queue = [(0, start)]
while priority_queue:
current_dist, node = heapq.heappop(priority_queue)
if current_dist > dist[node]:
continue
for neighbor, we... | def test_shortest_path_through_node():
n = 5
e = 7
s = 0
t = 4
m = 2
edges = [
(0, 1, 10),
(0, 2, 3),
(1, 2, 1),
(1, 3, 2),
(2, 3, 8),
(2, 4, 5),
(3, 4, 2)
]
assert shortest_path_through_node(n, e, s, t, m, edges) == 8
def tes... | [
{
"docstring": null,
"function_declaration": "def dijkstra(graph, start, n):",
"function_name": "dijkstra",
"parameter_list": "(graph, start, n)"
},
{
"docstring": null,
"function_declaration": "def shortest_path_through_node(n, e, s, t, m, edges):",
"function_name": "shortest_path_t... | [
0,
1,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "import heapq\n\ndef dijkstra(n, graph, start):\n distances = {node: float('inf') for node in range(n)}\n distances[start] = 0\n priority_queue = [(0, star... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00040952",
"row_id": 40952,
"seed_ids": "[15233]"
} | 0.748482 | Taco_40952 | I | [
"dijkstra",
"shortest_path_through_node",
"main"
] | 3 | [
[
"shortest_path_through_node",
"dijkstra"
]
] | 1 | [] | false | [] | false | pytest | false | [] | true | 844a18758eb30c821066e09ba4dfbfd65d25ae8d | a1b48be7ebac60f7004f8c7678961d27e55a1e65 | |||
v1.0 | instruct | Taco | Taco_41011_I | Mina is passionate about gardening and has a special flower bed she takes care of daily. Her flower bed is represented as a 2D grid of dimensions NxM (N rows and M columns), where each position contains a flower of a certain type. The flowers are identified by numbers from 1 to K. Mina’s goal is to make her flower bed ... | def max_beauty(grid, N, M):
"""
Calculate the maximum possible beauty of the flower bed after rearrangement.
"""
flower_counts = {}
for row in grid:
for flower in row:
if flower in flower_counts:
flower_counts[flower] += 1
else:
flower_... | def test_beautify_flower_beds():
input_string = "3\n3 3 3\n1 2 3\n3 2 1\n1 3 2\n4 4 4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n4 3 4 3\n5 5 5\n1 1 1 1 1\n2 2 2 2 2\n3 3 3 3 3\n4 4 4 4 4\n5 5 5 5 5"
expected_output = [3, 4, 5]
assert beautify_flower_beds(input_string) == expected_output
def test_single_type():
input... | [
{
"docstring": "Calculate the maximum possible beauty of the flower bed after rearrangement.",
"function_declaration": "def max_beauty(grid, N, M):",
"function_name": "max_beauty",
"parameter_list": "(grid, N, M)"
},
{
"docstring": null,
"function_declaration": "def parse_input(input_str... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def max_beauty(grid, N, M):\n \"\"\"\n Calculate the maximum possible beauty of the flower bed after rearrangement.\n \"\"\"\n flower_counts = {}\n ... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00041011",
"row_id": 41011,
"seed_ids": "[7291]"
} | 0.608296 | Taco_41011 | I | [
"max_beauty",
"parse_input",
"beautify_flower_beds"
] | 3 | [
[
"beautify_flower_beds",
"max_beauty"
],
[
"beautify_flower_beds",
"parse_input"
]
] | 2 | [
"parse_input"
] | false | [] | false | pytest | false | [] | true | e9f2b0e9198988d7233ee6d5ec2a1468de2b4048 | 4c8db6a5e8ce22b58981b0b2277cf0a11d1e757c | |||
v1.0 | instruct | Taco | Taco_41045_I | A company has recently implemented a new policy where they want to distribute bonus points to their employees based on their performance scores. The distribution should be fair and follow these rules:
- Each employee receives at least one bonus point.
- An employee with a higher performance score than an adjacent emplo... | def min_bonus_points(test_cases):
results = []
for scores in test_cases:
M = len(scores)
bonuses = [1] * M # Each employee gets at least 1 point initially
# First pass: adjust bonuses from left to right
for i in range(1, M):
if scores[i] > scores[i - 1]:
... | from solution import bonus_points
def test_bonus_points():
data1 = """1
3 1 2 2"""
expected1 = [4]
assert bonus_points(data1) == expected1
data2 = """1
5 1 2 2 3 4"""
expected2 = [9]
assert bonus_points(data2) == expected2
data3 = """1
4 4 3 2 1"""
expected3 = [10]... | [
{
"docstring": null,
"function_declaration": "def min_bonus_points(test_cases):",
"function_name": "min_bonus_points",
"parameter_list": "(test_cases)"
},
{
"docstring": null,
"function_declaration": "def parse_input(data):",
"function_name": "parse_input",
"parameter_list": "(da... | [
1,
1,
0
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def min_bonus_points(test_cases):\n results = []\n for performance_scores in test_cases:\n M = len(performance_scores)\n bonuses = [1] * M\n\n ... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00041045",
"row_id": 41045,
"seed_ids": "[11911]"
} | 0.706318 | Taco_41045 | I | [
"min_bonus_points",
"parse_input",
"bonus_points"
] | 3 | [
[
"bonus_points",
"min_bonus_points"
],
[
"bonus_points",
"parse_input"
]
] | 2 | [
"parse_input"
] | false | [] | false | pytest | true | [] | true | 5c6bffb56aeedde18dc7a0d0a7f5a066b47692aa | b1f42dc7d319476e2decab02e83b29d6dc894b64 | |||
v1.0 | instruct | Taco | Taco_41076_I | In a certain country, mobile numbers follow a specific format. Each mobile number consists of 10 digits, without any separators. However, due to common usage, some people often format numbers with spaces, hyphens, or even parentheses for ease of readability.
For example, the following are considered different ways of... | import re
def normalize_number(number):
"""
Normalize the mobile number by removing any non-numeric characters.
"""
return re.sub(r'\D', '', number)
def count_unique_numbers(numbers):
"""
Count the number of unique normalized mobile numbers.
"""
normalized_numbers = set(normalize_numbe... | import pytest
from solution import normalize_number, count_unique_numbers
def test_normalize_number():
assert normalize_number("123-456-7890") == "1234567890"
assert normalize_number("(123) 456 7890") == "1234567890"
assert normalize_number("123 456 7890") == "1234567890"
assert normalize_number("12345... | [
{
"docstring": "Normalize the mobile number by removing any non-numeric characters.",
"function_declaration": "def normalize_number(number):",
"function_name": "normalize_number",
"parameter_list": "(number)"
},
{
"docstring": "Count the number of unique normalized mobile numbers.",
"fun... | [
0,
1,
1
] | 2 | easy | 0.667 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def normalize_mobile_number(number):\n \"\"\"\n Normalize the mobile number by removing non-numeric characters.\n \"\"\"\n normalized = ''.join(filter(... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00041076",
"row_id": 41076,
"seed_ids": "[671]"
} | 0.566348 | Taco_41076 | I | [
"normalize_number",
"count_unique_numbers"
] | 2 | [
[
"count_unique_numbers",
"normalize_number"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 950dd4311836c25ad863abdb81afb2d5142fabe4 | f3d9f0dbf348cae3f1932857a3806fda0295a7a7 | |||
v1.0 | instruct | Taco | Taco_41093_I | Given a binary tree, you need to find the maximum value of the node levels.
The node level is defined as the horizontal distance of a node from the root. For the root node, the level is 0. For any other node, the level is equal to the parent node's level plus 1.
Your task is to determine the maximum value of the nod... | from collections import defaultdict, deque
def max_values_at_levels(n, nodes):
if n == 0:
return []
tree = defaultdict(lambda: [-1, -1])
for v, l, r in nodes:
tree[v] = [l, r]
levels = defaultdict(list)
queue = deque([(1, 0)]) # (node value, level)
while queue:
... | from solution import max_values_at_levels
def test_max_values_at_levels_basic():
n = 7
nodes = [
(1, 2, 3),
(2, 4, 5),
(3, -1, 6),
(4, -1, -1),
(5, -1, -1),
(6, 7, -1),
(7, -1, -1)
]
result = max_values_at_levels(n, nodes)
assert result == [1,... | [
{
"docstring": null,
"function_declaration": "def max_values_at_levels(n, nodes):",
"function_name": "max_values_at_levels",
"parameter_list": "(n, nodes)"
},
{
"docstring": null,
"function_declaration": "def solve():",
"function_name": "solve",
"parameter_list": "()"
}
] | [
1,
0
] | 1 | medium | 0.5 | {
"trial_gpt4o_0": null,
"trial_gpt4o_1": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared1_results_combined.jsonl",
"solution_code": "from collections import defaultdict, deque\n\ndef max_values_at_levels(n, nodes):\n if n == 0:\n return []\n \n tree = def... | trial_gpt4o_1 | {
"original_instruction": "",
"prompt_id": "00041093",
"row_id": 41093,
"seed_ids": "[23146]"
} | 0.619661 | Taco_41093 | I | [
"max_values_at_levels",
"solve"
] | 2 | [
[
"solve",
"max_values_at_levels"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 232b8f07bbe303ec0c00c4c916d5b8de9dc72e0a | 8f5a5c63c53b38c2dc093f247e5d15a5ec9a5c34 | |||
v1.0 | instruct | Taco | Taco_41148_I | Hi everyone!
Let's tackle a fun problem involving prime numbers.
A twin prime is a prime number that has a prime gap of two. In other words, a twin prime is a pair of prime numbers that differ by 2. For example, (3, 5) and (11, 13) are twin primes.
Your task is to write a function that takes an integer `n` and retu... | def is_prime(x):
"""
Helper function to check if a number x is prime.
"""
if x <= 1:
return False
if x <= 3:
return True
if x % 2 == 0 or x % 3 == 0:
return False
i = 5
while i * i <= x:
if x % i == 0 or x % (i + 2) == 0:
return False
i... | from solution import count_twin_primes
def test_small_range():
assert count_twin_primes(10) == 2 # (3, 5) and (5, 7)
def test_with_no_twin_primes():
assert count_twin_primes(3) == 0 # No twin primes in this range
def test_larger_range():
assert count_twin_primes(20) == 4 # (3, 5), (5, 7), (11, 13), an... | [
{
"docstring": "Helper function to check if a number x is prime.",
"function_declaration": "def is_prime(x):",
"function_name": "is_prime",
"parameter_list": "(x)"
},
{
"docstring": "Returns the number of twin prime pairs (p1, p2) such that both p1 and p2 are less than or equal to n.",
... | [
1,
0,
0
] | 1 | medium | 0.333 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "def is_prime(x):\n \"\"\"\n Helper function to check if a number x is prime.\n \"\"\"\n if x <= 1:\n return False\n if x <= 3:\n retur... | trial_gpt4o_0 | {
"original_instruction": "",
"prompt_id": "00041148",
"row_id": 41148,
"seed_ids": "[9951]"
} | 0.710837 | Taco_41148 | I | [
"is_prime",
"count_twin_primes"
] | 2 | [
[
"count_twin_primes",
"is_prime"
]
] | 1 | [] | false | [] | false | pytest | true | [] | true | 3014b36e910e748534e4495a1b02201e26fb68c2 | d7e31f9379ce13a95e3eef28aaa6eefd7f6aa45e | |||
v1.0 | instruct | Taco | Taco_41154_I | Alice and Bob are playing a game with a tree. A tree is an undirected graph in which any two vertices are connected by exactly one path. The tree has `n` vertices and `n-1` edges. Each edge has a weight, given by an integer array `w` of length `n-1`.
They want to know, for each pair of vertices (u, v), the weight of t... | from collections import defaultdict, deque
def build_tree(n, edges):
tree = defaultdict(list)
for u, v, w in edges:
tree[u].append((v, w))
tree[v].append((u, w))
return tree
def bfs_heaviest_edge(tree, n):
max_edge = [[0] * (n + 1) for _ in range(n + 1)]
for start in range(1, ... | def test_heaviest_edge_on_path_case_1():
n = 5
edges = [
(1, 2, 4),
(2, 3, 3),
(3, 4, 5),
(4, 5, 6)
]
queries = [(1, 5), (2, 4), (3, 5)]
assert heaviest_edge_on_path(n, edges, queries) == [6, 5, 6]
def test_heaviest_edge_on_path_case_2():
n = 4
edges = [
... | [
{
"docstring": null,
"function_declaration": "def build_tree(n, edges):",
"function_name": "build_tree",
"parameter_list": "(n, edges)"
},
{
"docstring": null,
"function_declaration": "def bfs_heaviest_edge(tree, n):",
"function_name": "bfs_heaviest_edge",
"parameter_list": "(tre... | [
1,
1,
1
] | 3 | easy | 1 | {
"trial_gpt4o_0": {
"file_source": "CodeGen_instruction_taco-i2i_100000_1739866661_sanitized_prepared0_results_combined.jsonl",
"solution_code": "class Tree:\n def __init__(self, n):\n self.graph = [[] for _ in range(n)]\n self.n = n\n\n def add_edge(self, u, v, w):\n self.graph[u-... | trial_gpt4o_2 | {
"original_instruction": "",
"prompt_id": "00041154",
"row_id": 41154,
"seed_ids": "[10632]"
} | 0.699633 | Taco_41154 | I | [
"build_tree",
"bfs_heaviest_edge",
"heaviest_edge_on_path"
] | 3 | [
[
"heaviest_edge_on_path",
"bfs_heaviest_edge"
],
[
"heaviest_edge_on_path",
"build_tree"
]
] | 2 | [] | false | [] | false | pytest | false | [] | true | 7f8723432dc7f5cd9008da16f931fb41e06ab3c4 | 34f8b44a8399f8cd3cf696b4fba70741fe53b49f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.