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": "You are tasked with creating a function that simulates the configuration of a workflow based on user options. The function should accept parameters that define the workflow settings and return a dictionary with the configured workflow options. The parameters for the function ar...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert configure_workflow('image1.png', 'image2.png', '/input/dir', '/output/dir', 100, ['view1', 'view2'], 5, 3, 'method1', 0.1, False) == {'workflow_id': None, 'image1': 'image1.png', 'image2': 'image2.png', 'input_directory': '/input/dir', 'output_directory': '/...
{ "split": "train", "index": 400, "acecode_id": "bigcode_python_fns_15280", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `generate_qos_report(device: str) -> str` that generates a summary report of Quality of Service (QoS) policies for a given device. The function will take a string `device` as input, which represents the name of the device. You need to sim...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_qos_report('Router1') == 'Device: Router1\\\\nInterfaces:\\\\neth0: High\\\\neth1: Medium\\\\neth2: Low'\", \"assert generate_qos_report('Switch1') == 'Device: Switch1\\\\nInterfaces:\\\\neth0: High\\\\neth1: Medium\\\\neth2: Low'\", \"assert genera...
{ "split": "train", "index": 401, "acecode_id": "bigcode_python_fns_1668", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that checks if a list of integers is monotonically increasing or decreasing. The function should take a list and a boolean parameter 'strict'. If 'strict' is True, consecutive elements must be unique for the list to be considered monotonically increasing or...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert monotonic([1, 2, 3, 4]) == True\", \"assert monotonic([4, 3, 2, 1]) == True\", \"assert monotonic([1, 2, 2, 3], strict=False) == True\", \"assert monotonic([1, 2, 2, 3], strict=True) == False\", \"assert monotonic([1, 2, 3, 2]) == False\", \"assert monotonic...
{ "split": "train", "index": 402, "acecode_id": "evol_32379", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of complex numbers, return a new list containing the square of each number. The square of a complex number a + bj is calculated as (a + bj) * (a + bj). Your function should handle the input as a list of complex numbers and return a list of the squared complex numbe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert square_complex_numbers([0]) == [(0+0j)]\", \"assert square_complex_numbers([]) == []\", \"assert square_complex_numbers([5+0j]) == [(25+0j)]\", \"assert square_complex_numbers([0+0j]) == [(0+0j)]\", \"assert square_complex_numbers([1j, -1j]) == [(-1+0j), (-1...
{ "split": "train", "index": 403, "acecode_id": "bigcode_python_fns_4810", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `is_valid_preset_name(name: str) -> bool` that determines whether a given preset name is valid. A valid preset name must consist entirely of alphanumeric characters (letters and numbers) and underscores. The function should return `True` ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_preset_name('valid_name_123') == True\", \"assert is_valid_preset_name('Invalid-name') == False\", \"assert is_valid_preset_name('anotherValidName') == True\", \"assert is_valid_preset_name('123456') == True\", \"assert is_valid_preset_name('name_wi...
{ "split": "train", "index": 404, "acecode_id": "bigcode_python_fns_34582", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a one-dimensional list of integers and returns the product of all prime numbers in that list. If there are no prime numbers, return 1.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert prod_of_primes([2, 3, 4, 5, 6, 7, 8, 9, 10]) == 210\", \"assert prod_of_primes([0, 1, 4, 6, 8, 9, 10]) == 1\", \"assert prod_of_primes([11, 13, 17]) == 2431\", \"assert prod_of_primes([-1, -2, -3, -4]) == 1\", \"assert prod_of_primes([2, 3, 4, 6, 8, 10]) == ...
{ "split": "train", "index": 405, "acecode_id": "evol_29243", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of file and directory paths. Your task is to implement a function `count_wiki_files(f_d)` that takes a list of paths `f_d` as input and returns the count of files that have a length of at least 5 characters and start with 'wiki'. If an item in the list is n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_wiki_files(['/path/to/directory1', '/path/to/directory2/file1.txt', '/path/to/directory3/file2.txt', '/path/to/directory4/wiki_file.txt']) == 1\", \"assert count_wiki_files(['/path/to/wiki_doc.txt', '/path/to/file.txt', '/path/to/wiki_image.png']) == 2...
{ "split": "train", "index": 406, "acecode_id": "oss_19508", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with counting the occurrences of a specified character in a given string. Your task is to implement a Python function that accomplishes the following: 1. Take a string input and a character to search for. 2. Count how many times that character appears in the stri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_character('hello', 'l') == 2\", \"assert count_character('hello world', 'o') == 2\", \"assert count_character('abcabcabc', 'a') == 3\", \"assert count_character('data structures', 't') == 3\", \"assert count_character('openai', 'o') == 1\", \"assert co...
{ "split": "train", "index": 407, "acecode_id": "oss_22670", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a URL pattern matching system for a web application. Given a URL and a list of URL patterns, create a function that matches the URL against the defined URL patterns. Each pattern consists of a string with parameters indicated in angle brackets (e.g....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert match_url('place/123/456', [('place/<int:sid>/<int:oid>', 'CreateOrder view function')]) == ('CreateOrder view function', {'sid': 123, 'oid': 456})\", \"assert match_url('home', [('home', 'HomeView function')]) == ('HomeView function', {})\", \"assert match_...
{ "split": "train", "index": 408, "acecode_id": "oss_22699", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function `extract_domain(email: str) -> str` that extracts the domain from a given email address. The email address will be in the format 'local_part@domain.com'. If the email address is invalid or does not contain a domain, the function should return an empty st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_domain('john.doe@example.com') == 'example.com'\", \"assert extract_domain('alice.smith@subdomain.example.com') == 'subdomain.example.com'\", \"assert extract_domain('user@domain.org') == 'domain.org'\", \"assert extract_domain('invalid-email') == ''...
{ "split": "train", "index": 409, "acecode_id": "evol_9202", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of lists, determine if the list is ragged, meaning that not all inner lists have the same length. Implement a function `is_ragged(arr: List[List[int]]) -> bool` that takes a parameter `arr`, which is a list of lists of integers. The function should return True if t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_ragged([[1, 2], [3, 4], [5, 6]]) == False\", \"assert is_ragged([[1], [2, 3], [4]]) == True\", \"assert is_ragged([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == False\", \"assert is_ragged([[1, 2], [3, 4, 5]]) == True\", \"assert is_ragged([[], []]) == False\", \"...
{ "split": "train", "index": 410, "acecode_id": "bigcode_python_fns_38913", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function called `remove_duplicates_and_sort` that removes all duplicate elements from the list and returns the modified list in descending order without using any built-in unique() or set() method. The function should maintain the original orde...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates_and_sort([1, 2, 2, 3, 3, 4]) == [4, 3, 2, 1]\", \"assert remove_duplicates_and_sort([5, 5, 5, 5]) == [5]\", \"assert remove_duplicates_and_sort([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\", \"assert remove_duplicates_and_sort([-1, -2, -2, -3]) == ...
{ "split": "train", "index": 411, "acecode_id": "evol_21331", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing a list of files, each represented by a dictionary containing a 'filename' and a 'size'. Your goal is to implement a function that retrieves the filenames of files that have a size less than 1000. The function should take a list of file dictionarie...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_filenames_to_delete([{'filename': 'file1.txt', 'size': 500}, {'filename': 'file2.txt', 'size': 1500}, {'filename': 'file3.txt', 'size': 900}]) == ['file1.txt', 'file3.txt']\", \"assert get_filenames_to_delete([{'filename': 'file4.txt', 'size': 2500}, {'f...
{ "split": "train", "index": 412, "acecode_id": "oss_15256", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that converts a given Laplacian matrix of an unweighted, undirected graph into its equivalent adjacency list representation. The function should take a 2D list representing the Laplacian matrix and return a dictionary where the keys are the nodes of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert laplacian_to_adjacency([[2, -1, 0, -1], [-1, 3, -1, -1], [0, -1, 1, 0], [-1, -1, 0, 2]]) == {0: [1, 3], 1: [0, 2, 3], 2: [1], 3: [0, 1]}\", \"assert laplacian_to_adjacency([[2, -1, -1], [-1, 2, -1], [-1, -1, 2]]) == {0: [1, 2], 1: [0, 2], 2: [0, 1]}\", \"ass...
{ "split": "train", "index": 413, "acecode_id": "evol_8442", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function `string_to_base64(s: str) -> str` that takes a string as input and returns its base64 encoded representation. The input string will be a valid UTF-8 string. The output should be a string that represents the base64 encoding of the input string.\nPlease reaso...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert string_to_base64('Hello World') == 'SGVsbG8gV29ybGQ='\", \"assert string_to_base64('Python Programming') == 'UHl0aG9uIFByb2dyYW1taW5n'\", \"assert string_to_base64('') == ''\", \"assert string_to_base64('123456') == 'MTIzNDU2'\", \"assert string_to_base64('B...
{ "split": "train", "index": 414, "acecode_id": "evol_28055", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a non-negative integer `radius`, write a function `calculate_circle_area` that calculates and returns the area of a circle using the formula: area = π * radius^2. Use the value of π (pi) as 3.14159. You can assume that the radius will always be a non-negative number. The ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_circle_area(0) == 0.0\", \"assert calculate_circle_area(1) == 3.14159\", \"assert calculate_circle_area(2) == 12.56636\", \"assert calculate_circle_area(3) == 28.27431\", \"assert calculate_circle_area(4) == 50.26544\", \"assert calculate_circle_ar...
{ "split": "train", "index": 415, "acecode_id": "oss_36011", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Design a function `find_account(accounts: List[Account], customer: str) -> Optional[Account]` that takes a list of bank accounts and a customer's name as input, and returns the corresponding Account object for that customer if it exists, or `None` if it does not. The Account ob...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_account([], 'Alice') is None\", \"assert find_account([Account('Alice', 100.0)], 'Bob') is None\", \"assert find_account([Account('Frank', 600.0), Account('Grace', 700.0)], 'Hank') is None\", \"assert find_account([Account('Jack', 900.0)], 'John') is No...
{ "split": "train", "index": 416, "acecode_id": "evol_13813", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with managing server connection settings for a custom asynchronous socket I/O core. Your goal is to implement a function `configure_server` that will take a set of TCP connection settings and update various server configurations. The function should accept the fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert configure_server({'tcp://localhost:8000'}, None, True, True) == {'tcp_settings': {'tcp://localhost:8000'}, 'raw_checker': None, 'unknown_clients_allowed': True, 'client_addr_info_enabled': True}\", \"assert configure_server(set(), None, True, False) == {'tcp...
{ "split": "train", "index": 417, "acecode_id": "oss_9566", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of distinct integers, implement a function that returns a list of all prime numbers found within that list. A prime number is defined as a number greater than 1 that has no positive divisors other than 1 and itself.\nPlease reason step by step, then write a self-co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_prime_numbers([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) == [2, 3, 5, 7, 11]\", \"assert get_prime_numbers([1, 4, 6, 8, 9, 10]) == []\", \"assert get_prime_numbers([13, 17, 19, 23, 29]) == [13, 17, 19, 23, 29]\", \"assert get_prime_numbers([0, -1, -7, -5]) ==...
{ "split": "train", "index": 418, "acecode_id": "evol_2352", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to create a function that returns a dictionary where each key is the original integer and the value is 1 if the integer is greater than zero, and 0 if it is less than or equal to zero. Implement a function `mask_positive_numbers(nu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mask_positive_numbers([-1, 0, 1, 2]) == {-1: 0, 0: 0, 1: 1, 2: 1}\", \"assert mask_positive_numbers([3, -2, 5, 0]) == {3: 1, -2: 0, 5: 1, 0: 0}\", \"assert mask_positive_numbers([]) == {}\", \"assert mask_positive_numbers([0, -1, -5]) == {0: 0, -1: 0, -5: 0}...
{ "split": "train", "index": 419, "acecode_id": "bigcode_python_fns_23393", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that takes in a large integer and a prime number as inputs. The function should determine if the sum of cubes of the individual digits in that integer, each raised to the power of the digit itself, is divisible by the provided prime number. Implement the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_divisible(1234567890, 7) == False\", \"assert is_divisible(987654321, 11) == False\", \"assert is_divisible(0, 5) == False\", \"assert is_divisible(999, 13) == False\", \"assert is_divisible(234, 19) == False\", \"assert is_divisible(42, 5) == True\", \"a...
{ "split": "train", "index": 420, "acecode_id": "evol_12836", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that converts a given integer to its string representation. The function should take an integer as input and return a string representing the integer. For example, if the input is 999, the function should return the string '999'. The ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert number_to_string(0) == '0'\", \"assert number_to_string(1) == '1'\", \"assert number_to_string(-1) == '-1'\", \"assert number_to_string(1234) == '1234'\", \"assert number_to_string(-5678) == '-5678'\", \"assert number_to_string(100) == '100'\", \"assert numb...
{ "split": "train", "index": 421, "acecode_id": "oss_14560", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function to simulate a simple server-client interaction. Your function should accept a list of client information, where each client is represented as a tuple containing the client's address (a string) and port number (an integer). Your tas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_clients([('192.168.1.1', 54321), ('10.0.0.1', 12345)]) == ['Accepted connection from 192.168.1.1:54321', 'Accepted connection from 10.0.0.1:12345']\", \"assert process_clients([('localhost', 8080)]) == ['Accepted connection from localhost:8080']\", \...
{ "split": "train", "index": 422, "acecode_id": "oss_19590", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `S` composed of lowercase letters and an integer array `shifts`, implement a function `shiftingLetters(S, shifts)` that applies a series of shifts to the string `S`. For each `shifts[i] = x`, the first `i+1` letters of `S` should be shifted `x` times in the alpha...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shiftingLetters('abc', [3, 5, 9]) == 'rpl'\", \"assert shiftingLetters('a', [0]) == 'a'\", \"assert shiftingLetters('b', [26]) == 'b'\", \"assert shiftingLetters('test', [0, 0, 0, 0]) == 'test'\", \"assert shiftingLetters('z', [1]) == 'a'\", \"assert shiftin...
{ "split": "train", "index": 423, "acecode_id": "evol_8751", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given a list of pressure values represented in one unit (e.g., Pascals, atmospheres, etc.) and you need to convert these values to another specified pressure unit. Implement a function `convert_pressures(pressures: List[float], from_unit: str, to_unit: str) -> List[floa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_pressures([0], 'Pascal', 'psi') == [0.0]\", \"assert convert_pressures([1], 'atmosphere', 'Pascal') == [101325.0]\", \"assert convert_pressures([1], 'Pascal', 'psi') == [0.0001450377]\", \"assert convert_pressures([1], 'psi', 'Pascal') == [6894.76]\"...
{ "split": "train", "index": 424, "acecode_id": "bigcode_python_fns_2167", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates sending a request for flow statistics from a controller to a switch in a network. The function should take two parameters: a string representing the controller's name and a string representing the switch's name. The fun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert send_flow_stats_request('ControllerA', 'Switch1') == 'Request sent from ControllerA to Switch1 for flow statistics.'\", \"assert send_flow_stats_request('ControllerB', 'Switch2') == 'Request sent from ControllerB to Switch2 for flow statistics.'\", \"assert ...
{ "split": "train", "index": 425, "acecode_id": "bigcode_python_fns_20555", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to calculate the position of a reflected wave based on the original wave's position, wave velocity, and the time it takes for the wave to reach the reflecting surface and return. The formula to calculate the position of the reflected ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reflected_wave(0.0, 1.0, 2.0) == 2.0\", \"assert reflected_wave(-3.0, 1.0, 4.0) == 1.0\", \"assert reflected_wave(2.0, 2.0, 2.0) == 3.0\", \"assert reflected_wave(7.0, 7.0, 1.0) == 2.0\", \"assert reflected_wave(9.0, 3.0, 2.0) == 5.0\", \"assert reflected_wa...
{ "split": "train", "index": 426, "acecode_id": "oss_5745", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that determines if an operation can be executed based on a given frequency constraint in seconds. The function should take two parameters: an integer `frequency_constraint` which represents the minimum time in seconds that must pass s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert can_execute(5, 0, 5) == True\", \"assert can_execute(10, 5, 15) == True\", \"assert can_execute(3, 1, 5) == True\", \"assert can_execute(1, 3, 5) == True\", \"assert can_execute(7, 5, 12) == True\", \"assert can_execute(2, 1, 3) == True\", \"assert can_execu...
{ "split": "train", "index": 427, "acecode_id": "oss_24923", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that initializes a booking loader for a showing based on a given response and an optional item. The function should take two parameters: a 'response' string that contains booking details and an optional 'item' string representing a specif...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert init_showing_booking_loader('Booking successful') == {'response': 'Booking successful', 'item': None}\", \"assert init_showing_booking_loader('Booking successful', 'VIP Seat') == {'response': 'Booking successful', 'item': 'VIP Seat'}\", \"assert init_showing...
{ "split": "train", "index": 428, "acecode_id": "bigcode_python_fns_4501", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a collection of data, which can be a tuple of lists or a dictionary where keys are strings and values are lists, implement a function that combines the elements in the following way: \n\n1. If the input is a tuple of lists, return a list of lists where each inner list con...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert data_zip(([1, 2, 3], [4, 5, 6])) == [[1, 4], [2, 5], [3, 6]]\", \"assert data_zip({'a': [1, 2], 'b': [3, 4]}) == [{'a': 1, 'b': 3}, {'a': 2, 'b': 4}]\", \"assert data_zip([1, 2, 3]) == [1, 2, 3]\", \"assert data_zip(([1], [2], [3])) == [[1, 2, 3]]\", \"asser...
{ "split": "train", "index": 429, "acecode_id": "bigcode_python_fns_11535", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a string, implement a function that reverses the sequence of characters in the string and returns the reversed string. For example, if the input string is 'Hello World!', the output should be '!dlroW olleH'.\nPlease reason step by step, then write a self-contained Python ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_string('Hello World!') == '!dlroW olleH'\", \"assert reverse_string('Python') == 'nohtyP'\", \"assert reverse_string('') == ''\", \"assert reverse_string('a') == 'a'\", \"assert reverse_string('ab') == 'ba'\", \"assert reverse_string('racecar') == 'r...
{ "split": "train", "index": 430, "acecode_id": "evol_1431", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a user management system for a second-hand item selling website. Implement a function `create_user` that takes in a username, email, and password, and returns a new user object. The user object should validate the uniqueness of the username and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_user('john_doe', 'john@example.com', 'securepassword') is not None\", \"assert create_user('jane_doe', 'jane@example.com', 'password123') is not None\", \"assert create_user('john_smith', 'john.smith@example.com', 'password456') is not None\", \"asser...
{ "split": "train", "index": 431, "acecode_id": "evol_7636", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that creates a metadata dictionary for a plugin handler. The function should return a dictionary with two keys: 'interface' and 'label'. The value for 'interface' should always be the string 'plugin', and the value for 'label' should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_plugin_metadata() == {'interface': 'plugin', 'label': 'my_plugin_handler'}\", \"assert create_plugin_metadata()['interface'] == 'plugin'\", \"assert create_plugin_metadata()['label'] == 'my_plugin_handler'\", \"assert isinstance(create_plugin_metadata...
{ "split": "train", "index": 432, "acecode_id": "oss_5377", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a given Instagram post URL and extracts the shortcode from it. The function should take a single string parameter, 'url', representing the Instagram post URL, and return a tuple. The first element of the tuple should be a b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_insta_shortcode('https://www.instagram.com/p/ABC123/') == (True, 'ABC123')\", \"assert get_insta_shortcode('https://www.instagram.com/p/XYZ789/') == (True, 'XYZ789')\", \"assert get_insta_shortcode('https://www.instagram.com/p/123456/') == (True, '123456...
{ "split": "train", "index": 433, "acecode_id": "bigcode_python_fns_5043", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function `calculate_age(birthdate: str) -> Tuple[int, int]` that takes a string representing a person's date of birth in the format 'YYYY-MM-DD' and returns a tuple containing their age in years and the number of months since their last birthday. Assume the current date...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_age('1998-06-04') == (25, 4)\", \"assert calculate_age('1980-01-01') == (43, 9)\", \"assert calculate_age('1988-10-10') == (35, 0)\", \"assert calculate_age('1993-09-01') == (30, 1)\", \"assert calculate_age('2004-03-01') == (19, 7)\"]}" }
{ "split": "train", "index": 434, "acecode_id": "evol_32936", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a positive integer `n`, determine the least number of operations required to transform `n` into `1`. You can perform the following operations: if `n` is even, replace `n` with `n / 2`; if `n` is odd, replace `n` with either `n + 1`, `n - 1`, or `n * 2`. Implement a functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert min_operations(8) == 3\", \"assert min_operations(7) == 4\", \"assert min_operations(4) == 2\", \"assert min_operations(1) == 0\", \"assert min_operations(16) == 4\", \"assert min_operations(32) == 5\", \"assert min_operations(2) == 1\", \"assert min_operati...
{ "split": "train", "index": 435, "acecode_id": "evol_8480", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that decodes a sequence of values encoded with a prefix that indicates how many values follow. The input is a list of integers where the first integer represents the count of subsequent integers to decode. The function should return a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decode_packed_values([3, 1, 2, 3]) == [1, 2, 3]\", \"assert decode_packed_values([2, 5, 10]) == [5, 10]\", \"assert decode_packed_values([4, 100, 200, 300, 400]) == [100, 200, 300, 400]\", \"assert decode_packed_values([1, 42]) == [42]\", \"assert decode_pac...
{ "split": "train", "index": 436, "acecode_id": "bigcode_python_fns_48262", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes an email message and its components as input and returns the formatted email message as a string. The function should accept the sender's email address, receiver's email address, subject, and body of the email. The email messag...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_email('alice@example.com', 'bob@example.com', 'Hello', 'This is a test email.') == 'From: alice@example.com\\\\nTo: bob@example.com\\\\nSubject: Hello\\\\nThis is a test email.'\", \"assert format_email('john.doe@gmail.com', 'jane.smith@yahoo.com', 'M...
{ "split": "train", "index": 437, "acecode_id": "oss_22645", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that translates a list of English flashcards into Traditional Chinese and returns a list of formatted strings representing the new flashcard entries. Each flashcard entry should be formatted as 'Chinese::Vocab Extra::{flashcard}', where {...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert translate_flashcards(['Traditional', 'English']) == ['Chinese::Vocab Extra::Traditional', 'Chinese::Vocab Extra::English']\", \"assert translate_flashcards(['Apple', 'Banana']) == ['Chinese::Vocab Extra::Apple', 'Chinese::Vocab Extra::Banana']\", \"assert tr...
{ "split": "train", "index": 438, "acecode_id": "oss_33809", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a non-empty list of integers, implement a function that returns the sum of all odd elements located at even indices, along with a list of these filtered odd elements and their corresponding even indices. The function signature should be `def solution(lst: List[int]) -> Tu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert solution([1, 2, 3, 4]) == (4, [(0, 1), (2, 3)])\", \"assert solution([0, 2, 4, 6]) == (0, [])\", \"assert solution([7, 8, 10, 3, 15]) == (22, [(0, 7), (4, 15)])\", \"assert solution([2, 4, 6, 8]) == (0, [])\", \"assert solution([9, 1, 3]) == (12, [(0, 9), (2...
{ "split": "train", "index": 439, "acecode_id": "evol_763", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with processing a list of music items, where each item has a music information dictionary and a hot value. Implement a function `process_music_data(music_list: List[Dict[str, Union[Dict[str, Any], int]]]) -> List[Tuple[Dict[str, Any], int]]` that takes a list of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_music_data([{'music_info': {'title': 'Song A', 'artist': 'Artist A', 'album': 'Album A'}, 'hot_value': 100}, {'music_info': {'title': 'Song B', 'artist': 'Artist B', 'album': 'Album B'}, 'hot_value': 200}]) == [( {'title': 'Song A', 'artist': 'Artist...
{ "split": "train", "index": 440, "acecode_id": "bigcode_python_fns_2627", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a given text by removing all punctuation marks and converting the entire text to lowercase. Your function should take a single string as input and return the processed string as output. The input text may contain alp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_text('Hello! How are you?') == 'hello how are you'\", \"assert process_text('Good morning, everyone.') == 'good morning everyone'\", \"assert process_text('Python is fun!') == 'python is fun'\", \"assert process_text('What time is it?') == 'what time...
{ "split": "train", "index": 441, "acecode_id": "oss_21857", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with analyzing stock price movements using historical data. Write a function `stock_signals(prices: List[float]) -> List[Tuple[int, str]]` that takes a list of daily closing prices for a stock and identifies buy/sell signals based on the moving average crossover ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert stock_signals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == []\", \"assert stock_signals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == []\", \"assert stock_signals([100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128...
{ "split": "train", "index": 442, "acecode_id": "oss_2721", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that identifies prime numbers within a given range and reports those numbers that are not prime along with their smallest prime divisor. The function should take two arguments: the lower and upper bounds of the range (both inclusive). Each prime number shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert identify_primes(2, 10) == ['2 is a prime number', '3 is a prime number', '4 is not a prime number, its smallest prime divisor is 2', '5 is a prime number', '6 is not a prime number, its smallest prime divisor is 2', '7 is a prime number', '8 is not a prime n...
{ "split": "train", "index": 443, "acecode_id": "evol_33501", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates retrieving a list of message templates. The function should return a predefined list of message templates when called. If an error occurs during the retrieval process, the function should return None and a string indicating...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_message_templates() == (['Template 1', 'Template 2', 'Template 3'], 'success')\", \"assert get_message_templates() == (['Template 1', 'Template 2', 'Template 3'], 'success')\", \"assert get_message_templates() == (['Template 1', 'Template 2', 'Template 3...
{ "split": "train", "index": 444, "acecode_id": "bigcode_python_fns_41293", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that calculates the product of all the integers in the list using recursion. The function should take a single parameter, `num_list`, which is a list of integers. Your function should handle the case where the list might contain non-in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_product([1, 2, 3, 4, 5]) == 120\", \"assert compute_product([0, 1, 2, 3, 4]) == 0\", \"assert compute_product([-1, -2, -3]) == -6\", \"assert compute_product([1, 2, '3', 4, 5]) == 40\", \"assert compute_product(['a', 'b', 'c']) == 1\", \"assert compu...
{ "split": "train", "index": 445, "acecode_id": "evol_34657", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string representation of a molecule in the MOL2 format and a filename. The function should return the string with the correct filename extension. If the provided filename does not end with '.mol2', it should be modified to in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_mol2_filename('molecule', 'some_molecule_string') == 'molecule.mol2'\", \"assert get_mol2_filename('molecule.mol2', 'some_molecule_string') == 'molecule.mol2'\", \"assert get_mol2_filename('molecule.txt', 'some_molecule_string') == 'molecule.txt.mol2'\",...
{ "split": "train", "index": 446, "acecode_id": "bigcode_python_fns_38343", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that updates a value at a specific position in a fixed-size list. The list can hold a maximum of 15 elements, initialized to zero. The function should accept the position (index) and the value to be inserted. If the position is out of...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_value(0, 5) == None\", \"assert update_value(5, 10.5) == None\", \"assert update_value(14, -3) == None\", \"assert update_value(1, 0) == None\", \"assert update_value(7, 3.14) == None\", \"assert update_value(10, 2.71) == None\", \"assert update_value...
{ "split": "train", "index": 447, "acecode_id": "evol_27684", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function `count_upper(s: str) -> int` that determines the number of capital letter vowels (A, E, I, O, U) present at even index positions (0-based) within a given text string, excluding the first and the last character of the string. The function should return the count...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_upper('abcdefg') == 0\", \"assert count_upper('dBBE') == 0\", \"assert count_upper('A') == 0\", \"assert count_upper('AEI') == 0\", \"assert count_upper('UOIEA') == 1\", \"assert count_upper('hello') == 0\", \"assert count_upper('XAEIOU') == 2\", \"ass...
{ "split": "train", "index": 448, "acecode_id": "evol_24613", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function `find_primes_in_range(start: int, end: int) -> List[int]` that returns a list of all prime numbers within a given range, including both the start and end values. The range is defined by two integers, `start` and `end`, where 1 <= start <= end <= 10^6.\nPlea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_primes_in_range(50, 100) == [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\", \"assert find_primes_in_range(1, 10) == [2, 3, 5, 7]\", \"assert find_primes_in_range(10, 20) == [11, 13, 17, 19]\", \"assert find_primes_in_range(20, 30) == [23, 29]\", \"assert fi...
{ "split": "train", "index": 449, "acecode_id": "evol_34199", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Construct a function `execute_query(query: str, parameters: dict) -> List[Any]` that takes a GraphQL query as a string and a dictionary of parameters, and returns a list of results from a simulated database. For this question, you should assume that the database is a simple dic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert execute_query('getUser', {'id': 1}) == ['Alice']\", \"assert execute_query('getUser', {'id': 2}) == ['Bob']\", \"assert execute_query('getUser', {'id': 3}) == []\", \"assert execute_query('getUser', {'id': 5}) == []\", \"assert execute_query('getUser', {'id'...
{ "split": "train", "index": 450, "acecode_id": "evol_16951", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function `fibonacci_sequence(n)` that generates and returns a list containing the first `n` numbers of the Fibonacci sequence. The Fibonacci sequence is defined as follows: the first two numbers are 0 and 1, and each subsequent number is the sum of the two preceding...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci_sequence(0) == []\", \"assert fibonacci_sequence(1) == [0]\", \"assert fibonacci_sequence(2) == [0, 1]\", \"assert fibonacci_sequence(3) == [0, 1, 1]\", \"assert fibonacci_sequence(4) == [0, 1, 1, 2]\", \"assert fibonacci_sequence(5) == [0, 1, 1, 2...
{ "split": "train", "index": 451, "acecode_id": "evol_18783", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of model options and extracts specific information from it. Each item in the list is a dictionary representing the model options with a 'name' key for the model name and an 'options' key containing a 'permissi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_permissions([{'name': 'order', 'options': {'permissions': (('export_order', 'Can export order'),)}}]) == {'order': ['export_order']}\", \"assert extract_permissions([{'name': 'product', 'options': {'permissions': (('view_product', 'Can view product')...
{ "split": "train", "index": 452, "acecode_id": "oss_8778", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries representing yum repository configurations. Each dictionary contains the following keys: 'url', which is a string representing the URL to the yum repo definition file, 'dist', which is a string that indicates the Linux distribution ('amazon'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert install_repos([{'url': 'http://example.com/repo1.repo', 'dist': 'redhat', 'epel_version': '6'}, {'url': 'http://example.com/repo2.repo', 'dist': 'all', 'epel_version': '7'}], 'centos', '7.0') == ['http://example.com/repo2.repo']\", \"assert install_repos([{'...
{ "split": "train", "index": 453, "acecode_id": "bigcode_python_fns_35524", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python decorator that tracks the number of times a decorated function is called. Your goal is to create a decorator called `track_calls` that can be applied to functions, allowing you to count how many times they are called. The decorator shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert track_calls(lambda: None).call_count == 0\", \"assert (decorated_foo := track_calls(lambda: None))() is None\", \"assert (decorated_bar := track_calls(lambda: None))() is None\", \"assert (decorated_foo := track_calls(lambda: None))() is None\", \"assert (de...
{ "split": "train", "index": 454, "acecode_id": "oss_35115", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries, where each dictionary contains an 'address' key representing an IP address. Write a function that takes this list as input and returns a comma-delimited string of these IP addresses, each followed by ':53'. The IP addresses should be format...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert slave_addresses([{'address': '192.168.1.1'}, {'address': '10.0.0.1'}, {'address': '172.16.0.1'}]) == '192.168.1.1:53, 10.0.0.1:53, 172.16.0.1:53'\", \"assert slave_addresses([{'address': '0.0.0.0'}, {'address': '255.255.255.255'}]) == '0.0.0.0:53, 255.255.25...
{ "split": "train", "index": 455, "acecode_id": "bigcode_python_fns_23489", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `swap_case(x: str) -> str` that takes a string `x` as input and returns a new string where all uppercase letters are converted to lowercase and all lowercase letters are converted to uppercase. Non-alphabetic characters should remain unchanged. You must not...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert swap_case('Hello World') == 'hELLO wORLD'\", \"assert swap_case('Python123') == 'pYTHON123'\", \"assert swap_case('12345') == '12345'\", \"assert swap_case('') == ''\", \"assert swap_case('aBcDeFg') == 'AbCdEfG'\", \"assert swap_case('!@#$%^&*()') == '!@#$%^...
{ "split": "train", "index": 456, "acecode_id": "evol_23360", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that simulates the management of partitioned models in a database. The function should create a new partitioned model based on the given fields, method, key, and connection. Additionally, it should add a list-based partition wi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_partitioned_model({'name': 'TextField', 'category': 'TextField'}, 'method1', 'key1', 'connection1', 'pt1', ['car', 'boat']) == None\", \"assert manage_partitioned_model({'title': 'TextField', 'description': 'TextField'}, 'method2', 'key2', 'connection...
{ "split": "train", "index": 457, "acecode_id": "oss_21733", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement the function `custom_base_arithmetics(n, m, base, operation)` that takes in two positive integers `n` and `m`, an integer `base` in the range [2, 10] (inclusive), and a string `operation` which can be one of the following: ['sum', 'diff', 'product', 'average']. The fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_base_arithmetics(1, 5, 2, 'average') == '0b11'\", \"assert custom_base_arithmetics(2, 4, 10, 'sum') == '9'\", \"assert custom_base_arithmetics(7, 3, 2, 'product') == -1\", \"assert custom_base_arithmetics(10, 10, 2, 'sum') == '0b1010'\", \"assert cust...
{ "split": "train", "index": 458, "acecode_id": "evol_23441", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function `insert_in_list(initial_list: List[int], elem: int, index: int) -> List[int]` that inserts an element into a given list at a specified index. The function should handle errors appropriately if an invalid index is provided (i.e., index out of bounds) or if the d...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert insert_in_list([2, 4, 6, 8, 10], 3, 1) == [2, 3, 4, 6, 8, 10]\", \"assert insert_in_list([1, 3, 5], 2, 2) == [1, 3, 2, 5]\", \"assert insert_in_list([], 1, 0) == [1]\", \"assert insert_in_list([1], 2, 1) == [1, 2]\", \"assert insert_in_list([1, 2, 3], 'a', 1...
{ "split": "train", "index": 459, "acecode_id": "evol_32891", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a configuration dictionary `cfg` that contains a key `model` with a nested key `name`, implement a function `build_model` that returns the model name as a string. The function should extract the name from the configuration dictionary and return it. If the model name is no...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert build_model({'model': {'name': 'ResNet'}}) == 'ResNet'\", \"assert build_model({'model': {'name': 'Inception'}}) == 'Inception'\", \"assert build_model({'model': {'name': 'VGG'}}) == 'VGG'\", \"assert build_model({'model': {'name': 'MobileNet'}}) == 'MobileN...
{ "split": "train", "index": 460, "acecode_id": "bigcode_python_fns_3982", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of numerical values representing fit results. Your task is to compute the total loss, mean squared error (MSE) loss, regularization loss, and the percentage of regularization loss based on the following rules: \n\n1. The total loss is the sum of all numeric...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_fit_metrics([0.0, 0.0, 0.0], 0.5) == (0.0, 0.0, 0.00, 0.00)\", \"assert compute_fit_metrics([5.0, 5.0, 5.0], 0.0) == (15.0, 25.0, 0.00, 0.00)\", \"assert compute_fit_metrics([1.0], 0.1) == (1.0, 1.0, 0.10, 10.00)\", \"assert compute_fit_metrics([100....
{ "split": "train", "index": 461, "acecode_id": "bigcode_python_fns_24790", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a verification function to check the compatibility of two data objects based on their metadata. Each object has a `metadata` dictionary containing the number of columns and a list of column definitions. Your function should ensure that: 1. The t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert verify({'metadata': {'ncols': 2, 'columns': [{'type': 'int'}, {'type': 'str'}], 'keys': ['key1'], 'key1': 'value1'}}, {'metadata': {'ncols': 2, 'columns': [{'type': 'str'}, {'type': 'str'}], 'keys': ['key1'], 'key1': 'value1'}}) == False\", \"assert verify({...
{ "split": "train", "index": 462, "acecode_id": "oss_35589", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given a string representing a ChangeToken. Your task is to determine the status of this ChangeToken based on predefined rules. The possible statuses are 'PROVISIONED', 'PENDING', and 'INSYNC'. Implement a function that returns the status of the ChangeToken based on the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_change_token_status('abcd12f2-46da-4fdb-b8d5-fbd4c466928f1') == 'PROVISIONED'\", \"assert get_change_token_status('abcd12f2-46da-4fdb-b8d5-fbd4c466928f2') == 'PENDING'\", \"assert get_change_token_status('abcd12f2-46da-4fdb-b8d5-fbd4c466928f3') == 'INSYN...
{ "split": "train", "index": 463, "acecode_id": "bigcode_python_fns_16282", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks whether a library name follows a specific format for installation. The library name should either be a valid GitHub repository link or a simple library name. A valid GitHub repository link starts with 'git+https://github.com/'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_library('git+https://github.com/user/repo') == True\", \"assert is_valid_library('git+https://github.com/user/repo.git') == True\", \"assert is_valid_library('numpy') == True\", \"assert is_valid_library('my-library') == True\", \"assert is_valid_li...
{ "split": "train", "index": 464, "acecode_id": "bigcode_python_fns_29290", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that maps an input value to a corresponding usage page. The function should take an integer value as input and return a specified result based on the following criteria: 1. If the value is in the range of known usage pages (0x0000 to 0x00F...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_usage_page(0x0000) == 'Known Usage Page'\", \"assert find_usage_page(0x00FF) == 'Known Usage Page'\", \"assert find_usage_page(0x0001) == 'Known Usage Page'\", \"assert find_usage_page(0x000A) == 'Known Usage Page'\", \"assert find_usage_page(100) == 'K...
{ "split": "train", "index": 465, "acecode_id": "oss_5208", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a string `s`, return the length of the longest proper prefix which is also a suffix. A proper prefix is defined as a prefix that is not equal to the entire string. You need to implement a function `longest_proper_prefix_suffix(s: str) -> int` that takes a string `s` as in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert longest_proper_prefix_suffix('ababcabab') == 4\", \"assert longest_proper_prefix_suffix('aaaa') == 3\", \"assert longest_proper_prefix_suffix('abcde') == 0\", \"assert longest_proper_prefix_suffix('a') == 0\", \"assert longest_proper_prefix_suffix('abab') ==...
{ "split": "train", "index": 466, "acecode_id": "bigcode_python_fns_25258", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a simple function to check if a given number of requests can be allowed within a specified rate limit. Implement a function `can_allow_requests(max_requests: int, time_window: int, requests: List[int]) -> bool` that determines if all requests in the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert can_allow_requests(5, 10, [1, 2, 3, 4, 5]) == True\", \"assert can_allow_requests(5, 10, [1, 2, 3, 4, 5, 11]) == False\", \"assert can_allow_requests(3, 5, [1, 2, 3, 4, 5]) == False\", \"assert can_allow_requests(1, 1, [1, 2]) == False\", \"assert can_allow_...
{ "split": "train", "index": 467, "acecode_id": "oss_18676", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that counts the occurrences of a specified character in a given string. The function should take two parameters: a string 'text' and a character 'char', and return the number of times 'char' appears in 'text'.\nPlease reason step by step, then write a self-...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_char('Hello World', 'l') == 3\", \"assert count_char('Python Programming', 'o') == 2\", \"assert count_char('Data Science', 'a') == 2\", \"assert count_char('OpenAI GPT', 'A') == 1\", \"assert count_char('abcdef', 'g') == 0\", \"assert count_char('Hell...
{ "split": "train", "index": 468, "acecode_id": "evol_12165", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function `decode_signed_varints(buffer: List[int], mask: int) -> List[int]` that decodes a list of signed variable-length integers. Each integer is encoded using a variable-length format where the most significant bit indicates whether ther...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decode_signed_varints([0xAC, 0x02], 0xFFFFFFFFFFFFFFFF) == [300]\", \"assert decode_signed_varints([0x80, 0x01], 0xFFFFFFFFFFFFFFFF) == [128]\", \"assert decode_signed_varints([0xFF, 0x7F], 0xFFFFFFFFFFFFFFFF) == [-1]\", \"assert decode_signed_varints([], 0x...
{ "split": "train", "index": 469, "acecode_id": "bigcode_python_fns_84", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that modifies two fields of a user model represented as a dictionary. The existing user model has a field named 'money' with a float value and a field named 'phone' with a string value. Your objective is to modify these fields such that '...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert modify_user_fields({'money': 100.0, 'phone': '1234567890'}) == {'money': None, 'phone': '1234567890', 'money_verbose': 'Saldo', 'phone_verbose': 'Telefono'}\", \"assert modify_user_fields({'money': None, 'phone': None}) == {'money': None, 'phone': None, 'mon...
{ "split": "train", "index": 470, "acecode_id": "oss_31283", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple 2D game involving characters called 'Gobo' and 'Player'. Each character has a position on a 2D grid represented by coordinates (x, y) and a health value. The function should take a list of characters, where eac...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert character_status([('Gobo', (1, 2), 10), ('Player', (3, 4), 5)]) == ['Gobo at (1, 2) is alive', 'Player at (3, 4) is alive']\", \"assert character_status([('Gobo', (1, 2), 0), ('Player', (3, 4), 0)]) == ['Gobo at (1, 2) is dead', 'Player at (3, 4) is dead']\"...
{ "split": "train", "index": 471, "acecode_id": "oss_36572", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a simplified function that simulates a fuzz testing environment for a graphics shader compiler. The function `fuzz_shader_compiler` takes three parameters: a string representing the active device name, an integer seed for randomization, and a list o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fuzz_shader_compiler('amdllpc', 12345, ['sig1', 'sig2']) == {'active_device': 'amdllpc', 'seed': 12345, 'ignored_signatures': ['sig1', 'sig2']}\", \"assert fuzz_shader_compiler('swift_shader', 54321, None) == {'active_device': 'swift_shader', 'seed': 54321, ...
{ "split": "train", "index": 472, "acecode_id": "bigcode_python_fns_24658", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2x2 grid represented by a list of lists, where each tile is an integer from 0 to 4. The integer '0' represents an empty square, and the integers '1', '2', '3', and '4' represent tiles. A valid move consists of swapping the '0' with one of its diagonally adjacent...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert least_moves([[1,2],[3,0]]) == 0\", \"assert least_moves([[2,1],[3,0]]) == -1\", \"assert least_moves([[4,1],[3,0]]) == -1\", \"assert least_moves([[1,0],[2,3]]) == 2\", \"assert least_moves([[0,0],[0,0]]) == -1\", \"assert least_moves([[4,2],[1,0]]) == -1\",...
{ "split": "train", "index": 473, "acecode_id": "evol_6647", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a list of required skills `req_skills` and a list of people where each person has a list of skills along with their associated skill levels, implement a function `smallestSufficientTeam(req_skills: List[str], people: List[List[Tuple[str, int]]]) -> List[int]` that returns...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert smallestSufficientTeam(['java','nodejs','reactjs'], [[('java', 2)], [('nodejs', 1)], [('nodejs', 1),('reactjs', 2)]]) == [0, 2]\", \"assert smallestSufficientTeam(['python', 'javascript'], [[('python', 5)], [('javascript', 4)], [('java', 2)]]) == [0, 1]\", \...
{ "split": "train", "index": 474, "acecode_id": "evol_22621", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of integers and returns the total sum of all the integers in the list. The function should handle both positive and negative integers. For example, given the input list [-1, 2, 3, -4, 5], the output should be 5.\nPlease reason step by step...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_total_sum([-1, 2, 3, -4, 5]) == 5\", \"assert calc_total_sum([0, 0, 0]) == 0\", \"assert calc_total_sum([1]) == 1\", \"assert calc_total_sum([-1]) == -1\", \"assert calc_total_sum([10, 20, 30]) == 60\", \"assert calc_total_sum([-10, -20, -30]) == -60\",...
{ "split": "train", "index": 475, "acecode_id": "evol_5088", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are required to implement a Python function `is_harshad(n)` that takes an integer `n` as input and returns `True` if the number is a Harshad number, and `False` otherwise. A Harshad number (also called Niven number) is an integer that is divisible by the sum of its digits. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_harshad(18) == True\", \"assert is_harshad(19) == False\", \"assert is_harshad(1) == True\", \"assert is_harshad(0) == False\", \"assert is_harshad(-5) == False\", \"assert is_harshad(21) == True\", \"assert is_harshad(22) == False\", \"assert is_harshad(...
{ "split": "train", "index": 476, "acecode_id": "oss_15111", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function called `bank_account_operations` that simulates a simple banking system. The function should take a list of operations as input, where each operation is either a deposit or a withdrawal, and return the final balance and the total numb...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bank_account_operations([100, 200, -50]) == (250, 3)\", \"assert bank_account_operations([]) == (0, 0)\", \"assert bank_account_operations([50, 50, 50]) == (150, 3)\", \"assert bank_account_operations([200, 300, -100, -50, 50]) == (400, 5)\", \"assert bank_a...
{ "split": "train", "index": 477, "acecode_id": "oss_716", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that determines the compatibility of various Java Development Kit (JDK) versions with a specified minimum required version. The function should take in a list of dictionaries, where each dictionary represents a JDK with its version...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_compliant_jdks([{'name': 'JDK 8', 'version': '1.8', 'javaCompliance': '1.8'}, {'name': 'JDK 11', 'version': '1.11', 'javaCompliance': '1.11'}, {'name': 'JDK 14', 'version': '1.14', 'javaCompliance': '1.14'}, {'name': 'JDK 7', 'version': '1.7', 'javaCompl...
{ "split": "train", "index": 478, "acecode_id": "oss_29025", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two nested dictionaries that may contain conflicting key-value pairs. Write a function `merge_dicts(dict1, dict2)` that recursively merges these two dictionaries. In the case of conflicting keys, the value from the second dictionary should be used. The function sh...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_dicts({}, {}) == {}\", \"assert merge_dicts({'a': 1}, {}) == {'a': 1}\", \"assert merge_dicts({}, {'b': 2}) == {'b': 2}\", \"assert merge_dicts({'x': {'y': 4}}, {'x': {'z': 5}}) == {'x': {'y': 4, 'z': 5}}\", \"assert merge_dicts({'a': 1, 'b': 2}, {'a':...
{ "split": "train", "index": 479, "acecode_id": "evol_119", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two integers x and y, write a function that calculates the number of unique paths from the top-left corner of a grid to the bottom-right corner, moving only right or down. The grid has dimensions (x+1) by (y+1). You need to implement a function `uniquePaths(x: int, y: int...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert uniquePaths(0, 0) == 1\", \"assert uniquePaths(0, 1) == 1\", \"assert uniquePaths(1, 0) == 1\", \"assert uniquePaths(1, 1) == 2\", \"assert uniquePaths(2, 2) == 6\", \"assert uniquePaths(3, 3) == 20\", \"assert uniquePaths(2, 3) == 10\", \"assert uniquePaths...
{ "split": "train", "index": 480, "acecode_id": "bigcode_python_fns_18980", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `find_greeting(name: str) -> str` that returns a greeting based on the provided name. If the name is 'Alice', the function should return 'Hi Alice!'. For any other name, if it has been greeted before, return 'Hello!'. If the name has not been greeted before...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_greeting('Alice') == 'Hi Alice!'\", \"assert find_greeting('Bob') == 'Hello!'\", \"assert find_greeting('Charlie') == 'Hello!'\", \"assert find_greeting('Bob') == 'Hello!'\", \"assert find_greeting('Diana') == 'Hello!'\", \"assert find_greeting('Eve') =...
{ "split": "train", "index": 481, "acecode_id": "evol_2764", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a list of tuples where each tuple represents the start and end times of saccades (eye movements) in a visual tracking study, implement a function that calculates the average duration of these saccades. Each tuple is formatted as (start_time_inclusive, end_time_exclusive),...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert average_saccades_time([(0, 1), (1, 2), (2, 3)]) == 1.0\", \"assert average_saccades_time([(0, 2)]) == 2.0\", \"assert average_saccades_time([]) == 0.0\", \"assert average_saccades_time([(10, 20), (20, 30)]) == 10.0\", \"assert average_saccades_time([(0, 5), ...
{ "split": "train", "index": 482, "acecode_id": "bigcode_python_fns_12083", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function `case_insensitive_replace(original: str, to_replace: str, replacement: str) -> str` that searches for a substring in a given string and replaces it with another substring in a case-insensitive manner. The replacement should retain the original case format o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert case_insensitive_replace('Hello World', 'Hello', 'Hi') == 'Hi World'\", \"assert case_insensitive_replace('Python is great', 'PYTHON', 'Java') == 'Java is great'\", \"assert case_insensitive_replace('Replace this text.', 'text', 'string') == 'Replace this st...
{ "split": "train", "index": 483, "acecode_id": "evol_29022", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given two lists of integers, `actual` and `predictions`, write a function `calculate_accuracy(actual: List[int], predictions: List[int]) -> float` that calculates the accuracy of the predictions. The accuracy is defined as the ratio of the number of correct predictions to the t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_accuracy([1, 0, 1], [1, 0, 1]) == 1.0\", \"assert calculate_accuracy([1, 1, 1], [1, 1, 1]) == 1.0\", \"assert calculate_accuracy([0, 0, 0], [1, 1, 1]) == 0.0\", \"assert calculate_accuracy([1, 0], [1, 0]) == 1.0\", \"assert calculate_accuracy([1, 0...
{ "split": "train", "index": 484, "acecode_id": "bigcode_python_fns_23822", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `remove_duplicates(input_array)` that takes an array of integers as input and returns a new array with all duplicate integers removed while maintaining the original order of the elements. The input array may contain positive or negative integers.\nPlease re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates([3, 1, 7, 5, 3, 8, 7]) == [3, 1, 7, 5, 8]\", \"assert remove_duplicates([1, 2, 2, 3, 4]) == [1, 2, 3, 4]\", \"assert remove_duplicates([5, 5, 5, 5]) == [5]\", \"assert remove_duplicates([]) == []\", \"assert remove_duplicates([-1, -1, 0, 1]...
{ "split": "train", "index": 485, "acecode_id": "evol_2436", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a function that checks for syntax errors in a given list of tokens. Each token is represented as a dictionary containing three keys: 'type', 'lineno', and 'lexpos'. The 'type' key indicates the type of token (like 'IDENTIFIER', 'NUMBER', etc.), while 'line...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_syntax_errors([]) == []\", \"assert check_syntax_errors([{'type': 'IDENTIFIER', 'lineno': 1, 'lexpos': 5}, {'type': 'NUMBER', 'lineno': 1, 'lexpos': 10}]) == []\", \"assert check_syntax_errors([{'type': 'INVALID', 'lineno': 2, 'lexpos': 3}]) == ['Synta...
{ "split": "train", "index": 486, "acecode_id": "bigcode_python_fns_16525", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string representing the name of a fruit and returns a string describing that fruit. The function should support a predefined list of fruits: 'apple', 'banana', 'cherry', and 'date'. Each fruit has a specific description: 'app...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert describe_fruit('apple') == 'A sweet red fruit'\", \"assert describe_fruit('banana') == 'A long yellow fruit'\", \"assert describe_fruit('cherry') == 'A small red fruit often used in desserts'\", \"assert describe_fruit('date') == 'A sweet brown fruit often f...
{ "split": "train", "index": 487, "acecode_id": "oss_29861", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of lists, where each inner list contains integers, implement a function `append_lists(lists: List[List[int]]) -> List[int]` that appends the integers position-wise from each inner list into a new list. The function should stop appending once the shortest inner list...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert append_lists([[1, 2], [3, 4], [5, 6]]) == [1, 3, 5, 2, 4, 6]\", \"assert append_lists([[1], [2], [3], [4]]) == [1, 2, 3, 4]\", \"assert append_lists([[1, 2], [3, 4, 5, 6], [7, 8]]) == [1, 3, 7, 2, 4, 8]\", \"assert append_lists([[1, 2, 3], [], [5, 6]]) == []...
{ "split": "train", "index": 488, "acecode_id": "bigcode_python_fns_43487", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the widths of edges in a graph. Your task is to implement a function `calculate_line_widths(widths: List[int], lw_by: Optional[int] = None) -> List[int]` that returns a new list of line widths. If `lw_by` is provided, the function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_line_widths([5, 10, 15], 1) == [10]\", \"assert calculate_line_widths([3, 6, 9], 0) == [3]\", \"assert calculate_line_widths([1, 2, 3], None) == [1, 1, 1]\", \"assert calculate_line_widths([-1, -2, -3], 2) == [-3]\", \"assert calculate_line_widths(...
{ "split": "train", "index": 489, "acecode_id": "bigcode_python_fns_43308", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a tuple of numbers and a specified target product, implement a function that calculates the product of consecutive elements in the tuple. If the product reaches the target product exactly, return that product. If the product exceeds the target product, return -1. If the t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_product_until_limit((2, 3, 4), 24) == 24\", \"assert calculate_product_until_limit((1, 2, 3, 4), 6) == 6\", \"assert calculate_product_until_limit((1, 2, 3, 4), 7) == -1\", \"assert calculate_product_until_limit((5, 5, 5), 125) == 125\", \"assert c...
{ "split": "train", "index": 490, "acecode_id": "evol_14558", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given a grid representing a network of corridors in a building. Each cell in the grid can either be an entrance, an exit, or a corridor with a specific flow capacity. The flow capacity indicates how many units can move through that corridor. Your task is to find the max...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maximum_flow((1, 1), [(0, 0)], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\", \"assert maximum_flow((0, 0), [(1, 1)], [[0, 0], [0, 0]]) == 0\", \"assert maximum_flow((0, 0), [(2, 2)], [[5, 0, 0], [0, 5, 0], [0, 0, 0]]) == 0\", \"assert maximum_flow((0, 0), [(1, ...
{ "split": "train", "index": 491, "acecode_id": "bigcode_python_fns_48758", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Write a function that takes two integer inputs: 'num_range' and 'samples'. The function should generate 'samples' number of random integers within the range of 0 to 'num_range'. For each generated integer, determine if it is even or odd. The function should return a dictionary ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert random_num_parity(1, 1) == {'even': 0, 'odd': 1}\", \"assert random_num_parity(0, 10) == None\", \"assert random_num_parity(-5, 10) == None\", \"assert random_num_parity(10, -1) == None\", \"assert random_num_parity(50, 0) == None\", \"assert random_num_pari...
{ "split": "train", "index": 492, "acecode_id": "evol_16513", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of lists of integers and returns a list of tuples, where each tuple corresponds to one input list. Each tuple should contain three elements: a sorted list of prime numbers from the input list, the product of all prime numbers (or None if there...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_prime_numbers([[2, 3, 5]]) == [([2, 3, 5], 30, 10)]\", \"assert find_prime_numbers([[4, 6, 8, 10]]) == [([], None, None)]\", \"assert find_prime_numbers([[1, -1, 0]]) == [([], None, None)]\", \"assert find_prime_numbers([[11, 13, 17]]) == [([11, 13, 17]...
{ "split": "train", "index": 493, "acecode_id": "evol_7474", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a 2D grid of integers where each integer represents a specific label of an object, implement a function that takes in the grid and a specific label and returns the coordinates of the bounding box that encompasses all the cells with the given label. The bounding box is def...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_bounding_box([[1, 1], [1, 1]], 1) == [(0, 0), (1, 1)]\", \"assert find_bounding_box([[0, 0], [0, 0]], 1) == []\", \"assert find_bounding_box([[2, 2, 2], [2, 1, 2], [2, 2, 2]], 1) == [(1, 1), (1, 1)]\", \"assert find_bounding_box([[3, 3, 3], [3, 4, 3], [...
{ "split": "train", "index": 494, "acecode_id": "bigcode_python_fns_48", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the weighted average of a list of values. The function should take two parameters: a list of values and a corresponding list of weights. Ensure that both lists are of the same length and that the sum of the weights equals 1. If either condit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert weighted_average([5, 15], [0.5, 0.5]) == 10.0\", \"assert weighted_average([0, 0, 0], [1, 0, 0]) == 0.0\", \"assert weighted_average([10, 20], [0.4, 0.6]) == 16.0\", \"assert weighted_average([3, 3, 3], [0.33, 0.33, 0.34]) == 3.0\", \"assert weighted_average...
{ "split": "train", "index": 495, "acecode_id": "evol_5709", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Implement a function that recursively retrieves all the keys from a nested dictionary. The function should return a flat list of keys. For example, given a nested dictionary, it should extract all keys regardless of the depth of nesting.\nPlease reason step by step, then write ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert retrieve_keys({'A': 1, 'B': {'B1': 2, 'B2': {'B21': 3}}, 'C': 4}) == ['A', 'B', 'B1', 'B2', 'B21', 'C']\", \"assert retrieve_keys({'X': {'Y': {'Z': 5}}}) == ['X', 'Y', 'Z']\", \"assert retrieve_keys({'M': 10, 'N': 20}) == ['M', 'N']\", \"assert retrieve_keys...
{ "split": "train", "index": 496, "acecode_id": "evol_29317", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, implement a function that returns the minimum and maximum values in the array. If the array is empty, the function should return None for both minimum and maximum values. Define the function signature as `def findMinAndMax(array: List[int]) -> Tuple[...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert findMinAndMax([3, 1, 4, 1, 5, 9, 2, 6]) == (1, 9)\", \"assert findMinAndMax([-1, -2, -3, -4]) == (-4, -1)\", \"assert findMinAndMax([10]) == (10, 10)\", \"assert findMinAndMax([0, 0, 0]) == (0, 0)\", \"assert findMinAndMax([]) == (None, None)\", \"assert fin...
{ "split": "train", "index": 497, "acecode_id": "evol_8726", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a dummy object based on a given class title and a simplified API documentation structure. The function should accept a string `class_title` and a dictionary `doc` that contains collections and classes. Your function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_dummy_object('ClassA', {'collections': {'ClassA': {'collection': {'name': 'ClassA', 'manages': {'object': 'http://example.com/ClassB'}}}}, 'parsed_classes': {}}) == {'@type': 'ClassA', 'members': [{'@id': '/api/ClassB/1', '@type': 'ClassB'}, {'@id':...
{ "split": "train", "index": 498, "acecode_id": "bigcode_python_fns_32024", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `flatten_and_sum` that takes the list as input and returns the sum of all integers in a nested list structure. The function should handle both flat lists and lists containing other lists. For example, given the input `[1, 2, [3, 4], [[...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten_and_sum([1, 2, [3, 4], [[5]]]) == 15\", \"assert flatten_and_sum([1, [2, [3]], 4]) == 10\", \"assert flatten_and_sum([[1], [2], [3]]) == 6\", \"assert flatten_and_sum([1, 2, 3]) == 6\", \"assert flatten_and_sum([]) == 0\", \"assert flatten_and_sum([[...
{ "split": "train", "index": 499, "acecode_id": "bigcode_python_fns_34404", "num_tests": 16 }