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 dictionary called TYPESTUW that maps unique integers to corresponding names of dam types. Your task is to implement a function `get_dam_type_id(current_name: str) -> int` that takes a string `current_name` as input and returns its corresponding unique integer ID...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_dam_type_id('Gravity') == 1\", \"assert get_dam_type_id('Arch') == 2\", \"assert get_dam_type_id('Buttress') == 3\", \"assert get_dam_type_id('Embankment') == 4\", \"assert get_dam_type_id('NonExistentType') == 99\", \"assert get_dam_type_id('Gravity') =...
{ "split": "train", "index": 77400, "acecode_id": "bigcode_python_fns_24264", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string `s` that may contain consecutive duplicate characters. Your task is to implement a function `collapse_duplicates` that takes this string as input and returns a new string where all consecutive duplicate characters are collapsed into a single character. Fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert collapse_duplicates('aaabbbcccd') == 'abcd'\", \"assert collapse_duplicates('hello') == 'helo'\", \"assert collapse_duplicates('mississippi') == 'misisipi'\", \"assert collapse_duplicates('aabbcc') == 'abc'\", \"assert collapse_duplicates('') == ''\", \"asse...
{ "split": "train", "index": 77401, "acecode_id": "oss_11385", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of user objects, where each user object contains a username and a list of posts associated with that user. Your task is to implement a function called `get_user_posts(user_list, username)` that retrieves all posts for a user with the specified username. If ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_user_posts([{'username': 'alice', 'posts': ['post1', 'post2']}, {'username': 'bob', 'posts': ['post3']}], 'alice') == ['post1', 'post2']\", \"assert get_user_posts([{'username': 'alice', 'posts': ['post1', 'post2']}, {'username': 'bob', 'posts': ['post3'...
{ "split": "train", "index": 77402, "acecode_id": "oss_11175", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function named `describe_artwork` that takes three parameters: a string `title`, a string `genre`, and a string `description`. The function should return a formatted string that combines these three parameters into a single description of the artwork in the following fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert describe_artwork('Starry Night', 'Post-Impressionism', 'A painting by Vincent van Gogh that depicts a night sky filled with swirling clouds and bright stars.') == 'Title: Starry Night, Genre: Post-Impressionism, Description: A painting by Vincent van Gogh th...
{ "split": "train", "index": 77403, "acecode_id": "evol_7071", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to create a unique feed group identifier for a social media platform. The function `create_feed_group(username: str, tag: str) -> str` takes in a username and a tag, and returns a unique group ID based on these inputs. To create the g...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_feed_group('user123', 'mytag') == 'user123_mytag'\", \"assert create_feed_group('username', 'tag') == 'username_tag'\", \"assert create_feed_group('longusername1234567890', 'tag') == 'longusername1234567890_tag'\", \"assert create_feed_group('user', '...
{ "split": "train", "index": 77404, "acecode_id": "oss_27522", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python module dependency resolver. Given a list of Python module dependencies and their relationships, your goal is to create a function that returns the order in which the modules should be imported to satisfy all dependencies. You are provid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert resolve_dependencies({'a': [], 'b': ['a'], 'c': ['b']}) == ['a', 'b', 'c'] or ['a', 'c', 'b'] or ['b', 'a', 'c'] or ['b', 'c', 'a'] or ['c', 'b', 'a'] or ['c', 'a', 'b']\", \"assert resolve_dependencies({'mod1': [], 'mod2': ['mod1'], 'mod3': ['mod1'], 'mod4'...
{ "split": "train", "index": 77405, "acecode_id": "oss_12474", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design and implement a function in Python that takes two arguments: a variable (an integer or float) and a list of integers. The function should calculate the sum of the elements in the list with the given variable. It should handle potential errors gracefully by returning appr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manipulate_variables(10, [1, 2, 3]) == 16\", \"assert manipulate_variables(5.5, [1, 2, 3, 4]) == 15.5\", \"assert manipulate_variables(0, []) == 'Error: The list is empty.'\", \"assert manipulate_variables(7, [1, 2, 'three']) == 'Error: The list contains non...
{ "split": "train", "index": 77406, "acecode_id": "evol_8798", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `calc_mean(lst)` that takes a list of numbers as input and returns the mean value of all the elements in the list. The mean is calculated as the sum of the elements divided by the number of elements. If the list is empty, the function should return 0.\nPlea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_mean([1, 2, 3, 4, 5]) == 3.0\", \"assert calc_mean([10, 20, 30]) == 20.0\", \"assert calc_mean([-1, -2, -3]) == -2.0\", \"assert calc_mean([0, 0, 0]) == 0.0\", \"assert calc_mean([5]) == 5.0\", \"assert calc_mean([1.5, 2.5, 3.5]) == 2.5\", \"assert calc...
{ "split": "train", "index": 77407, "acecode_id": "evol_26703", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a custom error-handling system for a file processing module in a Python application. Your task is to implement a function named `handle_error` that takes an error code as an argument and returns a descriptive error message corresponding to the provi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_error(-2) == 'Error: Index or position is out of range'\", \"assert handle_error(-3) == 'Error: Cannot write to the file'\", \"assert handle_error(-4) == 'Error: File size is missing or cannot be determined'\", \"assert handle_error(-5) == 'Error: Can...
{ "split": "train", "index": 77408, "acecode_id": "oss_23172", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `start_timer` that accepts a variable number of string arguments representing names for timers. The function should return the current timestamp in seconds since the epoch. If no names are provided, use a default name 'default_timer'. The function should st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert start_timer('A') >= 0\", \"assert start_timer('B') >= 0\", \"assert start_timer() >= 0\", \"assert start_timer('C', 'D') >= 0\", \"assert start_timer('E') >= 0\", \"assert start_timer('default') >= 0\", \"assert start_timer('F', 'G', 'H') >= 0\", \"assert st...
{ "split": "train", "index": 77409, "acecode_id": "bigcode_python_fns_22599", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of integers and returns a new list containing only the integers that are not divisible by 7.\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 remove_divisible_by_7([28, 12, 49, 33]) == [12, 33]\", \"assert remove_divisible_by_7([7, 14, 21, 28]) == []\", \"assert remove_divisible_by_7([1, 2, 3, 4, 5, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert remove_divisible_by_7([-1, -2, -3, -4, -5]) == [-1, -2, -3, -...
{ "split": "train", "index": 77410, "acecode_id": "evol_16490", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `find_unique_pairs_with_zero_difference` that returns a list containing the first unique pair of integers (a, b) such that a - b = 0. If no such pair exists, return an empty list. The output should include the pair in the order they ap...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_unique_pairs_with_zero_difference([1, 2, 3, 4]) == []\", \"assert find_unique_pairs_with_zero_difference([1, 2, 3, 4, 5]) == []\", \"assert find_unique_pairs_with_zero_difference([]) == []\", \"assert find_unique_pairs_with_zero_difference([5, 4, 3, 2, ...
{ "split": "train", "index": 77411, "acecode_id": "evol_12704", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of class labels, implement a function that converts the class labels from scalars to one-hot vectors. The function should take in a list of integers representing the class labels and return a tuple containing two elements: the first element is a 2D list (or array) ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert dense_to_one_hot([0, 1, 2]) == ([[1, 0, 0], [0, 1, 0], [0, 0, 1]], {0: 0, 1: 1, 2: 2})\", \"assert dense_to_one_hot([]) == ([], {})\", \"assert dense_to_one_hot([2, 2, 0, 1]) == ([[0, 0, 1], [0, 0, 1], [1, 0, 0], [0, 1, 0]], {2: 2, 0: 0, 1: 1})\", \"assert d...
{ "split": "train", "index": 77412, "acecode_id": "bigcode_python_fns_40295", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given an array of strings, implement a function that transforms the array into a dictionary where each string is mapped to its corresponding index in the array. The keys of the dictionary should be the indices of the strings in the array, and the values should be the strings th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert array_to_dict(['A', 'B', 'C']) == {0: 'A', 1: 'B', 2: 'C'}\", \"assert array_to_dict(['Hello', 'World']) == {0: 'Hello', 1: 'World'}\", \"assert array_to_dict(['Python', 'is', 'fun']) == {0: 'Python', 1: 'is', 2: 'fun'}\", \"assert array_to_dict(['Leet', 'Co...
{ "split": "train", "index": 77413, "acecode_id": "evol_35772", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array 'numbers' constituted of N random integers (which may include negative integers and repetitive entries), determine if it is possible to form a sorted array with unique elements by using the following operations: inverting any subarray multiple times, removing any...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_sort_advanced([5, -4, 3, 1, -2, 2]) == False\", \"assert custom_sort_advanced([1, 2, 3]) == True\", \"assert custom_sort_advanced([-1, -2, -3, -4]) == True\", \"assert custom_sort_advanced([]) == True\", \"assert custom_sort_advanced([10, 20, 10]) == ...
{ "split": "train", "index": 77414, "acecode_id": "evol_28450", "num_tests": 8 }
acecode
[ { "role": "user", "content": "In a book club, there are six friends, each with a unique favorite genre of book. The genres are: mystery, romance, fantasy, historical novels, thrillers, and sci-fi. Given a dictionary mapping each friend's name to their favorite genre, implement a function that determines whi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_scifi_reader({'Alice': 'mystery', 'Ben': 'romance', 'Caleb': 'fantasy', 'Diana': 'historical novels', 'Ella': 'thrillers', 'Frank': 'sci-fi'}) == 'Frank'\", \"assert get_scifi_reader({'Alice': 'mystery', 'Ben': 'romance', 'Caleb': 'fantasy', 'Diana': 'hi...
{ "split": "train", "index": 77415, "acecode_id": "evol_27282", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the time intervals (in minutes) between events, implement a function that calculates and returns the frequency of each unique interval in the list. The output should be a dictionary where the keys are the unique intervals and the values are...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert frequency_intervals([1, 2, 2, 3, 4]) == {1: 1, 2: 2, 3: 1, 4: 1}\", \"assert frequency_intervals([5, 5, 5, 5, 5]) == {5: 5}\", \"assert frequency_intervals([]) == {}\", \"assert frequency_intervals([10, 20, 10, 30, 20]) == {10: 2, 20: 2, 30: 1}\", \"assert f...
{ "split": "train", "index": 77416, "acecode_id": "bigcode_python_fns_30632", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a binary tree, implement a function that performs both in-order and pre-order traversals of the tree. The function should return a list containing the results of both traversals. The first half of the list should contain the results of the in-order traversal, and the seco...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert traverse_tree(None) == []\", \"assert traverse_tree(TreeNode(1)) == [1, 1]\", \"assert traverse_tree(TreeNode(1, TreeNode(2), TreeNode(3))) == [2, 1, 3, 1, 2, 3]\", \"assert traverse_tree(TreeNode(1, None, TreeNode(2))) == [1, 2, 1, 2]\", \"assert traverse_t...
{ "split": "train", "index": 77417, "acecode_id": "oss_28659", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of bending forces, where each entry is a list consisting of three integers representing indices of atoms (1-based indexing), followed by a floating-point number representing the external force applied to that bend. Your task is to process this list and dete...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_bends([[1, 2, 3, 0.5], [3, 1, 2, 0.7], [4, 5, 6, 1.0]]) == 2\", \"assert count_unique_bends([[1, 2, 3, 0.1], [2, 1, 3, 0.2]]) == 1\", \"assert count_unique_bends([[1, 1, 1, 0.5], [1, 1, 1, 0.7]]) == 1\", \"assert count_unique_bends([[1, 2, 3, 0....
{ "split": "train", "index": 77418, "acecode_id": "bigcode_python_fns_17242", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given two strings, determine if the first string is a palindrome using a custom-built function (without using any built-in reverse or palindrome-checking functions). If it is, return 1. If not, check if the second string is a palindrome. If it is, return -1. If neither string i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_string('radar', 'level') == 1\", \"assert check_string('hello', 'world') == 0\", \"assert check_string('madam', 'test') == 1\", \"assert check_string('python', 'noon') == -1\", \"assert check_string('abc', 'def') == 0\", \"assert check_string('racecar'...
{ "split": "train", "index": 77419, "acecode_id": "evol_34316", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that converts pressure measurements from the SI unit Pascal to the non-SI unit Bar. The function should take a single integer or float parameter representing the pressure in Pascals and return the equivalent pressure in Bar. Recall that 1 Bar is equal to 10...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert pascal_to_bar(0) == 0.0\", \"assert pascal_to_bar(100000) == 1.0\", \"assert pascal_to_bar(200000) == 2.0\", \"assert pascal_to_bar(500000) == 5.0\", \"assert pascal_to_bar(1000000) == 10.0\", \"assert pascal_to_bar(50000) == 0.5\", \"assert pascal_to_bar(12...
{ "split": "train", "index": 77420, "acecode_id": "evol_35902", "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 unique integers from the input list, preserving the order of their first occurrence. Implement the function `get_unique_numbers(arr: List[int]) -> List[int]` where `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_unique_numbers([1, 2, 3, 2, 1, 4]) == [1, 2, 3, 4]\", \"assert get_unique_numbers([5, 5, 5, 5]) == [5]\", \"assert get_unique_numbers([]) == []\", \"assert get_unique_numbers([10, 20, 10, 30, 20, 40]) == [10, 20, 30, 40]\", \"assert get_unique_numbers([1...
{ "split": "train", "index": 77421, "acecode_id": "bigcode_python_fns_28637", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of clusters, where each cluster is represented as a dictionary containing the following keys: 'quadrant', 'n_cluster', 'n_total', 'x', and 'y'. Your task is to implement a function `filter_realistic_clusters(clusters: List[Dict[str, Union[int, float]]], min...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_realistic_clusters([{'quadrant': 1, 'n_cluster': 10, 'n_total': 20, 'x': 0.8, 'y': 0.8}, {'quadrant': 2, 'n_cluster': 5, 'n_total': 15, 'x': 0.3, 'y': 0.7}], 0.4, 0.1) == [{'quadrant': 1, 'n_cluster': 10, 'n_total': 20, 'x': 0.8, 'y': 0.8}]\", \"asser...
{ "split": "train", "index": 77422, "acecode_id": "bigcode_python_fns_31671", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Write a python function that takes a list of numbers as input. Your task is to return a tuple containing the sum of all the numbers in the list and the sum of the squares of all the numbers in the list. If the list is empty, both sums should be 0. Handle lists that contain both...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_sum_and_squares([1, 2, 3, 4, 5]) == (15, 55)\", \"assert calculate_sum_and_squares([]) == (0, 0)\", \"assert calculate_sum_and_squares([-1, -2, -3]) == (-6, 14)\", \"assert calculate_sum_and_squares([0]) == (0, 0)\", \"assert calculate_sum_and_squa...
{ "split": "train", "index": 77423, "acecode_id": "evol_19605", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of version strings and returns the latest version number. The version strings are in the format 'x.y.z', where x, y, and z are non-negative integers representing the major, minor, and patch versions, respectiv...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert latest_version(['1.0.3', '2.1.1', '0.9.5', '1.3.0']) == '2.1.1'\", \"assert latest_version(['1.2.3', '1.2.4', '1.2.3']) == '1.2.4'\", \"assert latest_version(['0.0.1', '0.0.0']) == '0.0.1'\", \"assert latest_version(['1.0.0', '1.0.0', '1.0.0']) == '1.0.0'\",...
{ "split": "train", "index": 77424, "acecode_id": "oss_33328", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a JSON representation of a multi-agent system. Given a list of agents, variables, and constraints, you need to implement a function `create_json_instance(name: str, agts: List[int], vars: Dict[str, Dict[str, Union[int, str]]], doms: List[List[int]],...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_json_instance('instance1', [1, 2], {'1': {'agt': 1, 'dom': 0}, '2': {'agt': 2, 'dom': 1}}, [[0, 1], [2, 3]], [{'scope': [1, 2], 'values': [{'cost': 1}, {'cost': 2}]}]) == {'variables': {'v1': {'value': None, 'domain': [0, 1], 'agent': 'a1', 'type': 1,...
{ "split": "train", "index": 77425, "acecode_id": "bigcode_python_fns_35099", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple function that takes a list of integers and returns a new list containing only the even integers from the original list. Your function should not modify the original list and should maintain the order of the even integers as they appeare...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5, 6]) == [2, 4, 6]\", \"assert filter_even_numbers([10, 15, 20, 25]) == [10, 20]\", \"assert filter_even_numbers([0, -1, -2, -3]) == [0, -2]\", \"assert filter_even_numbers([-1, -3, -5]) == []\", \"assert filter_even_numbers...
{ "split": "train", "index": 77426, "acecode_id": "oss_9332", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `textual_sequence` and a character `symbol`, substitute each instance of `symbol` within `textual_sequence` with a blank space. Return the modified string along with the total count of substitutions made. The function signature is: `def substitute_symbol(textual_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert substitute_symbol('abcde', 'c') == ('ab de', 1)\", \"assert substitute_symbol('hello world', 'o') == ('hell w rld', 2)\", \"assert substitute_symbol('example', 'z') == ('example', 0)\", \"assert substitute_symbol('', 'a') == ('', 0)\", \"assert substitute_s...
{ "split": "train", "index": 77427, "acecode_id": "evol_11572", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Develop a function `calculate_statistics` that takes a list of ten numerical inputs and returns a dictionary containing the mean, median, and mode of these numbers. The function should handle cases where the input list does not contain exactly ten numbers by returning None. If ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_statistics([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == {'mean': 5.5, 'median': 5.5, 'mode': None}\", \"assert calculate_statistics([10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == {'mean': 10.0, 'median': 10.0, 'mode': 10}\", \"assert calculate_statistics([1, ...
{ "split": "train", "index": 77428, "acecode_id": "evol_28375", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a function that can be retried a certain number of times when it fails. Implement a function `retry_function` that takes the following parameters: `func` (the function to be retried), `tries` (the maximum number of attempts), `delay` (initial delay between attempt...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert retry_function(lambda: 1, 3, 1, 5, 2, 0) == 1\", \"assert retry_function(lambda: 1/0, 1, 1, 5, 2, 1) is None\", \"assert retry_function(lambda: 1, 1, 0, None, 1, 0) == 1\", \"assert retry_function(lambda: 1/0, -1, 1, 5, 1, 0) is None\", \"assert retry_functi...
{ "split": "train", "index": 77429, "acecode_id": "bigcode_python_fns_37488", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a `ServerCoordinator` object, determine if it has a master server based on the following criteria: the `ServerCoordinator` should not have a master server assigned (`master` should be `None`) and it should have a valid `master_url`. Write a function `has_master(server_coo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_master(ServerCoordinator(None, 'http://example.com')) == True\", \"assert has_master(ServerCoordinator(None, '')) == False\", \"assert has_master(ServerCoordinator('MasterServer', 'http://example.com')) == False\", \"assert has_master(ServerCoordinator('...
{ "split": "train", "index": 77430, "acecode_id": "bigcode_python_fns_34530", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings, implement a function that finds the longest common substring shared among all the strings in the list. If there is no common substring, return an empty string. The function signature is: def longest_common_substring(strings: List[str]) -> str.\nPlease r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert longest_common_substring(['commonstring', 'anycommonstring', 'longestcommonstring']) == 'commonstring'\", \"assert longest_common_substring(['abcdef', 'ghijkl', 'mnopqr']) == ''\", \"assert longest_common_substring(['python', 'pythonic', 'pythons']) == 'pyth...
{ "split": "train", "index": 77431, "acecode_id": "evol_525", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a string of alphanumeric characters, implement a function that converts the string into its corresponding hexadecimal numerical representation. The string will be a valid representation of a non-negative integer. The output should be a string that starts with '0x' followe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert to_hexadecimal('10') == '0xa'\", \"assert to_hexadecimal('255') == '0xff'\", \"assert to_hexadecimal('4095') == '0xfff'\", \"assert to_hexadecimal('1') == '0x1'\", \"assert to_hexadecimal('0') == '0x0'\", \"assert to_hexadecimal('16') == '0x10'\", \"assert t...
{ "split": "train", "index": 77432, "acecode_id": "evol_24776", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the heights of a group of people, write a function `max_height_difference(heights: List[int]) -> int` that calculates the maximum difference in height between any two people in the group. The function should return the maximum height differ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_height_difference([1, 2, 3, 4, 5]) == 4\", \"assert max_height_difference([5, 10, 15]) == 10\", \"assert max_height_difference([1]) == 0\", \"assert max_height_difference([]) == 0\", \"assert max_height_difference([3, 3, 3]) == 0\", \"assert max_height_d...
{ "split": "train", "index": 77433, "acecode_id": "bigcode_python_fns_7130", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that computes the power of a given n x n matrix to a specified integer exponent. The matrix is represented as a 2D list, and the output should be the resulting matrix after raising the input matrix to the given power. The function should handle positive int...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert matrix_power([[1, 2], [3, 4]], 2, 2) == [[7, 10], [15, 22]]\", \"assert matrix_power([[2, 0], [0, 2]], 2, 3) == [[8, 0], [0, 8]]\", \"assert matrix_power([[1, 1], [1, 1]], 2, 1) == [[1, 1], [1, 1]]\", \"assert matrix_power([[0, 0], [0, 0]], 2, 5) == [[0, 0],...
{ "split": "train", "index": 77434, "acecode_id": "evol_11225", "num_tests": 11 }
acecode
[ { "role": "user", "content": "At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by `bills`). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must provide the correct change ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lemonadeChange([5, 5, 5, 10, 20], 5, 2) == True\", \"assert lemonadeChange([5, 10, 5, 20], 3, 2) == True\", \"assert lemonadeChange([5, 5, 5, 5, 10, 20], 10, 5) == True\", \"assert lemonadeChange([10, 5], 0, 1) == False\", \"assert lemonadeChange([5, 20, 20,...
{ "split": "train", "index": 77435, "acecode_id": "evol_19071", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python package for a data processing application. Write a function `create_setup_file` that takes the following parameters: `name` (str), `version` (str), `author` (str), `author_email` (str), `description` (str), `packages` (list of str), `includ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_setup_file('data-processing', '1.0.0', 'Your Name', 'your@email.com', 'A Python package for data processing', ['module1', 'module2'], True, True, ['psycopg2>=2.5.2'], '') == {'name': 'data-processing', 'version': '1.0.0', 'author': 'Your Name', 'autho...
{ "split": "train", "index": 77436, "acecode_id": "oss_18369", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that simulates a simple banking operation. The function, `bank_operations`, takes in a list of operations where each operation is represented by a dictionary containing the keys 'operation' (either 'deposit' or 'withdraw'), 'amount' (the a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bank_operations([{'operation': 'deposit', 'amount': 100, 'initial_balance': 0}]) == (100.0, 1)\", \"assert bank_operations([{'operation': 'withdraw', 'amount': 50, 'initial_balance': 100}]) == (50.0, 1)\", \"assert bank_operations([{'operation': 'withdraw', ...
{ "split": "train", "index": 77437, "acecode_id": "oss_36042", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a JSON data structure representing a messaging interface. The JSON contains a list of messages, each with a list of actions. Each action has an 'action' type and a 'label'. Your task is to implement a function that extracts the labels of all actions where the acti...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_web_link_labels('{\\\"messages\\\":[{\\\"actions\\\":[{\\\"action\\\":\\\"webLink\\\",\\\"label\\\":\\\"Visit our website\\\",\\\"webLinkUrl\\\":\\\"https://example.com\\\"},{\\\"action\\\":\\\"text\\\",\\\"label\\\":\\\"Click here\\\",\\\"messageTex...
{ "split": "train", "index": 77438, "acecode_id": "oss_268", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_average(numbers)` that takes a list of elements as input and returns the average of all numeric values in the list. If the list is empty, return 'The input list is empty'. If the list contains non-numeric values, return 'The input list contains n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average([]) == 'The input list is empty'\", \"assert calculate_average(['a', 'b', 'c']) == 'The input list contains non-numeric values'\", \"assert calculate_average([1, 2, 3]) == 2.0\", \"assert calculate_average([1, 'a', 3]) == 'The input list co...
{ "split": "train", "index": 77439, "acecode_id": "evol_20360", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given a list of strings representing daily minimum temperatures recorded in Melbourne, Australia, along with their corresponding dates. Each string may contain an invalid temperature value represented by a question mark (?). Your task is to preprocess this list by conve...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert preprocess_temperatures(['?', '?', '?']) == []\", \"assert preprocess_temperatures(['5', '10', '15']) == [5, 10, 15]\", \"assert preprocess_temperatures(['?']) == []\", \"assert preprocess_temperatures(['1', '2', '3', '4', '5']) == [1, 2, 3, 4, 5]\", \"asser...
{ "split": "train", "index": 77440, "acecode_id": "bigcode_python_fns_2782", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that checks whether a given string representing an animal and a string representing a food item satisfy a specific condition. The condition is that the first character of the animal's name must be the same as the first character of th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_matching('cat', 'carrot') == True\", \"assert is_matching('elephant', 'egg') == False\", \"assert is_matching('bear', 'bake') == False\", \"assert is_matching('shark', 'soup') == False\", \"assert is_matching('rabbit', 'rice') == False\", \"assert is_matc...
{ "split": "train", "index": 77441, "acecode_id": "oss_30885", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that manages a collection of URLs associated with different novels. Your function should take two strings as input: `id_or_url` which is either a unique identifier for the novel or a URL associated with the novel, and `new_url`, which is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_url('novel123', 'http://example.com/novel123') == 'URL added successfully.'\", \"assert add_url('novel123', 'http://example.com/novel456') == 'URL added successfully.'\", \"assert add_url('novel456', 'http://example.com/novel456') == 'URL added successfu...
{ "split": "train", "index": 77442, "acecode_id": "bigcode_python_fns_35581", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of entries where each entry is represented as a dictionary containing 'ID', 'Title', and 'Location', implement a function `filter_entries(entries: List[Dict[str, Union[int, str]]], allowed_locations: List[str]) -> List[Dict[str, Union[int, str]]]` that removes entr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_entries([{'ID': 14, 'Title': 'Grace', 'Location': 'Brazil'}, {'ID': 15, 'Title': 'Hank', 'Location': 'France'}], ['Australia', 'Brazil']) == [{'ID': 14, 'Title': 'Grace', 'Location': 'Brazil'}]\", \"assert filter_entries([{'ID': 6, 'Title': 'Ivy', 'Lo...
{ "split": "train", "index": 77443, "acecode_id": "evol_8384", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a dictionary representing metadata of a journal article, which includes the following keys: 'codiceIdentificativo' (a unique identifier), 'titolo' (the title of the article), and optionally 'numeri' (a list of identifiers). Your task is to implement a function tha...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_journal_metadata({'codiceIdentificativo': '67890', 'titolo': 'Another Journal/Research', 'numeri': []}) == {'short_title': 'Another Journal', 'full_title': 'Another Journal/Research', 'bid': '67890', 'sbn_link': 'http://id.sbn.it/bid/67890', 'identif...
{ "split": "train", "index": 77444, "acecode_id": "bigcode_python_fns_5958", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that selects a random word from a predefined list of words. The function should be named `get_random_word` and it should not take any parameters. When called, it should return a single random word from the list: ['apple', 'banana', 'cherr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_random_word() in ['apple', 'banana', 'cherry', 'date', 'elderberry']\", \"assert get_random_word() in ['apple', 'banana', 'cherry', 'date', 'elderberry']\", \"assert get_random_word() in ['apple', 'banana', 'cherry', 'date', 'elderberry']\", \"assert get...
{ "split": "train", "index": 77445, "acecode_id": "oss_8055", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that validates user registration input. The function will accept a dictionary containing user registration details, specifically 'username', 'email', 'password1', 'password2', and 'recaptcha_response'. The function should perform the foll...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_registration({'username': 'testUser', 'email': 'test@example.com', 'password1': 'Password123!', 'password2': 'Password123!', 'recaptcha_response': 'valid'}) == {'status': True, 'message': 'Registration successful!'}\", \"assert validate_registration...
{ "split": "train", "index": 77446, "acecode_id": "bigcode_python_fns_39745", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a dictionary `bands` containing brainwave frequency bands and their corresponding frequency ranges. Each key in the dictionary represents a brainwave frequency band, and the value associated with each key is a list containing the lower and upper bounds of the freq...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_band(9.5, {'theta': [4.0, 8.0], 'alpha1': [7.0, 10.0], 'alpha2': [10.0, 13.0], 'alpha': [7.0, 13.0], 'mu': [8.0, 13.0], 'beta': [13.0, 25.0], 'gamma': [25.0, 40.0]}) == 'alpha1'\", \"assert find_band(5.0, {'theta': [4.0, 8.0], 'alpha1': [7.0, 10.0], 'al...
{ "split": "train", "index": 77447, "acecode_id": "oss_12286", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Create a Python function to convert a decimal number representing an amount in a specified currency to another currency format. The function should handle conversions between USD, EUR, and JPY based on the following rates: 1 USD = 0.85 EUR = 110.35 JPY. The function should retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_currency(100, 'USD', 'EUR') == '85.00'\", \"assert convert_currency(100, 'USD', 'JPY') == '11035.00'\", \"assert convert_currency(100, 'EUR', 'USD') == '117.65'\", \"assert convert_currency(100, 'EUR', 'JPY') == '12982.35'\", \"assert convert_currenc...
{ "split": "train", "index": 77448, "acecode_id": "evol_8804", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Construct a Python function that determines the most significant absent prime number from a given list of unique prime numbers in ascending order. If all prime numbers up to the largest prime in the list are present, return None.\nPlease reason step by step, then write a self-c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert most_significant_absent_prime([2, 3, 5, 7]) == 11\", \"assert most_significant_absent_prime([2, 3, 5, 7, 11]) == 13\", \"assert most_significant_absent_prime([2, 3, 5]) == 7\", \"assert most_significant_absent_prime([2, 3, 5, 11, 13, 17]) == 19\", \"assert m...
{ "split": "train", "index": 77449, "acecode_id": "evol_15262", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the creation of a virtual machine. The function should take the following parameters: name (string), hostname (string), endpoints (list of strings), ssh_cert_path (string), user (string), password (string), location (string...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_virtual_machine('vm2', 'vm2.cloudapp.net', ['80', '443'], None, 'user2', 'password2', 'West US', 'Standard_B2s', 'storageaccount', 'image2', 'vnet2', True, 30) == (True, 'vm2.cloudapp.net')\", \"assert create_virtual_machine('vm1', 'vm1.cloudapp.net',...
{ "split": "train", "index": 77450, "acecode_id": "bigcode_python_fns_2228", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of tour IDs and deletes them from a tour management system. The function should return a list of statuses indicating whether each deletion was successful or not. If the tour ID exists in the provided list, the functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert delete_tours([1, 2, 3]) == ['deleted tour', 'deleted tour', 'deleted tour']\", \"assert delete_tours([4, 5, 6]) == ['tour not found', 'tour not found', 'tour not found']\", \"assert delete_tours([1, 4]) == ['deleted tour', 'tour not found']\", \"assert delet...
{ "split": "train", "index": 77451, "acecode_id": "bigcode_python_fns_4609", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple server response parser for a custom protocol. The server responds with either a success message or an error message. Your goal is to implement a function `parse_response(response: str) -> Union[Success, Error]` that takes a string respo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_response('HD c1=1 c2=2') == Success({'c1': 1, 'c2': 2})\", \"assert parse_response('ER Invalid command') == Error('Invalid command')\", \"assert parse_response('HD c1=0') == Success({'c1': 0})\", \"assert parse_response('ER Connection lost') == Error('...
{ "split": "train", "index": 77452, "acecode_id": "oss_7069", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with constructing a server error reply message based on a given input message. Your function should take a string message as input and return a new string that combines a predefined header with the input message formatted as an error reply. The header is a consta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_error_reply('Database connection lost') == 'Error: Server Failure - Database connection lost'\", \"assert generate_error_reply('User not found') == 'Error: Server Failure - User not found'\", \"assert generate_error_reply('Invalid request format') =...
{ "split": "train", "index": 77453, "acecode_id": "bigcode_python_fns_8429", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a two-dimensional matrix populated with integers, implement a function that determines the largest difference between the smallest and largest numerical elements in the entire matrix. Your function should only consider the overall minimum and maximum values in the matrix ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert matrix_disparity([[1, 2, 3], [4, 5, 6]]) == 5\", \"assert matrix_disparity([[5, 5, 5], [5, 5, 5]]) == 0\", \"assert matrix_disparity([[0, -1, -2], [-3, -4, -5]]) == 5\", \"assert matrix_disparity([[10, 20], [30, 40]]) == 30\", \"assert matrix_disparity([[1]]...
{ "split": "train", "index": 77454, "acecode_id": "evol_17243", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with designing a function that determines if a given set of rules is defined for a game. The function should take a list of rules as input and return `True` if there are any rules defined in the list, and `False` otherwise. Implement a function named `has_rules(r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_rules([]) == False\", \"assert has_rules(['Rule 1']) == True\", \"assert has_rules(['Rule 1', 'Rule 2']) == True\", \"assert has_rules(['']) == True\", \"assert has_rules(['Rule 1', '']) == True\", \"assert has_rules(['Rule 2']) == True\", \"assert has_r...
{ "split": "train", "index": 77455, "acecode_id": "oss_28036", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string representing a PokerStove-style name of holecards. Your task is to implement a function that translates this name into an expanded list of poker hands in a specific format. The input string can represent either a pair of cards or a suited/offsuit combinat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert translate_holecards('AKs') == ['Ac Kc', 'Ad Kd', 'Ah Kh', 'As Ks']\", \"assert translate_holecards('QKs') == ['Qc Kc', 'Qd Kd', 'Qh Kh', 'Qs Ks']\", \"assert translate_holecards('53s') == ['5c 3c', '5d 3d', '5h 3h', '5s 3s']\", \"assert translate_holecards('...
{ "split": "train", "index": 77456, "acecode_id": "bigcode_python_fns_21265", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a given string by removing all spaces from it. Additionally, if a specific character length is provided, the function should ensure that the resulting string matches this length. If the length does not match, the function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert ensure_format('hello world') == 'helloworld'\", \"assert ensure_format(' a b c ') == 'abc'\", \"assert ensure_format('remove spaces') == 'removespaces'\", \"assert ensure_format(' test string ') == 'teststring'\", \"assert ensure_format(' leading and t...
{ "split": "train", "index": 77457, "acecode_id": "bigcode_python_fns_39431", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that returns a list of desired attributes for a specific API named 'fpolicy-policy-status-info'. Your function should be named 'get_desired_attrs' and should return a list of strings representing the desired attributes for this API. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_desired_attrs() == ['policy_name', 'status', 'last_modified', 'rules_count']\", \"assert len(get_desired_attrs()) == 4\", \"assert 'policy_name' in get_desired_attrs()\", \"assert 'status' in get_desired_attrs()\", \"assert 'last_modified' in get_desired...
{ "split": "train", "index": 77458, "acecode_id": "oss_30127", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `is_subset(main_dict: dict, subset_dict: dict) -> bool` that checks if every key in the `subset_dict` is present in the `main_dict`. The function should return `True` if all keys in `subset_dict` are found in `main_dict`, and `False` otherwise.\nPlease reason s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_subset({'first':1, 'second':2, 'third':3, 'fourth':4, 'fifth':5}, {'second':2, 'third':3, 'fifth':5}) == True\", \"assert is_subset({'a': 1, 'b': 2, 'c': 3}, {'b': 2}) == True\", \"assert is_subset({'x': 10, 'y': 20, 'z': 30}, {'x': 10, 'a': 1}) == False\...
{ "split": "train", "index": 77459, "acecode_id": "evol_14975", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the downloading of survey responses. The function `download_responses(survey_id: int) -> str` should take an integer `survey_id` as input and return a string containing the survey responses in CSV format. Each survey re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert download_responses(1) == '1,John Doe,Yes\\\\n2,Jane Smith,No'\", \"assert download_responses(2) == '3,Alice Johnson,Maybe\\\\n4,Bob Brown,Yes'\", \"assert download_responses(3) == '5,Charlie Davis,No\\\\n6,Diana Prince,Yes'\", \"assert download_responses(4) ...
{ "split": "train", "index": 77460, "acecode_id": "bigcode_python_fns_23625", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `rate_limit_exceeded(user_requests: List[int], limit: int, interval: int) -> bool`. This function should determine if a user has exceeded a specified rate limit of requests within a given time interval. The `user_requests` list contai...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rate_limit_exceeded([1, 2, 3, 4, 5], 3, 5) == True\", \"assert rate_limit_exceeded([1, 2, 3, 6, 7], 3, 5) == False\", \"assert rate_limit_exceeded([1, 2, 3, 4, 5, 6, 7, 8], 5, 10) == True\", \"assert rate_limit_exceeded([1, 2, 11, 12, 13], 3, 10) == False\",...
{ "split": "train", "index": 77461, "acecode_id": "bigcode_python_fns_36400", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a complex number in the form of `a + bj`, where `a` and `b` are real numbers and `j` is the imaginary unit. Your task is to write a function that takes this complex number as input and returns its magnitude and phase. The magnitude of a complex number `c` is calcu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert complex_magnitude_and_phase(3, 4) == (5.00, 0.93)\", \"assert complex_magnitude_and_phase(1, 0) == (1.00, 0.00)\", \"assert complex_magnitude_and_phase(0, 1) == (1.00, 1.57)\", \"assert complex_magnitude_and_phase(-1, 0) == (1.00, 3.14)\", \"assert complex_m...
{ "split": "train", "index": 77462, "acecode_id": "oss_22838", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simple air quality sensor. The sensor produces analog values that represent the air quality level. Your task is to implement a function `get_air_quality_value(pin: int) -> int` that, given an integer pin number (representing the sensor's pin), r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_air_quality_value(0) in range(0, 1024)\", \"assert get_air_quality_value(1) in range(0, 1024)\", \"assert get_air_quality_value(2) in range(0, 1024)\", \"assert get_air_quality_value(3) in range(0, 1024)\", \"assert get_air_quality_value(4) in range(0, 1...
{ "split": "train", "index": 77463, "acecode_id": "oss_9260", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a token, return the length of the token if the token is valid (i.e., it contains only alphanumeric characters). If the token is invalid, return -1. A token is considered valid if it consists of at least one character and does not include spaces or sp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_token_length('abc123') == 6\", \"assert validate_token_length('') == -1\", \"assert validate_token_length(' ') == -1\", \"assert validate_token_length('token@2023') == -1\", \"assert validate_token_length('validToken123') == 13\", \"assert validat...
{ "split": "train", "index": 77464, "acecode_id": "bigcode_python_fns_18674", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function called `filter_even_numbers` that takes a string of comma-separated numbers as input. The function should return a list of even numbers extracted from the input string. The function should not use the built-in filter function of Python and should implement ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers('1,2,3,4,5,6') == [2, 4, 6]\", \"assert filter_even_numbers('10,15,20,25') == [10, 20]\", \"assert filter_even_numbers('abc,2,3,4') == []\", \"assert filter_even_numbers('') == []\", \"assert filter_even_numbers('7,8,9') == [8]\", \"asser...
{ "split": "train", "index": 77465, "acecode_id": "evol_28035", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that checks whether a given string is a palindrome. A palindrome is a string that reads the same backward as forward, ignoring case. Write a function `is_palindrome(s: str) -> bool` that takes a string `s` as input and returns `True` if `s` is a palindrome,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome('malayalam') == True\", \"assert is_palindrome('racecar') == True\", \"assert is_palindrome('A man a plan a canal Panama') == False\", \"assert is_palindrome('No lemon no melon') == False\", \"assert is_palindrome('Was it a car or a cat I saw?'...
{ "split": "train", "index": 77466, "acecode_id": "evol_35097", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to validate the structure of an order model for an e-commerce platform based on a JSON representation. The order model consists of various attributes such as order ID, customer details, items in the order, total price, and shipping in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_order_model({\\\"order_id\\\": \\\"12345\\\", \\\"customer\\\": {\\\"name\\\": \\\"John Doe\\\", \\\"email\\\": \\\"johndoe@example.com\\\", \\\"address\\\": \\\"123 Main St\\\"}, \\\"items\\\": [{\\\"item_id\\\": \\\"item001\\\", \\\"name\\\": \\\"...
{ "split": "train", "index": 77467, "acecode_id": "oss_35813", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Alice and Bob are playing a game with piles of stones represented by an integer array `stoneValue`. They take turns picking 1, 2, or 3 stones from the start of the array. Alice goes first. The objective is to have the highest score, which is the sum of the values of the stones ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert stoneGameIII([1, 2, 3, 7]) == 'Bob'\", \"assert stoneGameIII([1, 2, 3, -9]) == 'Alice'\", \"assert stoneGameIII([1, 2, 3, 6]) == 'Tie'\", \"assert stoneGameIII([1, 2, 3, -1, -2, -3, 7]) == 'Alice'\", \"assert stoneGameIII([-1, -2, -3]) == 'Tie'\", \"assert s...
{ "split": "train", "index": 77468, "acecode_id": "evol_13640", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that validates a given JSON object against a predefined schema. The schema is represented as a Python dictionary and follows a specific structure. Each key in the schema represents a property, and its corresponding value is ano...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_json({'name': {'type': 'string'}, 'age': {'type': 'number'}}, {'name': 'Jane Smith', 'age': '25'}) == False\", \"assert validate_json({'isActive': {'type': 'boolean'}}, {'isActive': 'yes'}) == False\", \"assert validate_json({'name': {'type': 'strin...
{ "split": "train", "index": 77469, "acecode_id": "oss_6460", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that verifies the structure and content of a JSON Web Token (JWT) in a specific payload format. Given a JWT as a string, your function should decode it and check that it contains the following required fields: 'at_hash', 'aud', 'auth_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert verify_jwt('{\\\"at_hash\\\": \\\"hash1\\\", \\\"aud\\\": \\\"test-audience\\\", \\\"auth_time\\\": 1625450736, \\\"avatar_url\\\": null, \\\"client\\\": \\\"test client\\\", \\\"email\\\": \\\"user@example.com\\\", \\\"email_verified\\\": true, \\\"exp\\\":...
{ "split": "train", "index": 77470, "acecode_id": "bigcode_python_fns_39813", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that represents a credit card as a string format. The function should take the following parameters: a credit card number (as a string), an expiration month (as a string), an expiration year (as a string), a first name (as a string), a la...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert credit_card_to_string('4111111111111111', '02', '2012', 'John', 'Doe', '911') == '<CreditCard -- John Doe, visa, ************1111, expires: 02/2012>'\", \"assert credit_card_to_string('5111111111111118', '01', '2025', 'Jane', 'Smith', '123') == '<CreditCard ...
{ "split": "train", "index": 77471, "acecode_id": "bigcode_python_fns_22361", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of Python version strings and returns a list of messages based on the version number. The function should handle the given Python versions and produce the expected output as follows: \n1. If the version is less than ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_python_versions(['2.7', '3.4', '3.5', '3.6']) == ['Legacy Python version: 2.7', 'Legacy Python version: 3.4', 'Legacy Python version: 3.5', 'Python 3.6 is supported']\", \"assert process_python_versions(['3.7', '3.8', '3.9']) == ['Future Python versi...
{ "split": "train", "index": 77472, "acecode_id": "oss_3507", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string as input and breaks it into a list of non-empty lines. The function should return a list of strings, where each string is a line from the input string. Lines are defined as segments of text separated by newline charact...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_lines('Hello\\\\nWorld') == ['Hello', 'World']\", \"assert extract_lines('\\\\nLine1\\\\n\\\\nLine2') == ['Line1', 'Line2']\", \"assert extract_lines('') == []\", \"assert extract_lines('\\\\n\\\\n') == []\", \"assert extract_lines('Single line') == ...
{ "split": "train", "index": 77473, "acecode_id": "bigcode_python_fns_2804", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a matrix represented as a list of lists, write a function `invert_options` that returns the dimensions of the matrix as a tuple (rows, columns). If the input is a sparse matrix, represented as a boolean flag, return the dimensions of a default sparse matrix (0, 0). The fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert invert_options([[1, 2], [3, 4]]) == (2, 2)\", \"assert invert_options([[1]]) == (1, 1)\", \"assert invert_options([]) == (0, 0)\", \"assert invert_options([[1, 2, 3], [4, 5, 6]]) == (2, 3)\", \"assert invert_options([[1, 0], [0, 1], [1, 1]]) == (3, 2)\", \"a...
{ "split": "train", "index": 77474, "acecode_id": "bigcode_python_fns_10425", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers and a target sum value, implement a function that returns all unique pairs of integers from the list that add up to the target sum. Each pair should be represented as a tuple and the results should be returned as a list of tuples. If no such pairs exist...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_pairs([1, 1, 1, 1], 2) == [(1, 1)]\", \"assert find_pairs([1, 2, 3, 4, 5], 10) == []\", \"assert find_pairs([2, 2, 2, 2], 4) == [(2, 2)]\", \"assert find_pairs([10, 20, 30, 40], 50) == [(10, 40), (20, 30)]\", \"assert find_pairs([], 5) == []\", \"assert...
{ "split": "train", "index": 77475, "acecode_id": "evol_2968", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple library management system for handling book records. Each book is represented as a dictionary with the following keys: 'id', 'title', 'author', and 'year'. Your function should take a list of book dictionaries and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_recent_books([{'id': 1, 'title': 'Book A', 'author': 'Author A', 'year': 2020}, {'id': 2, 'title': 'Book B', 'author': 'Author B', 'year': 2019}], 2020) == []\", \"assert get_recent_books([{'id': 1, 'title': 'Book A', 'author': 'Author A', 'year': 2020}]...
{ "split": "train", "index": 77476, "acecode_id": "oss_15222", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function named `encrypt` that takes a string and a numerical rotation as arguments. The function should return an encrypted string using a rotated alphabet. The rotation is determined by squaring the rotation number, and the function should maintain the case of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert encrypt('Hello', 1) == 'Ifmmp'\", \"assert encrypt('abc DEF', 1) == 'bcd EFG'\", \"assert encrypt('Test Input!', 0) == 'Test Input!'\", \"assert encrypt('1234 #$%', 5) == '1234 #$%'\", \"assert encrypt('Shift', 1) == 'Tijgu'\", \"assert encrypt('Spaces ', 1...
{ "split": "train", "index": 77477, "acecode_id": "evol_4989", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Implement a function `process_data(data: List[str]) -> List[str]` that takes a list of string data as input, processes each string to ensure it meets certain criteria (non-empty and contains only alphanumeric characters), and returns a list of valid strings. If a string does no...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_data(['hello', 'world']) == ['hello', 'world']\", \"assert process_data(['123', 'abc', 'A1B2C3']) == ['123', 'abc', 'A1B2C3']\", \"assert process_data(['', 'test', ' ']) == ['test']\", \"assert process_data(['validString', 'invalid_string!', 'anothe...
{ "split": "train", "index": 77478, "acecode_id": "evol_16160", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks the health of a hardware component based on its CPU and memory usage. The function will take in two parameters: `cpu_usage` (an integer representing the CPU usage percentage) and `memory_usage` (an integer representing the mem...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_hardware_status(50, 70) == {'status': 'healthy', 'message': 'System is operating normally.'}\", \"assert check_hardware_status(80, 50) == {'status': 'warning', 'message': 'Resource usage is high, consider monitoring.'}\", \"assert check_hardware_status...
{ "split": "train", "index": 77479, "acecode_id": "bigcode_python_fns_43782", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that performs specific mathematical operations based on the input arguments. The function should be able to handle both positional and keyword arguments. The function should support the following operations based on the input argument...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert execute() == 0\", \"assert execute(5) == 25\", \"assert execute(2, 3) == 5\", \"assert execute(1.5, 2.5) == 4.0\", \"assert execute(1, 2, 3, 4) == 10\", \"assert execute(1, 2, 3, operation='product') == 6\", \"assert execute(2, 3, 4, operation='product') == ...
{ "split": "train", "index": 77480, "acecode_id": "oss_24881", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of dictionaries representing background elements, each containing properties such as 'bgtype', 'size', 'color', and 'position', write a function `generate_background_xml(elements: List[Dict[str, Any]]) -> str` that generates an XML string representation of these ba...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_background_xml([{'bgtype': 'BgImage', 'size': [100, 200], 'color': [255, 255, 255], 'position': [0, 0]}]) == '<BgImages><BgImage><Size width=\\\"100\\\" height=\\\"200\\\"/><Color r=\\\"255\\\" g=\\\"255\\\" b=\\\"255\\\"/><Location left=\\\"0\\\" t...
{ "split": "train", "index": 77481, "acecode_id": "bigcode_python_fns_4535", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Write a function `roll_multiple_dice(dice_sides: List[int]) -> int` that takes a list of integers representing the number of sides on each die (where each integer is greater than 1) and returns the sum of the results when all dice are rolled. The function should simulate the ro...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert roll_multiple_dice([6, 6, 6]) >= 3 and roll_multiple_dice([6, 6, 6]) <= 18\", \"assert roll_multiple_dice([4, 4]) >= 2 and roll_multiple_dice([4, 4]) <= 8\", \"assert roll_multiple_dice([10]) >= 1 and roll_multiple_dice([10]) <= 10\", \"assert roll_multiple_...
{ "split": "train", "index": 77482, "acecode_id": "evol_20005", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple Python function that initializes and returns a dictionary representing the attributes of a custom controller. The function should take two parameters, `attribute1` and `attribute2`, and create a dictionary with keys 'attribute1' and 'at...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_custom_controller('value1', 'value2') == {'attribute1': 'value1', 'attribute2': 'value2'}\", \"assert initialize_custom_controller('test', 'data') == {'attribute1': 'test', 'attribute2': 'data'}\", \"assert initialize_custom_controller('foo', 'bar...
{ "split": "train", "index": 77483, "acecode_id": "oss_7899", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Transform a sparse two-dimensional matrix into a JSON-like format, where you only store non-null/non-zero elements along with their indices. Implement a function `matrix_to_json(matrix)` that takes a 2D list of integers (matrix) and returns a list of dictionaries. Each dictiona...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert matrix_to_json([[1, 0, 3], [0, 5, 0], [7, 0, 9]]) == [{'row': 0, 'col': 0, 'value': 1}, {'row': 0, 'col': 2, 'value': 3}, {'row': 1, 'col': 1, 'value': 5}, {'row': 2, 'col': 0, 'value': 7}, {'row': 2, 'col': 2, 'value': 9}]\", \"assert matrix_to_json([[0, 0,...
{ "split": "train", "index": 77484, "acecode_id": "evol_24701", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `mutual_elements(array1, array2)` that takes two distinct ordered collections (arrays) of integers and returns a list of mutual entities present in both arrays. The result should maintain the order of first appearance from the first array. You cannot use an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mutual_elements([2, 4, 6, 12, 14], [3, 4, 6, 11, 14]) == [4, 6, 14]\", \"assert mutual_elements([1, 2, 3], [4, 5, 6]) == []\", \"assert mutual_elements([], [1, 2, 3]) == []\", \"assert mutual_elements([1, 2, 3], []) == []\", \"assert mutual_elements([10, 20,...
{ "split": "train", "index": 77485, "acecode_id": "evol_1288", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of employee salaries and doubles each salary in the list. Implement a function named `double_salaries` that takes a list of integers `salaries` representing the salaries of employees and returns a new list where each sal...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert double_salaries([1000, 2000, 3000]) == [2000, 4000, 6000]\", \"assert double_salaries([0]) == [0]\", \"assert double_salaries([]) == []\", \"assert double_salaries([-1000, -2000]) == [-2000, -4000]\", \"assert double_salaries([1, 2, 3, 4]) == [2, 4, 6, 8]\",...
{ "split": "train", "index": 77486, "acecode_id": "oss_37444", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a singly linked list represented by the ListNode class. Your task is to implement the function `insertionSortList(head)` that sorts the linked list in ascending order using the insertion sort algorithm. The ListNode class has the following structure: \n\nclass Lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert insertionSortList(ListNode.fromList([4, 2, 1, 3])).toList() == [1, 2, 3, 4]\", \"assert insertionSortList(ListNode.fromList([5, 1, 4, 2, 8])).toList() == [1, 2, 4, 5, 8]\", \"assert insertionSortList(ListNode.fromList([1, 2, 3, 4, 5])).toList() == [1, 2, 3, ...
{ "split": "train", "index": 77487, "acecode_id": "oss_25019", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a dictionary where the keys are strings, implement a function `check_dict_case(dct)` that checks the case of the keys. The function should return: 'Lower' if all keys are in lowercase, 'Upper' if all keys are in uppercase, 'Number' if all keys start with a numerical value...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_dict_case({}) == 'Empty'\", \"assert check_dict_case({'1': 'value'}) == 'Number'\", \"assert check_dict_case({'A': 'value', 'B': 'data'}) == 'Upper'\", \"assert check_dict_case({'a': 'value', 'b': 'data'}) == 'Lower'\", \"assert check_dict_case({'a': '...
{ "split": "train", "index": 77488, "acecode_id": "evol_5602", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that processes a list of elements. Your function should take a list called `result` as input and return the first element of the list if it contains any elements. If the list is empty or evaluates to a falsy value, your function should ret...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_first_element([1, 2, 3]) == 1\", \"assert get_first_element(['a', 'b', 'c']) == 'a'\", \"assert get_first_element([]) == ''\", \"assert get_first_element(['']) == ''\", \"assert get_first_element([None]) == None\", \"assert get_first_element([False]) == ...
{ "split": "train", "index": 77489, "acecode_id": "oss_26131", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `s`, write a function `convert_special_to_underscore(s)` that replaces every special character in the string with an underscore. Special characters are defined as any character that is not an alphanumeric character (a-z, A-Z, 0-9). Return the modified string.\nPl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_special_to_underscore('2021/05/01') == '2021_05_01'\", \"assert convert_special_to_underscore('Python#Rocks!') == 'Python_Rocks_'\", \"assert convert_special_to_underscore('NoSpecialChars') == 'NoSpecialChars'\", \"assert convert_special_to_underscor...
{ "split": "train", "index": 77490, "acecode_id": "evol_1829", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of quiz questions and returns a list of question objects. Each question object should be a dictionary containing the question text and its associated options. The input will be a list of tuples, where each tuple cont...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_questions([('Question 1', ['Option 1', 'Option 2']), ('Question 2', ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5'])]) == [{'question': 'Question 1', 'options': ['Option 1', 'Option 2']}, {'question': 'Question 2', 'options': ['Option 1'...
{ "split": "train", "index": 77491, "acecode_id": "oss_19166", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a file path based on a given executable name. The function should accept an optional parameter for the executable name. If no executable name is provided, the function should return the path of a default executable named 'i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_executable_path() == '/usr/local/bin/install.exe'\", \"assert get_executable_path('margo') == '/usr/local/bin/margo'\", \"assert get_executable_path('example.exe') == '/usr/local/bin/example.exe'\", \"assert get_executable_path('') == '/usr/local/bin/ins...
{ "split": "train", "index": 77492, "acecode_id": "bigcode_python_fns_15808", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with verifying the contents of a unit conversion dictionary. Your job is to implement a function called `check_single_unit(old_unit_dict)` that takes in a dictionary `old_unit_dict`, where the keys represent unit types and the values represent their respective co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_single_unit({'meter': 1}) == True\", \"assert check_single_unit({'liter': 1}) == True\", \"assert check_single_unit({'kilogram': 1}) == True\", \"assert check_single_unit({'meter': 1, 'centimeter': 100}) == False\", \"assert check_single_unit({'meter':...
{ "split": "train", "index": 77493, "acecode_id": "oss_27083", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a number `n` (which can be an integer or a float), write a function `number2human(n)` that formats the number into a human-readable string using appropriate metric prefixes. The function should return the formatted string as follows: \n- For numbers in the range of thous...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert number2human(1000) == '1.0K'\", \"assert number2human(500) == '500.00'\", \"assert number2human(999) == '999.00'\", \"assert number2human(10000) == '10.0K'\", \"assert number2human(2500) == '2.5K'\", \"assert number2human(950) == '950.00'\", \"assert number2...
{ "split": "train", "index": 77494, "acecode_id": "bigcode_python_fns_25644", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a non-negative integer n, return the nth Fibonacci number. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. Your task is to implement a function that calculates the nth Fibonacci number using recursion.\nPlease reason...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fib(0) == 0\", \"assert fib(1) == 1\", \"assert fib(2) == 1\", \"assert fib(3) == 2\", \"assert fib(4) == 3\", \"assert fib(5) == 5\", \"assert fib(6) == 8\", \"assert fib(7) == 13\", \"assert fib(8) == 21\", \"assert fib(9) == 34\", \"assert fib(10) == 55\"...
{ "split": "train", "index": 77495, "acecode_id": "bigcode_python_fns_11849", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two integers x and y, implement a function `E(x, y)` that returns the count of steps required to ascertain the highest common factor of x and y utilizing Euclid's algorithm. The algorithm follows these steps: set x1 = y, y1 = x mod y, and repeat this process until y becom...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert E(1, 1) == 1\", \"assert E(10, 6) == 3\", \"assert E(6, 10) == 4\", \"assert E(2, 2) == 1\", \"assert E(7, 14) == 2\", \"assert E(100, 1) == 1\"]}" }
{ "split": "train", "index": 77496, "acecode_id": "evol_4351", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given three float numbers x1, x2, and x3, implement a function that calculates the output based on the formula: output = -0.2 * x2 - 0.2 * x3 + 0.8. The function should return the computed output. You can assume that the inputs will always be valid floats.\nPlease reason step b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert f1_3D(0.0, 0.0, 0.0) == 0.8\", \"assert f1_3D(1.0, 0.0, 0.0) == 0.8\", \"assert f1_3D(1.0, 1.0, 1.0) == 0.4\", \"assert f1_3D(0.0, 2.0, 2.0) == 0.0\", \"assert f1_3D(0.0, -2.0, -2.0) == 1.6\", \"assert f1_3D(2.0, 0.0, 0.0) == 0.8\"]}" }
{ "split": "train", "index": 77497, "acecode_id": "bigcode_python_fns_47434", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with generating an XML representation of a list of products for a product feed system. Each product is represented by a dictionary containing keys 'id', 'name', and 'price'. Implement a function `generate_product_feed(products: List[Dict[str, Union[int, str, floa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_product_feed([{'id': 1, 'name': 'Laptop', 'price': 999.99}]) == '<products><product><id>1</id><name>Laptop</name><price>999.99</price></product></products>'\", \"assert generate_product_feed([{'id': 2, 'name': 'Smartphone', 'price': 499.99}]) == '<p...
{ "split": "train", "index": 77498, "acecode_id": "bigcode_python_fns_10609", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of strings and returns a random string from that list. The function should read the list and select a random string based on the number of strings in the list. Implement the function `get_random_string(strings)` wher...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_random_string(['apple', 'banana', 'cherry', 'date']) in ['apple', 'banana', 'cherry', 'date']\", \"assert get_random_string(['dog', 'cat', 'mouse']) in ['dog', 'cat', 'mouse']\", \"assert get_random_string(['red', 'green', 'blue']) in ['red', 'green', 'b...
{ "split": "train", "index": 77499, "acecode_id": "oss_17056", "num_tests": 16 }