data_source
large_stringclasses
1 value
prompt
listlengths
1
1
ability
large_stringclasses
1 value
reward_model
dict
extra_info
dict
acecode
[ { "role": "user", "content": "You are tasked with implementing a function called `remove_epsilon` that processes a string representing transitions in a finite-state acceptor. Each line of the input string contains a transition in the format 'source_state destination_state label weight'. Your job is to remov...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_epsilon('0 1 1 1\\\\n1 2 0 1\\\\n2 3 2 1') == '0 1 1 1\\\\n2 3 2 1'\", \"assert remove_epsilon('0 1 0 1\\\\n1 2 0 2\\\\n2 3 0 3') == ''\", \"assert remove_epsilon('0 4 1 1\\\\n4 5 0 1\\\\n5 6 2 1') == '0 4 1 1\\\\n5 6 2 1'\", \"assert remove_epsilon('...
{ "split": "train", "index": 73600, "acecode_id": "oss_5335", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that encrypts a given message using a simple Caesar cipher. Each letter in the message should be shifted by 3 positions in the alphabet. If the shift goes beyond 'Z' for uppercase letters or 'z' for lowercase letters, it should wrap around to the beginning ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert encrypt_message('Hello World!') == 'Khoor Zruog!'\", \"assert encrypt_message('Caesar Cipher.') == 'Fdhvdu Flskhu.'\", \"assert encrypt_message('A B C D E') == 'D E F G H'\", \"assert encrypt_message('xyz') == 'abc'\", \"assert encrypt_message('XYZ') == 'ABC...
{ "split": "train", "index": 73601, "acecode_id": "evol_33160", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of stations, each represented by a tuple containing the station's name and its geographical coordinates (latitude, longitude). Your task is to implement a function that takes a list of these stations, a central point (latitude, longitude), and a radius in k...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert stations_within_radius([('Station A', (52.2053, 0.1218)), ('Station B', (52.2153, 0.1318)), ('Station C', (52.1953, 0.1118))], (52.2053, 0.1218), 10) == ['Station A', 'Station B', 'Station C']\", \"assert stations_within_radius([('Station D', (52.3000, 0.200...
{ "split": "train", "index": 73602, "acecode_id": "bigcode_python_fns_44456", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of student names and a corresponding list of their grades. Each student has four grades. Your task is to calculate the average grade for each student and return the number of students whose average grade is greater than or equal to 7.0. Implement a function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_students_above_average(['aluno1', 'aluno2', 'aluno3'], [[8, 7, 9, 6], [5, 5, 6, 7], [9, 10, 8, 9]]) == 2\", \"assert count_students_above_average(['student1', 'student2'], [[6, 6, 6, 6], [8, 8, 8, 8]]) == 1\", \"assert count_students_above_average(['st...
{ "split": "train", "index": 73603, "acecode_id": "oss_18548", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a class `IsotopeQuantity` that represents the quantity of a specific isotope over time. The class has the following attributes: `isotope` (a string representing the name of the isotope), `ref_date` (a datetime object representing the reference date), and a method ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_equal(IsotopeQuantity('Carbon-14', datetime(2020, 1, 1), 100), IsotopeQuantity('Carbon-14', datetime(2020, 1, 1), 100)) == True\", \"assert is_equal(IsotopeQuantity('Carbon-14', datetime(2020, 1, 1), 100), IsotopeQuantity('Carbon-14', datetime(2020, 1, 1)...
{ "split": "train", "index": 73604, "acecode_id": "bigcode_python_fns_47677", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of CPU utilization metrics for different instances represented as a list of integers. Your task is to implement a function that calculates the average CPU utilization from this list. The function should take in a list of integers and return a single float r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_utilization([10, 20, 30]) == 20.0\", \"assert calculate_average_utilization([100, 200, 300, 400]) == 250.0\", \"assert calculate_average_utilization([0, 0, 0, 0]) == 0.0\", \"assert calculate_average_utilization([50]) == 50.0\", \"assert ca...
{ "split": "train", "index": 73605, "acecode_id": "bigcode_python_fns_26937", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that returns a dictionary representing the frequency of each integer in the list. The keys of the dictionary should be the unique integers from the list, and the values should be their respective counts.\nPlease reason step by step, th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert frequency_count([1, 2, 2, 3, 3, 3]) == {1: 1, 2: 2, 3: 3}\", \"assert frequency_count([4, 5, 6, 4, 5]) == {4: 2, 5: 2, 6: 1}\", \"assert frequency_count([1, 1, 1, 1, 1]) == {1: 5}\", \"assert frequency_count([]) == {}\", \"assert frequency_count([10]) == {10...
{ "split": "train", "index": 73606, "acecode_id": "evol_8143", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a custom R-squared (coefficient of determination) function in Python. The R-squared value is a statistical measure that represents the proportion of the variance for a dependent variable that's explained by an independent variable. Your task is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_r2_score([1, 2, 3], [1, 2, 3]) == 1.0\", \"assert custom_r2_score([1, 2, 3, 4], [1, 2, 3, 4]) == 1.0\", \"assert custom_r2_score([10, 20, 30], [10, 20, 30]) == 1.0\", \"assert custom_r2_score([0, 1, 2], [0, 1, 3]) == 0.5\", \"assert custom_r2_score([2...
{ "split": "train", "index": 73607, "acecode_id": "oss_29582", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the scores of students in a particular subject. Your task is to implement a function named `average_scores(scores: List[int]) -> float` that calculates and returns the average score of the students. The average score should be round...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert average_scores([80, 90, 100]) == 90.00\", \"assert average_scores([0, 0, 0]) == 0.00\", \"assert average_scores([95]) == 95.00\", \"assert average_scores([10, 20, 30, 40, 50]) == 30.00\", \"assert average_scores([-10, -20, -30]) == -20.00\", \"assert average...
{ "split": "train", "index": 73608, "acecode_id": "bigcode_python_fns_12601", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of a group of people standing in a line. Your task is to write a function that determines the maximum number of people that can see the stage if they are looking in one direction (either to the left or to the right). A p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_visible_people([1, 2, 3, 4, 5]) == 5\", \"assert max_visible_people([1, 3, 2, 5, 4]) == 3\", \"assert max_visible_people([1, 1, 1, 1, 1]) == 1\", \"assert max_visible_people([3, 2, 4, 1, 5]) == 3\", \"assert max_visible_people([5, 2, 3, 4, 1]) == 3\", \"...
{ "split": "train", "index": 73609, "acecode_id": "oss_10367", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a recipe ID as an integer, return the detail URL for the recipe in the format '/reteta/<recipe_id>/', where <recipe_id> is the provided integer. Implement a function `detail_url(recipe_id: int) -> str` that takes a single integer argument 'recipe_id' and returns the corre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert detail_url(1) == '/reteta/1/'\", \"assert detail_url(100) == '/reteta/100/'\", \"assert detail_url(0) == '/reteta/0/'\", \"assert detail_url(-1) == '/reteta/-1/'\", \"assert detail_url(42) == '/reteta/42/'\", \"assert detail_url(123456) == '/reteta/123456/'\...
{ "split": "train", "index": 73610, "acecode_id": "bigcode_python_fns_1878", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Markdown scanner that checks for the presence of valid emphasis sequences in a given document. An emphasis sequence in Markdown is denoted by either asterisks (*) or underscores (_) surrounding a word or phrase. For example, `*emphasis*` or `_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_valid_emphasis('This is a *valid* emphasis sequence.') == True\", \"assert has_valid_emphasis('This is a _valid_ emphasis sequence.') == True\", \"assert has_valid_emphasis('No emphasis here.') == False\", \"assert has_valid_emphasis('Some *text with _mi...
{ "split": "train", "index": 73611, "acecode_id": "oss_32562", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a string that represents a series of commands. Each command can be either 'A' (add a cow head) or 'R' (remove a cow head). Implement a function that returns the total number of cow heads after processing all the commands in the string. If the number of commands le...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_commands('A') == 1\", \"assert process_commands('AR') == 0\", \"assert process_commands('AAA') == 3\", \"assert process_commands('R') == 0\", \"assert process_commands('AARAR') == 1\", \"assert process_commands('AARAA') == 3\", \"assert process_comma...
{ "split": "train", "index": 73612, "acecode_id": "bigcode_python_fns_22343", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Write a function `is_palindrome(s)` that determines whether a given string is a palindrome or not. A palindrome is defined as a sequence of characters that reads the same forward and backward when ignoring spaces and case differences. The input string `s` will contain only alph...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome('A man a plan a canal Panama') == True\", \"assert is_palindrome('racecar') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('') == True\", \"assert is_palindrome('Able was I ere I saw Elba') == True\", ...
{ "split": "train", "index": 73613, "acecode_id": "oss_33216", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a binary tree, write a function `check_if_bst(root)` that determines if the binary tree satisfies the properties of a binary search tree (BST). A binary search tree is defined as a binary tree in which for each node, all values in the left subtree are less than the node's...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_if_bst(None) == True\", \"assert check_if_bst(TreeNode(10, TreeNode(5), TreeNode(15))) == True\", \"assert check_if_bst(TreeNode(10, TreeNode(5), TreeNode(10))) == False\", \"assert check_if_bst(TreeNode(10, TreeNode(5, TreeNode(3), TreeNode(7)), TreeN...
{ "split": "train", "index": 73614, "acecode_id": "bigcode_python_fns_37049", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with managing upvotes for different auctions in a simplified manner. Implement a function `get_upvotes(auction_id: int, upvote_list: List[Tuple[int, int]]) -> List[int]` that receives two parameters: an integer `auction_id` representing the ID of the auction, and...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_upvotes(123, [(1, 123), (2, 123), (3, 456), (4, 123), (1, 456)]) == [1, 2, 4]\", \"assert get_upvotes(789, [(1, 123), (2, 123), (3, 456), (4, 123), (1, 456)]) == []\", \"assert get_upvotes(123, [(5, 123), (5, 123), (6, 123)]) == [5, 6]\", \"assert get_up...
{ "split": "train", "index": 73615, "acecode_id": "oss_37457", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that extracts exclusively even numbers from two given lists, combines them, and sorts the combined list in descending numerical order. The function should take two lists of integers as input and return a new list containing only the even integers from both ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_merge_sort_even_numbers([-1, 2, -4, 5, 6], [5, 3, -5, 2, -3, 3, 8, 0, 14, 4, -10]) == [14, 8, 6, 4, 2, 2, 0, -4, -10]\", \"assert filter_merge_sort_even_numbers([], [2, 4, 6]) == [6, 4, 2]\", \"assert filter_merge_sort_even_numbers([1, 3, 5], [7, 9, 1...
{ "split": "train", "index": 73616, "acecode_id": "evol_29839", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a message reaction system for a chat application. Your function should listen for messages from a specific user and respond with a custom greeting. Implement a function `custom_reaction(user_id: int, username: str) -> str` ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_reaction(123, 'Alice') == 'Hello, Alice!'\", \"assert custom_reaction(234, 'Bob') == 'Hello, Bob!'\", \"assert custom_reaction(345, 'Charlie') == 'Hello, Charlie!'\", \"assert custom_reaction(456, 'Dave') == 'Hello, Dave!'\", \"assert custom_reaction(...
{ "split": "train", "index": 73617, "acecode_id": "oss_9913", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of a series of walls. Your task is to write a function that calculates the amount of water that can be trapped between the walls after it rains. Implement the function `trapped_water(walls)` where `walls` is a list of in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert trapped_water([3, 0, 2, 0, 4]) == 7\", \"assert trapped_water([1, 0, 2]) == 1\", \"assert trapped_water([4, 2, 0, 3, 2, 5]) == 9\", \"assert trapped_water([0, 1, 0, 2]) == 1\", \"assert trapped_water([2, 1, 2]) == 1\", \"assert trapped_water([0, 2, 0]) == 0\...
{ "split": "train", "index": 73618, "acecode_id": "oss_29587", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function `median(my_list)` that computes the median of the list. The median is defined as the middle value when the list is sorted. If the list has an even number of elements, return the average of the two middle values. The function should...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert median([1, 3, 2]) == 2\", \"assert median([1, 2, 3, 4]) == 2.5\", \"assert median([5, 1, 2, 4, 3]) == 3\", \"assert median([1, 1, 1, 1]) == 1\", \"assert median([1, 2, 2, 3, 4, 5]) == 2.5\", \"assert median([-1, -2, -3, -4]) == -2.5\", \"assert median([-1, 0...
{ "split": "train", "index": 73619, "acecode_id": "evol_25949", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a vehicle detection system that processes a series of frames captured from a camera. Each frame is represented as a 2D list of integers, where each integer denotes the presence of a vehicle (1) or the absence of a vehicle (0) in a specific posit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_vehicles([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\", \"assert count_vehicles([[1, 0, 0], [0, 0, 0], [0, 0, 0]]) == 1\", \"assert count_vehicles([[1, 1, 1], [0, 0, 0], [0, 0, 0]]) == 3\", \"assert count_vehicles([[0, 0, 1], [1, 1, 1], [0, 0, 0]]) == 4\",...
{ "split": "train", "index": 73620, "acecode_id": "oss_8908", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `calculate_placeholder` that computes a value based on various input parameters. The function takes the following parameters: \n- `M` (an integer): representing a numerical value \n- `m` (an integer): representing a numerical value \n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_placeholder(0, 0, 1, True, False) == 1\", \"assert calculate_placeholder(0, 0, 10, False, False) == 0\", \"assert calculate_placeholder(10, 10, 10, False, False) == 10\", \"assert calculate_placeholder(15, 5, 2, True, False) == 26\", \"assert calcu...
{ "split": "train", "index": 73621, "acecode_id": "oss_10121", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a number n, return its double. If a boolean parameter 'formato' is set to True, return the doubled number formatted as a currency string with a dollar sign and two decimal places. If 'formato' is False, return the doubled number as a float. Write a function called 'dobrar...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert dobrar(0, False) == 0.0\", \"assert dobrar(0, True) == '$0.00'\", \"assert dobrar(1, False) == 2.0\", \"assert dobrar(1, True) == '$2.00'\", \"assert dobrar(10, False) == 20.0\", \"assert dobrar(10, True) == '$20.00'\", \"assert dobrar(-5, False) == -10.0\",...
{ "split": "train", "index": 73622, "acecode_id": "bigcode_python_fns_877", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a string of words and transforms it into headline style. In this format, the first and last words should always be capitalized, and all words with three or more letters should also be capitalized. Words with fewer than three letters should be in ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert headline_style('the quick brown fox') == 'The Quick Brown Fox'\", \"assert headline_style('a quick brown dog jumps') == 'A Quick Brown Dog Jumps'\", \"assert headline_style('hello world') == 'Hello World'\", \"assert headline_style('the quick brown') == 'The...
{ "split": "train", "index": 73623, "acecode_id": "evol_7839", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given an array of integers, write a function that returns the sum of all even numbers in the array. The function should take a single parameter, an integer array 'nums', and return an integer representing the sum of the even numbers. If there are no even numbers, return 0.\nPle...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_evens([1, 2, 3, 4, 5]) == 6\", \"assert sum_of_evens([10, 15, 20, 25]) == 30\", \"assert sum_of_evens([1, 3, 5, 7, 9]) == 0\", \"assert sum_of_evens([]) == 0\", \"assert sum_of_evens([-2, -4, 1, 3]) == -6\", \"assert sum_of_evens([2, 4, 6, 8, 10]) == ...
{ "split": "train", "index": 73624, "acecode_id": "bigcode_python_fns_32503", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a command template system. The function `create_ui_template` takes in several parameters: an integer `q` representing the command quantity, an integer `e` representing the existence status, a string `dt` for the template na...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_ui_template(1, 1, 'myTemplate', 1, 'otherTemplate') == 'myTemplate'\", \"assert create_ui_template(0, 1, 'myTemplate', 1, 'otherTemplate') == 'Cannot create template'\", \"assert create_ui_template(1, 0, 'myTemplate', 1, 'otherTemplate') == 'Cannot cr...
{ "split": "train", "index": 73625, "acecode_id": "bigcode_python_fns_33732", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that processes a list of file paths and returns a dictionary containing the count of files with unique extensions. The function should ignore case sensitivity when comparing file extensions. Implement the function `count_unique...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_extensions(['file1.TXT', 'file2.txt', 'file3.PDF', 'file4.pdf']) == {'txt': 2, 'pdf': 2}\", \"assert count_unique_extensions(['image1.JPG', 'image2.jpg', 'image3.PNG', 'image4.png']) == {'jpg': 2, 'png': 2}\", \"assert count_unique_extensions(['...
{ "split": "train", "index": 73626, "acecode_id": "oss_17004", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to calculate various metrics for evaluating the performance of a predictive model against a gold standard dataset. The function should take two lists of tuples, `gold_standard` and `predictions`, as input. Each tuple contains a `clini...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_metrics([('case1', 'codeA'), ('case1', 'codeB')], [('case1', 'codeA')]) == {'Pred_Pos_per_cc': {'case1': 1}, 'Pred_Pos': 1, 'GS_Pos_per_cc': {'case1': 2}, 'GS_Pos': 2, 'TP_per_cc': {'case1': 1}}\", \"assert calculate_metrics([('case1', 'codeA')], [...
{ "split": "train", "index": 73627, "acecode_id": "oss_465", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a simple function that returns a specific JSON response. Implement a function called `ping_response` that, when called, returns a JSON object with the structure: {\"ping\": \"pong\"}. The function should not take any parameters and should return the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert ping_response() == {'ping': 'pong'}\", \"assert isinstance(ping_response(), dict)\", \"assert 'ping' in ping_response()\", \"assert ping_response()['ping'] == 'pong'\", \"assert len(ping_response()) == 1\", \"assert type(ping_response()) == dict\", \"assert ...
{ "split": "train", "index": 73628, "acecode_id": "oss_29571", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that returns a new list containing only the unique elements from the original list in the order they first appeared. The input list may contain duplicates. Your function should take a list of integers as input and return a list of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 3, 2, 1, 4]) == [1, 2, 3, 4]\", \"assert unique_elements([5, 5, 5, 5]) == [5]\", \"assert unique_elements([]) == []\", \"assert unique_elements([10, 20, 10, 30, 20]) == [10, 20, 30]\", \"assert unique_elements([1, 2, 3, 1, 2, 3]) == [1...
{ "split": "train", "index": 73629, "acecode_id": "bigcode_python_fns_4076", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes the title of a book as a string input and returns the title in uppercase letters. The function should be named `convert_title_to_uppercase` and should accept a single parameter: `titulo`, which is a string representing the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_title_to_uppercase('To Kill a Mockingbird') == 'TO KILL A MOCKINGBIRD'\", \"assert convert_title_to_uppercase('1984') == '1984'\", \"assert convert_title_to_uppercase('Pride and Prejudice') == 'PRIDE AND PREJUDICE'\", \"assert convert_title_to_upperc...
{ "split": "train", "index": 73630, "acecode_id": "oss_35031", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two sorted arrays of integers, write a function to merge them into one sorted array. Your merged array should not contain any duplicate elements. Additionally, return the number of pairs of numbers in the merged array that add up to a given target. Implement a function th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_de_dupe_and_count_pairs([1, 2, 4, 5], [3, 6, 7, 8], 10) == ([1, 2, 3, 4, 5, 6, 7, 8], 3)\", \"assert merge_de_dupe_and_count_pairs([], [], 5) == ([], 0)\", \"assert merge_de_dupe_and_count_pairs([1, 3, 5], [2, 4, 6], 10) == ([1, 2, 3, 4, 5, 6], 1)\", \...
{ "split": "train", "index": 73631, "acecode_id": "evol_18932", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Design and implement a function that takes a compressed string representation of characters and their frequencies (which may include nested compressed strings) and provides a way to get the next character, check if there are more characters to uncompress, and skip the next occu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert string_iterator_actions('A1B1C1', [('next', None), ('next', None), ('next', None), ('hasNext', None)]) == ['A', 'B', 'C', False]\", \"assert string_iterator_actions('A2B3', [('next', None), ('next', None), ('next', None), ('next', None), ('hasNext', None)]) ...
{ "split": "train", "index": 73632, "acecode_id": "evol_18132", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a list of tuples, where each tuple contains filenames of training data images. The last item in each tuple represents the labeled image. Write a function that counts the number of unique labeled images across all tuples. The function should take the list of tuples...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_labeled_images([('sub1-T1.nii.gz', 'sub1-T2.nii.gz', 'sub1-truth.nii.gz'), ('sub2-T1.nii.gz', 'sub2-T2.nii.gz', 'sub2-truth.nii.gz')]) == 2\", \"assert count_unique_labeled_images([('sub1-T1.nii.gz', 'sub1-T2.nii.gz', 'sub1-truth.nii.gz'), ('sub...
{ "split": "train", "index": 73633, "acecode_id": "bigcode_python_fns_113", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `find_max(arr: List[int]) -> int` that takes a list of integers `arr` and returns the maximum value from the array. You must not use any built-in functions and can only compare elements using bitwise operations.\nPlease reason step by step, then write a sel...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_max([-1, -5, -3, -4]) == -1\", \"assert find_max([0, 1, 0, 1]) == 1\", \"assert find_max([1]) == 1\", \"assert find_max([0]) == 0\", \"assert find_max([5, 5, 5, 5]) == 5\", \"assert find_max([5, 4, 3, 2, 1]) == 5\", \"assert find_max([2, 2, 2, 2, 3]) ==...
{ "split": "train", "index": 73634, "acecode_id": "evol_11238", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of integers. The function should return a new list that contains the squares of each integer in the input list, maintaining the original order. If the input list is empty, the function should return an empty l...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert square_numbers([]) == []\", \"assert square_numbers([0]) == [0]\", \"assert square_numbers([1]) == [1]\", \"assert square_numbers([-1]) == [1]\", \"assert square_numbers([2, 3]) == [4, 9]\", \"assert square_numbers([-2, -3]) == [4, 9]\", \"assert square_numb...
{ "split": "train", "index": 73635, "acecode_id": "oss_14002", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that removes all comments from a given list of strings. Each string represents a line of text, and any text following the '#' character on a line should be considered a comment and removed. Write a function `remove_comments(lines: ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_comments(['This is a sample line', '# This line should be removed', 'This is another line', '# This line should also be removed']) == ['This is a sample line', 'This is another line']\", \"assert remove_comments(['No comments here', 'Just a regular li...
{ "split": "train", "index": 73636, "acecode_id": "oss_24926", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a data structure to store information about a podcast. Specifically, you need to create a class named `Podcast` that has a single field named `image` which is a string representing the URL of the podcast's image. Your task is to implement a function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_podcast('http://example.com/image1.jpg').image == 'http://example.com/image1.jpg'\", \"assert create_podcast('http://example.com/image2.png').image == 'http://example.com/image2.png'\", \"assert create_podcast('http://example.com/image3.gif').image ==...
{ "split": "train", "index": 73637, "acecode_id": "oss_24861", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that filters a list of strings based on a given pattern. The pattern is represented as a regular expression, and the function should return a new list containing only the strings that match the pattern. Implement the function `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_strings_by_pattern([\\\"dog\\\", \\\"cat\\\", \\\"fish\\\", \\\"bird\\\"], \\\"c.*t\\\") == [\\\"cat\\\"]\", \"assert filter_strings_by_pattern([\\\"hello\\\", \\\"world\\\", \\\"python\\\", \\\"regex\\\"], \\\"p.*n\\\") == [\\\"python\\\"]\", \"asser...
{ "split": "train", "index": 73638, "acecode_id": "oss_28144", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `get_valid_credentials(force_refresh: bool) -> str` that simulates obtaining OAuth2 credentials. The function should return a string representing the status of the credentials based on the following conditions: If `force_refresh` is `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_valid_credentials(True) == 'Credentials refreshed'\", \"assert get_valid_credentials(True) == 'Credentials refreshed'\", \"assert get_valid_credentials(False) == 'Credentials valid'\", \"assert get_valid_credentials(True) == 'Credentials refreshed'\", \"...
{ "split": "train", "index": 73639, "acecode_id": "bigcode_python_fns_21379", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a DELETE HTTP request header for a specific product. The function should take a single string parameter, `param`, which represents the product identifier. The function should return a string that contains the complete HTTP ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_delete_request('12345') == 'DELETE /products/12345 HTTP/1.1\\\\r\\\\nHost: localhost:8080\\\\r\\\\n\\\\r\\\\n'\", \"assert generate_delete_request('abcde') == 'DELETE /products/abcde HTTP/1.1\\\\r\\\\nHost: localhost:8080\\\\r\\\\n\\\\r\\\\n'\", \"a...
{ "split": "train", "index": 73640, "acecode_id": "bigcode_python_fns_27889", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that sorts an array of integers in increasing order using the bubble sort algorithm. The function should take a list of integers as input and return a new list that is sorted in ascending order. Do not use any built-in sorting functions or libraries.\nPleas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bubbleSort([5, 3, 8, 1, 2]) == [1, 2, 3, 5, 8]\", \"assert bubbleSort([10, 9, 8, 7, 6]) == [6, 7, 8, 9, 10]\", \"assert bubbleSort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert bubbleSort([5]) == [5]\", \"assert bubbleSort([]) == []\", \"assert bubbleSort(...
{ "split": "train", "index": 73641, "acecode_id": "evol_4404", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that merges two sequences of numbers. Given two lists of integers, `list1` and `list2`, your function should return a new list that contains all the elements of `list1` followed by all the elements of `list2`. The elements in the outp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_sequences([1, 2, 3], [4, 5, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert merge_sequences([], [4, 5, 6]) == [4, 5, 6]\", \"assert merge_sequences([1, 2, 3], []) == [1, 2, 3]\", \"assert merge_sequences([], []) == []\", \"assert merge_sequences([7], [8]) == [7,...
{ "split": "train", "index": 73642, "acecode_id": "bigcode_python_fns_41147", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of neural network layers represented as strings, write a function `count_conv2d_layers(layers: List[str], exclude_downsample: bool, include_linear: bool) -> int` that counts the number of Conv2D layers in the list. A layer is represented as a string that could be '...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_conv2d_layers(['Conv2D', 'Linear', 'Downsample'], exclude_downsample=True, include_linear=True) == 2\", \"assert count_conv2d_layers(['Conv2D', 'Conv2D', 'Downsample'], exclude_downsample=True, include_linear=False) == 2\", \"assert count_conv2d_layers...
{ "split": "train", "index": 73643, "acecode_id": "bigcode_python_fns_34181", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a multi-line string in Markdown format that contains metadata about a software package. Your task is to implement a function `parse_long_description(long_description: str) -> dict` that extracts specific information from this string. The input will always contain ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_long_description('Programming Language :: Python :: 3.6\\\\nTopic :: Scientific/Engineering :: Artificial Intelligence') == {'programming_language': 'Python :: 3.6', 'topic': 'Scientific/Engineering :: Artificial Intelligence'}\", \"assert parse_long_d...
{ "split": "train", "index": 73644, "acecode_id": "oss_5784", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `create_transport(type: str, capacity: int, speed: int, cost: int) -> dict` that takes in four parameters: `type` (a string), `capacity` (an integer), `speed` (an integer), and `cost` (an integer). The function should return a dictionary representing the tr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_transport('Car', 5, 100, 20000) == {'type': 'Car', 'capacity': 5, 'speed': 100, 'cost': 20000}\", \"assert create_transport('Bus', 50, 80, 50000) == {'type': 'Bus', 'capacity': 50, 'speed': 80, 'cost': 50000}\", \"assert create_transport('Bicycle', 1,...
{ "split": "train", "index": 73645, "acecode_id": "evol_8115", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a multidimensional array, write a function that swaps all even-indexed elements with their respective odd-indexed elements within each sub-array. If a sub-array has an odd number of elements, the last element should remain in its original position. The array may contain b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert swap_elements([[1, 2], ['A', 'B'], [3, 4], [5, 6]]) == [[2, 1], ['B', 'A'], [4, 3], [6, 5]]\", \"assert swap_elements([[1, 'A', 3], [4, 'B', 6]]) == [['A', 1, 3], ['B', 4, 6]]\", \"assert swap_elements([[10, 20, 30], ['X', 'Y', 'Z', 'W']]) == [[20, 10, 30], ...
{ "split": "train", "index": 73646, "acecode_id": "evol_12853", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates updating a user's email and password in a user database. The function, `update_user`, takes three parameters: `old_email`, `new_email`, and `password`. The `old_email` is required, while `new_email` and `password` are optio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_user('old@example.com', 'new@example.com', 'newpassword') == ('new@example.com', 'Password updated')\", \"assert update_user('old@example.com', None, 'newpassword') == 'Password updated'\", \"assert update_user('old@example.com', 'new@example.com', No...
{ "split": "train", "index": 73647, "acecode_id": "bigcode_python_fns_42493", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2-D array (matrix) of integers, implement a function that calculates and returns the total sum of all individual elements in the matrix. The matrix can be of any size, including an empty matrix. Write a function `sum_matrix_elements(matrix: List[List[int]]) -> int` that...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_matrix_elements([[1,2], [3,4], [5,6]]) == 21\", \"assert sum_matrix_elements([[0,0], [0,0]]) == 0\", \"assert sum_matrix_elements([[-1, -2], [-3, -4]]) == -10\", \"assert sum_matrix_elements([[10, 20], [30, 40], [50]]) == 150\", \"assert sum_matrix_eleme...
{ "split": "train", "index": 73648, "acecode_id": "evol_27176", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `add_items` that accepts a variable number of integer arguments. This function should maintain a list that contains at most three unique integers, sorted in ascending order. If more than three integers are provided, only the three lowest unique integers sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_items(3, 1, 2) == [1, 2, 3]\", \"assert add_items(5, 3, 1, 2) == [1, 2, 3]\", \"assert add_items(3, 1, 5, 2, 4) == [1, 2, 3]\", \"assert add_items(9, 4, 7, 1, 3, 2) == [1, 2, 3]\", \"assert add_items(8, 6, 3, 3, 6) == [3, 6, 8]\", \"assert add_items(1, 2...
{ "split": "train", "index": 73649, "acecode_id": "evol_26505", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with maximizing the amount of money you can steal from a linear arrangement of houses, where each house has a certain amount of money hidden inside. However, you cannot rob two adjacent houses on the same night, as this would trigger an alarm. You are given a lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rob([1, 2, 3, 1]) == 4\", \"assert rob([2, 7, 9, 3, 1]) == 12\", \"assert rob([0]) == 0\", \"assert rob([5, 1, 2, 10]) == 15\", \"assert rob([10, 2, 10]) == 20\", \"assert rob([1, 0, 3, 9, 2]) == 10\", \"assert rob([4, 1, 2]) == 6\", \"assert rob([2, 4, 6, 2...
{ "split": "train", "index": 73650, "acecode_id": "evol_23780", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of model names available for a speech synthesis project, write a function that returns the count of available models that contain the substring 'fast' in their names. The function should take a list of strings as input, where each string represents a model name. Th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_available_models(['fastSpeech2', 'textToMel', 'fastModel', 'otherModel']) == 2\", \"assert count_available_models(['modelOne', 'modelTwo', 'modelThree']) == 0\", \"assert count_available_models(['fastTrack', 'quickStep', 'fastForward']) == 2\", \"asser...
{ "split": "train", "index": 73651, "acecode_id": "bigcode_python_fns_25386", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that checks whether a given user is an admin based on the global variable `is_admin`, which is a dictionary mapping user IDs to their admin status. The function should return `True` if the user is an admin (i.e., the value associated ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_admin(1) == True\", \"assert check_admin(2) == False\", \"assert check_admin(3) == True\", \"assert check_admin(4) == False\", \"assert check_admin(5) == False\", \"assert check_admin(7) == False\", \"assert check_admin(9) == False\", \"assert check_ad...
{ "split": "train", "index": 73652, "acecode_id": "oss_6430", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given an array `result_data` of integers. Your task is to implement a function `copyToBuffer(result_data: List[int]) -> List[int]` that creates a new array, `buffer`, and copies elements from `result_data` to `buffer` based on the following rules: \n- If the element at...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert copyToBuffer([2, -3, 4, -5, 6]) == [2, -3, 4, -5, 6]\", \"assert copyToBuffer([0, -1, 0, -2, 0]) == [0, -1, 0, -2, 0]\", \"assert copyToBuffer([4, -5, 6, -7, 8]) == [4, -5, 6, -7, 8]\", \"assert copyToBuffer([]) == []\", \"assert copyToBuffer([5, -5, 10, -10...
{ "split": "train", "index": 73653, "acecode_id": "oss_17365", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given two integers n and m, implement a function `create_matrix(n: int, m: int) -> List[List[int]]` that creates a two-dimensional array of size n x m, filled with sequentially ordered even numbers starting from 0. The matrix should be represented in a column-major order.\nPlea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_matrix(1, 1) == [[0]]\", \"assert create_matrix(2, 4) == [[0, 8], [2, 10], [4, 12], [6, 14]]\", \"assert create_matrix(3, 3) == [[0, 6, 12], [2, 8, 14], [4, 10, 16]]\", \"assert create_matrix(2, 5) == [[0, 10], [2, 12], [4, 14], [6, 16], [8, 18]]\", \...
{ "split": "train", "index": 73654, "acecode_id": "evol_35885", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Develop a function that receives two string arguments and a special character. The function should construct a new string that intermingles characters from the two provided strings in an alternating manner. If the strings are of different lengths, the missing characters from th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert intermingle_strings('abc', '123', '-') == 'a1b2c3'\", \"assert intermingle_strings('a', '12', '#') == 'a1#2'\", \"assert intermingle_strings('hello', 'world', '!') == 'hweolrllod'\", \"assert intermingle_strings('12345', 'abc', '?') == '1a2b3c4?5?'\", \"asse...
{ "split": "train", "index": 73655, "acecode_id": "evol_20662", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of integers as input and returns a new list containing only the unique elements from the input list in the order they first appeared. The output list should not contain any duplicates.\nPlease reason step by step, then write a self-contain...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates([1, 2, 3, 3, 4, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert remove_duplicates([1, 1, 1, 1]) == [1]\", \"assert remove_duplicates([5, 5, 5, 2, 3, 2]) == [5, 2, 3]\", \"assert remove_duplicates([]) == []\", \"assert remove_duplicates([7, 8, 9, 7, 8...
{ "split": "train", "index": 73656, "acecode_id": "evol_15136", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `create_person(name: str, age: int) -> dict` that takes a person's name and age as input, and returns a dictionary representing the person with the following keys: 'name', 'age', and 'is_adult'. The 'is_adult' key should contain a boolean value indicating w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_person('Alice', 30) == {'name': 'Alice', 'age': 30, 'is_adult': True}\", \"assert create_person('Bob', 17) == {'name': 'Bob', 'age': 17, 'is_adult': False}\", \"assert create_person('Charlie', 18) == {'name': 'Charlie', 'age': 18, 'is_adult': True}\",...
{ "split": "train", "index": 73657, "acecode_id": "evol_31601", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of tuples `friend_towns`, where each tuple contains a string representing the name of a friend and a string representing the name of a town they are visiting. Additionally, you are provided with a dictionary `home_to_town_distances`, which maps town names t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_total_distance([('Alice', 'New York'), ('Bob', 'Los Angeles')], {'New York': 200, 'Los Angeles': 300}) == 500\", \"assert calculate_total_distance([('Alice', 'New York'), ('Bob', 'Los Angeles'), ('Alice', 'New York')], {'New York': 200, 'Los Angele...
{ "split": "train", "index": 73658, "acecode_id": "oss_6850", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of URL strings and a boolean value indicating whether to ignore symlinks. The function should return a list of valid URLs. A URL is considered valid if it starts with 'http://' or 'https://'. If the ignore_symlinks p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_valid_urls(['http://example.com', 'https://example.com', 'ftp://example.com'], False) == ['http://example.com', 'https://example.com']\", \"assert filter_valid_urls(['http://example.com', 'https://example.com', 'symlink://example.com'], True) == ['htt...
{ "split": "train", "index": 73659, "acecode_id": "bigcode_python_fns_8797", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function in Python that takes a string as input and splits it into a list of words. The function should handle special cases such as multiple spaces, different types of whitespace characters (like tabs and newlines), and punctuation marks. The words in the output list s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert split_words('Hello, world! This is a test.') == ['hello', 'world', 'this', 'is', 'a', 'test']\", \"assert split_words(' Multiple spaces here ') == ['multiple', 'spaces', 'here']\", \"assert split_words('Special characters: @#$%^&*()') == ['special', 'c...
{ "split": "train", "index": 73660, "acecode_id": "evol_20294", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a string `s`, determine the least number of insertions required to transform `s` into a palindrome. A palindrome is a string that reads the same forward and backward. You can insert any character at any position within the string. Implement a function `findMinInsertions(s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert findMinInsertions('zzazz') == 0\", \"assert findMinInsertions('mbadm') == 2\", \"assert findMinInsertions('leetcode') == 5\", \"assert findMinInsertions('g') == 0\", \"assert findMinInsertions('no') == 1\", \"assert findMinInsertions('abc') == 2\", \"assert ...
{ "split": "train", "index": 73661, "acecode_id": "evol_17954", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string 'body', a string 'obj', a string 'obj_string', a rule which is also a string, and a boolean 'only_body', implement a function 'check_rule' that checks if 'body' matches a portion of 'rule' and, if 'only_body' is False, if 'obj' matches 'obj_string'. The function ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_rule('condition', 'object', 'different_object', 'type:condition', False) == False\", \"assert check_rule('condition', 'object', 'object', 'type:wrong_condition', False) == False\", \"assert check_rule('another_condition', 'object', 'object', 'type:cond...
{ "split": "train", "index": 73662, "acecode_id": "bigcode_python_fns_30846", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a TensorFlow model file path, a target CoreML model path, a dictionary that maps input names to their shapes, and a list of output feature names. Your task is to create a function `convert_to_coreml(tf_model_path: str, mlmodel_path: str, input_name_shape_dict: dic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_to_coreml('path/to/tf_model', 'path/to/mlmodel', {'input_1': (1, 224, 224, 3)}, ['output_1']) == 'Conversion successful'\", \"assert convert_to_coreml('path/to/tf_model', 'path/to/mlmodel', {}, ['output_1']) == 'Conversion failed'\", \"assert convert...
{ "split": "train", "index": 73663, "acecode_id": "bigcode_python_fns_19112", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function that accepts two matrices (lists of lists) of equal dimensions and performs element-wise multiplication. The function should validate the following constraints: both matrices must be of the same dimensions, all elements in both matrices must be integers, an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multiply_matrices([[1, 2], [3, 4]], [[5, 6], [7, 8]]) == [[5, 12], [21, 32]]\", \"assert multiply_matrices([[0, -1], [2, 3]], [[1, 2], [3, 4]]) == [[0, -2], [6, 12]]\", \"assert multiply_matrices([[1]], [[2]]) == [[2]]\", \"assert multiply_matrices([[1, 2, 3...
{ "split": "train", "index": 73664, "acecode_id": "evol_25246", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Create a Python function that finds the first non-repeating character in a given string and returns its index position. You must implement this without using any built-in functions or methods other than for string length. The string will not contain special characters. For exam...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert firstUniqChar('leetcode') == 0\", \"assert firstUniqChar('loveleetcode') == 2\", \"assert firstUniqChar('aabb') == -1\", \"assert firstUniqChar('abcd') == 0\", \"assert firstUniqChar('eett') == -1\", \"assert firstUniqChar('hello') == 0\", \"assert firstUniq...
{ "split": "train", "index": 73665, "acecode_id": "evol_14433", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with designing a function that takes two strings as input: a comma-separated list of parameter server addresses and a comma-separated list of worker addresses. The function should return a dictionary that maps 'ps' to a list of parameter server addresses and 'wor...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_cluster_spec('127.0.0.1:5000,127.0.0.1:5001', '192.168.1.1:6000,192.168.1.2:6001') == {'ps': ['127.0.0.1:5000', '127.0.0.1:5001'], 'worker': ['192.168.1.1:6000', '192.168.1.2:6001']}\", \"assert create_cluster_spec('localhost:9000', 'localhost:9001') ...
{ "split": "train", "index": 73666, "acecode_id": "bigcode_python_fns_6843", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple feature flag management system. A feature flag is a way to control the visibility of a feature in an application. Your goal is to implement a function `manage_feature_flags` that takes a list of feature names and returns a list of uniqu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_feature_flags(['featureA', 'featureB', 'featureA']) == [{'name': 'featureA'}, {'name': 'featureB'}]\", \"assert manage_feature_flags(['feature1', 'feature2', 'feature3']) == [{'name': 'feature1'}, {'name': 'feature2'}, {'name': 'feature3'}]\", \"asser...
{ "split": "train", "index": 73667, "acecode_id": "oss_21775", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple timer. The function should take an integer input representing the number of seconds and return a string that indicates how long the timer has run. The returned string should be in the format 'Timer ran for X second...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert timer_simulation(5) == 'Timer ran for 5 seconds'\", \"assert timer_simulation(10) == 'Timer ran for 10 seconds'\", \"assert timer_simulation(0) == 'Timer ran for 0 seconds'\", \"assert timer_simulation(-1) == 'Invalid input'\", \"assert timer_simulation(15) ...
{ "split": "train", "index": 73668, "acecode_id": "bigcode_python_fns_32513", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D list 'covariate' representing weather data for multiple locations over several days, and an integer 'period' representing the number of days for which the data should be repeated, implement a function 'periodic_forecast' that creates a new 2D list 'output_array' wher...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert periodic_forecast([[5, 10]], 1) == [[10]]\", \"assert periodic_forecast([[100, 200]], 1) == [[200]]\", \"assert periodic_forecast([[0, 0, 1, 1]], 2) == [[1, 1]]\", \"assert periodic_forecast([[9]], 1) == [[9]]\", \"assert periodic_forecast([[99, 98]], 1) == ...
{ "split": "train", "index": 73669, "acecode_id": "bigcode_python_fns_25467", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a request object which contains information about a test. Your task is to implement a function `get_test_details(request)` that returns a tuple containing the module name and the function name of the test being executed. The module name can be accessed from `reque...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_test_details(MockRequest(module='math', parent_request=MockParentRequest(func_name='test_add'))) == ('math', 'test_add')\", \"assert get_test_details(MockRequest(module='string', parent_request=MockParentRequest(func_name='test_concat'))) == ('string', '...
{ "split": "train", "index": 73670, "acecode_id": "bigcode_python_fns_30965", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Develop an algorithm to identify the longest decreasing subsequence in an array. Given an array of integers, return the longest decreasing subsequence as a list of integers. If there are multiple longest decreasing subsequences, return any one of them.\nPlease reason step by st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert longest_decreasing_subsequence([23, 21, 19, 22, 20, 18, 24, 25, 16, 15, 17, 14, 13, 12, 11]) == [23, 21, 19, 18, 16, 15, 14, 13, 12, 11]\", \"assert longest_decreasing_subsequence([10, 9, 8, 7, 6, 5]) == [10, 9, 8, 7, 6, 5]\", \"assert longest_decreasing_sub...
{ "split": "train", "index": 73671, "acecode_id": "evol_22032", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that prepares a model for dispatching. The function `prepare_for_crude_dispatch` takes in a model identifier (a string) and an output store identifier (another string) as parameters. The function should return a string that indicates the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert prepare_for_crude_dispatch('model_A', 'store_A') == 'prepared_model_A'\", \"assert prepare_for_crude_dispatch('model_B', 'store_B') == 'prepared_model_B'\", \"assert prepare_for_crude_dispatch('linear_regression', 'output_store_1') == 'prepared_linear_regres...
{ "split": "train", "index": 73672, "acecode_id": "oss_29122", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes two string parameters, 'first_name' and 'last_name', and returns the full name as a single string. Additionally, the function should also return the length of the full name, including any spaces. Implement the function 'get_ful...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_full_name_and_length('John', 'Doe') == ('John Doe', 8)\", \"assert get_full_name_and_length('Alice', 'Smith') == ('Alice Smith', 11)\", \"assert get_full_name_and_length('Bob', 'Marley') == ('Bob Marley', 10)\", \"assert get_full_name_and_length('Eve', '...
{ "split": "train", "index": 73673, "acecode_id": "oss_13274", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of email messages. Each email message is represented as a dictionary with two keys: 'message_id' (a unique string identifier for the email) and 'status' (a string that can be either 'read', 'unread', or 'deleted'). T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_messages([{'message_id': '1', 'status': 'read'}, {'message_id': '2', 'status': 'unread'}, {'message_id': '3', 'status': 'deleted'}, {'message_id': '4', 'status': 'read'}]) == [{'message_id': '2', 'status': 'unread'}, {'message_id': '3', 'status': 'del...
{ "split": "train", "index": 73674, "acecode_id": "bigcode_python_fns_42175", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that calculates the total cost of shipping an item based on its weight and a given shipping rate per pound. Implement a function called `calculate_shipping_cost` that takes two parameters: `weight` (a float representing the weight of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_shipping_cost(5, 4.5) == 22.5\", \"assert calculate_shipping_cost(1, 4.5) == 4.5\", \"assert calculate_shipping_cost(0, 4.5) == 0.0\", \"assert calculate_shipping_cost(10, 4.5) == 45.0\", \"assert calculate_shipping_cost(2.5, 4.5) == 11.25\", \"ass...
{ "split": "train", "index": 73675, "acecode_id": "evol_11441", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, implement a function that finds the second largest number in the array. The search should stop immediately if the number 13 is encountered again after being seen. If there is no second largest number, return None.\nPlease reason step by step, then wr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_second_largest([13, 54, 78, 54, 3, 87, 13]) == 78\", \"assert find_second_largest([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9\", \"assert find_second_largest([10, 10, 10, 10]) == None\", \"assert find_second_largest([13, 13, 13, 13]) == None\", \"assert find_...
{ "split": "train", "index": 73676, "acecode_id": "evol_29475", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function called `modify_list` that accepts three parameters: a text string `prepend_str`, a list of strings `l`, and a string `end_str`. The function should return a list where each string from the input list `l` is prefixed by `prepend_str` and suffixed by `end_str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert modify_list('Sample: ', ['x', 'y', 'z'], ';') == ['Sample: x;', 'Sample: y;', 'Sample: z;']\", \"assert modify_list('Hello ', [], '!') == []\", \"assert modify_list('Test ', ['1', '2', '3'], '?') == ['Test 1?', 'Test 2?', 'Test 3?']\", \"assert modify_list('...
{ "split": "train", "index": 73677, "acecode_id": "evol_13568", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given two lists of numbers, `a` and `b`, both of the same length, write a function `calculate_rmse(a: List[float], b: List[float]) -> float` that calculates the Root Mean Squared Error (RMSE) between the two lists. The RMSE is defined as the square root of the average of the sq...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_rmse([1.0, 2.0, 3.0], [1.0, 2.0, 3.0]) == 0.0\", \"assert calculate_rmse([1.0, 2.0], [2.0, 3.0]) == 1.0\", \"assert calculate_rmse([0.0, 0.0, 0.0], [1.0, 1.0, 1.0]) == 1.0\", \"assert calculate_rmse([3.0, 4.0, 5.0], [1.0, 2.0, 3.0]) == 2.0\", \"ass...
{ "split": "train", "index": 73678, "acecode_id": "bigcode_python_fns_27227", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of items, implement a function `is_data_array(arr: list) -> bool` that returns True if the input list is a valid representation of a data array (i.e., it is a list of numbers). Otherwise, it should return False. For the purpose of this problem, a valid data array m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_data_array([1, 2, 3, 4.5]) == True\", \"assert is_data_array([1, 2, '3', 4]) == False\", \"assert is_data_array([]) == False\", \"assert is_data_array([1, 2, 3, 4]) == True\", \"assert is_data_array([1.0, 2.0, 3.0]) == True\", \"assert is_data_array(['a',...
{ "split": "train", "index": 73679, "acecode_id": "bigcode_python_fns_12037", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with determining if a given hour of a work shift is adequately staffed based on coverage events. Each coverage event is represented as a dictionary with two keys: 'staff_level' (an integer indicating the level of staff provided) and 'duration' (an integer indicat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_hour_staffed([{'staff_level': 2, 'duration': 30}, {'staff_level': 1, 'duration': 15}], [(1, 15)]) == True\", \"assert is_hour_staffed([{'staff_level': 2, 'duration': 60}, {'staff_level': 2, 'duration': 30}], [(2, 30), (2, 60)]) == True\", \"assert is_hour...
{ "split": "train", "index": 73680, "acecode_id": "bigcode_python_fns_25850", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of binary sequences and their corresponding outcomes. Implement a function `binary_sequence_dataset` that takes two lists: `sequences`, which contains lists of binary integers (0s and 1s), and `outcomes`, which contains the corresponding outcomes (strings)....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert binary_sequence_dataset([[0, 1, 0], [1, 1, 0]], ['A', 'B']) == [{'sequence': '0 1 0', 'outcome': 'A'}, {'sequence': '1 1 0', 'outcome': 'B'}]\", \"assert binary_sequence_dataset([[1, 0], [0, 1, 1]], ['X', 'Y']) == [{'sequence': '1 0', 'outcome': 'X'}, {'sequ...
{ "split": "train", "index": 73681, "acecode_id": "evol_2223", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a dictionary of optional configuration parameters. Your function should accept a dictionary with the following optional keys, which should have default values if not provided: \n- 'data_name': Represents the name of the dat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_config({}) == {'data_name': 'default_data_name', 'cache_name': 'DataPrepare_cache.pkl', 'data_root': '/default/data/root', 'version': '1.0'}\", \"assert process_config({'data_name': 'custom_data'}) == {'data_name': 'custom_data', 'cache_name': 'DataP...
{ "split": "train", "index": 73682, "acecode_id": "oss_20650", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string containing a JSON object, write a function `json_string_to_dict(json_string: str) -> dict` that converts the JSON string into a Python dictionary. The function should ensure that all string values in the resulting dictionary are converted from Unicode to ASCII, a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert json_string_to_dict('{\\\"key1\\\": \\\"value1\\\", \\\"key2\\\": \\\"value2\\\"}') == {'key1': 'value1', 'key2': 'value2'}\", \"assert json_string_to_dict('{\\\"nested\\\": {\\\"inner\\\": \\\"value\\\"}}') == {'nested': {'inner': 'value'}}\", \"assert json...
{ "split": "train", "index": 73683, "acecode_id": "bigcode_python_fns_23887", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given three jugs with capacities `jug1Capacity`, `jug2Capacity`, and `jug3Capacity` liters. There is an infinite amount of water supply available. Determine whether it is possible to measure exactly `targetCapacity` liters using these three jugs, and if so, return the m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert minOperations(2, 6, 8, 5) == -1\", \"assert minOperations(1, 1, 1, 1) == 1\", \"assert minOperations(1, 2, 3, 2) == 1\", \"assert minOperations(6, 9, 12, 6) == 1\", \"assert minOperations(2, 4, 5, 3) == 2\", \"assert minOperations(5, 10, 15, 5) == 1\", \"ass...
{ "split": "train", "index": 73684, "acecode_id": "evol_34470", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a JSON string representing a configuration for a graphics application. The function should take two parameters: a list of sprite file paths (as strings) and a dictionary representing settings (with keys such as 'algorithm' ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_parameters_json(['example/path/*.png'], {'algorithm': 'default', 'format': 'png'}) == '{\\\\n \\\"sprites\\\": [\\\\n \\\"example/path/*.png\\\"\\\\n ],\\\\n \\\"settings\\\": {\\\\n \\\"algorithm\\\": \\\"default\\\",\\\\n ...
{ "split": "train", "index": 73685, "acecode_id": "bigcode_python_fns_7965", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that retrieves user information based on a user ID. The function should take a single input parameter, user_id, which is an integer representing the unique identifier of a user. Your function should return a dictionary containing the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_user_info(1) == {'name': 'Alice', 'age': 30, 'email': 'alice@example.com'}\", \"assert get_user_info(2) == {'name': 'Bob', 'age': 25, 'email': 'bob@example.com'}\", \"assert get_user_info(3) == {'name': 'Charlie', 'age': 35, 'email': 'charlie@example.com...
{ "split": "train", "index": 73686, "acecode_id": "bigcode_python_fns_29089", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a learning rate scheduler for a neural network training process. Your function should compute the learning rate for a given epoch based on the following input parameters: \n\n- `epoch`: An integer representing the current epoch number during tra...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_learning_rate(1, 10, 'compound', 'constant*piecewise_constant', [20], [0.1], 0.001) == 0.001\", \"assert compute_learning_rate(1, 10, 'compound', 'constant*piecewise_constant', [10], [0.5], 0.001) == 0.0005\", \"assert compute_learning_rate(2, 10, 'c...
{ "split": "train", "index": 73687, "acecode_id": "oss_20443", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of integers, return the maximum sum of any contiguous subarray within that list. A contiguous subarray is defined as a subarray that consists of consecutive elements in the array. The input list may contain both positive and negative integers. Your task is to imple...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maximum_segment_sum([-5, 2, 6, -4, 5, -6, -4, 3]) == 9\", \"assert maximum_segment_sum([-33, 22, 11, -44]) == 33\", \"assert maximum_segment_sum([-33, 22, 0, 1, -3, 11, -44, 30, -5, -13, 12]) == 31\", \"assert maximum_segment_sum([1, 2, 3, 4, 5]) == 15\", \"...
{ "split": "train", "index": 73688, "acecode_id": "bigcode_python_fns_19207", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a string as input and returns the string reversed. The function should handle alphanumeric characters, special characters, and white spaces correctly. You can assume that the input string will only contain printable ASCII characters.\nPlease reas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_string('hello') == 'olleh'\", \"assert reverse_string('12345') == '54321'\", \"assert reverse_string('!@#$%') == '%$#@!'\", \"assert reverse_string('a b c') == 'c b a'\", \"assert reverse_string('abc! 123') == '321 !cba'\", \"assert reverse_string(''...
{ "split": "train", "index": 73689, "acecode_id": "evol_7492", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of temperature readings (in degrees Celsius) from a temperature sensor. Your task is to implement a function that checks if any temperature in the list exceeds a specified threshold. If any temperature exceeds the threshold, the function should return True;...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_temperature_exceeds_threshold([22.5, 23.0, 24.5, 25.0], 25.0) == False\", \"assert check_temperature_exceeds_threshold([25.1, 26.0, 24.9, 23.0], 25.0) == True\", \"assert check_temperature_exceeds_threshold([20.0, 19.5, 18.0], 21.0) == False\", \"asser...
{ "split": "train", "index": 73690, "acecode_id": "oss_14475", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of command-line arguments and a filename. The function should return a string that combines the command-line arguments into a single space-separated string followed by the suffix '_commandline.txt'. Your function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_command_line(['python', 'script.py', '--option', 'value'], 'output') == 'python script.py --option value_commandline.txt'\", \"assert format_command_line(['ls', '-l', '/home/user'], 'list') == 'ls -l /home/user_commandline.txt'\", \"assert format_comm...
{ "split": "train", "index": 73691, "acecode_id": "bigcode_python_fns_9833", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of projects where each project is represented as a list of three integers: [startDay, endDay, profit]. The project starts at startDay and ends at endDay, and upon completion, it yields a profit specified by the profit value. You are also given an integer n,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxProfit([[1,2,10],[2,3,20],[3,4,30]], 3) == 60\", \"assert maxProfit([[1,2,5],[3,4,10],[5,6,15]], 3) == 30\", \"assert maxProfit([[1,10,100],[2,3,50],[4,5,25]], 2) == 100\", \"assert maxProfit([[1,10,100],[2,3,50]], 1) == 100\", \"assert maxProfit([[1,1,10...
{ "split": "train", "index": 73692, "acecode_id": "evol_33715", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a matrix representing a plate, where each cell is a dictionary containing various properties. The matrix should be of a specified dimension, and one of the cells should be marked as containing a crystal, based on the specif...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_plate((1, 1), (-1, -1)) == [[{'is_in_crystal': True, 'b': 0, 'c': 1, 'd': 0}]]\", \"assert create_plate((2, 2), (0, 0)) == [[{'is_in_crystal': True, 'b': 0, 'c': 1, 'd': 0}, {'is_in_crystal': False, 'b': 0, 'c': 0, 'd': 1}], [{'is_in_crystal': False, ...
{ "split": "train", "index": 73693, "acecode_id": "bigcode_python_fns_15074", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given a 2D list (matrix) of integers, representing a collection of samples and their features. You need to write a function that takes this matrix and a list of descriptions, and returns a new matrix with an additional first column called 'Description'. This first colum...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_description_column([[1, 2], [3, 4]], ['Sample1', 'Sample2']) == [['Sample1', 1, 2], ['Sample2', 3, 4]]\", \"assert add_description_column([[1, 2]], []) == [['0', 1, 2]]\", \"assert add_description_column([], ['Sample1']) == []\", \"assert add_description...
{ "split": "train", "index": 73694, "acecode_id": "bigcode_python_fns_22768", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a custom data type in Python that can be serialized to and from string format. Your goal is to implement a function that takes a string representation of a custom data type and converts it to an instance of that type. Additionally, you need to imple...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_custom_type('Alice:30') == ('Alice', 30)\", \"assert convert_custom_type('Bob:25') == ('Bob', 25)\", \"assert convert_custom_type('Charlie:40') == ('Charlie', 40)\", \"assert convert_custom_type('Dana:20') == ('Dana', 20)\", \"assert convert_custom_t...
{ "split": "train", "index": 73695, "acecode_id": "oss_35560", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes project names and manages them within pipelines. Each project is represented by a name and a pipeline name. Your function should take a project name and a pipeline name as input and perform the following actions: 1. If ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_project('Project Alpha', 'Pipeline One') == (None, ['Pipeline One', 'Project Alpha'])\", \"assert process_project('Project Alpha Beta', 'Pipeline One') == ('Beta', ['Pipeline One', 'Project Alpha Beta'])\", \"assert process_project('SinglePart', 'Pip...
{ "split": "train", "index": 73696, "acecode_id": "oss_26169", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of buildings in a city. Your task is to write a function that calculates the number of buildings that can see the sunset. A building can see the sunset if all the buildings to its right are shorter than it. Return the co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_buildings([3, 7, 8, 3, 6, 1]) == 3\", \"assert count_buildings([2, 2, 2, 2]) == 1\", \"assert count_buildings([1]) == 1\", \"assert count_buildings([5, 6, 5, 6, 5]) == 2\", \"assert count_buildings([]) == 0\", \"assert count_buildings([10, 9, 11, 12, 8...
{ "split": "train", "index": 73697, "acecode_id": "bigcode_python_fns_28661", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given the root node of a binary tree and an integer target_depth, implement a function that returns a list of all node values at the specified depth. If the target depth exceeds the actual depth of the tree, return an empty list. If the target depth is less than 1, also return ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_nodes_at_depth(None, 1) == []\", \"assert get_nodes_at_depth(Node(1), 1) == [1]\", \"assert get_nodes_at_depth(Node(1), 2) == []\", \"assert get_nodes_at_depth(Node(1, Node(2)), 1) == [1]\", \"assert get_nodes_at_depth(Node(1, Node(2)), 2) == [2]\", \"as...
{ "split": "train", "index": 73698, "acecode_id": "evol_16444", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `del2(M: List[List[float]]) -> List[List[float]]` that calculates the second derivative of a 2D matrix M using finite differences. The output should be a matrix of the same dimensions as M, where the boundary values are set to zero. The function should work...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert del2([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]\", \"assert del2([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]\", \"assert del2([[1, 2], [3, 4]]) == [[0.0, 0.0], [0.0,...
{ "split": "train", "index": 73699, "acecode_id": "evol_22635", "num_tests": 9 }