data_source
large_stringclasses
1 value
prompt
listlengths
1
1
ability
large_stringclasses
1 value
reward_model
dict
extra_info
dict
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that determines the quality gate status of a project based on its status string. The function should take in a status string and return '0' if the quality gate fails (indicated by 'ERROR') and '1' if the quality gate passes (indica...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_quality_gate_status('OK') == '1'\", \"assert get_quality_gate_status('ERROR') == '0'\", \"assert get_quality_gate_status('SUCCESS') == 'Invalid Status'\", \"assert get_quality_gate_status('FAIL') == 'Invalid Status'\", \"assert get_quality_gate_status(''...
{ "split": "train", "index": 4300, "acecode_id": "oss_20300", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to convert time between different units. The function should take a time value and its unit, and return the equivalent time in a specified target unit. The supported time units are 'seconds', 'minutes', 'hours', and 'days'. Your funct...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_time(5, 'minutes', 'seconds') == '300.00 seconds'\", \"assert convert_time(1, 'hours', 'minutes') == '60.00 minutes'\", \"assert convert_time(2, 'days', 'hours') == '48.00 hours'\", \"assert convert_time(3600, 'seconds', 'hours') == '1.00 hours'\", \...
{ "split": "train", "index": 4301, "acecode_id": "oss_31867", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that validates a geometric polygon defined by a list of points. The function should take a dictionary as input that includes a key 'polygon' with its value being a list of tuples. Each tuple represents a corner of the polygon and shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_polygon({'polygon': [(0, 0), (1, 1), (2, 0)]}) is None\", \"assert validate_polygon({'polygon': [(0, 0), (1, 1), (2, 0), (1, -1)]}) is None\", \"assert validate_polygon({'polygon': [(0, 0), (0, 1), (1, 1), (1, 0)]}) is None\", \"assert validate_poly...
{ "split": "train", "index": 4302, "acecode_id": "bigcode_python_fns_40856", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a sorted array of integers in increasing order, write a function that determines the index at which a specified integer should be inserted to maintain the array's ascending order. The function should take in two parameters: the sorted array and the integer to be inserted....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert index_to_insert([1, 3, 5, 7], 4) == 2\", \"assert index_to_insert([2, 4, 6, 8], 5) == 2\", \"assert index_to_insert([10, 20, 30, 40], 25) == 2\", \"assert index_to_insert([1, 2, 3, 4, 5], 0) == 0\", \"assert index_to_insert([1, 2, 3, 4, 5], 6) == 5\", \"asse...
{ "split": "train", "index": 4303, "acecode_id": "evol_33468", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create a function called `validate_date` that checks if a given date string is in the correct format of 'dd/mm/yyyy' and also validates whether the date actually exists. Specifically, your function should handle months with varying numbers of days, including leap years. If the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_date('29/02/2020') == True\", \"assert validate_date('30/02/2021') == 'Invalid date or date format. It should be dd/mm/yyyy.'\", \"assert validate_date('31/04/2021') == 'Invalid date or date format. It should be dd/mm/yyyy.'\", \"assert validate_dat...
{ "split": "train", "index": 4304, "acecode_id": "evol_18486", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to implement a function that returns the sum of all even numbers in the list. If there are no even numbers, return 0. The function should be named `sum_of_even_numbers`. The input will be a list of integers, and the output should b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_even_numbers([1, 2, 3, 4]) == 6\", \"assert sum_of_even_numbers([1, 3, 5]) == 0\", \"assert sum_of_even_numbers([-2, -4, -6]) == -12\", \"assert sum_of_even_numbers([0]) == 0\", \"assert sum_of_even_numbers([2, 4, 6, 8]) == 20\", \"assert sum_of_even_...
{ "split": "train", "index": 4305, "acecode_id": "oss_7249", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the behavior of transferring data between two different environments. Implement a function `transfer_data(data, to_environment)` that takes two parameters: `data`, which is a variable of any Python data type (e.g., integer,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transfer_data(5, 'R') == 'transferred to R'\", \"assert transfer_data(3.14, 'R') == 'transferred to R'\", \"assert transfer_data([1, 2, 3], 'R') == 'transferred to R'\", \"assert transfer_data({'key': 'value'}, 'R') == 'transferred to R'\", \"assert transfer...
{ "split": "train", "index": 4306, "acecode_id": "oss_10822", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that creates a new list containing the squares of each integer from the original list. The output list should maintain the same order as the input list. The function should be named 'square_numbers' and take a single parameter, 'nu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert square_numbers([1, 2, 3]) == [1, 4, 9]\", \"assert square_numbers([-1, -2, -3]) == [1, 4, 9]\", \"assert square_numbers([0]) == [0]\", \"assert square_numbers([]) == []\", \"assert square_numbers([10, 20, 30]) == [100, 400, 900]\", \"assert square_numbers([5...
{ "split": "train", "index": 4307, "acecode_id": "bigcode_python_fns_10858", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two lists of numbers, `X` and `y`, where `X` represents the predicted values and `y` represents the actual values, write a function `calculate_parity_plot_data(X: List[float], y: List[float]) -> Tuple[List[float], List[float]]` that returns two lists: the first list conta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_parity_plot_data([1, 2, 3], [1, 2, 3]) == ([1, 2, 3], [1, 2, 3])\", \"assert calculate_parity_plot_data([0, 0, 0], [0, 0, 0]) == ([0, 0, 0], [0, 0, 0])\", \"assert calculate_parity_plot_data([5, 6, 7], [5, 6, 7]) == ([5, 6, 7], [5, 6, 7])\", \"asse...
{ "split": "train", "index": 4308, "acecode_id": "bigcode_python_fns_13323", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a function call mechanism in Python. The function `call_function` takes the following parameters: \n- `ret_type`: A string representing the expected return type of the function being called. \n- `func_id`: An integer re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert call_function('int', 1, 'ss', 'hello', 'world') == 1\", \"assert call_function('int', 2, 'i', 42) == 2\", \"assert call_function('str', 3, 's', 'hello') == 3\", \"assert call_function('float', 4, 'fff', 1.0, 2.0, 3.0) == 4\", \"assert call_function('bool', 5...
{ "split": "train", "index": 4309, "acecode_id": "oss_12312", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a nested list of variables, where each variable can either be a single variable or a tuple of variables. Your task is to implement a function that checks if all the variables in the list are valid. A valid variable is defined as either a string representing a sing...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_variable_definition(['a', 'b', 'c']) == True\", \"assert is_valid_variable_definition([('a', 'b'), 'c']) == True\", \"assert is_valid_variable_definition([('a',), ('b', 'c')]) == True\", \"assert is_valid_variable_definition([('x', 'y', 'z'), 'a']) ...
{ "split": "train", "index": 4310, "acecode_id": "bigcode_python_fns_45152", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function to retrieve the current address of a LoRa module based on a given response string. The response string is structured as follows: it starts with 'AT', followed by the address, and ends with 'OK'. The address is separated from th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_current_address('AT 123456 OK') == '123456'\", \"assert get_current_address('AT abcdef OK') == 'abcdef'\", \"assert get_current_address('AT 000001 OK') == '000001'\", \"assert get_current_address('AT 1A2B3C OK') == '1A2B3C'\", \"assert get_current_addres...
{ "split": "train", "index": 4311, "acecode_id": "oss_32150", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `create_object(attributes: dict) -> JsonObject` that takes a dictionary as input and creates an object where the keys in the dictionary become attributes of the object. The function should handle nested dictionaries, converting them into nested objects. The fun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_object({'name': 'Alice', 'age': 30}).get_attribute('name') == 'Alice'\", \"assert create_object({'name': 'Bob', 'height': 175}).get_attribute('height') == 175\", \"assert create_object({'person': {'name': 'Charlie', 'age': 25}}).get_attribute('person'...
{ "split": "train", "index": 4312, "acecode_id": "evol_29588", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with generating a database of records from a defined universe of integers. Implement a function `generate_database(m: int, n: int, uni_range_low: int, uni_range_high: int, exact_number: bool) -> List[int]` that generates a list of `m` records. The records should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert len(generate_database(3, 5, 0, 10, False)) == 3\", \"assert set(generate_database(10, 5, 1, 5, False)).issubset(set(range(1, 5)))\", \"assert len(set(generate_database(5, 5, 0, 10, False))) <= 5\", \"assert generate_database(0, 10, 1, 20, True) == []\", \"as...
{ "split": "train", "index": 4313, "acecode_id": "bigcode_python_fns_16598", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that determines whether a given `DataSubItem` object should be inserted into a data structure based on certain conditions. The `DataSubItem` class has the following attributes: \n- `root`: an attribute of type `RootItem` representing ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert inserting(DataSubItem(RootItem(Action.INSERT), NA())) == True\", \"assert inserting(DataSubItem(RootItem(Action.INSERT), 'some_value')) == True\", \"assert inserting(DataSubItem(RootItem(Action.UPSERT), NA())) == True\", \"assert inserting(DataSubItem(RootIt...
{ "split": "train", "index": 4314, "acecode_id": "oss_2729", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a function `get_command_view(is_running: bool, stop_requested: bool, commands_by_id: List[Tuple[str, str]]) -> Dict[str, Any]`. This function takes in three parameters: a boolean `is_running` which indicates whether a command is currently running, a boolea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_command_view(True, False, [('1', 'start'), ('2', 'stop')]) == {'is_running': True, 'stop_requested': False, 'commands': {'1': 'start', '2': 'stop'}}\", \"assert get_command_view(False, True, [('3', 'pause')]) == {'is_running': False, 'stop_requested': Tr...
{ "split": "train", "index": 4315, "acecode_id": "bigcode_python_fns_16801", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `aggregate_user_activity(user_activity_data: List[Dict[str, Union[str, int]]]) -> Dict[str, int]` that takes a list of user activity data, where each record is represented as a dictionary containing 'user_id', 'song_id', and 'play_count'. The function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert aggregate_user_activity([{'user_id': 'user1', 'song_id': 'songA', 'play_count': 2}, {'user_id': 'user1', 'song_id': 'songB', 'play_count': 3}]) == {'user1': 5}\", \"assert aggregate_user_activity([{'user_id': 'user2', 'song_id': 'songC', 'play_count': 1}, {'...
{ "split": "train", "index": 4316, "acecode_id": "evol_10175", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a square 2D array (matrix), implement a function that returns a list containing the sum of each row followed by the sum of the diagonal elements. The input matrix will always have the same number of rows and columns. You need to create a function 'sum_rows(matrix)' that t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_rows([[1, 2], [3, 4]]) == [3, 7, 5]\", \"assert sum_rows([[0, 0], [0, 0]]) == [0, 0, 0]\", \"assert sum_rows([[5]]) == [5, 5]\", \"assert sum_rows([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [6, 15, 24, 15]\", \"assert sum_rows([[10, 20], [30, 40]]) == [30, 70...
{ "split": "train", "index": 4317, "acecode_id": "evol_23302", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given the root of a binary tree, write a function to compute the maximum depth of the tree. The maximum depth is defined as the longest path from the root node down to the farthest leaf node. A leaf node is a node with no children. If the tree is empty, the maximum depth should...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_max_depth(None) == 0\", \"assert compute_max_depth(TreeNode(1)) == 1\", \"assert compute_max_depth(TreeNode(1, TreeNode(2))) == 2\", \"assert compute_max_depth(TreeNode(1, None, TreeNode(3))) == 2\", \"assert compute_max_depth(TreeNode(1, TreeNode(2)...
{ "split": "train", "index": 4318, "acecode_id": "evol_19489", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to filter out 'good' words from a list of words. A 'good' word is defined as a word that contains at least one vowel and one consonant. Implement a Python function `good_words(words)` that takes a list of lowercase words as input and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert good_words(['sky', 'bby', 'xyz']) == []\", \"assert good_words(['o', 'e', 'i', 'u']) == []\", \"assert good_words(['aeiou', 'xyz', 'abc', 'def']) == ['abc', 'def']\", \"assert good_words(['']) == []\", \"assert good_words(['x', 'y', 'z']) == []\", \"assert g...
{ "split": "train", "index": 4319, "acecode_id": "oss_30488", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a dictionary representing a system's natural language understanding (NLU) output, a specific slot string, and a domain string, write a function that determines whether the specified slot is understood by the system within the provided domain. The function should return Tr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_understood_request({}, 'slot1', 'domain1') == True\", \"assert has_understood_request({'domain1': ['slot1', 'slot2']}, 'slot1', 'domain1') == True\", \"assert has_understood_request({'domain1': ['slot1', 'slot2']}, 'slot2', 'domain1') == True\", \"assert...
{ "split": "train", "index": 4320, "acecode_id": "bigcode_python_fns_3428", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating the movement of a bullet in a 2D game environment. Implement the function `move_bullet(bullet_position, bullet_velocity, is_in_motion, bcount)` that updates the position of the bullet based on its current velocity and direction. The function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert move_bullet((0, 0), (1, 1), True, 5) == ((1, 1), BULLET_SPEED)\", \"assert move_bullet((10, 10), (2, 3), True, 10) == ((12, 13), BULLET_SPEED)\", \"assert move_bullet((5, 5), (-1, -1), True, 3) == ((4, 4), BULLET_SPEED)\", \"assert move_bullet((0, 0), (0, 0)...
{ "split": "train", "index": 4321, "acecode_id": "oss_12897", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two lists of integers, return a dictionary containing three keys: 'evens', 'pos_odds_l1', and 'neg_odds_l2'. The 'evens' key should map to a list of strictly even integers obtained by merging both lists and sorting them in reverse numerical order. The 'pos_odds_l1' key sh...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert listed_numbers([1, 3, 5], [2, 4, 6]) == {'evens': [6, 4, 2], 'pos_odds_l1': [1, 3, 5], 'neg_odds_l2': []}\", \"assert listed_numbers([0, -2, -4], [-1, -3, -5]) == {'evens': [0, -2, -4], 'pos_odds_l1': [], 'neg_odds_l2': [-1, -3, -5]}\", \"assert listed_numbe...
{ "split": "train", "index": 4322, "acecode_id": "evol_20281", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple card game. The function should take a list of cards as input, where each card is represented as a string containing its name and value (e.g., 'CardA:3', 'CardB:5'). Your goal is to find the card with the highes...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_best_card(['CardA:3', 'CardB:5', 'CardC:2']) == 'CardB'\", \"assert find_best_card(['CardX:10', 'CardY:10', 'CardZ:1']) == 'CardX'\", \"assert find_best_card(['CardA:3', 'CardB:3']) == 'CardA'\", \"assert find_best_card(['CardA:0']) == 'CardA'\", \"asse...
{ "split": "train", "index": 4323, "acecode_id": "oss_10169", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_aggregate_stats(n: int, sequence_type: str) -> dict` that calculates aggregate statistics for the first n prime numbers or Fibonacci numbers, based on the specified sequence type. The function should return a dictionary containing the 'aggregate'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_aggregate_stats(0, 'fibonacci') == 'Error: n must be a positive integer.'\", \"assert calculate_aggregate_stats(1, 'prime') == {'aggregate': 2, 'mean': 2.0, 'median': 2.0, 'standard deviation': 0.0, 'mode': 2}\", \"assert calculate_aggregate_stats(...
{ "split": "train", "index": 4324, "acecode_id": "evol_28830", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a floating-point number `a`, implement a function `ceil(a)` that returns the smallest integer greater than or equal to `a`. The input will be a single floating-point number (or integer), and the output should be an integer representing the ceiling value of the input numbe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert ceil(2.3) == 3\", \"assert ceil(5.0) == 5\", \"assert ceil(-1.5) == -1\", \"assert ceil(0.0) == 0\", \"assert ceil(-2.8) == -2\", \"assert ceil(3.7) == 4\", \"assert ceil(1.1) == 2\", \"assert ceil(4.99) == 5\", \"assert ceil(-0.1) == 0\", \"assert ceil(6.99...
{ "split": "train", "index": 4325, "acecode_id": "bigcode_python_fns_9982", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a grid of size n x n, where n is a positive integer, you need to generate a triangle on the grid using symbols from a predefined list. The triangle can be oriented in one of four ways: top-left, top-right, bottom-left, or bottom-right. The function should take in an integ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_triangle(4, ['A', 'B', 'C', 'D', 'E', 'F']) in [((0, 0), 'A'), ((0, 1), 'A'), ((0, 2), 'A'), ((1, 0), 'A'), ((1, 1), 'A'), ((1, 2), 'A')]\", \"assert generate_triangle(5, ['X', 'Y', 'Z', 'W', 'V', 'U']) in [((0, 0), 'X'), ((0, 1), 'X'), ((0, 2), 'X'...
{ "split": "train", "index": 4326, "acecode_id": "bigcode_python_fns_2903", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `create_point` that takes three integers `x`, `y`, and `z` as arguments and returns a string representation of a point in a three-dimensional Cartesian system in the format 'Point(x, y, z)'. The default values for `x`, `y`, and `z` should be 0 if not provid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_point(1, 2, 3) == 'Point(1, 2, 3)'\", \"assert create_point(0, 0, 0) == 'Point(0, 0, 0)'\", \"assert create_point(-1, -2, -3) == 'Point(-1, -2, -3)'\", \"assert create_point(10, 20, 30) == 'Point(10, 20, 30)'\", \"assert create_point(100, 200, 300) ==...
{ "split": "train", "index": 4327, "acecode_id": "evol_22716", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that computes the cyclic learning rate based on a given global step. The cyclic learning rate varies between a minimum and a maximum value according to the specified cycle parameters. Implement the function `cyclic_learning_rate(globa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(cyclic_learning_rate(0, 0.01, 0.1, 50000, 0.99994, 'triangular') - 0.01) < 1e-5\", \"assert abs(cyclic_learning_rate(50000, 0.01, 0.1, 50000, 0.99994, 'triangular') - 0.1) < 1e-5\", \"assert abs(cyclic_learning_rate(100000, 0.01, 0.1, 50000, 0.99994, 'tr...
{ "split": "train", "index": 4328, "acecode_id": "bigcode_python_fns_35947", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of unique soldier ratings, implement a function `numTeams(rating)` that counts the total number of valid teams of 3 soldiers that can be formed. A team of soldiers is valid if their ratings are in either strictly increasing or strictly decreasing order, where the i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert numTeams([2, 5, 3, 4, 1]) == 3\", \"assert numTeams([2, 1, 3]) == 0\", \"assert numTeams([1, 2, 3, 4]) == 4\", \"assert numTeams([3, 1, 4, 2]) == 0\", \"assert numTeams([10, 20, 30, 40, 50]) == 10\", \"assert numTeams([50, 40, 30, 20, 10]) == 10\", \"assert ...
{ "split": "train", "index": 4329, "acecode_id": "evol_23250", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the scaled density and distance values based on a given dictionary of parameters and a units string. The units string is formatted as 'density_unit_distance_unit', where 'density_unit' and 'distance_unit' are specific ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert scale_values('g/cm^3_m', {'rhos': 10, 'rs': 5, 'rmin': 2, 'rmax': 8, 'rhomax': 15}) == {'rhos': 10000.0, 'rs': 5, 'rmin': 2, 'rmax': 8, 'rhomax': 15000.0}\", \"assert scale_values('kg/m^3_km', {'rhos': 1, 'rs': 1, 'rmin': 1, 'rmax': 1, 'rhomax': 1}) == {'rho...
{ "split": "train", "index": 4330, "acecode_id": "bigcode_python_fns_46934", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string of text that may contain various punctuation marks and spaces. Your task is to create a function that processes this text and returns a list of sentences, where each sentence is represented as a dictionary containing the source identifier and the cleaned ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert make_sentences('No punctuation here', 'file4') == [{'src': 'file4', 'label': 0, 'sentence': 'No punctuation here'}]\", \"assert make_sentences(' Leading spaces and trailing spaces ', 'file5') == [{'src': 'file5', 'label': 0, 'sentence': 'Leading spaces a...
{ "split": "train", "index": 4331, "acecode_id": "bigcode_python_fns_785", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given an array of signed integers and a list of indices, implement a function that returns a new array containing the cumulative sums of the elements from the original array at the specified indices. The cumulative sums should account for any repeated indices, meaning if an ind...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert cumulative_sums([5, 10, 15], [0, 1, 2]) == [5, 15, 30]\", \"assert cumulative_sums([0, 0, 0], [0, 1, 2, 0, 1]) == [0, 0, 0, 0, 0]\", \"assert cumulative_sums([2, 4, 6, 8], [3, 2, 1, 0]) == [8, 14, 18, 20]\", \"assert cumulative_sums([], []) == []\", \"assert...
{ "split": "train", "index": 4332, "acecode_id": "evol_19120", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that accepts a list of integers and returns a new list containing only the even numbers from the original list, in the order they appeared. Implement the function `filter_even_numbers(nums: List[int]) -> List[int]`, where `nums` is a list...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5, 6]) == [2, 4, 6]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filter_even_numbers([0, 2, 4, 6]) == [0, 2, 4, 6]\", \"assert filter_even_numbers([-2, -1, 0, 1, 2]) == [-2, 0, 2]\", \"assert filter_even_nu...
{ "split": "train", "index": 4333, "acecode_id": "oss_32927", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with extracting package names and their version constraints from a given list of package strings. Each package and its version constraint are formatted within double quotes and are separated by commas. The version constraint may use symbols such as '==', '>=', or...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_requirements(['\\\"tensorflow-gpu>=2.4.0\\\"', '\\\"torch>=1.7.0\\\"']) == {'tensorflow-gpu': '>=2.4.0', 'torch': '>=1.7.0'}\", \"assert parse_requirements(['\\\"django>=3.1.0\\\"', '\\\"requests[security]>=2.25\\\"']) == {'django': '>=3.1.0', 'request...
{ "split": "train", "index": 4334, "acecode_id": "oss_36944", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a 2D list of integers, implement a function `findMax(data)` that returns the maximum integer from the list. The input is guaranteed to be a non-empty 2D list containing sublists with at least one integer. You should also ensure that the input is valid, meaning that it mus...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert findMax([[1, 2], [3, 4], [5]]) == 5\", \"assert findMax([[10, 20, 30], [5, 15, 25], [40]]) == 40\", \"assert findMax([[1], [2], [3], [4], [5]]) == 5\", \"assert findMax([[0, -1, -2], [-3, -4, -5]]) == 0\", \"assert findMax([[100, 200], [150, 250], [300]]) ==...
{ "split": "train", "index": 4335, "acecode_id": "evol_14207", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are developing a software tool for image processing. Your task is to implement a function that processes a single-band image by applying a set of model components to it. The function will take two arguments: a list of integers representing the pixel values of the single-ban...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_image([10, 20, 30], {'increase': lambda x: x + 10}) == [20, 30, 40]\", \"assert process_image([0, 0, 0], {'double': lambda x: x * 2}) == [0, 0, 0]\", \"assert process_image([1, 2, 3], {'square': lambda x: x ** 2}) == [1, 4, 9]\", \"assert process_ima...
{ "split": "train", "index": 4336, "acecode_id": "oss_12089", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Construct a Python function that counts the occurrence of each individual character in a list of strings. The function should accept an array containing textual strings as its argument and return a nested dictionary. The keys of the outer dictionary should be the individual str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert character_counts(['hello', 'world']) == {'hello': {'h': 1, 'e': 1, 'l': 2, 'o': 1}, 'world': {'w': 1, 'o': 1, 'r': 1, 'l': 1, 'd': 1}}\", \"assert character_counts(['test', 'data']) == {'test': {'t': 2, 'e': 1, 's': 1}, 'data': {'d': 1, 'a': 2, 't': 1}}\", \...
{ "split": "train", "index": 4337, "acecode_id": "evol_9581", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a 2D array of integers, write a function that computes the sum of all the even numbers present in the array. If the sum is a prime number, return the sum; otherwise, return -1.\nPlease reason step by step, then write a self-contained Python solution. Give your final progr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_even_sum_and_check_prime([[1, 1], [1, 1], [1]]) == -1\", \"assert compute_even_sum_and_check_prime([[11, 13, 15]]) == -1\", \"assert compute_even_sum_and_check_prime([]) == -1\", \"assert compute_even_sum_and_check_prime([[7, 9], [11, 13]]) == -1\", ...
{ "split": "train", "index": 4338, "acecode_id": "evol_2676", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a dictionary where the keys are parameter names (strings) and the values are lists of numbers. All lists must have the same length. Your task is to implement a function that converts this dictionary into a tuple containing two elements: a sorted list of the parame...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_parameter_dict_to_matrix({'param1': [1, 2, 3], 'param2': [4, 5, 6]}) == (['param1', 'param2'], [[1, 2, 3], [4, 5, 6]])\", \"assert convert_parameter_dict_to_matrix({'a': [1, 2], 'b': [3, 4]}) == (['a', 'b'], [[1, 2], [3, 4]])\", \"assert convert_para...
{ "split": "train", "index": 4339, "acecode_id": "bigcode_python_fns_43556", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `sort_valid_emails(emails)` that takes a list of email addresses and returns a sorted list of valid email addresses based on their character count. An email is considered valid if it follows the standard email format. Invalid email addresses should be exclu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_valid_emails(['@example.com', 'user@domain', 'user@domain.org']) == ['user@domain.org']\", \"assert sort_valid_emails(['email@domain.com', 'too@many@@symbols.com', 'valid.email@domain.com']) == ['email@domain.com', 'valid.email@domain.com']\", \"assert ...
{ "split": "train", "index": 4340, "acecode_id": "evol_12759", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that generates random protocol parameters based on given bounds. The function should take in three parameters: a float `mu3`, a 2D array `xb` of shape (5, 2) representing the lower and upper bounds for five protocol parameters, and a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_protocol_parameters(0.1, [[0.0, 1.0], [0.1, 0.9], [0.1, 0.9], [0.0, 1.0], [0.0, 1.0]], 0.01) is not None\", \"assert len(generate_protocol_parameters(0.1, [[0.0, 1.0], [0.1, 0.9], [0.1, 0.9], [0.0, 1.0], [0.0, 1.0]], 0.01)) == 5\", \"assert all(para...
{ "split": "train", "index": 4341, "acecode_id": "bigcode_python_fns_46692", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a dataset where each entry contains a description and a category. Implement a function `train(node)` that simulates the training of an AI model to classify descriptions into categories. The function should take a dictionary `node` with keys 'description' and 'cate...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert train({'description': 'This professional is able to diagnose, treat & prevent diseases of dental pulp & surrounding tissues.', 'category': 'Dentist'}) == True\", \"assert train({'description': 'This professional helps to prevent illness through behavior chan...
{ "split": "train", "index": 4342, "acecode_id": "evol_1170", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings, where each string contains the following information: an acceptable range, a letter, and a password separated by spaces. The acceptable range defines the minimum and maximum number of times the given letter must appear in the password for it to ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_valid_passwords(['1-3 a: abcde', '1-3 b: cdefg', '2-9 c: ccccccccc']) == 2\", \"assert count_valid_passwords(['1-2 a: aabc', '2-4 b: bbbbc', '3-5 c: cccccc']) == 2\", \"assert count_valid_passwords(['1-3 p: ppppp', '2-5 e: eee', '2-2 r: ra']) == 1\", \...
{ "split": "train", "index": 4343, "acecode_id": "oss_34056", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a precision calculation for a machine learning model. Your function should take in two integer inputs: `true_count`, which represents the number of correctly predicted samples, and `total_sample_count`, which represents the total number of sampl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_precision(10, 100) == 0.1\", \"assert calculate_precision(0, 10) == 0.0\", \"assert calculate_precision(50, 50) == 1.0\", \"assert calculate_precision(25, 100) == 0.25\", \"assert calculate_precision(0, 0) == 0.0\", \"assert calculate_precision(5, ...
{ "split": "train", "index": 4344, "acecode_id": "oss_6257", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D matrix of size MxN, implement a function that returns the elements of the matrix in diagonal zigzag order. The function should handle cases where the matrix can have variable row and column lengths. If the matrix contains only one row, return the elements in left to ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_diagonal_zigzag([[1, 2, 3, 4]]) == [1, 2, 3, 4]\", \"assert print_diagonal_zigzag([[1], [2], [3], [4]]) == [1, 2, 3, 4]\", \"assert print_diagonal_zigzag([]) == []\", \"assert print_diagonal_zigzag([[]]) == []\", \"assert print_diagonal_zigzag([[1]]) =...
{ "split": "train", "index": 4345, "acecode_id": "evol_35835", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a configuration dictionary for dropout layers and returns a list of dropout layer specifications. Each dropout layer specification should be represented as a dictionary with the required parameters, including 'type' which indic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert build_dropout_layers({'layers': [{'type': 'Dropout', 'rate': 0.5}, {'type': 'Dropout', 'rate': 0.3}]}) == [{'type': 'Dropout', 'rate': 0.5}, {'type': 'Dropout', 'rate': 0.3}]\", \"assert build_dropout_layers({'layers': [{'type': 'Dropout', 'rate': 0.1}]}) ==...
{ "split": "train", "index": 4346, "acecode_id": "bigcode_python_fns_39970", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simplified turn-based card game. Your function should take two parameters: a list of connected players and the number of AI players. Each player starts with a hand of cards drawn from a deck. The goal is to play cards in turns based on specific ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_winner(['Alice'], 0) == 'Alice'\", \"assert get_winner(['Alice', 'Bob'], 1) == 'Bob'\", \"assert get_winner(['Alice', 'Bob', 'Charlie', 'David'], 0) == 'David'\", \"assert get_winner(['Alice', 'Bob', 'Charlie', 'David', 'Eve'], 1) == 'Eve'\", \"assert ge...
{ "split": "train", "index": 4347, "acecode_id": "bigcode_python_fns_40173", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `calculate_missing_stats(arr)` that returns the number of missing values (None) in the list and the total number of values present (excluding None). The function should return a tuple containing these two counts. For example, if the in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_missing_stats([1, 2, None, 4, None, 6]) == (2, 4)\", \"assert calculate_missing_stats([None, None, None]) == (3, 0)\", \"assert calculate_missing_stats([1, 2, 3, 4, 5]) == (0, 5)\", \"assert calculate_missing_stats([]) == (0, 0)\", \"assert calcula...
{ "split": "train", "index": 4348, "acecode_id": "bigcode_python_fns_19784", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `double_string(s: str) -> str` that takes a string `s` as input and returns the string concatenated with itself. For example, if the input is 'abc', the output should be 'abcabc'.\nPlease reason step by step, then write a self-contained Python solution. Give yo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert double_string('Hello') == 'HelloHello'\", \"assert double_string('World') == 'WorldWorld'\", \"assert double_string('') == ''\", \"assert double_string('123') == '123123'\", \"assert double_string('abc') == 'abcabc'\", \"assert double_string('!@#') == '!@#!@...
{ "split": "train", "index": 4349, "acecode_id": "evol_8238", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer, implement a function that determines if the number is a palindrome. A number is considered a palindrome if it remains the same when its digits are reversed. For example, 121 is a palindrome, while 123 is not. Your function should return True if the num...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome(121) == True\", \"assert is_palindrome(123) == False\", \"assert is_palindrome(7337) == True\", \"assert is_palindrome(45654) == True\", \"assert is_palindrome(1001) == True\", \"assert is_palindrome(0) == True\", \"assert is_palindrome(9) == T...
{ "split": "train", "index": 4350, "acecode_id": "evol_5279", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with managing a list of malware files. Each malware file is represented by a unique identifier, information about the file, its status, the date it was uploaded, whether it is considered malicious, and associated domains. Implement a function named `add_domain_to...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_domain_to_malware('ABC123', {'name': 'malware.exe', 'size': '1024KB'}, 'Quarantined', '2022-01-15', True, 'maliciousdomain.com') == {'malware_id': 'ABC123', 'file': {'name': 'malware.exe', 'size': '1024KB'}, 'status': 'Quarantined', 'upload_date': '2022-...
{ "split": "train", "index": 4351, "acecode_id": "oss_2780", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with processing a string to determine if it contains a backslash '\\' and a hyphen '-'. Implement a function `process_string(s: str) -> Tuple[bool, bool]` that takes a string `s` as input and processes it character by character. The function should return a tuple...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_string('abc-def') == (False, True)\", \"assert process_string('abc\\\\\\\\-\\\\-def') == (True, False)\", \"assert process_string('a-b-c') == (False, True)\", \"assert process_string('\\\\\\\\') == (True, False)\", \"assert process_string('no special...
{ "split": "train", "index": 4352, "acecode_id": "oss_28072", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function that generates the first 'n' rows of Pascal's triangle and returns it as a list of lists. Each inner list represents a row of the triangle. The function signature should be: def generate_pascal_triangle(n: int) -> List[List[int]].\nPlease reason step by ste...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_pascal_triangle(1) == [[1]]\", \"assert generate_pascal_triangle(2) == [[1], [1, 1]]\", \"assert generate_pascal_triangle(3) == [[1], [1, 1], [1, 2, 1]]\", \"assert generate_pascal_triangle(4) == [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]\", \"assert ge...
{ "split": "train", "index": 4353, "acecode_id": "evol_34491", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a directed graph represented as an adjacency list, where each node represents an airport and each edge represents a direct flight between two airports with a certain cost. You also have a mapping of cities to their respective airports. Your task is to write a func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert minimum_cost_path('cityX', 'cityY', {'X': [('Y', 10)], 'Y': []}, {'cityX': ['X'], 'cityY': ['Y']}) == (10, ['X', 'Y'])\", \"assert minimum_cost_path('city1', 'city3', {'A': [('B', 100), ('C', 300)], 'B': [], 'C': []}, {'city1': ['A'], 'city2': ['B', 'C'], 'c...
{ "split": "train", "index": 4354, "acecode_id": "bigcode_python_fns_35231", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that retrieves a module name based on a given version number. Your function should be able to handle specific version strings that correspond to certain module names. Write a function `get_module_name(version: str) -> str` that takes a ve...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_module_name('v20190701') == 'Module for version 20190701'\", \"assert get_module_name('v20190801') == 'Module for version 20190801'\", \"assert get_module_name('v20191001') == 'Module for version 20191001'\", \"assert get_module_name('v20191101') == 'Mod...
{ "split": "train", "index": 4355, "acecode_id": "oss_10469", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D array of integers, write a function that returns the first integer in the traversal order of the 2D array that appears an odd number of times. If no integer meets this criterion, return None.\nPlease reason step by step, then write a self-contained Python solution. G...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_uneven_frequency([[1,2,3],[4,5,6],[7,8,1]]) == 2\", \"assert find_uneven_frequency([[10, 20, 10],[30, 20, 30],[20]]) == 20\", \"assert find_uneven_frequency([[7, 8], [9, 8, 7, 9, 7]]) == 7\", \"assert find_uneven_frequency([[1, 2, 3], [2, 3, 4], [4, 5]]...
{ "split": "train", "index": 4356, "acecode_id": "evol_7646", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Write a python function that splits a list at the nth element, adds the first part to the end, and then sorts the resulting list in ascending order. The function should handle exceptions for invalid input such as when the nth element is not a valid index in the list. The functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rotate_and_sort([5, 3, 8, 6], 1) == [3, 5, 6, 8]\", \"assert rotate_and_sort([10, 20, 30, 40], 0) == [10, 20, 30, 40]\", \"assert rotate_and_sort([], 0) == []\", \"assert rotate_and_sort([7], 0) == [7]\", \"assert rotate_and_sort([2, 4, 1, 3], 3) == [1, 2, 3...
{ "split": "train", "index": 4357, "acecode_id": "evol_25449", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a string input representing an encryption key, implement a function `is_valid_key(key: str) -> bool` that checks if the key is a valid encryption key. A valid key is a base64-encoded string of 32 bytes (256 bits). The function should return `True` if the key is valid and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_key('dGVzdF9rZXk=' ) == False\", \"assert is_valid_key('InvalidKeyNotBase64' ) == False\", \"assert is_valid_key('U2VjcmV0S2V5' ) == False\", \"assert is_valid_key('SGVsbG9Xb3JsZC1UZXN0' ) == False\", \"assert is_valid_key('YmFzZTY0' ) == False\"]}"...
{ "split": "train", "index": 4358, "acecode_id": "bigcode_python_fns_31537", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a forward pass through a neural network. This function, named `forward_pass`, should take two parameters: an integer `in_channels` representing the number of input channels and a string `encoder_name` representing the n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert forward_pass(3, 'simplenet') == 'Output shape: 1x1x128'\", \"assert forward_pass(3, 'resnet') == 'Output shape: 1x1x256'\", \"assert forward_pass(3, 'vgg') == 'Output shape: 1x1x512'\", \"assert forward_pass(5, 'simplenet') == 'Output shape: 1x1x128'\", \"as...
{ "split": "train", "index": 4359, "acecode_id": "oss_34387", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries representing a population where each dictionary contains two keys: 'birth_nation' (a string) and 'name' (a string). Your task is to implement a function that randomly selects a specified number of parents from each nationality based on a giv...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert select_parents([{'birth_nation': 'A', 'name': 'Alice'},{'birth_nation': 'A', 'name': 'Alex'},{'birth_nation': 'B', 'name': 'Bob'},{'birth_nation': 'B', 'name': 'Bill'},{'birth_nation': 'C', 'name': 'Charlie'}], {'A': 2, 'B': 1, 'C': 1}) == [{'birth_nation': ...
{ "split": "train", "index": 4360, "acecode_id": "bigcode_python_fns_21655", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function `advanced_vowels_count(s)` that accepts a string `s` representing a sentence and returns a dictionary with the total counts of vowels present for each word. Vowels include 'a', 'e', 'i', 'o', 'u', and 'y' ONLY when it occurs as the final letter of a word. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert advanced_vowels_count('Hello World!') == {'Hello': 2, 'World!': 1}\", \"assert advanced_vowels_count('A quick brown fox jumps over the lazy dog.') == {'A': 1, 'quick': 2, 'brown': 1, 'fox': 1, 'jumps': 1, 'over': 2, 'the': 1, 'lazy': 2, 'dog.': 1}\", \"asser...
{ "split": "train", "index": 4361, "acecode_id": "evol_19552", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given an array of integers, write a function that returns a new array containing only the unique elements from the original array, maintaining the order of their first occurrence. The input array may contain duplicates. Please implement the function `remove_duplicates(arr)` whe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates([1, 2, 3, 4, 4, 1, 5]) == [1, 2, 3, 4, 5]\", \"assert remove_duplicates([1, 1, 1, 1, 1]) == [1]\", \"assert remove_duplicates([]) == []\", \"assert remove_duplicates([7, 8, 9, 7, 8]) == [7, 8, 9]\", \"assert remove_duplicates([1, 2, 3, 1, 2...
{ "split": "train", "index": 4362, "acecode_id": "evol_26017", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that returns the maximum sum of any contiguous subarray within the list. The input list may contain both positive and negative integers. Your function should take a single parameter, `nums`, which is a list of integers, and return ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_subarray_sum([-2, 1, -3, 4, -1, 2, 1, -5, 4]) == 6\", \"assert max_subarray_sum([1, 2, 3, 4, 5]) == 15\", \"assert max_subarray_sum([-1, -2, -3, -4]) == -1\", \"assert max_subarray_sum([5, -1, 2, 3, -4, 6]) == 11\", \"assert max_subarray_sum([0, 0, 0, 0]...
{ "split": "train", "index": 4363, "acecode_id": "oss_20231", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of alphanumeric characters, implement a function that reverses the elements of the list in place. The first character should swap places with the last character, the second character should swap with the second last, and so on. The function should return the modifi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_list(['a', 'b', 'c', 'd']) == ['d', 'c', 'b', 'a']\", \"assert reverse_list(['1', '2', '3', '4', '5']) == ['5', '4', '3', '2', '1']\", \"assert reverse_list(['x', 'y', 'z']) == ['z', 'y', 'x']\", \"assert reverse_list(['A', 'B', 'C', 'D', 'E', 'F']) ...
{ "split": "train", "index": 4364, "acecode_id": "evol_20101", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `deep_copy_custom_class` that takes an instance of a `CustomClass` and returns a deep copy of that instance. The `CustomClass` has the following attributes: `name` (a string), `age` (an integer), `hobbies` (a list of strings), and `ad...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert deep_copy_custom_class(CustomClass('Alice', 30, ['reading', 'hiking'], {'city': 'Wonderland', 'zip': '12345'})).name == 'Alice'\", \"assert deep_copy_custom_class(CustomClass('Alice', 30, ['reading', 'hiking'], {'city': 'Wonderland', 'zip': '12345'})).age ==...
{ "split": "train", "index": 4365, "acecode_id": "oss_14854", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create a function that receives a list of integers as an argument. This function should find the highest and lowest values within the list and provide their indexes. If the highest or lowest value appears more than once, return all indexes where these values are found. If the p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_max_min([7, 4, 12, 1, 9, 3, 12, 1]) == 'Highest Value: 12, Indexes: [2, 6], Lowest Value: 1, Indexes: [3, 7]'\", \"assert find_max_min([1, 2, 3, 4, 5]) == 'Highest Value: 5, Indexes: [4], Lowest Value: 1, Indexes: [0]'\", \"assert find_max_min([5, 5, 5,...
{ "split": "train", "index": 4366, "acecode_id": "evol_11309", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simplified command execution on a device. The function, `execute_commands`, takes a list of strings as input, where each string represents a command. The function should return a list of results that indicate the status o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert execute_commands(['run', 'stop', 'pause']) == ['executed', 'stopped', 'unknown command']\", \"assert execute_commands(['RUN', 'STOP', 'run']) == ['unknown command', 'unknown command', 'executed']\", \"assert execute_commands(['start', 'run', 'stop']) == ['un...
{ "split": "train", "index": 4367, "acecode_id": "bigcode_python_fns_26815", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of scores and a list of sequences, your task is to filter out unique sequences based on their scores. A sequence is considered unique if it does not appear more than once in the list. If a sequence appears multiple times, keep the one with the lowest score among th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_unique_sequences([0.1, 0.2, 0.1, 0.3], ['seq1', 'seq2', 'seq1', 'seq3']) == {'seq2': 0.2, 'seq3': 0.3}\", \"assert filter_unique_sequences([0.5, 0.5, 0.5, 0.4], ['seqA', 'seqB', 'seqA', 'seqC']) == {'seqB': 0.5, 'seqC': 0.4}\", \"assert filter_unique_...
{ "split": "train", "index": 4368, "acecode_id": "bigcode_python_fns_32905", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `simulate_stack_operations(operations: List[Tuple[str, Optional[int]]]) -> List[Optional[int]]` that simulates a simple stack data structure based on a list of operations. The operations will be provided as a list of tuples, where each tuple consists of a s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_stack_operations([('pop', None), ('peek', None)]) == [None, None]\", \"assert simulate_stack_operations([('push', 5), ('push', 15), ('pop', None), ('push', 25), ('peek', None)]) == [15, 25]\", \"assert simulate_stack_operations([('push', 1), ('push'...
{ "split": "train", "index": 4369, "acecode_id": "oss_28093", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that logs a warning message to a default logger. The function should take a string message as input and log it at the 'WARNING' level. If the logger is not specified, the function should use a default logger. Your function should be named...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert log_warning('Low disk space') == 'Low disk space'\", \"assert log_warning('User not found') == 'User not found'\", \"assert log_warning('Invalid input provided') == 'Invalid input provided'\", \"assert log_warning('Connection failed') == 'Connection failed'\...
{ "split": "train", "index": 4370, "acecode_id": "bigcode_python_fns_25591", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `dict_to_object(item: dict) -> object` that converts a Python dictionary into a Python object. The keys of the dictionary should become attributes of the object, and if any of the values are dictionaries themselves, they should also be converted into object...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert dict_to_object({'name': 'Alice', 'age': 30}).name == 'Alice'\", \"assert dict_to_object({'name': 'Alice', 'age': 30}).age == 30\", \"assert dict_to_object({'hobbies': ['reading', 'coding']}).hobbies == ['reading', 'coding']\", \"assert dict_to_object({'addre...
{ "split": "train", "index": 4371, "acecode_id": "bigcode_python_fns_38911", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a filename as a string, return the full file path by combining the filename with the directory path '/test/data/'. The resulting path should be a string that represents the complete file path. For example, if the input is 'example.txt', the output should be '/test/data/ex...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_full_path('example.txt') == '/test/data/example.txt'\", \"assert get_full_path('data.csv') == '/test/data/data.csv'\", \"assert get_full_path('image.png') == '/test/data/image.png'\", \"assert get_full_path('report.pdf') == '/test/data/report.pdf'\", \"a...
{ "split": "train", "index": 4372, "acecode_id": "bigcode_python_fns_45910", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `employee_bonus` that takes three parameters: `job_title` (a string), `experience` (an integer), and `salary` (a float). The function should return the bonus for the employee based on the following rules: For less than 5 years of experience, the bonus is 5% of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert employee_bonus('Junior', 4, 1000) == 50.0\", \"assert employee_bonus('Junior', 5, 1000) == 70.0\", \"assert employee_bonus('Junior', 9, 1000) == 70.0\", \"assert employee_bonus('Junior', 10, 1000) == 100.0\", \"assert employee_bonus('Junior', 11, 1000) == 10...
{ "split": "train", "index": 4373, "acecode_id": "evol_5699", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a single interval formatted as 'seqname start end', implement a function that parses this string and returns a dictionary containing the 'seqname', 'start', and 'end' values. Note that the 'start' value should be adjusted to be 1-based instead of 0-b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_interval('chr1 0 100') == {'seqname': 'chr1', 'start': 1, 'end': 100}\", \"assert parse_interval('chr2 50 150') == {'seqname': 'chr2', 'start': 51, 'end': 150}\", \"assert parse_interval('chr3 10 200') == {'seqname': 'chr3', 'start': 11, 'end': 200}\",...
{ "split": "train", "index": 4374, "acecode_id": "bigcode_python_fns_38727", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of strings as input and returns a set containing the unique strings from that list. The input list may contain duplicates, and the order of the output set does not matter. Implement a function `unique_strings(strings: Li...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_strings(['apple', 'banana', 'apple', 'orange']) == {'apple', 'banana', 'orange'}\", \"assert unique_strings(['hello', 'world', 'hello', 'python']) == {'hello', 'world', 'python'}\", \"assert unique_strings(['test', 'test', 'test']) == {'test'}\", \"as...
{ "split": "train", "index": 4375, "acecode_id": "bigcode_python_fns_6705", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with modifying a database migration script that adds two new columns to a table named 'collection'. Your job is to implement a function that generates the SQL commands needed to add these two columns: 'gather_start_at' of type DateTime and 'gather_end_at' of type...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_migration_commands() == ['ALTER TABLE collection ADD COLUMN gather_start_at TIMESTAMP;', 'ALTER TABLE collection ADD COLUMN gather_end_at TIMESTAMP;']\", \"assert generate_migration_commands() == ['ALTER TABLE collection ADD COLUMN gather_start_at T...
{ "split": "train", "index": 4376, "acecode_id": "oss_3309", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Define a Python function that calculates the occurrence rate of each distinct word present within a given sentence. The function should return a dictionary where the keys are the distinct words (in lowercase) and the values are their corresponding counts in the sentence. The in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert word_occurrence_rate('This is a test sentence and this test works') == {'this': 2, 'is': 1, 'a': 1, 'test': 2, 'sentence': 1, 'and': 1, 'works': 1}\", \"assert word_occurrence_rate('') == {}\", \"assert word_occurrence_rate('A B C A a b c') == {'a': 3, 'b': ...
{ "split": "train", "index": 4377, "acecode_id": "evol_27338", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given two integers n and k, where n >= 0 and k >= 0, implement a function `binomial_coefficient(n: int, k: int) -> int` that returns the value of the binomial coefficient C(n, k) = n! / (k! * (n - k)!) modulo 2,000,000,007. The function should handle cases where k > n by return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert binomial_coefficient(0, 0) == 1\", \"assert binomial_coefficient(5, 0) == 1\", \"assert binomial_coefficient(5, 1) == 5\", \"assert binomial_coefficient(5, 2) == 10\", \"assert binomial_coefficient(5, 3) == 10\", \"assert binomial_coefficient(5, 4) == 5\", \...
{ "split": "train", "index": 4378, "acecode_id": "evol_35903", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `calc_total(nested_list)` that calculates the total of all the elements in a multidimensional list (i.e., a list of lists). The list may contain integers as well as string representations of integers. Your function should handle cases where the strings cannot b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_total([[\\\"1\\\", 2, 3], [4, \\\"5\\\", 6], [7, 8, \\\"Nine\\\"]]) == 36\", \"assert calc_total([[\\\"7\\\", \\\"3\\\", \\\"2\\\"], [\\\"10\\\", 5, \\\"0\\\"]]) == 27\", \"assert calc_total([[1, 2, 3], [4, 5]]) == 15\", \"assert calc_total([[\\\"1\\\"]...
{ "split": "train", "index": 4379, "acecode_id": "evol_32347", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates an email message when a new forum thread is created. The function should take in a dictionary `post` with the following keys: 'content' (string), 'content_parsed' (string), 'creator' (dictionary with 'username' as a key), a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_email_message({'content': 'Hello World', 'content_parsed': '<p>Hello World</p>', 'creator': {'username': 'User1'}, 'thread': {'title': 'Introduction', 'document': {'title': 'General Discussion'}}}, 'forum.com') == {'subject': 'General Discussion - I...
{ "split": "train", "index": 4380, "acecode_id": "bigcode_python_fns_47730", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string that represents a pipeline configuration file. This file is formatted in a specific way where each pipeline consists of a name, a list of parameters, stages, and calls. Implement a function `parse_pipeline_config(pipeline_string: str) -> dict` that takes ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_pipeline_config('pipeline testPipeline() { call testCall(); return(); }') == {'pipeline_name': 'testPipeline', 'parameters': [], 'stages': {}, 'calls': {'testCall': []}}\", \"assert parse_pipeline_config('pipeline emptyPipeline() { }') == {'pipeline_na...
{ "split": "train", "index": 4381, "acecode_id": "bigcode_python_fns_25583", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `max_product(nums: List[int]) -> int` that returns the maximum product that can be obtained by multiplying any two distinct elements from the list. If the list contains less than two elements, return 0. The function should handle both ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_product([1, 2, 3, 4]) == 12\", \"assert max_product([0, 0, 0]) == 0\", \"assert max_product([1, -2, -3, 4]) == 6\", \"assert max_product([-1, 2]) == -2\", \"assert max_product([5]) == 0\", \"assert max_product([]) == 0\", \"assert max_product([3, 5, -2, ...
{ "split": "train", "index": 4382, "acecode_id": "bigcode_python_fns_47700", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given the radius of a right circular cone, compute its volume. The height of the cone is always twice its base radius. Implement a function `cone_volume(radius: float) -> float` that takes the radius as input and returns the volume of the cone.\nPlease reason step by step, then...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(cone_volume(1) - (1/3) * math.pi * 1**2 * 2) < 1e-9\", \"assert abs(cone_volume(2) - (1/3) * math.pi * 2**2 * 4) < 1e-9\", \"assert abs(cone_volume(3) - (1/3) * math.pi * 3**2 * 6) < 1e-9\", \"assert abs(cone_volume(4) - (1/3) * math.pi * 4**2 * 8) < 1e-...
{ "split": "train", "index": 4383, "acecode_id": "evol_26443", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `mask_type` which can either be 'A' or 'B', an integer `in_channels` representing the number of input channels to a layer, and an integer `out_channels` representing the number of output channels of that layer, write a function `create_channel_mask(mask_type: str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_channel_mask('A', 3, 3) == [[0, 0, 0], [1, 0, 0], [1, 1, 0]]\", \"assert create_channel_mask('B', 3, 3) == [[1, 0, 0], [1, 1, 0], [1, 1, 1]]\", \"assert create_channel_mask('A', 4, 2) == [[0, 0, 0, 0], [1, 0, 0, 0]]\", \"assert create_channel_mask('B'...
{ "split": "train", "index": 4384, "acecode_id": "bigcode_python_fns_11972", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a string representing a snippet of Python code. Write a Python function `extract_comments(code: str) -> List[str]` that takes this string as input and returns a list of strings containing all the comments from the code snippet. A comment is defined as any line tha...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_comments('''# First comment\\n# Second comment\\nprint(\\\"Hello\\\")\\n# Third comment\\n''') == ['# First comment', '# Second comment', '# Third comment']\", \"assert extract_comments('''# Comment line 1\\n# Comment line 2\\n# Comment line 3\\n#\\n...
{ "split": "train", "index": 4385, "acecode_id": "oss_32312", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a trapezoid-shaped grid of numbers, implement a function that calculates the maximum sum of numbers starting from the top of the trapezoid to the bottom, moving to adjacent numbers in the row below. The trapezoid is represented as a list of lists, where each sublist repre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert solve_trapezoid([[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]) == 4\", \"assert solve_trapezoid([[4], [2, 5], [1, 3, 6], [7, 8, 9, 10]]) == 25\", \"assert solve_trapezoid([[5], [5, 5], [5, 5, 5], [5, 5, 5, 5]]) == 20\", \"assert solve_trapezoid([[1], [0, 0], [0, 0,...
{ "split": "train", "index": 4386, "acecode_id": "evol_16142", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a list of tuples representing stress-strain data points, where each tuple contains two values (stress, strain), implement a function that calculates Young's Modulus. Young's Modulus is defined as the slope of the linear elastic region of the stress-strain curve, which is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(calculate_youngs_modulus([(0, 0), (10, 1)]) - 10.0) < 1e-2\", \"assert abs(calculate_youngs_modulus([(0, 0), (20, 2), (30, 3)]) - 10.0) < 1e-2\", \"assert abs(calculate_youngs_modulus([(0, 0), (30, 3), (60, 6)]) - 10.0) < 1e-2\", \"assert abs(calculate_y...
{ "split": "train", "index": 4387, "acecode_id": "bigcode_python_fns_28752", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that takes two strings as input and returns a list of unique characters that are common to both strings, ignoring case sensitivity. The function should convert both strings to lowercase, extract the characters, and then find the intersection of these cha...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert intersect_chars('Python', 'Java') == []\", \"assert intersect_chars('OpenAI', 'AI') == ['a', 'i']\", \"assert intersect_chars('Case', 'SENSitivity') == ['s', 'e']\", \"assert intersect_chars('abcd', 'efgh') == []\", \"assert intersect_chars('abcdefg', 'ghijk...
{ "split": "train", "index": 4388, "acecode_id": "evol_17481", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with managing the lifecycle of files in a storage system. Each file can be transitioned to a lower-cost storage class after a specified period of inactivity. You need to create a function that takes in a file system ID and a list of lifecycle policies, where each...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert put_lifecycle_configuration('fs-12345', [{'TransitionToIA': 'AFTER_30_DAYS'}]) == {'LifecyclePolicies': [{'TransitionToIA': 'AFTER_30_DAYS'}]}\", \"assert put_lifecycle_configuration('fs-67890', [{'TransitionToIA': 'AFTER_7_DAYS'}, {'TransitionToIA': 'AFTER_...
{ "split": "train", "index": 4389, "acecode_id": "bigcode_python_fns_6205", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing pixel data of an image. Your task is to return a new list that contains the pixel data in a flattened format. The pixel data list may represent multiple frames, where each frame is a contiguous segment of the list. Write a function ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten_pixel_data([1, 2, 3, 4, 5], 1) == [1, 2, 3, 4, 5]\", \"assert flatten_pixel_data([1, 2, 3, 4, 5, 6, 7, 8, 9], 3) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\", \"assert flatten_pixel_data([], 1) == []\", \"assert flatten_pixel_data([5, 6, 7, 8, 9], 1) == [5, 6, 7...
{ "split": "train", "index": 4390, "acecode_id": "bigcode_python_fns_13590", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a string. Write a function that partitions the string into two halves and reverses the order of the two halves. Additionally, reverse the order of the characters in each half. If the string has an odd length, the middle character should be included in the second h...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert part_rev('HelloWorld') == 'dlroWolleH'\", \"assert part_rev('abcdefg') == 'gfedcba'\", \"assert part_rev('123456789') == '987654321'\", \"assert part_rev('OpenAI') == 'IAnepO'\", \"assert part_rev('abc') == 'cba'\", \"assert part_rev('a') == 'a'\", \"assert ...
{ "split": "train", "index": 4391, "acecode_id": "evol_31236", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of modules, where each module has a method called `write_css()` that generates a CSS file for that module. Implement a function `generate_css_files(modules: List[Module]) -> None` that iterates through the list of modules and calls the `write_css()` method ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_css_files([MockModule('module1'), MockModule('module2')]) == None\", \"assert generate_css_files([MockModule('moduleA'), MockModule('moduleB'), MockModule('moduleC')]) == None\", \"assert generate_css_files([]) == None\", \"assert generate_css_files...
{ "split": "train", "index": 4392, "acecode_id": "bigcode_python_fns_19852", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes an integer and returns the cube of that integer. The function should be named `cube` and should accept a single parameter `n`, which is the integer to be cubed. The output should be an integer representing the cubed value of `n`.\nPlease reason s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert cube(0) == 0\", \"assert cube(1) == 1\", \"assert cube(-1) == -1\", \"assert cube(2) == 8\", \"assert cube(-2) == -8\", \"assert cube(3) == 27\", \"assert cube(-3) == -27\", \"assert cube(4) == 64\", \"assert cube(-4) == -64\", \"assert cube(5) == 125\", \"a...
{ "split": "train", "index": 4393, "acecode_id": "evol_305", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `check_hex_color_format(hex_code: str) -> str` that takes a single hexadecimal color code as input and determines if it is in RGB or ARGB format. The function should return 'RGB' for a 7-character code (e.g., '#AABBCC'), 'ARGB' for a 9-character code (e.g., '#A...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_hex_color_format('#AABBCC') == 'RGB'\", \"assert check_hex_color_format('#ABC') == 'Shorthand RGB'\", \"assert check_hex_color_format('#A1B2C3D4') == 'ARGB'\", \"assert check_hex_color_format('#123456') == 'RGB'\", \"assert check_hex_color_format('#FFF...
{ "split": "train", "index": 4394, "acecode_id": "evol_13430", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function `filter_books(books: Dict[str, Tuple[float, float, float, float, float, float, str, str]], base_values: Tuple[float, float, float, float, float, float, str, str]) -> List[Tuple[str, float, float, float, float]]` that takes a dictionary `books` where the key...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_books({'Book A': (10.0, 4.5, 300, 2020, 1500, 4.8, 'Author A', 'Fiction')}, (5.0, 4.0, 250, 2015, 1000, 4.0, 'Author A', 'Fiction')) == [('Book A', 4.5, 2020, 1500, 4.8)]\", \"assert filter_books({'Book C': (20.0, 4.8, 320, 2021, 2000, 5.0, 'Author C'...
{ "split": "train", "index": 4395, "acecode_id": "evol_15755", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Develop a function that generates a set of unique random numbers within a specified range. The function should accept two parameters: the range (inclusive) defined by 'range_start' and 'range_end', and the number of unique random numbers to generate 'count'. If the requested co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_unique_random_numbers(0, 50, 60) == sorted(set(range(0, 51)))\", \"assert generate_unique_random_numbers(0, 1000, 0) == []\", \"assert generate_unique_random_numbers(1, 1, 1) == [1]\", \"assert generate_unique_random_numbers(10, 10, 1) == [10]\", \"...
{ "split": "train", "index": 4396, "acecode_id": "evol_29191", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of policy MD5 hashes, implement a function that returns a list of unique policy hostnames derived from these hashes. The function should take in a list of strings, where each string represents a policy MD5 hash, and return a list of unique hostnames. You can assume...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_hostnames(['abc123', 'def456', 'ghi789', 'abc123', 'jkl012']) == ['host1', 'host2', 'host3', 'host4']\", \"assert unique_hostnames(['abc123', 'abc123', 'abc123']) == ['host1']\", \"assert unique_hostnames(['def456', 'ghi789', 'jkl012']) == ['host2', '...
{ "split": "train", "index": 4397, "acecode_id": "bigcode_python_fns_20223", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that retrieves specific settings from a predefined dictionary representing a data processing system's configuration. The function should take a dictionary as input, which contains a section named 'samsa' with the following keys: 'topics',...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_settings({'samsa': {'topics': 'science', 'polling_freq': 10, 'max_history': 100, 'view_mode': 'detailed'}}) == ('science', 10, 100, 'detailed')\", \"assert get_settings({'samsa': {'topics': 'technology', 'polling_freq': 5, 'max_history': 50, 'view_mode':...
{ "split": "train", "index": 4398, "acecode_id": "oss_8145", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple key-value store. The function should support adding key-value pairs and converting the key-value store to a string representation. You need to implement the function `key_value_store_operations(operations: List...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert key_value_store_operations([('add', 'name', 'Alice'), ('add', 'age', 25)]) == \\\"{'name': 'Alice', 'age': 25}\\\"\", \"assert key_value_store_operations([('add', 'city', 'New York'), ('to_str',)]) == \\\"{'city': 'New York'}\\\"\", \"assert key_value_store_...
{ "split": "train", "index": 4399, "acecode_id": "oss_9477", "num_tests": 16 }