data_source large_stringclasses 1
value | prompt listlengths 1 1 | ability large_stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|
acecode | [
{
"role": "user",
"content": "Given a list of email addresses, implement a function that organizes the emails by their service providers and returns a dictionary where the keys are service provider names and the values are the counts of distinct email addresses associated with each provider. For example, if... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert organize_and_count(['test1@gmail.com', 'test2@gmail.com', 'test3@yahoo.com']) == {'Google': 2, 'Yahoo': 1}\", \"assert organize_and_count(['user1@mail.google.com', 'user2@mail.google.com', 'user3@gmail.com', 'user4@yahoo.com']) == {'Google': 3, 'Yahoo': 1}\"... | {
"split": "train",
"index": 63100,
"acecode_id": "evol_24923",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are working on a file management system for a game engine. Your task is to implement a function `retrieve_file(pak, filename)` that takes the package name `pak` and the file name `filename` as input and returns the contents of the specified file. If the file does not exist ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert retrieve_file('game_data', 'level1.txt') == 'Contents of level1.txt'\", \"assert retrieve_file('game_data', 'level2.txt') == 'Contents of level2.txt'\", \"assert retrieve_file('game_data', 'nonexistent_file.txt') == None\", \"assert retrieve_file('game_data'... | {
"split": "train",
"index": 63101,
"acecode_id": "oss_1865",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Implement a function `calculate_circle_area(radius: Union[int, float, list]) -> Union[int, float, list]` that calculates the area of a circle given its radius. The function should accept a single radius or a list of radii. If the radius is not a non-negative number or if it is ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_circle_area(5) == 78.53981633974483\", \"assert calculate_circle_area(0) == 0.0\", \"assert calculate_circle_area(3.5) == 38.48451000647496\", \"assert calculate_circle_area([1, 2, 3]) == [3.141592653589793, 12.566370614359172, 28.274333882308138]\... | {
"split": "train",
"index": 63102,
"acecode_id": "evol_21283",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a touch sensor that can detect if it is being pressed. Implement a function `is_pressed()` that simulates the state of the touch sensor. The function should return `True` if the sensor is pressed and `False` otherwise. For this problem, assume that the sensor is p... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_pressed(0.0) == False\", \"assert is_pressed(1.0) == True\", \"assert is_pressed(0.5) in [True, False]\", \"assert is_pressed(0.25) in [True, False]\", \"assert is_pressed(0.75) in [True, False]\", \"assert is_pressed(0.1) in [True, False]\", \"assert is_... | {
"split": "train",
"index": 63103,
"acecode_id": "bigcode_python_fns_38679",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, write a function to find the maximum sum of any continuous subarray within the array. The function should return this maximum sum.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert maxSubArraySum([-2, -3, -1, -5]) == -1\", \"assert maxSubArraySum([5, 4, -1, 7, 8]) == 23\", \"assert maxSubArraySum([1]) == 1\", \"assert maxSubArraySum([-1, -2, -3, -4, -5]) == -1\", \"assert maxSubArraySum([2, 1]) == 3\", \"assert maxSubArraySum([0, 0, 0,... | {
"split": "train",
"index": 63104,
"acecode_id": "evol_34154",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a class `User` that has two string attributes, `name` and `last_name`. Implement a method `full_name` that returns the full name of the user by concatenating the `name` and `last_name` attributes with a space in between. The `User` class is defined as follows: `cl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert User('John', 'Doe').full_name() == 'John Doe'\", \"assert User('Alice', 'Smith').full_name() == 'Alice Smith'\", \"assert User('Bob', 'Johnson').full_name() == 'Bob Johnson'\", \"assert User('Charlie', 'Brown').full_name() == 'Charlie Brown'\", \"assert User... | {
"split": "train",
"index": 63105,
"acecode_id": "evol_31371",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple banking system simulation. You need to implement a function `bank_operations` that takes a list of operations as input and returns the final balance of a bank account after performing all the operations. Each operation will be a tuple where... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bank_operations(100, [('deposit', 50), ('withdraw', 30)]) == 120\", \"assert bank_operations(0, [('withdraw', 100)]) == 0\", \"assert bank_operations(2000, [('withdraw', 500), ('withdraw', 200), ('deposit', 300)]) == 1600\", \"assert bank_operations(1000, [(... | {
"split": "train",
"index": 63106,
"acecode_id": "oss_35872",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the reboot process of a computer node after a maintenance step is completed. The function will take in a dictionary representing the node's current state and a string indicating the type of maintenance step ('clean' or ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reboot_node({'uuid': 'node1', 'reboot_requested': True, 'driver_internal_info': {}}, 'clean') == {'uuid': 'node1', 'reboot_requested': True, 'driver_internal_info': {'cleaning_reboot': True}}\", \"assert reboot_node({'uuid': 'node2', 'reboot_requested': Fals... | {
"split": "train",
"index": 63107,
"acecode_id": "bigcode_python_fns_48970",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a list of intervals, where each interval is represented as a list of two integers [start, end]. Your task is to implement a function `modify_intervals` that modifies the last interval in the list such that its length (end - start) is equal to a given integer `m`. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert modify_intervals([[1, 3], [4, 6], [7, 9], [10, 12]], 3) == [[1, 3], [4, 6], [7, 9], [10, 13]]\", \"assert modify_intervals([[1, 2], [3, 5], [6, 9]], 5) == [[1, 2], [3, 5], [6, 11]]\", \"assert modify_intervals([[1, 4]], 2) == [[1, 3]]\", \"assert modify_inte... | {
"split": "train",
"index": 63108,
"acecode_id": "oss_30590",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that counts the number of GitHub repositories belonging to a specific user or organization from a given list of repository names. The function should take in a list of repository names in the format 'user/repo' or 'org/repo' and a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_repositories(['JordanMicahBennett/DeepBrainSeg', 'user/Repo1', 'org/Repo2', 'JordanMicahBennett/Repo3', 'user/Repo4', 'JordanMicahBennett/Repo5'], 'JordanMicahBennett') == 3\", \"assert count_repositories(['user1/repoA', 'user1/repoB', 'user2/repoC', '... | {
"split": "train",
"index": 63109,
"acecode_id": "oss_12243",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, implement a function `efficient_sort(arr: List[int], almost_sorted: bool) -> List[int]` that sorts the array using an efficient sorting strategy. If the size of the array is less than or equal to 10, or if the array is almost sorted (i.e., the `almos... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert efficient_sort([3, 1, 2], False) == [1, 2, 3]\", \"assert efficient_sort([5, 3, 8, 3, 9], True) == [3, 3, 5, 8, 9]\", \"assert efficient_sort([10, 2, 5, 7, 9], False) == [2, 5, 7, 9, 10]\", \"assert efficient_sort([], True) == []\", \"assert efficient_sort([... | {
"split": "train",
"index": 63110,
"acecode_id": "evol_5328",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `input_str` containing a series of words separated by spaces. Your task is to write a Python function `capitalize_vowels(input_str)` that capitalizes all the vowels (both uppercase and lowercase) in the string. The function should return the modified stri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert capitalize_vowels('hello world') == 'hEllO wOrld'\", \"assert capitalize_vowels('example string') == 'ExAmplE strIng'\", \"assert capitalize_vowels('python programming') == 'pythOn prOgrAmmIng'\", \"assert capitalize_vowels('data science') == 'dAtA scIEncE'\... | {
"split": "train",
"index": 63111,
"acecode_id": "oss_9633",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to find the average GPA of all students in a specific course within a university database. Each course has a unique ID, a name, and a dictionary of grades corresponding to each student's ID. The function should take the course's ID an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert average_gpa(101, {1: 3.0, 2: 4.0, 3: 2.5}) == 3.1666666666666665\", \"assert average_gpa(102, {1: 3.5, 2: 3.5}) == 3.5\", \"assert average_gpa(103, {4: 2.0, 5: 3.0}) == 2.5\", \"assert average_gpa(104, {}) == 0\", \"assert average_gpa(105, {6: 4.0}) == 4.0\"... | {
"split": "train",
"index": 63112,
"acecode_id": "evol_29240",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integer positions representing the genetic bases in a read, and you need to process these positions based on the specified start and end coordinates. Your task is to implement a function that simulates this data processing and returns an updated dictiona... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_positions([1, 2, 3], 1, 3) == {'depth': [1, 1, 1]}\", \"assert process_positions([1, 2, 3, 4], 1, 3) == {'depth': [1, 1, 1]}\", \"assert process_positions([1, 1, 2, 3], 1, 3) == {'depth': [2, 1, 1]}\", \"assert process_positions([0, 1, 2, 3, 4, 5], 2... | {
"split": "train",
"index": 63113,
"acecode_id": "oss_23740",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that accepts a list of configuration recorder statuses and determines the count of recorders that are currently recording. Each recorder status is represented as a dictionary with the following keys: 'name', 'lastStartTime', 'lastStopTime... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_recording_recorders([]) == 0\", \"assert count_recording_recorders([{'name': 'recorder1', 'lastStartTime': '2023-01-01', 'lastStopTime': '2023-01-02', 'recording': True, 'lastStatus': 'Success', 'lastErrorCode': '', 'lastErrorMessage': '', 'lastStatusC... | {
"split": "train",
"index": 63114,
"acecode_id": "bigcode_python_fns_44547",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary that may contain two keys: 'google_users' and 'dataset_ids'. Your task is to create a function called `reformat_dict` that takes a dictionary as input and returns a new dictionary with the following transformations: \n\n1. If the input dictionary cont... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reformat_dict({'google_users': ['user1', 'user2'], 'dataset_ids': [1, 2]}) == {'google_users': ['user1_formatted', 'user2_formatted'], 'dataset_ids': ['1', '2']}\", \"assert reformat_dict({'google_users': ['alice', 'bob']}) == {'google_users': ['alice_format... | {
"split": "train",
"index": 63115,
"acecode_id": "bigcode_python_fns_40293",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to calculate the scaled value of an integer input based on its position in a sequence. The scaling factor starts at 1.0 for the first item and increases by 0.5 for each subsequent integer. Write a function `apply_scale(item)` that tak... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert apply_scale(1) == 1.0\", \"assert apply_scale(2) == 1.5\", \"assert apply_scale(3) == 2.0\", \"assert apply_scale(4) == 2.5\", \"assert apply_scale(5) == 3.0\", \"assert apply_scale(6) == 3.5\", \"assert apply_scale(7) == 4.0\", \"assert apply_scale(8) == 4.... | {
"split": "train",
"index": 63116,
"acecode_id": "oss_26940",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `word_count(s)` that accepts a string and returns the count of distinct words in it. The function should ignore case sensitivity and should not consider special characters within words. Words are defined as sequences of alphanumeric characters separated by ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert word_count('Hello World') == 2\", \"assert word_count('This is a sentence.') == 4\", \"assert word_count('\\u00e1nother_ex\\u00e4mple') == 1\", \"assert word_count(' ') == 0\", \"assert word_count('') == 0\", \"assert word_count('hello hello') == 1\", \"as... | {
"split": "train",
"index": 63117,
"acecode_id": "evol_23860",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that receives a list of integers and returns a sorted list of tuples containing each unique integer and its count of occurrences in the input list. The output should be sorted based on the unique integers. Each tuple should have the unique integer as the fi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_count([1, 2, 2, 3, 3, 3]) == [(1, 1), (2, 2), (3, 3)]\", \"assert unique_count([5, 5, 5, 1, 1, 2]) == [(1, 2), (2, 1), (5, 3)]\", \"assert unique_count([]) == []\", \"assert unique_count([10]) == [(10, 1)]\", \"assert unique_count([10, 10, 10, 10]) ==... | {
"split": "train",
"index": 63118,
"acecode_id": "evol_21745",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that checks whether a given dictionary contains a specific key. Write a function `contains_key(data: dict, key: str) -> bool` that checks if the provided dictionary `data` contains the key `key`. If `data` is `None`, the function s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert contains_key({'node': 'node1', 'status': 'Running'}, 'node') == True\", \"assert contains_key({'name': 'pod1', 'status': 'Pending'}, 'node') == False\", \"assert contains_key({'node': 'node2'}, 'node') == True\", \"assert contains_key({}, 'node') == False\",... | {
"split": "train",
"index": 63119,
"acecode_id": "oss_1994",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing addresses. Your task is to write a function to sort the addresses based on their lengths in descending order and return the sorted list. Write a function `sort_addresses_by_length(addresses)` that takes in a list of strings `addresse... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_addresses_by_length(['A', 'B', 'C', 'D']) == ['A', 'B', 'C', 'D']\", \"assert sort_addresses_by_length(['Longer Address', 'Short', 'Medium']) == ['Longer Address', 'Medium', 'Short']\", \"assert sort_addresses_by_length(['123', '45', '6']) == ['123', '4... | {
"split": "train",
"index": 63120,
"acecode_id": "oss_31308",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given an integer array `arr` and an array of integer arrays `pieces`. Your task is to determine if you can construct `arr` by concatenating the subarrays in `pieces` in any order, without changing the order of elements within each subarray. Return `true` if `arr` can be... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert canFormArray([85], [[85]]) == True\", \"assert canFormArray([15,88], [[88],[15]]) == True\", \"assert canFormArray([49,18,16], [[16,18,49]]) == False\", \"assert canFormArray([91,4,64,78], [[78],[4,64],[91]]) == True\", \"assert canFormArray([1,3,5,7], [[2,4... | {
"split": "train",
"index": 63121,
"acecode_id": "evol_30822",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `s` and an integer `k`. Your task is to write a function that calculates and returns the cumulative aesthetic value of all substrings of length `k` within `s`. The aesthetic value of a substring is defined as the difference between the frequency of the mo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert aesthetic('aabcb', 3) == 0\", \"assert aesthetic('abcabc', 3) == 0\", \"assert aesthetic('aaa', 1) == 0\", \"assert aesthetic('xyzxyz', 2) == 0\", \"assert aesthetic('abcd', 4) == 0\", \"assert aesthetic('aaaaaaa', 2) == 0\", \"assert aesthetic('aabbcc', 2) ... | {
"split": "train",
"index": 63122,
"acecode_id": "evol_8339",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if any text in a given set of rows exceeds the specified column width. The function should take in a list of rows, where each row is a list of strings representing the text in each column, and a list of integers representi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_column_widths([['apple', 'banana', 'cherry'], ['apple', 'banana', 'cherry'], ['apple', 'banana', 'strawberry']], [5, 6, 5]) == True\", \"assert check_column_widths([['a', 'b', 'c'], ['d', 'e', 'f']], [1, 1, 1]) == False\", \"assert check_column_widths(... | {
"split": "train",
"index": 63123,
"acecode_id": "oss_6808",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a device sweeping algorithm to ensure fair distribution of workload across a set of devices. The algorithm should randomize the order in which devices are processed to prevent bias in case of a process restart before the sweep is completed. Your... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sweep_devices(mock_logger, ['device1', 'device2', 'device3']) == None\", \"assert sweep_devices(mock_logger, ['deviceA', 'deviceB', 'deviceC']) == None\", \"assert sweep_devices(mock_logger, ['device1', 'device2', 'device3', 'device4']) == None\", \"assert s... | {
"split": "train",
"index": 63124,
"acecode_id": "oss_24492",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `get_positive_numbers(nums)` that returns a new list containing only the positive integers from the input list in the same order they appeared. The input list may contain negative integers, zero, and positive integers. If there are no ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_positive_numbers([-1, 2, 3, -4, 5]) == [2, 3, 5]\", \"assert get_positive_numbers([0, -1, -2, -3]) == []\", \"assert get_positive_numbers([1, 2, 3]) == [1, 2, 3]\", \"assert get_positive_numbers([-10, -20, 0, 10]) == [10]\", \"assert get_positive_numbers... | {
"split": "train",
"index": 63125,
"acecode_id": "bigcode_python_fns_26907",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function that maps a quantum operation specified in a dictionary to its corresponding instruction class. The function should take two inputs: a mapping of operation names to instruction classes and a dictionary representing a quantum operation. The dicti... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert blackbird_operation_to_instruction({'Sgate': SgateInstruction, 'MeasureFock': MeasureFockInstruction, 'Dgate': DgateInstruction}, {'op': 'Sgate'}) == SgateInstruction\", \"assert blackbird_operation_to_instruction({'Sgate': SgateInstruction, 'MeasureFock': M... | {
"split": "train",
"index": 63126,
"acecode_id": "oss_5767",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers 'sequence', write a function 'find_swap_pairs' that finds the first index where the element is greater than its successor. The function should return a dictionary containing this index ('index') and the index of a smaller element before it that can be s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_swap_pairs([1, 2, 3]) == {'index': -1, 'swap_with': -1}\", \"assert find_swap_pairs([2, 3, 4, 5]) == {'index': -1, 'swap_with': -1}\", \"assert find_swap_pairs([1]) == {'index': -1, 'swap_with': -1}\", \"assert find_swap_pairs([4, 3, 5, 6]) == {'index':... | {
"split": "train",
"index": 63127,
"acecode_id": "evol_30819",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates an HTML template string for a webpage. The function should take two parameters: a page title (string) and the current year (integer). The function should return a complete HTML string that includes a title tag with the page... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_html_template('Processing - Getting Started', 2023) == '<html><head><title>Processing - Getting Started</title></head><body><p>Year: 2023</p></body></html>'\", \"assert generate_html_template('Home', 2021) == '<html><head><title>Home</title></head><... | {
"split": "train",
"index": 63128,
"acecode_id": "bigcode_python_fns_38171",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of integers and returns the maximum product that can be obtained by multiplying any three integers from the list. If the list contains fewer than three integers, the function should return 0. Your function should handle ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_product_of_three([1, 2, 3, 4]) == 24\", \"assert max_product_of_three([-10, -10, 1, 3, 2]) == 300\", \"assert max_product_of_three([-10, -3, 5, 6, -2]) == 180\", \"assert max_product_of_three([0, 0, 0]) == 0\", \"assert max_product_of_three([1, 2]) == 0\... | {
"split": "train",
"index": 63129,
"acecode_id": "oss_27834",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that checks if two strings are anagrams of each other. An anagram is a rearrangement of the letters of a word or phrase to form a different word or phrase, using all the original letters exactly once. Your function should take two strings ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert are_anagrams('listen', 'silent') == True\", \"assert are_anagrams('triangle', 'integral') == True\", \"assert are_anagrams('apple', 'pale') == False\", \"assert are_anagrams('Dormitory', 'Dirty room') == True\", \"assert are_anagrams('The eyes', 'They see') ... | {
"split": "train",
"index": 63130,
"acecode_id": "oss_17372",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `invert_dict(dictionary)` that takes a dictionary as input where the keys are unique and the values are also unique. The function should return a new dictionary where the original keys are transformed into corresponding values and the original values become... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert invert_dict({1: 'Apple', 2: 'Orange', 3: 'Banana'}) == {'Apple': 1, 'Orange': 2, 'Banana': 3}\", \"assert invert_dict({'a': 1, 'b': 2, 'c': 3}) == {1: 'a', 2: 'b', 3: 'c'}\", \"assert invert_dict({'x': 10, 'y': 20, 'z': 30}) == {10: 'x', 20: 'y', 30: 'z'}\",... | {
"split": "train",
"index": 63131,
"acecode_id": "evol_31364",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a Python function that calculates the arithmetic mean of a list of positive integers. The function should take a single parameter, which is the list of integers, and return the calculated mean as a float.\nPlease reason step by step, then write a self-contained Python s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_mean([1, 2, 3]) == 2.0\", \"assert calculate_mean([10, 20, 30, 40]) == 25.0\", \"assert calculate_mean([5]) == 5.0\", \"assert calculate_mean([1, 1, 1, 1]) == 1.0\", \"assert calculate_mean([2, 4, 6, 8]) == 5.0\", \"assert calculate_mean([100, 200,... | {
"split": "train",
"index": 63132,
"acecode_id": "evol_19978",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a unique container name for a Docker environment. The function should take a string input representing the prefix for the container name and return a unique container name that consists of the provided prefix followed by a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_container_name('torchlambda-')[:12] == 'torchlambda-'\", \"assert generate_container_name('example-').startswith('example-')\", \"assert '-' in generate_container_name('prefix-')\", \"assert generate_container_name('container-')[12:].count('a') <= 8... | {
"split": "train",
"index": 63133,
"acecode_id": "bigcode_python_fns_793",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given a list of company names, implement a function `filter_companies` that takes in a list of strings `companies` and a string `prefix`. The function should return a list of company names that start with the given prefix. The comparison should be case-insensitive. For example,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_companies(['IBM', 'Apple', 'ibm', 'Microsoft', 'amazon'], 'ib') == ['IBM', 'ibm']\", \"assert filter_companies(['Google', 'Facebook', 'Twitter'], 'g') == ['Google']\", \"assert filter_companies(['Tesla', 'Ford', 'Nissan', 'Toyota'], 'a') == []\", \"as... | {
"split": "train",
"index": 63134,
"acecode_id": "bigcode_python_fns_35751",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of strings, implement a function that returns a new array containing only the unique strings from the input, sorted in alphabetical order.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_strings_in_alphabetical_order(['apple', 'banana', 'apple', 'grape', 'mango', 'banana', 'cherry']) == ['apple', 'banana', 'cherry', 'grape', 'mango']\", \"assert unique_strings_in_alphabetical_order(['orange', 'kiwi', 'banana', 'kiwi', 'orange']) == ['... | {
"split": "train",
"index": 63135,
"acecode_id": "evol_26498",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a TCP packet represented as a bytes object. Implement a function `parse_tcp_packet(tcp_packet: bytes) -> Tuple[int, int, int, int, int, bytes]` that extracts the following information from the TCP packet: the source port, destination port, flags, sequence number, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_tcp_packet(b'\\\\x1f\\\\x90\\\\x00\\\\x50\\\\x00\\\\x00\\\\x00\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x50\\\\x18\\\\x20\\\\x00\\\\x00\\\\x00\\\\x00') == (8080, 80, 24, 1, 0, b'')\", \"assert parse_tcp_packet(b'\\\\x00\\\\x16\\\\x00\\\\x50\\\\x00\\\\x00\... | {
"split": "train",
"index": 63136,
"acecode_id": "bigcode_python_fns_21292",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a list of file paths in the form of strings. Each path may contain wildcard characters represented by the asterisk (*) which can match zero or more characters. Your task is to implement a function `expand_wildcards(file_paths: List[str]) -> List[str]` that takes t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert expand_wildcards(['/home/user/*.txt']) == ['/home/user/file1.txt', '/home/user/file2.txt']\", \"assert expand_wildcards(['/home/user/*.jpg']) == ['/home/user/image1.jpg', '/home/user/image2.jpg']\", \"assert expand_wildcards(['/home/user/nothing/*.xyz']) == ... | {
"split": "train",
"index": 63137,
"acecode_id": "bigcode_python_fns_20166",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Create a Python function that takes two lists as input parameters. The first list contains keys and the second list contains values. The function should check if they have equal length. If they do, combine their respective elements into a single dictionary where the key-value p... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert combine_lists_to_dict(['a', 'b', 'c'], [1, 2, 3]) == {'a': 1, 'b': 2, 'c': 3}\", \"assert combine_lists_to_dict(['key1', 'key2'], []) == {'key1': None, 'key2': None}\", \"assert combine_lists_to_dict(['key1'], ['value1']) == {'key1': 'value1'}\", \"assert co... | {
"split": "train",
"index": 63138,
"acecode_id": "evol_5189",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing multiple VL53L0X time-of-flight (ToF) sensors. Create a function `measure_distances(sensor_addresses: List[int], accuracy_mode: int) -> List[int]` that takes a list of sensor addresses and an accuracy mode as input. The function should return a list... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert measure_distances([0x2B, 0x2D], 1) == [150, 200]\", \"assert measure_distances([0x2B, 0x2F], 2) == [150, 250]\", \"assert measure_distances([0x2D, 0x2F], 1) == [200, 250]\", \"assert measure_distances([0x2B, 0x2D, 0x2F], 1) == [150, 200, 250]\", \"assert mea... | {
"split": "train",
"index": 63139,
"acecode_id": "oss_29328",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `snippet` which represents a code snippet. Your task is to implement a function `whereSnippet(snippet: str) -> List[str]` that returns a list of strings indicating the possible locations where the code snippet could be used. The locations should be determ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert whereSnippet('class MyClass') == ['Class Definitions']\", \"assert whereSnippet('function doSomething()') == ['Function Definitions']\", \"assert whereSnippet('class Dog') == ['Class Definitions']\", \"assert whereSnippet('def helper_function()') == ['Functi... | {
"split": "train",
"index": 63140,
"acecode_id": "bigcode_python_fns_9690",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with importing a specific class from a given module in a Python package. Your goal is to successfully import the 'Type' class from the 'b2.build.type' module. Write a function called 'import_type' that attempts to perform this import and returns a message indicat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert import_type() == 'Import failed'\", \"assert import_type() == 'Import failed'\", \"assert import_type() == 'Import failed'\", \"assert import_type() == 'Import failed'\", \"assert import_type() == 'Import failed'\", \"assert import_type() == 'Import failed'\... | {
"split": "train",
"index": 63141,
"acecode_id": "oss_33126",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that updates the status of a specific bug in a bug tracking system. The function should take two parameters: 'key_name', a string representing the unique identifier of the bug, and 'status', a string representing the new status to be assi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_bug_status('BUG-001', 'open') == {'key_name': 'BUG-001', 'status': 'open', 'state': 'active'}\", \"assert update_bug_status('BUG-002', 'closed') == {'key_name': 'BUG-002', 'status': 'closed', 'state': 'resolved'}\", \"assert update_bug_status('BUG-003... | {
"split": "train",
"index": 63142,
"acecode_id": "bigcode_python_fns_46473",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a board represented as a 2D list of integers, where each integer represents a cell on the board. Your task is to implement a function `find_path_to_goal(board: List[List[int]], goal: int) -> List[Tuple[int, int]]` that finds a path to the goal value on the board. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_path_to_goal([[0, 1, 2], [3, 4, 5], [6, 7, 8]], 10) == []\", \"assert find_path_to_goal([[1, 0], [0, 0]], 1) == [(0, 0)]\", \"assert find_path_to_goal([[1]], 1) == [(0, 0)]\", \"assert find_path_to_goal([[1, 2, 3], [4, 5, 6]], 7) == []\", \"assert find_... | {
"split": "train",
"index": 63143,
"acecode_id": "bigcode_python_fns_7999",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with designing a simple game room management system. Implement a function `manage_game_room` that takes two inputs: a list of players and a string representing the action to be performed. The function should manage the players in a game room based on the followin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_game_room(['Alice', 'Bob'], 'create') == 'Room created with players: Alice, Bob'\", \"assert manage_game_room(['Alice', 'Bob'], 'join') == 'Players joined the room: Alice, Bob'\", \"assert manage_game_room([], 'create') == 'No players available'\", \"... | {
"split": "train",
"index": 63144,
"acecode_id": "bigcode_python_fns_10222",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string, implement a function to find the longest substring that contains only unique characters and return its length. For example, the longest unique substring in 'helloworld123' is 'world', which has a length of 5.\nPlease reason step by step, then write a self-contai... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_substring('abcabcbb') == 3\", \"assert longest_substring('bbbbb') == 1\", \"assert longest_substring('pwwkew') == 3\", \"assert longest_substring('') == 0\", \"assert longest_substring('a') == 1\", \"assert longest_substring('abcde') == 5\", \"assert... | {
"split": "train",
"index": 63145,
"acecode_id": "evol_2094",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the positions of various items on a line. Your task is to implement a function that checks if any of the items overlap with each other. An overlap occurs when two items occupy the same position on the line. Your function should retu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_overlap([1, 2, 3, 4, 5]) == False\", \"assert check_overlap([1, 2, 3, 2, 5]) == True\", \"assert check_overlap([0, 0, 0]) == True\", \"assert check_overlap([-1, -2, -3, -4, -5]) == False\", \"assert check_overlap([-1, 0, 1, 0]) == True\", \"assert chec... | {
"split": "train",
"index": 63146,
"acecode_id": "bigcode_python_fns_29944",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a nested structure of schedules, you are to determine if a specific schedule is called within another schedule. Each schedule can contain either subroutine calls or further nested schedules. A subroutine call is represented by its name. Your task is to implement a functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_schedule_called('A', ScheduleBlock([Call('B'), ScheduleBlock([Call('A')])])) == True\", \"assert is_schedule_called('C', ScheduleBlock([Call('A'), Call('B')])) == False\", \"assert is_schedule_called('Main', ScheduleBlock([Call('Main'), ScheduleBlock([Cal... | {
"split": "train",
"index": 63147,
"acecode_id": "bigcode_python_fns_21516",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `parity_check(code: str, parity_type: str) -> str` that checks the integrity of a binary data code by validating its parity bit based on the specified parity type ('even' or 'odd'). The input `code` will be a string consisting of binary digits followed by a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parity_check('1101001', 'even') == 'The data is correct.'\", \"assert parity_check('1101000', 'even') == 'The data is corrupted.'\", \"assert parity_check('1101001', 'odd') == 'The data is corrupted.'\", \"assert parity_check('1101000', 'odd') == 'The data i... | {
"split": "train",
"index": 63148,
"acecode_id": "evol_26897",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `check_services(services: List[Tuple[str, bool]]) -> str` that checks the health status of a list of services. Each service is represented as a tuple containing the service name and a boolean indicating whether the service is operational ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_services([('ServiceA', True), ('ServiceB', True)]) == 'OK'\", \"assert check_services([('ServiceA', False), ('ServiceB', True)]) == 'FALSE\\\\nService ServiceA is down.'\", \"assert check_services([('ServiceA', True), ('ServiceB', False), ('ServiceC', ... | {
"split": "train",
"index": 63149,
"acecode_id": "bigcode_python_fns_23647",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement the quicksort algorithm to sort a given list of integers. Your implementation should be able to handle duplicate integers efficiently. The function should take a list of integers as input and return a new list that contains the integers sorted in non-decreasing order.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quicksort([9, 9, 5, 8, 1, 3, 3, 6, 7, 1, 7]) == [1, 1, 3, 3, 5, 6, 7, 7, 8, 9, 9]\", \"assert quicksort([]) == []\", \"assert quicksort([1]) == [1]\", \"assert quicksort([3, 2, 1]) == [1, 2, 3]\", \"assert quicksort([2, 2, 2, 2]) == [2, 2, 2, 2]\", \"assert ... | {
"split": "train",
"index": 63150,
"acecode_id": "evol_34062",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of quadrilaterals represented by their vertices in a 2D space, generate a list of bounding boxes from these quadrilaterals. Each bounding box should be defined by its minimum and maximum y-coordinates and its minimum and maximum x-coordinates. You are provided with... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_bounding_boxes([[0,0,8,0,8,8,0,8]], [1], (10, 10), 2, 3) == ([[0, 0, 8, 8]], [1])\", \"assert generate_bounding_boxes([[0,0,2,0,2,1,0,1]], [1], (5, 5), 1, 3) == ([], [])\", \"assert generate_bounding_boxes([[0,0,8,0,8,8,0,8]], [1], (10, 10), 4, 3) =... | {
"split": "train",
"index": 63151,
"acecode_id": "bigcode_python_fns_22019",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Design a function that takes an array of strings and identifies the longest consecutive alphabetic substring that is common among all strings in the array. The function should return this longest substring. If there is no common substring, return an empty string.\nPlease reason... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_common_substring(['abcpqr', 'abcde', 'abcdef']) == 'abc'\", \"assert longest_common_substring(['xyz', 'abc', 'def']) == ''\", \"assert longest_common_substring(['a', 'b', 'c']) == ''\", \"assert longest_common_substring(['abc', 'abc', 'abc']) == 'abc... | {
"split": "train",
"index": 63152,
"acecode_id": "evol_7388",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of events and formats the information for display. The function should take in a list of event dictionaries, where each dictionary contains the keys 'ID', 'name', and 'date'. Your function should return a string desc... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_events([]) == 'No events were found.'\", \"assert format_events([{'ID': 1, 'name': 'Event A', 'date': '2023-01-01'}]) == 'Event ID: 1, Name: Event A, Date: 2023-01-01'\", \"assert format_events([{'ID': 1, 'name': 'Event A', 'date': '2023-01-01'}, {'ID... | {
"split": "train",
"index": 63153,
"acecode_id": "bigcode_python_fns_23036",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function `sqrt(x: float) -> float` that calculates the square root of a non-negative number. The function should return the square root of `x`. If `x` is negative, raise a ValueError with the message 'Cannot square-root a negative number with this function!'.\nPleas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sqrt(0) == 0.0\", \"assert sqrt(1) == 1.0\", \"assert sqrt(4) == 2.0\", \"assert sqrt(9) == 3.0\", \"assert sqrt(16) == 4.0\", \"assert sqrt(25) == 5.0\", \"assert sqrt(36) == 6.0\", \"assert sqrt(49) == 7.0\", \"assert sqrt(64) == 8.0\", \"assert sqrt(81) =... | {
"split": "train",
"index": 63154,
"acecode_id": "bigcode_python_fns_38313",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a number 'num', write a function `is_cubic_root_odd(num)` that returns True if the cubic root of 'num' is an odd integer, and False otherwise. For the purposes of this problem, the cubic root is defined as the number that, when raised to the power of three, equals 'num'.\... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_cubic_root_odd(64) == False\", \"assert is_cubic_root_odd(27) == True\", \"assert is_cubic_root_odd(8) == False\", \"assert is_cubic_root_odd(1) == True\", \"assert is_cubic_root_odd(125) == True\", \"assert is_cubic_root_odd(1000) == False\", \"assert is... | {
"split": "train",
"index": 63155,
"acecode_id": "evol_28013",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `launch` that simulates the submission of a work chain to compute the band structure for a given input structure in a quantum simulation framework. The function will take five parameters: `code` (a string representing the computational co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert launch('code1', 'structure1', 'pseudo_family1', True, {'name': 'theos-ht-1.0'}) == 'Submitted PwBandStructureWorkChain to the daemon'\", \"assert launch('code2', 'structure2', 'pseudo_family2', False, {'name': 'theos-ht-1.0'}) == 'Ran PwBandStructureWorkChai... | {
"split": "train",
"index": 63156,
"acecode_id": "bigcode_python_fns_27018",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `strStr(haystack: str, needle: str) -> int` that returns the index of the first occurrence of `needle` in `haystack`, or `-1` if `needle` is not part of `haystack`. If `needle` is an empty string, return `0`. You are not allowed to use any built-in string s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert strStr('hello', 'll') == 2\", \"assert strStr('aaaaa', 'bba') == -1\", \"assert strStr('', '') == 0\", \"assert strStr('abc', 'a') == 0\", \"assert strStr('abc', 'c') == 2\", \"assert strStr('abc', 'ab') == 0\", \"assert strStr('abc', 'abc') == 0\", \"assert... | {
"split": "train",
"index": 63157,
"acecode_id": "evol_23578",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing image filenames that are named as numbers. Write a function that takes a list of integers and returns a new list containing only the integers that fall within a specified range [start, end] and are spaced by a specified step. The fu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_images([0, 1, 2, 3, 4, 5, 6], 1, 5, 1) == [1, 2, 3, 4, 5]\", \"assert filter_images([10, 20, 30, 40], 15, 35, 5) == [20, 30]\", \"assert filter_images([1, 2, 3, 4, 5], 0, 6, 2) == [2, 4]\", \"assert filter_images([5, 10, 15, 20, 25], 5, 25, 5) == [5, ... | {
"split": "train",
"index": 63158,
"acecode_id": "bigcode_python_fns_1005",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function that performs a linear search on a list of integers. The function should take two parameters: a list of integers and an integer target. If the target is found in the list, return its index. If the target is not found, return -1.\nPlease reason step by step,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert linear_search([1, 2, 3, 4, 5], 3) == 2\", \"assert linear_search([10, 20, 30, 40, 50], 10) == 0\", \"assert linear_search([5, 15, 25, 35, 45], 25) == 2\", \"assert linear_search([100, 200, 300], 400) == -1\", \"assert linear_search([0, 1, 2, 3, 4, 5], 5) == ... | {
"split": "train",
"index": 63159,
"acecode_id": "evol_6159",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of tuples, where each tuple represents an experimental measurement identified by two strings (representing cation and anion) and a float (representing the experimental value). Your task is to process this list to return a summary that includes the average a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_experimental_data([('K', 'Br', 2.0), ('K', 'Br', 2.0)]) == [('K', 'Br', 2.0, 0.0)]\", \"assert merge_experimental_data([('Mg', 'SO4', 3.0), ('Mg', 'SO4', 3.0), ('Mg', 'SO4', 4.0)]) == [('Mg', 'SO4', 3.3333333333333335, 0.4714045207910317)]\", \"assert ... | {
"split": "train",
"index": 63160,
"acecode_id": "bigcode_python_fns_40262",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `vacuum_storage(tasks: List[List[str]]) -> List[str]` that simulates the behavior of a vacuum operation on a tasks table. The input is a list of tasks, where each task is represented as a list containing a task name (a string) and its... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert vacuum_storage([['task1', 'completed'], ['task2', 'pending'], ['task3', 'completed']]) == ['task2']\", \"assert vacuum_storage([['task1', 'pending'], ['task2', 'pending'], ['task3', 'pending']]) == ['task1', 'task2', 'task3']\", \"assert vacuum_storage([['ta... | {
"split": "train",
"index": 63161,
"acecode_id": "bigcode_python_fns_22313",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a list of sales data and calculates the total sales for each month. The sales data is provided as a list of tuples, where each tuple contains the date of the sale (in the format 'YYYY-MM-DD') and the correspondin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_monthly_sales([('2022-01-05', 1500.0), ('2022-01-15', 2000.0), ('2022-02-10', 1000.0), ('2022-03-20', 2500.0), ('2022-03-25', 1800.0), ('2022-04-05', 3000.0), ('2022-04-10', 1200.0)]) == OrderedDict({'2022-01': 3500.0, '2022-02': 1000.0, '2022-03':... | {
"split": "train",
"index": 63162,
"acecode_id": "oss_6073",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks the validity of a measurement result from a device. The measurement result is expected to be a set of exactly three bytes. Your function should take a single parameter, which is a dictionary representing the device's measureme... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_measurement({'device': {'measure': lambda: [1, 2, 3]}}) == True\", \"assert is_valid_measurement({'device': {'measure': lambda: [1, 2]}}) == False\", \"assert is_valid_measurement({'device': {'measure': lambda: [1, 2, 3, 4]}}) == False\", \"assert i... | {
"split": "train",
"index": 63163,
"acecode_id": "bigcode_python_fns_18778",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that determines which run range a given run number belongs to based on predefined ranges. The run ranges are defined as follows: 'A': (315252, 316995), 'B': (316998, 319312), 'C': (319313, 320393), and 'D': (320394, 325273). Write a funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_run_range(315300) == 'A'\", \"assert get_run_range(316000) == 'A'\", \"assert get_run_range(316995) == 'A'\", \"assert get_run_range(316998) == 'B'\", \"assert get_run_range(317000) == 'B'\", \"assert get_run_range(319312) == 'B'\", \"assert get_run_rang... | {
"split": "train",
"index": 63164,
"acecode_id": "oss_21697",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of devices represented by their model names. Each device can have between 1 to 3 unique identifiers based on its model. Your task is to implement a function that takes a list of device model names and returns a list of unique identifiers for each device. Th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_device_identifiers(['090615.switch.switch01']) == ['switch01-1']\", \"assert get_device_identifiers(['090615.switch.switch02']) == ['switch02-1', 'switch02-2']\", \"assert get_device_identifiers(['090615.switch.switch03']) == ['switch03-1', 'switch03-2',... | {
"split": "train",
"index": 63165,
"acecode_id": "bigcode_python_fns_11644",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `generate_primes(n)` that takes an integer `n` as input and returns a list of all prime numbers from 1 to `n` inclusively. A prime number is defined as a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. If `n` is l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_primes(10) == [2, 3, 5, 7]\", \"assert generate_primes(2) == [2]\", \"assert generate_primes(1) == []\", \"assert generate_primes(15) == [2, 3, 5, 7, 11, 13]\", \"assert generate_primes(20) == [2, 3, 5, 7, 11, 13, 17, 19]\", \"assert generate_primes... | {
"split": "train",
"index": 63166,
"acecode_id": "evol_27132",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of various buildings. Your task is to write a function `max_visible_buildings(heights: List[int]) -> int` that calculates the maximum number of buildings that can be seen from the left side of the street. A building can ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_visible_buildings([3, 1, 4, 2, 5]) == 3\", \"assert max_visible_buildings([1, 2, 3, 4, 5]) == 5\", \"assert max_visible_buildings([5, 4, 3, 2, 1]) == 1\", \"assert max_visible_buildings([2, 2, 2, 2]) == 1\", \"assert max_visible_buildings([1]) == 1\", \"... | {
"split": "train",
"index": 63167,
"acecode_id": "bigcode_python_fns_6385",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `msg` containing a message. Your task is to write a function `reverse_words` to reverse the order of words in the message while maintaining the order of characters within each word. A word is defined as a sequence of non-space characters. For example, if ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_words('Hello World') == 'World Hello'\", \"assert reverse_words('The quick brown fox') == 'fox brown quick The'\", \"assert reverse_words('Python is fun') == 'fun is Python'\", \"assert reverse_words('Trailing spaces ') == 'spaces Trailing'\", \"ass... | {
"split": "train",
"index": 63168,
"acecode_id": "oss_16673",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked to create a function called `make_palindrome` that generates the shortest possible palindrome using the characters in a given string. The function should consider only alphanumeric characters and ignore case and non-alphanumeric characters. For example, the outpu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_palindrome('') == ''\", \"assert make_palindrome('12321') == '12321'\", \"assert make_palindrome('') == ''\", \"assert make_palindrome('a') == 'a'\", \"assert make_palindrome('bb') == 'bb'\", \"assert make_palindrome('cc') == 'cc'\", \"assert make_palin... | {
"split": "train",
"index": 63169,
"acecode_id": "evol_27898",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a 2D list of integers representing an image in grayscale format, implement a function that converts it into its equivalent color format. The grayscale image is represented by a list of lists, where each inner list contains integers ranging from 0 to 255. The output should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_to_color([[0]]) == [[[0, 0, 0]]]\", \"assert convert_to_color([[255]]) == [[[255, 255, 255]]]\", \"assert convert_to_color([[128]]) == [[[128, 128, 128]]]\", \"assert convert_to_color([[0, 128, 255]]) == [[[0, 0, 0], [128, 128, 128], [255, 255, 255]]... | {
"split": "train",
"index": 63170,
"acecode_id": "bigcode_python_fns_13446",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing student records for a university. Write a function `allocate_courses(students: List[Tuple[str, int]], courses: List[Tuple[str, str]]) -> Dict[int, List[str]]` that takes in a list of students, each represented as a tuple containing the student's nam... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert allocate_courses([('Alice', 1), ('Bob', 2)], [('Math', 'M101'), ('English', 'E101')]) == {1: ['Math'], 2: ['English']}\", \"assert allocate_courses([('Alice', 1)], [('Math', 'M101')]) == {1: ['Math']}\", \"assert allocate_courses([], [('Math', 'M101')]) == {... | {
"split": "train",
"index": 63171,
"acecode_id": "oss_7900",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple key management system that allows users to securely store and retrieve a sensitive value. Your task is to implement a function called `manage_secret_key` that accepts two parameters: `action` (a string) and `key` (a string). The function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_secret_key('store', 'my_secret_key') == None\", \"assert manage_secret_key('store', 'another_secret') == None\", \"assert manage_secret_key('store', 'final_secret') == None\", \"assert manage_secret_key('invalid_action', 'some_key') == 'Invalid action... | {
"split": "train",
"index": 63172,
"acecode_id": "oss_25928",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given an argument that can either be a value or None, implement a function `default_value(argument: Any, default: Any) -> Any` that returns the `default` value if the `argument` is `None`; otherwise, return `argument`. Your function should handle any type of input for `argument... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert default_value(None, 10) == 10\", \"assert default_value(5, 10) == 5\", \"assert default_value('Hello', 'Default') == 'Hello'\", \"assert default_value(None, 'Default') == 'Default'\", \"assert default_value([], [1, 2, 3]) == []\", \"assert default_value([1, ... | {
"split": "train",
"index": 63173,
"acecode_id": "bigcode_python_fns_40939",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string representing a non-negative integer, implement a function that converts the string to its integer representation. The function should handle cases where the string may contain leading zeros. For example, the string '007' should return the integer 7. Your function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert string_to_integer('007') == 7\", \"assert string_to_integer('0') == 0\", \"assert string_to_integer('123') == 123\", \"assert string_to_integer('0000123') == 123\", \"assert string_to_integer('0000') == 0\", \"assert string_to_integer('456789') == 456789\", ... | {
"split": "train",
"index": 63174,
"acecode_id": "bigcode_python_fns_27747",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves the karma score of a user based on their user ID. The user ID can contain special characters like '<', '>', and '@', which should be stripped before processing. If the user ID is not found in the database or if the user has... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_karma('user1') == 'Hey user1, your current karma is 10'\", \"assert get_karma('user2') == 'Hey user2, your current karma is 20'\", \"assert get_karma('user5') == 'User not found'\", \"assert get_karma('user7') == 'User not found'\", \"assert get_karma('<... | {
"split": "train",
"index": 63175,
"acecode_id": "bigcode_python_fns_45561",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a list of films along with their shooting locations represented as latitude and longitude coordinates, write a function `transform_to_dict(closest_list: list) -> dict` that returns a dictionary mapping each unique coordinate (latitude, longitude) to a set of film titles t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_to_dict([[\\\"film1\\\", (49, 24)]]) == {(49, 24): {\\\"film1\\\"}}\", \"assert transform_to_dict([[\\\"film1\\\", (49, 24)], [\\\"film2\\\", (49, 24)]]) == {(49, 24): {\\\"film1\\\", \\\"film2\\\"}}\", \"assert transform_to_dict([[\\\"film1\\\", (... | {
"split": "train",
"index": 63176,
"acecode_id": "bigcode_python_fns_19679",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string `ciphertext` that contains encrypted alphabetic characters and a positive integer `shift` (in the range of 1 to 25), implement a function `decipher(ciphertext, shift)` that returns the decrypted version of the string. The decryption should reverse the shift appli... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert decipher('Jgnnq Yqtnf', 2) == 'Hello World'\", \"assert decipher('Uifsf jt b tfdsfu!', 1) == 'There is a secret!'\", \"assert decipher('Wklv lv d whvw phvvdjh.', 3) == 'This is a test message.'\", \"assert decipher('Gur Dhvpx', 13) == 'The Quick'\", \"assert... | {
"split": "train",
"index": 63177,
"acecode_id": "evol_25300",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Write a function in Python that returns a datetime object representing the date and time for Sunday, March 7, 2021, at 5:30 PM.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block."
}
] | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_datetime() == datetime(2021, 3, 7, 17, 30)\", \"assert get_datetime().year == 2021\", \"assert get_datetime().month == 3\", \"assert get_datetime().day == 7\", \"assert get_datetime().hour == 17\", \"assert get_datetime().minute == 30\", \"assert get_dat... | {
"split": "train",
"index": 63178,
"acecode_id": "evol_18044",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given three parameters: brightness (a float between 0.0 and 1.0), contrast (a float between 0.0 and 1.0), and drange (a float representing the data range), implement a function `briconToScaleOffset(brightness: float, contrast: float, drange: float) -> Tuple[float, float]` that ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert briconToScaleOffset(0.5, 0.5, 100.0) == (1.0, 0.0)\", \"assert briconToScaleOffset(0.1, 0.4, 200.0) == (0.8, -80.0)\", \"assert briconToScaleOffset(0.5, 0.0, 50.0) == (0.0, 0.0)\", \"assert briconToScaleOffset(0.5, 0.5, 75.0) == (1.0, 0.0)\", \"assert bricon... | {
"split": "train",
"index": 63179,
"acecode_id": "bigcode_python_fns_36554",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of scalar values, implement a function `create_tensor` that converts the input into a tensor format, represented as a nested list. If the input is a single scalar value, it should be wrapped in a list. The output should maintain the structure of the input; if the i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_tensor(5) == [[5]]\", \"assert create_tensor(3.14) == [[3.14]]\", \"assert create_tensor([1, 2, 3]) == [[1], [2], [3]]\", \"assert create_tensor([4.5, 5.5, 6.5]) == [[4.5], [5.5], [6.5]]\", \"assert create_tensor([10]) == [[10]]\", \"assert create_ten... | {
"split": "train",
"index": 63180,
"acecode_id": "bigcode_python_fns_13154",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D binary matrix representing an image, write a function that creates a boolean mask marking the perimeter of the image as True. The width of the perimeter is determined by a corner fraction, which is a float value between 0 and 0.5. The function should return a new 2D ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert perimeter_mask([[0, 0], [0, 0]], 0.5) == [[True, True], [True, True]]\", \"assert perimeter_mask([[0, 0, 0], [0, 0, 0], [0, 0, 0]], 0.33) == [[True, True, True], [True, False, True], [True, True, True]]\", \"assert perimeter_mask([[1]], 0.1) == [[True]]\", \... | {
"split": "train",
"index": 63181,
"acecode_id": "bigcode_python_fns_40673",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `are_anagrams(s1: str, s2: str) -> bool` that takes two strings as input and returns True if the two strings are anagrams of each other, and False otherwise. An anagram is defined as a word or phrase formed by rearranging the letters of a different word or phra... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert are_anagrams('listen', 'silent') == True\", \"assert are_anagrams('triangle', 'integral') == True\", \"assert are_anagrams('apple', 'papel') == True\", \"assert are_anagrams('anagram', 'nagaram') == True\", \"assert are_anagrams('rat', 'car') == False\", \"a... | {
"split": "train",
"index": 63182,
"acecode_id": "evol_13709",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of dictionaries, each representing a ratio with fields 'path', 'ratio', and 'url', create a function that extracts the 'ratio' values into a new list. The input list will contain at least one dictionary and at most 1000 dictionaries. The function should return the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_ratios([{'path': '/home', 'ratio': '1:2', 'url': 'http://example.com/home'}, {'path': '/about', 'ratio': '3:4', 'url': 'http://example.com/about'}]) == ['1:2', '3:4']\", \"assert extract_ratios([{'path': '/contact', 'ratio': '5:6', 'url': 'http://exa... | {
"split": "train",
"index": 63183,
"acecode_id": "bigcode_python_fns_15531",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a file upload system that enforces a specific tag requirement for each file. Your task is to implement a function `upload_file(file: str, tag: str, required_tag: str) -> Union[str, str]` that uploads a file only if the provided tag matches the r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert upload_file('file1.txt', 'tag1', 'tag1') == 'File uploaded successfully'\", \"assert upload_file('file2.txt', 'tag2', 'tag2') == 'File uploaded successfully'\", \"assert upload_file('file3.txt', 'tag1', 'tag2') == 'Tag mismatch: File upload failed'\", \"asse... | {
"split": "train",
"index": 63184,
"acecode_id": "oss_37436",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string containing a sequence of characters. Your task is to write a function that counts the number of distinct characters in the string. A character is considered distinct if it appears at least once in the string. For example, given the string 'hello', the dis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_distinct_characters('hello') == 4\", \"assert count_distinct_characters('') == 0\", \"assert count_distinct_characters('abcdefg') == 7\", \"assert count_distinct_characters('Hello, World!') == 10\", \"assert count_distinct_characters('12345') == 5\", \... | {
"split": "train",
"index": 63185,
"acecode_id": "bigcode_python_fns_46060",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing a network of interconnected items. Each item has a name and can hold various properties stored in a dictionary. Your goal is to implement a function that merges two property dictionaries into one. In the merged dictionary, if a key exists in both di... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_properties({'a': 1, 'b': 2}, {'b': 3, 'c': 4}) == {'a': 1, 'b': 3, 'c': 4}\", \"assert merge_properties({'name': 'item1'}, {}) == {'name': 'item1'}\", \"assert merge_properties({}, {'color': 'red'}) == {'color': 'red'}\", \"assert merge_properties({'ke... | {
"split": "train",
"index": 63186,
"acecode_id": "oss_36866",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the power state of a smart home device. The device can either be 'ON' or 'OFF'. Your function should take a list of commands and return the final power state after executing all the commands. The commands are as follows... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_device(['turn_on', 'get_state']) == 'ON'\", \"assert simulate_device(['turn_off', 'get_state']) == 'OFF'\", \"assert simulate_device(['turn_on', 'turn_off', 'get_state']) == 'OFF'\", \"assert simulate_device(['turn_off', 'turn_on', 'turn_on', 'get_s... | {
"split": "train",
"index": 63187,
"acecode_id": "oss_18403",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates the parameters for adding a new Rucio Storage Element (RSE). The function should take the following parameters: rse (string), issuer (string), vo (string, default 'def'), deterministic (boolean, default True), volatile (boo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_rse_parameters('rse1', 'issuer1') == True\", \"assert validate_rse_parameters('rse2', 'issuer2', city='City A', country_name='Country A') == True\", \"assert validate_rse_parameters('rse3', 'issuer3', latitude=45.0, longitude=-73.0) == True\", \"ass... | {
"split": "train",
"index": 63188,
"acecode_id": "bigcode_python_fns_18035",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes incoming data packets for an Information-Centric Networking (ICN) layer. The function should take a single parameter, `data`, which is a tuple containing a face id (an integer) and a packet object. The packet object can... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_data((1, Interest())) == 'Received Interest Packet, do nothing'\", \"assert process_data((1, Content('example.com'))) == 'Received Data Packet: example.com'\", \"assert process_data((1, 'not a packet')) == 'ICN Layer expects to receive [face id, pack... | {
"split": "train",
"index": 63189,
"acecode_id": "oss_10200",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of pairs of integers. For each pair, write a function `calculate_products` that takes a list of pairs and returns a list of their products. Each product should be calculated by multiplying the two integers in the pair. The function signature is: `def calcul... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_products([(1, 2), (3, 4)]) == [2, 12]\", \"assert calculate_products([(0, 5), (5, 0)]) == [0, 0]\", \"assert calculate_products([(10, 20), (30, 40)]) == [200, 1200]\", \"assert calculate_products([(2, 3), (4, 5), (6, 7)]) == [6, 20, 42]\", \"assert... | {
"split": "train",
"index": 63190,
"acecode_id": "oss_3767",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to calculate the aberration terms for a given wavelength in a simulated detector system. The aberration terms are defined for specific wavelengths, and your function should handle wavelengths that fall outside the specified range by a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_aberration_terms(2e-6) == [0.01, 0.02, 0.01]\", \"assert get_aberration_terms(3e-6) == [0.015, 0.025, 0.012]\", \"assert get_aberration_terms(4e-6) == [0.018, 0.03, 0.014]\", \"assert get_aberration_terms(5e-6) == [0.02, 0.03, 0.015]\", \"assert get_aber... | {
"split": "train",
"index": 63191,
"acecode_id": "oss_23838",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes in a person's name and job title as input, and returns a formatted string that displays the person's information in the format 'Name: [name], Job: [job]'. Implement the function `display_person_info(name: str, job: str) -> str`... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert display_person_info('John Doe', 'Software Engineer') == 'Name: John Doe, Job: Software Engineer'\", \"assert display_person_info('Jane Smith', 'Data Scientist') == 'Name: Jane Smith, Job: Data Scientist'\", \"assert display_person_info('Alice Johnson', 'Prod... | {
"split": "train",
"index": 63192,
"acecode_id": "oss_37505",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string representing a filename, write a function that splits the filename into two parts: the name and the extensions. The name should consist of the string before the first dot (.) in the filename, and the extensions should include everything after the first dot, inclu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert split_filename('image.jpg.png') == ('image', '.jpg.png')\", \"assert split_filename('archive.tar.gz') == ('archive', '.tar.gz')\", \"assert split_filename('document.pdf') == ('document', '.pdf')\", \"assert split_filename('file') == ('file', '')\", \"assert ... | {
"split": "train",
"index": 63193,
"acecode_id": "bigcode_python_fns_9702",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `my_sort` that takes a list of tuples as an argument. Each tuple contains two integers and a single string. The function should sort the list by the first integer in ascending order, then by the second integer in descending order, and finally by the length ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert my_sort([(2, 5, 'aba'), (2, 5, 'ab'), (3, 1, 'abc'), (1, 7, 'abcd'), (4, 3, 'abcde')]) == [(1, 7, 'abcd'), (2, 5, 'aba'), (2, 5, 'ab'), (3, 1, 'abc'), (4, 3, 'abcde')]\", \"assert my_sort([(1, 2, 'a'), (3, 2, 'abc'), (2, 1, 'ab'), (1, 3, 'abcde'), (2, 2, 'a'... | {
"split": "train",
"index": 63194,
"acecode_id": "evol_32390",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simple recurrent unit layer. Given a list of integers representing an input sequence and a boolean value indicating whether the sequence should be processed in reverse, implement a function that computes the output sequence based on the follow... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert recurrent_layer([5, 10, 15], True) == [30, 25, 15]\", \"assert recurrent_layer([0, 0, 0], False) == [0, 0, 0]\", \"assert recurrent_layer([1], False) == [1]\", \"assert recurrent_layer([1], True) == [1]\", \"assert recurrent_layer([-1, -2, -3], False) == [-1... | {
"split": "train",
"index": 63195,
"acecode_id": "bigcode_python_fns_12026",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `replace_alternating(string: str, replace_char: str) -> str` that replaces every alternate character in the given string `string` with the character `replace_char`. The first character at index 0 should be replaced, followed by every second character. The funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert replace_alternating('a', 'b') == 'b'\", \"assert replace_alternating('testcase', '@') == '@e@t@a@e'\", \"assert replace_alternating('openai', '+') == '+p+n+i'\", \"assert replace_alternating('abc', '1') == '1b1'\", \"assert replace_alternating('xyz', '0') ==... | {
"split": "train",
"index": 63196,
"acecode_id": "evol_25085",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Implement a function that generates a random string of a specified length composed exclusively of lowercase alphabetic characters. The function should take an integer parameter `length` which determines the length of the generated string. Ensure that the string is random and un... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_random_string(8) != generate_random_string(8)\", \"assert len(generate_random_string(8)) == 8\", \"assert len(generate_random_string(5)) == 5\", \"assert len(generate_random_string(1)) == 1\", \"assert generate_random_string(1).islower()\", \"assert... | {
"split": "train",
"index": 63197,
"acecode_id": "evol_5909",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an encrypted character array, implement a function that decrypts the array and checks if the decrypted string matches a specified regular expression pattern. The decryption is done by shifting each alphanumeric character back by one position, with '#' being treated as an ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_congruent('ZyXwV', '^[A-Za-z]*$') == True\", \"assert is_congruent('1234#', '^[0-9]*$') == True\", \"assert is_congruent('1#2#3#', '^[0-9]*$') == True\", \"assert is_congruent('A@B#C', '^[A-Za-z]*$') == False\", \"assert is_congruent('12#34', '^[0-9]*$') ... | {
"split": "train",
"index": 63198,
"acecode_id": "evol_29065",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings representing different types of nodes, where each string is either 'worker' or 'ps', implement a function `count_nodes(nodes: List[str]) -> Dict[str, int]` that counts the occurrences of each type of node. The function should return a dictionary with the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_nodes(['worker', 'ps', 'worker', 'ps', 'worker', 'worker']) == {'worker': 4, 'ps': 2}\", \"assert count_nodes(['ps', 'ps', 'ps']) == {'worker': 0, 'ps': 3}\", \"assert count_nodes(['worker']) == {'worker': 1, 'ps': 0}\", \"assert count_nodes(['ps']) ==... | {
"split": "train",
"index": 63199,
"acecode_id": "oss_7536",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.