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 2D list of integers representing a matrix, write a function that computes the product of all non-zero elements located on the main diagonal of the matrix. The main diagonal consists of elements where the row index and the column index are the same (i.e., elements at pos... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prod_non_zero_diag([[0, 2], [3, 0]]) == 1\", \"assert prod_non_zero_diag([[1, 0], [0, 1]]) == 1\", \"assert prod_non_zero_diag([[5]]) == 5\", \"assert prod_non_zero_diag([[0]]) == 1\", \"assert prod_non_zero_diag([[1, 2], [0, 0], [3, 4]]) == 1\", \"assert pr... | {
"split": "train",
"index": 85000,
"acecode_id": "bigcode_python_fns_2025",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that modifies the MAC address of a given network device. The function should take two parameters: a string representing the name of the network device and another string representing the new MAC address. Your function should return a stri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_mac_address('eth0', '00:1A:2B:3C:4D:5E') == 'MAC address 00:1A:2B:3C:4D:5E has been set for device eth0'\", \"assert set_mac_address('wlan0', '11:22:33:44:55:66') == 'MAC address 11:22:33:44:55:66 has been set for device wlan0'\", \"assert set_mac_addres... | {
"split": "train",
"index": 85001,
"acecode_id": "bigcode_python_fns_36501",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of game platforms and a specific platform ID, return a list of games available for that platform. Each game is represented as a string. If no games are found for the given platform ID, return an empty list. Implement a function `get_games(platforms: List[str], plat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_games(['1:gameA,gameB', '2:gameC', '1:gameD'], '1') == ['gameA', 'gameB', 'gameD']\", \"assert get_games(['1:gameA,gameB', '2:gameC', '1:gameD'], '2') == ['gameC']\", \"assert get_games(['1:gameA,gameB', '2:gameC', '1:gameD'], '3') == []\", \"assert get_... | {
"split": "train",
"index": 85002,
"acecode_id": "bigcode_python_fns_14734",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of unique integers, implement a function `max_quotient(arr)` that returns the maximum quotient obtained from dividing any two distinct integers in the list. If the list contains less than two integers, return None.\nPlease reason step by step, then write a self-con... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_quotient([-10, 5, 1, 16, 2, -8, 7, 4]) == 16.0\", \"assert max_quotient([1, 2, 3, 4, 5]) == 5.0\", \"assert max_quotient([10]) == None\", \"assert max_quotient([]) == None\", \"assert max_quotient([-10, 10]) == 1.0\", \"assert max_quotient([2, 4, 8, 16])... | {
"split": "train",
"index": 85003,
"acecode_id": "evol_23970",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Your task is to write a function `find_first_occurrence(arr: List[int], target: int) -> int:` that returns the index of the first occurrence of the `target` in the list `arr`. If the `target` is not present in the list, return -1. The function ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_first_occurrence([1, 2, 3, 4, 5], 3) == 2\", \"assert find_first_occurrence([1, 2, 3, 4, 5], 1) == 0\", \"assert find_first_occurrence([1, 2, 3, 4, 5], 5) == 4\", \"assert find_first_occurrence([1, 2, 3, 4, 5], 6) == -1\", \"assert find_first_occurrence... | {
"split": "train",
"index": 85004,
"acecode_id": "bigcode_python_fns_39740",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that simulates a system check before executing a critical operation. The function should take in a minimum SDK level and the architecture as parameters. It should raise a custom exception if the current SDK level is below the minim... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_system_and_execute(10.0, '64-bit', lambda: 'Operation Successful') == 'Operation Successful'\", \"assert check_system_and_execute(10.10, '64-bit', lambda: 42) == 42\", \"assert check_system_and_execute(9.5, '64-bit', lambda: 'Valid') == 'Valid'\", \"as... | {
"split": "train",
"index": 85005,
"acecode_id": "oss_4145",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of tuples representing a persistence barcode diagram, implement a function that sorts the bars based on either their birth or death values. Each tuple in the list contains two values: the birth time and the death time of a bar. The function should accept the follow... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_bars([(1, 3), (2, 5), (0, 4)], 'birth') == [(0, 4), (1, 3), (2, 5)]\", \"assert sort_bars([(1, 3), (2, 5), (0, 4)], 'death') == [(1, 3), (0, 4), (2, 5)]\", \"assert sort_bars([], 'birth') == []\", \"assert sort_bars([], 'death') == []\", \"assert sort_b... | {
"split": "train",
"index": 85006,
"acecode_id": "bigcode_python_fns_24941",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a list of telescope types. Each telescope type is represented by a dictionary containing its `id`, `name`, `created`, and `modified` timestamps. Your function should accept a list of tuples, where each tuple contains a tele... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_telescope_types([(1, 'Refractor'), (2, 'Reflector')], '2023-10-01T12:00:00Z') == [{'id': 1, 'name': 'Refractor', 'created': '2023-10-01T12:00:00Z', 'modified': '2023-10-01T12:00:00Z'}, {'id': 2, 'name': 'Reflector', 'created': '2023-10-01T12:00:00Z', ... | {
"split": "train",
"index": 85007,
"acecode_id": "bigcode_python_fns_46918",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a function that simulates the adjustment of hole sizes and centers in an entrance pupil based on a scaling factor. The function takes a boolean parameter 'rescale' which, if set to True, applies a scaling factor of 1.1 to the calculated demagnification. If 'rescal... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert adjust_hole_sizes(True) == (1.0, (0.0, 0.0))\", \"assert adjust_hole_sizes(False) == (0.5, (1.0, 1.0))\", \"assert adjust_hole_sizes(True) == (1.0, (0.0, 0.0))\", \"assert adjust_hole_sizes(False) == (0.5, (1.0, 1.0))\", \"assert adjust_hole_sizes(True) == (... | {
"split": "train",
"index": 85008,
"acecode_id": "bigcode_python_fns_23316",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes an array of integers as input and sorts it using the bubble sort algorithm. In addition to returning the sorted array, the function should also return the total number of swaps that were performed during the sorting process. The function signatur... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bubble_sort([1, 2, 3]) == ([1, 2, 3], 0)\", \"assert bubble_sort([5, 4, 3, 2, 1]) == ([1, 2, 3, 4, 5], 10)\", \"assert bubble_sort([3, 3, 3]) == ([3, 3, 3], 0)\", \"assert bubble_sort([1]) == ([1], 0)\", \"assert bubble_sort([]) == ([], 0)\", \"assert bubble... | {
"split": "train",
"index": 85009,
"acecode_id": "evol_20986",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the retrieval of role assignments for a team based on the team's name and an optional project name. Implement a function `get_role_assignments(name: str, project_name: Optional[str] = None) -> List[str]` that returns a list... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_role_assignments('TeamA') == ['Role1', 'Role2']\", \"assert get_role_assignments('TeamB') == ['Role3']\", \"assert get_role_assignments('TeamC') == ['Role4', 'Role5', 'Role6']\", \"assert get_role_assignments('UnknownTeam') == []\", \"assert get_role_ass... | {
"split": "train",
"index": 85010,
"acecode_id": "bigcode_python_fns_34328",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Develop a function to determine if a 2D array is symmetric, meaning it is equal to its transpose. The dimensions of the array should not exceed 10x10. A 2D array is symmetric if the element at position (i, j) is equal to the element at position (j, i) for all valid indices i an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_symmetric([[1, 2], [2, 1]]) == True\", \"assert is_symmetric([[1, 0], [0, 1]]) == True\", \"assert is_symmetric([[1]]) == True\", \"assert is_symmetric([[0, 1, 2], [1, 0, 3], [2, 3, 0]]) == True\", \"assert is_symmetric([[1, 1], [1, 1]]) == True\", \"asse... | {
"split": "train",
"index": 85011,
"acecode_id": "evol_13722",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings that represent tokens in an expression. Your task is to implement a function called `parse_tokens` that takes a list of tokens and returns a single string that concatenates the tokens, separated by a comma. If the list of tokens is empty or conta... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_tokens(['apple', '', 'banana', 'cherry']) == 'apple,banana,cherry'\", \"assert parse_tokens(['', '', '']) == ''\", \"assert parse_tokens([]) == ''\", \"assert parse_tokens(['a', 'b', 'c']) == 'a,b,c'\", \"assert parse_tokens(['one', 'two', 'three']) ==... | {
"split": "train",
"index": 85012,
"acecode_id": "bigcode_python_fns_13929",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, write a function that finds the second smallest element in the array. The array may contain duplicates and negative integers. If there is no second smallest element (e.g., all elements are the same), return 'No second smallest number.'\nPlease reason... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert second_smallest([1, 1, 1]) == 'No second smallest number.'\", \"assert second_smallest([5, 5, 5, 5]) == 'No second smallest number.'\", \"assert second_smallest([-1, -1, -1]) == 'No second smallest number.'\", \"assert second_smallest([2, 3, 4, 5, 6]) == 3\"... | {
"split": "train",
"index": 85013,
"acecode_id": "evol_25320",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers that represent the weights of items. Your task is to implement a function `max_weight(weights: List[int], limit: int) -> int` that calculates the maximum total weight of items that can be selected without exceeding a given weight limit. The func... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_weight([1, 2, 3, 4, 5], 5) == 5\", \"assert max_weight([10, 20, 30], 25) == 20\", \"assert max_weight([1, 2, 3], 6) == 6\", \"assert max_weight([1, 2, 3, 4], 10) == 10\", \"assert max_weight([1, 2, 3, 4], 4) == 4\", \"assert max_weight([2, 2, 2], 5) == 4... | {
"split": "train",
"index": 85014,
"acecode_id": "oss_35920",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a multilingual dictionary where each key is a word and its value is a list of languages that the word is associated with, implement a function `print_languages(dictionary)` that prints each word followed by the languages it belongs to in a specific format. The output shou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_languages({'apple': ['English', 'Dutch'], 'apfel': ['German', 'Dutch'], 'pomme': ['French']}) == 'apple: English, Dutch\\\\napfel: German, Dutch\\\\npomme: French\\\\n'\", \"assert print_languages({'cat': ['English'], 'gato': ['Spanish', 'Portuguese']}... | {
"split": "train",
"index": 85015,
"acecode_id": "evol_28333",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to process and analyze a list of detections from a sensor. Each detection is represented as a tuple containing the x and y coordinates of the detected object. The goal is to identify and count the number of unique objects detected wit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unique_objects([(0, 0), (1, 1), (2, 2)], 1.5) == 2\", \"assert count_unique_objects([(0, 0), (0, 0), (0, 0)], 1.0) == 1\", \"assert count_unique_objects([], 1.0) == 0\", \"assert count_unique_objects([(1, 1)], 1.0) == 1\", \"assert count_unique_objects... | {
"split": "train",
"index": 85016,
"acecode_id": "oss_9158",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a default configuration dictionary for a network gateway. The function should return a dictionary with the following keys and their associated default values: 'socket_base_url' (str): Represents the base URL for the gateway... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_gateway_config() == {'socket_base_url': 'wss://gateway.discord.gg/', 'version': 9}\", \"assert get_gateway_config()['socket_base_url'] == 'wss://gateway.discord.gg/'\", \"assert get_gateway_config()['version'] == 9\", \"assert type(get_gateway_config()) ... | {
"split": "train",
"index": 85017,
"acecode_id": "oss_4462",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the total number of doorsteps in a playground composed of connected rooms organized in a line. Each room has a specific number of doorsteps. Write a function `compute_total_doorsteps(num_rooms: int, doorsteps_per_room: int) -> int` that takes in ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compute_total_doorsteps(5, 3) == 15\", \"assert compute_total_doorsteps(0, 10) == 0\", \"assert compute_total_doorsteps(10, 0) == 0\", \"assert compute_total_doorsteps(1, 1) == 1\", \"assert compute_total_doorsteps(2, 2) == 4\", \"assert compute_total_doorst... | {
"split": "train",
"index": 85018,
"acecode_id": "oss_22479",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that calculates the overlap duration between two time ranges. The time ranges are represented by named tuples with 'start' and 'end' attributes, where 'start' and 'end' are datetime objects. Your function should return the duration... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_overlap_duration(Range(start=datetime(2022, 1, 1), end=datetime(2022, 1, 10)), Range(start=datetime(2022, 1, 5), end=datetime(2022, 1, 15))) == 432000\", \"assert calculate_overlap_duration(Range(start=datetime(2022, 2, 1), end=datetime(2022, 2, 10... | {
"split": "train",
"index": 85019,
"acecode_id": "oss_24072",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that retrieves all active storage backends from a given context. The storage backends are represented as a list of dictionaries, where each dictionary contains information about the backend, including its 'name' and 'active' status. Y... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_storage_backends([{'name': 'Backend1', 'active': True}, {'name': 'Backend2', 'active': False}], False) == [{'name': 'Backend1', 'active': True}]\", \"assert get_storage_backends([{'name': 'Backend1', 'active': True}, {'name': 'Backend2', 'active': False}... | {
"split": "train",
"index": 85020,
"acecode_id": "bigcode_python_fns_31289",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary containing key-value pairs where the keys represent different locations and the values are lists of numerical data. Each list contains four elements representing different measurements: temperature, humidity, pressure, and an additional value (initial... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_data({'loc1': [25.0, 100.0, 250.0, 0]}) == {'loc1': [25.0, 100.0, 250.0, 1]}\", \"assert process_data({'loc3': [22.0, 140.0, 190.0, 0]}) == {'loc3': [22.0, 140.0, 190.0, 1]}\", \"assert process_data({'loc6': [21.0, 130.0, 195.0, 0]}) == {'loc6': [21.... | {
"split": "train",
"index": 85021,
"acecode_id": "oss_8817",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Create a function `total_sum(a, b, c)` that takes two integers `a` and `b`, and a list of integers `c`. The function should return the sum of `a`, `b`, and the total of the integers in the list `c`. If any of the parameters are missing or if `a` or `b` are not integers, the fun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert total_sum(1, 2, [3, 4]) == 10\", \"assert total_sum(0, 0, []) == 0\", \"assert total_sum(-1, -1, [-2, -3]) == -7\", \"assert total_sum(5, 5, [5]) == 15\", \"assert total_sum(10, 20, [30, 40]) == 100\", \"assert total_sum(1, 2, [1.5]) == 'Error: c must be a l... | {
"split": "train",
"index": 85022,
"acecode_id": "evol_27050",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string s, write a function that converts the string into a UTF-8 encoded Weld literal byte-vector. The output should be a string formatted as a list of byte values, where each byte is followed by the character 'c'. For example, for the input 'hello', the output should b... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert string_to_weld_literal('hello') == '[104c,101c,108c,108c,111c]'\", \"assert string_to_weld_literal('') == '[]'\", \"assert string_to_weld_literal('A') == '[65c]'\", \"assert string_to_weld_literal('abc') == '[97c,98c,99c]'\", \"assert string_to_weld_literal(... | {
"split": "train",
"index": 85023,
"acecode_id": "bigcode_python_fns_13801",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the total number of matches required to form a specific number of geometric shapes. The first shape requires a fixed number of matches, and each subsequent shape requires a number of matches that is a multiple of a given factor. You are given the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_matches(2, 2, 4) == 30\", \"assert calculate_matches(1, 3, 3) == 13\", \"assert calculate_matches(3, 1, 5) == 15\", \"assert calculate_matches(5, 2, 2) == 15\", \"assert calculate_matches(4, 2, 1) == 4\", \"assert calculate_matches(0, 1, 5) == 0\",... | {
"split": "train",
"index": 85024,
"acecode_id": "oss_3727",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a program that takes a numerical grade as input and outputs the corresponding letter grade based on the following scale: A: 90-100, B: 80-89, C: 70-79, D: 60-69, F: 0-59. Your program should handle both integer and floating-point input grades and sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_grade(95) == 'A'\", \"assert calculate_grade(90) == 'A'\", \"assert calculate_grade(100) == 'A'\", \"assert calculate_grade(89.9) == 'B'\", \"assert calculate_grade(85) == 'B'\", \"assert calculate_grade(80) == 'B'\", \"assert calculate_grade(79.9)... | {
"split": "train",
"index": 85025,
"acecode_id": "oss_19464",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a sorted array of distinct integers. Your task is to find the index of a peak element in the array. A peak element is defined as an element that is greater than its neighbors. Write a function `findPeakElement(nums)` that takes a sorted array of distinct integers ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert findPeakElement([1, 2, 3, 1]) in [2]\", \"assert findPeakElement([1, 3, 2]) in [1]\", \"assert findPeakElement([1, 2, 4, 3, 1]) in [2]\", \"assert findPeakElement([5, 10, 15, 10]) in [2]\", \"assert findPeakElement([1, 2, 3, 4, 5]) in [4]\", \"assert findPea... | {
"split": "train",
"index": 85026,
"acecode_id": "oss_14245",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of comments, where each comment is represented as a dictionary. Each dictionary contains a key 'reviewRating' that stores another dictionary with a key 'ratingValue'. Your task is to implement a function that extracts the 'ratingValue' from each comment and... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_ratings([{ 'reviewRating': { 'ratingValue': '5' } }, { 'reviewRating': { 'ratingValue': '4' } }, { 'reviewRating': { 'ratingValue': '3' } }]) == ['5', '4', '3']\", \"assert get_ratings([{ 'reviewRating': { 'ratingValue': '2' } }, { 'reviewRating': { 'rat... | {
"split": "train",
"index": 85027,
"acecode_id": "bigcode_python_fns_41158",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating the next element in a sequence based on specific rules. Given an initial integer, the next element is determined as follows: If the current element is even, the next element is the result of dividing the current element by 2. If the current elemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_next_element(4) == 2\", \"assert get_next_element(2) == 1\", \"assert get_next_element(1) == 4\", \"assert get_next_element(5) == 16\", \"assert get_next_element(16) == 8\", \"assert get_next_element(8) == 4\", \"assert get_next_element(3) == 10\", \"ass... | {
"split": "train",
"index": 85028,
"acecode_id": "oss_29039",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D binary grid `grid` of dimensions `m x n`, initially filled with `0`s, symbolizing water. The `1`s in the grid represent land. Your task is to implement a function that performs a series of operations to convert water cells into land cells at specific position... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert numIslands(3, 3, [[0,0],[0,1],[1,2],[2,1]]) == [1, 1, 2, 3]\", \"assert numIslands(1, 1, [[0,0]]) == [1]\", \"assert numIslands(2, 2, [[0,0],[0,1],[1,0],[1,1]]) == [1, 1, 1, 1]\", \"assert numIslands(4, 4, [[0,0],[0,1],[1,1],[2,2],[2,3]]) == [1, 1, 1, 2, 2]\... | {
"split": "train",
"index": 85029,
"acecode_id": "evol_26842",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with filtering and grouping a list of phone number URNs. You have an input list of URNs that may include some invalid entries. Your goal is to filter out any URNs that do not start with 'tel:+' and then group the valid URNs into batches of a specified size. Write... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_and_group_urns(['tel:+1234567890', 'tel:+9876543210', 'invalid_urn', 'tel:+4567890123'], 2) == [['tel:+1234567890', 'tel:+9876543210'], ['tel:+4567890123']]\", \"assert filter_and_group_urns(['invalid_urn1', 'invalid_urn2'], 3) == []\", \"assert filte... | {
"split": "train",
"index": 85030,
"acecode_id": "bigcode_python_fns_10922",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that counts the total number of images for different categories based on their file names. Each image file name contains a hyphen (-) and the characters before the hyphen represent the image category. Write a function called `count... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_image_categories(['cat-image1.png', 'cat-image2.png', 'dog-image1.png']) == {'cat': 2, 'dog': 1}\", \"assert count_image_categories(['animal-cat1.jpg', 'animal-cat2.png', 'animal-dog1.jpg']) == {'animal': 3}\", \"assert count_image_categories(['fruit-a... | {
"split": "train",
"index": 85031,
"acecode_id": "oss_35341",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of strings and returns a new list containing only the strings that are palindromes. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, disregardin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_palindromes(['level', 'radar', 'hello', 'world']) == ['level', 'radar']\", \"assert find_palindromes(['A man a plan a canal Panama', 'not a palindrome', '12321']) == ['A man a plan a canal Panama', '12321']\", \"assert find_palindromes(['Was it a car or... | {
"split": "train",
"index": 85032,
"acecode_id": "oss_27174",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes an image based on specific conditions. Write a function `process_image` that takes two parameters: `media` (a boolean indicating if there is media attached) and `reply_media` (a boolean indicating if there is a reply with m... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_image(True, False) == 'Processing image...'\", \"assert process_image(False, True) == 'Processing reply image...'\", \"assert process_image(False, False) == 'No image to process.'\", \"assert process_image(True, True) == 'Processing image...'\", \"as... | {
"split": "train",
"index": 85033,
"acecode_id": "bigcode_python_fns_26866",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that performs a basic arithmetic operation on two integers. The function should support four operations: addition, subtraction, multiplication, and division. The function should take three parameters: two integers `a` and `b`, and a s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert perform_operation(3, 2, 'add') == 5\", \"assert perform_operation(3, 2, 'subtract') == 1\", \"assert perform_operation(3, 2, 'multiply') == 6\", \"assert perform_operation(3, 2, 'divide') == 1.5\", \"assert perform_operation(3, 0, 'divide') == 'Division by z... | {
"split": "train",
"index": 85034,
"acecode_id": "oss_23964",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a Python function that identifies the penultimate highest value within an unordered list of distinct positive integers. If the list contains less than two elements, return a message indicating that there is no penultimate element.\nPlease reason step by step, then write... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert penultimate_highest([1, 3, 4, 5, 9, 10, 11]) == 10\", \"assert penultimate_highest([5, 3, 1, 4, 2]) == 4\", \"assert penultimate_highest([7, 8]) == 7\", \"assert penultimate_highest([20, 15, 30, 25]) == 25\", \"assert penultimate_highest([100, 200, 300]) == ... | {
"split": "train",
"index": 85035,
"acecode_id": "evol_19199",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `fib(n: int) -> int` that calculates the n-th Fibonacci number using memoization. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. Your function should optimize the computation by storing previously com... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fib(0) == 0\", \"assert fib(1) == 1\", \"assert fib(2) == 1\", \"assert fib(3) == 2\", \"assert fib(4) == 3\", \"assert fib(5) == 5\", \"assert fib(6) == 8\", \"assert fib(7) == 13\", \"assert fib(8) == 21\", \"assert fib(9) == 34\", \"assert fib(10) == 55\"... | {
"split": "train",
"index": 85036,
"acecode_id": "evol_33393",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the toggling of a device's power state. Given a list of device states represented as strings, where each string can be either 'on' or 'off', implement the function `toggle_power_states(states: List[str]) -> List[str]`. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert toggle_power_states(['on', 'off', 'on']) == ['off', 'on', 'off']\", \"assert toggle_power_states(['off', 'off', 'off']) == ['on', 'on', 'on']\", \"assert toggle_power_states(['on']) == ['off']\", \"assert toggle_power_states(['off']) == ['on']\", \"assert to... | {
"split": "train",
"index": 85037,
"acecode_id": "bigcode_python_fns_7653",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary representing a card entry. The dictionary contains the following keys: 'name' (a string representing the name of the cardholder), 'notes' (a string for additional notes, which may be empty), and 'card' (another dictionary with keys 'brand' for the car... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_card_entry({'name': 'John Doe', 'notes': '', 'card': {'brand': 'Visa', 'number': '1234-5678-9012-3456'}}) == ('John Doe - Card', 'Visa', '1234-5678-9012-3456', '', 'brand: Visa\\\\nnumber: 1234-5678-9012-3456')\", \"assert process_card_entry({'name':... | {
"split": "train",
"index": 85038,
"acecode_id": "bigcode_python_fns_2697",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries where each dictionary represents a podcast with attributes such as 'title', 'thumbnail', and 'url'. Your task is to create a function that processes this list and returns a new list of dictionaries. Each dictionary in the output should conta... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compile_playable_podcast([{'title': 'Podcast A', 'thumbnail': 'thumbA.png', 'url': 'urlA.com'}]) == [{'label': 'Podcast A', 'thumbnail': 'thumbA.png', 'path': 'urlA.com', 'is_playable': True}]\", \"assert compile_playable_podcast([{'title': 'Podcast B', 'thu... | {
"split": "train",
"index": 85039,
"acecode_id": "bigcode_python_fns_27872",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a custom serializer for user accounts in a Django REST framework application. The application has a model called `AccountsUser` which represents user accounts. Your goal is to create a serializer that can handle the serialization of `AccountsUser` o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert serialize_user(AccountsUser(id=1, username='user1', email='user1@example.com', date_joined='2023-01-01', is_active=True)) == {'id': 1, 'username': 'user1', 'email': 'user1@example.com', 'date_joined': '2023-01-01', 'is_active': True}\", \"assert serialize_us... | {
"split": "train",
"index": 85040,
"acecode_id": "oss_13231",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if a given user is authorized to perform an action based on their role. The system has three roles: 'user', 'manager', and 'other'. A user is authorized to perform an action if they are either the original user or a manage... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_authorized('user123', 'user123', 'manager456') == True\", \"assert is_authorized('manager456', 'user123', 'manager456') == True\", \"assert is_authorized('other789', 'user123', 'manager456') == False\", \"assert is_authorized('user123', 'user456', 'manage... | {
"split": "train",
"index": 85041,
"acecode_id": "bigcode_python_fns_46747",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of integers and returns the sum of all even numbers in the list. The function should ignore any negative integers and only consider non-negative even integers. Write a function `sum_of_evens(nums: List[int]) -> int` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_evens([1, 2, 3, 4, 5, -6, 7, 8]) == 14\", \"assert sum_of_evens([-1, -2, -3, -4]) == 0\", \"assert sum_of_evens([0, 1, 2, 3, 4]) == 6\", \"assert sum_of_evens([10, 15, 20, -5]) == 30\", \"assert sum_of_evens([]) == 0\", \"assert sum_of_evens([1, 3, 5,... | {
"split": "train",
"index": 85042,
"acecode_id": "bigcode_python_fns_678",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns the lowest common multiple (LCM) of the integers in the list. The list can contain up to 1000 numbers. You may assume that all integers in the list are positive.\nPlease reason step by step, then write a self-contained... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lowest_common_multiple([2, 3, 4]) == 12\", \"assert lowest_common_multiple([5, 10, 15]) == 30\", \"assert lowest_common_multiple([1, 2, 3, 4, 5]) == 60\", \"assert lowest_common_multiple([7, 14, 21]) == 42\", \"assert lowest_common_multiple([12, 15, 20]) == ... | {
"split": "train",
"index": 85043,
"acecode_id": "evol_35143",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that converts a given dictionary into a JSON string format. Your task is to complete the implementation of the `dict_to_json` function, ensuring that the provided dictionary is transformed into a JSON string. The `dict_to_json` functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert dict_to_json({\\\"name\\\": \\\"John Doe\\\", \\\"age\\\": 30, \\\"city\\\": \\\"New York\\\"}) == '{\\\"name\\\": \\\"John Doe\\\", \\\"age\\\": 30, \\\"city\\\": \\\"New York\\\"}'\", \"assert dict_to_json({\\\"a\\\": 1, \\\"b\\\": 2, \\\"c\\\": 3}) == '{\... | {
"split": "train",
"index": 85044,
"acecode_id": "oss_19982",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing lines from a geometry file that follows a specific format. Each line can contain information about lattice vectors, atom positions, or initial magnetic moments. Your task is to implement a function that processes these lines and retu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_geometry(['lattice_vector 1.0 0.0 0.0', 'lattice_vector 0.0 1.0 0.0', 'lattice_vector 0.0 0.0 1.0']) == {'cell': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], 'atoms': []}\", \"assert parse_geometry(['atom 0.0 0.0 0.0 H', 'atom 1.0 1.0 1.0 O']) ... | {
"split": "train",
"index": 85045,
"acecode_id": "bigcode_python_fns_24964",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary called `prior_flat` where the keys are strings containing parameters and the values are floats. Each parameter may have a mean and standard deviation denoted by suffixes `-mean` and `-sdev`. Your task is to implement a function `validate_priors(prior_... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_priors({'param1-mean': 1.0, 'param1-sdev': 0.5}) == True\", \"assert validate_priors({'param1-mean': 1.0, 'param1-sdev': 2.0, 'param2-mean': 3.0, 'param2-sdev': 1.0}) == True\", \"assert validate_priors({'param1-mean': 1.0, 'param1-sdev': 0.1}) == T... | {
"split": "train",
"index": 85046,
"acecode_id": "bigcode_python_fns_9510",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `load_data` that simulates loading data from a given `entity` and returns a list of results. Due to potential issues, such as simulated network failures or data retrieval problems, the function should be designed to handle failures an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert load_data('test_entity') == ['Sample data 1', 'Sample data 2']\", \"assert load_data('another_entity') == ['Sample data 1', 'Sample data 2']\", \"assert load_data('test_entity') == ['Sample data 1', 'Sample data 2']\", \"assert load_data('some_entity') == ['... | {
"split": "train",
"index": 85047,
"acecode_id": "oss_3752",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a nested list in Python where each nested element can be another nested list or an integer, write a recursive function that will invert the whole structure. Each nested list should be reversed, and if a sublist contains other nested lists, the same rule applies, down to t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert invert([1, [2,3,4, [5,6]], 7]) == [7, [[6,5], 4, 3, 2], 1]\", \"assert invert([[[1, 2]], [3]]) == [[3], [[2, 1]]]\", \"assert invert([1, 2, 3]) == [3, 2, 1]\", \"assert invert([]) == []\", \"assert invert([[1], [2], [3]]) == [[3], [2], [1]]\", \"assert inver... | {
"split": "train",
"index": 85048,
"acecode_id": "evol_11052",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the power consumption data recorded over time. Your task is to implement a function that calculates the average power consumption from the given list. The average is defined as the sum of the power consumption values divided by the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_power([]) == 0.0\", \"assert calculate_average_power([0, 0, 0]) == 0.0\", \"assert calculate_average_power([100, 200, 300]) == 200.0\", \"assert calculate_average_power([1]) == 1.0\", \"assert calculate_average_power([10, 20, 30, 40, 50]) =... | {
"split": "train",
"index": 85049,
"acecode_id": "bigcode_python_fns_4823",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple Python function that generates a greeting message. Your function should take a single argument, a string representing a name, and return a greeting message in the format 'Hello {name}!'. For example, if the input is 'Basel', the output shou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert greet('Basel') == 'Hello Basel!'\", \"assert greet('Alice') == 'Hello Alice!'\", \"assert greet('Bob') == 'Hello Bob!'\", \"assert greet('Charlie') == 'Hello Charlie!'\", \"assert greet('Diana') == 'Hello Diana!'\", \"assert greet('Eve') == 'Hello Eve!'\", \... | {
"split": "train",
"index": 85050,
"acecode_id": "oss_20288",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string that represents a command which can optionally include a command-line tool like 'xvfb-run'. Your task is to write a function `run_command(command: str) -> str` that takes a command string as input and returns the complete command string that would be exec... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_command('python butler.py js_unittest') == 'python butler.py js_unittest'\", \"assert run_command('xvfb-run python butler.py js_unittest') == 'xvfb-run python butler.py js_unittest'\", \"assert run_command('ls -la') == 'ls -la'\", \"assert run_command('x... | {
"split": "train",
"index": 85051,
"acecode_id": "bigcode_python_fns_43776",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing a hierarchical data structure representing a company's organizational chart. Each employee has a unique ID, a name, a position, and may have a supervisor (another employee) who is represented by their unique ID. Implement a function `get_total_repor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_total_reports(1, [(1, 'Alice', 'CEO', None), (2, 'Bob', 'Manager', 1), (3, 'Charlie', 'Employee', 2)]) == 2\", \"assert get_total_reports(2, [(1, 'Alice', 'CEO', None), (2, 'Bob', 'Manager', 1), (3, 'Charlie', 'Employee', 2)]) == 1\", \"assert get_total_... | {
"split": "train",
"index": 85052,
"acecode_id": "oss_888",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of URLs and extracts the domain names from each URL. The domain name is defined as the substring between the protocol (e.g., 'http://', 'https://') and the first subsequent slash ('/'). If the URL does not contai... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_domain_names(['https://www.example.com/page1', 'http://subdomain.example.org/page2']) == ['www.example.com', 'subdomain.example.org']\", \"assert extract_domain_names(['https://www.subdomain.domain.co.uk', 'http://localhost:8080/page6']) == ['www.sub... | {
"split": "train",
"index": 85053,
"acecode_id": "oss_8995",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Develop a function to determine whether two phrases have the exact same words, their order, and each word's frequency, while ignoring the repetition and case of the words. Implement the function 'compare_word_sets_and_order(phrase1: str, phrase2: str) -> bool' that returns True... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_word_sets_and_order('Hello world', 'hello world') == True\", \"assert compare_word_sets_and_order('word word word', 'word') == True\", \"assert compare_word_sets_and_order('The quick brown fox', 'the quick brown fox') == True\", \"assert compare_word... | {
"split": "train",
"index": 85054,
"acecode_id": "evol_12073",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `format_time_zone(offset: int) -> str` that takes an integer representing a time zone offset in minutes and returns a string formatted as '+hhmm' or '-hhmm'. The integer can be positive or negative. The hours should be represented with two digits and the minute... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_time_zone(0) == '+0000'\", \"assert format_time_zone(60) == '+0100'\", \"assert format_time_zone(-60) == '-0100'\", \"assert format_time_zone(120) == '+0200'\", \"assert format_time_zone(-120) == '-0200'\", \"assert format_time_zone(180) == '+0300'\",... | {
"split": "train",
"index": 85055,
"acecode_id": "bigcode_python_fns_5992",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a caching mechanism in Python. Your goal is to create a function `cache_function` that takes in a callable `function`, a dictionary `cache`, and an integer `limit`. The function should return a wrapper function that caches the results of the ori... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cache_function(lambda x: x * 2, {}, 2)(1) == 2\", \"assert cache_function(lambda x: x * 2, {}, 2)(2) == 4\", \"assert cache_function(lambda x: x * 2, {}, 2)(1) == 2\", \"assert cache_function(lambda x: x + 3, {}, 1)(0) == 3\", \"assert cache_function(lambda ... | {
"split": "train",
"index": 85056,
"acecode_id": "oss_25801",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the management of an inventory for a small business. The function should take a list of inventory operations and return the final inventory status as a dictionary. Each operation can be one of the following: 'add', 'remove'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_inventory([('add', '1', 'Apple', 10, 0.5)]) == {'1': {'name': 'Apple', 'quantity': 10, 'price': 0.5}}\", \"assert manage_inventory([('add', '1', 'Apple', 10, 0.5), ('add', '1', 'Apple', 5, 0.5)]) == {'1': {'name': 'Apple', 'quantity': 15, 'price': 0.5... | {
"split": "train",
"index": 85057,
"acecode_id": "oss_24423",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that retrieves the latest log entry from a list of log entries based on a given logger ID. Each log entry is represented as a dictionary with keys 'id', 'logger_id', 'timestamp', and 'message'. Your function should accept a list of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_latest_log([], 1) == None\", \"assert get_latest_log([{'id': 1, 'logger_id': 1, 'timestamp': '2023-01-01T00:00:00', 'message': 'Log Entry 1'}, {'id': 2, 'logger_id': 1, 'timestamp': '2023-01-01T00:00:01', 'message': 'Log Entry 2'}, {'id': 3, 'logger_id':... | {
"split": "train",
"index": 85058,
"acecode_id": "oss_2766",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the ages of packets in a networking device. Your task is to implement a function that enables packet aging by filtering out all packets that are older than a specified threshold age. The function should return a new list containing ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert enable_packet_aging([1, 3, 5, 7], 5) == [1, 3, 5]\", \"assert enable_packet_aging([10, 20, 30, 40], 25) == [10, 20]\", \"assert enable_packet_aging([], 5) == []\", \"assert enable_packet_aging([1, 2, 3, 4, 5], 10) == [1, 2, 3, 4, 5]\", \"assert enable_packet... | {
"split": "train",
"index": 85059,
"acecode_id": "bigcode_python_fns_34094",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers representing the lengths of the sides of a pentagon, write a function that calculates the perimeter of the pentagon. The function should return the sum of the lengths if the array contains exactly 5 elements. If the array does not contain exactly 5 el... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert findPerimeter([1, 2, 3, 4, 5]) == 15\", \"assert findPerimeter([10, 10, 10, 10, 10]) == 50\", \"assert findPerimeter([1, 1, 1, 1, 1]) == 5\", \"assert findPerimeter([0, 0, 0, 0, 0]) == 0\", \"assert findPerimeter([-1, -2, -3, -4, -5]) == -15\", \"assert find... | {
"split": "train",
"index": 85060,
"acecode_id": "evol_9300",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `evaluate_command_condition(command, condition)` that evaluates a command and a condition based on predefined mappings. You have two dictionaries: `COMMANDS`, which maps command strings to their corresponding numerical values, and `CO... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_command_condition('div', 'ze') == 3 % 5\", \"assert evaluate_command_condition('mod', 'ze') == 4 % 5\", \"assert evaluate_command_condition('and', 'ze') == 5 % 5\", \"assert evaluate_command_condition('or', 'ze') == 6 % 5\", \"assert evaluate_comman... | {
"split": "train",
"index": 85061,
"acecode_id": "oss_30304",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple function that takes a list of integers and returns a new list containing only the unique integers from the input list, preserving their original order. For example, if the input list is [1, 2, 3, 2, 1, 4], the output should be [1, 2, 3, 4].... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_integers([1, 2, 3, 2, 1, 4]) == [1, 2, 3, 4]\", \"assert unique_integers([1, 1, 1, 1]) == [1]\", \"assert unique_integers([]) == []\", \"assert unique_integers([5, 6, 7, 8, 5, 6]) == [5, 6, 7, 8]\", \"assert unique_integers([10, 20, 10, 30, 20, 40]) =... | {
"split": "train",
"index": 85062,
"acecode_id": "bigcode_python_fns_35094",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that determines whether a bank account's balance goes below zero after a series of transactions, considering transaction fees for each operation. Each transaction is represented as a tuple containing the operation type ('deposit' or '... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert below_zero([('deposit', 100, 0), ('withdraw', 50, 0)], case_insensitive=False, fee_included=False) == False\", \"assert below_zero([('withdraw', 50, 0)], case_insensitive=False, fee_included=False) == True\", \"assert below_zero([('deposit', 100, 0), ('withd... | {
"split": "train",
"index": 85063,
"acecode_id": "evol_25781",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of integers and returns a new list containing only the even integers from the original list. The function should take a list of integers as input and output a list of even integers in the same order they appeared... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_even_integers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_integers([10, 15, 20, 25, 30]) == [10, 20, 30]\", \"assert filter_even_integers([7, 9, 11]) == []\", \"assert filter_even_integers([2, 4, 6, 8]) == [2, 4, 6, 8]\", \"assert filter_even_i... | {
"split": "train",
"index": 85064,
"acecode_id": "bigcode_python_fns_43956",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries representing input specifications for files. Each dictionary contains the following keys: 'filename', 'column', 'datatype', 'example', 'default', 'notes', and 'source'. Your task is to write a function that processes this list and returns a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_filenames_with_columns([{'filename': 'file1.csv', 'column': 'col1', 'datatype': 'int', 'example': '1', 'default': '0', 'notes': '', 'source': ''}, {'filename': 'file1.csv', 'column': 'col2', 'datatype': 'str', 'example': 'example', 'default': '', 'notes'... | {
"split": "train",
"index": 85065,
"acecode_id": "bigcode_python_fns_44504",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a result form and a race type, and you need to return a list of candidates and their respective results. Implement a function `candidate_results_for_race_type(result_form: str, race_type: str, num_results: Optional[int] = None) -> List[Tuple[str, List[int]]]`. The... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert candidate_results_for_race_type('official', 'sprint', None) == [('Alice', [10, 12, 9]), ('Bob', [11, 10, 14])]\", \"assert candidate_results_for_race_type('unofficial', 'marathon', 2) == [('Charlie', [240, 250]), ('Diana', [230, 220])]\", \"assert candidate_... | {
"split": "train",
"index": 85066,
"acecode_id": "bigcode_python_fns_16278",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given two arrays `nums1` and `nums2`, return the maximum dot product between non-empty subsequences of `nums1` and `nums2` with the same length. The subsequences should also have a length of at least 3. A subsequence of an array is formed by deleting some (can be none) of the c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert maxDotProduct([1,2,3], [4,5,6]) == 32\", \"assert maxDotProduct([-1,-2,-3], [-4,-5,-6]) == 32\", \"assert maxDotProduct([0,0,0], [0,0,0]) == 0\", \"assert maxDotProduct([100,200,300], [400,500,600]) == 320000\", \"assert maxDotProduct([1000,1000,1000], [1000... | {
"split": "train",
"index": 85067,
"acecode_id": "evol_14038",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a non-negative integer, write a function that reverses the binary representation of the integer, excluding the first and last bits. If the binary representation has less than three bits, return the original integer. Implement a function `reverse_binary(number: int) -> int... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_binary(5) == 5\", \"assert reverse_binary(2) == 2\", \"assert reverse_binary(8) == 8\", \"assert reverse_binary(7) == 7\", \"assert reverse_binary(3) == 3\", \"assert reverse_binary(0) == 0\", \"assert reverse_binary(1) == 1\", \"assert reverse_binar... | {
"split": "train",
"index": 85068,
"acecode_id": "evol_21681",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that calculates the total size of network traffic within a specified time range based on a given list of tcpdump records. Each record is represented as a tuple containing a timestamp and the size of the traffic. The function should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_total_traffic_size([('2023-01-01 00:00:00', 100), ('2023-01-01 01:00:00', 200), ('2023-01-01 02:00:00', 300)], '2023-01-01 00:00:00', '2023-01-01 01:30:00') == 300\", \"assert get_total_traffic_size([('2023-01-01 00:00:00', 100), ('2023-01-01 01:00:00', ... | {
"split": "train",
"index": 85069,
"acecode_id": "oss_34836",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function that generates a dictionary mapping numbers in a list to their squares. The function should ignore any non-numeric values in the input list and only include valid number-to-square mappings in the returned dictionary.\nPlease reason step by step, then write ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert squares_dictionary([1, 2, 3]) == {1: 1, 2: 4, 3: 9}\", \"assert squares_dictionary([4, 5.0, 'six']) == {4: 16, 5.0: 25.0}\", \"assert squares_dictionary(['one', None, 0]) == {0: 0}\", \"assert squares_dictionary([]) == {}\", \"assert squares_dictionary([-1, ... | {
"split": "train",
"index": 85070,
"acecode_id": "evol_17491",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that validates a dictionary representing parametric data before it can be written to a database. The function should ensure that the input dictionary meets the following criteria: 1. The dictionary is not empty. 2. It contains the key... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_parametric_data({'id': 123, 'name': 'temperature', 'value': 25.5}) == True\", \"assert validate_parametric_data({'id': 0, 'name': 'temperature', 'value': 25.5}) == False\", \"assert validate_parametric_data({'id': 123, 'name': '', 'value': 25.5}) ==... | {
"split": "train",
"index": 85071,
"acecode_id": "oss_30188",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of unique user IDs and a corresponding list of UUIDs representing user sessions. Your task is to implement a function that takes two lists as input: `user_ids` and `session_uuids`. The function should return a dictionary where each key is a user ID and the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert map_users_to_sessions([1, 2, 3], ['uuid1', 'uuid2', 'uuid3']) == {1: 'uuid1', 2: 'uuid2', 3: 'uuid3'}\", \"assert map_users_to_sessions([1, 2, 3], ['uuid1', 'uuid2']) == {1: 'uuid1', 2: 'uuid2'}\", \"assert map_users_to_sessions([], []) == {}\", \"assert map... | {
"split": "train",
"index": 85072,
"acecode_id": "bigcode_python_fns_29986",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string consisting of multiple lines, your task is to implement a function that counts the number of lines in the string. A line is defined as a sequence of characters terminated by a newline character '\\n'. If the string is empty, the function should return 0. Implemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_lines('') == 0\", \"assert count_lines('line1\\\\nline2\\\\nline3') == 3\", \"assert count_lines('single line') == 1\", \"assert count_lines('line1\\\\nline2') == 2\", \"assert count_lines('a\\\\nb\\\\nc\\\\nd\\\\ne') == 5\", \"assert count_lines('one ... | {
"split": "train",
"index": 85073,
"acecode_id": "bigcode_python_fns_2267",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers, L. Your task is to create a function `steady(L)` that returns the sum of all even integers in the list. If the list is empty, return 0. The function should not modify the input list. Write the function so that it can handle both positive and ne... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert steady([1, 2, 3, 4, 5]) == 6\", \"assert steady([-2, -4, -1, 0, 5]) == -6\", \"assert steady([0, 2, 4, 6, 8]) == 20\", \"assert steady([1, 3, 5, 7, 9]) == 0\", \"assert steady([]) == 0\", \"assert steady([10, 20, 30]) == 60\", \"assert steady([-10, -20, -30]... | {
"split": "train",
"index": 85074,
"acecode_id": "bigcode_python_fns_13258",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a Baselight folder name using a specified date and time. The folder name should follow the format 'Baselight_YYYY-MM-DD_HH-MM-SS', where YYYY is the 4-digit year, MM is the 2-digit month, DD is the 2-digit day, HH is the 24... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_baselight_folder(2023, 9, 15, 14, 30, 45) == 'Baselight_2023-09-15_14-30-45'\", \"assert create_baselight_folder(2023, 12, 31, 23, 59, 59) == 'Baselight_2023-12-31_23-59-59'\", \"assert create_baselight_folder(2023, 1, 1, 0, 0, 0) == 'Baselight_2023-0... | {
"split": "train",
"index": 85075,
"acecode_id": "oss_2456",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers, where each integer represents the score of a player in a game. Write a function `evaluate_scores(scores: List[int]) -> Tuple[float, float, float, float]` that evaluates the performance of the players. The function should return a tuple containi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_scores([10, 20, 30]) == (20.0, 30, 10, 8.16496580927726)\", \"assert evaluate_scores([1, 2, 3, 4, 5]) == (3.0, 5, 1, 1.4142135623730951)\", \"assert evaluate_scores([]) == (0.0, 0.0, 0.0, 0.0)\", \"assert evaluate_scores([5]) == (5.0, 5, 5, 0.0)\", ... | {
"split": "train",
"index": 85076,
"acecode_id": "bigcode_python_fns_8825",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a string as input and returns a new string that contains the original string duplicated, but without any punctuation or grammatical symbols. The punctuation characters to be ignored include: . , ? ! ; : ' \" ( ) [ ] { } - _ / \\ @ # $ % ^ & * + =... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert duplicate_without_punctuation('Hello, World!') == 'Hello WorldHello World'\", \"assert duplicate_without_punctuation('Python is great!') == 'Python is greatPython is great'\", \"assert duplicate_without_punctuation('No punctuation here') == 'No punctuation h... | {
"split": "train",
"index": 85077,
"acecode_id": "evol_22681",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given an array of fractional numbers, implement a function that sorts the elements in ascending order without using any in-built sorting functions. The function should take a list of floats as input and return a new list that contains the sorted elements.\nPlease reason step by... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bubble_sort([3.2, 0.5, 10.9, 4.8]) == [0.5, 3.2, 4.8, 10.9]\", \"assert bubble_sort([1.1, 2.2, 3.3, 4.4]) == [1.1, 2.2, 3.3, 4.4]\", \"assert bubble_sort([4.4, 3.3, 2.2, 1.1]) == [1.1, 2.2, 3.3, 4.4]\", \"assert bubble_sort([0.1, 0.2, 0.3]) == [0.1, 0.2, 0.3... | {
"split": "train",
"index": 85078,
"acecode_id": "evol_22774",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that simulates a simple text-based game on a grid. The grid is represented as a 2D list where each cell can contain one of the following characters: 'P' (the player's position), 'T' (a treasure), 'X' (an obstacle), and 'E' (the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert navigate_grid([['P', 'T', 'X', 'E'], [' ', ' ', ' ', ' '], [' ', 'X', 'T', ' ']]) == (2, True)\", \"assert navigate_grid([['P', 'T', 'X', ' '], ['T', 'X', 'E', ' '], [' ', ' ', ' ', ' ']]) == (2, True)\", \"assert navigate_grid([['P', 'T', 'T'], ['X', 'E', '... | {
"split": "train",
"index": 85079,
"acecode_id": "oss_9433",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a tuple that contains a timestamp in the format (seconds, microseconds) and a timezone offset. Your task is to implement a function that packs this information into a serialized format represented as a tuple containing the total number of seconds since the beginni... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pack_time(((10, 500000), 3)) == (10, 3)\", \"assert pack_time(((0, 0), -5)) == (0, -5)\", \"assert pack_time(((59, 999999), 2)) == (59, 2)\", \"assert pack_time(((0, 1000000), 0)) == (1, 0)\", \"assert pack_time(((3600, 0), 1)) == (3600, 1)\", \"assert pack_... | {
"split": "train",
"index": 85080,
"acecode_id": "bigcode_python_fns_48696",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a python function named 'calculate_cumulative_sum' that accepts two parameters: an array of integers and an optional integer 'n'. The function should calculate the cumulative sum of the integers in the array. If 'n' is provided, the function must validate that all integer... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_cumulative_sum([1, 2, 3], 3) == [1, 3, 6]\", \"assert calculate_cumulative_sum([0, 0, 0], 0) == [0, 0, 0]\", \"assert calculate_cumulative_sum([1, 2, 3, 4], 5) == [1, 3, 6, 10]\", \"assert calculate_cumulative_sum([5, 1, 2], 5) == [5, 6, 8]\", \"as... | {
"split": "train",
"index": 85081,
"acecode_id": "evol_25680",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves a user from a list of users based on a given user ID. The users are represented as a list of dictionaries, where each dictionary contains the user's ID and name. Write a function `get_user_by_id(users: List[Dict[str, Any]],... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_user_by_id([{'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}], 1) == {'id': 1, 'name': 'Alice'}\", \"assert get_user_by_id([{'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}], 2) == {'id': 2, 'name': 'Bob'}\", \"assert get_user_by_id([{'id': 1, 'n... | {
"split": "train",
"index": 85082,
"acecode_id": "bigcode_python_fns_29856",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary representing HTTP headers, and your task is to extract the firmware version from the 'Server' key if it exists. The firmware version is formatted as 'ServerTech-AWS/vX.YZ', where X is one or more digits, Y is one or more digits, and Z is an optional l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_firmware_version({'Server': 'ServerTech-AWS/v1.2'}) == '1.2'\", \"assert extract_firmware_version({'Server': 'ServerTech-AWS/v10.0a'}) == '10.0a'\", \"assert extract_firmware_version({'Server': 'ServerTech-AWS/v2.5b'}) == '2.5b'\", \"assert extract_f... | {
"split": "train",
"index": 85083,
"acecode_id": "bigcode_python_fns_39141",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Create a Python function that calculates the geometric mean of a given list of numbers, but only considers numbers greater than 1 in the calculation. Exclude any numbers less than or equal to 1. If there are no numbers greater than 1, return 0. The geometric mean should be roun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert geometric_mean_greaterones([2, 0.5, 4]) == 2.8284\", \"assert geometric_mean_greaterones([3.2, 1, 0]) == 3.2\", \"assert geometric_mean_greaterones([0.9, 2, 2]) == 2.0\", \"assert geometric_mean_greaterones([1, 1, 1]) == 0\", \"assert geometric_mean_greatero... | {
"split": "train",
"index": 85084,
"acecode_id": "evol_34720",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to count the occurrences of a specific phrase within a given text. The phrase is defined as a sequence of words, and the search should be case-insensitive. Your function should handle edge cases, such as empty input strings for both t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_phrase_occurrences('The delegation fails to find a match, resolution for this entity does not resume with the current list. (A subsequent resolution', 'resolution for this entity') == 1\", \"assert count_phrase_occurrences('Hello world! Hello universe.... | {
"split": "train",
"index": 85085,
"acecode_id": "oss_18880",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing frames captured from a video feed. Your task is to create a function that takes this list as input and returns a new list containing every other frame starting from the first frame. The output list should maintain the original order... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert capture_every_other_frame([1, 2, 3, 4, 5]) == [1, 3, 5]\", \"assert capture_every_other_frame([10, 20, 30, 40, 50, 60]) == [10, 30, 50]\", \"assert capture_every_other_frame([7]) == [7]\", \"assert capture_every_other_frame([]) == []\", \"assert capture_ever... | {
"split": "train",
"index": 85086,
"acecode_id": "oss_5268",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with comparing two revisions of a version control system by processing log data. Implement a function `compareRevisions(rev1: str, rev2: str) -> Result` that takes in two revision numbers as strings. The function should simulate the retrieval of log data for each... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compareRevisions('rev1', 'rev2').testname == 'test1'\", \"assert compareRevisions('rev1', 'rev2').real1 == 'true'\", \"assert compareRevisions('rev1', 'rev2').real2 == 'false'\", \"assert compareRevisions('rev1', 'rev2').branch1 == 'main'\", \"assert compare... | {
"split": "train",
"index": 85087,
"acecode_id": "oss_13680",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `parse_arguments(command_line: str) -> Tuple[Dict[str, Union[str, int]], bool]` that simulates the parsing of command-line arguments passed as a single string. The command-line string may contain options for listening host and port, debug mode, and help. Your f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_arguments('-l 127.0.0.1:8080') == ({'host': '127.0.0.1', 'port': 8080}, False)\", \"assert parse_arguments('-l 192.168.0.1:3000') == ({'host': '192.168.0.1', 'port': 3000}, False)\", \"assert parse_arguments('--listen 10.0.0.1') == ({'host': '10.0.0.1'... | {
"split": "train",
"index": 85088,
"acecode_id": "bigcode_python_fns_2351",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given an array of strings, implement a function that takes the array as input and returns a new array containing the strings sorted in alphabetical order. The input array may contain strings of varying lengths and can include uppercase and lowercase letters. The sorting should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_array(['green', 'red', 'blue', 'orange']) == ['blue', 'green', 'orange', 'red']\", \"assert sort_array(['apple', 'Banana', 'cherry', 'date']) == ['apple', 'Banana', 'cherry', 'date']\", \"assert sort_array(['Zebra', 'antelope', 'Lion']) == ['antelope', ... | {
"split": "train",
"index": 85089,
"acecode_id": "evol_29695",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a string representation of a JSON object, and a parameter which may specify a nested value within that JSON object. Your task is to implement a function that extracts the value of the specified parameter from the JSON object. If the parameter points to a list, you... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_json_value('name', '{\\\"name\\\": \\\"Alice\\\", \\\"age\\\": 30}') == 'Alice'\", \"assert get_json_value('age', '{\\\"name\\\": \\\"Alice\\\", \\\"age\\\": 30}') == 30\", \"assert get_json_value('hobbies.3', '{\\\"hobbies\\\": [\\\"reading\\\", \\\"gam... | {
"split": "train",
"index": 85090,
"acecode_id": "bigcode_python_fns_19509",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a string, implement a function `char_count(s)` that counts the number of vowels, consonants, and special characters in the string. Vowels are defined as 'a', 'e', 'i', 'o', 'u' (case insensitive), and 'y' is considered a vowel only if it appears at the end of the string. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert(char_count('abcde') == {'Vowels': 2, 'Consonants': 3, 'Special characters': 0})\", \"assert(char_count('ACEDY') == {'Vowels': 3, 'Consonants': 2, 'Special characters': 0})\", \"assert(char_count('123456') == {'Vowels': 0, 'Consonants': 0, 'Special characters... | {
"split": "train",
"index": 85091,
"acecode_id": "evol_5920",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a durability tracking system for a video game item. The system should manage the item’s durability and calculate the current durability percentage based on the maximum durability. You need to implement a function `track_durability(max_durability... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert track_durability(100, 0) == 100.0\", \"assert track_durability(100, 50) == 50.0\", \"assert track_durability(100, 100) == 0.0\", \"assert track_durability(200, 100) == 50.0\", \"assert track_durability(200, 200) == 0.0\", \"assert track_durability(150, 75) =... | {
"split": "train",
"index": 85092,
"acecode_id": "oss_18631",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the least common multiple (LCM) of all prime numbers up to a given positive integer boundary. If the boundary is zero or negative, the function should return None.\nPlease reason step by step, then write a self-contained Python solution. Give yo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_lcm_of_primes(0) == None\", \"assert find_lcm_of_primes(-5) == None\", \"assert find_lcm_of_primes(1) == 1\", \"assert find_lcm_of_primes(2) == 2\", \"assert find_lcm_of_primes(3) == 6\", \"assert find_lcm_of_primes(4) == 6\", \"assert find_lcm_of_prime... | {
"split": "train",
"index": 85093,
"acecode_id": "evol_26728",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a base URL and three string parameters: campaign, source, and medium. Your task is to create a function that appends UTM (Urchin Tracking Module) parameters to the given URL. The UTM parameters to be added are: utm_campaign, utm_source, and utm_medium. If the base... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_utm('https://example.com', 'winter_sale') == 'https://example.com?utm_campaign=winter_sale&utm_source=notification&utm_medium=email'\", \"assert add_utm('https://example.com', 'summer_sale', 'social', 'facebook') == 'https://example.com?utm_campaign=summ... | {
"split": "train",
"index": 85094,
"acecode_id": "bigcode_python_fns_3700",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of n distinct integers and an integer k (0 ≤ k ≤ n), implement a function that returns a list of k random elements from the array. The returned list should contain unique elements and the order of elements does not matter. You may use the random module to select ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert choose_k_random_elements([1, 2, 3, 4, 5], 3) != choose_k_random_elements([1, 2, 3, 4, 5], 3)\", \"assert len(choose_k_random_elements([10, 20, 30, 40, 50], 2)) == 2\", \"assert len(choose_k_random_elements([1, 2, 3, 4, 5], 0)) == 0\", \"assert set(choose_k_r... | {
"split": "train",
"index": 85095,
"acecode_id": "evol_30184",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `identify_email_type(email: str) -> str` that accepts an email address as a string and returns 'Personal email' if the email is from a personal domain (gmail, yahoo, or hotmail) and 'Business email' if it is from any other domain. If the email is not valid,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert identify_email_type('user@gmail.com') == 'Personal email'\", \"assert identify_email_type('user@yahoo.com') == 'Personal email'\", \"assert identify_email_type('user@hotmail.com') == 'Personal email'\", \"assert identify_email_type('user@example.com') == 'Bu... | {
"split": "train",
"index": 85096,
"acecode_id": "evol_20434",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the prices of a stock on different days. Implement a function `max_profit(prices: List[int]) -> int` that calculates the maximum profit you can achieve from buying and selling the stock. You may complete at most one transaction (i.e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_profit([7, 1, 5, 3, 6, 4]) == 5\", \"assert max_profit([7, 6, 4, 3, 1]) == 0\", \"assert max_profit([1, 2, 3, 4, 5]) == 4\", \"assert max_profit([5, 4, 3, 2, 1]) == 0\", \"assert max_profit([2, 1, 2, 1, 2]) == 1\", \"assert max_profit([3, 2, 6, 5, 0, 3])... | {
"split": "train",
"index": 85097,
"acecode_id": "bigcode_python_fns_25957",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `create_splash_screen` that simulates the creation of a splash screen for a graphical user interface application. The function should take a string parameter `message` and return a dictionary containing two key-value pairs: 'image_path' w... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_splash_screen('Loading Extensions...') == {'image_path': 'images/KrakenUI_Splash.png', 'loading_message': 'Loading Extensions...'}\", \"assert create_splash_screen('Please wait...') == {'image_path': 'images/KrakenUI_Splash.png', 'loading_message': 'P... | {
"split": "train",
"index": 85098,
"acecode_id": "bigcode_python_fns_32352",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with optimizing a mathematical function using a genetic algorithm. Implement a function `fitness_function(params)` that takes a list of parameters as input and returns a numerical value representing the fitness of the parameters. For this problem, the fitness fun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fitness_function([1, 2, 3]) == 14\", \"assert fitness_function([-1, -2, -3]) == 14\", \"assert fitness_function([0, 0, 0]) == 0\", \"assert fitness_function([3, 4, 0]) == 25\", \"assert fitness_function([-3, 4, 5]) == 50\", \"assert fitness_function([10, 0, ... | {
"split": "train",
"index": 85099,
"acecode_id": "oss_14780",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.