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": "Write a function that extracts all unique words from a given block of text. The function should ignore case and return the words in lowercase. Words are defined as sequences of alphabetic characters. The input will be a string containing the text, and the output should be a lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_unique_words('Hello world! Hello everyone.') == ['everyone', 'hello', 'world']\", \"assert extract_unique_words('This is a test. This test is only a test.') == ['a', 'is', 'only', 'test', 'this']\", \"assert extract_unique_words('Python is fun. Pytho... | {
"split": "train",
"index": 85800,
"acecode_id": "evol_2342",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Write a function that computes the n-th power of each number in a list and returns a new list. The function should handle erroneous inputs and edge cases effectively. If the input list contains non-numeric values, the function should raise a ValueError. The function should also... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert power_list([1, 2, 3], 2) == [1, 4, 9]\", \"assert power_list([-1, -2, -3], 2) == [1, 4, 9]\", \"assert power_list([1, 2, 3], 0) == [1, 1, 1]\", \"assert power_list([1, 2, 3], -1) == [1, 0.5, 0.3333333333333333]\", \"assert power_list([1, 2, 3], 1.5) == [1.0,... | {
"split": "train",
"index": 85801,
"acecode_id": "evol_29755",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the median of a list of numbers while also handling erroneous values. The function should accept a list of elements and return the median of the numeric values. If any element in the list is not a numeric type (i.e., a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert median_error_detect([3, 1, 4, 5, 2]) == 3\", \"assert median_error_detect([2, 3, 1]) == 2\", \"assert median_error_detect([-1, -2, -3, -4, -5]) == -3\", \"assert median_error_detect([1, 2, 'a', 4]) == 'Error Value Detected'\", \"assert median_error_detect([1... | {
"split": "train",
"index": 85802,
"acecode_id": "evol_17603",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a graph represented as an adjacency list, implement a function `can_move_in_direction(graph: Dict[int, List[int]], node: int, direction: str) -> int`. The graph consists of nodes numbered from 0 to n-1, where each node can have neighbors in the form of an adjacent list. T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert can_move_in_direction({0: [1], 1: [0]}, 0, 'down') == 1\", \"assert can_move_in_direction({0: [], 1: []}, 0, 'left') == 0\", \"assert can_move_in_direction({0: [1], 1: [0, 2], 2: [1]}, 1, 'right') == 1\", \"assert can_move_in_direction({0: [1], 1: [0]}, 1, '... | {
"split": "train",
"index": 85803,
"acecode_id": "bigcode_python_fns_22761",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that manages the access permissions for a given Lambda Layer. Your function should take in a string representing the name or ARN of the Lambda Layer and return a dictionary with two keys: 'layerName' and 'description'. The 'layerName'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_lambda_layer_access('arn:aws:lambda:us-east-1:123456789012:layer:my-layer') == {'layerName': 'arn:aws:lambda:us-east-1:123456789012:layer:my-layer', 'description': 'Access granted to the Lambda Layer.'}\", \"assert manage_lambda_layer_access('my-layer... | {
"split": "train",
"index": 85804,
"acecode_id": "oss_8801",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing a sequence of numbers. Your task is to implement a function `count_even_odd(numbers)` that takes a list of integers as input and returns a dictionary with the count of even and odd numbers. The dictionary should have two keys: 'even... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_even_odd([1, 2, 3, 4, 5]) == {'even': 2, 'odd': 3}\", \"assert count_even_odd([6, 7, 8, 9, 10]) == {'even': 3, 'odd': 2}\", \"assert count_even_odd([0, 1, 2, 3, 4]) == {'even': 3, 'odd': 2}\", \"assert count_even_odd([-2, -1, 0, 1, 2]) == {'even': 3, '... | {
"split": "train",
"index": 85805,
"acecode_id": "oss_4588",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `custom_sort(arr)` that takes a list of decimal numbers (both positive and negative) and arranges them in descending order without using any built-in sort functions. The function should also handle numbers that have the same integer part but different fract... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert custom_sort([3.1, 2.5, 1.9, 5.7, -2.4, 3.1, -0.5, -1.6]) == [5.7, 3.1, 3.1, 2.5, 1.9, -0.5, -1.6, -2.4]\", \"assert custom_sort([-1.1, -1.2, -2.2, -1.0]) == [-1.0, -1.1, -1.2, -2.2]\", \"assert custom_sort([0.1, 0.2, 0.0]) == [0.2, 0.1, 0.0]\", \"assert cust... | {
"split": "train",
"index": 85806,
"acecode_id": "evol_9426",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that monitors the validation accuracy during the training process of a machine learning model. Your function should take a list of validation accuracies and a threshold accuracy as input. It should return the index of the first occurr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_threshold_exceedance([0.90, 0.92, 0.94, 0.96, 0.95], 0.95) == 3\", \"assert find_threshold_exceedance([0.80, 0.85, 0.90, 0.92], 0.95) == -1\", \"assert find_threshold_exceedance([], 0.95) == -1\", \"assert find_threshold_exceedance([0.99, 0.98, 0.97, 0.... | {
"split": "train",
"index": 85807,
"acecode_id": "oss_9986",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates a given gender limitation for a conference session. The gender limitation must be either 'Male' or 'Female'. The function should accept a string as input and return a boolean value indicating whether the input is valid. The... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_gender_limitation('Male') == True\", \"assert is_valid_gender_limitation('female') == True\", \"assert is_valid_gender_limitation('FEMALE') == True\", \"assert is_valid_gender_limitation('mAlE') == True\", \"assert is_valid_gender_limitation('') == ... | {
"split": "train",
"index": 85808,
"acecode_id": "oss_20411",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a program to match users with nearby locations based on their geographical coordinates and search radius. Given a dictionary of users with their email addresses, zip codes, and search radii, along with a list of locations and their geographical coor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert match_users_to_locations({'user2@example.com': {'zip': '67890', 'search_radius': 20}}, [{'name': 'Location2', 'coordinates': (34.0522, -118.2437)}], ['user2@example.com']) == [{'email': 'user2@example.com', 'avail': []}]\", \"assert match_users_to_locations(... | {
"split": "train",
"index": 85809,
"acecode_id": "oss_18827",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the daily stock prices of a company. Your task is to write a function that calculates the maximum profit that can be obtained by buying and selling the stock at most once. If it is not possible to make any profit, the function shoul... | 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]) == 0\", \"assert max_profit([5, 4, 3, 2, 1]) == 0\", \"assert max_profit([]) == 0\", \"assert max_profit... | {
"split": "train",
"index": 85810,
"acecode_id": "oss_183",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given an integer array `thetas` of length `n`, where `n` is an even number. Your task is to create a new array `result` of the same length, where each element at index `i` is the sum of the elements at index `i` and `i + 1` in the `thetas` array, wrapping around to the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_control_state([0, 0, 0, 0]) == [0, 0, 0, 0]\", \"assert create_control_state([1, 1, 1, 1]) == [2, 2, 2, 2]\", \"assert create_control_state([1, 3, 5, 7]) == [4, 8, 12, 8]\", \"assert create_control_state([1, 2]) == [3, 3]\", \"assert create_control_st... | {
"split": "train",
"index": 85811,
"acecode_id": "bigcode_python_fns_4187",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Implement a function `is_palindrome(string: str) -> bool` that determines if the given string is a palindrome. The function should ignore case sensitivity and special characters, only considering alphanumeric characters. A palindrome is a string that reads the same backward as ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('racecar') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('12321') == True\", \"assert is_palindrome('') == True\", \"assert is_palin... | {
"split": "train",
"index": 85812,
"acecode_id": "evol_8912",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Your task is to implement a function that returns a new list containing only the unique integers from the input list, maintaining the original order of their first appearances. Write a function `unique_integers(arr: List[int]) -> List[int]` tha... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_integers([1, 2, 1, 3, 2, 4]) == [1, 2, 3, 4]\", \"assert unique_integers([1, 1, 1, 1]) == [1]\", \"assert unique_integers([]) == []\", \"assert unique_integers([5, 6, 5, 7, 6, 8]) == [5, 6, 7, 8]\", \"assert unique_integers([10, 20, 10, 30, 20, 40]) =... | {
"split": "train",
"index": 85813,
"acecode_id": "bigcode_python_fns_21320",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a complex number as input and returns a string representation of the number in words, along with its phase angle value in both radians and degrees. The output format should be \"<word_representation>, phase angle is <radians> radians or <degrees>... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert complex2words(complex(3, 4)) == 'Three plus Four i; phase angle is 0.93 radians or 53.13 degrees.'\", \"assert complex2words(complex(0, 5)) == 'Five i; phase angle is 1.57 radians or 90.00 degrees.'\", \"assert complex2words(complex(0, 0)) == 'Zero; phase an... | {
"split": "train",
"index": 85814,
"acecode_id": "evol_27253",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function `find_matching_lines` that takes a list of strings and a search expression. The function should return a list of all lines that contain the search expression. If the search expression is not found in any line, return an empty list. The function should ignor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_matching_lines(['Hello World', 'Goodbye World'], 'hello') == ['Hello World']\", \"assert find_matching_lines(['Test line one', 'Another test line'], 'test') == ['Test line one', 'Another test line']\", \"assert find_matching_lines(['Python is fun', 'I l... | {
"split": "train",
"index": 85815,
"acecode_id": "bigcode_python_fns_35137",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a JSON object representing network configuration data. The function should extract specific information from the JSON and perform a transformation on it. The JSON object represents network configuration data and has ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_network_config({\\\"vpn-binding\\\": {\\\"ip-address\\\": \\\"192.168.1.100\\\"}, \\\"network-id\\\": \\\"12345\\\", \\\"admin-state-up\\\": \\\"true\\\", \\\"neutron-binding:host-id\\\": \\\"host123\\\", \\\"neutron-binding:vif-details\\\": [{\\\"de... | {
"split": "train",
"index": 85816,
"acecode_id": "oss_14807",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that takes an integer N as an argument and returns the Nth prime number. A prime number is a number greater than 1 that has no positive divisors other than 1 itself and the number. Implement the function `nth_prime(N)` that returns the Nth prime number.\nPlease... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert nth_prime(1) == 2\", \"assert nth_prime(2) == 3\", \"assert nth_prime(3) == 5\", \"assert nth_prime(4) == 7\", \"assert nth_prime(5) == 11\", \"assert nth_prime(6) == 13\", \"assert nth_prime(7) == 17\", \"assert nth_prime(8) == 19\", \"assert nth_prime(9) =... | {
"split": "train",
"index": 85817,
"acecode_id": "evol_34800",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `parse_rfc3339(date_string: str) -> datetime` that takes a string representing a date in RFC 3339 format (e.g., '2008-09-03T20:56:35.450686Z') and returns a corresponding `datetime` object. The function should correctly handle both UTC and local time offsets as... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_rfc3339('2008-09-03T20:56:35.450686Z') == datetime(2008, 9, 3, 20, 56, 35, 450686, tzinfo=timezone.utc)\", \"assert parse_rfc3339('2008-09-03T20:56:35Z') == datetime(2008, 9, 3, 20, 56, 35, tzinfo=timezone.utc)\", \"assert parse_rfc3339('2008-09-03T20:... | {
"split": "train",
"index": 85818,
"acecode_id": "evol_24143",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integer pairs, where each pair represents a connection between two nodes in a network. Each connection has a weight associated with it, represented as an integer. Your task is to implement a function that finds and returns the total weight of the connect... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert total_weight([(1, 2, 4), (2, 3, 5), (1, 3, 2)]) == 11\", \"assert total_weight([(0, 1, 10), (1, 2, 20)]) == 30\", \"assert total_weight([(1, 1, 3), (1, 2, 1)]) == 4\", \"assert total_weight([(3, 4, 5)]) == 5\", \"assert total_weight([]) == 0\", \"assert tota... | {
"split": "train",
"index": 85819,
"acecode_id": "bigcode_python_fns_22251",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing lines from a G2O file. Each line can represent either a vertex or an edge in a pose graph with the following formats: 'VERTEX_SE2 index x y theta', 'EDGE_SE2 before_index after_index x y theta precision_matrix_components...'. Your ta... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_g2o_lines(['VERTEX_SE2 0 1.0 2.0 0.5', 'EDGE_SE2 0 1 0.5 0.5 0.1 0.2']) == {'vertices': [(0, 1.0, 2.0, 0.5)], 'edges': [(0, 1, 0.5, 0.5, 0.1, [0.2])]}\", \"assert parse_g2o_lines(['VERTEX_SE2 0 0.0 0.0 0.0']) == {'vertices': [(0, 0.0, 0.0, 0.0)], 'edge... | {
"split": "train",
"index": 85820,
"acecode_id": "bigcode_python_fns_18160",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the jailing of a user in a messaging platform based on their role hierarchy and duration of the jail sentence. The function should take in three parameters: the user's role level, the jailer's role level, and the durati... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert jail_user(1, 2, '2h') == 'User has been jailed for 2 hours.'\", \"assert jail_user(2, 3, '45s') == 'User has been jailed for 45 seconds.'\", \"assert jail_user(2, 5, '15m') == 'User has been jailed for 15 minutes.'\", \"assert jail_user(5, 6, '2h') == 'User ... | {
"split": "train",
"index": 85821,
"acecode_id": "bigcode_python_fns_27322",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, determine if the list is monotonically increasing or monotonically decreasing. A list is defined to be monotonically increasing if each element is greater than or equal to the previous one, and monotonically decreasing if each element is less than or e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_monotonic([1, 2, 4, 20]) == True\", \"assert is_monotonic([1, 20, 4, 10]) == False\", \"assert is_monotonic([4, 1, 0, -10]) == True\", \"assert is_monotonic([1, 2, 2, 3]) == True\", \"assert is_monotonic([3, 2, 2, 1]) == True\", \"assert is_monotonic([1, ... | {
"split": "train",
"index": 85822,
"acecode_id": "bigcode_python_fns_22020",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `recursive_factorial(n: int) -> int` that calculates the factorial of a given non-negative integer n using recursion. If the input n is negative, the function should return 'Error: Factorial is not defined for negative numbers.' Handle the edge case where n... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert recursive_factorial(5) == 120\", \"assert recursive_factorial(0) == 1\", \"assert recursive_factorial(1) == 1\", \"assert recursive_factorial(2) == 2\", \"assert recursive_factorial(3) == 6\", \"assert recursive_factorial(4) == 24\", \"assert recursive_facto... | {
"split": "train",
"index": 85823,
"acecode_id": "evol_28795",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that simulates loading configuration settings from two predefined JSON-like dictionaries. The function should take no parameters and return a single dictionary that combines the settings from both dictionaries. The first dictionary represe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert load_config() == {'lambda': {'timeout': 30, 'memory_size': 128}, 'global': {'region': 'us-east-1', 'log_level': 'INFO'}}\", \"assert load_config()['lambda']['timeout'] == 30\", \"assert load_config()['lambda']['memory_size'] == 128\", \"assert load_config()[... | {
"split": "train",
"index": 85824,
"acecode_id": "bigcode_python_fns_27841",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the number of epochs in a training process. Implement a function `get_learning_rates(lr_policy: str, n_epochs: int, n_epochs_decay: int, epoch_count: int) -> List[float]` that returns the learning rates for each epoch based on the l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_learning_rates('step', 5, 5, 0) == [1.0, 1.0, 1.0, 1.0, 1.0]\", \"assert get_learning_rates('plateau', 5, 5, 0) == [1.0, 1.0, 1.0, 1.0, 1.0]\", \"assert get_learning_rates('linear', 0, 0, 0) == []\", \"assert get_learning_rates('step', 0, 0, 0) == []\", ... | {
"split": "train",
"index": 85825,
"acecode_id": "bigcode_python_fns_30531",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers and a target integer, implement a function that efficiently searches for the target in the array and returns its index. If the target is not found, return -1. You can optimize the search process by using a suitable data structure. The input array may ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert optimized_search([1, 2, 3, 4, 5], 3) == 2\", \"assert optimized_search([10, 20, 30, 40, 50], 10) == 0\", \"assert optimized_search([1, 2, 3, 4, 5], 6) == -1\", \"assert optimized_search([], 1) == -1\", \"assert optimized_search([100, 200, 300, 400, 500], 500... | {
"split": "train",
"index": 85826,
"acecode_id": "evol_34064",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given an array of strings, implement a function that returns a new array consisting of only the unique strings from the input, sorted in ascending alphabetical order.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert distinct_sorted_strings(['apple', 'orange', 'banana', 'apple', 'kiwi', 'banana', 'orange']) == ['apple', 'banana', 'kiwi', 'orange']\", \"assert distinct_sorted_strings(['zebra', 'apple', 'orange', 'banana', 'kiwi']) == ['apple', 'banana', 'kiwi', 'orange', ... | {
"split": "train",
"index": 85827,
"acecode_id": "evol_17109",
"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 even integers from the original list. Implement the function `filter_even_numbers(nums)` that takes a list of integers `nums` as input and returns a list of a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25, 30]) == [10, 20, 30]\", \"assert filter_even_numbers([0, -2, 4, -6, 8]) == [0, -2, 4, -6, 8]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filte... | {
"split": "train",
"index": 85828,
"acecode_id": "oss_1882",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a simple control system that manages the state of a simulation. Your goal is to implement a function `start_simulation(is_started: bool, user_choice: bool) -> str` that determines whether to start a new simulation based on the current state of the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert start_simulation(False, True) == 'Simulation started.'\", \"assert start_simulation(False, False) == 'Simulation not started.'\", \"assert start_simulation(True, True) == 'Simulation already running.'\", \"assert start_simulation(True, False) == 'Simulation ... | {
"split": "train",
"index": 85829,
"acecode_id": "oss_31354",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a function that estimates the maximum coverage value for genomic data based on two inputs: the mean genome coverage and a scaling factor. Implement a function `suggest_max_coverage(cov: float, y: float) -> float` that takes in two parameters: `cov`, a float repres... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert suggest_max_coverage(7.56, 2) == 15.12\", \"assert suggest_max_coverage(0.0, 5) == 0.0\", \"assert suggest_max_coverage(5.5, 1.5) == 8.25\", \"assert suggest_max_coverage(10.2, 0) == 0.0\", \"assert suggest_max_coverage(4.75, 3) == 14.25\", \"assert suggest_... | {
"split": "train",
"index": 85830,
"acecode_id": "bigcode_python_fns_45208",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, implement a function that sorts the array in ascending order, calculates the average of the array, and returns a dictionary containing the average and the sorted array with only the numbers less than or equal to the average. The function signature sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_array([7, 19, 5, 4, 16]) == {'Average': 10.2, 'Sorted_Array': [4, 5, 7]}\", \"assert process_array([1, 2, 3, 4, 5]) == {'Average': 3.0, 'Sorted_Array': [1, 2, 3]}\", \"assert process_array([10, 20, 30, 40, 50]) == {'Average': 30.0, 'Sorted_Array': [1... | {
"split": "train",
"index": 85831,
"acecode_id": "evol_29897",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of tuples where each tuple contains an IP address (string) and a TCP port number (integer). Write a function `check_ports(tcp_connections: List[Tuple[str, int]]) -> List[bool]` that returns a list of boolean values indicating whether each corresponding TCP ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_ports([('127.0.0.1', 80)]) == [True]\", \"assert check_ports([('127.0.0.1', 443)]) == [True]\", \"assert check_ports([('127.0.0.1', 21)]) == [False]\", \"assert check_ports([('127.0.0.1', 22)]) == [False]\", \"assert check_ports([('192.168.1.1', 8080)]... | {
"split": "train",
"index": 85832,
"acecode_id": "bigcode_python_fns_12725",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a message represented by a dictionary with two keys: 'bot_event' and 'body'. Your task is to implement a function `is_runnable(message: Dict[str, str]) -> bool` that checks whether the message is considered runnable based on the following conditions: 1. The 'bot_e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_runnable({'bot_event': 'EVENT_X', 'body': 'Hello, World!'}) == True\", \"assert is_runnable({'bot_event': 'EVENT_Y', 'body': 'Hello, World!'}) == False\", \"assert is_runnable({'bot_event': 'EVENT_X', 'body': ''}) == False\", \"assert is_runnable({'bot_ev... | {
"split": "train",
"index": 85833,
"acecode_id": "oss_19406",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a function that determines if one string is a rotation of another string. A string 's2' is considered a rotation of string 's1' if it can be obtained by shifting the characters of 's1' in a circular manner. Implement a function `is_rotation(s1: str, s2: str) -> bool` th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_rotation('abcde', 'deabc') == True\", \"assert is_rotation('hello', 'llohe') == True\", \"assert is_rotation('waterbottle', 'erbottlewat') == True\", \"assert is_rotation('rotation', 'tionrota') == True\", \"assert is_rotation('abc', 'acb') == False\", \"... | {
"split": "train",
"index": 85834,
"acecode_id": "evol_30419",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an elevation limit in radians, an observatory latitude in radians, and a source declination in radians, calculate the hour angle from transit for rising and setting. If the source never sets, return pi. If the source is always below the horizon, return 0. Implement a func... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert abs(ha_rise_set(1.0, 0.5, -0.5) - 0.0) < 1e-9\", \"assert abs(ha_rise_set(1.5, 0.5, 0.8) - 0.0) < 1e-9\", \"assert abs(ha_rise_set(1.5, 0.5, -0.8) - 0.0) < 1e-9\", \"assert abs(ha_rise_set(0.9, 0.5, -0.4) - 0.0) < 1e-9\", \"assert abs(ha_rise_set(0.5, 0.5, -... | {
"split": "train",
"index": 85835,
"acecode_id": "bigcode_python_fns_30622",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing a list of transactions. Each transaction is represented by a dictionary containing the following keys: 'amount' (float), 'description' (string), and 'timestamp' (string in ISO format). Your goal is to implement a function named `create_transaction` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_transaction([{'amount': 50.75, 'description': 'Withdrawal', 'timestamp': '2023-10-02T15:30:00'}]) == ['Transaction created: Withdrawal of amount 50.75']\", \"assert create_transaction([{'amount': 0.99, 'description': 'Snack Purchase', 'timestamp': '20... | {
"split": "train",
"index": 85836,
"acecode_id": "oss_36385",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes security content based on a specified type. Write a function `process_security_content` that takes in three parameters: `type` (an enum representing the type of security content), `data` (a list of dictionaries c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_security_content(SecurityContentType.detections, [{'id': 1, 'name': 'malware'}], '/dummy/path') == {'detections': [{'id': 1, 'name': 'malware', 'status': 'processed'}]}\", \"assert process_security_content(SecurityContentType.stories, [{'title': 'Sec... | {
"split": "train",
"index": 85837,
"acecode_id": "oss_15884",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a Python function that calculates the sum of all numerical elements (integers and floats) in a one-dimensional array. If the array contains non-numerical elements, they should be ignored in the sum calculation. The function should return the total sum of the numerical e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert aggregate_array([1, 2, 3.5, 'hello', 4]) == 10.5\", \"assert aggregate_array([-1, -2, 3, 'x', 5.5]) == 5.5\", \"assert aggregate_array([10, 'a', 20, 'b', 30]) == 60\", \"assert aggregate_array(['apple', 'banana', 'cherry']) == 0\", \"assert aggregate_array([... | {
"split": "train",
"index": 85838,
"acecode_id": "evol_27695",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that removes all prime numbers from a given multidimensional array. The multidimensional array can have any structure and the prime numbers can be located at any level of depth. Your function should return a new array that contains only the non-prime number... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_primes([[2, 3, [5, 7]], [9, 12], [13, 15]]) == [[9, 12], [15]]\", \"assert remove_primes([]) == []\", \"assert remove_primes([[7], [8], [9]]) == [[8], [9]]\", \"assert remove_primes([[2, 3, 5], [21, 22, [23, 24]]]) == [[21, 22, [24]]]\", \"assert remo... | {
"split": "train",
"index": 85839,
"acecode_id": "evol_16375",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given an integer n, return the count of all numbers with non-repeating digits, x, where 0 <= x < 10^n. A number has non-repeating digits if no digit appears more than once. Write a function `countNumbersWithUniqueDigits(n: int) -> int` to solve this problem.\nPlease reason step... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert countNumbersWithUniqueDigits(0) == 1\", \"assert countNumbersWithUniqueDigits(1) == 10\", \"assert countNumbersWithUniqueDigits(2) == 91\", \"assert countNumbersWithUniqueDigits(3) == 739\", \"assert countNumbersWithUniqueDigits(4) == 5275\", \"assert countN... | {
"split": "train",
"index": 85840,
"acecode_id": "evol_34751",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a Python dictionary representing a nested structure. Your task is to write a function that flattens this nested dictionary into a single-level dictionary, where the keys are concatenated using underscores to represent the nesting. Write a function `flatten_dict(ne... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert flatten_dict({'a': 1}) == {'a': 1}\", \"assert flatten_dict({'a': {'b': 2}}) == {'a_b': 2}\", \"assert flatten_dict({'x': {'y': {'z': 3}}}) == {'x_y_z': 3}\", \"assert flatten_dict({'p': 4, 'q': {'r': 5}}) == {'p': 4, 'q_r': 5}\", \"assert flatten_dict({'a':... | {
"split": "train",
"index": 85841,
"acecode_id": "oss_339",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers, and your task is to determine if there exists a pair of integers in the list that sums up to a specific target value. Write a function `has_pair_with_sum(nums: List[int], target: int) -> bool` that takes in a list of integers `nums` and an inte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert has_pair_with_sum([1, 2, 3, 4, 5], 9) == True\", \"assert has_pair_with_sum([1, 2, 3, 4, 5], 10) == False\", \"assert has_pair_with_sum([0, -1, 2, -3, 1], -2) == True\", \"assert has_pair_with_sum([1, 2, 3], 6) == False\", \"assert has_pair_with_sum([-1, 1, ... | {
"split": "train",
"index": 85842,
"acecode_id": "bigcode_python_fns_42921",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `analyze_data_types(p, q, r)` that takes three parameters of any data type and returns a dictionary where the keys are the variable names ('p', 'q', 'r', 'n', 'm', 'o') and the values are their respective data types. The function should handle a variety of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert analyze_data_types(10, 5, 2) == {'p': int, 'q': int, 'r': int, 'n': int, 'm': int, 'o': int}\", \"assert analyze_data_types(10.5, 5.2, 2.1) == {'p': float, 'q': float, 'r': float, 'n': float, 'm': float, 'o': float}\", \"assert analyze_data_types('10', '5', ... | {
"split": "train",
"index": 85843,
"acecode_id": "evol_23813",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D grid representing a board where each cell can either be alive (1) or dead (0). Your task is to implement a function `toggle_cells(board: List[List[int]], initial_cells: int) -> List[List[int]]` that will toggle the state of the cells on the board until you re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert toggle_cells([[0, 0], [0, 0]], 1) == [[1, 0], [0, 0]]\", \"assert toggle_cells([[1, 0], [0, 0]], 1) == [[0, 0], [0, 0]]\", \"assert toggle_cells([[0, 1], [1, 1]], 1) == [[1, 1], [1, 1]]\", \"assert toggle_cells([[1, 1], [1, 1]], 2) == [[0, 0], [1, 1]]\", \"a... | {
"split": "train",
"index": 85844,
"acecode_id": "bigcode_python_fns_437",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages a list of video game characters. The function should allow you to insert new character information and return all existing character information. Implement a function called `manage_game_characters` that takes a list of tuple... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_game_characters([('Overwatch', 'Tracer', 8888), ('Overwatch', 'Winston', 9999)]) == [{'games': 'Overwatch', 'hero': 'Tracer', 'userNum': 8888}, {'games': 'Overwatch', 'hero': 'Winston', 'userNum': 9999}]\", \"assert manage_game_characters([('Fortnite'... | {
"split": "train",
"index": 85845,
"acecode_id": "oss_13280",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of integers, `list_width` and `list_height`, which represent the widths and heights of a collection of images, respectively. Your task is to implement a function `calculate_average_dimensions()` that calculates the average width and height of the images.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_dimensions([100, 200, 150], [80, 150, 120]) == (150.0, 116.67)\", \"assert calculate_average_dimensions([120, 240, 360], [40, 80, 120]) == (240.0, 80.0)\", \"assert calculate_average_dimensions([50, 75], [100, 150]) == (62.5, 125.0)\", \"as... | {
"split": "train",
"index": 85846,
"acecode_id": "oss_13328",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.