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": "Given a list of float numbers, normalize the values in the list by dividing each value by the maximum value in the list. Return a new list containing the normalized values. If the maximum value is 0, return a list of zeros with the same length as the input list. The normalized ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert normalize_values([1.0, 2.0, 3.0, 4.0]) == [0.25, 0.5, 0.75, 1.0]\", \"assert normalize_values([0.0, 0.0, 0.0]) == [0.0, 0.0, 0.0]\", \"assert normalize_values([10.0, 20.0, 30.0]) == [0.33, 0.67, 1.0]\", \"assert normalize_values([5.0, 5.0, 5.0]) == [1.0, 1.0...
{ "split": "train", "index": 80200, "acecode_id": "bigcode_python_fns_14128", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function called `update_person_age` that takes in a person's name as a string and their current age as an integer, as well as a number of years to update their age by. The function should return the new age of the person after adding the specified number of years to...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_person_age('John', 25, 5) == 30\", \"assert update_person_age('Alice', 30, 10) == 40\", \"assert update_person_age('Bob', 20, 2) == 22\", \"assert update_person_age('Charlie', 15, 3) == 18\", \"assert update_person_age('Diana', 40, 5) == 45\", \"asser...
{ "split": "train", "index": 80201, "acecode_id": "evol_34324", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `assembleMSG` that returns a specific message based on the input parameter `teid` (Transmission Entity Identifier). The function should behave as follows: \n- If `teid` is 1, return 'Hello, World!'. \n- If `teid` is 2, return 'This...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert assembleMSG(1) == 'Hello, World!'\", \"assert assembleMSG(2) == 'This is a test message.'\", \"assert assembleMSG(3) == 'Important notification: Please read ASAP.'\", \"assert assembleMSG(4) == 'Emergency: System malfunction detected!'\", \"assert assembleMS...
{ "split": "train", "index": 80202, "acecode_id": "oss_14888", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary called ReviewsD where the keys are item IDs and the values are dictionaries representing user scores for those items. Each user in the inner dictionary is identified by their userID and their corresponding score. You also have a userIDTest to identify...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculatePredictions({'item1': {'user1': 5}, 'item2': {'user1': 4}}, 'user1', 5, {'item1': 0.5, 'item2': 0.5}) == (5, 4.5)\", \"assert calculatePredictions({'item1': {'user2': 5}, 'item2': {'user2': 4}}, 'user1', 4, {'item1': 0.7, 'item2': 0.7}) == None\", \...
{ "split": "train", "index": 80203, "acecode_id": "bigcode_python_fns_8418", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string representing a Google Analytics account ID and returns a boolean indicating whether the account ID is valid. A valid account ID must consist of exactly six digits and should not start with zero. Implement the function ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_account_id('123456') == True\", \"assert is_valid_account_id('654321') == True\", \"assert is_valid_account_id('000000') == False\", \"assert is_valid_account_id('12345') == False\", \"assert is_valid_account_id('1234567') == False\", \"assert is_va...
{ "split": "train", "index": 80204, "acecode_id": "bigcode_python_fns_44902", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string that contains pairs of numbers in the format 'HLU Number ALU Number', where each pair is separated by a newline. Your task is to write a function that processes this string and constructs a dictionary mapping ALU numbers to HLU numbers. The input string m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert to_alu_hlu_map(' 0 12\\\\n 1 23\\\\n') == {12: 0, 23: 1}\", \"assert to_alu_hlu_map(' 0 12\\\\n 0 23\\\\n') == {12: 0, 23: 0}\", \"assert to_alu_hlu_map('\\\\n\\\\n\\\\n') == {}\", \"assert to_alu_hlu_map(' 0 12\\\\n 1 23\\\\n 2 34\\\\n') == {12: 0, 23: 1, 3...
{ "split": "train", "index": 80205, "acecode_id": "bigcode_python_fns_40894", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a datetime object that includes a specific timezone information, implement a function `format_datetime_with_timezone(dt: datetime) -> str` that returns a string representation of the datetime in the format 'YY/MM/DD HH:MM'. The output should reflect the local time of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_datetime_with_timezone(datetime(2013, 2, 1, 17, 20, tzinfo=timezone.utc)) == '13/02/01 17:20'\", \"assert format_datetime_with_timezone(datetime(2020, 12, 25, 15, 5, tzinfo=timezone.utc)) == '20/12/25 15:05'\", \"assert format_datetime_with_timezone(d...
{ "split": "train", "index": 80206, "acecode_id": "bigcode_python_fns_27416", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `resize_image(image: List[List[Tuple[int, int, int]]], new_size: Tuple[int, int]) -> List[List[Tuple[int, int, int]]]` that takes in an image represented as a 2D list of RGB tuples and a new size as a tuple of width and height. The function should resize th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert resize_image([[(255, 0, 0), (0, 255, 0)], [(0, 0, 255), (255, 255, 0)]], (2, 2)) == [[(255, 0, 0), (0, 255, 0)], [(0, 0, 255), (255, 255, 0)]]\", \"assert resize_image([[(255, 0, 0), (0, 255, 0)], [(0, 0, 255), (255, 255, 0)]], (1, 1)) == [[(255, 0, 0)]]\", ...
{ "split": "train", "index": 80207, "acecode_id": "bigcode_python_fns_21073", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You have been given a list of dictionaries where each dictionary contains a 'name' and a 'location'. Your task is to implement a function that sorts this list by the 'location' field using a custom lexicographic order function. The custom lexicographic order should compare two ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_sort([{'name': 'Alice', 'location': 'Canada'}, {'name': 'Bob', 'location': 'Australia'}]) == [{'name': 'Bob', 'location': 'Australia'}, {'name': 'Alice', 'location': 'Canada'}]\", \"assert custom_sort([{'name': 'Eve', 'location': 'Brazil'}, {'name': '...
{ "split": "train", "index": 80208, "acecode_id": "evol_16391", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that generates a SQL CREATE TABLE statement based on a list of tuples representing database fields and their corresponding data types. Each tuple contains two elements: the field name (as a string) and the data type in the format '...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_create_table_sql([('user1', 'models.CharField(max_length=50)'), ('user2', 'models.CharField(max_length=50)')]) == 'CREATE TABLE table_name (\\\\n user1 VARCHAR(50),\\\\n user2 VARCHAR(50)\\\\n);'\", \"assert generate_create_table_sql([('name',...
{ "split": "train", "index": 80209, "acecode_id": "oss_2680", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of buildings in a skyline. Your task is to implement a function `maxSkylineHeight(heights)` that takes a list of integers `heights` and returns the maximum height of the buildings that can be seen from the side. The maxi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxSkylineHeight([1, 3, 2, 5, 4]) == 5\", \"assert maxSkylineHeight([10, 20, 30, 25]) == 30\", \"assert maxSkylineHeight([7, 7, 7, 7]) == 7\", \"assert maxSkylineHeight([0, 0, 0, 0]) == 0\", \"assert maxSkylineHeight([-1, -2, -3]) == -1\", \"assert maxSkylin...
{ "split": "train", "index": 80210, "acecode_id": "oss_13638", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string S and a pattern P, write a function that finds all occurrences of the pattern P in the string S, allowing for overlapping occurrences. The function should return a list of starting indices where P is found within S. If the pattern P is not found in S, the functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_occurrences('ABABAB', 'AB') == [0, 2, 4]\", \"assert find_occurrences('hello', 'lo') == [3]\", \"assert find_occurrences('testtesttest', 'test') == [0, 4, 8]\", \"assert find_occurrences('aaaaaa', 'aa') == [0, 1, 2, 3, 4]\", \"assert find_occurrences('a...
{ "split": "train", "index": 80211, "acecode_id": "evol_26524", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that rearranges a given string (case-sensitive) in alphabetical order and returns a tuple containing both the rearranged string and a frequency dictionary of characters. The frequency dictionary should map each character to its count in the string. Spaces s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_string('aA') == ('Aa', {'A': 1, 'a': 1})\", \"assert sort_string('') == ('', {})\", \"assert sort_string('abc ABC') == (' ABCabc', {' ': 1, 'A': 1, 'B': 1, 'C': 1, 'a': 1, 'b': 1, 'c': 1})\", \"assert sort_string('123 321') == (' 112233', {' ': 1, '1': ...
{ "split": "train", "index": 80212, "acecode_id": "evol_32014", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes player status data from a gaming platform. The function should accept a dictionary containing player information and return a new dictionary summarizing the player's status. The input dictionary will have the following keys...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert summarize_player_status({'Rank': 'Default', 'LastSeen': '1 day ago', 'CurrentStatus': 'Currently Offline', 'FirstJoined': '30/05/2021', 'TimePlayed': '22 hours played', 'MonthlyViews': 12, 'HCF': {'Kills': 0, 'Deaths': 0, 'KDR': 0.0, 'Lives': 0, 'Playtime': ...
{ "split": "train", "index": 80213, "acecode_id": "bigcode_python_fns_10523", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a string message that may contain names of cities. Your task is to implement a function named `get_city(msg: str) -> Optional[str]`, which extracts the first city name from the message. The city name is identified by the prefix 'City:'. If a city name is found, re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_city('I live in City:NewYork') == 'NewYork'\", \"assert get_city('We visited City:LosAngeles last summer.') == 'LosAngeles'\", \"assert get_city('This is not a city name.') == None\", \"assert get_city('City:Tokyo is beautiful.') == 'Tokyo'\", \"assert g...
{ "split": "train", "index": 80214, "acecode_id": "bigcode_python_fns_46746", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a long message string that may exceed 150 characters. Your task is to implement a function called `chop_and_prepend` that divides the input string into blocks of up to 150 characters each. Each block should be prefixed with a message indicator in the format (XX/YY...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert chop_and_prepend('') == []\", \"assert chop_and_prepend('Lorem ipsum dolor sit amet.') == ['(01/01) Lorem ipsum dolor sit amet.']\", \"assert chop_and_prepend('a' * 150) == ['(01/01) ' + 'a' * 150]\", \"assert chop_and_prepend('a' * 151) == ['(01/02) ' + 'a'...
{ "split": "train", "index": 80215, "acecode_id": "oss_9376", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple visibility control system for a company. The function should take in a list of documents and a user's authentication status, and return the documents that the user is allowed to see based on their authentication st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_visible_documents(['doc1', 'doc2', 'doc3'], True) == ['doc1', 'doc2', 'doc3']\", \"assert get_visible_documents(['doc1', 'doc2'], False) == []\", \"assert get_visible_documents(['financial_report', 'employee_list'], True) == ['financial_report', 'employe...
{ "split": "train", "index": 80216, "acecode_id": "oss_16892", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two lists of directory paths, one containing directories that must be protected and the other containing directories that may work on files, write a function `directory_stats(protect_dirs: List[str], work_on_dirs: List[str]) -> Tuple[int, int]` that returns two integers. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert directory_stats(['ki1', 'ki1/df', 'ki1/df/ki12'], ['df2', 'ki1/df']) == (3, 2)\", \"assert directory_stats(['df2', 'ki1/df'], ['ki1', 'ki1/df/ki13']) == (2, 2)\", \"assert directory_stats(['ki1', 'ki1/df/ki12', 'ki1/df/ki13'], ['df2', 'ki1/df']) == (3, 2)\",...
{ "split": "train", "index": 80217, "acecode_id": "bigcode_python_fns_1705", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `quick_sort(arr: List[int]) -> List[int]` that takes a list of integers and returns a new list containing the elements sorted in ascending order using the QuickSort algorithm. The original list should not be modified. You may assume that the input list will...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quick_sort([10, 7, 8, 9, 1, 5]) == [1, 5, 7, 8, 9, 10]\", \"assert quick_sort([]) == []\", \"assert quick_sort([1]) == [1]\", \"assert quick_sort([2, 1]) == [1, 2]\", \"assert quick_sort([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5]\", \"assert quick_sort([1, 2, 3, 4,...
{ "split": "train", "index": 80218, "acecode_id": "evol_21556", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that handles changes in playback modes for a media player. The function should accept two parameters: a string representing the new repeat mode ('none', 'all', 'one') and a boolean indicating whether the shuffle mode is enabled. The f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_playback_modes('none', False) == {'repeat_mode': 'none', 'shuffle_mode': False}\", \"assert update_playback_modes('all', True) == {'repeat_mode': 'all', 'shuffle_mode': True}\", \"assert update_playback_modes('one', False) == {'repeat_mode': 'one', 's...
{ "split": "train", "index": 80219, "acecode_id": "oss_571", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of integers and returns a list of integers representing the heights of spacers. Each spacer height will be derived from the original list by ensuring that all heights are at least 20 units tall. If a height is less than ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert adjust_spacer_heights([10, 25, 5, 30]) == [20, 25, 20, 30]\", \"assert adjust_spacer_heights([20, 20, 20]) == [20, 20, 20]\", \"assert adjust_spacer_heights([15, 18, 22, 19]) == [20, 20, 22, 20]\", \"assert adjust_spacer_heights([0, -5, 100]) == [20, 20, 100...
{ "split": "train", "index": 80220, "acecode_id": "oss_17757", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function named `validate_recovery` that takes three parameters: `file_a_size` (an integer representing the size of the first file), `file_b_size` (an integer representing the size of the second file), and `recovered_state` (a string representi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_recovery(10, 20, 'second') == True\", \"assert validate_recovery(0, 20, 'second') == False\", \"assert validate_recovery(10, 0, 'second') == False\", \"assert validate_recovery(10, 20, 'first') == False\", \"assert validate_recovery(15, 30, 'second'...
{ "split": "train", "index": 80221, "acecode_id": "oss_28034", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function to keep track of the list of items purchased by each customer as a time-series and maintain the order in which the purchases were made. The function should allow adding purchases for a given customer and provide a method to efficiently retrieve the N most r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_n_most_recent_purchases({1: ['item1', 'item2', 'item3', 'item4'], 2: ['item1', 'item2']}, 1, 2) == ['item3', 'item4']\", \"assert get_n_most_recent_purchases({1: ['item1'], 2: ['item1', 'item2']}, 2, 1) == ['item2']\", \"assert get_n_most_recent_purchase...
{ "split": "train", "index": 80222, "acecode_id": "evol_28380", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a collision detection algorithm for two rectangular objects in a 2D space. Each rectangular object is defined by its top-left and bottom-right corner coordinates, as well as a 2D array representing its physical map. Your goal is to determine if ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_collision((0, 0), (2, 2), (0, 0), (2, 2), (0, 0), (2, 2), [[1, 1], [1, 1]], [[1, 1], [1, 1]]) == True\", \"assert check_collision((0, 0), (2, 2), (1, 1), (3, 3), (1, 1), (2, 2), [[1, 1], [0, 0]], [[1, 0], [0, 1]]) == False\", \"assert check_collision((...
{ "split": "train", "index": 80223, "acecode_id": "oss_16709", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a 2D grid of integers and an integer k, write a function `maxSumPath(grid: List[List[int]], k: int) -> int` that returns the maximum sum of values on a path from the top-left corner to any cell in the grid, where you can move either right, left, down, or up, and you are a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxSumPath([[1]], 0) == 1\", \"assert maxSumPath([[0]], 1) == 0\", \"assert maxSumPath([[5, 5], [5, 5]], 2) == 15\", \"assert maxSumPath([[1, 2, 3], [4, 5, 6]], 0) == 1\", \"assert maxSumPath([[1, 2, 3, 4]], 3) == 10\", \"assert maxSumPath([[1, 1, 1], [1, 1,...
{ "split": "train", "index": 80224, "acecode_id": "evol_20409", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a list of image filenames and a list of sound filenames along with a multi-dimensional array representing the distances between each sound and image. Your task is to find the rank of the first image in the sorted distance list that is associated with a specified s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_image_rank(0, [[0.1, 0.2], [0.3, 0.4]], ['sound1', 'sound2'], ['image1', 'image2'], {'sound1': ['image1', 'image3']}) == 1\", \"assert find_image_rank(1, [[0.1, 0.5], [0.3, 0.2]], ['sound1', 'sound2'], ['image1', 'image2'], {'sound2': ['image3']}) == 3\...
{ "split": "train", "index": 80225, "acecode_id": "bigcode_python_fns_46950", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given two integer lists, List1 and List2, write a function called `find_intersection` that returns a list containing the elements that are present in both lists. The returned list should contain unique elements and be sorted in ascending order. The input lists are predefined as...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_intersection([2, 5, 9, 12, 17], [3, 5, 9, 10]) == [5, 9]\", \"assert find_intersection([1, 2, 3], [3, 4, 5]) == [3]\", \"assert find_intersection([1, 2, 3], [4, 5, 6]) == []\", \"assert find_intersection([1, 2, 3, 3], [3, 3, 3]) == [3]\", \"assert find_...
{ "split": "train", "index": 80226, "acecode_id": "evol_27138", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a program that processes a list of academic disciplines and categorizes them based on their fields of study. Each discipline is represented as a string containing one or more fields of study separated by commas. Your program should categorize the di...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_disciplines(['Business', 'Communications and Journalism', 'Computer Science,Education']) == {'Business': 1, 'Communications and Journalism': 1, 'Computer Science': 1, 'Education': 1}\", \"assert categorize_disciplines(['Mathematics,Statistics', 'M...
{ "split": "train", "index": 80227, "acecode_id": "oss_15972", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a system to manage different types of noodles and their decorations. You are required to implement a function `get_decorated_noodle_info(decorated_noodle)` that takes a decorated noodle object as input and returns a tuple containing the total cost a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_decorated_noodle_info(MockNoodle(5.00, ['Noodles'])) == (5.00, ['Noodles'])\", \"assert get_decorated_noodle_info(MockNoodle(5.00, ['Noodles', 'Rice'])) == (7.50, ['Noodles', 'Rice'])\", \"assert get_decorated_noodle_info(MockNoodle(5.00, ['Noodles', 'Ve...
{ "split": "train", "index": 80228, "acecode_id": "oss_5141", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `seed_database()` that simulates seeding a database. The function takes no parameters and performs a single operation: updating the database's version from its current state to the latest version. The function should return a string r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert seed_database() == '2.0.1'\", \"assert seed_database() == '2.0.1'\", \"assert seed_database() == '2.0.1'\", \"assert seed_database() == '2.0.1'\", \"assert seed_database() == '2.0.1'\"]}" }
{ "split": "train", "index": 80229, "acecode_id": "bigcode_python_fns_39224", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a cluster configuration represented as a dictionary with the following keys: 'cluster_name', 'nodes', and 'min_workers'. Write a function `teardown_cluster(config: Dict[str, Any], yes: bool, workers_only: bool, override_cluster_name: Optional[str], keep_min_worker...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert teardown_cluster({'cluster_name': 'test-cluster', 'nodes': 5, 'min_workers': 1}, False, False, None, False, False) == 'Shutdown aborted.'\", \"assert teardown_cluster({'cluster_name': 'test-cluster', 'nodes': 5, 'min_workers': 1}, True, False, None, False, F...
{ "split": "train", "index": 80230, "acecode_id": "bigcode_python_fns_45779", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a payload for a location based on the provided domain, parent location, and a dictionary of data. The function should format the keys of the dictionary into a specific string format that includes a prefix and the property n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_payload('example.com', 'parent_location', {'key1': 'value1', 'key2': 'value2'}) == {'main-key1': 'value1', 'main-key2': 'value2'}\", \"assert create_payload('example.com', 'parent_location', {('prefix1', 'key1'): 'value1', ('prefix2', 'key2'): 'value2...
{ "split": "train", "index": 80231, "acecode_id": "bigcode_python_fns_191", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string input representing a template with placeholders and returns the rendered string. The template may contain placeholders in the format {{key}}. For this problem, you should assume that the only valid key is 'name', which...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert render_template('Hello, {{name}}!') == 'Hello, World!'\", \"assert render_template('Welcome to {{name}}.') == 'Welcome to World.'\", \"assert render_template('{{name}}, how are you?') == 'World, how are you?'\", \"assert render_template('Goodbye, {{name}}!')...
{ "split": "train", "index": 80232, "acecode_id": "bigcode_python_fns_19982", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with verifying if a proposed new ID for a node or link in a project falls within an allowable range defined in a configuration. Implement a function that checks whether the subject ID exists in the provided range dictionary. If the ID is not found in the range, t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_id_in_range('node', 'ProjectA', 5, {1: True, 2: False, 3: True, 4: True, 5: True}) == True\", \"assert check_id_in_range('link', 'ProjectB', 2, {1: False, 2: True, 3: False}) == True\", \"assert check_id_in_range('node', 'ProjectE', 1, {1: True}) == Tr...
{ "split": "train", "index": 80233, "acecode_id": "bigcode_python_fns_32541", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that filters devices based on the vendor name from a given list of devices. The function should take two parameters: a list of devices, where each device is represented by a dictionary containing its 'name' and 'vendor', and a string repr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_devices([{'name': 'Device1', 'vendor': 'VendorA'}, {'name': 'Device2', 'vendor': 'VendorB'}], 'VendorA') == ['Device1']\", \"assert filter_devices([{'name': 'Device1', 'vendor': 'VendorA'}, {'name': 'Device2', 'vendor': 'VendorB'}], 'VendorC') == []\"...
{ "split": "train", "index": 80234, "acecode_id": "oss_14006", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `compute_factorials(numbers: List[int]) -> Dict[int, int]` that calculates the factorial for a list of non-negative integers. The factorial of a number is the product of all positive integers less than or equal to that number. Your implementation should be ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_factorials([0]) == {0: 1}\", \"assert compute_factorials([1]) == {1: 1}\", \"assert compute_factorials([2]) == {2: 2}\", \"assert compute_factorials([3]) == {3: 6}\", \"assert compute_factorials([4]) == {4: 24}\", \"assert compute_factorials([5]) == ...
{ "split": "train", "index": 80235, "acecode_id": "evol_11858", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings representing the names of items in a hierarchy (from child to parent), implement a function `qualified_name(names: List[str]) -> str` that returns the full name of the item, including all its parent names concatenated with ' / '. If any name in the list ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert qualified_name(['Project1', None, 'Task1']) == None\", \"assert qualified_name(['Main', 'Sub', None, 'End']) == None\", \"assert qualified_name(['']) == ''\", \"assert qualified_name(['OnlyOne']) == 'OnlyOne'\", \"assert qualified_name([]) == ''\", \"assert ...
{ "split": "train", "index": 80236, "acecode_id": "bigcode_python_fns_806", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Write a Python function named `check_and_install_flask` that checks if the Flask web framework is installed in the system. If Flask is not installed, the function should return the string 'Flask is not installed, please install it.' If Flask is installed, it should return the s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_and_install_flask() == 'Flask is not installed, please install it.'\", \"assert check_and_install_flask() == 'Flask is not installed, please install it.'\", \"assert check_and_install_flask() == 'Flask is not installed, please install it.'\", \"assert ...
{ "split": "train", "index": 80237, "acecode_id": "evol_34589", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given two strings, `s1` and `s2`, determine if `s2` can become a substring of `s1` through a series of transformations. The transformations allowed are up to three direct swaps of letters within `s2` and a single replacement of one character in `s2` with any character from `s1`...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert cyclic_transform_check('hello', 'ell') == True\", \"assert cyclic_transform_check('abab', 'baa') == True\", \"assert cyclic_transform_check('himenss', 'simen') == True\", \"assert cyclic_transform_check('abc', 'cba') == True\", \"assert cyclic_transform_chec...
{ "split": "train", "index": 80238, "acecode_id": "evol_21020", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a user management system that allows users to check if they can export the private keys of other users based on their roles and status. You need to implement the function `canUserExportPrivateKey(currentUser: str, targetUser: str, users: Dict[st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert canUserExportPrivateKey('admin', 'user1', {'admin': ('admin', True), 'user1': ('nonadmin', True)}) == True\", \"assert canUserExportPrivateKey('admin', 'user2', {'admin': ('admin', True), 'user2': ('nonadmin', False)}) == True\", \"assert canUserExportPrivat...
{ "split": "train", "index": 80239, "acecode_id": "oss_29150", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that checks if a given HTML string contains properly formatted tags and adheres to basic web standards. The function should return True if the HTML is valid (all tags are properly opened and closed), and False otherwise. You can assume that the input will b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_html_valid('<html><head><title>Sample</title></head><body></body></html>') == True\", \"assert is_html_valid('<div><p>Text</p><p>More Text</div>') == False\", \"assert is_html_valid('<a href=\\\"#\\\">Link</a>') == True\", \"assert is_html_valid('<ul><li>...
{ "split": "train", "index": 80240, "acecode_id": "evol_8714", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, write a function that checks if n is equal to the sum of the cubes of its digits. Return True if it is, otherwise return False.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_sum_of_cubes(371) == True\", \"assert check_sum_of_cubes(153) == True\", \"assert check_sum_of_cubes(2) == False\", \"assert check_sum_of_cubes(3) == False\", \"assert check_sum_of_cubes(4) == False\", \"assert check_sum_of_cubes(5) == False\", \"asser...
{ "split": "train", "index": 80241, "acecode_id": "evol_7782", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a date represented as a four-tuple (year, month, day, day_of_week) and a date pattern represented as another four-tuple (year_pattern, month_pattern, day_pattern, day_of_week_pattern). Your task is to determine if the date matches the date pattern according to the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert match_date((2023, 10, 15, 0), (2023, 10, 15, 0)) == True\", \"assert match_date((2023, 10, 15, 0), (255, 10, 15, 0)) == True\", \"assert match_date((2023, 10, 15, 0), (2023, 255, 15, 0)) == True\", \"assert match_date((2023, 10, 15, 0), (2023, 10, 255, 0)) =...
{ "split": "train", "index": 80242, "acecode_id": "bigcode_python_fns_10091", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a matrix represented as a two-dimensional array, implement a function that transforms it into a one-dimensional array by concatenating all the elements row-wise. The function should return the resulting one-dimensional array.\nPlease reason step by step, then write a self...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten([[1, 2], [3, 4]]) == [1, 2, 3, 4]\", \"assert flatten([[5, 6], [7, 8], [9]]) == [5, 6, 7, 8, 9]\", \"assert flatten([[1]]) == [1]\", \"assert flatten([[], [1, 2], [3]]) == [1, 2, 3]\", \"assert flatten([[10, 20], [30, 40], [50, 60]]) == [10, 20, 30, ...
{ "split": "train", "index": 80243, "acecode_id": "evol_20629", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D array of integers, implement a function `find_prime_coords(array_2d)` that returns a list of tuples representing the coordinates (row, column) of all the prime numbers in the array. A prime number is defined as a number greater than 1 that has no positive divisors ot...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_prime_coords([[2, 4, 6], [3, 5, 7], [8, 9, 10]]) == [(0, 0), (1, 0), (1, 1), (1, 2)]\", \"assert find_prime_coords([[1, 4, 6], [0, -3, 7], [-1, 2, 8]]) == [(1, 2), (2, 1)]\", \"assert find_prime_coords([[4, 6, 8], [10, 12, 14], [15, 16, 18]]) == []\", \...
{ "split": "train", "index": 80244, "acecode_id": "evol_23663", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a JSON formatted string that represents a configuration, which includes a version and a name. Your task is to implement a function `parse_config(json_string: str) -> dict` that reads this JSON string and returns a dictionary with the following requirements: 1. The...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_config('{\\\"file_version\\\": \\\"1.0\\\", \\\"file_name\\\": \\\"config\\\"}') == {\\\"file_version\\\": \\\"1.0\\\", \\\"file_name\\\": \\\"config\\\"}\", \"assert parse_config('{\\\"file_version\\\": \\\"2.3\\\", \\\"file_name\\\": \\\"settings\\\"...
{ "split": "train", "index": 80245, "acecode_id": "bigcode_python_fns_5534", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that sorts the list in ascending order without using any built-in sort function. The function should also properly handle duplicate numbers in the list. Write a function named `custom_sort(arr)` that takes a list of integers as inp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_sort([8, 1, 9, 4, 6]) == [1, 4, 6, 8, 9]\", \"assert custom_sort([3, 2, 1]) == [1, 2, 3]\", \"assert custom_sort([5, 5, 5, 5]) == [5, 5, 5, 5]\", \"assert custom_sort([10, -1, 2, 0, 2]) == [-1, 0, 2, 2, 10]\", \"assert custom_sort([0, 0, 0]) == [0, 0,...
{ "split": "train", "index": 80246, "acecode_id": "evol_23298", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer n, write a function that generates a list of strings representing the numbers from 1 to n in four different numeral systems: decimal, octal, hexadecimal, and binary. Each number should be represented as a string in the following format: \"decimal octal hexadeci...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_numbers(5) == ['1 1 1 1', '2 2 2 10', '3 3 3 11', '4 4 4 100', '5 5 5 101']\", \"assert format_numbers(1) == ['1 1 1 1']\", \"assert format_numbers(2) == ['1 1 1 1', '2 2 2 10']\", \"assert format_numbers(3) == ['1 1 1 1', '2 2 2 10', '3 3 3 11']\", \...
{ "split": "train", "index": 80247, "acecode_id": "bigcode_python_fns_46727", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes two strings as input and concatenates them with the phrase ' and ' in between. Implement a function named `concatenate_with_and(a: str, b: str) -> str` that takes two strings `a` and `b` and returns a single string in the forma...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert concatenate_with_and('a', 'b') == 'a and b'\", \"assert concatenate_with_and('hello', 'world') == 'hello and world'\", \"assert concatenate_with_and('foo', 'bar') == 'foo and bar'\", \"assert concatenate_with_and('python', 'rocks') == 'python and rocks'\", \...
{ "split": "train", "index": 80248, "acecode_id": "bigcode_python_fns_11321", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a function `transpose_nested_list(data)` that takes a nested list `data` as input, where `data` is a list of lists of lists, your task is to implement the function to transpose the input list. The transposition should switch the last two dimensions of the nested list. For...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transpose_nested_list([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) == [[[1, 5], [3, 7]], [[2, 6], [4, 8]]]\", \"assert transpose_nested_list([[[1], [2]], [[3], [4]]]) == [[[1, 3], [2, 4]]]\", \"assert transpose_nested_list([[[1, 0], [0, 1]], [[1, 1], [1, 1]]]) == [...
{ "split": "train", "index": 80249, "acecode_id": "oss_840", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a JSON string as input and returns a sorted version of the JSON object. The sorting should be based on the keys of the JSON object in ascending order. If the input JSON string is invalid, the function should raise a ValueError....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_json_keys('{\\\"b\\\": 1, \\\"a\\\": 2}') == '{\\\"a\\\": 2, \\\"b\\\": 1}'\", \"assert sort_json_keys('{\\\"name\\\": \\\"Alice\\\", \\\"age\\\": 30}') == '{\\\"age\\\": 30, \\\"name\\\": \\\"Alice\\\"}'\", \"assert sort_json_keys('{\\\"key3\\\": \\\"v...
{ "split": "train", "index": 80250, "acecode_id": "oss_17229", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a non-negative integer n, determine whether the sum of its digits is equal to the product of its digits. Implement a function `spynum(n)` that returns True if the sum and product are equal, and False otherwise. The function should handle the case when n is 0 by returning ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert spynum(0) == True\", \"assert spynum(1) == True\", \"assert spynum(2) == True\", \"assert spynum(3) == True\", \"assert spynum(4) == True\", \"assert spynum(5) == True\", \"assert spynum(6) == True\", \"assert spynum(7) == True\", \"assert spynum(8) == True\...
{ "split": "train", "index": 80251, "acecode_id": "evol_14173", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a Python function `launch_application(app_name)` that takes a string `app_name` as input and returns the command to launch the application based on the user's operating system. If the platform is Windows, the function should return the command to launch the application us...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert launch_application('CloudCompare') == 'cloudcompare.CloudCompare'\", \"assert launch_application('CloudCompare') == 'cloudcompare.CloudCompare'\", \"assert launch_application('CloudCompare') == 'cloudcompare.CloudCompare'\", \"assert launch_application('Clou...
{ "split": "train", "index": 80252, "acecode_id": "oss_27820", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that updates the left and right boundaries of a plot based on input data. The boundaries are represented as lists of x and y coordinates. The function should take two tuples `b_left` and `b_right` as input, where each tuple contains two li...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_boundaries(([1, 2, 3], [10, 20, 30]), ([4, 5, 6], [40, 50, 60])) == ([1, 2, 3], [4, 5, 6])\", \"assert update_boundaries(([1, 2], [10, 20]), ([1, 2], [30, 40])) == ([1, 2], [1, 2])\", \"assert update_boundaries(([0, 0], [0, 1]), ([1, 1], [2, 2])) == (...
{ "split": "train", "index": 80253, "acecode_id": "oss_197", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of file objects, where each file object has a 'path' attribute representing its absolute file path. You need to implement a function that strips a specified prefix from each file path and returns a list of tuples. Each tuple should contain the modified path...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert strip_paths([{'path': '/home/user/documents/file1.txt'}, {'path': '/home/user/music/file2.mp3'}], '/home/user/') == [('documents/file1.txt', '/home/user/documents/file1.txt'), ('music/file2.mp3', '/home/user/music/file2.mp3')]\", \"assert strip_paths([{'path...
{ "split": "train", "index": 80254, "acecode_id": "bigcode_python_fns_49933", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer n, implement a function that determines whether n is a natural number. A natural number is defined as a positive integer (1, 2, 3, ...). The function should return True if n is a natural number and False otherwise. Your implementation should handle edge cases s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert not is_natural(-10)\", \"assert not is_natural(-1)\", \"assert not is_natural(0)\", \"assert not is_natural(0.5)\", \"assert not is_natural(1.0)\", \"assert is_natural(1)\", \"assert is_natural(2)\", \"assert is_natural(100)\", \"assert not is_natural(-100)\...
{ "split": "train", "index": 80255, "acecode_id": "bigcode_python_fns_42330", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of bounding boxes represented in the format [x, y, w, h], where (x, y) is the top-left corner of the box, w is the width, and h is the height, write a function that converts each box to the format [x1, y1, x2, y2], where (x1, y1) is the top-left corner and (x2, y2)...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert xywh_to_xyxy([[1, 2, 3, 4]]) == [[1, 2, 3, 5]]\", \"assert xywh_to_xyxy([[0, 0, 5, 5], [1, 1, 2, 2]]) == [[0, 0, 4, 4], [1, 1, 2, 2]]\", \"assert xywh_to_xyxy([[10, 20, 30, 40]]) == [[10, 20, 39, 59]]\", \"assert xywh_to_xyxy([[5, 5, 1, 1]]) == [[5, 5, 5, 5]...
{ "split": "train", "index": 80256, "acecode_id": "bigcode_python_fns_468", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `is_increasing(arr)` that determines whether the given list of integers `arr` is strictly increasing. A list is considered strictly increasing if each element is less than the next one. The function should return `True` if the list is strictly increasing an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_increasing([1, 2, 3, 4, 5]) == True\", \"assert is_increasing([5, 6, 7, 8]) == True\", \"assert is_increasing([10, 20, 30, 40, 50]) == True\", \"assert is_increasing([-5, -3, -1, 0, 1]) == True\", \"assert is_increasing([1, 1, 2, 3]) == False\", \"assert ...
{ "split": "train", "index": 80257, "acecode_id": "evol_32734", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of sample IDs and a list of tuples representing pairs of samples that have been compared for concordance. Each tuple contains two sample IDs and a boolean value indicating whether they are discordant (True) or not (False). Write a function `flag_discordant_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flag_discordant_replicates(['S1', 'S2', 'S3'], [('S1', 'S2', True), ('S2', 'S3', False)]) == {'S1': True, 'S2': True, 'S3': False}\", \"assert flag_discordant_replicates(['A', 'B', 'C'], [('A', 'B', False), ('B', 'C', False)]) == {'A': False, 'B': False, 'C'...
{ "split": "train", "index": 80258, "acecode_id": "bigcode_python_fns_16932", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of integers and a value, removes all occurrences of that value from the list, and returns the modified list in reverse order. The function should handle edge cases such as an empty list or a list that contains only the specified value.\nPl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_and_reverse([7, 8, 9, 10], 5) == [10, 9, 8, 7]\", \"assert remove_and_reverse([1, 1, 1, 1], 1) == []\", \"assert remove_and_reverse([], 0) == []\", \"assert remove_and_reverse([5, 6, 7, 8, 6], 6) == [8, 7, 5]\", \"assert remove_and_reverse([10, 20, 30...
{ "split": "train", "index": 80259, "acecode_id": "evol_7128", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates enabling or disabling various bug fixes for a video game based on a set of boolean flags. Your function `apply_bug_fixes` should take four boolean parameters: `fix_retort_counter`, `fix_jump`, `fix_boss_skip`, and `fix_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert apply_bug_fixes(True, False, False, False) == ['Retort counter fix applied.']\", \"assert apply_bug_fixes(False, True, False, False) == ['Jump fix applied.']\", \"assert apply_bug_fixes(False, False, True, False) == ['Boss skip fix applied.']\", \"assert app...
{ "split": "train", "index": 80260, "acecode_id": "oss_1345", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a two-dimensional array of integers representing an image, where each value corresponds to a pixel's color intensity. Implement a function `reduce_colors(image_array: List[List[int]]) -> List[List[int]]` that modifies the image by applying a color reduction algori...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reduce_colors([[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]]) == [[255, 255], [255, 255]]\", \"assert reduce_colors([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == [[0, 0], [0, 0]]\", \"assert reduce_col...
{ "split": "train", "index": 80261, "acecode_id": "bigcode_python_fns_49530", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of sentences and a list of stopwords as input and returns a dictionary containing the unique words across all sentences, along with the number of their occurrences. The function should be case-insensitive and should ignore any punctuation mark...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert word_frequency(['She sells seashells by the seashore.', 'He buys seashells at the seashore.'], ['she', 'he', 'by', 'the', 'at', 'sells']) == {'seashells': 2, 'seashore': 2, 'buys': 1}\", \"assert word_frequency(['Hello world!', 'Hello again, world.'], ['hell...
{ "split": "train", "index": 80262, "acecode_id": "evol_30512", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a binary string, implement a function that converts the binary string to its corresponding decimal number and counts the number of 1s in the binary string. Additionally, return the reverse of the input binary string. The function should return a tuple containing the decim...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert binary_operations('0000') == (0, 0, '0000')\", \"assert binary_operations('1111') == (15, 4, '1111')\", \"assert binary_operations('1101100') == (108, 4, '0011011')\", \"assert binary_operations('1000001') == (65, 2, '1000001')\", \"assert binary_operations(...
{ "split": "train", "index": 80263, "acecode_id": "evol_21212", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two strings, str1 and str2, write a function check_substring(str1, str2) that returns True if str1 is a substring of str2, and False otherwise. A substring is defined as a contiguous sequence of characters within another string. Ensure to handle cases with overlapping sub...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_substring('Ayda', 'Maya') == False\", \"assert check_substring('abc', 'abcdef') == True\", \"assert check_substring('def', 'abcdef') == True\", \"assert check_substring('gh', 'abcdef') == False\", \"assert check_substring('', 'abcdef') == True\", \"ass...
{ "split": "train", "index": 80264, "acecode_id": "evol_8980", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing coordinates along an axis and a tick mode, implement a function that returns the indices of the coordinates on which ticks should be displayed. The tick mode can either be 'auto' or 'all'. If the mode is 'all', return the indices of all coo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_tick_indices('all', 3, [1, 2, 3]) == ([0, 1, 2], 1)\", \"assert get_tick_indices('auto', 10, [1, 2, 3, 4]) == ([0, 1, 2, 3], 1)\", \"assert get_tick_indices('all', 1, [7]) == ([0], 1)\", \"assert get_tick_indices('auto', 2, [0, 1, 2, 3, 4, 5]) == ([0, 5]...
{ "split": "train", "index": 80265, "acecode_id": "bigcode_python_fns_22365", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `merge_sorted_arrays` that takes two sorted lists of integers and merges them into a single sorted list. The function should maintain the order of elements from the original lists. Write a function that accepts two lists of integer...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_sorted_arrays([1, 3, 5], [2, 4, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert merge_sorted_arrays([1, 2, 3], [4, 5, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert merge_sorted_arrays([1, 1, 1], [1, 1, 1]) == [1, 1, 1, 1, 1, 1]\", \"assert merge_sorted_arrays([], [1, 2,...
{ "split": "train", "index": 80266, "acecode_id": "oss_17459", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of items and returns a modified version of the list based on certain conditions. Write a Python function called `filter_items` that takes a list of tuples as input, where each tuple contains a string and an in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_items([('apple', 5), ('banana', 12), ('orange', 8), ('grape', 15)]) == ['banana', 'grape']\", \"assert filter_items([('cat', 3), ('dog', 10), ('elephant', 20)]) == ['dog', 'elephant']\", \"assert filter_items([('a', 9), ('b', 11), ('c', 10)]) == ['b',...
{ "split": "train", "index": 80267, "acecode_id": "oss_6195", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representation of an HTML document, write a function that retrieves the content of the title tag. If the title tag is not present, return an empty string. Implement the function `get_html_title(html: str) -> str` that takes a single argument, `html`, which is the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_html_title('<html><head><title>Page Title</title></head><body></body></html>') == 'Page Title'\", \"assert get_html_title('<html><head><title>Another Title</title></head><body></body></html>') == 'Another Title'\", \"assert get_html_title('<html><head></...
{ "split": "train", "index": 80268, "acecode_id": "evol_16083", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function `lcm_of_four(a: int, b: int, c: int, d: int) -> int` that takes four integers as input and returns their Least Common Multiple (LCM). You can assume that the input integers will be positive. You should only implement the `lcm_of_four` function and can use helpe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lcm_of_four(2, 3, 4, 5) == 60\", \"assert lcm_of_four(1, 1, 1, 1) == 1\", \"assert lcm_of_four(7, 14, 21, 28) == 84\", \"assert lcm_of_four(5, 10, 15, 20) == 60\", \"assert lcm_of_four(8, 12, 16, 24) == 48\", \"assert lcm_of_four(3, 5, 7, 11) == 1155\", \"as...
{ "split": "train", "index": 80269, "acecode_id": "evol_23459", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates handling an Invalid Grant error in an OAuth process. The function should take a single argument, which is an error message string. If the error message is 'Invalid Grant', the function should return a string 'Error: Invalid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_invalid_grant('Invalid Grant') == 'Error: Invalid Grant - Please check your credentials.'\", \"assert handle_invalid_grant('Invalid Credentials') == 'Invalid Credentials'\", \"assert handle_invalid_grant('Token expired') == 'Token expired'\", \"assert...
{ "split": "train", "index": 80270, "acecode_id": "bigcode_python_fns_6474", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the retrieval of labels associated with tasks in a project management system. The function takes a unique identifier (uid) for a label and returns the corresponding label if it exists. However, it must also handle vario...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_label('valid_uid') == 'valid_uid'\", \"assert get_label('another_valid_uid') == 'another_valid_uid'\", \"assert get_label('label_123') == 'label_123'\", \"assert get_label('label_456') == 'label_456'\", \"assert get_label('label_789') == 'label_789'\", \...
{ "split": "train", "index": 80271, "acecode_id": "oss_22701", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the final position of an object given its initial position, velocity, and time of motion. Write a function `calculate_final_position(initial_position: float, velocity: float, time: float) -> float` that takes in three parameters: the initial posi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_final_position(0, 5, 2) == 10\", \"assert calculate_final_position(10, 0, 5) == 10\", \"assert calculate_final_position(-5, 3, 4) == 7\", \"assert calculate_final_position(0, -5, 2) == -10\", \"assert calculate_final_position(100, 50, 1) == 150\", ...
{ "split": "train", "index": 80272, "acecode_id": "oss_2587", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of event names, write a function called `get_event_by_name` that takes a list of strings and an event name (string) as input. The function should return the index of the event name in the list if it exists, or -1 if it does not exist. Ignore case when comparing the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_event_by_name(['Concert', 'Festival', 'Conference'], 'Festival') == 1\", \"assert get_event_by_name(['Concert', 'Festival', 'Conference'], 'concert') == 0\", \"assert get_event_by_name(['Concert', 'Festival', 'Conference'], 'Sports Event') == -1\", \"ass...
{ "split": "train", "index": 80273, "acecode_id": "bigcode_python_fns_40954", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that accepts an integer value n and creates an n by n matrix, with all elements initialized as prime numbers in increasing order. The function should also take a boolean flag as an input to determine if the prime numbers should be arranged in a spiral pattern. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_matrix(1, False) == [[2]]\", \"assert generate_matrix(1, True) == [[2]]\", \"assert generate_matrix(2, False) == [[2, 3], [5, 7]]\", \"assert generate_matrix(2, True) == [[2, 3], [7, 5]]\", \"assert generate_matrix(3, False) == [[2, 3, 5], [7, 11, 1...
{ "split": "train", "index": 80274, "acecode_id": "evol_15464", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Write a function `chinese_half2full(input_str: str) -> str` that converts all halfwidth Chinese characters in a given string to their corresponding fullwidth characters. Halfwidth characters are those that occupy half the space of fullwidth characters. The function should handl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert chinese_half2full('Hello World!') == '\\uff28\\uff45\\uff4c\\uff4c\\uff4f\\u3000\\uff37\\uff4f\\uff52\\uff4c\\uff44\\uff01'\", \"assert chinese_half2full(' ') == '\\u3000\\u3000'\", \"assert chinese_half2full('abc') == '\\uff41\\uff42\\uff43'\", \"assert ch...
{ "split": "train", "index": 80275, "acecode_id": "bigcode_python_fns_3052", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a given string to generate a formatted list. The function should take a string as input and return a formatted list based on the input string. The input string will contain items separated by newlines and tabs, with each ta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_list('\\\\n\\\\t* Fruits\\\\n\\\\t\\\\t* Apple\\\\n\\\\t\\\\t* Banana\\\\n\\\\t* Vegetables\\\\n\\\\t\\\\t* Carrot\\\\n\\\\t\\\\t* Potato\\\\n') == '- Fruits\\\\n - Apple\\\\n - Banana\\\\n- Vegetables\\\\n - Carrot\\\\n - Potato'\", \"ass...
{ "split": "train", "index": 80276, "acecode_id": "oss_839", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a graph represented as a list of edges and a frog that can jump between nodes in the graph. The frog starts at node 1 and can make at most 't' jumps. Each jump can only be made to directly connected nodes. You need to calculate the probability that the frog will b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(frogPosition(7, [(1,2), (1,3), (2,4), (2,5), (3,6), (3,7)], 1, 4) - -1) < 1e-9\", \"assert abs(frogPosition(4, [(1,2), (2,3), (3,4)], 3, 4) - 1.0) < 1e-9\", \"assert abs(frogPosition(2, [(1,2)], 1, 2) - 1.0) < 1e-9\", \"assert abs(frogPosition(3, [(1,2),...
{ "split": "train", "index": 80277, "acecode_id": "evol_2873", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Write a function `find_first_palindrome` that takes a string as input and returns the first palindrome found within that string. If no palindrome exists, return None. A palindrome is a sequence of characters that reads the same backward as forward. The function should return on...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_first_palindrome('racecar') == 'racecar'\", \"assert find_first_palindrome('aabb') == 'aa'\", \"assert find_first_palindrome('abcba') == 'abcba'\", \"assert find_first_palindrome('noon') == 'noon'\", \"assert find_first_palindrome('') == None\", \"asser...
{ "split": "train", "index": 80278, "acecode_id": "evol_31683", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes camera data for a specific subject in a motion capture dataset. The function `process_camera_data` takes a parameter `args`, which is an object containing the following attributes: `h5_path`, `type`, `subject`, and `cam...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_camera_data({'h5_path': None, 'type': 'h36m', 'subject': 'S1', 'camera_id': 0}) == ('S1', 0, '54138969')\", \"assert process_camera_data({'h5_path': None, 'type': 'h36m', 'subject': 'S2', 'camera_id': 1}) == ('S2', 1, '55011271')\", \"assert process_...
{ "split": "train", "index": 80279, "acecode_id": "oss_454", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of class IDs, and you need to convert each class ID to its corresponding category name based on the COCO2017 dataset mappings. Implement a function called `get_category_names(class_ids: List[int]) -> List[str]` that takes a list of integers representing cla...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_category_names([1, 2, 3]) == ['person', 'bicycle', 'car']\", \"assert get_category_names([4, 5]) == ['motorcycle', 'airplane']\", \"assert get_category_names([6, 7, 8]) == ['bus', 'train', 'truck']\", \"assert get_category_names([13, 14]) == ['stop sign'...
{ "split": "train", "index": 80280, "acecode_id": "bigcode_python_fns_43821", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string, implement a function that swaps all instances of vowels with the next vowel in the sequence. Specifically, 'a' should be swapped with 'e', 'e' with 'i', 'i' with 'o', 'o' with 'u', and 'u' with 'a'. The same should apply for uppercase vowels: 'A' with 'E', 'E' w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert swap_vowels('a') == 'e'\", \"assert swap_vowels('e') == 'i'\", \"assert swap_vowels('i') == 'o'\", \"assert swap_vowels('o') == 'u'\", \"assert swap_vowels('u') == 'a'\", \"assert swap_vowels('A') == 'E'\", \"assert swap_vowels('E') == 'I'\", \"assert swap_v...
{ "split": "train", "index": 80281, "acecode_id": "evol_9788", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Build a function that generates a complete internet address (URL) from given components, including a protocol, subdomain, domain, path, and query parameters. The function should return the constructed URL as a string. The query parameters should be encoded into Base64 format, p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_url('http', 'example', 'test.com', 'path', {'param1': 'value1'}) == 'http://example.test.com/path?cGFyYW0xPXZhbHVlMQ=='\", \"assert generate_url('https', 'sub', 'domain', 'endpoint', {'key': 'value', 'another_key': 'another_value'}) == 'https://sub....
{ "split": "train", "index": 80282, "acecode_id": "evol_3895", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Create a function called `get_key_character` that takes an integer representing the ASCII value of a key and returns the corresponding character as a string. If the provided integer does not correspond to a valid ASCII character (i.e., outside the range 0-127), the function sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_key_character(65) == 'A'\", \"assert get_key_character(97) == 'a'\", \"assert get_key_character(48) == '0'\", \"assert get_key_character(32) == ' '\", \"assert get_key_character(10) == '\\\\n'\", \"assert get_key_character(128) == ''\", \"assert get_key_...
{ "split": "train", "index": 80283, "acecode_id": "evol_16486", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of tuples where each tuple contains two elements: a string and a number representing a person's name and their age, respectively. Your task is to create a function that takes this list and returns a dictionary where the keys are the names (strings) and the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_age_dict([('Alice', 30), ('Bob', 25), ('Alice', 32)]) == {'Alice': '30', 'Bob': '25'}\", \"assert create_age_dict([('John', 45), ('Jane', 29), ('John', 40)]) == {'John': '45', 'Jane': '29'}\", \"assert create_age_dict([('Mike', 50), ('Anna', 22)]) == ...
{ "split": "train", "index": 80284, "acecode_id": "bigcode_python_fns_8688", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a repository URL in the format 'https://github.com/@<service>[:<version>]/<module>.git', write a function `extract_service_and_module(repo_url: str) -> Tuple[str, str]` that extracts and returns the service and module from the URL. The function should return a tuple where...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_service_and_module('https://github.com/@my_service/my_module.git') == ('my_service', 'my_module')\", \"assert extract_service_and_module('https://github.com/@test_service/test_module.git') == ('test_service', 'test_module')\", \"assert extract_servic...
{ "split": "train", "index": 80285, "acecode_id": "bigcode_python_fns_11444", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a list of strings that represent QR code data. Write a function `decode_qr_codes(data: List[str]) -> List[str]` that takes in a list of strings, where each string is a QR code data. The function should return a list of decoded information extracted from each QR co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decode_qr_codes(['Hello', 'World', '123456']) == ['Hello', 'World', '123456']\", \"assert decode_qr_codes(['QR1', 'QR2', 'InvalidQR']) == ['QR1', 'QR2', 'Invalid QR Code']\", \"assert decode_qr_codes(['Data1', 'Data2', 'Data3']) == ['Data1', 'Data2', 'Data3'...
{ "split": "train", "index": 80286, "acecode_id": "oss_27642", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that registers a series of commands into a given environment. The function should take a list of command strings and an environment object, registering each command into the environment. Each command will simply be a string representing a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert register_commands(['cmd1', 'cmd2', 'cmd3'], mock_env) == 3\", \"assert register_commands(['cmd1', 'cmd2', 'cmd1'], mock_env) == 2\", \"assert register_commands(['cmdA', 'cmdB'], mock_env) == 2\", \"assert register_commands([], mock_env) == 0\", \"assert regi...
{ "split": "train", "index": 80287, "acecode_id": "bigcode_python_fns_24591", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a nested dictionary representing the odds and number of rolls for different combinations of two six-sided dice. Each key in the outer dictionary represents the sum of the first die and the second die, while each inner key represents the second dice value. The inne...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rolls_to_reach_odds({'4': {'5': {'ODDS': .5, 'ROLLS': 2}}, '5': {'6': {'ODDS': .4, 'ROLLS': 3}}}, 4, 0.5) == 2\", \"assert rolls_to_reach_odds({'10': {'11': {'ODDS': .95, 'ROLLS': 1}}, '11': {'12': {'ODDS': .9, 'ROLLS': 2}}}, 10, 0.9) == 1\", \"assert rolls_...
{ "split": "train", "index": 80288, "acecode_id": "oss_25241", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Create a function that combines two lists of dictionaries. Each dictionary contains three properties: name, grade, and age. The function should then sort the dictionaries first by grade in ascending order, if the grade is the same, then by age in descending order. If both grade...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert combine_and_sort_lists([{'name': 'Alice', 'grade': 9, 'age': 14}], [{'name': 'Bob', 'grade': 10, 'age': 15}]) == [{'name': 'Alice', 'grade': 9, 'age': 14}, {'name': 'Bob', 'grade': 10, 'age': 15}]\", \"assert combine_and_sort_lists([{'name': 'Tom', 'grade': ...
{ "split": "train", "index": 80289, "acecode_id": "evol_66", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a list of two boolean values, where each value can either be True or False. Your task is to implement a function `calculate_xor` that returns True if the two boolean values are different (i.e., one is True and the other is False), and returns False if they are the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_xor([True, False]) == True\", \"assert calculate_xor([False, True]) == True\", \"assert calculate_xor([True, True]) == False\", \"assert calculate_xor([False, False]) == False\", \"assert calculate_xor([True, True]) == False\", \"assert calculate_x...
{ "split": "train", "index": 80290, "acecode_id": "bigcode_python_fns_3902", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that moves every k-th element in a list to the front of its originating subarray and transposes all elements within each subarray by a single position to the left. The function should take a numerical list and an integer k as inputs. Each subarray is define...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert move_elements([10, 20, 30, 40, 50, 60, 70, 80], 2) == [20, 10, 40, 30, 60, 50, 80, 70]\", \"assert move_elements([7, 14, 21, 28, 35, 42, 49], 2) == [14, 7, 28, 21, 42, 35, 49]\", \"assert move_elements([1], 1) == [1]\", \"assert move_elements([], 3) == []\",...
{ "split": "train", "index": 80291, "acecode_id": "evol_32054", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a list of items that a boy possesses, where each item is represented as a string. Your task is to write a function `count_unique_items` that takes this list as input and returns the total number of unique items the boy has. Note that the same item can appear multi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_items(['apple', 'banana', 'apple', 'orange', 'banana']) == 3\", \"assert count_unique_items(['pen', 'pencil', 'rubber', 'candy', 'gum', 'pen', 'pencil']) == 5\", \"assert count_unique_items(['car', 'bike', 'car', 'bus']) == 3\", \"assert count_u...
{ "split": "train", "index": 80292, "acecode_id": "oss_36518", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a modified version of the merge sort algorithm to sort an array of integers. The modification involves using a sentinel value to handle the merging process. The sentinel value should be set to 10^12. Your task is to complete the implementation o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_sort([116, 176382, 94, 325, 3476, 4, 2542, 9, 21, 56, 322, 322], 10**12) == None\", \"assert merge_sort([], 10**12) == None\", \"assert merge_sort([1], 10**12) == None\", \"assert merge_sort([5, 3, 8, 6, 2], 10**12) == None\", \"assert merge_sort([10, ...
{ "split": "train", "index": 80293, "acecode_id": "oss_1815", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two values, `x` and `y`, which can be integers, floats, or strings, implement a function `safe_plus(x, y)` that performs the following operations: 1. If both `x` and `y` are numbers (int or float), return their sum. 2. If one of them is a string and the other is a number,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert safe_plus(2, 3) == 5\", \"assert safe_plus(2.5, 3.5) == 6.0\", \"assert safe_plus('Hello', ' World') == 'Hello World'\", \"assert safe_plus(0, 'NULL') == 0\", \"assert safe_plus('NULL', 5) == 5\", \"assert safe_plus('5', 10) == '510'\", \"assert safe_plus(10...
{ "split": "train", "index": 80294, "acecode_id": "bigcode_python_fns_11431", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates bank account operations. The function should accept a list of operations, where each operation is represented by a tuple. The first element of the tuple is a string, either 'deposit' or 'withdraw', and the second elemen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert final_balance([('deposit', 100), ('withdraw', 50)]) == 50\", \"assert final_balance([('deposit', 200), ('withdraw', 300)]) == 200\", \"assert final_balance([('withdraw', 100)]) == 0\", \"assert final_balance([('deposit', 50), ('deposit', 50), ('withdraw', 10...
{ "split": "train", "index": 80295, "acecode_id": "oss_30318", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a set of unique integers called 'individual'. Your task is to implement a function that modifies this set by either removing a random element from it or adding a random integer between 0 and a given number 'NBR_ITEMS' (exclusive). If the set is empty, you can only...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mutate_set({1, 2, 3}, 5) in [{0, 1, 2, 3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}, {2, 1, 4}, {3, 1, 4}, {3, 2, 4}]\", \"assert mutate_set(set(), 5) in [{0}, {1}, {2}, {3}, {4}]\", \"assert mutate_set({0, 1, 2}, 3) in [{0, 1}, {0, 2}, {1, 2}...
{ "split": "train", "index": 80296, "acecode_id": "bigcode_python_fns_10638", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given an array of floats called `signal`, write a function `normalize_signal(signal: List[float]) -> List[float]` that transforms the values in `signal` into a uniform distribution in the range [0, 1]. The function should return a new array where each value in `signal` is repla...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert normalize_signal([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]\", \"assert normalize_signal([10.0, 20.0, 30.0, 40.0]) == [0.0, 0.3333333333333333, 0.6666666666666666, 1.0]\", \"assert normalize_signal([5.0, 0.0, 10.0]) == [0.5, 0.0, 1.0]\", \"ass...
{ "split": "train", "index": 80297, "acecode_id": "bigcode_python_fns_5086", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a dictionary of options where the keys represent option names and the values represent the corresponding values for those options. Write a function `get_parsed_options(raw_options: dict) -> dict` that takes a dictionary of raw options as input and returns a new di...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_parsed_options({'option1': 5}) == {'option1': 5}\", \"assert get_parsed_options({'option2': True}) == {'option2': True}\", \"assert get_parsed_options({'option3': [1, 2, 3]}) == {'option3': [1, 2, 3]}\", \"assert get_parsed_options({}) == {}\", \"assert ...
{ "split": "train", "index": 80298, "acecode_id": "bigcode_python_fns_25269", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with managing financial transactions, specifically deposits and withdrawals. Implement a function `calculate_total_balance(transactions: List[Union[Deposit, Withdrawal]]) -> float` that takes a list of transactions (which can include instances of deposits and wit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_total_balance([Deposit(1, 'Income', 100.0)]) == 100.0\", \"assert calculate_total_balance([Withdrawal(1, 'Rent', '2021-02-01', 50.0)]) == -50.0\", \"assert calculate_total_balance([Deposit(1, 'Salary', 200.0), Withdrawal(2, 'Groceries', '2021-02-01...
{ "split": "train", "index": 80299, "acecode_id": "oss_6756", "num_tests": 16 }