data_source
large_stringclasses
1 value
prompt
listlengths
1
1
ability
large_stringclasses
1 value
reward_model
dict
extra_info
dict
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to check if a specific value exists in a binary tree. The binary tree is represented using a standard node structure with left and right child pointers. The function should return `True` if the value is found in the tree and `False` o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert search_in_binary_tree(TreeNode(1, TreeNode(2), TreeNode(3)), 2) == True\", \"assert search_in_binary_tree(TreeNode(1, TreeNode(2), TreeNode(3)), 4) == False\", \"assert search_in_binary_tree(TreeNode(1), 1) == True\", \"assert search_in_binary_tree(None, 1) ...
{ "split": "train", "index": 2900, "acecode_id": "oss_19322", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the process of deleting configuration files based on a given name. The function should take a string parameter 'name' representing the configuration name to be deleted. The function will check if the configuration exists in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert delete_config('configA') == \\\"Deleted configuration 'configA'.\\\"\", \"assert delete_config('configB') == \\\"Deleted configuration 'configB'.\\\"\", \"assert delete_config('configC') == \\\"Deleted configuration 'configC'.\\\"\", \"assert delete_config('...
{ "split": "train", "index": 2901, "acecode_id": "bigcode_python_fns_29218", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function to calculate the area of a triangle using Heron's formula. The formula is given by: Area = sqrt(s * (s - a) * (s - b) * (s - c)), where s is the semi-perimeter of the triangle, calculated as (a + b + c) / 2. Your function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculateTriangleAreaHeron(3, 4, 5) == 6.0\", \"assert calculateTriangleAreaHeron(1, 1, 1) == 0.4330127018922193\", \"assert calculateTriangleAreaHeron(7, 8, 9) == 26.832815729997478\", \"assert calculateTriangleAreaHeron(2, 2, 3) == 1.984313483298443\", \"a...
{ "split": "train", "index": 2902, "acecode_id": "oss_31921", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two strings, `source` and `target`. Your task is to copy the content of the `source` string into the `target` string, replacing the original content of `target`. You need to implement a function `copy_string(source: str, target: str) -> str` that returns the modif...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert copy_string('Hello World', 'Goodbye') == 'Hello World'\", \"assert copy_string('Data Science', 'Machine Learning') == 'Data Science'\", \"assert copy_string('Python', 'Java') == 'Python'\", \"assert copy_string('LeetCode', 'Codeforces') == 'LeetCode'\", \"as...
{ "split": "train", "index": 2903, "acecode_id": "bigcode_python_fns_18126", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_final_grade(scores: dict, weights: dict) -> float` that computes the final academic grade for a university student based on their obtained marks in various assignment categories. The function should take in two dictionaries: `scores`, which conta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_final_grade({'quiz': 75}, {'quiz': 100}) == 75.0\", \"assert calculate_final_grade({'midterm': 100, 'final': 100}, {'midterm': 0, 'final': 100}) == 100.0\", \"assert calculate_final_grade({'homework': 60, 'project': 70}, {'homework': 50, 'project':...
{ "split": "train", "index": 2904, "acecode_id": "evol_26766", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing a list of rig data containing their rotations and translations. Each rig is represented by several parameters: rig_id, sensor_id, qw, qx, qy, qz, tx, ty, tz. You need to implement a function that takes a list of these parameters and filters out an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_rigs([[1, 'sensorA', 1, 0, 0, 0, 1, 2, 3], [2, 'sensorB', 0, 1, 0, 0, 4, 5, 6]], {'sensorA'}) == {(2, 'sensorB'): {'rotation': [0.0, 1.0, 0.0, 0.0], 'translation': [4, 5, 6]}}\", \"assert process_rigs([[1, 'sensorA', 1, 0, 0, 0, 1, 2, 3], [2, 'sensor...
{ "split": "train", "index": 2905, "acecode_id": "bigcode_python_fns_17768", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the number of minutes each employee needs to complete their weekly tasks. Your goal is to determine the total time required for all employees to finish their tasks. Implement a function `total_time(employees: List[int]) -> int` that...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert total_time([30, 45, 60]) == 135\", \"assert total_time([0, 0, 0]) == 0\", \"assert total_time([15, 30, 45, 60]) == 150\", \"assert total_time([10]) == 10\", \"assert total_time([100, 200, 300]) == 600\", \"assert total_time([25, 35, 45, 55, 65]) == 225\", \"...
{ "split": "train", "index": 2906, "acecode_id": "bigcode_python_fns_26459", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the real height of a binary tree and populates a dictionary with nodes and their corresponding heights. The binary tree is represented as a nested dictionary, where each node is a dictionary with a 'value' key for the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_height_and_populate_dict({}) == (0, {})\", \"assert calculate_height_and_populate_dict({'value': 1, 'left': None, 'right': None}) == (1, {1: 0})\", \"assert calculate_height_and_populate_dict({'value': 1, 'left': {'value': 2, 'left': None, 'right':...
{ "split": "train", "index": 2907, "acecode_id": "oss_3702", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates keyword suggestions based on a given seed keyword. The function should take a string input representing the seed keyword and return a list of keyword suggestions. The keyword suggestions should be generated by appending '_s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_keyword_suggestions('apple') == ['apple_suggestion1', 'apple_suggestion2', 'apple_suggestion3']\", \"assert get_keyword_suggestions('banana') == ['banana_suggestion1', 'banana_suggestion2', 'banana_suggestion3']\", \"assert get_keyword_suggestions('') ==...
{ "split": "train", "index": 2908, "acecode_id": "oss_37606", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string containing the components of a cluster in the format 'cluster_name/role/env/job', write a function `parse_cluster_info` that extracts and returns the individual components as a dictionary. If any component is missing, it should not be included in the returned dic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_cluster_info('my_cluster/my_role/my_env/my_job') == {'cluster_name': 'my_cluster', 'role': 'my_role', 'env': 'my_env', 'job': 'my_job'}\", \"assert parse_cluster_info('my_cluster/my_role/my_env') == {'cluster_name': 'my_cluster', 'role': 'my_role', 'en...
{ "split": "train", "index": 2909, "acecode_id": "bigcode_python_fns_2776", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the process of extracting an authorization token from a request. The function should take in two parameters: 'code', a string representing an authorization code, and 'redirect_uri', a string representing the redirect UR...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_token('auth_code_123', 'http://redirect.com') == {'access_token': 'auth_code_123_token', 'refresh_token': 'auth_code_123_refresh', 'expires_in': 3600}\", \"assert get_token('code_xyz', 'http://example.com') == {'access_token': 'code_xyz_token', 'refresh_...
{ "split": "train", "index": 2910, "acecode_id": "bigcode_python_fns_14978", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates loading a pretrained word embedding model from a given path. The function should accept a string representing the file path to the model and return a message indicating whether the model was successfully loaded or if the fi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert load_model('valid_model_path') == 'Model loaded successfully from valid_model_path'\", \"assert load_model('') == 'File not found at '\", \"assert load_model('another_valid_path') == 'Model loaded successfully from another_valid_path'\", \"assert load_model(...
{ "split": "train", "index": 2911, "acecode_id": "bigcode_python_fns_35183", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple underground railway system that tracks travel times between stations. Design a function that simulates customer travel in the system. The system will allow customers to check in and check out at stations, and calculate the average and m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert railway_system.checkIn(1, 'A', 1) is None\", \"assert railway_system.checkIn(2, 'B', 2) is None\", \"assert railway_system.checkIn(3, 'A', 3) is None\", \"assert railway_system.checkIn(4, 'C', 5) is None\", \"assert railway_system.checkIn(5, 'A', 1) is None\...
{ "split": "train", "index": 2912, "acecode_id": "evol_25644", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a string, implement a function that returns the index of the first non-repeating character in the string. If there is no non-repeating character, return -1.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```py...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_inaugural_character('googlesearch') == 4\", \"assert find_inaugural_character('aabbccddeeff') == -1\", \"assert find_inaugural_character('abcdabc') == 3\", \"assert find_inaugural_character('ababab') == -1\", \"assert find_inaugural_character('hello') =...
{ "split": "train", "index": 2913, "acecode_id": "evol_18857", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a configuration dictionary that represents the state of a device and a polling topic for monitoring its availability. Your task is to implement a function `test_availability_poll_state` that simulates the polling process. The function should take the following par...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert test_availability_poll_state({'if': 1}, 'some_topic') == 'Device is available'\", \"assert test_availability_poll_state({'if': 2}, 'another_topic') == 'Device is available'\", \"assert test_availability_poll_state({'if': 0}, 'topic_zero') == 'Device is unava...
{ "split": "train", "index": 2914, "acecode_id": "bigcode_python_fns_37140", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings where each string represents a command, implement a function `CommandToString(command: List[str]) -> str` that returns a single string representing the command, where each command is enclosed in single quotes and separated by a space. For example, if the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert CommandToString(['ls', '-l', '/home/user']) == \\\"'ls' '-l' '/home/user'\\\"\", \"assert CommandToString(['mkdir', 'new_folder']) == \\\"'mkdir' 'new_folder'\\\"\", \"assert CommandToString(['echo', 'Hello World']) == \\\"'echo' 'Hello World'\\\"\", \"asser...
{ "split": "train", "index": 2915, "acecode_id": "bigcode_python_fns_17980", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a simple function that simulates searching a database for records based on a given search term. Your function should take a search string as input and return a list of mock results that would typically be returned from a search of a database. Each r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert search_database('example search') == [{'id': 1, 'title': 'Title 1', 'description': 'Description for item 1'}, {'id': 2, 'title': 'Title 2', 'description': 'Description for item 2'}, {'id': 3, 'title': 'Title 3', 'description': 'Description for item 3'}, {'id...
{ "split": "train", "index": 2916, "acecode_id": "oss_1790", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a dictionary called 'provenance' where each key is the name of a software package and each value is its version. Your task is to implement a function that generates a dictionary containing the package names as keys and their corresponding download URLs as values. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_url_for_packages({'cmtk': '3.2.2-1.4build1'}) == {'cmtk': 'http://example.com/cmtk_3.2.2-1.4build1.deb'}\", \"assert get_url_for_packages({'numpy': '1.21.0', 'pandas': '1.3.0'}) == {'numpy': 'http://example.com/numpy_1.21.0.deb', 'pandas': 'http://exampl...
{ "split": "train", "index": 2917, "acecode_id": "bigcode_python_fns_40373", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with extracting email addresses and phone numbers from a given string. Implement a function that takes a string as input and uses regular expressions to extract all email addresses and phone numbers from that string. The function should return a dictionary with t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_contacts('My emails are alice@example.com and bob@work.org.') == {'email_addresses': ['alice@example.com', 'bob@work.org'], 'phone_numbers': []}\", \"assert extract_contacts('No contacts here!') == {'email_addresses': [], 'phone_numbers': []}\", \"as...
{ "split": "train", "index": 2918, "acecode_id": "oss_3238", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function `sum_list` that calculates and returns the sum of all elements in the list. The function should handle both positive and negative integers, as well as an empty list.\nPlease reason step by step, then write a self-contained Python s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_list([1, 3, 4, 5]) == 13\", \"assert sum_list([-1, -2, -3]) == -6\", \"assert sum_list([0, 0, 0]) == 0\", \"assert sum_list([]) == 0\", \"assert sum_list([10, -10, 5]) == 5\", \"assert sum_list([-1, 1, -1, 1]) == 0\", \"assert sum_list([100, 200, 300]) =...
{ "split": "train", "index": 2919, "acecode_id": "evol_27003", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with managing a simple inventory system for an e-commerce application. Implement a function `manage_inventory(orders: List[Dict[str, Union[int, str]]], operation: str, order_id: Optional[int] = None, new_order: Optional[Dict[str, Union[int, str]]] = None) -> Unio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_inventory([], 'get_all') == []\", \"assert manage_inventory([], 'create', new_order={'product': 'Product A', 'quantity': 2}) == {'id': 1, 'product': 'Product A', 'quantity': 2}\", \"assert manage_inventory([{'id': 1, 'product': 'Product A', 'quantity'...
{ "split": "train", "index": 2920, "acecode_id": "oss_28064", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two dates as strings in the format 'YYYY-MM-DD', implement a function that returns a list of all dates (as strings) from the beginning date to the end date, inclusive. The function should handle leap years correctly and ensure that the output list is sorted in ascending o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert date_range('2023-01-01', '2023-01-05') == ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05']\", \"assert date_range('2023-02-28', '2023-03-02') == ['2023-02-28', '2023-03-01', '2023-03-02']\", \"assert date_range('2020-02-28', '2020-03-01...
{ "split": "train", "index": 2921, "acecode_id": "bigcode_python_fns_46926", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an IPv6 address and a CIDR prefix, write a function that checks if the provided IPv6 address is included in the specified CIDR prefix. The function should take three parameters: an IPv6 address as a string, a CIDR prefix as a string, and a prefix length as an integer. The...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_included('2001:0db8:85a3:0000:0000:8a2e:0370:7334', '2001:0db8:85a3::', 64) == True\", \"assert is_included('2001:0db8:85a3:0000:0000:8a2e:0370:7334', '2001:0db8:85a4::', 64) == False\", \"assert is_included('2001:0db8:85a3:0000:0000:8a2e:0370:7334', '200...
{ "split": "train", "index": 2922, "acecode_id": "bigcode_python_fns_29097", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that updates a list of values representing design parameters. The function `set_values` should take an array of new values and replace the current list of design parameters with these new values. The function should ensure that the input ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_values([1.0, 2.0, 3.0]) == [1.0, 2.0, 3.0]\", \"assert set_values([]) == []\", \"assert set_values([1, 2, 3]) == [1, 2, 3]\", \"assert set_values([-1, -2, -3]) == [-1, -2, -3]\", \"assert set_values([1.5, 2.5, 3.5]) == [1.5, 2.5, 3.5]\", \"assert set_val...
{ "split": "train", "index": 2923, "acecode_id": "oss_16028", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of integers representing project ratings and returns a new list containing only the ratings that are greater than or equal to a specified threshold. Your function should ignore any ratings that are invalid (i.e., non-int...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_ratings([5, 3, 8, 'a', 10], 5) == [5, 8, 10]\", \"assert filter_ratings([1, 2, 3, 4], 3) == [3, 4]\", \"assert filter_ratings([], 5) == []\", \"assert filter_ratings(['1', '2', 3, 4, 'five'], 2) == [3, 4]\", \"assert filter_ratings([0, -1, -5, 5], 0) ...
{ "split": "train", "index": 2924, "acecode_id": "oss_36806", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string s, implement a function that returns a new string with only the first character capitalized while keeping the rest of the string unchanged. If the string is empty, return an empty string.\nPlease reason step by step, then write a self-contained Python solution. G...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert capitalize('hello') == 'Hello'\", \"assert capitalize('world') == 'World'\", \"assert capitalize('python programming') == 'Python programming'\", \"assert capitalize('') == ''\", \"assert capitalize('123abc') == '123abc'\", \"assert capitalize('a') == 'A'\",...
{ "split": "train", "index": 2925, "acecode_id": "bigcode_python_fns_8612", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that sorts a list of tuples based on the second item of each tuple and then the first item in reverse order when the second items are the same. For example, given the list [(1,2), (3,3), (1,1), (2,2)], the output should be [(1,1), (2,2), (1,2), (3,3)]. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_tuples([(1,2), (3,3), (1,1), (2,2)]) == [(1,1), (2,2), (1,2), (3,3)]\", \"assert sort_tuples([(4,5), (2,4), (3,5), (1,3)]) == [(1,3), (2,4), (4,5), (3,5)]\", \"assert sort_tuples([(1,2), (2,2), (3,2), (4,2)]) == [(4,2), (3,2), (2,2), (1,2)]\", \"assert ...
{ "split": "train", "index": 2926, "acecode_id": "evol_14629", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a string `name` containing lowercase letters. Your task is to write a function `count_vowels_consonants` to count the number of vowels and consonants in the given string. For the purpose of this problem, consider the following as vowels: 'a', 'e', 'i', 'o', and 'u...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_vowels_consonants('a') == (1, 0)\", \"assert count_vowels_consonants('b') == (0, 1)\", \"assert count_vowels_consonants('abcde') == (2, 3)\", \"assert count_vowels_consonants('aeiou') == (5, 0)\", \"assert count_vowels_consonants('bcdfgh') == (0, 6)\",...
{ "split": "train", "index": 2927, "acecode_id": "oss_7199", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function `initialize_assets(n: int, assets: List[int]) -> List[int]` that initializes each asset by applying a transformation that sets all elements in the list to zero. The function should return the modified list of assets. For example, i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_assets(3, [5, 3, 9]) == [0, 0, 0]\", \"assert initialize_assets(4, [1, 2, 3, 4]) == [0, 0, 0, 0]\", \"assert initialize_assets(2, [-1, -2]) == [0, 0]\", \"assert initialize_assets(5, [100, 200, 300, 400, 500]) == [0, 0, 0, 0, 0]\", \"assert initia...
{ "split": "train", "index": 2928, "acecode_id": "bigcode_python_fns_20950", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a user agent from a web browser, write a function `detect_browser(user_agent: str) -> str` that returns the name of the browser being used. The function should recognize the following browsers: 'Internet Explorer', 'Firefox', 'Chrome', 'Safari', and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert detect_browser('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36') == 'Chrome'\", \"assert detect_browser('Mozilla/5.0 (Windows NT 10.0; Trident/7.0; AS; rv:11.0) like Gecko') == 'Internet Ex...
{ "split": "train", "index": 2929, "acecode_id": "evol_14882", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function called `find_item_index` that takes a list of integers and an integer item as input. The function should return the index of the item in the list if it exists, and return -1 if the item is not found. Do not use any built-in functions for searching the item ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_item_index([1, 3, 5], 5) == 2\", \"assert find_item_index([1, 3, 5], 1) == 0\", \"assert find_item_index([1, 3, 5], 3) == 1\", \"assert find_item_index([10, 20, 30], 20) == 1\", \"assert find_item_index([10, 20, 30], 10) == 0\", \"assert find_item_index...
{ "split": "train", "index": 2930, "acecode_id": "evol_35235", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a dictionary representing a bay and a boolean flag indicating whether to show long details. The dictionary contains information about the bay and its associated bay model. If the long details flag is set to True, the function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_bay_info({'baymodel_id': 'id', 'info': {}}, True) == {'baymodel_id': 'id', 'info': {'baymodel_key1': 'value1', 'baymodel_key2': 'value2'}}\", \"assert update_bay_info({'baymodel_id': 'id', 'info': {}}, False) == {'baymodel_id': 'id', 'info': {}}\", \"...
{ "split": "train", "index": 2931, "acecode_id": "bigcode_python_fns_16320", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries representing galaxies, where each dictionary contains various properties of a galaxy, including its redshift. Your task is to write a function `analyze_galaxies(gal_cat)` that takes a list of these dictionaries and returns the average redshi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert analyze_galaxies([]) == 0.0\", \"assert analyze_galaxies([{'redshift': 1.0}, {'redshift': 2.0}, {'redshift': 3.0}]) == 2.0\", \"assert analyze_galaxies([{'redshift': 0.7}, {'redshift': 0.8}]) == 0.75\", \"assert analyze_galaxies([{'redshift': 4.0}, {'redshif...
{ "split": "train", "index": 2932, "acecode_id": "oss_26342", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given two sets of appointment locations: a 'new_set' which contains the latest available appointments, and an 'old_set' which contains the previously scheduled appointments. Your task is to implement a function that calculates and returns two sets: the 'new_appointments...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_appointments({'LIVERPOOL', 'BROOKLYN', 'HONEOYE', 'KINGSTON'}, {'LIVERPOOL', 'BROOKLYN', 'KINGSTON'}) == ({'HONEOYE'}, {'LIVERPOOL', 'BROOKLYN', 'HONEOYE', 'KINGSTON'})\", \"assert calculate_appointments({'A', 'B', 'C'}, {'B'}) == ({'A', 'C'}, {'A'...
{ "split": "train", "index": 2933, "acecode_id": "bigcode_python_fns_36481", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a failure log for a proof system. The function should take in the following parameters: a conclusion predicate string, a list of premise predicate strings, a conclusion string, and a list of premise strings. The output shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert make_failure_log('concl', ['_premise1', '_premise2'], 'Conclusion', ['H : premise (Acc x1)', 'G : premise (Acc x2)'], ['type_error', 'open_formula']) == {'all_premises': ['premise1', 'premise2'], 'other_sub-goals': [{'subgoal': 'concl', 'index': 1, 'raw_subg...
{ "split": "train", "index": 2934, "acecode_id": "bigcode_python_fns_22417", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes data from a sensor array. The sensor array consists of multiple sensors, each providing a stream of data points. The data points are represented as tuples of the form (sensor_id, timestamp, value), where sensor_id is a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_sensor_values([(1, 0, 5), (1, 1, 15), (1, 2, 10)]) == {1: 10.0}\", \"assert calculate_average_sensor_values([(2, 0, 20), (2, 1, 30), (2, 2, 40)]) == {2: 30.0}\", \"assert calculate_average_sensor_values([]) == {}\", \"assert calculate_avera...
{ "split": "train", "index": 2935, "acecode_id": "oss_26001", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that determines the priority of a bug entry based on its labels. Each bug entry is represented as a dictionary with a key 'labels' that contains a list of strings. Each label is in the format of 'pri-<number>', where <number> is a digit r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_priority({'labels': ['pri-1', 'bug', 'feature']}) == '1'\", \"assert find_priority({'labels': ['pri-2', 'pri-1']}) == '2'\", \"assert find_priority({'labels': ['feature', 'bug']}) == ''\", \"assert find_priority({'labels': ['pri-3', 'pri-2', 'pri-1']}) ...
{ "split": "train", "index": 2936, "acecode_id": "bigcode_python_fns_31720", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two lists of integers. Your task is to implement a function `calculate_sum_difference(list1, list2)` that takes these two lists as input and returns the absolute difference between the sum of the first list and the sum of the second list. For example, given `list1...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_sum_difference([10, 20, 30], [5, 15, 25]) == 15\", \"assert calculate_sum_difference([0], [0]) == 0\", \"assert calculate_sum_difference([100], [50]) == 50\", \"assert calculate_sum_difference([2, 4, 6], [1, 3, 5]) == 3\", \"assert calculate_sum_di...
{ "split": "train", "index": 2937, "acecode_id": "oss_16208", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of trees in a forest. You need to implement a function that finds the maximum height among the trees and returns the index of that tree. If there are multiple trees with the maximum height, return the index of the first ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_tree_height_index([3, 5, 2, 7, 4]) == 3\", \"assert max_tree_height_index([1, 2, 3, 4, 5]) == 4\", \"assert max_tree_height_index([5, 5, 5, 5]) == 0\", \"assert max_tree_height_index([10, 20, 10, 20]) == 1\", \"assert max_tree_height_index([7, 1, 3, 4, 7...
{ "split": "train", "index": 2938, "acecode_id": "bigcode_python_fns_28190", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that extracts the publish gRPC endpoint for ingestion from a given code snippet. The code snippet is a part of a larger Python script and may contain comments. The comment containing the publish gRPC endpoint will always follow thi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_grpc_endpoint(\\\"\\\"\\\"# gRPC endpoint: 127.0.0.1:50051\\nSome code here\\n\\\"\\\"\\\") == '127.0.0.1:50051'\", \"assert extract_grpc_endpoint(\\\"\\\"\\\"# gRPC endpoint: localhost:8080\\nMore code\\n\\\"\\\"\\\") == 'localhost:8080'\", \"assert...
{ "split": "train", "index": 2939, "acecode_id": "oss_33854", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that accepts a CSV file and a list of dashboard configurations. The function should handle the CSV file upload, create a dashboard for each configuration provided, and return a list of success messages for each created dashboard. The dashboard configuration...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_dashboards('data.csv', [{'id': '1', 'title': 'Sales Dashboard', 'description': 'Dashboard for sales data', 'data': 'sales_data'}]) == ['Dashboard created successfully']\", \"assert create_dashboards('data.csv', [{'id': '1', 'title': 'Sales Dashboard',...
{ "split": "train", "index": 2940, "acecode_id": "evol_35415", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that verifies if a given string represents a valid Python import path for a module. The import path should follow these rules: 1. It should consist of one or more valid Python identifiers separated by dots (e.g., 'package.module.submodule...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_import_path('os.path') == True\", \"assert is_valid_import_path('json') == True\", \"assert is_valid_import_path('my_package.my_module') == True\", \"assert is_valid_import_path('my_package.1module') == False\", \"assert is_valid_import_path('1packa...
{ "split": "train", "index": 2941, "acecode_id": "bigcode_python_fns_1867", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that checks if the given input for a channel number is of the correct type. The function should take a single parameter, `channel_number`, and return a string message. If the input is an integer, return 'Channel number is valid.'. If ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_channel_number(42) == 'Channel number is valid.'\", \"assert check_channel_number(0) == 'Channel number is valid.'\", \"assert check_channel_number(-1) == 'Channel number is valid.'\", \"assert check_channel_number(100) == 'Channel number is valid.'\",...
{ "split": "train", "index": 2942, "acecode_id": "bigcode_python_fns_24463", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that filters a given list of installed packages based on certain conditions. The function should take in the following parameters: a list of installed packages, a boolean indicating whether a configuration file is filled, and a boolean in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_packages(['ypbind', 'ypserv', 'otherpkg'], True, True) == ['ypbind', 'ypserv']\", \"assert filter_packages(['ypbind', 'ypserv', 'otherpkg'], True, False) == ['ypbind']\", \"assert filter_packages(['ypbind', 'otherpkg'], True, True) == ['ypbind']\", \"...
{ "split": "train", "index": 2943, "acecode_id": "bigcode_python_fns_24834", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, define a function count_divisible_substrings(n) that returns the number of non-empty substrings of n that are divisible by 5. For example, the string \"2575\" has 10 non-empty substrings, two of which represent numbers that are divisible by 5, namely...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_divisible_substrings(5) == 1\", \"assert count_divisible_substrings(555) == 6\", \"assert count_divisible_substrings(11111) == 0\", \"assert count_divisible_substrings(25) == 2\", \"assert count_divisible_substrings(99999) == 0\", \"assert count_divisi...
{ "split": "train", "index": 2944, "acecode_id": "evol_13221", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Design a function to analyze and manipulate a given string based on a command. Implement the following function: \n\n```python\ndef evaluate_string(s: str, command: str) -> Union[List[str], int, str]:\n pass\n``` \n\nGiven a string `s` and a command `command`, perform an ope...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert evaluate_string(\\\"Hello;World;Python\\\", 'split') == [\\\"Hello\\\", \\\"World\\\", \\\"Python\\\"]\", \"assert evaluate_string(\\\"Test::String::Example\\\", 'split') == [\\\"Test\\\", \\\"String\\\", \\\"Example\\\"]\", \"assert evaluate_string(\\\"abcd...
{ "split": "train", "index": 2945, "acecode_id": "evol_369", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a string representing a timezone code, implement a function that validates whether the timezone code is present in a predefined list of valid timezone codes. The valid timezone codes are: ['America/New_York', 'Europe/London', 'Asia/Tokyo', 'Australia/Sydney', 'America/Los...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_timezone('America/New_York') == True\", \"assert validate_timezone('Europe/London') == True\", \"assert validate_timezone('Asia/Tokyo') == True\", \"assert validate_timezone('Australia/Sydney') == True\", \"assert validate_timezone('America/Los_Ange...
{ "split": "train", "index": 2946, "acecode_id": "bigcode_python_fns_47490", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a K-means clustering algorithm for strings using a specified distance metric and an additional penalty. Your function should take a list of strings, the number of desired clusters, the distance algorithm to be used, and an additional penalty. Yo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert k_means_string_clustering(['hello', 'world'], 2, 'placeholder', 2) == {('h', 'e', 'l', 'l', 'o'): ['hello'], ('w', 'o', 'r', 'l', 'd'): ['world']}\", \"assert k_means_string_clustering(['a', 'b', 'c'], 3, 'placeholder', 0) == {('a',): ['a'], ('b',): ['b'], (...
{ "split": "train", "index": 2947, "acecode_id": "oss_19489", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a point in a two-dimensional space represented by its coordinates (x, y) and a line defined by two distinct points in the same space, calculate the perpendicular distance from the point to the line. The line is represented by two points, each a pair of coordinates (x1, y1...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert distance_to_line((2, 2), ((0, 0), (4, 4))) == 0.0\", \"assert distance_to_line((1, 0), ((0, 0), (1, 1))) == 0.7071067811865475\", \"assert distance_to_line((-1, -1), ((-2, -2), (0, 0))) == 0.0\", \"assert distance_to_line((3, 1), ((1, 1), (1, 3))) == 2.0\", ...
{ "split": "train", "index": 2948, "acecode_id": "bigcode_python_fns_32807", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function `multifaceted_arithmetic(num1, num2, operation)` that performs a specified arithmetic operation on two numbers. The function accepts three parameters: `num1` and `num2` are the numbers on which the operation will be performed, and `operation` is a string th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multifaceted_arithmetic(2, 3, 'add') == 5\", \"assert multifaceted_arithmetic(2.5, 3.7, 'add') == 6.2\", \"assert multifaceted_arithmetic(-2, -3, 'add') == -5\", \"assert multifaceted_arithmetic(2, 3, 'subtract') == -1\", \"assert multifaceted_arithmetic(3, ...
{ "split": "train", "index": 2949, "acecode_id": "evol_27879", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to process an array of integers and return a new array containing the cubes of each integer decremented by 1. Write a Python function `find_cubes_opt(array)` where: - `array` is a list of integers (0 <= len(array) <= 10^5), where each...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_cubes_opt([]) == []\", \"assert find_cubes_opt([0]) == [-1]\", \"assert find_cubes_opt([1]) == [0]\", \"assert find_cubes_opt([-1]) == [-2]\", \"assert find_cubes_opt([2]) == [7]\", \"assert find_cubes_opt([3]) == [26]\", \"assert find_cubes_opt([-2]) =...
{ "split": "train", "index": 2950, "acecode_id": "oss_16646", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a notification message based on a given context. The context is a dictionary that may contain a key 'addon' and a key 'request'. If the 'addon' key is present, the function should return a dictionary containing the 'request...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_notification({'request': 'Request 1', 'addon': 'Addon 1'}) == {'request': 'Request 1', 'addon': 'Addon 1'}\", \"assert generate_notification({'request': 'Request 2'}) == {'request': 'Request 2', 'addon': 'No addon specified'}\", \"assert generate_no...
{ "split": "train", "index": 2951, "acecode_id": "bigcode_python_fns_47281", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that parses a given list of tokens representing a Java method signature and determines if the method throws any exceptions. Each token is represented as an object with `get_value()` and `get_type()` methods. The method signature follo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_throws([Token('void', TokenType.IDENTIFIER), Token('methodName', TokenType.IDENTIFIER), Token('(', TokenType.IDENTIFIER), Token('int', TokenType.IDENTIFIER), Token('param1', TokenType.IDENTIFIER), Token(')', TokenType.IDENTIFIER), Token('throws', Token...
{ "split": "train", "index": 2952, "acecode_id": "oss_9195", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of municipalities, each represented as a dictionary containing 'municipality.miif_category', 'municipality.province_code', and a nested dictionary for indicators with their respective values, write a function that collects and returns a nested dictionary of indicat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_provincial_miif_sets([]) == {}\", \"assert get_provincial_miif_sets([{'municipality.miif_category': 'A', 'municipality.province_code': 'P1', 'indicator1': {'values': [{'result': 10, 'date': '2020'}]}}, {'municipality.miif_category': 'A', 'municipality.pr...
{ "split": "train", "index": 2953, "acecode_id": "bigcode_python_fns_29575", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that formats a list of trigger information into a specific tabular format. Each trigger is represented as a dictionary containing the following keys: 'id', 'description', 'joplin_folder', 'mastodon', 'status', and 'date_triggered'....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_triggers([{'id': 1, 'description': 'Trigger 1', 'joplin_folder': 'Folder 1', 'mastodon': True, 'status': 'Active', 'date_triggered': '2022-01-01'}]) == None\", \"assert format_triggers([{'id': 2, 'description': 'Trigger 2', 'joplin_folder': 'Folder 2'...
{ "split": "train", "index": 2954, "acecode_id": "oss_30405", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that retrieves information about a specific pathway from a simulated API. The function should take a pathway ID as input and return a dictionary containing the pathway information. The simulated API returns predefined data for spec...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert retrieve_pathway_info('pathway_1') == {'name': 'Pathway 1', 'description': 'Description of Pathway 1'}\", \"assert retrieve_pathway_info('pathway_2') == {'name': 'Pathway 2', 'description': 'Description of Pathway 2'}\", \"assert retrieve_pathway_info('pathw...
{ "split": "train", "index": 2955, "acecode_id": "oss_2125", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a non-negative integer i, return the n and m orders of the i'th Zernike polynomial. The n order is determined by the formula: n = (1 + (sqrt(8 * i + 1) - 3) / 2). The m order is calculated using the formula: m = -n + 2 * (i - (n * (n + 1) / 2)). Implement a function `zern...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert zernike_orders(0) == (0, 0)\", \"assert zernike_orders(1) == (1, -1)\", \"assert zernike_orders(2) == (1, 1)\", \"assert zernike_orders(3) == (2, -2)\", \"assert zernike_orders(4) == (2, 0)\", \"assert zernike_orders(5) == (2, 2)\", \"assert zernike_orders(6...
{ "split": "train", "index": 2956, "acecode_id": "bigcode_python_fns_1767", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given the definition of a binary tree node, you need to implement a function `diameter_of_binary_tree(root)` that calculates the diameter of a binary tree. The diameter is defined as the number of nodes along the longest path between any two nodes in the tree. A single node is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert diameter_of_binary_tree(TreeNode(1)) == 1\", \"assert diameter_of_binary_tree(TreeNode(1, TreeNode(2))) == 2\", \"assert diameter_of_binary_tree(TreeNode(1, TreeNode(2), TreeNode(3))) == 3\", \"assert diameter_of_binary_tree(TreeNode(1, TreeNode(2, TreeNode(...
{ "split": "train", "index": 2957, "acecode_id": "oss_6407", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Convert a given decimal number to its binary representation. The input will be a decimal number (float) greater than or equal to 0 and less than 256. Implement a function that converts this decimal number into an 8-bit binary representation. If the number has a fractional part,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decimal_to_binary(3.5) == '11.1'\", \"assert decimal_to_binary(4.25) == '100.01'\", \"assert decimal_to_binary(5.5) == '101.1'\", \"assert decimal_to_binary(10.625) == '1010.101'\", \"assert decimal_to_binary(15.875) == '1111.111'\", \"assert decimal_to_bina...
{ "split": "train", "index": 2958, "acecode_id": "evol_33423", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a list of structures, each represented by a dictionary containing its members and their offsets. Implement a function `get_first_member_offset(structure: Dict[str, int]) -> int` that takes a single structure and returns the offset of the first member. If the struc...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_first_member_offset({'member1': 0, 'member2': 4}) == 0\", \"assert get_first_member_offset({'a': 1, 'b': 2, 'c': 3}) == 1\", \"assert get_first_member_offset({'x': 10}) == 10\", \"assert get_first_member_offset({'first': 5, 'second': 15}) == 5\", \"asser...
{ "split": "train", "index": 2959, "acecode_id": "bigcode_python_fns_46721", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes a list of dictionaries representing network devices. Each dictionary contains information about a network device, including its name, type, and status. Your goal is to filter this list to return only the devices that ha...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_active_devices([{'name': 'Router1', 'type': 'Router', 'status': 'active'}, {'name': 'Switch1', 'type': 'Switch', 'status': 'inactive'}]) == [{'name': 'Router1', 'type': 'Router', 'status': 'active'}]\", \"assert filter_active_devices([{'name': 'Router...
{ "split": "train", "index": 2960, "acecode_id": "oss_13113", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `filter_packages` that simulates a package filtering system. The function takes a list of packages and a dictionary of filters, and returns a list of packages that meet the specified criteria. Each package is represented as a dictiona...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_packages([{'owner_id': 'tenant1', 'is_public': True, 'enabled': True, 'type': 'library', 'categories': ['utils'], 'tags': ['python'], 'class_definitions': ['ClassA'], 'fully_qualified_name': 'lib.utils.ClassA'}], {'include_disabled': 'false', 'owned':...
{ "split": "train", "index": 2961, "acecode_id": "bigcode_python_fns_33818", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a function `create_payload(command_address: int) -> bytes` that constructs a payload for a buffer overflow attack in a hypothetical vulnerable program. The payload should be designed to overwrite the return address of a function with the address of a `system` func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_payload(0xdeadbeef) == b'A' * 32 + b'\\\\xc0\\\\x85\\\\x04\\\\x08' + b'BBBB' + b'\\\\xef\\\\xbe\\\\xad\\\\xde'\", \"assert create_payload(0x12345678) == b'A' * 32 + b'\\\\xc0\\\\x85\\\\x04\\\\x08' + b'BBBB' + b'\\\\x78\\\\x56\\\\x34\\\\x12'\", \"asser...
{ "split": "train", "index": 2962, "acecode_id": "oss_19133", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `process_consumer_data(data: List[Dict[str, Any]]) -> List[Dict[str, Any]]` that processes a list of consumer activity metadata from an online retail platform. Each entry in the input list is a dictionary containing consumer ID, product ID, timestamp, and q...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_consumer_data([{ 'consumer_id': 1, 'product_id': 101, 'timestamp': '2023-01-01T10:00:00Z', 'quantity': 2 }, { 'consumer_id': 1, 'product_id': 101, 'timestamp': '2023-01-01T10:05:00Z', 'quantity': 3 }, { 'consumer_id': 2, 'product_id': 102, 'timestamp...
{ "split": "train", "index": 2963, "acecode_id": "evol_31527", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that returns the second largest distinct integer in the list. If there are not enough distinct integers, return None.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```pyth...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert penultimate_max([1, 6, 4, 8, 7]) == 7\", \"assert penultimate_max([10, 20, 30]) == 20\", \"assert penultimate_max([5, 5, 5]) == None\", \"assert penultimate_max([-1, -2, -3, -4]) == -2\", \"assert penultimate_max([1]) == None\", \"assert penultimate_max([1, ...
{ "split": "train", "index": 2964, "acecode_id": "evol_5787", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes error messages for a chatbot. The function should be named `process_error_message`. It takes two parameters: `error_type` (a string) and `recipient` (an object that has a `send` method). If `error_type` is equal to 'on_comm...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_error_message('on_command_error', MockRecipient()) == None\", \"assert process_error_message('other_error', MockRecipient()) == None\", \"assert process_error_message('on_command_error', MockRecipient()) == None\", \"assert process_error_message('ano...
{ "split": "train", "index": 2965, "acecode_id": "oss_3165", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of integers (both positive and negative) and transforms each integer into its binary representation. The function should then compute the Hamming distance between each consecutive pair of binary representations. If any element in the list ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert hamming_distance_list([0, 0, 0]) == [0, 0]\", \"assert hamming_distance_list([4, 5]) == [1]\", \"assert hamming_distance_list([10, 12, 14]) == [2, 1]\", \"assert hamming_distance_list([15, 15, 15]) == [0, 0]\", \"assert hamming_distance_list([-10, 10]) == [4...
{ "split": "train", "index": 2966, "acecode_id": "evol_17724", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a list of sketches represented as a list of strings, implement a function `is_sketch_list_empty(sketch_list: List[str]) -> bool` that checks if the provided list contains no sketches. The function should return `True` if the list is empty and `False` otherwise. The input ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_sketch_list_empty([]) == True\", \"assert is_sketch_list_empty(['Sketch1']) == False\", \"assert is_sketch_list_empty(['Sketch1', 'Sketch2']) == False\", \"assert is_sketch_list_empty(['']) == False\", \"assert is_sketch_list_empty(['Sketch1', '', 'Sketch...
{ "split": "train", "index": 2967, "acecode_id": "bigcode_python_fns_14082", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that retrieves specific configuration settings from a dictionary and returns the input dictionary unchanged. The function should operate as follows: If the input dictionary contains a key 'github', it should return the input dictio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_config({'github': {'username': 'user123', 'token': 'abc123'}}) == {'github': {'username': 'user123', 'token': 'abc123'}}\", \"assert process_config({'other': {'key': 'value'}}) == {'other': {'key': 'value'}}\", \"assert process_config({'github': {}})...
{ "split": "train", "index": 2968, "acecode_id": "oss_14223", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `update_deployment` that takes in the following parameters: `deployment_name` (a string), `new_name` (a string), `default_version` (a string), `yaml_content` (a dictionary), and `quiet` (a boolean). The function should update the deployme...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_deployment('deployment_v1', 'deployment_v2', 'v2', {}, True) == {'name': 'deployment_v2', 'default_version': 'v2', 'description': None, 'labels': {}, 'input_fields': [], 'output_fields': []}\", \"assert update_deployment('deployment_a', 'deployment_b'...
{ "split": "train", "index": 2969, "acecode_id": "bigcode_python_fns_36371", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given an unordered list of distinct integers, implement a function that returns the penultimate highest value in the list. The function should not use any pre-existing Python libraries or built-in functions for sorting or maximum value determination. If the list has less than t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert penultimate_max([10, 33, 21, 50, 100, 55, 78]) == 78\", \"assert penultimate_max([1, 2]) == 1\", \"assert penultimate_max([5]) == None\", \"assert penultimate_max([45, 22, 88, 12, 55]) == 55\", \"assert penultimate_max([-10, -20, -30, -5]) == -10\", \"assert...
{ "split": "train", "index": 2970, "acecode_id": "evol_32975", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the collection of metrics for a given process. The function will return a tuple containing the return code of the process, the maximum CPU time used by the process and its children, the maximum memory usage, and a list of a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_process_metrics(0, [(10, 5), (7, 3)], [(100, 50), (80, 30)], ['conn1', 'conn2']) == (0, (10, 5), (100, 50), ['conn1', 'conn2'])\", \"assert get_process_metrics(1, [(3, 2), (9, 6)], [(200, 100), (30, 15)], ['connA', 'connB']) == (1, (9, 6), (200, 100), ['...
{ "split": "train", "index": 2971, "acecode_id": "bigcode_python_fns_5891", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of lists, where each inner list represents a row of data. Your task is to implement a function `fetch_rows(data: List[List[Any]]) -> Generator[Any, None, None]` that yields each element from the rows one by one. The function should traverse each inner list ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert list(fetch_rows([[1, 2], [3, 4, 5], [6]])) == [1, 2, 3, 4, 5, 6]\", \"assert list(fetch_rows([['a', 'b'], ['c'], ['d', 'e', 'f']])) == ['a', 'b', 'c', 'd', 'e', 'f']\", \"assert list(fetch_rows([[True, False], [False, True, True]])) == [True, False, False, T...
{ "split": "train", "index": 2972, "acecode_id": "bigcode_python_fns_45573", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates a farm management system. The farm state is represented by the `State` class, which has attributes such as `debug` (a boolean) and `current_tick` (an integer). Your task is to create a function `simulate_farm` that t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_farm(State(debug=False, current_tick=0), ['advance_tick']) == State(debug=False, current_tick=1)\", \"assert simulate_farm(State(debug=True, current_tick=0), ['toggle_debug']) == State(debug=False, current_tick=0)\", \"assert simulate_farm(State(deb...
{ "split": "train", "index": 2973, "acecode_id": "oss_1802", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `filter_alphanumeric(sentence: str) -> str` that takes a string `sentence` as input and returns a new string containing only the alphanumeric characters and spaces from the original string. All other characters should be removed. The output string should mainta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_alphanumeric(\\\"A B C D 1 2 3\\\") == \\\"A B C D 1 2 3\\\"\", \"assert filter_alphanumeric(\\\"No special chars: !@#$%^&*(){}[]\\\") == \\\"No special chars \\\"\", \"assert filter_alphanumeric(\\\"abc!def?ghi\\\") == \\\"abcdefghi\\\"\", \"assert f...
{ "split": "train", "index": 2974, "acecode_id": "evol_11832", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that compares two lists of integers and identifies the indices where the elements differ between the two lists. The function should take in two lists, `list1` and `list2`, and return a list of indices where the corresponding elements ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compare_lists([1, 2, 3], [1, 2, 3]) == []\", \"assert compare_lists([1, 2, 3], [1, 2, 4]) == [2]\", \"assert compare_lists([5, 6, 7], [5, 6, 7, 8]) == []\", \"assert compare_lists([], []) == []\", \"assert compare_lists([1, 2], []) == []\", \"assert compare_...
{ "split": "train", "index": 2975, "acecode_id": "oss_22604", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer 'n', implement a function that generates and returns a list of all prime numbers less than 'n'. The function should be able to handle values of 'n' that are both very high (beyond 10^6) and relatively low (less than 10).\nPlease reason step by step, the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_primes(2) == []\", \"assert generate_primes(3) == [2]\", \"assert generate_primes(10) == [2, 3, 5, 7]\", \"assert generate_primes(20) == [2, 3, 5, 7, 11, 13, 17, 19]\", \"assert generate_primes(30) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\", \"assert...
{ "split": "train", "index": 2976, "acecode_id": "evol_8996", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the processing of a dataset of images and labels. The function should take four parameters: `batch_size`, `repeat_size`, `num_parallel_workers`, and an optional `num_samples`. Your function should return a dictionary contai...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_dataset(32, 1, 1, 100) == {'batch_size': 32, 'repeat_size': 1, 'num_parallel_workers': 1, 'num_samples': 100, 'total_batches': 3}\", \"assert create_dataset(32, 2, 1, 100) == {'batch_size': 32, 'repeat_size': 2, 'num_parallel_workers': 1, 'num_samples...
{ "split": "train", "index": 2977, "acecode_id": "bigcode_python_fns_22716", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of at least two strings, where each string consists of the characters '(', ')', '[', ']', '{', and '}'. Your task is to determine if there exists a permutation of these strings that can be concatenated to form a properly nested and matching sequence of brac...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert match_brackets(['(', ')()', '[[', ']]', '{{', '}}']) == 'Yes'\", \"assert match_brackets([')', ')', '(', '(', '{{', ']']) == 'No'\", \"assert match_brackets(['[', ']', '{', '}', '(', ')']) == 'Yes'\", \"assert match_brackets(['{', '}', '(', '(', ']', '[']) =...
{ "split": "train", "index": 2978, "acecode_id": "evol_6796", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that transforms the list into a string representation of an XML format. Each integer should be wrapped in a `<number>` tag. The function should return the resulting XML string. For example, given the input list [1, 2, 3], the output sh...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert list_to_xml([1, 2, 3]) == '<numbers><number>1</number><number>2</number><number>3</number></numbers>'\", \"assert list_to_xml([]) == '<numbers></numbers>'\", \"assert list_to_xml([0]) == '<numbers><number>0</number></numbers>'\", \"assert list_to_xml([-1, -2...
{ "split": "train", "index": 2979, "acecode_id": "bigcode_python_fns_40303", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that returns a new list containing only the unique elements from the original list, preserving the order of their first occurrence. For example, if the input list is [1, 2, 2, 3, 4, 4, 5], the output should be [1, 2, 3, 4, 5].\nPle...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 2, 3, 4, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert unique_elements([1, 1, 1, 1]) == [1]\", \"assert unique_elements([]) == []\", \"assert unique_elements([5, 5, 5, 5, 5]) == [5]\", \"assert unique_elements([1, 2, 3, 4, 5]) == [1, 2, 3, 4, ...
{ "split": "train", "index": 2980, "acecode_id": "bigcode_python_fns_43071", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that retrieves the URL of pretrained weights for a deep learning model based on a provided weights dictionary. The function should take in a dictionary of weights, the model name, and the type of pretrained weights to load. It shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_pretrained_weights_url({'resnet18': {'pretrained1': 'url1', 'pretrained2': 'url2'}}, 'resnet18', 'pretrained1') == 'url1'\", \"assert get_pretrained_weights_url({'vgg16': {'pretrained1': 'url3', 'pretrained2': 'url4'}}, 'vgg16', 'pretrained2') == 'url4'\...
{ "split": "train", "index": 2981, "acecode_id": "oss_28522", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes three distinct numerical sequences (lists or tuples) and returns the sequence with the largest sum. If two or more sequences have the same sum, return the one with fewer negative numbers. If all sequences are identical, return any of them. The fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert largest_sum_seq([1, 2, 3], [4, 5, 6], [7, 8, 9]) == [7, 8, 9]\", \"assert largest_sum_seq([-1, -2, -3], [-4, -5, -6], [-7, -8, -9]) == [-1, -2, -3]\", \"assert largest_sum_seq([1, 2, 3], [3, 2, 1], [1, 1, 1]) == [1, 2, 3]\", \"assert largest_sum_seq([1.5, 2....
{ "split": "train", "index": 2982, "acecode_id": "evol_7557", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of tags in IOBES format, which is commonly used in natural language processing for entity recognition. Your task is to convert these tags into IOB format. The IOBES format uses the following tag prefixes: 'B' for the beginning of an entity, 'I' for inside a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_tags(['O', 'B-ORG', 'I-ORG', 'E-ORG']) == ['O', 'B-ORG', 'I-ORG', 'I-ORG']\", \"assert convert_tags(['S-DATE', 'B-LOC', 'I-LOC', 'E-LOC', 'O']) == ['B-DATE', 'B-LOC', 'I-LOC', 'I-LOC', 'O']\", \"assert convert_tags(['rel', 'B-PROD', 'I-PROD', 'O']) =...
{ "split": "train", "index": 2983, "acecode_id": "bigcode_python_fns_11519", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a moving average calculator. Given a stream of integers and a window size, your goal is to calculate the moving average for each window of the specified size as the stream progresses. Write a function `calculate_moving_average` that takes in two...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_moving_average([10, 20, 30, 40, 50, 60, 70], 3) == [20.0, 30.0, 40.0, 50.0, 60.0]\", \"assert calculate_moving_average([1, 2, 3, 4, 5], 2) == [1.5, 2.5, 3.5, 4.5]\", \"assert calculate_moving_average([5, 10, 15], 1) == [5.0, 10.0, 15.0]\", \"assert...
{ "split": "train", "index": 2984, "acecode_id": "oss_13340", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that can manage the versioning and release dates of software packages. Your function should take a list of tuples, where each tuple contains three elements: the package name (a string), the version number (a string), and the release date ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_packages([('numpy', '1.21.0', '2021-05-01'), ('pandas', '1.3.0', '2021-07-02')]) == {'numpy': {'version': '1.21.0', 'release_date': '2021-05-01'}, 'pandas': {'version': '1.3.0', 'release_date': '2021-07-02'}}\", \"assert manage_packages([('requests', ...
{ "split": "train", "index": 2985, "acecode_id": "oss_35300", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a linked list node represented as a Python class `Node` with two attributes: `value` (an integer) and `next` (the next node in the list). Write a function `rebase_node(curr: Optional[Node], pre: Node) -> Node` that takes in two parameters: `curr`, which can be eit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rebase_node(None, Node(6)).value == 6\", \"assert rebase_node(Node(7), Node(8)).next.value == 8\", \"assert rebase_node(None, Node(11)).next == None\", \"assert rebase_node(Node(12), Node(13)).next.value == 13\", \"assert rebase_node(Node(14), Node(15)).valu...
{ "split": "train", "index": 2986, "acecode_id": "bigcode_python_fns_47171", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design a Python function that transforms a tuple of strings into a structured dictionary format. Each string in the tuple is formatted as 'key: value' where the key can be nested using dot notation (e.g., 'key1.key2: value'). If there are multiple values for a key, they should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_tuple_to_dict(('a.b.c: 1', 'a.b.d: 2')) == {'a': {'b': {'c': '1', 'd': '2'}}}\", \"assert transform_tuple_to_dict(('x.y.z: 3', 'x.y.w: 4, 5')) == {'x': {'y': {'z': '3', 'w': ['4', '5']}}}\", \"assert transform_tuple_to_dict(('m.n.o: 100', 'm.n.p: 2...
{ "split": "train", "index": 2987, "acecode_id": "evol_30682", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given two lists of integers, lst1 and lst2, write a function `transposition(lst1, lst2)` that checks if it is possible to make all elements of lst1 even while keeping the sum of elements in lst1 and lst2 constant. The function should return 'YES' if it is possible and 'NO' if i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transposition([2, 4], [1, 3]) == 'YES'\", \"assert transposition([0, 2, 4], [2, 4, 6]) == 'YES'\", \"assert transposition([1, 2], [3, 4]) == 'YES'\", \"assert transposition([2], [1]) == 'YES'\", \"assert transposition([0, 0, 0], [1, 1, 1]) == 'YES'\", \"asse...
{ "split": "train", "index": 2988, "acecode_id": "evol_15734", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that converts a given decimal number to its binary representation. Implement the function `decimal_to_binary(decimal: int) -> str` which takes an integer `decimal` as its parameter and returns a string representing the binary equiv...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decimal_to_binary(10) == '1010'\", \"assert decimal_to_binary(27) == '11011'\", \"assert decimal_to_binary(0) == '0'\", \"assert decimal_to_binary(-10) == '-1010'\", \"assert decimal_to_binary(-27) == '-11011'\", \"assert decimal_to_binary(1) == '1'\", \"ass...
{ "split": "train", "index": 2989, "acecode_id": "oss_36066", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to create a function that randomly selects a nickname from a predefined list of options. The function, named `change_nickname`, should take no arguments and return a randomly selected nickname from the list. The list of options is: ['ChunFriendly', 'ChunKind', 'ChunHel...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert change_nickname() in ['ChunFriendly', 'ChunKind', 'ChunHelpful']\", \"assert change_nickname() in ['ChunFriendly', 'ChunKind', 'ChunHelpful']\", \"assert change_nickname() in ['ChunFriendly', 'ChunKind', 'ChunHelpful']\", \"assert change_nickname() in ['Chun...
{ "split": "train", "index": 2990, "acecode_id": "oss_12819", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing a sequence of operations. Each operation can be either a 'raise' (increase the value) or a 'lower' (decrease the value) operation, and is represented by a tuple of the form (operation_type, index). Your task is to write a function `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simplify_operations([('raise', 0), ('lower', 0)]) == []\", \"assert simplify_operations([('raise', 0), ('raise', 1), ('lower', 0), ('lower', 1)]) == []\", \"assert simplify_operations([]) == []\", \"assert simplify_operations([('raise', 0), ('lower', 0), ('r...
{ "split": "train", "index": 2991, "acecode_id": "bigcode_python_fns_37840", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Create a function called 'digitSum' that accepts a string input. The function should extract all uppercase letters from the string, convert each of these letters to their corresponding ASCII values, and return the total sum of these ASCII values. If there are no uppercase lette...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert digitSum('') == 0\", \"assert digitSum('abAB') == 131\", \"assert digitSum('abcCd') == 67\", \"assert digitSum('helloE') == 69\", \"assert digitSum('woArBld') == 131\", \"assert digitSum('aAaaaXa') == 153\", \"assert digitSum('XYZ') == 88+89+90\", \"assert d...
{ "split": "train", "index": 2992, "acecode_id": "evol_5480", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that accepts a string input from the user and returns a dictionary that catalogs the frequency of each character in the string. The keys of the dictionary should be the characters, and the values should be their corresponding frequencies....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert catalog_character_frequency('hello') == {'h': 1, 'e': 1, 'l': 2, 'o': 1}\", \"assert catalog_character_frequency('aabbcc') == {'a': 2, 'b': 2, 'c': 2}\", \"assert catalog_character_frequency('') == {}\", \"assert catalog_character_frequency('abc') == {'a': 1...
{ "split": "train", "index": 2993, "acecode_id": "evol_10217", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function that takes a large integer input, X (where 1 <= X <= 10^12), and returns a list of all unique prime divisors of that number. The function should handle edge cases where the input is less than 1 or greater than 10^12 by raising a ValueError. The output shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_prime_factors(12) == [2, 3]\", \"assert get_prime_factors(28) == [2, 7]\", \"assert get_prime_factors(1) == []\", \"assert get_prime_factors(29) == [29]\", \"assert get_prime_factors(100) == [2, 5]\", \"assert get_prime_factors(30) == [2, 3, 5]\", \"asse...
{ "split": "train", "index": 2994, "acecode_id": "evol_21619", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary where keys are identifiers (strings) and values are tuples containing a nucleotide sequence (a string consisting of characters 'A', 'C', 'G', 'T') and a list of scores (a list of integers). Your task is to implement a function `set_sequences(sequence_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_sequences({'seq1': ('ACGT', [1, 2, 3]), 'seq2': ('TGCA', [4, 5, 6])}, as_rna=False) == {'seq1': ('ACGT', [1, 2, 3]), 'seq2': ('TGCA', [4, 5, 6])}\", \"assert set_sequences({'seq1': ('ACGT', [1, 2, 3]), 'seq2': ('TGCA', [4, 5, 6])}, as_rna=True) == {'seq1...
{ "split": "train", "index": 2995, "acecode_id": "bigcode_python_fns_20381", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `text` and a character `symbol`, implement a function `find_symbol` that returns a list of all the indices where the `symbol` appears in the `text`. The function should be case-sensitive and should return an empty list if the `symbol` is not found.\nPlease reason...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_symbol('This is a test string without the character.', '#') == []\", \"assert find_symbol('Just one character: @', '@') == [20]\", \"assert find_symbol('No symbols here.', '$') == []\", \"assert find_symbol('Special characters: #, $, %, &, *', '#') == [...
{ "split": "train", "index": 2996, "acecode_id": "evol_14596", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that validates a password against a stored password. The function `check_password(stored_password: str, input_password: str) -> bool` should take two parameters: `stored_password`, which is the correct password, and `input_password`, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_password('P@ssw0rd', 'P@ssw0rd') == True\", \"assert check_password('Password123', 'Password123') == True\", \"assert check_password('SecretKey!', 'secretkey!') == False\", \"assert check_password('admin', 'admin') == True\", \"assert check_password('u...
{ "split": "train", "index": 2997, "acecode_id": "oss_34340", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of polygons represented by their vertices in a 2D plane, determine if a given point lies within any of the polygons. A polygon is defined as a list of tuples, where each tuple represents the (x, y) coordinates of a vertex. The function should return 'inside' if the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert point_in_polygons([[(0, 0), (5, 0), (5, 5), (0, 5)]], (3, 3)) == 'inside'\", \"assert point_in_polygons([[(0, 0), (5, 0), (5, 5), (0, 5)]], (6, 6)) == 'outside'\", \"assert point_in_polygons([[(1, 1), (2, 3), (3, 1)]], (2, 2)) == 'inside'\", \"assert point_i...
{ "split": "train", "index": 2998, "acecode_id": "bigcode_python_fns_32034", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of strings as input and returns a new list where each string from the input list is repeated a number of times equal to the length of the input list. The output should maintain the order of the original elements. For example, if the input list...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replicate_list(['a', 'b', 'c']) == ['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c']\", \"assert replicate_list(['x', 'y']) == ['x', 'x', 'y', 'y']\", \"assert replicate_list(['hello']) == ['hello']\", \"assert replicate_list(['a']) == ['a']\", \"assert replicat...
{ "split": "train", "index": 2999, "acecode_id": "evol_29879", "num_tests": 16 }