data_source large_stringclasses 1
value | prompt listlengths 1 1 | ability large_stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|
acecode | [
{
"role": "user",
"content": "Implement a function `get_time_in_format(format: str) -> str` that returns the current time in a specified format. The function should accept a string parameter `format`, which can either be '12' for 12-hour format or '24' for 24-hour format. If the format is invalid, the funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_time_in_format('12') != get_time_in_format('24')\", \"assert get_time_in_format('24') == get_time_in_format('24')\", \"assert get_time_in_format('12') == get_time_in_format('12')\", \"assert get_time_in_format('12') == get_time_in_format('12') or get_tim... | {
"split": "train",
"index": 73800,
"acecode_id": "evol_2120",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given two dates, start_date and end_date, write a function that returns a list of all business days (Monday to Friday) between these two dates, excluding US public holidays. You may assume that the input dates are in the format YYYY-MM-DD. The US public holidays are defined as:... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert business_days_list('2023-07-01', '2023-07-10') == ['2023-07-03', '2023-07-05', '2023-07-06', '2023-07-07', '2023-07-10']\", \"assert business_days_list('2023-01-04', '2023-01-04') == ['2023-01-04']\", \"assert business_days_list('2023-12-25', '2023-12-25') =... | {
"split": "train",
"index": 73801,
"acecode_id": "bigcode_python_fns_3024",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes software license information. The function should take a dictionary containing license details as input and return a formatted string summarizing the license information. The input dictionary will contain the fol... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_license_info({'gpl_version': '3', 'licence': 'AGPLv3', 'licence_tmpl': 'GPL'}) == 'License: AGPLv3, Version: 3, Template: GPL'\", \"assert format_license_info({'gpl_version': '2', 'licence': 'GPLv2', 'licence_tmpl': 'GPL'}) == 'License: GPLv2, Version... | {
"split": "train",
"index": 73802,
"acecode_id": "oss_10800",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two integer values representing a lower and upper range, implement a function that returns a list of all the prime numbers within that range. Additionally, for each prime number found, include its factors (excluding 1 and the number itself) in the output. The function sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert primes_in_range(10, 30) == [(11, []), (13, []), (17, []), (19, []), (23, []), (29, [])]\", \"assert primes_in_range(1, 10) == [(2, []), (3, []), (5, []), (7, [])]\", \"assert primes_in_range(20, 50) == [(23, []), (29, []), (31, []), (37, []), (41, []), (43, ... | {
"split": "train",
"index": 73803,
"acecode_id": "evol_29103",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates basic file management operations. The function should accept a list of commands and execute them accordingly. The commands will be represented as strings in the following formats: \n\n1. 'CREATE <directory_name>': Simulate ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert file_management(['CREATE dir1'], {'': []}) == []\", \"assert file_management(['CREATE dir2'], {'dir1': []}) == []\", \"assert file_management(['REMOVE dir1'], {'dir1': []}) == []\", \"assert file_management(['REMOVE dir3'], {'dir3': []}) == []\", \"assert fi... | {
"split": "train",
"index": 73804,
"acecode_id": "oss_24849",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D grid of integers representing some data points. Your task is to implement a function that identifies the coordinates of relative maximum or minimum points in the grid based on a specified window size. A relative maximum point is defined as a point that is gre... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_extrema([[1, 2, 1], [2, 3, 2], [1, 2, 1]], 'max', 1) == [(1, 1)]\", \"assert find_extrema([[1, 2, 1], [2, 3, 2], [1, 2, 1]], 'min', 1) == [(0, 0), (0, 2), (2, 0), (2, 2)]\", \"assert find_extrema([[5, 1, 3], [1, 2, 1], [3, 1, 5]], 'max', 1) == [(0, 0), ... | {
"split": "train",
"index": 73805,
"acecode_id": "bigcode_python_fns_26525",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the usage rate of entrance porch lighting based on the number of residents in a household. The function will take an integer `p`, representing the number of residents, and return a float representing the usage rate of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_porch_lighting_usage_rate(0) == 0.8\", \"assert calculate_porch_lighting_usage_rate(1) == 0.78\", \"assert calculate_porch_lighting_usage_rate(2) == 0.76\", \"assert calculate_porch_lighting_usage_rate(3) == 0.74\", \"assert calculate_porch_lightin... | {
"split": "train",
"index": 73806,
"acecode_id": "bigcode_python_fns_7451",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers and a target number, write a function that finds all unique pairs of indices (i, j) such that the sum of the integers at those indices equals the target number. The pairs should be returned as a list of tuples, where each tuple contains the indices of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pair_sum_to_target([1, 2, 3, 4], 8) == []\", \"assert pair_sum_to_target([-1, 1, 2, -2, 3], 0) == [(0, 1), (2, 3)]\", \"assert pair_sum_to_target([1, 2, 3], 6) == []\", \"assert pair_sum_to_target([], 5) == []\", \"assert pair_sum_to_target([1, 2, 3, 4, 5], ... | {
"split": "train",
"index": 73807,
"acecode_id": "evol_24649",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of lists, where each inner list contains space-separated non-negative integers. Your task is to implement a function `process_lines(lines)` that takes this list of lists as input and modifies each inner list according to the following rule: for each integer... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_lines([[1, 2, 3], [4, 5, 6]]) == ['t 0 1 2', 't 3 4 5']\", \"assert process_lines([[0, 0, 0], [1, 2, 3]]) == ['t -1 -1 -1', 't 0 1 2']\", \"assert process_lines([[10, 20], [30]]) == ['t 9 19', 't 29']\", \"assert process_lines([[5, 15, 25], [30, 40, ... | {
"split": "train",
"index": 73808,
"acecode_id": "oss_23467",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that creates batches from a given sequence of data and a corresponding binary mask. The function will take three parameters: a list of data, a list of binary masks, and an integer representing the batch size. Your goal is to return a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_batches([1, 2, 3, 4, 5, 6], [1, 0, 1, 0, 1, 0], 2) == [([1, 2], [1, 0]), ([3, 4], [1, 0]), ([5, 6], [1, 0])]\", \"assert create_batches([1, 2, 3], [1, 0, 1], 2) == [([1, 2], [1, 0])]\", \"assert create_batches([1, 2, 3, 4, 5], [1, 0, 1, 0, 1], 3) == [... | {
"split": "train",
"index": 73809,
"acecode_id": "oss_30849",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a list of integers and returns the mode values along with their frequencies. The mode of a set of data values is the value that appears most frequently in the list. If there are multiple values that appear with t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_modes([1, 1, 2, 3, 3]) == [(1, 2), (3, 2)]\", \"assert find_modes([5, 5, 5, 1, 1]) == [(5, 3)]\", \"assert find_modes([0, 0, 1, 1, 2, 2, 2]) == [(2, 3)]\", \"assert find_modes([3, 3, 3]) == [(3, 3)]\", \"assert find_modes([1, 2, 2, 3, 3]) == [(2, 2), (3... | {
"split": "train",
"index": 73810,
"acecode_id": "oss_27079",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simplified version of a chain buffer data structure. A chain buffer allows for the sequential writing of data blocks, and once the writing is complete, the buffer is closed for further writing. Your task is to implement a function `chain_buffe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert chain_buffer_operations([('write', 'data1'), ('write', 'data2'), ('close', None)]) == [None, None, None]\", \"assert chain_buffer_operations([('write', 'data1'), ('close', None), ('write', 'data2')]) == [None, None, 'Buffer is closed']\", \"assert chain_buff... | {
"split": "train",
"index": 73811,
"acecode_id": "oss_8160",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of lock states represented as strings, where each string can either be 'locked' or 'unlocked'. Your task is to create a function `refresh_lock_states` that takes the list of lock states and returns a new list where each state is replaced with the string 're... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert refresh_lock_states(['locked', 'unlocked', 'locked']) == ['refreshing', 'unlocked', 'refreshing']\", \"assert refresh_lock_states(['unlocked', 'unlocked']) == ['unlocked', 'unlocked']\", \"assert refresh_lock_states(['locked', 'locked']) == ['refreshing', 'r... | {
"split": "train",
"index": 73812,
"acecode_id": "bigcode_python_fns_6027",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the prices of items in an online store. Your task is to implement a function that returns the maximum profit you can achieve by buying and selling one item. You can only make one purchase and one sale. If no profit can be made, retu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_profit([7, 1, 5, 3, 6, 4]) == 5\", \"assert max_profit([7, 6, 4, 3, 1]) == 0\", \"assert max_profit([1, 2, 3, 4, 5]) == 4\", \"assert max_profit([5, 4, 3, 2, 1]) == 0\", \"assert max_profit([3, 2, 6, 5, 0, 0]) == 4\", \"assert max_profit([1]) == 0\", \"a... | {
"split": "train",
"index": 73813,
"acecode_id": "bigcode_python_fns_43645",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a new class representing a time travel model for a given base model. The base model is represented as a dictionary with the following properties: 'db_table' (a string), 'app_label' (a string), and 'fields' (a dictionary of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_timetravel_model({'db_table': 'user', 'app_label': 'auth', 'fields': {'id': 'IntegerField', 'username': 'CharField'}}) == {'Meta': {'app_label': 'auth', 'db_table': 'tt_user', 'index_together': ['id', 'username']}, '_tt_is_timetravel_model': True, 'id... | {
"split": "train",
"index": 73814,
"acecode_id": "bigcode_python_fns_18008",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Anna and Ben are jogging on a circular track, where Anna completes a lap in 60 minutes and Ben takes 80 minutes. Write a function `find_next_meeting_time(a: int, b: int) -> int` that returns the time in minutes when both Anna and Ben will meet again at the starting point after ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_next_meeting_time(60, 80) == 240\", \"assert find_next_meeting_time(30, 45) == 90\", \"assert find_next_meeting_time(100, 200) == 200\", \"assert find_next_meeting_time(15, 25) == 75\", \"assert find_next_meeting_time(120, 150) == 600\", \"assert find_n... | {
"split": "train",
"index": 73815,
"acecode_id": "evol_16681",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D list of integers representing a grayscale image. Your task is to implement a function that applies a simple image processing pipeline which consists of: overscan correction, trimming, gain correction, and bias subtraction. The function should return the proce... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_image([[100, 150], [200, 250]], 10, None, None, None, None) == [[90, 140], [190, 240]]\", \"assert process_image([[100, 150], [200, 250]], None, None, None, 1.0, 10) == [[90, 140], [190, 240]]\", \"assert process_image([[100]], None, None, None, 1.0,... | {
"split": "train",
"index": 73816,
"acecode_id": "bigcode_python_fns_15498",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that issues a deprecation warning when an old import statement is used. The function should take a string representing the old import statement. If the old import statement matches 'import evidently.profile_sections', the function should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_deprecation('import evidently.profile_sections') == \\\"Warning: 'import evidently.profile_sections' is deprecated, use 'import evidently.model_profile.sections' instead.\\\"\", \"assert check_deprecation('import evidently.model_profile.sections') == '... | {
"split": "train",
"index": 73817,
"acecode_id": "oss_10855",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `generate_table(input_array)` that takes a multi-dimensional array of integers and returns a formatted string representation of an HTML table. The function should handle jagged arrays and varying row sizes gracefully. The function should also allow for sort... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_table([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == '<table><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr><tr><td>7</td><td>8</td><td>9</td></tr></table>'\", \"assert generate_table([[3, 1, 2], [6, 4, 5], [9, 8, 7]]) == '<tab... | {
"split": "train",
"index": 73818,
"acecode_id": "evol_22288",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with updating an internal list with the contents from a provided list. Write a function `update_internal_list(list_name: str, new_items: List[str]) -> List[str]` that takes in a list name and a list of new items. It should merge the new items into the internal li... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_internal_list('fruits', ['apple', 'banana', 'orange']) == ['apple', 'banana', 'orange']\", \"assert update_internal_list('vegetables', ['carrot', 'potato']) == ['carrot', 'potato']\", \"assert update_internal_list('fruits', ['banana', 'apple', 'grape'... | {
"split": "train",
"index": 73819,
"acecode_id": "bigcode_python_fns_40741",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given an integer `n`. Your task is to write a function `perform_operations(n)` that returns the value of `i` after performing a series of operations based on the value of `n`. The operations are as follows: - If `n` is even, increment `i` by 2 for every pair of numbers ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert perform_operations(5) == -5\", \"assert perform_operations(4) == 4\", \"assert perform_operations(0) == 0\", \"assert perform_operations(1) == -1\", \"assert perform_operations(2) == 2\", \"assert perform_operations(3) == -3\", \"assert perform_operations(6)... | {
"split": "train",
"index": 73820,
"acecode_id": "oss_26247",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 1D array of integers representing stimulus intensity at each time point, and an integer d representing the number of time lags, write a function `make_design_matrix(stim: List[int], d: int) -> List[List[int]]` that generates a 2D design matrix. The design matrix should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_design_matrix([0, 0, 0], 4) == [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]\", \"assert make_design_matrix([1], 1) == [[1]]\", \"assert make_design_matrix([2, 1], 1) == [[2], [1]]\", \"assert make_design_matrix([], 3) == []\", \"assert make_design_matrix(... | {
"split": "train",
"index": 73821,
"acecode_id": "bigcode_python_fns_2020",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates a project input dictionary. The function should take a single parameter, `proj_data`, which is a dictionary containing the following keys: 'title', 'pi', and 'description'. Your function should check if the 'pi' (Principal ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_project_input({'title': 'Project 1', 'pi': 'Dr. Smith', 'description': 'A description'}) == True\", \"assert validate_project_input({'title': 'Project 2', 'pi': '', 'description': 'Another description'}) == False\", \"assert validate_project_input({... | {
"split": "train",
"index": 73822,
"acecode_id": "bigcode_python_fns_1229",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `make_xml` that creates an XML document with a single element named `foo`. This element should contain the text `bar`. The function should return the XML document object. You may use the `xml.dom.minidom` module for XML manipulation. The expected output of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_xml().documentElement.tagName == 'foo'\", \"assert make_xml().documentElement.firstChild.nodeValue == 'bar'\", \"assert make_xml().documentElement.childNodes.length == 1\", \"assert make_xml().documentElement.childNodes[0].nodeType == 3\", \"assert make... | {
"split": "train",
"index": 73823,
"acecode_id": "evol_25220",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that checks if a given integer is negative. If the integer is negative, the function should return the string 'negativo'. If the integer is zero or positive, the function should return an empty string. Your task is to complete ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_negative(-5) == 'negativo'\", \"assert check_negative(0) == ''\", \"assert check_negative(10) == ''\", \"assert check_negative(-1) == 'negativo'\", \"assert check_negative(-100) == 'negativo'\", \"assert check_negative(1) == ''\", \"assert check_negati... | {
"split": "train",
"index": 73824,
"acecode_id": "oss_29945",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `count_upper_vowels(s: str) -> int` that calculates the number of uppercase vowels ('A', 'E', 'I', 'O', 'U') present at even index positions in the input string `s`. The function should iterate through the string and check each character at even indices to ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_upper_vowels('aBCdEf') == 1\", \"assert count_upper_vowels('abcdefg') == 0\", \"assert count_upper_vowels('dBBE') == 0\", \"assert count_upper_vowels('AEIOU') == 3\", \"assert count_upper_vowels('AEIOUaeiou') == 3\", \"assert count_upper_vowels('BEE') ... | {
"split": "train",
"index": 73825,
"acecode_id": "evol_6616",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that checks if a given string is a valid email address. A valid email address must follow these rules: it must contain exactly one '@' symbol, the '@' symbol must not be the first or last character, and there must be at least one character... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_email('test@example.com') == True\", \"assert is_valid_email('user.name+tag+sorting@example.com') == True\", \"assert is_valid_email('user@domain.com') == True\", \"assert is_valid_email('user@sub.domain.com') == True\", \"assert is_valid_email('use... | {
"split": "train",
"index": 73826,
"acecode_id": "bigcode_python_fns_14863",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given three sets, `set_a`, `set_b`, and `set_c`, each containing integer elements, write a Python function that performs the following operations: 1. Find the intersection of `set_a` with `set_b` and `set_c`, and return the resulting set. 2. Find the elements in `set_a` that ar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_operations({5}, {5}, {5}) == ({5}, set())\", \"assert set_operations(set(), {1, 2}, {3}) == (set(), set())\", \"assert set_operations({1, 2, 3}, {4, 5}, {6, 7}) == (set(), {1, 2, 3})\", \"assert set_operations({1, 2, 3, 4}, {1, 2, 3}, {4}) == (set(), {4}... | {
"split": "train",
"index": 73827,
"acecode_id": "oss_5624",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a list of devices, where each device is represented as a dictionary containing at least a 'self_id' key. Your task is to implement a function `device_sort(device_list)` that sorts the devices based on their 'self_id' in ascending order. The function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert device_sort([{'self_id': 3}, {'self_id': 1}, {'self_id': 2}]) == [{'self_id': 1}, {'self_id': 2}, {'self_id': 3}]\", \"assert device_sort([{'self_id': 10}, {'self_id': 5}, {'self_id': 7}, {'self_id': 1}]) == [{'self_id': 1}, {'self_id': 5}, {'self_id': 7}, {... | {
"split": "train",
"index": 73828,
"acecode_id": "bigcode_python_fns_18898",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `simulate_queue(operations: List[Tuple[str, str]]) -> List[Union[str, None]]` that simulates a first-in, first-out (FIFO) queue based on a list of operations. Each operation is a tuple where the first element is a string indicating the operation type ('enqu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_queue([('enqueue', 'Apple'), ('enqueue', 'Banana'), ('enqueue', 'Cherry'), ('dequeue', ''), ('dequeue', ''), ('dequeue', ''), ('dequeue', '')]) == ['Apple', 'Banana', 'Cherry', None]\", \"assert simulate_queue([('enqueue', 'A'), ('dequeue', ''), ('e... | {
"split": "train",
"index": 73829,
"acecode_id": "evol_3097",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that extracts the repository name from a given Git remote URL. The function should take a Git remote URL as input and return the repository name in the format 'username/repo'. If the Git remote URL is not in the correct format or c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_repository_name('https://github.com/user/repo.git') == 'user/repo'\", \"assert extract_repository_name('git@github.com:user/repo.git') == 'user/repo'\", \"assert extract_repository_name('https://github.com/another_user/another_repo.git') == 'another_... | {
"split": "train",
"index": 73830,
"acecode_id": "oss_30506",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of a series of buildings. Your task is to implement a function that calculates the number of buildings that can be seen from the left side. A building can be seen if it is taller than all the buildings to its left. Write... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert countVisibleBuildings([1, 2, 3, 4, 5]) == 5\", \"assert countVisibleBuildings([5, 4, 3, 2, 1]) == 1\", \"assert countVisibleBuildings([1, 3, 2, 4, 5]) == 4\", \"assert countVisibleBuildings([7, 1, 2, 3, 4]) == 1\", \"assert countVisibleBuildings([1, 1, 1, 1,... | {
"split": "train",
"index": 73831,
"acecode_id": "bigcode_python_fns_9733",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a grid world represented by a dictionary where keys are identifiers of agents and objects, and values are their properties including their locations. Each agent can attempt to grab an object within a specified range. Implement a function `is_possible_grab(grid_wor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_possible_grab({'agent1': {'location': (1, 1), 'is_carrying': []}, 'object1': {'location': (1, 2), 'is_movable': True}}, 'agent1', 'object1', 1, 1) == ('RESULT_SUCCESS', True)\", \"assert is_possible_grab({'agent1': {'location': (1, 1), 'is_carrying': []},... | {
"split": "train",
"index": 73832,
"acecode_id": "bigcode_python_fns_45940",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns a new list containing the squares of the integers in the original list, but in reverse order. The function should handle both positive and negative integers correctly. Write a function called `reverse_and_square` that ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_and_square([1, -2, 3, -4, 5]) == [25, 16, 9, 4, 1]\", \"assert reverse_and_square([-1, -2, -3]) == [9, 4, 1]\", \"assert reverse_and_square([0, 0, 0]) == [0, 0, 0]\", \"assert reverse_and_square([1]) == [1]\", \"assert reverse_and_square([-5]) == [25... | {
"split": "train",
"index": 73833,
"acecode_id": "evol_17553",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with normalizing the inventory data for a warehouse based on a list of products. Each product has a specific volume and a list of inventory values corresponding to different days. Your goal is to implement a function that takes in two parameters: a list of dictio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert normalize_inventory([{'VOLUME': 20, 'INVENTORY_DAYS': [1, 2, 3], 'inventory': [10, 10, 10]}], 'inventory') == {'WH_INVENTORY_VOLUME': 20, 'WH_INVENTORY_NORMALISED': [0.0, 0.0, 0.0]}\", \"assert normalize_inventory([], 'inventory') == {'WH_INVENTORY_VOLUME': ... | {
"split": "train",
"index": 73834,
"acecode_id": "bigcode_python_fns_28291",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a list of bids represented as dictionaries, where each dictionary contains the details of a bid including 'participant_label' and 'amount'. Your task is to implement a function `filter_bids(bids: List[Dict[str, Union[str, int]]], min_amount: int) -> List[Dict[str,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_bids([{'participant_label': '1', 'amount': 100}, {'participant_label': '2', 'amount': 200}], 150) == [{'participant_label': '2', 'amount': 200}]\", \"assert filter_bids([{'participant_label': '1', 'amount': 50}, {'participant_label': '2', 'amount': 75... | {
"split": "train",
"index": 73835,
"acecode_id": "bigcode_python_fns_27116",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that modifies a given configuration represented as a dictionary. The configuration contains key-value pairs representing various settings. Your function should be able to update existing settings, add new ones, or remove specified setting... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert modify_configuration({'setting1': 'value1', 'setting2': 'value2'}, {'setting3': 'value3'}, []) == {'setting1': 'value1', 'setting2': 'value2', 'setting3': 'value3'}\", \"assert modify_configuration({'setting1': 'value1'}, {'setting1': 'new_value1'}, []) == {... | {
"split": "train",
"index": 73836,
"acecode_id": "oss_3258",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the mean of a given list of numbers. The function should also handle scenarios where the list is empty, returning the message 'The list is empty.'\nPlease reason step by step, then write a self-contained Python solution. Give your final program ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert mean_of_list([1, 4, 5, 9, 3]) == 4.4\", \"assert mean_of_list([10, 20, 30]) == 20.0\", \"assert mean_of_list([-5, -15, -10]) == -10.0\", \"assert mean_of_list([0]) == 0.0\", \"assert mean_of_list([]) == 'The list is empty.'\", \"assert mean_of_list([2, 4, 6]... | {
"split": "train",
"index": 73837,
"acecode_id": "evol_18302",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `get_primes_in_range(start: int, end: int) -> List[int]` that returns a list of all prime numbers in the inclusive range from `start` to `end`. The function should return an empty list if there are no prime numbers in the specified range.\nPlease reason step by... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_primes_in_range(3, 20) == [3, 5, 7, 11, 13, 17, 19]\", \"assert get_primes_in_range(10, 30) == [11, 13, 17, 19, 23, 29]\", \"assert get_primes_in_range(1, 1) == []\", \"assert get_primes_in_range(0, 5) == [2, 3, 5]\", \"assert get_primes_in_range(15, 15)... | {
"split": "train",
"index": 73838,
"acecode_id": "evol_27427",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `advanced_sort` that accepts a list `l`, two integers `n` and `m`, and a sorting order `s` ('asc' or 'desc'). The function should return a new list `l'` where elements at indices not divisible by `n` remain the same as in `l`, while elements at indices divi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert advanced_sort([10, 20, 30, 40], 1, 'asc', 2) == [20, 40, 60, 80]\", \"assert advanced_sort([10, 9, 8, 7, 6], 2, 'desc', 1) == [10, 9, 8, 7, 6]\", \"assert advanced_sort([], 1, 'asc', 2) == []\", \"assert advanced_sort([1], 1, 'asc', 1) == [1]\", \"assert adv... | {
"split": "train",
"index": 73839,
"acecode_id": "evol_22315",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a function that takes in a dictionary `keys_accumulator` and a string `property_name`, along with a float `value`. The dictionary `keys_accumulator` contains properties as keys and their corresponding float values. Your task is to complete the function `update_acc... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_accumulator({'a': 0.5, 'b': 0.5}, 'a', 0.1) == False\", \"assert update_accumulator({'key1': 0.2, 'key2': 0.3}, 'key3', 0.1) == False\", \"assert update_accumulator({'p': 0.4, 'q': 0.6}, 'p', 0.1) == False\", \"assert update_accumulator({'m': 0.7, 'n'... | {
"split": "train",
"index": 73840,
"acecode_id": "oss_16877",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves a list of available versions of a dataset. The function should return a list of strings representing the available versions based on the input parameter. If the input parameter version is 'current', return all available ver... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_available_versions('current') == ['20200925', '20200927', '20200929', '20201001', '20201012', '20201101', '20201202', '20210101', '20210128', '20210201', '20210218', '20210301', '20210412', '20210725', '20210726', '20210727', '20210823', '20210902', '202... | {
"split": "train",
"index": 73841,
"acecode_id": "bigcode_python_fns_44114",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of command line arguments as strings. Your task is to implement a function `parse_arguments(args: List[str]) -> Dict[str, Union[bool, str]]` that parses these arguments and returns a dictionary with the following structure: \n- If the argument is '--verbos... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_arguments(['--verbose', 'test.jls']) == {'verbose': True, 'filename': 'test.jls'}\", \"assert parse_arguments(['-v', 'example.jls']) == {'verbose': True, 'filename': 'example.jls'}\", \"assert parse_arguments(['-v', '--verbose', 'file.txt']) == {'verbo... | {
"split": "train",
"index": 73842,
"acecode_id": "bigcode_python_fns_2781",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of normalized numeric values that range from 0 to 1, and you need to scale this data series to a new range defined by two numeric values, new_min and new_max. Implement a function named `scale_data(data: List[float], new_min: float, new_max: float) -> List[... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert scale_data([0.0, 0.5, 1.0], 10, 20) == [10.0, 15.0, 20.0]\", \"assert scale_data([0.0, 0.25, 0.5, 0.75, 1.0], 100, 200) == [100.0, 125.0, 150.0, 175.0, 200.0]\", \"assert scale_data([], 0, 10) == []\", \"assert scale_data([0.1, 0.2, 0.3], 0, 1) == [0.1, 0.2,... | {
"split": "train",
"index": 73843,
"acecode_id": "bigcode_python_fns_14171",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a Python class `Person` that represents an individual with a first name, last name, and email, implement a function `generate_xml(person: Person) -> str` that takes an instance of the `Person` class and returns a string representing the XML response of the person's detail... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_xml(Person('John', 'Smith', 'john.smith@example.com')) == '<person><first_name>John</first_name><last_name>Smith</last_name><email>john.smith@example.com</email></person>'\", \"assert generate_xml(Person('Alice', 'Johnson', 'alice.johnson@example.co... | {
"split": "train",
"index": 73844,
"acecode_id": "evol_9447",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns a list of their squares arranged in descending order.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block."
}
] | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert descending_squares([3, 2, 4, 6, 1, 2, 9]) == [81, 36, 16, 9, 4, 4, 1]\", \"assert descending_squares([-3, -1, 0, 2]) == [9, 4, 1, 0]\", \"assert descending_squares([0]) == [0]\", \"assert descending_squares([]) == []\", \"assert descending_squares([1, 2, 3])... | {
"split": "train",
"index": 73845,
"acecode_id": "evol_35168",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `synchronize_publications` that simulates the synchronization of publications. The function takes the following parameters: `publications`, a list of tuples where each tuple contains a publication's ID and a boolean indicating whether it ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert synchronize_publications([(1, False), (2, True), (3, False), (4, True)], only_bad=True) == [1, 3]\", \"assert synchronize_publications([(1, False), (2, True), (3, False), (4, True)], only_new=True) == [1, 3]\", \"assert synchronize_publications([(1, False), ... | {
"split": "train",
"index": 73846,
"acecode_id": "bigcode_python_fns_40630",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representation of a JSON object. Your task is to parse this string and return the corresponding Python dictionary. Implement a function `parse_json(json_string: str) -> dict` that takes a single argument, `json_string`, which is a valid JSON string and re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_json('{\\\"name\\\": \\\"Alice\\\", \\\"age\\\": 30}') == {'name': 'Alice', 'age': 30}\", \"assert parse_json('{\\\"city\\\": \\\"New York\\\", \\\"population\\\": 8419600}') == {'city': 'New York', 'population': 8419600}\", \"assert parse_json('{\\\"i... | {
"split": "train",
"index": 73847,
"acecode_id": "bigcode_python_fns_22699",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two probability distributions P and Q represented as lists of floats, write a function `KLdist(P: List[float], Q: List[float]) -> float` that calculates the Kullback-Leibler distance (information divergence) between the two distributions. The function should only consider... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert KLdist([0.5, 0.5], [0.5, 0.5]) == 0.0\", \"assert KLdist([0.0, 1.0], [0.0, 1.0]) == 0.0\", \"assert KLdist([0.1, 0.9], [0.1, 0.9]) == 0.0\", \"assert KLdist([1.0], [1.0]) == 0.0\", \"assert KLdist([0.1, 0.2, 0.7], [0.1, 0.2, 0.7]) == 0.0\", \"assert KLdist([... | {
"split": "train",
"index": 73848,
"acecode_id": "bigcode_python_fns_38742",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given an integer representing the number of people in a group and a list of floats representing the distances traveled by each person. Your task is to write a function `calculate_average_distance(num_people: int, distances: List[float]) -> float` that calculates the ave... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_distance(3, [10.0, 15.0, 20.0]) == 15.0\", \"assert calculate_average_distance(1, [5.5]) == 5.5\", \"assert calculate_average_distance(2, [2.0, 3.0]) == 2.5\", \"assert calculate_average_distance(4, [1.0, 2.0, 3.0, 4.0]) == 2.5\", \"assert ... | {
"split": "train",
"index": 73849,
"acecode_id": "oss_21617",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings, where each string consists of words separated by spaces. Your task is to write a function that takes this list as input and returns a new list containing the count of words in each string. For example, given the input list ['Hello world', 'This ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_words_in_elements(['Hello world', 'This is a test', 'Programming problems are fun']) == [2, 4, 4]\", \"assert count_words_in_elements(['One', 'Two Three', 'Four Five Six Seven']) == [1, 2, 4]\", \"assert count_words_in_elements(['']) == [0]\", \"assert... | {
"split": "train",
"index": 73850,
"acecode_id": "oss_33372",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages a multilingual dictionary. The dictionary will store translations of words in various languages. Your task is to implement a function `manage_dictionary(operations)` that takes a list of operations to perform on the dictionar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_dictionary([['add', 'hello', 'German', 'hallo'], ['get', 'hello', 'German']]) == ['hallo']\", \"assert manage_dictionary([['add', 'hello', 'German', 'hallo'], ['get', 'hello', 'Hindi']]) == ['Translation not found']\", \"assert manage_dictionary([['ad... | {
"split": "train",
"index": 73851,
"acecode_id": "oss_3149",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a sequence of fixtures, represented as a list of strings. Each fixture can be a name of a resource that needs to be used in a testing environment. Your task is to write a function that takes this list of fixtures and returns a new list containing only the unique f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_unique_fixtures(['fixtureA', 'fixtureB', 'fixtureA']) == ['fixtureA', 'fixtureB']\", \"assert get_unique_fixtures(['fixtureC', 'fixtureC', 'fixtureC']) == ['fixtureC']\", \"assert get_unique_fixtures(['fixtureX', 'fixtureY', 'fixtureZ', 'fixtureX']) == [... | {
"split": "train",
"index": 73852,
"acecode_id": "bigcode_python_fns_44417",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of payment amounts and returns the total sum of those amounts. Your function should be named `calculate_total_payments` and should accept a list of floats representing the payment amounts. The function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_total_payments([10.0, 20.0, 30.0]) == 60.0\", \"assert calculate_total_payments([0.0, 0.0, 0.0]) == 0.0\", \"assert calculate_total_payments([]) == 0.0\", \"assert calculate_total_payments([5.5, 10.5]) == 16.0\", \"assert calculate_total_payments([... | {
"split": "train",
"index": 73853,
"acecode_id": "oss_18198",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a single string input representing an action, which can be either 'all', 'name', or 'number'. Your function should return a message based on the action specified: if the action is 'all', return 'Displaying all live ebuilds'; if... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert perform_action('all') == 'Displaying all live ebuilds'\", \"assert perform_action('name') == 'Displaying live ebuilds by name'\", \"assert perform_action('number') == 'Displaying live ebuilds by number'\", \"assert perform_action('invalid') == 'Invalid actio... | {
"split": "train",
"index": 73854,
"acecode_id": "bigcode_python_fns_23390",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function called `create_nim_board` that takes an integer `n` as input and creates a multi-stacked Nim game board represented as a list of lists. The board should consist of `n` stacks, where each stack is a list of integers representing stones. The number of stones in e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_nim_board(1) == [[1]]\", \"assert len(create_nim_board(3)) == 3\", \"assert all(1 <= stone <= 3 for stack in create_nim_board(3) for stone in stack)\", \"assert len(create_nim_board(4)) == 4\", \"assert all(len(stack) >= 1 and len(stack) <= 4 for stac... | {
"split": "train",
"index": 73855,
"acecode_id": "evol_31357",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function that checks if a given string matches a specific pattern. The pattern requires that the string starts with a lowercase alphabetical character from 'a' to 'm', and ends with an uppercase alphabetical character from 'N' to 'Z'. The string can include any sequ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_string('xY@N') == False\", \"assert check_string('z1!N') == False\", \"assert check_string('aA@N') == False\", \"assert check_string('n@M') == False\", \"assert check_string('hN') == True\", \"assert check_string('n$Z') == False\"]}"
} | {
"split": "train",
"index": 73856,
"acecode_id": "evol_18163",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a dictionary where the keys are words and the values are their corresponding counts, write a function `format_word_count` that takes this dictionary as input and returns a list of strings. Each string should represent a key-value pair in the format 'word\\tcount'. The key... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_word_count({'apple': 3, 'banana': 5, 'cherry': 2}) == ['apple\\\\t3', 'banana\\\\t5', 'cherry\\\\t2']\", \"assert format_word_count({'dog': 1, 'cat': 2}) == ['dog\\\\t1', 'cat\\\\t2']\", \"assert format_word_count({'one': 1}) == ['one\\\\t1']\", \"ass... | {
"split": "train",
"index": 73857,
"acecode_id": "oss_22433",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function named `enforce_max_length` that takes two parameters: `arg` (a string to be validated) and `max_length` (an integer representing the maximum allowed length for the string). Your function should check if the length of the `arg` exceeds... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert enforce_max_length('hello', 10) == 'hello'\", \"assert enforce_max_length('test', 4) == 'test'\", \"assert enforce_max_length('', 5) == ''\", \"assert enforce_max_length('abc', 3) == 'abc'\", \"assert enforce_max_length('12345', 5) == '12345'\", \"assert enf... | {
"split": "train",
"index": 73858,
"acecode_id": "oss_2256",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Write a python function called `greet_person` that takes a single parameter `name`. The function should print a greeting message in the format 'Hello, {name}'. However, if the `name` is not a string, the function should raise a ValueError with the message 'Please enter a valid ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert greet_person('Jane') == 'Hello, Jane'\", \"assert greet_person('Alice') == 'Hello, Alice'\", \"assert greet_person('John Doe') == 'Hello, John Doe'\", \"assert greet_person('') == 'Hello, '\", \"assert greet_person(' ') == 'Hello, '\", \"assert greet_person... | {
"split": "train",
"index": 73859,
"acecode_id": "evol_16329",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of bounding boxes and a minimum Intersection over Union (IoU) threshold. Your task is to implement a function that matches the predicted bounding boxes to the ground truth bounding boxes based on the IoU values. The function should return a dictionary wh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert match_bboxes([[[0,0,2,2]], [[3,3,4,4]]], [[[1,1,2,2]], [[2,2,3,3]]], 0.1) == {0: [(0, 0)], 1: []}\", \"assert match_bboxes([[[0,0,1,1]]], [[[2,2,3,3]]], 0.5) == {0: []}\", \"assert match_bboxes([[[0,0,1,1]], [[2,2,3,3]]], [[[0,0,1,1]], [[1,1,2,2]]], 0.2) == ... | {
"split": "train",
"index": 73860,
"acecode_id": "bigcode_python_fns_185",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given an array of positive decimal numbers and a target sum, implement a function that finds a pair of numbers in the array that adds up to the target sum. If such a pair exists, return a tuple containing the two numbers. If no such pair exists, return None.\nPlease reason step... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_pair([1, 2, 3, 4, 5], 4) == (1, 3)\", \"assert find_pair([1, 2, 3, 4, 5], 10) == None\", \"assert find_pair([10, 15, 3, 7], 17) == (10, 7)\", \"assert find_pair([1, 2, 2, 3, 4], 4) == (2, 2)\", \"assert find_pair([1, 5, 3, 9, 2], 8) == (5, 3)\", \"asser... | {
"split": "train",
"index": 73861,
"acecode_id": "evol_20079",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a dictionary, implement a function `check_dict_case(dictionary)` that checks if all keys in the dictionary are either all lower case or all upper case. The function should return False for empty dictionaries. If the keys contain a mix of cases, the function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_dict_case({}) == False\", \"assert check_dict_case({'A': 1, 'B': 2}) == True\", \"assert check_dict_case({'a': 1, 'b': 2}) == True\", \"assert check_dict_case({'a': 1, 'B': 2}) == False\", \"assert check_dict_case({'A': 1, 'b': 2}) == False\", \"assert... | {
"split": "train",
"index": 73862,
"acecode_id": "evol_9997",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a `m * n` matrix `seats` which symbolizes the seating arrangement in a classroom. A seat is represented by a `'.'` character if it is in good condition, and by a `'#'` character if it is broken. Students can see the answers of their peers sitting to their left, ri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_students([['.', '#'], ['#', '#'], ['#', '.'], ['#', '#'], ['.', '#']]) == 3\", \"assert max_students([['.', '.', '.', '.'], ['.', '.', '.', '.'], ['.', '.', '.', '.'], ['.', '.', '.', '.']]) == 8\", \"assert max_students([['#', '#', '#', '#'], ['#', '#',... | {
"split": "train",
"index": 73863,
"acecode_id": "evol_1633",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates a subfeed URI for a social media feed. The function should take two parameters: a string representing the main feed URI and a string representing the unique identifier for the subfeed. The output should be a string form... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_subfeed_uri('https://example.com/main_feed', '12345') == 'https://example.com/main_feed/12345'\", \"assert get_subfeed_uri('https://myfeed.com/main', 'abc') == 'https://myfeed.com/main/abc'\", \"assert get_subfeed_uri('http://socialmedia.com/feed', '1') ... | {
"split": "train",
"index": 73864,
"acecode_id": "oss_15524",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that retrieves a summary of a file based on its unique identifier (file_id). The function should take an integer file_id as input and return a string that represents the summary of the file. If the given file_id does not exist, the fu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_file_summary(1) == 'Summary of file with ID 1'\", \"assert get_file_summary(2) == 'Summary of file with ID 2'\", \"assert get_file_summary(3) == 'File not found'\", \"assert get_file_summary(5) == 'File not found'\", \"assert get_file_summary(8) == 'File... | {
"split": "train",
"index": 73865,
"acecode_id": "bigcode_python_fns_37208",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of n distinct numerical values and returns a new list with the values sorted in ascending order using the insertion sort technique. The input list will contain at least one element. For example, given the input [5, 3, 2, 4, 1], the functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insertion_sort([5, 3, 2, 4, 1]) == [1, 2, 3, 4, 5]\", \"assert insertion_sort([1]) == [1]\", \"assert insertion_sort([10, 1, 5]) == [1, 5, 10]\", \"assert insertion_sort([3, 2, 1]) == [1, 2, 3]\", \"assert insertion_sort([-1, -5, 0, 2]) == [-5, -1, 0, 2]\", ... | {
"split": "train",
"index": 73866,
"acecode_id": "evol_18118",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of characters representing consonants, write a function that determines how many of these consonants belong to a predefined list of voiced consonants. The function should take a list of single-character strings as input and return an integer representing the count ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_voiced_consonants(['b', 'c', 'd', 'e', 'g']) == 3\", \"assert count_voiced_consonants(['a', 'e', 'i', 'o', 'u']) == 0\", \"assert count_voiced_consonants(['b', 'v', 'w', 'x', 'y']) == 2\", \"assert count_voiced_consonants(['m', 'n', 'p', 'q', 'r']) == ... | {
"split": "train",
"index": 73867,
"acecode_id": "bigcode_python_fns_39271",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a linear equation represented in the form ax + by = c, write a function that calculates the value of the objective function defined as f(x, y) = ax + by - c. The coefficients a, b, and c are constants where a = 3, b = 5, and c = 7. Your function should take two parameters... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert objective_function(0, 0) == -7\", \"assert objective_function(1, 0) == -4\", \"assert objective_function(0, 1) == -2\", \"assert objective_function(3, 0) == 2\", \"assert objective_function(0, 2) == 3\", \"assert objective_function(-1, 0) == -10\", \"assert ... | {
"split": "train",
"index": 73868,
"acecode_id": "evol_18842",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of ExampleModelOne objects and returns a dictionary containing the count of non-empty text fields for each object. The ExampleModelOne class has three fields: char_field, text_field, and slug_field, all of typ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_non_empty_text_fields([ExampleModelOne('', '', ''), ExampleModelOne('', '', 'slug'), ExampleModelOne('char', '', ''), ExampleModelOne('', 'text', 'slug')]) == {1: 0, 2: 1, 3: 1, 4: 2}\", \"assert count_non_empty_text_fields([ExampleModelOne('a', 'b', '... | {
"split": "train",
"index": 73869,
"acecode_id": "oss_12306",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to calculate the mean-centered values of two audio signals. The mean-centered values are obtained by subtracting the mean of each signal from its corresponding values. Your task is to complete the implementation of the `mean_center` f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert mean_center([1.0, 2.0, 3.0], [1.5, 2.5, 3.5]) == ([-1.0, 0.0, 1.0], [-1.0, 0.0, 1.0])\", \"assert mean_center([0.0, 0.0, 0.0], [1.0, 1.0, 1.0]) == ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0])\", \"assert mean_center([1.0, 3.0, 5.0], [2.0, 3.0, 4.0]) == ([-2.0, 0.0, 2.... | {
"split": "train",
"index": 73870,
"acecode_id": "oss_4129",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the area of a rectangle given its length and width. The function should take two parameters, length (l) and width (w), both of which can be integers or floats. The function should return the area of the rectangle, which is calculated as the prod... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rectangle_area(1, 1) == 1\", \"assert rectangle_area(5, 3) == 15\", \"assert rectangle_area(0, 10) == 0\", \"assert rectangle_area(10, 0) == 0\", \"assert rectangle_area(2.5, 4.0) == 10.0\", \"assert rectangle_area(7, 3.5) == 24.5\", \"assert rectangle_area(... | {
"split": "train",
"index": 73871,
"acecode_id": "evol_11111",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of integers, `list1` and `list2`, both of the same length. Write a function that returns a new list containing the products of the corresponding elements from `list1` and `list2`. The function should take in two lists and return a new list with the same ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert multiply_lists([1, 2, 3], [4, 5, 6]) == [4, 10, 18]\", \"assert multiply_lists([0, 0, 0], [1, 2, 3]) == [0, 0, 0]\", \"assert multiply_lists([-1, -2, -3], [1, 2, 3]) == [-1, -4, -9]\", \"assert multiply_lists([1, 1, 1], [1, 1, 1]) == [1, 1, 1]\", \"assert mu... | {
"split": "train",
"index": 73872,
"acecode_id": "bigcode_python_fns_46720",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a simple tabbed interface as a string representation. The function should take two parameters: a list of tab names and a list of corresponding content for each tab. Your task is to implement the function that returns a form... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_tabbed_interface(['Tab1', 'Tab2'], ['Content for Tab1', 'Content for Tab2']) == 'Tab1:\\\\n Content for Tab1\\\\nTab2:\\\\n Content for Tab2'\", \"assert create_tabbed_interface(['Tab1'], ['Content for Tab1']) == 'Tab1:\\\\n Content for Tab1'\", \"... | {
"split": "train",
"index": 73873,
"acecode_id": "oss_4035",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two integers, `id` and `group_id`. Your task is to implement a function that revokes the permissions that a group identified by `group_id` has on a resource identified by `id`. The function should simply return a message indicating that the permissions have been r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert revoke_permissions(1, 100) == 'Permissions revoked for group 100 on resource 1'\", \"assert revoke_permissions(2, 200) == 'Permissions revoked for group 200 on resource 2'\", \"assert revoke_permissions(3, 300) == 'Permissions revoked for group 300 on resour... | {
"split": "train",
"index": 73874,
"acecode_id": "bigcode_python_fns_6897",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a list of dictionaries representing 3D bounding box instances and converts them into a list of dictionaries with specific attributes. Each dictionary contains the following keys: 'cube', 'patch_number', 'score', ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bound3ds_to_list([{'cube': 1, 'patch_number': 2, 'score': 0.8, 'label': 'A'}]) == [{'cube': 1, 'patch_number': 2, 'score': 0.8, 'label': 'A'}]\", \"assert bound3ds_to_list([{'cube': 1, 'patch_number': 2, 'score': 0.8, 'label': 'A'}, {'cube': 3, 'patch_number... | {
"split": "train",
"index": 73875,
"acecode_id": "oss_27558",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that takes in a list of three distinct humidity percentages, represented as integers, and returns the median value of these percentages. The median is defined as the value that separates the higher half from the lower half of the data set.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_median([30, 20, 10]) == 20\", \"assert find_median([45, 55, 50]) == 50\", \"assert find_median([90, 80, 70]) == 80\", \"assert find_median([10, 30, 20]) == 20\", \"assert find_median([100, 0, 50]) == 50\", \"assert find_median([25, 15, 35]) == 25\", \"a... | {
"split": "train",
"index": 73876,
"acecode_id": "evol_7327",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that splits the list into two parts based on a specified fraction. The first part should contain the specified fraction of the elements from the beginning of the list, while the second part should contain the remainder of the elements.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert split_list([1, 2, 3, 4, 5], 0.25) == ([1], [2, 3, 4, 5])\", \"assert split_list([10, 20, 30, 40], 0.5) == ([10, 20], [30, 40])\", \"assert split_list([5, 10, 15, 20, 25], 0.0) == ([], [5, 10, 15, 20, 25])\", \"assert split_list([1], 1.0) == ([1], [])\", \"as... | {
"split": "train",
"index": 73877,
"acecode_id": "bigcode_python_fns_33194",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing scores of different models evaluated on a validation set. Your task is to implement a function that takes this list of scores and returns the loss (average of scores) and the F1 score (harmonic mean of precision and recall) for the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_models([4, 5, 6], [2, 2, 2], [1, 1, 1], [0, 0, 0]) == (5.0, 0.8)\", \"assert evaluate_models([0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]) == (0.0, 0.0)\", \"assert evaluate_models([1, 1, 1], [0, 0, 0], [1, 1, 1], [1, 1, 1]) == (1.0, 0.0)\", \"assert ... | {
"split": "train",
"index": 73878,
"acecode_id": "bigcode_python_fns_11454",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D integer array named `classes`, where `classes[i] = [passi, totali]` indicates that in the `ith` class, `totali` is the total number of students and `passi` is the number of students who will pass the exam. You also have an integer `extraStudents`, which repre... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert abs(maxAveragePassRatio([[1,2],[3,5],[2,2]], 2) - 0.78333) < 1e-5\", \"assert abs(maxAveragePassRatio([[2,4],[3,9],[4,5],[2,10]], 4) - 0.53485) < 1e-5\", \"assert abs(maxAveragePassRatio([[1,1]], 1) - 1.0) < 1e-5\", \"assert abs(maxAveragePassRatio([[1,1],[1... | {
"split": "train",
"index": 73879,
"acecode_id": "evol_7255",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given a two-dimensional array (matrix) and a number (num_of_cols), implement a function that prints the elements of the matrix column-wise up to the specified number of columns. If the specified number of columns exceeds the number of columns in the matrix, the function should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_columns([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 2) is None\", \"assert print_columns([[1, 2], [3, 4]], 1) is None\", \"assert print_columns([[1, 2, 3]], 3) is None\", \"assert print_columns([[1], [2], [3]], 1) is None\", \"assert print_columns([[1, 2, 3], [... | {
"split": "train",
"index": 73880,
"acecode_id": "evol_35674",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the percentage difference between an initial value and a final value. The percentage difference is calculated using the formula: \n\n\\[ \\text{Percentage Difference} = \\left( \\frac{p2 - p1}{\\max(p1, p2)} \\right) \... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculatePercentageDifference(50, 75) == 33.33\", \"assert calculatePercentageDifference(80, 60) == -25.00\", \"assert calculatePercentageDifference(100, 100) == 0.00\", \"assert calculatePercentageDifference(10, 0) == -100.00\", \"assert calculatePercentage... | {
"split": "train",
"index": 73881,
"acecode_id": "oss_6480",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given two dictionaries where each key corresponds to a list of hook objects. Each hook object has a `priority` attribute that is an integer. Your task is to merge these two dictionaries into a new dictionary where each key contains a single list of hooks. The merged lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_hooks({'a': [{'priority': 1}, {'priority': 3}], 'b': [{'priority': 2}]}, {'a': [{'priority': 2}], 'b': [{'priority': 1}, {'priority': 4}]} ) == {'a': [{'priority': 1}, {'priority': 2}, {'priority': 3}], 'b': [{'priority': 1}, {'priority': 2}, {'priorit... | {
"split": "train",
"index": 73882,
"acecode_id": "bigcode_python_fns_41307",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Vector class in Python that supports basic operations such as indexing, length retrieval, and multiplication by another Vector or a scalar. Implement the Vector class with the following methods: 1. __getitem__(self, index: int) -> int: Returns... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Vector((1, 2, 3))[0] == 1\", \"assert Vector((1, 2, 3))[1] == 2\", \"assert Vector((1, 2, 3))[2] == 3\", \"assert len(Vector((1, 2, 3))) == 3\", \"assert len(Vector((5, 6))) == 2\"]}"
} | {
"split": "train",
"index": 73883,
"acecode_id": "oss_16457",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of drum instrument names and a specific instrument name. Your task is to determine the order of the given instrument in a predefined sequence of drum instruments. The predefined sequence is represented as a list of strings, where each string is the name of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_instrument_order(['Snare', 'Bass', 'Hi-Hat', 'Tom-Tom', 'Cymbal'], 'Snare') == 0\", \"assert get_instrument_order(['Snare', 'Bass', 'Hi-Hat', 'Tom-Tom', 'Cymbal'], 'Bass') == 1\", \"assert get_instrument_order(['Snare', 'Bass', 'Hi-Hat', 'Tom-Tom', 'Cymb... | {
"split": "train",
"index": 73884,
"acecode_id": "bigcode_python_fns_29342",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Write a function called `remove_fruit` that takes a list of strings `fruits` and a string `fruit_to_remove`. The function should remove all occurrences of `fruit_to_remove` from the `fruits` list and return the updated list. For example, if the input list is `['banana', 'apple'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_fruit(['banana', 'apple', 'mango', 'orange'], 'apple') == ['banana', 'mango', 'orange']\", \"assert remove_fruit(['apple', 'apple', 'orange'], 'apple') == ['orange']\", \"assert remove_fruit(['banana', 'mango', 'orange'], 'apple') == ['banana', 'mango... | {
"split": "train",
"index": 73885,
"acecode_id": "evol_14280",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the minimum number of leaps of a specified length needed to reach or exceed a coordinate on the x-axis at position (d, 0) starting from the origin (0, 0) in a Cartesian plane. The function should take two parameters: a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calc_leaps(10, 3) == 4\", \"assert calc_leaps(15, 5) == 3\", \"assert calc_leaps(0, 2) == 0\", \"assert calc_leaps(5, 7) == 1\", \"assert calc_leaps(25, 10) == 3\", \"assert calc_leaps(100, 25) == 4\", \"assert calc_leaps(50, 7) == 8\", \"assert calc_leaps(3... | {
"split": "train",
"index": 73886,
"acecode_id": "evol_26563",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of lists of integers, write a function `pad_and_stack_lists(lst_lists: List[List[int]], max_length: Optional[int] = None) -> List[List[int]]` that pads each inner list with zeros at the end to make all inner lists have the same length. If `max_length` is provided, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pad_and_stack_lists([[1, 2], [3, 4, 5], [6]], None) == [[1, 2, 0], [3, 4, 5], [6, 0, 0]]\", \"assert pad_and_stack_lists([[1], [2], [3]], 3) == [[1, 0, 0], [2, 0, 0], [3, 0, 0]]\", \"assert pad_and_stack_lists([[1, 2, 3]], None) == [[1, 2, 3]]\", \"assert pa... | {
"split": "train",
"index": 73887,
"acecode_id": "bigcode_python_fns_17841",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a list of strings to create a dictionary mapping character labels to their corresponding indices. The input list contains strings in the format 'character label', where each character is associated with a unique ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_char_label_dict(['A 1', 'B 2', 'C 3', 'A 4']) == {'A': '4', 'B': '2', 'C': '3'}\", \"assert create_char_label_dict(['X 10', 'Y 20', 'Z 30', 'X 40']) == {'X': '40', 'Y': '20', 'Z': '30'}\", \"assert create_char_label_dict(['A 1', 'A 2', 'A 3']) == {'A'... | {
"split": "train",
"index": 73888,
"acecode_id": "oss_22773",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that validates a dictionary against a set of expected key-value pairs. The function should take in a dictionary `res` and check if it contains the following specific key-value pairs: 'urn_type' should be 'metrics', 'run_id' should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_res({'urn_type': 'metrics', 'run_id': '20200403T1234.324Z', 'expectation_suite_name': 'my_suite'}) == True\", \"assert validate_res({'urn_type': 'metrics', 'run_id': '20200403T1234.324Z', 'expectation_suite_name': 'other_suite'}) == False\", \"asser... | {
"split": "train",
"index": 73889,
"acecode_id": "oss_35128",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates rolling a six-sided die. The function should return a random integer between 1 and 6, inclusive, each time it is called. Implement the function `roll_die()` that does not take any parameters and returns the result of the di... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert roll_die() >= 1 and roll_die() <= 6\", \"assert roll_die() >= 1 and roll_die() <= 6\", \"assert roll_die() >= 1 and roll_die() <= 6\", \"assert roll_die() >= 1 and roll_die() <= 6\", \"assert roll_die() >= 1 and roll_die() <= 6\", \"assert roll_die() >= 1 an... | {
"split": "train",
"index": 73890,
"acecode_id": "oss_33517",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of integers, `today_cards` and `old_cards`, representing the number of cards sold today and on a previous day respectively. Your task is to compare the two lists and return a new list where each element at index `i` is the difference between the number o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_card_sales([10, 20, 30], [5, 15, 25]) == [5, 5, 5]\", \"assert compare_card_sales([10, 20, 30], [10, 20, 30]) == [0, 0, 0]\", \"assert compare_card_sales([5], [0]) == [5]\", \"assert compare_card_sales([0], [5]) == [-5]\", \"assert compare_card_sales... | {
"split": "train",
"index": 73891,
"acecode_id": "bigcode_python_fns_11377",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a simple menu management system for a restaurant. The menu consists of various dishes, each with a name, price, and category. Your function should take a list of tuples representing dishes, where each tuple contains the dis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert menu_summary([('Pasta', 12.99, 'Main Course'), ('Caesar Salad', 8.99, 'Appetizer')]) == (21.98, {'Main Course': ['Pasta'], 'Appetizer': ['Caesar Salad']})\", \"assert menu_summary([('Pizza', 10.99, 'Main Course'), ('Ice Cream', 4.99, 'Dessert'), ('Fries', 3.... | {
"split": "train",
"index": 73892,
"acecode_id": "oss_15332",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of integers and sorts it using the Bubble Sort algorithm. The function should return the sorted list. For example, given the input [5, 3, 2, 4, 1], the output should be [1, 2, 3, 4, 5].\nPlease reason step by step, then write a self-contai... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bubbleSort([5, 3, 2, 4, 1]) == [1, 2, 3, 4, 5]\", \"assert bubbleSort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert bubbleSort([2, 1]) == [1, 2]\", \"assert bubbleSort([3]) == [3]\", \"assert bubbleSort([]) == []\", \"assert bubbleSort([9, 8, 7, 6, 5]) == ... | {
"split": "train",
"index": 73893,
"acecode_id": "evol_13719",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `check_palindrome(sequence: str) -> bool` that takes a string sequence as an argument and returns True if the sequence is a palindrome (reads the same forwards and backwards), and False otherwise.\nPlease reason step by step, then write a self-contained Pyt... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_palindrome('level') == True\", \"assert check_palindrome('radar') == True\", \"assert check_palindrome('hello') == False\", \"assert check_palindrome('A man a plan a canal Panama') == False\", \"assert check_palindrome('') == True\", \"assert check_pal... | {
"split": "train",
"index": 73894,
"acecode_id": "evol_6521",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a sorted list of distinct integers `nums` in ascending order. Write a function `search` to implement binary search to find the index of a specific target element `target` within the list. If the target is found, return its index; otherwise, return -1. Your impleme... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert search([-10, -5, 0, 3, 7, 10], 3) == 3\", \"assert search([-10, -5, 0, 3, 7, 10], 10) == 5\", \"assert search([-10, -5, 0, 3, 7, 10], -10) == 0\", \"assert search([-10, -5, 0, 3, 7, 10], -5) == 1\", \"assert search([-10, -5, 0, 3, 7, 10], 0) == 2\", \"assert... | {
"split": "train",
"index": 73895,
"acecode_id": "oss_27103",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns a new list where each element at index i is the cumulative sum of the squares of all elements from the original list up to index i. The function should take a single parameter, a list of integers, and return a list of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compute_cumulative_square_sum([1, 2, 3]) == [1, 5, 14]\", \"assert compute_cumulative_square_sum([0, 0, 0]) == [0, 0, 0]\", \"assert compute_cumulative_square_sum([-1, -2, -3]) == [1, 5, 14]\", \"assert compute_cumulative_square_sum([4, 5, 6]) == [16, 41, 77... | {
"split": "train",
"index": 73896,
"acecode_id": "evol_35026",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a dataset that records the number of bicycles crossing the Fremont Bridge in Seattle. The dataset is structured with a date index and two columns representing the number of bicycles crossing from the East and West directions. Your goal is to creat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_bicycle_data([('01/01/2023 08:00:00 AM', 5, 10), ('01/01/2023 08:00:00 AM', 3, 7)]) == {'01/01/2023 08:00:00 AM': 25}\", \"assert process_bicycle_data([('01/01/2023 08:00:00 AM', 5, 10), ('01/02/2023 08:00:00 AM', 3, 7)]) == {'01/01/2023 08:00:00 AM'... | {
"split": "train",
"index": 73897,
"acecode_id": "bigcode_python_fns_3921",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that finds any prime numbers present in the list and replaces them with the next prime number. The function should return the modified list. For example, if the input list is [8, 11, 2, 13, 6, 7, 10], the output should be [8, 13, 3, 17... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prime_next([8, 11, 2, 13, 6, 7, 10]) == [8, 13, 3, 17, 6, 11, 10]\", \"assert prime_next([1, 4, 6, 8]) == [1, 4, 6, 8]\", \"assert prime_next([2, 3, 5, 7]) == [3, 5, 7, 11]\", \"assert prime_next([15, 17, 19]) == [15, 19, 23]\", \"assert prime_next([20, 21, ... | {
"split": "train",
"index": 73898,
"acecode_id": "evol_10286",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a level-order traversal function for a binary tree using a queue. Level-order traversal visits all the nodes at each level before moving on to the next level. Your function should be named `levelorder_traversal_queue(root)` and it should take th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert levelorder_traversal_queue(TreeNode(1, TreeNode(2, TreeNode(4), TreeNode(5)), TreeNode(3, TreeNode(6), TreeNode(7)))) == [1, 2, 3, 4, 5, 6, 7]\", \"assert levelorder_traversal_queue(TreeNode(1, TreeNode(2), TreeNode(3))) == [1, 2, 3]\", \"assert levelorder_t... | {
"split": "train",
"index": 73899,
"acecode_id": "oss_36915",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.