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": "Implement a function `get_closest_vowel(word: str) -> str` that takes a string `word` as input and returns the closest vowel that is surrounded by consonants, starting the search from the end of the string. The function should consider case sensitivity and ignore any vowels tha... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_closest_vowel('yogurt') == 'u'\", \"assert get_closest_vowel('FULL') == 'U'\", \"assert get_closest_vowel('quick') == ''\", \"assert get_closest_vowel('ab') == ''\", \"assert get_closest_vowel('AEIOU') == ''\", \"assert get_closest_vowel('banana') == 'a'... | {
"split": "train",
"index": 83100,
"acecode_id": "evol_25386",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Implement a function `randomize(arr: List[int]) -> List[int]` that takes a list of integers as input and randomizes the order of the integers using an optimized Fisher-Yates algorithm. The function should return a new list containing the integers in a randomized order.\nPlease ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert randomize([1, 2, 3]) != [1, 2, 3]\", \"assert sorted(randomize([1, 2, 3, 4, 5])) == [1, 2, 3, 4, 5]\", \"assert len(randomize([5, 10, 15])) == 3\", \"assert randomize([1]) == [1]\", \"assert randomize([1, 2]) != [1, 2]\", \"assert randomize([1, 2, 3, 4]) != ... | {
"split": "train",
"index": 83101,
"acecode_id": "evol_32438",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a user profile object with attributes 'city' and 'country', implement a function `get_location` that returns a string containing the city and country of the user, separated by a comma. If either the city or country is missing, only return the available location informatio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_location({'city': 'New York', 'country': 'USA'}) == 'New York, USA'\", \"assert get_location({'city': 'Tokyo', 'country': 'Japan'}) == 'Tokyo, Japan'\", \"assert get_location({'city': 'Paris', 'country': 'France'}) == 'Paris, France'\", \"assert get_loca... | {
"split": "train",
"index": 83102,
"acecode_id": "bigcode_python_fns_32633",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given two strings `a` and `b` of the same length, you need to determine if it is possible to create a palindrome by splitting both strings at the same index. Specifically, you can split string `a` into `aprefix` and `asuffix`, and string `b` into `bprefix` and `bsuffix`. You mu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert checkPalindromeFormation('x', 'y') == True\", \"assert checkPalindromeFormation('abdef', 'fecab') == True\", \"assert checkPalindromeFormation('ulacfd', 'jizalu') == True\", \"assert checkPalindromeFormation('xbdef', 'xecab') == False\", \"assert checkPalind... | {
"split": "train",
"index": 83103,
"acecode_id": "evol_22676",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, implement a function `prod_signs(arr)` that computes the total absolute value of the unique non-zero integers, each multiplied by the cumulative product of the signs (1 for positive, -1 for negative) of each distinct number. If the array is empty or ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prod_signs([0, 1]) == None\", \"assert prod_signs([]) == None\", \"assert prod_signs([-1, -1, 2, 2]) == -2\", \"assert prod_signs([7, 7, -3, -3, 5]) == -105\", \"assert prod_signs([0, 0, 0]) == None\", \"assert prod_signs([4]) == 4\", \"assert prod_signs([-1... | {
"split": "train",
"index": 83104,
"acecode_id": "evol_23275",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are working on a network automation project and need to implement a method that handles configuration commands for devices. Your task is to create a function `config_mode(config_command: str) -> str` that can process the following commands: \n- 'add <config_item>': This com... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert config_mode('add item1') == 'Added item1 to the configuration.'\", \"assert config_mode('add item2') == 'Added item2 to the configuration.'\", \"assert config_mode('remove item3') == 'item3 is not in the configuration.'\", \"assert config_mode('add item4') =... | {
"split": "train",
"index": 83105,
"acecode_id": "oss_17874",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that manipulates a given string based on specific rules. The function should take a string as input and perform the following operations: 1. Convert the string to lowercase. 2. Replace all occurrences of the letter 'e' with '3'. 3.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manipulate_string('Hello') == 'h3llo123'\", \"assert manipulate_string('Python') == 'python123'\", \"assert manipulate_string('Test') == 't3$t123'\", \"assert manipulate_string('Example') == '3xampl3123'\", \"assert manipulate_string('No Changes') == 'no cha... | {
"split": "train",
"index": 83106,
"acecode_id": "oss_1030",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of elements where every two consecutive elements represent a key-value pair. The first element in the pair is a string that represents a key, and the second element is any value associated with that key. Your task is to write a function `transform_data_to_d... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_data_to_dictionary(['key1', 'value1', 'key2', 'value2']) == {'key1': 'value1', 'key2': 'value2'}\", \"assert transform_data_to_dictionary(['key1', 'value1', 'key1', 'value2']) == {'key1': 'value2'}\", \"assert transform_data_to_dictionary([' key1 ... | {
"split": "train",
"index": 83107,
"acecode_id": "bigcode_python_fns_14545",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `bubble_sort(array)` that takes a list of integers as input and sorts the list in ascending order using the Bubble Sort algorithm. The function should modify the input list in place and not return any value.\nPlease reason step by step, then write a self-co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bubble_sort([1]) == None and [1] == [1]\", \"assert bubble_sort([]) == None and [] == []\", \"assert bubble_sort([2, 2, 2, 2]) == None and [2, 2, 2, 2] == [2, 2, 2, 2]\", \"assert bubble_sort([1, 2, 3]) == None and [1, 2, 3] == [1, 2, 3]\", \"assert bubble_s... | {
"split": "train",
"index": 83108,
"acecode_id": "evol_23546",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `close_file_handler(file_name: str) -> str` that simulates closing a file operation. The function should take a string `file_name` as input, which represents the name of the file to be 'closed'. The function should return 'File closed... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert close_file_handler('test.txt') == 'File closed: test.txt'\", \"assert close_file_handler('data.csv') == 'File closed: data.csv'\", \"assert close_file_handler('report.pdf') == 'File closed: report.pdf'\", \"assert close_file_handler('image.png') == 'File clo... | {
"split": "train",
"index": 83109,
"acecode_id": "oss_35069",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of dictionaries, each representing an item with various attributes, write a function `get_latest_release_date(items: List[Dict[str, Any]]) -> str` that returns the latest 'updated' date from the list of items. Each dictionary will have an 'updated' key with a date ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_latest_release_date([{'updated': '2023-10-01'}, {'updated': '2023-10-02'}, {'updated': '2023-09-30'}]) == '2023-10-02'\", \"assert get_latest_release_date([{'updated': '2021-05-01'}, {'updated': '2021-06-15'}, {'updated': '2021-06-14'}]) == '2021-06-15'\... | {
"split": "train",
"index": 83110,
"acecode_id": "bigcode_python_fns_38259",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists A and B, where A and B can have varying lengths and may contain duplicate elements, write a function `find_pairs(A, B)` that returns the total number of unique pairs of indices (i, j) such that A[i] is equal to B[j]. The function should handle lists containing u... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_pairs([1, 2, 3], [3, 2, 1]) == 3\", \"assert find_pairs([1, 1, 1], [1]) == 3\", \"assert find_pairs([1, 2, 3], []) == 0\", \"assert find_pairs([], [1, 2, 3]) == 0\", \"assert find_pairs([1, 2, 3], [4, 5, 6]) == 0\", \"assert find_pairs([1, 2, 3], [1, 1,... | {
"split": "train",
"index": 83111,
"acecode_id": "evol_33821",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given a 2D array representing the Harris response of an image, implement a function that performs non-maximum suppression to identify the coordinates of corners in the image. The function should take in two parameters: the Harris response array and an integer representing the '... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert nonmax_suppression([[0, 0, 0], [0, 1, 0], [0, 0, 0]], 1) == ([1], [1])\", \"assert nonmax_suppression([[1, 0, 0], [0, 2, 0], [0, 0, 1]], 1) == ([1], [1])\", \"assert nonmax_suppression([[1, 2, 3], [3, 4, 2], [1, 0, 1]], 1) == ([1], [1])\", \"assert nonmax_su... | {
"split": "train",
"index": 83112,
"acecode_id": "bigcode_python_fns_6582",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a schema represented as a dictionary, which defines the expected keys and their corresponding types for a resource. You need to implement a function `lazy_validate(schema: dict, resource: dict) -> bool` that validates whether the given resource (also a dictionary)... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lazy_validate({'name': 'string', 'age': 'integer'}, {'name': 'Alice', 'age': 30}) == True\", \"assert lazy_validate({'name': 'string', 'age': 'integer'}, {'name': 'Alice'}) == False\", \"assert lazy_validate({'name': 'string', 'age': 'integer'}, {'age': 30})... | {
"split": "train",
"index": 83113,
"acecode_id": "bigcode_python_fns_29964",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a dictionary of user settings and returns a new dictionary with the same keys but with all values converted to strings. Your function should ensure that if the value is already a string, it remains unchanged. If the value i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_values_to_strings({'username': 'admin', 'age': 30, 'is_active': True}) == {'username': 'admin', 'age': '30', 'is_active': 'True'}\", \"assert convert_values_to_strings({'height': 1.75, 'weight': 70, 'email': 'user@example.com'}) == {'height': '1.75',... | {
"split": "train",
"index": 83114,
"acecode_id": "oss_28766",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a list of integer values called 'payload', implement a function `evaluate_payload(payload: List[int]) -> List[int]` that processes the payload by doubling each value in the list. The function should return a new list containing the doubled values. For example, if the inpu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_payload([1, 2, 3]) == [2, 4, 6]\", \"assert evaluate_payload([0]) == [0]\", \"assert evaluate_payload([-1, -2, -3]) == [-2, -4, -6]\", \"assert evaluate_payload([]) == []\", \"assert evaluate_payload([5, 10, 15]) == [10, 20, 30]\", \"assert evaluate... | {
"split": "train",
"index": 83115,
"acecode_id": "bigcode_python_fns_32774",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two sequences of floating-point numbers, `precisions` and `recalls`, both of which represent precision and recall values for a classification model. Your task is to implement a function that calculates the area under the precision-recall curve (AUC-PR) using the t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_auc_pr([0.0, 0.5, 1.0], [0.0, 0.5, 1.0]) == 0.5\", \"assert calculate_auc_pr([0.0, 0.0, 0.0], [0.0, 0.5, 1.0]) == 0.0\", \"assert calculate_auc_pr([0.4, 0.6], [0.0, 1.0]) == 0.5\", \"assert calculate_auc_pr([0.5, 0.7], [0.0, 1.0]) == 0.6\", \"asser... | {
"split": "train",
"index": 83116,
"acecode_id": "bigcode_python_fns_24520",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a floating-point number as input and returns the number rounded to exactly four decimal places. The rounding should follow standard floating-point rounding rules. For example, if the input is 3.14159265, the output should be 3.1416.\nPlease reaso... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reduce_to_four_decimal_places(3.14159265) == 3.1416\", \"assert reduce_to_four_decimal_places(1.23456789) == 1.2346\", \"assert reduce_to_four_decimal_places(-2.718281828) == -2.7183\", \"assert reduce_to_four_decimal_places(0.000123456) == 0.0001\", \"asser... | {
"split": "train",
"index": 83117,
"acecode_id": "evol_17641",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a string representing a filename (without any path) and simulates the loading of game data from that file. The function will check if the version of the game data matches a predefined VERSION constant. If the version does not m... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert load_game_data('save1') == {'filename': 'save1', 'is_valid': True}\", \"assert load_game_data('save2') == {'filename': 'save2', 'is_valid': True}\", \"assert load_game_data('save4') == {'filename': 'save4', 'is_valid': True}\", \"assert load_game_data('save6... | {
"split": "train",
"index": 83118,
"acecode_id": "bigcode_python_fns_20985",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Write a function in Python that takes an integer 'n' and a list of mixed elements, which may include integers, floats, and strings. The function should add the integer 'n' to only the integer elements of the list and return the updated list. Non-integer elements should remain u... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_integer(5, [1, 2, 3]) == [6, 7, 8]\", \"assert add_integer(10, [1, 'hello', 3.5]) == [11, 'hello', 3.5]\", \"assert add_integer(0, [1, 2, 3, 'test']) == [1, 2, 3, 'test']\", \"assert add_integer(-3, [5, -2, 'world']) == [2, -5, 'world']\", \"assert add_i... | {
"split": "train",
"index": 83119,
"acecode_id": "evol_31776",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a simple client-server communication system. Implement a function `client_communication(operations: List[Tuple[str, str]]) -> List[str]` where `operations` is a list of tuples. Each tuple represents an operation: the first element is a string that... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert client_communication([('send', 'Hello, server!')]) == []\", \"assert client_communication([('send', 'Hello, server!'), ('receive', '')]) == ['Hello, server!']\", \"assert client_communication([('send', 'First message'), ('send', 'Second message'), ('receive'... | {
"split": "train",
"index": 83120,
"acecode_id": "oss_12249",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that manages a simple configuration for carriers in a transportation management system. The function should allow for the addition and retrieval of carrier-specific settings. Your task is to implement the function `manage_carrier_sett... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_carrier_settings([('set', 'max_weight', '1000')]) == {'max_weight': '1000'}\", \"assert manage_carrier_settings([('set', 'max_volume', '2000'), ('get', 'max_volume')]) == {'max_volume': '2000'}\", \"assert manage_carrier_settings([('set', 'delivery_ti... | {
"split": "train",
"index": 83121,
"acecode_id": "oss_37195",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a unique identifier for a playground based on a user's information. Write a function `generate_playground_id(userid: str, building: str, algo_type: str) -> str` that takes a user ID, a building name, and an algorithm type as inputs, and returns a ne... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert len(generate_playground_id('user5', 'buildingE', 'algo5')) == 36\", \"assert generate_playground_id('user6', 'buildingF', 'algo6') != generate_playground_id('user7', 'buildingF', 'algo6')\", \"assert generate_playground_id('user8', 'buildingG', 'algo7') != g... | {
"split": "train",
"index": 83122,
"acecode_id": "bigcode_python_fns_12363",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that configures parameters for a blob detector based on specified thresholds and area limits. The function should take four integer parameters: minThreshold, maxThreshold, minArea, and maxArea. It will return a dictionary containing t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert configure_blob_detector(0, 255, 1500, 25000) == {'minThreshold': 0, 'maxThreshold': 255, 'minArea': 1500, 'maxArea': 25000}\", \"assert configure_blob_detector(1, 100, 2000, 30000) == {'minThreshold': 1, 'maxThreshold': 100, 'minArea': 2000, 'maxArea': 30000... | {
"split": "train",
"index": 83123,
"acecode_id": "bigcode_python_fns_15683",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a function that simulates the execution of commands in a shell. The function takes a string command as input and requires two boolean flags: `flag_echo` and `flag_dryrun`. If `flag_echo` is set to True, the function should output the string 'executing: ' followed ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert execute_command('ls', False, False) == hypothetical_command_result('ls')\", \"assert execute_command('pwd', False, True) == 0\", \"assert execute_command('mkdir test', True, False) == hypothetical_command_result('mkdir test')\", \"assert execute_command('rm ... | {
"split": "train",
"index": 83124,
"acecode_id": "bigcode_python_fns_17776",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `max_autocorrelation(nums: List[int], lag: int) -> float` that calculates the autocorrelation of the list at a specified lag. The autocorrelation at lag `k` is defined as the correlation between the list and itself, shifted by `k` posi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_autocorrelation([10, 20, 30, 40, 50], 0) == 1.0\", \"assert max_autocorrelation([1, 2, 3], 3) == 0.0\", \"assert max_autocorrelation([], 1) == 0.0\", \"assert max_autocorrelation([1, 2, 3, 4], 4) == 0.0\", \"assert max_autocorrelation([-1, 0, 1], 1) == 0... | {
"split": "train",
"index": 83125,
"acecode_id": "bigcode_python_fns_16011",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given a string representing a credit card number, determine the classification of the credit card. The card number may contain spaces and can be associated with one of the following types: 'AMEX', 'VISA', 'Discover', 'MasterCard', or 'Unknown'. The classification rules are as f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert identify_card('4111 2029 3219 9480') == 'VISA'\", \"assert identify_card('5100 2029 3219 9480') == 'MasterCard'\", \"assert identify_card('3711 2029 3219 948') == 'AMEX'\", \"assert identify_card('6011 2029 3219 9480') == 'Discover'\", \"assert identify_card... | {
"split": "train",
"index": 83126,
"acecode_id": "evol_31200",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a multidimensional list, implement a function that creates a new list that is exactly twice as expansive as the original list. Each element in the original list should appear twice in the new list, and if an element is itself a list, it should also be expanded in the same... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert expand_list([]) == []\", \"assert expand_list([5]) == [5, 5]\", \"assert expand_list([[], 1]) == [[], [], 1, 1]\", \"assert expand_list([1, 2, 3]) == [1, 1, 2, 2, 3, 3]\", \"assert expand_list([True, False]) == [True, True, False, False]\"]}"
} | {
"split": "train",
"index": 83127,
"acecode_id": "evol_11394",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a simple event registration system. The function should take in a dictionary of event details and return a message indicating whether the event was successfully registered or if there were validation errors. The event detai... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert register_event({'event_name': 'Sample Event', 'location': 'Sample Location'}) == 'Event successfully registered'\", \"assert register_event({'event_name': 'Sample Event', 'location': 'Sample Location', 'publish_date': '2023-10-01'}) == 'Event successfully re... | {
"split": "train",
"index": 83128,
"acecode_id": "oss_18186",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a 3D matrix represented as a list of lists of lists. Write a function that takes this 3D matrix as input and returns a flattened version of the matrix as a list. The function should handle matrices of any depth (greater than 3D) by flattening them into a single li... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert flatten_3d_matrix([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) == [1, 2, 3, 4, 5, 6, 7, 8]\", \"assert flatten_3d_matrix([[[1]]]) == [1]\", \"assert flatten_3d_matrix([[[1, 2, 3]], [[4, 5, 6]]]) == [1, 2, 3, 4, 5, 6]\", \"assert flatten_3d_matrix([[[1, 2], [3, 4]],... | {
"split": "train",
"index": 83129,
"acecode_id": "evol_6588",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that converts a given RGB color code to its HTML hexadecimal representation. The function should take three integers as input representing the red, green, and blue components of the color, where each component is in the range of 0 to 255. It should return a str... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rgb_to_hex(255, 0, 128) == '#ff0080'\", \"assert rgb_to_hex(0, 255, 0) == '#00ff00'\", \"assert rgb_to_hex(0, 0, 255) == '#0000ff'\", \"assert rgb_to_hex(255, 255, 255) == '#ffffff'\", \"assert rgb_to_hex(0, 0, 0) == '#000000'\", \"assert rgb_to_hex(255, 255... | {
"split": "train",
"index": 83130,
"acecode_id": "evol_26839",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that performs an interpolative search on a sorted array of integers. The function should take three parameters: an array of integers `arr`, an integer `lo` representing the starting index, an integer `hi` representing the ending index, and an integer `y` re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert interpolative_search([14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], 0, 16, 22) == 8\", \"assert interpolative_search([1, 2, 3, 4, 5, 6, 7, 8, 9], 0, 8, 5) == 4\", \"assert interpolative_search([10, 20, 30, 40, 50], 0, 4, 30) == 2\", \"... | {
"split": "train",
"index": 83131,
"acecode_id": "evol_14798",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a sparse matrix represented in Compressed Sparse Row (CSR) format. The CSR representation consists of three arrays: 'data', 'indices', and 'indptr', along with the shape of the matrix. Implement a function `load_sparse_csr(data: List[float], indices: List[int], in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert load_sparse_csr([1.0], [0], [0, 1], (1, 1)) == [[1.0]]\", \"assert load_sparse_csr([1.0, 2.0], [0, 1], [0, 1, 2], (2, 2)) == [[1.0, 0], [0, 2.0]]\", \"assert load_sparse_csr([1.1, 2.2, 3.3, 4.4], [0, 1, 2, 3], [0, 1, 2, 3, 4], (4, 4)) == [[1.1, 0, 0, 0], [0,... | {
"split": "train",
"index": 83132,
"acecode_id": "bigcode_python_fns_27102",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Your task is to implement a function that separates this list into groups based on a specified minimum difference. Each group consists of consecutive integers where the absolute difference between any two adjacent integers in a group is less th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert split_list([1, 2, 4, 11, 14, 15, 16, 16, 19, 30, 31, 50, 51, 100, 101, 105], 7) == [[1, 2, 4], [11, 14, 15, 16, 16, 19], [30, 31], [50, 51], [100, 101, 105]]\", \"assert split_list([1, 10, 20, 25, 30, 40], 5) == [[1], [10], [20], [25], [30], [40]]\", \"asser... | {
"split": "train",
"index": 83133,
"acecode_id": "evol_2811",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given a string `input_string`, construct a function that finds the minimal length substring that contains all unique characters present in `input_string`. The function should return this substring. If no such substring exists, return an empty string.\nPlease reason step by step... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert min_substring('a') == 'a'\", \"assert min_substring('abc') == 'abc'\", \"assert min_substring('abcdefg') == 'abcdefg'\", \"assert min_substring('xyzxyzxyz') == 'xyz'\", \"assert min_substring('') == ''\", \"assert min_substring('ab') == 'ab'\", \"assert min_... | {
"split": "train",
"index": 83134,
"acecode_id": "evol_20638",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a CPU scheduler yielding control back to the operating system. The function should take no parameters and return an integer that represents the result of the yield operation. Since this is a simulation, simply return a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cpu_yield() >= 1 and cpu_yield() <= 100\", \"assert cpu_yield() >= 1 and cpu_yield() <= 100\", \"assert cpu_yield() >= 1 and cpu_yield() <= 100\", \"assert cpu_yield() >= 1 and cpu_yield() <= 100\", \"assert cpu_yield() >= 1 and cpu_yield() <= 100\", \"asser... | {
"split": "train",
"index": 83135,
"acecode_id": "bigcode_python_fns_4268",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array consisting of integers, floats, and strings, implement a function `process_array(arr)` that inverts the order of the array without using any predefined or built-in methods. After inverting the array, find the sum of integer elements located at even indices in asc... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_array([10, 'abc', 20.4, 'def', 30.8, 50]) == 60\", \"assert process_array(['a', 'b', 'c', 2, 0]) == 2\", \"assert process_array([2, 4, 'x', 8, 'y', 6]) == 20\", \"assert process_array([10.1, 20.2, 30.3, 40.4]) == 0\", \"assert process_array(['alpha',... | {
"split": "train",
"index": 83136,
"acecode_id": "evol_4484",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a stream of integers and a fixed window size. Write a function `moving_average(size: int, values: List[int]) -> List[float]` that calculates the moving average of the last `size` values for the provided stream of integers. The function should return a list of movi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert moving_average(3, [1, 10, 3, 5]) == [1.0, 5.5, 4.67, 6.0]\", \"assert moving_average(2, [1, 2, 3, 4]) == [1.0, 1.5, 2.5, 3.5]\", \"assert moving_average(1, [1, 2, 3, 4]) == [1.0, 2.0, 3.0, 4.0]\", \"assert moving_average(3, []) == []\", \"assert moving_avera... | {
"split": "train",
"index": 83137,
"acecode_id": "oss_10661",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `count_characters(sequence: str) -> int` that takes a string input `sequence` and returns the number of individual characters in the string, including spaces and punctuation. The function should return 0 for an empty string.\nPlease reason step by step, the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_characters('Hello, World!') == 13\", \"assert count_characters('') == 0\", \"assert count_characters('Python') == 6\", \"assert count_characters('12345') == 5\", \"assert count_characters('!@#$%^&*()') == 10\", \"assert count_characters(' ') == 4\",... | {
"split": "train",
"index": 83138,
"acecode_id": "evol_28773",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating wind energy generation for both onshore and offshore turbine placements based on specific parameters. Write a function `generate_wind_simulation(bounds: List[int], resolution: int, hub_height_onshore: int, turbine_onshore: str, hub_height_offshore... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_wind_simulation([0, 10, 0, 10], 100, 80, 'TurbineA', 100, 'TurbineB') == ({'bounds': [0, 10, 0, 10], 'resolution': 100, 'hub_height': 80, 'turbine': 'TurbineA'}, {'bounds': [0, 10, 0, 10], 'resolution': 100, 'hub_height': 100, 'turbine': 'TurbineB'}... | {
"split": "train",
"index": 83139,
"acecode_id": "bigcode_python_fns_3859",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the total value of executed stock orders based on their respective prices. You will receive a list of stock orders and a set of adjusted close prices for certain stocks. Each order specifies an action (e.g., SELL_SHORT, SELL, BUY_TO_COVER), the s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculateTotalOrderValue([('SELL_SHORT', 'xyz', 5, True)], {'xyz': 20.0}) == 100.0\", \"assert calculateTotalOrderValue([('BUY_TO_COVER', 'abc', 3, True)], {'abc': 30.0}) == -90.0\", \"assert calculateTotalOrderValue([('SELL', 'abc', 2, True)], {'abc': 40.0}... | {
"split": "train",
"index": 83140,
"acecode_id": "oss_16644",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of academic events and a list of thesis projects. Each academic event is represented as a dictionary with a 'date' and an 'event' key, while each thesis project is represented as a dictionary with 'title', 'supervisor', and 'status' keys. Write a function `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert display_academic_info([{'date': '2022-09-15', 'event': 'Orientation Day'}], [{'title': 'Automated Testing Framework', 'supervisor': 'Dr. Smith', 'status': 'In Progress'}]) == ([{'date': '2022-09-15', 'event': 'Orientation Day'}], [{'title': 'Automated Testin... | {
"split": "train",
"index": 83141,
"acecode_id": "oss_15320",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to simulate sending messages to an Engine Control Unit (ECU) based on specific commands. The ECU can be in one of three states: 'normal', 'programming', or 'diagnostic'. The function should process a list of messages and return the co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_ecu_messages(['start_diag']) == ['diag_started']\", \"assert simulate_ecu_messages(['end_diag']) == []\", \"assert simulate_ecu_messages(['start_prog']) == ['prog_started']\", \"assert simulate_ecu_messages(['end_prog']) == []\", \"assert simulate_e... | {
"split": "train",
"index": 83142,
"acecode_id": "oss_23095",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings, write a function that returns a new list containing only the strings that have a maximum length of 5 characters. The input list may contain strings of varying lengths, and the output should maintain the order of the original list. Implement the function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_strings_by_length(['a', 'bb', 'ccc', 'dddd', 'eeeee']) == ['a', 'bb', 'ccc', 'dddd', 'eeeee']\", \"assert filter_strings_by_length(['short', 'longerthan5', 'tiny', 'big', 'medium']) == ['short', 'tiny', 'big']\", \"assert filter_strings_by_length(['x'... | {
"split": "train",
"index": 83143,
"acecode_id": "bigcode_python_fns_25276",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the available seats in various rides and a list of integers representing the number of spots requested by users. Your task is to determine if each user can successfully make their reservation based on the available seats in the resp... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_reservations([4, 2, 3], [2, 1, 4]) == [True, True, False]\", \"assert check_reservations([0, 5, 10], [1, 2, 3]) == [False, True, True]\", \"assert check_reservations([6, 3, 8], [5, 3, 2]) == [True, True, True]\", \"assert check_reservations([2, 2, 2], ... | {
"split": "train",
"index": 83144,
"acecode_id": "bigcode_python_fns_44567",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `generate_error_response` that simulates the behavior of an HTTP error response generator. The function takes four parameters: `status_code` (an integer representing the HTTP status code), `message` (an optional string representing a brie... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_error_response(404) == {'status_code': 404, 'message': 'Error 404', 'detail': 'No additional details provided.', 'headers': {}}\", \"assert generate_error_response(500, 'Internal Server Error') == {'status_code': 500, 'message': 'Internal Server Err... | {
"split": "train",
"index": 83145,
"acecode_id": "bigcode_python_fns_10944",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of real numbers representing logits (scores) for a multi-class classification problem. Your task is to implement a function that computes the softmax of these logits and returns a list of probabilities. The softmax function is defined as: softmax(x_i) = exp... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert softmax([1.0, 2.0, 3.0]) == [0.09003057317038046, 0.24472847105479767, 0.6652409557748219]\", \"assert softmax([0.0, 0.0, 0.0]) == [1.0/3, 1.0/3, 1.0/3]\", \"assert softmax([-1.0, 0.0, 1.0]) == [0.09003057317038046, 0.24472847105479767, 0.6652409557748219]\"... | {
"split": "train",
"index": 83146,
"acecode_id": "bigcode_python_fns_17406",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Design a function that takes a list of words and a list of indices. The function should convert the last letter of the words at the given indices to uppercase and return the modified list of words. If any index in the list exceeds the length of the words list, the function shou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_last_letters(['hello', 'world'], [1]) == ['hello', 'worlD']\", \"assert transform_last_letters(['cat', 'dog', 'fish'], [0]) == ['caT', 'dog', 'fish']\", \"assert transform_last_letters(['python', 'java', 'c++'], [2]) == ['python', 'java', 'c++']\",... | {
"split": "train",
"index": 83147,
"acecode_id": "evol_9647",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `generate_unique_id(s: str) -> int` that generates a unique, case-insensitive ID for a given string. The ID should be consistent and remain the same regardless of the case of the input characters. For example, the input 'Hello World' and 'HELLO WORLD' shoul... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_unique_id('Hello World') == generate_unique_id('HELLO WORLD')\", \"assert generate_unique_id('Python') == generate_unique_id('python')\", \"assert generate_unique_id('OpenAI') == generate_unique_id('openai')\", \"assert generate_unique_id('Case Inse... | {
"split": "train",
"index": 83148,
"acecode_id": "evol_6738",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing logits and an integer representing the true label, write a function `add_adversarial_constraint(logits: List[int], true_label: int) -> List[str]` that returns a list of constraints in the form of strings. The constraints should ensure that ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_adversarial_constraint([2, 3], 0) == ['logit[0] <= logit[1]']\", \"assert add_adversarial_constraint([5, 1], 1) == ['logit[1] <= logit[0]']\", \"assert add_adversarial_constraint([1, 2, 3], 0) == ['logit[0] <= logit[2]']\", \"assert add_adversarial_const... | {
"split": "train",
"index": 83149,
"acecode_id": "bigcode_python_fns_46354",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing email addresses. Your task is to implement a function that filters out email addresses that belong to a specific domain. The function should take two parameters: a list of email addresses and a domain string. It should return a new l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_emails(['user1@example.com', 'user2@domain.com', 'user3@example.com'], '@example.com') == ['user1@example.com', 'user3@example.com']\", \"assert filter_emails(['user1@example.com', 'user2@domain.com', 'user3@EXAMPLE.COM'], '@example.com') == ['user1@e... | {
"split": "train",
"index": 83150,
"acecode_id": "bigcode_python_fns_23933",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given the name of a subpackage that contains various models. Your task is to implement a function that simulates the behavior of importing all models from this subpackage. Specifically, the function should take the name of the subpackage and return a list of all the mod... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_imported_models('models') == ['User', 'Post', 'Comment', 'Profile']\", \"assert get_imported_models('models') == ['User', 'Post', 'Comment', 'Profile']\", \"assert get_imported_models('unknown') == []\", \"assert get_imported_models('models') == ['User',... | {
"split": "train",
"index": 83151,
"acecode_id": "oss_21005",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that constructs a multimodal embedding model given a configuration dictionary. The configuration contains the necessary parameters to build the model, including functions to initialize the model, parameterized functions for different moda... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_multimodal_embedding_model({'init': 'init_function', 'broad_video': 'video_function', 'broad_audio': 'audio_function', 'narrow_video': 'narrow_video_function', 'loss': 'loss_function'}) == {'init_fn': 'init_function', 'forward_fns': {'broad_video': 'v... | {
"split": "train",
"index": 83152,
"acecode_id": "bigcode_python_fns_24052",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating target directory paths for a data migration project. Each directory path must follow a specific format based on the provided details about the source tables. Your function should take a list of dictionaries, where each dictionary contains the foll... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_target_directory_paths([{'full_table_name': 'fake_domainfake_database_fake_job_tablename', 'domain': 'fake_domain', 'source_database_name': 'fake_database', 'source_table_name': 'fake_job_tablename'}]) == ['mdm/fake_domain/fake_database/fake_job_tab... | {
"split": "train",
"index": 83153,
"acecode_id": "oss_16747",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes input arguments and keyword arguments, while also handling and logging any unused arguments. The function should take into account the possibility of receiving a namedtuple as the first argument and should appropriately... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_and_invoke(lambda *args: sum(args), [0, 2], [], 'test5', False, 10, 20, 30) == 40\", \"assert process_and_invoke(lambda x, y, z: x + y + z, [0, 2], ['z'], 'test7', True, (1, 2, 3), z=4) == 8\", \"assert process_and_invoke(lambda a, b: a + b, [0], ['b... | {
"split": "train",
"index": 83154,
"acecode_id": "oss_13549",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function that checks if one set is a proper subset of another set without using built-in set functions. A proper subset is defined as a set that contains some, but not all, elements of another set. If both sets are identical, the function should return 'False'. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert proper_subset_check({1, 2}, {1, 2, 3}) == True\", \"assert proper_subset_check({1, 2, 3}, {1, 2, 3}) == False\", \"assert proper_subset_check({1}, {1, 2}) == True\", \"assert proper_subset_check({}, {1, 2, 3}) == True\", \"assert proper_subset_check({1, 2, 3... | {
"split": "train",
"index": 83155,
"acecode_id": "evol_14119",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two sets of eigenvalues for a material's band structure, represented as nested lists within dictionaries. Each eigenvalue is a pair of values, where the first value represents the energy level and the second value represents the momentum. Your task is to compare t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_eigenvalue_difference({\\\"output\\\": {\\\"eigenvalues\\\": {\\\"1\\\": [[[1.0, 0.0], [2.0, 0.0]], [[3.0, 0.0]]]} }}, {\\\"output\\\": {\\\"eigenvalues\\\": {\\\"1\\\": [[[1.0, 0.0], [2.0, 0.0]], [[3.0, 0.0]]]} }}) == 0\", \"assert calculate_eigen... | {
"split": "train",
"index": 83156,
"acecode_id": "oss_15804",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary where the keys are contributors' names and the values are the number of contributions they made to a project. Write a function `top_five_contributors(contributor_dict: Dict[str, int]) -> List[Tuple[str, int]]` that returns a list of the top five contr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert top_five_contributors({'Alice': 10, 'Bob': 20, 'Charlie': 15}) == [('Bob', 20), ('Charlie', 15), ('Alice', 10)]\", \"assert top_five_contributors({'Alice': 5}) == [('Alice', 5)]\", \"assert top_five_contributors({'Alice': 5, 'Bob': 5, 'Charlie': 5}) == [('Al... | {
"split": "train",
"index": 83157,
"acecode_id": "bigcode_python_fns_27343",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `process_data` that takes an integer `x`, a string `message`, a list of integers `numbers`, and an optional string `suffix`. The function should return a string that contains `message` concatenated with the sum of the integers in `numbers` and, if `suffix` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_data(5, 'Total:', [1, 2, 3], 'done') == 'Total:6done'\", \"assert process_data(10, 'Result:', [4, 5, 6]) == 'Result:15'\", \"assert process_data(0, 'Count:', [0, 0, 0], 'end') == 'Count:0end'\", \"assert process_data(1, 'Sum:', [1, 1, 1, 1], 'finishe... | {
"split": "train",
"index": 83158,
"acecode_id": "evol_4602",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary that may contain nested dictionaries. Your task is to implement a function `find_nested_key(input_dict: dict, target_key: str) -> list` that searches for all occurrences of a specified key (`target_key`) within this nested dictionary and returns a lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_nested_key({'first_key': 'Hello', 'second_key': {'nested_key': 42}}, 'nested_key') == [42]\", \"assert find_nested_key({'alpha_key': 'World', 'beta_key': {'delta_key': {'nested_key': 55}}}, 'nested_key') == [55]\", \"assert find_nested_key({'gamma_key':... | {
"split": "train",
"index": 83159,
"acecode_id": "evol_22767",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that converts a non-negative integer into its corresponding English word representation. The function should take an integer 'i' as input and return a string. If 'i' is not an integer or if 'i' is a negative integer, the function should return 'Invalid inpu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert integer_to_string(0) == 'zero'\", \"assert integer_to_string(1) == 'one'\", \"assert integer_to_string(2) == 'two'\", \"assert integer_to_string(-1) == 'Invalid input'\", \"assert integer_to_string(1.5) == 'Invalid input'\", \"assert integer_to_string('a') =... | {
"split": "train",
"index": 83160,
"acecode_id": "evol_33741",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given an integer n, implement a function that checks if n is a Mersenne prime number. A Mersenne prime is of the form 2^p - 1 where p is a prime number. Your function should return a tuple containing two values: a boolean indicating whether n is a Mersenne prime and the exponen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_mersenne_prime(3) == (True, 2)\", \"assert is_mersenne_prime(7) == (True, 3)\", \"assert is_mersenne_prime(15) == (False, None)\", \"assert is_mersenne_prime(31) == (True, 5)\", \"assert is_mersenne_prime(127) == (True, 7)\", \"assert is_mersenne_prime(51... | {
"split": "train",
"index": 83161,
"acecode_id": "evol_34451",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with validating user profile information for a web application. Write a function `validate_user_profile(name: str, email: str, date_of_birth: str, biography: str) -> bool` that takes in the following parameters: `name`, `email`, `date_of_birth`, and `biography`. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_user_profile('John Doe', 'john.doe@example.com', '1990-01-01', 'This is a short biography.') == True\", \"assert validate_user_profile('', 'john.doe@example.com', '1990-01-01', 'This is a short biography.') == False\", \"assert validate_user_profile... | {
"split": "train",
"index": 83162,
"acecode_id": "oss_4757",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of words and returns a modified list based on the following rules: 1. If a word starts with the substring 'Hello', the word should be replaced with the string 'Greeting'. 2. If a word does not start with 'Hello',... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_words(['Hello', 'World', 'HelloWorld', 'Python']) == ['Greeting', 'World', 'Greeting', 'Python']\", \"assert process_words(['HelloEveryone', 'Goodbye', 'HelloAgain']) == ['Greeting', 'Goodbye', 'Greeting']\", \"assert process_words(['Hi', 'Hello', 'H... | {
"split": "train",
"index": 83163,
"acecode_id": "oss_30913",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers and a target number, write a function that finds the indices of the two elements in the array whose sum is closest to the target number. If there are multiple pairs with the same closest sum, return the indices of the first pair you find. The array ma... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert closest_pair_indices([1, 2, 3, 4, 5], 8) == (2, 4)\", \"assert closest_pair_indices([5, 5, 5, 5], 10) == (0, 1)\", \"assert closest_pair_indices([1, 1, 1, 1], 2) == (0, 1)\", \"assert closest_pair_indices([0, 0, 0, 0], 0) == (0, 1)\", \"assert closest_pair_i... | {
"split": "train",
"index": 83164,
"acecode_id": "evol_33492",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of integer tuples as input and returns the list sorted by the second element of each tuple in descending order. If two tuples have the same second element, they should maintain their original order relative to each other (i.e., stable sort... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_tuples([(2, 5), (3, 1), (1, 7), (4, 3)]) == [(1, 7), (2, 5), (4, 3), (3, 1)]\", \"assert sort_tuples([(1, 2), (3, 4), (5, 6)]) == [(5, 6), (3, 4), (1, 2)]\", \"assert sort_tuples([(10, 10), (20, 20), (30, 30), (40, 40)]) == [(40, 40), (30, 30), (20, 20)... | {
"split": "train",
"index": 83165,
"acecode_id": "evol_26668",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a title for a task as a string. Your task is to create a function that validates whether the title meets certain criteria. The criteria for a valid title are as follows: it must be a non-empty string, contain at least 3 characters, and must not exceed 100 characte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_title('Task 1') == True\", \"assert validate_title('A') == False\", \"assert validate_title('Valid Title 123') == True\", \"assert validate_title('') == False\", \"assert validate_title(' ') == False\", \"assert validate_title('ab') == False\", \"a... | {
"split": "train",
"index": 83166,
"acecode_id": "bigcode_python_fns_10828",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the configuration of hyperparameters for a machine learning model. The function should accept the following parameters: cmc_lambda (float), lr (float), batch_size (int), nb_steps (int), save_interval (int), tsne_interva... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_config(1.0, 0.0001, 32, 200000, 10000, 1000, 16, 1, 0.5) == {'CMC_LAMBDA': 1.0, 'LR': 0.0001, 'BATCH_SIZE': 32, 'NB_STEPS': 200000, 'SAVE_INTERVAL': 10000, 'TSNE_INTERVAL': 1000, 'CKPT_FREQ': 16, 'CKPT_HORIZON': 1, 'IMITATION_CUTOFF': 0.5}\", \"assert... | {
"split": "train",
"index": 83167,
"acecode_id": "bigcode_python_fns_10989",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that redirects an edge in a directed graph. An edge is defined by its source node, destination node, source connector, destination connector, and a data attribute. Your function should allow you to modify the source and destination of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert redirect_edge('A', 'B', 'in', 'out') == {'src': 'A', 'dst': 'B', 'src_conn': 'in', 'dst_conn': 'out', 'data': None}\", \"assert redirect_edge('A', 'B', 'in', 'out', new_src='C') == {'src': 'C', 'dst': 'B', 'src_conn': 'in', 'dst_conn': 'out', 'data': None}\"... | {
"split": "train",
"index": 83168,
"acecode_id": "bigcode_python_fns_45867",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a social media post's likes. The function should take in a string representing the caption of the post and an integer representing the number of likes to increment. The function should return a dictionary containing the cap... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_post_likes('Hello World!', 5) == {'caption': 'Hello World!', 'likes': 5}\", \"assert simulate_post_likes('My first post', 0) == {'caption': 'My first post', 'likes': 0}\", \"assert simulate_post_likes('Python is great!', 10) == {'caption': 'Python i... | {
"split": "train",
"index": 83169,
"acecode_id": "oss_35055",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of buy and sell operations on a cryptocurrency account starting with zero balance, detect if at any point the balance falls below zero or equals zero and return True in that scenario. Otherwise, return False. Implement an optional 'case_insensitive' flag which, whe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert below_zero([('BUY', 1), ('SELL', 5), ('BUY', 2)], True, 0.02, 1.50) == True\", \"assert below_zero([('buy', 1), ('sell', 2)], True, 0.02, 1.00) == True\", \"assert below_zero([('SELL', 1), ('BUY', 1)], True, 0.01, 1.00) == True\", \"assert below_zero([('BUY'... | {
"split": "train",
"index": 83170,
"acecode_id": "evol_13134",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a string s, convert each character in the string to its corresponding hexadecimal value. The output should be a string where each hexadecimal value is separated by a colon (:). The hexadecimal values should be represented as two-digit lowercase hexadecimal numbers. Write ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert hex_string('hello') == '68:65:6c:6c:6f'\", \"assert hex_string('') == ''\", \"assert hex_string('A') == '41'\", \"assert hex_string('abc') == '61:62:63'\", \"assert hex_string('xyz') == '78:79:7a'\", \"assert hex_string('123') == '31:32:33'\", \"assert hex_s... | {
"split": "train",
"index": 83171,
"acecode_id": "bigcode_python_fns_46893",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple task management system. Your goal is to implement a function that takes a list of tasks and returns a list of completed tasks. Each task is represented as a dictionary with the following keys: 'id' (an integer), 'title' (a string), 'descrip... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_completed_tasks([{'id': 1, 'title': 'Task 1', 'description': 'Description 1', 'completed': True, 'created_at': '2023-01-01T00:00:00Z', 'updated_at': '2023-01-01T00:00:00Z'}, {'id': 2, 'title': 'Task 2', 'description': 'Description 2', 'completed': False,... | {
"split": "train",
"index": 83172,
"acecode_id": "oss_20089",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with developing a Python function that processes a configuration dictionary for a deep learning training pipeline. The configuration dictionary contains parameters for training a model on a dataset. Your function should extract specific information from the dicti... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_training_config({'samples_per_gpu': 2, 'workers_per_gpu': 2, 'train': {'type': 'coco'}}) == (4, 'coco')\", \"assert process_training_config({'samples_per_gpu': 1, 'workers_per_gpu': 1, 'train': {'type': 'pascal'}}) == (1, 'pascal')\", \"assert proces... | {
"split": "train",
"index": 83173,
"acecode_id": "oss_4800",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Design a Python function that initializes a Patient object with attributes: name, ailment, age, and gender. The function should return the Patient object after ensuring that all attributes are valid (name and ailment as strings, age as a non-negative integer, and gender as eith... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_patient('John Doe', 'Flu', 30, 'Male').get_name() == 'John Doe'\", \"assert create_patient('Jane Doe', 'Cold', 25, 'Female').get_ailment() == 'Cold'\", \"assert create_patient('Alice', 'Headache', 40, 'Other').get_age() == 40\", \"assert create_patien... | {
"split": "train",
"index": 83174,
"acecode_id": "evol_17750",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Write a function `find_word_frequency(text: str, words: List[str], case_sensitive: bool) -> Dict[str, int]` that takes a block of text, a list of words, and a boolean flag indicating whether the search should be case sensitive. The function should return a dictionary where the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_word_frequency('Hello world! Hello everyone.', ['Hello', 'world'], True) == {'Hello': 2, 'world': 1}\", \"assert find_word_frequency('Hello world! Hello everyone.', ['hello', 'world'], False) == {'hello': 2, 'world': 1}\", \"assert find_word_frequency('... | {
"split": "train",
"index": 83175,
"acecode_id": "evol_20980",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers, `predictions` and `targets`, write a function `rmse(predictions: List[int], targets: List[int]) -> float` that computes the root mean squared error (RMSE) between the two lists. The RMSE is calculated as the square root of the average of the squared... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rmse([1, 2, 3], [1, 2, 3]) == 0.0\", \"assert rmse([0, 0, 0], [1, 1, 1]) == 1.0\", \"assert rmse([1, 1, 1], [1, 1, 1]) == 0.0\", \"assert rmse([2, -2, 0], [0, 2, 2]) == 2.83\", \"assert rmse([1, 2, 3, 4], [1, 2]) == -1\", \"assert rmse([100, 200], [100, 200]... | {
"split": "train",
"index": 83176,
"acecode_id": "bigcode_python_fns_13000",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Implement a function that sorts an array of floating point numbers in ascending order using the bubble sort algorithm. The function should take a list of floats as input and return a new list containing the sorted numbers. Do not modify the original list. For example, given the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bubble_sort([4.2, -1.7, 3.14, 2.9, 0.0, -3.1, 8.33, -7.25, 5.8, 6.01]) == [-7.25, -3.1, -1.7, 0.0, 2.9, 3.14, 4.2, 5.8, 6.01, 8.33]\", \"assert bubble_sort([1.1, 2.2, 3.3]) == [1.1, 2.2, 3.3]\", \"assert bubble_sort([-1.0, -2.0, -3.0]) == [-3.0, -2.0, -1.0]\... | {
"split": "train",
"index": 83177,
"acecode_id": "evol_30770",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of geometric figures represented as strings, write a function to determine the total number of holes in these figures. Each figure can either be a 'Polygon' or a 'MultiPolygon'. A 'Polygon' has a specific number of holes represented by an integer that follows the w... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_holes(['Polygon 2']) == 2\", \"assert count_holes(['Polygon 1', 'Polygon 3']) == 4\", \"assert count_holes(['Polygon 0']) == 0\", \"assert count_holes(['Polygon 4', 'MultiPolygon Polygon 0']) == 4\", \"assert count_holes(['Polygon 3', 'Polygon 3', 'Pol... | {
"split": "train",
"index": 83178,
"acecode_id": "bigcode_python_fns_2876",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that updates a model's parameters based on given input. The function should take a dictionary representing the model parameters and return the updated model parameters as a dictionary. If the input dictionary does not contain a 'model_id'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_model({'model_id': 1, 'param1': 'value1'}) == {'model_id': 1, 'param1': 'value1'}\", \"assert update_model({'model_id': 2, 'param2': 'value2'}) == {'model_id': 2, 'param2': 'value2'}\", \"assert update_model({'model_id': 3, 'param3': 'value3'}) == {'m... | {
"split": "train",
"index": 83179,
"acecode_id": "bigcode_python_fns_36127",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `verify_user(username: str, password: str, user_data: Dict[str, str]) -> bool` that checks if the provided username and password match an entry in the user data dictionary. The user data is a dictionary where the keys are usernames and the values are hashed... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert verify_user('alice', 'password123', {'alice': 'hashed_password123', 'bob': 'hashed_password456'}) == False\", \"assert verify_user('charlie', 'mypassword', {'alice': 'hashed_password123', 'bob': 'hashed_password456'}) == False\", \"assert verify_user('alice'... | {
"split": "train",
"index": 83180,
"acecode_id": "evol_31722",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary called 'raw_settings' that contains application configuration settings. The dictionary has a key 'INSTALLED_APPS' with a list of app names, and an optional key 'CONFIT_SCHEMAS' which is also a dictionary that maps app names to their corresponding sche... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_settings({'INSTALLED_APPS': ['app1', 'app2'], 'CONFIT_SCHEMAS': {'app1': {}, 'app2': {}}}) == {'INSTALLED_APPS': ['app1', 'app2']}\", \"assert validate_settings({'INSTALLED_APPS': ['app1'], 'CONFIT_SCHEMAS': {'app1': {}}}) == {'INSTALLED_APPS': ['ap... | {
"split": "train",
"index": 83181,
"acecode_id": "bigcode_python_fns_26608",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given an integer representing a count of seconds, write a function that converts this count into a string formatted as 'H:M:S', where H represents hours, M represents minutes, and S represents seconds. Note that you should not restrict the function to only handle values less th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert seconds_to_hms(0) == '0:0:0'\", \"assert seconds_to_hms(59) == '0:0:59'\", \"assert seconds_to_hms(60) == '0:1:0'\", \"assert seconds_to_hms(3600) == '1:0:0'\", \"assert seconds_to_hms(3661) == '1:1:1'\", \"assert seconds_to_hms(7200) == '2:0:0'\", \"assert ... | {
"split": "train",
"index": 83182,
"acecode_id": "bigcode_python_fns_9599",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two integers a and p, implement a function `modInv(a: int, p: int) -> int` that computes the modular multiplicative inverse of a modulo p. The modular inverse is an integer x such that (a * x) % p = 1. If the modular inverse does not exist, return None. You may assume tha... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert modInv(3, 11) == 4\", \"assert modInv(10, 17) == 12\", \"assert modInv(7, 13) == 2\", \"assert modInv(4, 5) == 4\", \"assert modInv(5, 7) == 3\", \"assert modInv(2, 3) == 2\", \"assert modInv(1, 5) == 1\", \"assert modInv(6, 7) == 6\", \"assert modInv(9, 11)... | {
"split": "train",
"index": 83183,
"acecode_id": "evol_23512",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a list of source code lines and generating a modified version of the lines. Your program should remove any trailing whitespace from each line, while preserving any comments that are present in the line. Additionally, you need to add a prefix of '_... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_source_code(['for (int i = 0; i < 10; i++) { // Loop']) == ['_(for (int i = 0; i < 10; i++) { // Loop)']\", \"assert process_source_code(['']) == ['_()']\", \"assert process_source_code([' ']) == ['_()']\", \"assert process_source_code(['int... | {
"split": "train",
"index": 83184,
"acecode_id": "oss_16805",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a list of motor angles representing the angles of a robotic creature's legs, write a function that determines if the creature is in a 'terminated' state based on two conditions: 1) If any of the front leg angles exceed 35 degrees or if any of the rear leg angles are less ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_terminated((36, 0, 0, 0), 0) == True\", \"assert is_terminated((0, 0, 0, 0), 31) == True\", \"assert is_terminated((0, 0, -36, 0), 0) == True\", \"assert is_terminated((0, 0, 0, -36), 0) == True\", \"assert is_terminated((0, 0, 0, 0), 30) == False\", \"as... | {
"split": "train",
"index": 83185,
"acecode_id": "bigcode_python_fns_8009",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a recursive function that computes the nth term of the Lucas sequence. The Lucas sequence is defined as follows: L(0) = 2, L(1) = 1, and for n >= 2, L(n) = L(n-1) + L(n-2). Your function should take an integer n as input and return the nth term of the Lucas sequence.\nPle... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lucas_term(0) == 2\", \"assert lucas_term(1) == 1\", \"assert lucas_term(2) == 3\", \"assert lucas_term(3) == 4\", \"assert lucas_term(4) == 7\", \"assert lucas_term(5) == 11\", \"assert lucas_term(6) == 18\", \"assert lucas_term(7) == 29\", \"assert lucas_t... | {
"split": "train",
"index": 83186,
"acecode_id": "evol_23609",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D list of nested embeddings where each sub-list contains a series of numerical values, write a function `get_labels_and_features(nested_embeddings)` that separates the last element of each sub-list as the label and the rest of the elements as the features. The function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_labels_and_features([[1, 2, 3, 0], [4, 5, 6, 1], [7, 8, 9, 0]]) == ([[1, 2, 3], [4, 5, 6], [7, 8, 9]], [0, 1, 0])\", \"assert get_labels_and_features([[10, 20, 30, 2], [40, 50, 60, 3]]) == ([[10, 20, 30], [40, 50, 60]], [2, 3])\", \"assert get_labels_and... | {
"split": "train",
"index": 83187,
"acecode_id": "bigcode_python_fns_39146",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks whether a specific package is installed in the Python environment. If the package is not installed, the function should return a message indicating that the package needs to be installed. If the package is already installed, i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_package('numpy') == 'Package numpy is already installed.'\", \"assert check_package('pandas') == 'Package pandas is already installed.'\", \"assert check_package('tensorflow') == 'Package tensorflow needs to be installed.'\", \"assert check_package('ke... | {
"split": "train",
"index": 83188,
"acecode_id": "oss_32144",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given a string `variable`, write a function that checks whether the string is a valid field name or a reserved keyword in a hypothetical programming language. The function should raise a `SyntaxError` if the `variable` is either a Python keyword or matches a specific regular ex... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_field_name('validFieldName') == \\\"validFieldName isn't a known keyword\\\"\", \"assert check_field_name('anotherValidField') == \\\"anotherValidField isn't a known keyword\\\"\", \"assert check_field_name('valid_name') == \\\"valid_name isn't a known... | {
"split": "train",
"index": 83189,
"acecode_id": "bigcode_python_fns_29633",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Implement a function `char_frequency(string: str) -> dict` that takes a string as input and returns a dictionary where each unique character in the string is a key, and the corresponding value is the count of occurrences of that character in the string. The function should igno... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert char_frequency('aaaaaa') == {'a': 6}\", \"assert char_frequency('') == {}\", \"assert char_frequency('aA') == {'a': 2}\", \"assert char_frequency('12345 54321') == {'1': 2, '2': 2, '3': 2, '4': 2, '5': 2, ' ': 1}\", \"assert char_frequency('abcdefg') == {'a'... | {
"split": "train",
"index": 83190,
"acecode_id": "evol_9966",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing an HTML document. Your task is to implement a function that extracts the title of the document from the HTML. The title is enclosed within <title> and </title> tags. If the title tag is not present, return an empty string. Implement the funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_title('<html><head><title>Test Title</title></head><body></body></html>') == 'Test Title'\", \"assert extract_title('<html><head><TITLE>Another Test Title</TITLE></head><body></body></html>') == 'Another Test Title'\", \"assert extract_title('<html><... | {
"split": "train",
"index": 83191,
"acecode_id": "bigcode_python_fns_34113",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary representing an item, which contains several fields. Your task is to implement a function that checks which requested fields are present in the dictionary and which are missing. The function should take two parameters: a dictionary `item` and an optio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_fields({'a': 1, 'b': 2}, ['a', 'b']) == ({'a', 'b'}, set())\", \"assert validate_fields({'x': 10, 'y': 20}, ['x', 'z']) == ({'x'}, {'z'})\", \"assert validate_fields({}, ['a', 'b', 'c']) == (set(), {'a', 'b', 'c'})\", \"assert validate_fields({'name... | {
"split": "train",
"index": 83192,
"acecode_id": "bigcode_python_fns_12055",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a boolean variable `a_not_b`. Your task is to implement a function that takes this boolean variable as input and returns 'True' if `a_not_b` is False, and 'False' if `a_not_b` is True. Implement the function without using any conditional expression. The function s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate(False) == True\", \"assert evaluate(True) == False\", \"assert evaluate(False) == True\", \"assert evaluate(True) == False\", \"assert evaluate(False) == True\", \"assert evaluate(True) == False\", \"assert evaluate(False) == True\", \"assert evalua... | {
"split": "train",
"index": 83193,
"acecode_id": "oss_10269",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `complex_math` that takes three parameters: a list of arithmetic operations `operation_set`, a list of integers `number_set`, and a boolean `round_ans`. The function should evaluate the mathematical expression defined by the operations in `operation_set` ap... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert complex_math(['+', '-'], [5, 3, 2], True) == 6.00\", \"assert complex_math(['*', '/'], [2, 4, 2], False) == 4.0\", \"assert complex_math(['-', '+'], [10, 5, 3], False) == 8.0\", \"assert complex_math(['tan', 'cos'], [0, 0, 1], True) == 1.00\", \"assert compl... | {
"split": "train",
"index": 83194,
"acecode_id": "evol_6327",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages a simple list of users. The function should accept a command string that can be either 'add {name}', 'remove {name}', or 'list'. Based on the command, the function should modify the list of users accordingly. If the command i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_users('add Alice') is None\", \"assert manage_users('add Bob') is None\", \"assert manage_users('remove Alice') is None\", \"assert manage_users('remove Charlie') is None\", \"assert manage_users('add Charlie') is None\", \"assert manage_users('add Al... | {
"split": "train",
"index": 83195,
"acecode_id": "oss_13545",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with validating a set of configuration settings for a secure web application. Write a function `validate_configuration()` that performs the following checks:\n1. Check if the configuration setting `APP_ENV` is set in the `config` dictionary. If not, raise a `Valu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_configuration({'APP_ENV': 'production', 'VERIFY_HEADER_NAME': 'Header', 'VERIFY_PASSWORD': 'Password', 'VERIFY_HASHED': 'Hash'}) == 'Configuration settings validated successfully'\", \"assert validate_configuration({'APP_ENV': 'development', 'VERIFY... | {
"split": "train",
"index": 83196,
"acecode_id": "oss_5944",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function `calculate(num1: int, num2: int, operation: str) -> float` that takes two integers and a string representing a mathematical operation. The `operation` can be one of the following: 'add', 'subtract', 'multiply', or 'divide'. The function should return the re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate(5, 8, 'add') == 13\", \"assert calculate(5, 8, 'subtract') == -3\", \"assert calculate(5, 8, 'multiply') == 40\", \"assert calculate(5, 8, 'divide') == 0.625\", \"assert calculate(10, 2, 'divide') == 5.0\", \"assert calculate(10, 5, 'add') == 15\",... | {
"split": "train",
"index": 83197,
"acecode_id": "evol_34985",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that takes a list of integers and returns a new list containing only the even integers from the original list. The function should preserve the order of the even integers as they appear in the original list. Implement a function na... | 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([-2, -1, 0, 1, 2]) == [-2, 0, 2]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filter_even_... | {
"split": "train",
"index": 83198,
"acecode_id": "oss_19962",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `parse_xml_string(xml_string: str) -> List[str]` that takes a string representation of XML data and returns a list of all elements found in the XML, including nested elements. The returned list should contain the full path of each element in the format 'par... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_xml_string('<root><child1/><child2/></root>') == ['root', 'root/child1', 'root/child2']\", \"assert parse_xml_string('<parent><child><subchild/></child></parent>') == ['parent', 'parent/child', 'parent/child/subchild']\", \"assert parse_xml_string('<a>... | {
"split": "train",
"index": 83199,
"acecode_id": "evol_21271",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.