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 given a string representing a Minecraft username. Your task is to write a function that returns a unique identifier (UUID) for the username based on a specific encoding scheme. The encoding scheme is as follows: if the username's length is less than or equal to 5, retur...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_uuid('user') == 'short_4'\", \"assert get_uuid('username') == 'medium_USERNAME'\", \"assert get_uuid('testUser') == 'medium_TESTUSER'\", \"assert get_uuid('test123456') == 'medium_TEST123456'\", \"assert get_uuid('abcdefghij') == 'medium_ABCDEFGHIJ'\", \...
{ "split": "train", "index": 66300, "acecode_id": "bigcode_python_fns_4528", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that simulates a command execution system within a container. The function, `exec_command`, takes the following parameters: a command to execute (as a string), and an optional parameter for interactive mode, which is a boolean ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert exec_command('echo Hello', interactive=True) == 'Hello'\", \"assert exec_command('echo Hello', interactive=False) == 'Hello'\", \"assert exec_command('exit', interactive=True) == 'Exited'\", \"assert exec_command('exit', interactive=False) == 'Exited'\", \"a...
{ "split": "train", "index": 66301, "acecode_id": "oss_18019", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that takes a list of integers and returns a new list containing only the even integers from the original list. The returned list should maintain the order of the even integers as they appeared in the original list. If there are no even integers, return a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even([6, 7, 8, 9, 10]) == [6, 8, 10]\", \"assert filter_even([1, 3, 5]) == []\", \"assert filter_even([2, 4, 6]) == [2, 4, 6]\", \"assert filter_even([-2, -1, 0, 1, 2]) == [-2, 0, 2]\", \"assert filte...
{ "split": "train", "index": 66302, "acecode_id": "evol_6890", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to validate and store a financial transaction. The function should take in details of the transaction such as amount (float), currency (string), payment type (string), user ID (integer), and a User object (which has an attribute 'id' ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_transaction(100.0, 'USD', 'credit', 1, User(1)) == {'amount': 100.0, 'currency': 'USD', 'payment_type': 'credit', 'user_id': 1}\", \"assert add_transaction(50.5, 'EUR', 'debit', 2, User(2)) == {'amount': 50.5, 'currency': 'EUR', 'payment_type': 'debit', ...
{ "split": "train", "index": 66303, "acecode_id": "oss_29189", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer array, implement a function that returns a tuple containing two lists: the first list should contain all the even numbers from the array, and the second list should contain all the odd numbers. The order of numbers in each list should be the same as their order...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert segregate_numbers([1, 2, 3, 4, 5, 6]) == ([2, 4, 6], [1, 3, 5])\", \"assert segregate_numbers([10, 21, 32, 43, 54]) == ([10, 32, 54], [21, 43])\", \"assert segregate_numbers([0, -1, -2, -3, -4]) == ([0, -2, -4], [-1, -3])\", \"assert segregate_numbers([5, 11...
{ "split": "train", "index": 66304, "acecode_id": "evol_17671", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `check_payload_format` that takes a dictionary as input and checks if it is properly formatted according to the following criteria: the dictionary must contain a 'username' key and a 'password' key. Additionally, the 'password' value must be a string with a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_payload_format({'username': 'user1', 'password': 'password123'}) == 'success'\", \"assert check_payload_format({'username': 'user1', 'password': 'short'}) == 'Password must be at least 8 characters long'\", \"assert check_payload_format({'username': 'u...
{ "split": "train", "index": 66305, "acecode_id": "evol_19816", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that prepares a query dictionary based on the provided parameters. The function should take the following inputs: a boolean 'counts_only', a string 'time_added_from', and a string 'time_added_to'. The function should return a dictionary t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert prepare_query_dict(True, '2023-01-01 00:00:00', '2023-12-31 23:59:59') == {'counts-only': True, 'time-added-from': '2023-01-01 00:00:00', 'time-added-to': '2023-12-31 23:59:59'}\", \"assert prepare_query_dict(False, '2023-01-01 00:00:00', '2023-12-31 23:59:5...
{ "split": "train", "index": 66306, "acecode_id": "bigcode_python_fns_31493", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of elements that may contain numeric values and non-numeric values. Your task is to implement a function `foo(nums_data)` that takes this list as input. The function should add 2 to each numeric value in the list and replace the original value with the new ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert foo([1, 2, 3, 4]) == [3, 4, 5, 6]\", \"assert foo([0, -1, -2, -3]) == [2, 1, 0, -1]\", \"assert foo([]) == []\", \"assert foo([5, '10', 15]) == [7, 12, 17]\", \"assert foo(['10', '20', '30']) == [12, 22, 32]\", \"assert foo(['2', '3', '4']) == [4, 5, 6]\", \...
{ "split": "train", "index": 66307, "acecode_id": "evol_20707", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Design a function that accepts a dataset in the form of a list of dictionaries and applies error handling techniques to it according to specified instructions. The function should perform the following operations: 1) Check if the input is a list, and raise a ValueError if not. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_errors_in_data([{'a': 1, 'b': 2}, {'a': 1, 'b': 2}]) == [{'a': 1, 'b': 2}]\", \"assert handle_errors_in_data([{'a': 1, 'b': None}, {'a': 2, 'b': 3}]) == [{'a': 2, 'b': 3}]\", \"assert handle_errors_in_data([{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]) == [{'a...
{ "split": "train", "index": 66308, "acecode_id": "evol_5445", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a profile edit form for a web application. Your goal is to implement a function that accepts user data as input in the form of a dictionary and returns a new dictionary that includes the user's email, preferred ebook format, email notification prefe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_profile_data({'email': 'user@example.com', 'preferred_ebook_format': '.epub', 'dont_email_me': False, 'age': 25}) == {'email': 'user@example.com', 'preferred_ebook_format': '.epub', 'dont_email_me': False, 'age': 25}\", \"assert validate_profile_dat...
{ "split": "train", "index": 66309, "acecode_id": "oss_31084", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a string `s`, implement a function `is_elated(s)` that returns True if the following conditions are met: the length of the string is exactly 5, no two adjacent characters are the same, and the count of each character in the string is a prime number and at least 3. Otherwi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_elated('abcde') == False\", \"assert is_elated('abcde') == False\", \"assert is_elated('aabaa') == False\", \"assert is_elated('aaccd') == False\", \"assert is_elated('aaaaa') == False\", \"assert is_elated('abcde') == False\", \"assert is_elated('aaabbb'...
{ "split": "train", "index": 66310, "acecode_id": "evol_24663", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function in Python to calculate the factorial of a non-negative integer using recursion. The function should raise a TypeError if the input is not an integer and a ValueError if the input is a negative integer. The function signature should be `def factorial(n: int)...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(...
{ "split": "train", "index": 66311, "acecode_id": "evol_16509", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a Python function that calculates the skewness of a list of numerical values without using any libraries. The skewness is a measure of the asymmetry of the distribution of values in the list. Your function should handle potential errors such as empty lists and lists w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_skewness([1, 2, 3]) == 0.0\", \"assert calc_skewness([1, 1, 1]) == 0.0\", \"assert calc_skewness([1, 2, 3, 4, 5]) == 0.0\", \"assert calc_skewness([1, 2, 2, 3, 3, 4]) == 0.0\", \"assert calc_skewness([1, 1, 1, 1, 1, 2]) > 0.0\", \"assert calc_skewness([...
{ "split": "train", "index": 66312, "acecode_id": "evol_17194", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with generating a summary report for a machine learning model based on its layer information. Write a Python function `generate_model_summary(model_layers_info)` that takes a list of dictionaries `model_layers_info`, where each dictionary contains the following k...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_model_summary([{'name': 'Dense', 'shape': (100,), 'params': 10100}, {'name': 'Dropout', 'shape': (100,), 'params': 0}, {'name': 'Dense', 'shape': (10,), 'params': 1010}]) == {'total_num_layers': 3, 'total_params': 11110, 'layer_shapes': [{'name': 'D...
{ "split": "train", "index": 66313, "acecode_id": "oss_4500", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a 2-D array `image` of integers, where each integer represents the pixel value of the image (ranging from 0 to 65535). Given a coordinate `(sr, sc)` representing the starting pixel (row and column) of the flood fill, a pixel value `newColor`, and a `threshold` val...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert advancedFloodFill([[1,1,1],[1,1,0],[1,0,1]], 1, 1, 2, 0) == [[2,2,2],[2,2,0],[2,0,1]]\", \"assert advancedFloodFill([[0]], 0, 0, 1, 0) == [[1]]\", \"assert advancedFloodFill([[1]], 0, 0, 0, 0) == [[0]]\", \"assert advancedFloodFill([[10,20,30],[20,10,20],[30...
{ "split": "train", "index": 66314, "acecode_id": "evol_24314", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Develop a function called \"calculate_power_parity\" in Python that requires two integer input parameters, x and y, and outputs a boolean outcome. This function must first compute the power of x raised to y (x^y), then check for the parity of this result. If the computed result...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_power_parity(2, 4) == True\", \"assert calculate_power_parity(3, 3) == False\", \"assert calculate_power_parity(0, 0) == True\", \"assert calculate_power_parity(-2, 4) == True\", \"assert calculate_power_parity(7, 1) == False\", \"assert calculate_...
{ "split": "train", "index": 66315, "acecode_id": "evol_33383", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the number of tokens for different slaves in a control system, and a dictionary mapping each slave to its number of connections, write a function that calculates the total number of tokens across all slaves. Each slave's tokens are counted ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert total_tokens([10, 5, 0, 8], {'A': 1, 'B': 2, 'C': 0, 'D': 1}) == 23\", \"assert total_tokens([0, 0, 0, 0], {'A': 1, 'B': 1, 'C': 1, 'D': 1}) == 0\", \"assert total_tokens([5, 15, 10], {'A': 1, 'B': 1, 'C': 1}) == 30\", \"assert total_tokens([1, 2, 3], {'A': ...
{ "split": "train", "index": 66316, "acecode_id": "bigcode_python_fns_3439", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string or bytes input, implement a function `ensure_binary(s)` that converts the input into bytes. If the input is of type `str`, it should be encoded to bytes using UTF-8 encoding. If the input is already of type `bytes`, it should be returned as is. If the input is ne...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert ensure_binary('hello') == b'hello'\", \"assert ensure_binary('test string') == b'test string'\", \"assert ensure_binary(b'byte string') == b'byte string'\", \"assert ensure_binary('') == b''\", \"assert isinstance(ensure_binary('hello world'), bytes)\", \"as...
{ "split": "train", "index": 66317, "acecode_id": "bigcode_python_fns_19222", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that retrieves a tournament record based on the tournament name provided. The function should take in the name of the tournament as a string and an optional list of parameters used for filtering the response. The function should return a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_tournament_record('Championship 2023', ['date', 'location']) == {'name': 'Championship 2023', 'date': '2023-07-15', 'location': 'Stadium A'}\", \"assert get_tournament_record('Championship 2023', ['teams', 'prize']) == {'name': 'Championship 2023', 'team...
{ "split": "train", "index": 66318, "acecode_id": "bigcode_python_fns_13826", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given a string representing a time interval, such as '5m' for 5 minutes, write a function that converts this interval into the total number of seconds. The time interval can be specified in minutes (m), hours (h), days (d), or weeks (w). The function should return the total num...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_time_interval_to_seconds('5m') == 300\", \"assert convert_time_interval_to_seconds('1h') == 3600\", \"assert convert_time_interval_to_seconds('2d') == 172800\", \"assert convert_time_interval_to_seconds('1w') == 604800\", \"assert convert_time_interv...
{ "split": "train", "index": 66319, "acecode_id": "bigcode_python_fns_31888", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2D list of integers representing a matrix. Your task is to implement a function `matrix_transpose(matrix: List[List[int]]) -> List[List[int]]` that returns the transpose of the given matrix. The transpose of a matrix is obtained by swapping its rows and columns....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert matrix_transpose([[1, 2, 3], [4, 5, 6]]) == [[1, 4], [2, 5], [3, 6]]\", \"assert matrix_transpose([[1]]) == [[1]]\", \"assert matrix_transpose([[1, 2], [3, 4], [5, 6]]) == [[1, 3, 5], [2, 4, 6]]\", \"assert matrix_transpose([[0, 1, 2], [3, 4, 5]]) == [[0, 3]...
{ "split": "train", "index": 66320, "acecode_id": "oss_20319", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the indices of threads. Your task is to implement a function `check_thread_initialization(indices: List[int]) -> List[bool]` that verifies if each thread is properly initialized based on the following conditions: For each index in t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_thread_initialization([1]) == [True]\", \"assert check_thread_initialization([2]) == [True]\", \"assert check_thread_initialization([3]) == [True]\", \"assert check_thread_initialization([4]) == [True]\", \"assert check_thread_initialization([1, 2]) ==...
{ "split": "train", "index": 66321, "acecode_id": "bigcode_python_fns_43620", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Write a function that takes three strings as input and returns the shortest string without any lowercase vowels ('a', 'e', 'i', 'o', 'u'). If there is a tie in length, return the first string that is shortest without vowels. If any of the input strings are null or empty, return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shortest_string_without_vowels('hello', 'world', 'python') == 'hll'\", \"assert shortest_string_without_vowels('aeiou', 'aeiou', 'aeiou') == 'All strings contain only vowels.'\", \"assert shortest_string_without_vowels('', 'test', 'case') == 'One of the stri...
{ "split": "train", "index": 66322, "acecode_id": "evol_12375", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a list of layers representing an image data, where each layer is a string of pixel values containing '0', '1', or '2'. Your task is to implement a function `decode_image(layers)` that takes this list of layers as input and returns the decoded image as a list of st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decode_image(['222', '222', '222']) == ['222']\", \"assert decode_image(['000', '000', '000']) == [' ']\", \"assert decode_image(['111', '111', '111']) == ['\\u2588\\u2588\\u2588']\", \"assert decode_image(['112', '212', '221']) == ['\\u2588\\u2588\\u2588'...
{ "split": "train", "index": 66323, "acecode_id": "oss_3827", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to perform part-of-speech (POS) tagging on a given input text. The function should accept the following parameters: a string `text` containing the input text, a string `separator` that indicates how to split the input text into words,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert pos_tagging('The quick brown fox jumps over the lazy dog', ' ') == 'The/DET quick/ADJ brown/ADJ fox/NOUN jumps/VERB over/ADP the/DET lazy/ADJ dog/NOUN'\", \"assert pos_tagging('The quick brown', ' ') == 'The/DET quick/ADJ brown/ADJ'\", \"assert pos_tagging('...
{ "split": "train", "index": 66324, "acecode_id": "oss_9704", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a date in ISO 8601 format (YYYY-MM-DD), implement a function that checks if the date is valid. A valid date must adhere to the following rules: 1. The year must be a four-digit number. 2. The month must be a two-digit number between 01 and 12. 3. The...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_date('2023-02-28') == True\", \"assert is_valid_date('2020-02-29') == True\", \"assert is_valid_date('2021-02-29') == False\", \"assert is_valid_date('2023-04-31') == False\", \"assert is_valid_date('2023-12-31') == True\", \"assert is_valid_date('2...
{ "split": "train", "index": 66325, "acecode_id": "bigcode_python_fns_48762", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two lists containing both numbers and strings, implement a function that finds the common elements between the two lists. The comparison should be case-insensitive for strings, and if a value is present in both lists, it should be considered common regardless of its type ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_common_and_sort(['a', 'b', 'c'], ['A', 'B', 'C']) == [['a', 1, 1], ['b', 1, 1], ['c', 1, 1]]\", \"assert find_common_and_sort([1, 2, 3], ['1', '2', '3']) == [['1', 1, 1], ['2', 1, 1], ['3', 1, 1]]\", \"assert find_common_and_sort(['apple', 'banana', 'ch...
{ "split": "train", "index": 66326, "acecode_id": "evol_23092", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of stock returns for a set of securities. Your task is to implement a function that categorizes these securities into two groups: those with low returns and those with high returns. A stock is considered to have low returns if its return is less than or equ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_stocks([0.1, 0.2, 0.3, 0.4]) == ([0.1, 0.2], [0.3, 0.4])\", \"assert categorize_stocks([0.5, 0.5, 0.5]) == ([0.5, 0.5, 0.5], [])\", \"assert categorize_stocks([-1.0, 2.0, 3.0]) == ([-1.0], [2.0, 3.0])\", \"assert categorize_stocks([0.0, 0.0, 0.0])...
{ "split": "train", "index": 66327, "acecode_id": "bigcode_python_fns_8182", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of integers and returns a new list containing only the even numbers from the original list. The order of the even numbers in the output list should be the same as their order in the input list. Implement the function `fi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25]) == [10, 20]\", \"assert filter_even_numbers([-2, -1, 0, 1]) == [-2, 0]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filter_even_numbers([]) ==...
{ "split": "train", "index": 66328, "acecode_id": "oss_2320", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if a given message can be sent through a simple messaging system. The function, `can_send_message(message: str) -> bool`, should simulate the process of sending a message to a server. The function should return `True` if the m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert can_send_message('Hello, World!') == True\", \"assert can_send_message('This is a test message.') == True\", \"assert can_send_message('error in the message') == False\", \"assert can_send_message('This message will fail') == False\", \"assert can_send_messa...
{ "split": "train", "index": 66329, "acecode_id": "oss_8276", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `extract_information` that processes a list of key-value pairs to extract specific information based on a predefined protocol mapping. The protocol mapping is represented as a dictionary, where keys are the field names and values are ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_information([('name', 'Alice'), ('age', 30)], {'name': str, 'age': int}) == {'name': 'Alice', 'age': 30}\", \"assert extract_information([('score', 95), ('passed', True)], {'score': int, 'passed': bool}) == {'score': 95, 'passed': True}\", \"assert e...
{ "split": "train", "index": 66330, "acecode_id": "oss_25693", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `calculate_spectrum` that takes in a list of photon energies and returns a list of adjusted binding energies. The binding energy is calculated by multiplying each photon energy by -1. The function should also apply a broadening effect def...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_spectrum([1.0, 2.0, 3.0], 0.5) == [(1.0, (-1.25, -0.75)), (2.0, (-2.25, -1.75)), (3.0, (-3.25, -2.75))]\", \"assert calculate_spectrum([0.0, 1.0, 2.0], 1.0) == [(0.0, (-0.5, 0.5)), (1.0, (-1.5, -0.5)), (2.0, (-2.5, -1.5))]\", \"assert calculate_spe...
{ "split": "train", "index": 66331, "acecode_id": "bigcode_python_fns_33714", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a scheduling algorithm for a task scheduler. You are given a list of tasks, where each task is represented by a tuple `(priority, arrival_time)`. The priority is an integer representing the importance of the task, and the arrival time is a non-n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert schedule_tasks([(1, 0), (2, 1), (3, 2), (2, 3), (4, 4)]) == [(4, 4), (3, 2), (2, 1), (2, 3), (1, 0)]\", \"assert schedule_tasks([(3, 0), (1, 1), (2, 2)]) == [(3, 0), (2, 2), (1, 1)]\", \"assert schedule_tasks([(1, 0), (1, 1), (1, 2)]) == [(1, 0), (1, 1), (1,...
{ "split": "train", "index": 66332, "acecode_id": "oss_16187", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that formats a URL based on given parameters. The function should take a base URL and an optional dictionary of query parameters. If the dictionary contains keys 'auth_login' and 'auth_password', the function should append these as query ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_url('http://example.com', {'auth_login': 'user', 'auth_password': 'pass'}) == 'http://example.com?auth_login=user&auth_password=pass'\", \"assert format_url('http://example.com', {'sessionToken': 'abc123'}) == 'http://example.com?sessionToken=abc123'\...
{ "split": "train", "index": 66333, "acecode_id": "bigcode_python_fns_22633", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that performs an insertion sort on a given list of integers. The function should take a list of integers as input and return a new list that contains the integers sorted in ascending order using the insertion sort algorithm.\nPlease reason step by step, the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert insertion_sort([5, 2, 9, 1, 5, 6]) == [1, 2, 5, 5, 6, 9]\", \"assert insertion_sort([12, 11, 13, 5, 6]) == [5, 6, 11, 12, 13]\", \"assert insertion_sort([]) == []\", \"assert insertion_sort([1]) == [1]\", \"assert insertion_sort([3, 2]) == [2, 3]\", \"assert...
{ "split": "train", "index": 66334, "acecode_id": "evol_32871", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the lengths of the sides of triangles. Your task is to implement a function `count_valid_triangles(sides: List[int]) -> int` that counts how many valid triangles can be formed with these sides. A valid triangle is defined by the tri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_valid_triangles([3, 4, 5]) == 1\", \"assert count_valid_triangles([1, 1, 1]) == 1\", \"assert count_valid_triangles([5, 10, 25]) == 0\", \"assert count_valid_triangles([1, 2, 3, 4, 5]) == 3\", \"assert count_valid_triangles([8, 15, 17, 20]) == 4\", \"a...
{ "split": "train", "index": 66335, "acecode_id": "bigcode_python_fns_26311", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the depreciated value of a car after a certain number of years. The depreciation model is linear, where the car's value decreases by 10% of its current value each year. Write a function named `calculate_depreciation` that takes three parameters: ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_depreciation('Toyota', 2018, 25000.0, 0) == 25000.0\", \"assert calculate_depreciation('Toyota', 2018, 25000.0, 1) == 22500.0\", \"assert calculate_depreciation('Toyota', 2018, 25000.0, 2) == 20250.0\", \"assert calculate_depreciation('Honda', 2020...
{ "split": "train", "index": 66336, "acecode_id": "oss_13196", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a string representing a file path and a string representing a target file extension. Write a function that checks if the file has the specified extension. The function should return True if the file has the extension, and False otherwise. The extension comparison ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_file_extension('document.pdf', '.pdf') == True\", \"assert check_file_extension('image.jpeg', '.JPEG') == True\", \"assert check_file_extension('archive.zip', '.zip') == True\", \"assert check_file_extension('report.docx', '.doc') == False\", \"assert ...
{ "split": "train", "index": 66337, "acecode_id": "bigcode_python_fns_6479", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a JSON object represented as a dictionary in Python, which contains a key 'hi' with the value 'globe' and a key 'lst' with the value being a list containing a single string 'universe'. Your task is to write a function `modify_json_object(data: dict) -> dict` that ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert modify_json_object({'hi': 'globe', 'lst': ['universe']}) == {'hi': 'globe', 'lst': ['universe', 'universe', 'universe', 'universe']}\", \"assert modify_json_object({'hi': 'world', 'lst': ['universe']}) == {'hi': 'world', 'lst': ['universe', 'universe', 'univ...
{ "split": "train", "index": 66338, "acecode_id": "oss_32805", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers and an integer n. Your task is to implement a function that divides the list into consecutive chunks of size n. If the list cannot be divided evenly, the last chunk may contain fewer than n elements. The function should return a list of these ch...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert chunk_list([1, 2, 3, 4, 5], 2) == [[1, 2], [3, 4], [5]]\", \"assert chunk_list([1, 2, 3, 4, 5], 3) == [[1, 2, 3], [4, 5]]\", \"assert chunk_list([], 2) == []\", \"assert chunk_list([1, 2, 3], 1) == [[1], [2], [3]]\", \"assert chunk_list([10, 20, 30, 40], 4) ...
{ "split": "train", "index": 66339, "acecode_id": "bigcode_python_fns_6158", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `all_combinations(string: str) -> List[str]` that generates a list of all possible combinations of a given string without repeating characters. The combinations should include all lengths from 0 up to the length of the string, and the output list should include...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert all_combinations('DEF') == ['', 'D', 'E', 'F', 'DE', 'DF', 'EF', 'DEF']\", \"assert all_combinations('A') == ['', 'A']\", \"assert all_combinations('AB') == ['', 'A', 'B', 'AB']\", \"assert all_combinations('ABC') == ['', 'A', 'B', 'C', 'AB', 'AC', 'BC', 'AB...
{ "split": "train", "index": 66340, "acecode_id": "evol_27781", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given an array of integers and a list of indices, implement a function that updates the values at the specified indices by adding a given value to them. The function should take three parameters: an array of integers `input`, a list of integers `indices`, and an integer `value`...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert scatter_add([1, 2, 3, 4], [0, 2], 10) == [11, 2, 13, 4]\", \"assert scatter_add([5, 5, 5], [1], 3) == [5, 8, 5]\", \"assert scatter_add([0, 0, 0], [], 5) == [0, 0, 0]\", \"assert scatter_add([1, 2, 3], [3], 5) == [1, 2, 3]\", \"assert scatter_add([-1, -2, -3...
{ "split": "train", "index": 66341, "acecode_id": "bigcode_python_fns_44753", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes an image represented as a 2D list of pixels and downscales it to a target size. The function should accept the original image's width and height, as well as the desired target width and height. The downscaled image should b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert downscale_image([[0, 255], [255, 0]], 2, 2) == [[0, 255], [255, 0]]\", \"assert downscale_image([[100]], 1, 1) == [[100]]\", \"assert downscale_image([[100]], 2, 2) == [[100]]\", \"assert downscale_image([], 2, 2) == []\", \"assert downscale_image([[0, 0], [...
{ "split": "train", "index": 66342, "acecode_id": "bigcode_python_fns_5664", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of cat facts as input and randomly selects one fact from the list. The function should return the selected fact as a string. You may assume that the input list is non-empty.\nPlease reason step by step, then write a self-contained Python solut...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert select_random_fact(['Cats are great pets.', 'Cats sleep for 70% of their lives.', 'A group of cats is called a clowder.']) == 'Cats are great pets.' or 'Cats sleep for 70% of their lives.' or 'A group of cats is called a clowder.'\", \"assert select_random_f...
{ "split": "train", "index": 66343, "acecode_id": "evol_34057", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that dynamically calculates the optimal number of columns for displaying camera feeds in a graphical user interface (GUI). The function should take an integer input representing the number of camera feeds and return the optimal num...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_columns(0) == 0\", \"assert calculate_columns(1) == 1\", \"assert calculate_columns(2) == 2\", \"assert calculate_columns(3) == 3\", \"assert calculate_columns(4) == 4\", \"assert calculate_columns(5) == 5\", \"assert calculate_columns(6) == 6\", \...
{ "split": "train", "index": 66344, "acecode_id": "oss_1205", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of processes, where each process is represented as a list containing three elements: [user, pid, ppid]. Write a function `find_process_in_list(proclist: List[List[Union[str, int]]], pid: int) -> Union[List[Union[str, int]], None]` that searches for a given ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_process_in_list([['user1', 1, 0], ['user2', 2, 1], ['user3', 3, 1]], 2) == ['user2', 2, 1]\", \"assert find_process_in_list([['user1', 1, 0], ['user2', 2, 1], ['user3', 3, 1]], 4) == None\", \"assert find_process_in_list([], 1) == None\", \"assert find_...
{ "split": "train", "index": 66345, "acecode_id": "bigcode_python_fns_18129", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if a specific role-name already exists within a given application based on its app name and a provided list of roles. The function should take three parameters: 'appname' (a string representing the application's name), 'role' ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert role_exists('app1', 'admin', ['user', 'admin', 'viewer']) == True\", \"assert role_exists('app2', 'editor', ['user', 'admin', 'viewer']) == False\", \"assert role_exists('app3', 'user', ['user', 'superuser']) == True\", \"assert role_exists('app4', 'guest', ...
{ "split": "train", "index": 66346, "acecode_id": "bigcode_python_fns_40003", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `print_primes(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 handle cases where `start` is less than 2 by adjusting it to start at 2, as there are no prime numbe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_primes(20, 50) == [23, 29, 31, 37, 41, 43, 47]\", \"assert print_primes(1, 10) == [2, 3, 5, 7]\", \"assert print_primes(10, 30) == [11, 13, 17, 19, 23, 29]\", \"assert print_primes(15, 15) == []\", \"assert print_primes(2, 2) == [2]\", \"assert print_p...
{ "split": "train", "index": 66347, "acecode_id": "evol_18580", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `update_visit(website_section_visits: Dict[str, Dict[str, Union[int, float]]], section: str, duration: float) -> Dict[str, Dict[str, Union[int, float]]]` that updates the visit count and total duration of a specific section of a website. The function should...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_visit({}, 'section1', 5) == {'section1': {'visit_count': 1, 'total_duration': 5}}\", \"assert update_visit({'section1': {'visit_count': 1, 'total_duration': 5}}, 'section1', 10) == {'section1': {'visit_count': 2, 'total_duration': 15}}\", \"assert upd...
{ "split": "train", "index": 66348, "acecode_id": "evol_10460", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You have `k` servers numbered from `0` to `k-1` that are used to handle multiple requests simultaneously. Each server has infinite computational capacity but cannot handle more than one request at a time. The requests are assigned to servers according to a specific algorithm: T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert busiestServers(3, [1,2,3,4,5], [5,2,3,3,3], [1,2,1,2,1]) == [1]\", \"assert busiestServers(3, [1,2,3,4], [1,2,1,2], [1,2,1,2]) == [0]\", \"assert busiestServers(3, [1,2,3], [10,12,11], [1,2,3]) == [0,1,2]\", \"assert busiestServers(3, [1,2,3,4,8,9,10], [5,2,...
{ "split": "train", "index": 66349, "acecode_id": "evol_466", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a challenge process for a user. The function should accept two parameters: a boolean `is_open` which indicates whether the challenge is open or not, and a string `user` which represents the user involved in the challenge. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert challenge_process(True, 'Alice') == {'user': 'Alice', 'is_open': True, 'message': 'Challenge in process'}\", \"assert challenge_process(False, 'Bob') == {'user': 'Bob', 'is_open': False, 'message': 'Challenge not in process'}\", \"assert challenge_process(Tr...
{ "split": "train", "index": 66350, "acecode_id": "bigcode_python_fns_27423", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given three integers: `document_feature_size`, `creator_feature_size`, and `user_feature_size`, write a function `construct_user_rnn_inputs` that returns a list representing the merged input size for a user RNN model. The function should consider the following rules: 1. Always ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert construct_user_rnn_inputs(10, 5, 0) == 15\", \"assert construct_user_rnn_inputs(10, 0, 0) == 10\", \"assert construct_user_rnn_inputs(10, 3, 5) == 18\", \"assert construct_user_rnn_inputs(0, 0, 0) == 0\", \"assert construct_user_rnn_inputs(5, 5, 5) == 15\", ...
{ "split": "train", "index": 66351, "acecode_id": "bigcode_python_fns_11814", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that updates the rank of an object in a list based on its ID. The function should take three parameters: an integer `obj_id` representing the ID of the object, an integer `rank` representing the new rank, and a list of dictionaries `o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_rank(1, 3, [{'id': 1, 'rank': 1}, {'id': 2, 'rank': 2}]) == [{'id': 1, 'rank': 3}, {'id': 2, 'rank': 2}]\", \"assert update_rank(2, 5, [{'id': 1, 'rank': 1}, {'id': 2, 'rank': 2}]) == [{'id': 1, 'rank': 1}, {'id': 2, 'rank': 5}]\", \"assert update_ran...
{ "split": "train", "index": 66352, "acecode_id": "bigcode_python_fns_6831", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a dictionary where each key maps to another dictionary containing lists of integers, implement a function that returns a new dictionary containing only the positive integers from the lists, sorted in ascending order. The structure of the input and output dictionary must r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_positive_and_sort_dict({'a': {'c': [-1, 2, -4]}, 'b': {'d': [5, 6]}}) == {'a': {'c': [2]}, 'b': {'d': [5, 6]}}\", \"assert get_positive_and_sort_dict({'x': {'s': [5, 3, -5, 2, -3, 3, 9, 123, 1, -10]}, 'y': {'w': [-1, 0, -3]}}) == {'x': {'s': [1, 2, 3, 3,...
{ "split": "train", "index": 66353, "acecode_id": "evol_22721", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with extracting a supplier ID from a dictionary that simulates command-line arguments for a supplier management system. Your task is to implement a function `get_supplier_id(args: dict) -> int` that takes a dictionary `args` as input. The dictionary may contain a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_supplier_id({'--supplier-id': '12345'}) == 12345\", \"assert get_supplier_id({'--supplier-id': '0'}) == 0\", \"assert get_supplier_id({'--supplier-id': '99999'}) == 99999\", \"assert get_supplier_id({'--supplier-id': '-1'}) == -1\", \"assert get_supplier...
{ "split": "train", "index": 66354, "acecode_id": "oss_20437", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a simple status checker for experiments. Each experiment can have multiple statuses associated with it. Write a function `check_experiment_status(statuses: List[str]) -> bool` that takes a list of statuses as input and returns `True` if all statuses...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_experiment_status(['CANCELLED', 'CANCELLED', 'CANCELLED']) == True\", \"assert check_experiment_status(['CANCELLED', 'RUNNING', 'CANCELLED']) == False\", \"assert check_experiment_status(['FAILED', 'CANCELLED', 'COMPLETED']) == False\", \"assert check_...
{ "split": "train", "index": 66355, "acecode_id": "bigcode_python_fns_3696", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of objects and checks if all the objects in the list have the same value for a specific attribute called 'tss'. The function should also ensure that the input list is not empty. If the list is empty, the function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_object_list([Object(1), Object(1), Object(1)]) == 'All objects have the same tss value'\", \"assert check_object_list([Object(5), Object(5), Object(5)]) == 'All objects have the same tss value'\", \"assert check_object_list([Object(2)]) == 'All objects...
{ "split": "train", "index": 66356, "acecode_id": "oss_36933", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that converts color values from the Cyan, Magenta, Yellow, and Key (Black) (CMYK) color scale into the corresponding Hexadecimal (HEX) color representation. The function should take four parameters, which are the CMYK values (c, m, y, k) as floating-point numbe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert cmyk_to_hex(0.0, 0.0, 0.0, 0.0) == '#FFFFFF'\", \"assert cmyk_to_hex(0.0, 0.0, 0.0, 1.0) == '#000000'\", \"assert cmyk_to_hex(0.0, 1.0, 0.0, 0.0) == '#FF00FF'\", \"assert cmyk_to_hex(1.0, 0.0, 0.0, 0.0) == '#00FFFF'\", \"assert cmyk_to_hex(0.0, 0.0, 1.0, 0.0...
{ "split": "train", "index": 66357, "acecode_id": "evol_8514", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that filters a list of grades based on whether they are ready for export. The function should take in a list of grades, where each grade is represented as a dictionary containing a 'score' and a 'ready' boolean. Your function should r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_ready_grades([{'score': 90, 'ready': True}, {'score': 85, 'ready': False}]) == [90]\", \"assert filter_ready_grades([{'score': 70, 'ready': True}, {'score': 60, 'ready': True}]) == [70, 60]\", \"assert filter_ready_grades([{'score': 50, 'ready': False...
{ "split": "train", "index": 66358, "acecode_id": "bigcode_python_fns_18516", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes input data based on the number of arguments passed to it. Your function should handle the following scenarios: If only one argument is passed to the function, it should return that argument as is. If multiple argumen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_data('single') == 'single'\", \"assert process_data(1) == 1\", \"assert process_data(3.14) == 3.14\", \"assert process_data(True) == True\", \"assert process_data('first', 'second') == ('first', 'second')\", \"assert process_data('apple', 'banana', '...
{ "split": "train", "index": 66359, "acecode_id": "oss_9787", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a command-line argument parser. The function should accept an optional parameter `formatter_class`. If `formatter_class` is not provided, it should default to `CustomFormatter`. The parser should include various argument gr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert default_arg_parser() is not None\", \"assert isinstance(default_arg_parser(), argparse.ArgumentParser)\", \"assert 'Config' in [group.title for group in default_arg_parser()._action_groups]\", \"assert 'Before' in [group.title for group in default_arg_parser...
{ "split": "train", "index": 66360, "acecode_id": "bigcode_python_fns_41318", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `get_banner_message(conn: dict) -> str` that constructs a banner message based on the provided connection details. The input is a dictionary `conn` with the following keys: 'url', which is a string representing the connection URL, and 'cr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_banner_message({'url': 'http://example.com', 'creds': ['user1']}) == 'Connected to http://example.com as user1\\\\nPress Ctrl-D to exit'\", \"assert get_banner_message({'url': 'http://example.com', 'creds': None}) == 'Connected to http://example.com\\\\n...
{ "split": "train", "index": 66361, "acecode_id": "bigcode_python_fns_19331", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of connection members, where each member has an attribute `atom_type`. Your task is to implement a function that formats and returns the names of the `atom_type` attributes for all connection members as a single string, with each name separated by ' --- '. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_formatted_atom_types_names([Member(None), Member(AtomType('H')), Member(AtomType('O'))]) == ' --- H --- O'\", \"assert get_formatted_atom_types_names([Member(AtomType('C')), Member(None), Member(AtomType('N'))]) == 'C --- --- N'\", \"assert get_formatte...
{ "split": "train", "index": 66362, "acecode_id": "bigcode_python_fns_34902", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `load_unique_messages(messages: List[Tuple[str, str, str, str, str]], unique: bool) -> List[Tuple[str, str, str, str, str]]` that processes a list of message tuples. Each tuple contains five elements: sender, recipients, timestamp, subjec...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert load_unique_messages([('alice@example.com', 'bob@example.com', '2023-01-01 10:00:00', 'Hello', 'Hi Bob!'), ('alice@example.com', 'bob@example.com', '2023-01-01 10:00:00', 'Hello', 'Hi Bob!')], True) == [('alice@example.com', 'bob@example.com', '2023-01-01 10...
{ "split": "train", "index": 66363, "acecode_id": "bigcode_python_fns_9426", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary called 'new_settings' which contains configuration settings for a staging environment. Write a function called 'staging' that takes this dictionary as input and returns a list of keys that are present in the 'new_settings' dictionary. If the dictionar...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert staging({'setting1': 'value1', 'setting2': 'value2', 42: 'value3'}) == ['setting1', 'setting2']\", \"assert staging({'key1': 'val1', 100: 'val2', 'key2': 'val3'}) == ['key1', 'key2']\", \"assert staging({}) == []\", \"assert staging({'a': 1, 'b': 2, 'c': 3})...
{ "split": "train", "index": 66364, "acecode_id": "bigcode_python_fns_9862", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of items and two specified items, implement a function that replaces all occurrences of the first specified item with the second specified item in the list. The function should return a new list with the replacements made, preserving the order of the original list....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replace_item(['apple', 'banana', 'cherry'], 'banana', 'orange') == ['apple', 'orange', 'cherry']\", \"assert replace_item(['apple', 'banana', 'cherry'], 'grape', 'orange') == ['apple', 'banana', 'cherry']\", \"assert replace_item(['apple', 'banana', 'banana'...
{ "split": "train", "index": 66365, "acecode_id": "evol_23573", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement the Karatsuba algorithm for multiplying two non-negative integers. The function should take two integers as input and return their product using the Karatsuba multiplication technique. The function should be optimized for large integers by recursively breaking the num...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert karatsuba_mul(1234, 5678) == 7006652\", \"assert karatsuba_mul(0, 12345) == 0\", \"assert karatsuba_mul(123, 456) == 56088\", \"assert karatsuba_mul(99999, 99999) == 9999800001\", \"assert karatsuba_mul(100, 200) == 20000\", \"assert karatsuba_mul(1, 1) == 1...
{ "split": "train", "index": 66366, "acecode_id": "evol_33898", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `gen_decorate_name(name: str, mangle: bool, cc: str, type: str) -> bool` that simulates the decoration of a name based on certain parameters. The function should return `True` if the name should be decorated based on the following criteri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert gen_decorate_name('testName', True, 'C', 'function') == True\", \"assert gen_decorate_name('testName', True, 'C', 'variable') == True\", \"assert gen_decorate_name('testName', True, 'C++', 'function') == True\", \"assert gen_decorate_name('testName', False, ...
{ "split": "train", "index": 66367, "acecode_id": "bigcode_python_fns_12638", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of numeric values, write a function `multiply_abs_values(lst)` that computes the absolute value of each number, converts these absolute values into their closest lower integers, and then returns the product of these integer numbers. For example, given the input lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multiply_abs_values([2, -3, 4]) == 24\", \"assert multiply_abs_values([1, -5, 9, -3]) == 135\", \"assert multiply_abs_values([0, 0, 0]) == 0\", \"assert multiply_abs_values([-1, -1, -1]) == 1\", \"assert multiply_abs_values([5.9, 3.2, 4.4]) == 60\", \"assert...
{ "split": "train", "index": 66368, "acecode_id": "evol_7968", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with updating a list of records based on specific conditions. Create a function `update_records` that takes a list of records and an update date as input. Each record is represented as a dictionary containing the following fields: `parent`, `paid`, `status`, `fin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_records([{'parent': '1', 'paid': 1, 'status': 'Finished', 'finished_date': '2022-01-01', 'date_paid': '2021-12-31', 'comision_pagada': 0, 'warranty': 0}], '2022-01-02') == [{'parent': '1', 'paid': 1, 'status': 'Finished', 'finished_date': '2022-01-01'...
{ "split": "train", "index": 66369, "acecode_id": "oss_11714", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to filter out None values from a list of gradient values and validate that the number of valid gradients matches a given count of locally aggregated gradients. Implement a function `validate_gradients(grads: List[Union[float, None]], ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_gradients([1.0, None, 2.0, 3.0], 3) == True\", \"assert validate_gradients([None, None, None], 0) == True\", \"assert validate_gradients([1.0, 2.0, 3.0], 3) == True\", \"assert validate_gradients([1.0, None, 2.0, None], 2) == True\", \"assert valida...
{ "split": "train", "index": 66370, "acecode_id": "oss_20292", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the status of a series of devices. Each device can either be '1' (ready) or '0' (not ready). Your task is to implement a function `check_device_status(devices: List[int]) -> str` that checks the status of the devices and returns 'Al...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_device_status([1, 1, 1]) == 'All devices ready'\", \"assert check_device_status([1, 0, 1]) == 'Some devices not ready'\", \"assert check_device_status([0, 0, 0]) == 'Some devices not ready'\", \"assert check_device_status([]) == 'No devices'\", \"asser...
{ "split": "train", "index": 66371, "acecode_id": "oss_31426", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `harmonic_sum(n: int) -> float` that computes the harmonic sum of the first n natural numbers using recursion. The harmonic sum is defined as H(n) = 1 + 1/2 + 1/3 + ... + 1/n. If n is less than 1, the function should return 0.0.\nPlease reason step by step,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert harmonic_sum(1) == 1.0\", \"assert harmonic_sum(2) == 1.5\", \"assert harmonic_sum(3) == 1.8333333333333333\", \"assert harmonic_sum(4) == 2.083333333333333\", \"assert harmonic_sum(5) == 2.283333333333333\", \"assert harmonic_sum(7) == 2.5928571428571425\",...
{ "split": "train", "index": 66372, "acecode_id": "evol_24554", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Design a custom exception class in Python named `SSHTimeoutError` that inherits from another custom exception class called `WolphinException`. The `WolphinException` class is already defined in your codebase. Your task is to create the `SSHTimeoutError` class such that it does ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_ssh_timeout_error_class() is SSHTimeoutError\", \"assert issubclass(SSHTimeoutError, WolphinException)\", \"assert isinstance(SSHTimeoutError(), SSHTimeoutError)\", \"assert isinstance(SSHTimeoutError(), WolphinException)\", \"assert not isinstance(SS...
{ "split": "train", "index": 66373, "acecode_id": "oss_2801", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given an input string, identify each adjacent pair of characters that contains one vowel and one consonant, and then invert their positions while retaining the original location of all other character types. Write a function `invert_positions(input_str: str) -> str` that implem...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert invert_positions('') == ''\", \"assert invert_positions('aeiou') == 'aeiou'\", \"assert invert_positions('bcdfgh') == 'bcdfgh'\", \"assert invert_positions('a') == 'a'\", \"assert invert_positions('zebra') == 'ezbar'\", \"assert invert_positions('ae') == 'ae...
{ "split": "train", "index": 66374, "acecode_id": "evol_27681", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a list of strings, implement a function `validate_nmtokens(nmtokens: List[str]) -> bool` that checks if all strings in the list are valid NMTOKENs according to XML specifications. An NMTOKEN can only contain letters, digits, underscores (_), hyphens (-), and periods (.). ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_nmtokens(['abc', 'def', 'ghi']) == True\", \"assert validate_nmtokens(['abc1', 'def_']) == True\", \"assert validate_nmtokens(['a-b', 'c.d']) == True\", \"assert validate_nmtokens(['abcde1', 'gh']) == False\", \"assert validate_nmtokens(['', 'a']) =...
{ "split": "train", "index": 66375, "acecode_id": "bigcode_python_fns_36318", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a datetime object representing a specific date and time, write a function `shortdateformat(value: datetime) -> str` that returns a string representing the date in the format 'DD Month' (e.g., '25 July') without leading zeros in the day. The input `value` will always be a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shortdateformat(datetime.strptime('2018-07-25 10:15:00', '%Y-%m-%d %H:%M:%S')) == '25 July'\", \"assert shortdateformat(datetime.strptime('2020-01-01 00:00:00', '%Y-%m-%d %H:%M:%S')) == '1 January'\", \"assert shortdateformat(datetime.strptime('1999-12-31 23...
{ "split": "train", "index": 66376, "acecode_id": "bigcode_python_fns_43445", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list as input and returns a tuple containing the first and last values of the list. If the list is empty, the function should return the string 'List is empty'.\nPlease reason step by step, then write a self-contained Python solution. Give your...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert first_and_last([1, 2, 3, 4, 5]) == (1, 5)\", \"assert first_and_last(['a', 'b', 'c']) == ('a', 'c')\", \"assert first_and_last([True, False]) == (True, False)\", \"assert first_and_last([1.1, 2.2, 3.3]) == (1.1, 3.3)\", \"assert first_and_last(['first', 'mid...
{ "split": "train", "index": 66377, "acecode_id": "evol_10751", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string, determine if it contains any rare typographical symbols. The rare symbols to check for are: ©, ®, ™, ¶, and §. Implement a function named `contains_rare_symbols` that takes a single string parameter and returns a boolean value indicating whether any of the rare ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert contains_rare_symbols('This is a normal string without any special symbols.') == False\", \"assert contains_rare_symbols('This string contains a \\u00a9 symbol.') == True\", \"assert contains_rare_symbols('No rare symbols here!') == False\", \"assert contain...
{ "split": "train", "index": 66378, "acecode_id": "evol_35431", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `find_street(address: str) -> str` that takes a string representing a residential or business location and returns the street name found in the address. The street name is defined as the sequence of characters following the first occurrence of a number and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_street('123 Main St') == 'Main St'\", \"assert find_street('456 Elm Avenue') == 'Elm Avenue'\", \"assert find_street('789 Broadway') == 'Broadway'\", \"assert find_street('10 Downing Street') == 'Downing Street'\", \"assert find_street('1001 First St') ...
{ "split": "train", "index": 66379, "acecode_id": "evol_14281", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a dictionary with string keys and integer values, and returns a new dictionary sorted by the values in ascending order. The original dictionary should remain unchanged. For example, given the input {'Alice': 4, 'Bob': 2, 'Charlie': 3}, the output...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reorder_dictionary({'Jerry': 10, 'Marcus': 3, 'Hanna': 5}) == {'Marcus': 3, 'Hanna': 5, 'Jerry': 10}\", \"assert reorder_dictionary({'Alice': 4, 'Bob': 2, 'Charlie': 3}) == {'Bob': 2, 'Charlie': 3, 'Alice': 4}\", \"assert reorder_dictionary({'Zoe': 1, 'Yara'...
{ "split": "train", "index": 66380, "acecode_id": "evol_15552", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `fibonacci(n)` that generates the Fibonacci series starting from the initial term of 1 and returns a list containing the first n terms of the series. The function should accept an integer n (1 ≤ n ≤ 30) and return a list of integers representing the Fibonacci s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci(1) == [1]\", \"assert fibonacci(2) == [1, 1]\", \"assert fibonacci(3) == [1, 1, 2]\", \"assert fibonacci(4) == [1, 1, 2, 3]\", \"assert fibonacci(5) == [1, 1, 2, 3, 5]\", \"assert fibonacci(6) == [1, 1, 2, 3, 5, 8]\", \"assert fibonacci(7) == [1, 1...
{ "split": "train", "index": 66381, "acecode_id": "evol_6700", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `is_prime(n: int) -> bool` that determines whether a given integer n is a prime number. A prime number is defined as a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. If n is less than 2, the function should r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_prime(0) == False\", \"assert is_prime(1) == False\", \"assert is_prime(2) == True\", \"assert is_prime(3) == True\", \"assert is_prime(4) == False\", \"assert is_prime(5) == True\", \"assert is_prime(6) == False\", \"assert is_prime(7) == True\", \"asser...
{ "split": "train", "index": 66382, "acecode_id": "evol_17533", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement the merge sort algorithm to sort a given list of integers in ascending order. The function should take a list as input and return a new list that contains all the elements from the input list sorted in ascending order. For example, if the input list is [9, 4, 6, 2, 12...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_sort([9, 4, 6, 2, 12, 15, 11, 5, 7, 10, 8, 13, 1, 3, 14]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\", \"assert merge_sort([5, 1, 4, 2, 8]) == [1, 2, 4, 5, 8]\", \"assert merge_sort([]) == []\", \"assert merge_sort([3]) == [3]\", \"assert ...
{ "split": "train", "index": 66383, "acecode_id": "evol_20455", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `select_coins(coins, target)` that selects a combination of coins to reach a target sum. The input `coins` is a list of dictionaries, where each dictionary represents a coin with a key `amount` indicating its value (an integer). The `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert select_coins([{ 'amount': 1 }, { 'amount': 2 }, { 'amount': 3 }], 5) == [{'amount': 2}, {'amount': 3}]\", \"assert select_coins([{ 'amount': 5 }, { 'amount': 10 }, { 'amount': 15 }], 20) == [{'amount': 5}, {'amount': 15}]\", \"assert select_coins([{ 'amount'...
{ "split": "train", "index": 66384, "acecode_id": "oss_14019", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function `generate_prime_matrix(rows: int, cols: int) -> List[List[int]]` that constructs a matrix of prime numbers with the specified number of rows and columns. The function should return a list of lists, where each inner list represents a row of the matrix filled wit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_prime_matrix(3, 5) == [[2, 3, 5, 7, 11], [13, 17, 19, 23, 29], [31, 37, 41, 43, 47]]\", \"assert generate_prime_matrix(1, 1) == [[2]]\", \"assert generate_prime_matrix(2, 2) == [[2, 3], [5, 7]]\", \"assert generate_prime_matrix(4, 4) == [[2, 3, 5, 7...
{ "split": "train", "index": 66385, "acecode_id": "evol_27185", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with generating a promotion API name based on certain attributes. Implement a function `generate_api_name` that takes the following parameters: \n1. `generate_weapp_webview`: A boolean indicating whether to generate a link to open the WeChat client. \n2. `gener...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_api_name(False, None, None, []) == 'pdd.ddk.theme.prom.url.generate'\", \"assert generate_api_name(True, True, '123456', [1, 2]) == 'pdd.ddk.theme.prom.url.generate'\", \"assert generate_api_name(False, False, '789012', [3]) == 'pdd.ddk.theme.prom.u...
{ "split": "train", "index": 66386, "acecode_id": "oss_13348", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a recursive function that takes a numerical score as input and returns a string based on the following criteria: If the score is between 75 and 100 (inclusive), return 'Passed'. If the score is between 71 and 74 (inclusive), return 'Borderline'. If the score is below ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert evaluate(100) == 'Passed'\", \"assert evaluate(80) == 'Passed'\", \"assert evaluate(75) == 'Passed'\", \"assert evaluate(74) == 'Borderline'\", \"assert evaluate(73) == 'Borderline'\", \"assert evaluate(71) == 'Borderline'\", \"assert evaluate(69) == 'Failed...
{ "split": "train", "index": 66387, "acecode_id": "evol_36212", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that segregates groups of balanced parentheses from a given string. The function should accept a string containing nested parentheses and a boolean flag indicating whether to handle imbalanced input. If the flag is set to True, the function should skip imba...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_paren_groups('( ) (( )) (( )( ))', True) == (['()', '(())', '(()())'], {'Total segregated groups': 3, 'Imbalanced equations': 0, 'Character Count - Longest Group': 6})\", \"assert parse_paren_groups('((()))', True) == (['((()))'], {'Total segregated gr...
{ "split": "train", "index": 66388, "acecode_id": "evol_6751", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a list of lists, where each sublist contains two integers. Implement a function `complex_sort(lst)` that sorts the sublists based on the following criteria: 1. Sublists where both integers are even go into an 'even' list, sublists where both integers are odd go in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert complex_sort([]) == []\", \"assert complex_sort([[0, 0], [4, 4], [2, 2], [1, 1], [3, 3]]) == [[0, 0], [2, 2], [4, 4], [1, 1], [3, 3]]\", \"assert complex_sort([[10, 20], [30, 40], [15, 25]]) == [[10, 20], [30, 40], [15, 25]]\", \"assert complex_sort([[5, 5],...
{ "split": "train", "index": 66389, "acecode_id": "evol_20301", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given a document represented by its name and version. Your task is to write a function that takes in the document's name and version, and returns the version of the document. Additionally, you need to implement two helper functions: one to set the date when the document...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert document_version('Document A', 'v1.0') == 'v1.0'\", \"assert document_version('Document B', 'v2.1') == 'v2.1'\", \"assert document_version('Document C', 'v3.2.1') == 'v3.2.1'\", \"assert document_version('Report', 'v1.0') == 'v1.0'\", \"assert document_versi...
{ "split": "train", "index": 66390, "acecode_id": "oss_23804", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing pixel data represented as a 2D list (matrix) of integers. Your goal is to apply a specific operation to the pixel data based on a boolean flag. Implement a function `process_pixel_data(pixel_matrix: List[List[int]], apply_operation: bool) -> List[...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_pixel_data([[1, 2], [3, 4]], True) == [[2, 4], [6, 8]]\", \"assert process_pixel_data([[1, 2], [3, 4]], False) == [[1, 2], [3, 4]]\", \"assert process_pixel_data([[0]], True) == [[0]]\", \"assert process_pixel_data([[0]], False) == [[0]]\", \"assert ...
{ "split": "train", "index": 66391, "acecode_id": "oss_19069", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a cigar string representing a sequence alignment (e.g., '50M25N50M'), and a starting position on a chromosome, return a list of integers that represent the start and end positions of the matching subsequences based on the cigar string. Each match is inclusive, so all posi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert cigar_segment_bounds('5M5N5M', 10) == [10, 14, 20, 24]\", \"assert cigar_segment_bounds('1M1N1M1N1M', 0) == [0, 0, 2, 2, 4, 4]\", \"assert cigar_segment_bounds('3M7N3M', 50) == [50, 52, 60, 62]\", \"assert cigar_segment_bounds('4M4N4M4N4M', 0) == [0, 3, 8, 1...
{ "split": "train", "index": 66392, "acecode_id": "bigcode_python_fns_18635", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given two integers 'n' and 'm', write a function that computes the factorial of 'n' and returns the result of the factorial modulo 'm'.\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 factorial_mod(5, 2) == 0\", \"assert factorial_mod(6, 7) == 6\", \"assert factorial_mod(1, 1) == 0\", \"assert factorial_mod(10, 5) == 0\", \"assert factorial_mod(3, 4) == 2\"]}" }
{ "split": "train", "index": 66393, "acecode_id": "evol_1277", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with moving a lever named 'lever_name' to a random position between 1.0 and 3.9. Write a function `move_lever_to_random_position(lever_name: str) -> float` that takes a string `lever_name` as input and returns a float representing the position of the lever after ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert move_lever_to_random_position('lever1') >= 1.0 and move_lever_to_random_position('lever1') <= 3.9\", \"assert move_lever_to_random_position('lever2') >= 1.0 and move_lever_to_random_position('lever2') <= 3.9\", \"assert move_lever_to_random_position('lever3'...
{ "split": "train", "index": 66394, "acecode_id": "bigcode_python_fns_19442", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that manages a deployment system for a serverless application. The function should take in a list of integrations, a deployment ID, a stage, and a list of outputs. Your goal is to create a deployment record that includes the deploymen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_deployment(['integration1'], 'deploy1', 'dev', [('lambda_function', 'myLambda'), ('api_url', 'wss://myapi.example.com')]) == {'deploy_id': 'deploy1', 'stage': 'dev', 'outputs': {'lambda_function': 'myLambda', 'api_url': 'wss://myapi.example.com'}}\", ...
{ "split": "train", "index": 66395, "acecode_id": "oss_30284", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the retrieval of the latest 5 messages from a specified topic in a messaging service. The function should take a list of messages as input and return the last 5 messages from that list. If there are fewer than 5 messages, r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_latest_messages(['Message 1', 'Message 2']) == ['Message 1', 'Message 2']\", \"assert get_latest_messages(['Only one message']) == ['Only one message']\", \"assert get_latest_messages([]) == []\", \"assert get_latest_messages(['One', 'Two', 'Three', 'Fou...
{ "split": "train", "index": 66396, "acecode_id": "oss_27354", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a list of integers, your task is to create a function `count_even_numbers(nums: List[int]) -> int` that counts the number of even integers in the given list. An even integer is defined as any integer that is completely divisible by 2. The input list can contain both posit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_even_numbers([1, 2, 3, 4, 5]) == 2\", \"assert count_even_numbers([-2, -1, 0, 1, 2]) == 3\", \"assert count_even_numbers([]) == 0\", \"assert count_even_numbers([7, 9, 11]) == 0\", \"assert count_even_numbers([2, 4, 6, 8, 10]) == 5\", \"assert count_ev...
{ "split": "train", "index": 66397, "acecode_id": "bigcode_python_fns_45565", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to calculate the average value of a given list of numbers in batches. Your function should take a list of floating-point numbers, an integer representing the size of each batch, and an integer representing the number of epochs. The fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_batch_averages([10.0, 20.0, 30.0, 40.0], 2, 1) == [15.0, 35.0]\", \"assert calculate_batch_averages([1.5, 2.5, 3.5, 4.5, 5.5, 6.5], 3, 1) == [2.5, 5.5]\", \"assert calculate_batch_averages([1.0, 4.0, 7.0, 10.0], 4, 1) == [5.5]\", \"assert calculate...
{ "split": "train", "index": 66398, "acecode_id": "oss_24780", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are analyzing job placement data for individuals over various time periods. The data is structured as a dictionary of dictionaries, where the outer dictionary keys represent different time periods (0, 1, 2, ...), and the inner dictionaries contain the probabilities of vario...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert average_hiring_probability({0: {'is_hired_1mo': 0.9, 'is_unemployed': 0.1, 'lost_job_1mo': 0.05, 'job_search': 0.8, 'job_offer': 0.7}, 1: {'is_hired_1mo': 0.8, 'is_unemployed': 0.2, 'lost_job_1mo': 0.1, 'job_search': 0.6, 'job_offer': 0.5}}) == 0.85\", \"ass...
{ "split": "train", "index": 66399, "acecode_id": "oss_34454", "num_tests": 13 }