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 given four lists: rabi_rates, azimuthal_angles, detunings, and durations. Each list contains numerical values representing different parameters of a driven control. Your task is to implement a function `export_plot_data(rabi_rates, azimuthal_angles, detunings, durations... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert export_plot_data([3.14, 6.28, 3.14], [0, 1.57, -1.57], [0, 1, 0], [1, 1.25, 1.5]) == {'X amplitude': [{'duration': 1, 'value': 3.14}, {'duration': 1.25, 'value': 6.28}, {'duration': 1.5, 'value': 3.14}], 'Y amplitude': [{'duration': 1, 'value': 0}, {'duratio... | {
"split": "train",
"index": 66000,
"acecode_id": "bigcode_python_fns_37514",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given two strings, str1 and str2, write a function that calculates the minimum edit distance between the two strings. The edit distance is defined as the minimum number of operations required to convert str1 into str2, where an operation is defined as an insertion, deletion, or... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert min_edit_distance('kitten', 'sitting') == 3\", \"assert min_edit_distance('flaw', 'lawn') == 2\", \"assert min_edit_distance('intention', 'execution') == 5\", \"assert min_edit_distance('abc', 'abc') == 0\", \"assert min_edit_distance('abc', 'ab') == 1\", \"... | {
"split": "train",
"index": 66001,
"acecode_id": "bigcode_python_fns_42739",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `charCount(s: str) -> Dict[str, int]` that takes a string `s` as input and returns a dictionary representing the count of each unique alphabetical character in the string. The function should be case-sensitive, meaning 'A' and 'a' are considered different c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert charCount('Hello World') == {'H': 1, 'e': 1, 'l': 3, 'o': 2, 'W': 1, 'r': 1, 'd': 1}\", \"assert charCount('') == {}\", \"assert charCount('abcABC') == {'a': 1, 'b': 1, 'c': 1, 'A': 1, 'B': 1, 'C': 1}\", \"assert charCount('1234!@#$%^&*()') == {}\", \"assert... | {
"split": "train",
"index": 66002,
"acecode_id": "evol_18248",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a min-heap data structure in Python. A min-heap is a complete binary tree where each node's value is less than or equal to its children's values. Implement a function `insert_to_heap` that takes a list of integers and inserts each integer into a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insert_to_heap([5, 3, 8]) == [3, 5, 8]\", \"assert insert_to_heap([10, 20, 15]) == [10, 20, 15]\", \"assert insert_to_heap([1, 1, 1]) == [1, 1, 1]\", \"assert insert_to_heap([9, 3, 7, 1, 5]) == [1, 3, 7, 9, 5]\", \"assert insert_to_heap([4]) == [4]\", \"asse... | {
"split": "train",
"index": 66003,
"acecode_id": "oss_32347",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of file paths and identifies which of those paths are considered 'anomalous'. A path is considered anomalous if it contains a 'None' reference. Your function should return a list of these anomalous paths. The function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_anomalous_paths(['file1.txt', 'file2.txt', 'file3.txt']) == []\", \"assert find_anomalous_paths(['file1.txt', 'None', 'file3.txt']) == ['None']\", \"assert find_anomalous_paths(['None', 'None', 'file3.txt']) == ['None', 'None']\", \"assert find_anomalou... | {
"split": "train",
"index": 66004,
"acecode_id": "bigcode_python_fns_4152",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that receives a list of integers and returns a new list containing the squares of each number. The function should handle both positive and negative integers. The output list should maintain the same order as the input list. The fu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert square_numbers([1, 2, 3]) == [1, 4, 9]\", \"assert square_numbers([-1, -2, -3]) == [1, 4, 9]\", \"assert square_numbers([0]) == [0]\", \"assert square_numbers([5]) == [25]\", \"assert square_numbers([-5]) == [25]\", \"assert square_numbers([]) == []\", \"ass... | {
"split": "train",
"index": 66005,
"acecode_id": "oss_4902",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function to manage patient information for a medical database. The function should take in the following parameters: surname, forename, address, sex, date of birth, date of acceptance, and date of completion. The function should return a dictionar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_patient_info('SMITH', 'JOHN', ['123 MAIN ST'], 'M', '1980-01-01', '2022-01-01', '2022-12-31') == {'surname': 'SMITH', 'forename': 'JOHN', 'address': ['123 MAIN ST'], 'sex': 'M', 'date_of_birth': '1980-01-01', 'date_of_acceptance': '2022-01-01', 'date_... | {
"split": "train",
"index": 66006,
"acecode_id": "oss_34477",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the deletion of a data bundle from an internal storage system. The function should take a dictionary containing various parameters, including a mandatory 'data_bundle_id' which represents the unique identifier of the da... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert delete_data_bundle(data_bundle_id=1) == ({'data_bundle_id': 1}, 200)\", \"assert delete_data_bundle(data_bundle_id=2) == ({'data_bundle_id': 2}, 200)\", \"assert delete_data_bundle(data_bundle_id=3) == ({'data_bundle_id': 3}, 200)\", \"assert delete_data_bun... | {
"split": "train",
"index": 66007,
"acecode_id": "bigcode_python_fns_6069",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function called `grade_converter` that accepts a numerical rating between 1 and 100 (inclusive) and returns the corresponding symbolic academic grade based on the following mapping: 'A' for ratings between 90 and 100, 'B' for ratings between 80 and 89, 'C' for ratin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert grade_converter(95) == 'A'\", \"assert grade_converter(85) == 'B'\", \"assert grade_converter(75) == 'C'\", \"assert grade_converter(65) == 'D'\", \"assert grade_converter(55) == 'F'\", \"assert grade_converter(100) == 'A'\", \"assert grade_converter(89) == ... | {
"split": "train",
"index": 66008,
"acecode_id": "evol_4006",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `is_palindrome(s: str) -> bool` that determines whether the given string `s` is a palindrome. A string is considered a palindrome if it reads the same forward and backward, ignoring spaces and punctuation. The function should return `True` if `s` is a palindrom... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_palindrome('racecar') == True\", \"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('') == True\", \"assert is_palindrome('hello') == False\", \"assert is_palindrome('Able was I ere I saw Elba') == True\", \"assert ... | {
"split": "train",
"index": 66009,
"acecode_id": "evol_17159",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of floating-point numbers and returns a new list containing only the unique values from the input list, sorted in ascending order. Write a function `unique_sorted` that takes a list of floats as input and returns a l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_sorted([3.1, 2.2, 3.1, 1.0, 2.2]) == [1.0, 2.2, 3.1]\", \"assert unique_sorted([1.5, 1.5, 1.5, 1.5]) == [1.5]\", \"assert unique_sorted([]) == []\", \"assert unique_sorted([5.0, 4.5, 4.5, 3.2, 5.0]) == [3.2, 4.5, 5.0]\", \"assert unique_sorted([7.8, 7... | {
"split": "train",
"index": 66010,
"acecode_id": "oss_35647",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to calculate the Kullback-Leibler (KL) divergence between a true probability distribution and an estimated probability distribution. The KL divergence is a measure of how one probability distribution diverges from a second, expected p... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert abs(kl_divergence(0.5, 0.5) - 0.0) < 1e-9\", \"assert abs(kl_divergence(0.0, 0.0) - 0.0) < 1e-9\", \"assert abs(kl_divergence(1.0, 1.0) - 0.0) < 1e-9\", \"assert abs(kl_divergence(0.3, 0.3) - 0.0) < 1e-9\", \"assert abs(kl_divergence(0.1, 0.1) - 0.0) < 1e-9\... | {
"split": "train",
"index": 66011,
"acecode_id": "oss_23031",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that performs data type conversion based on the type of the input. The function should handle three cases: if the input is a list, it should convert each element of the list using a provided conversion function; if the input is a Unic... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert data_type_conversion([\\\"1\\\", \\\"2\\\", \\\"3\\\"], int) == [1, 2, 3]\", \"assert data_type_conversion([\\\"a\\\", \\\"b\\\", \\\"c\\\"], str.upper) == [\\\"A\\\", \\\"B\\\", \\\"C\\\"]\", \"assert data_type_conversion([1, 2, 3], str) == [\\\"1\\\", \\\"... | {
"split": "train",
"index": 66012,
"acecode_id": "oss_16061",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of financial transactions to determine the final balance of an account. Each transaction is represented as a string in the format 'transaction_type amount', where 'transaction_type' can either be 'deposit' or 'wi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_transactions(['deposit 100', 'withdraw 50', 'deposit 20']) == 70\", \"assert process_transactions(['withdraw 30', 'deposit 100', 'withdraw 70']) == 0\", \"assert process_transactions(['deposit 50', 'withdraw 50', 'withdraw 10']) == -10\", \"assert pr... | {
"split": "train",
"index": 66013,
"acecode_id": "oss_995",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of integers and returns a new list containing only the even numbers from the original list, maintaining their order. If there are no even numbers, return an empty list. Write a function `filter_even_numbers(nums: Lis... | 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]) == [10, 20]\", \"assert filter_even_numbers([0, 1, 2, 3, 4]) == [0, 2, 4]\", \"assert filter_even_numbers([7, 9, 11]) == []\", \"assert filter_even_numbers([-2, ... | {
"split": "train",
"index": 66014,
"acecode_id": "bigcode_python_fns_18182",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries representing geographical data points, with each dictionary containing the keys: 'LocalityName', 'NptgLocalityCode', 'AreaName', 'StopAreaCode', 'Latitude', and 'Longitude'. Write a function that groups these data points by 'LocalityName' an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert average_coordinates([{'LocalityName': 'A', 'Latitude': 1.0, 'Longitude': 1.0}, {'LocalityName': 'A', 'Latitude': 2.0, 'Longitude': 2.0}]) == [{'LocalityName': 'A', 'AverageLatitude': 1.5, 'AverageLongitude': 1.5}]\", \"assert average_coordinates([{'LocalityN... | {
"split": "train",
"index": 66015,
"acecode_id": "bigcode_python_fns_16174",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a request object and returns a dictionary containing two key-value pairs. The first key should be 'messages', which is a list of messages extracted from the request object. The second key should be 'DEFAULT_MESSAGE_LEVELS', whi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_response(MockRequest(['Hello', 'World'])) == {'messages': ['Hello', 'World'], 'DEFAULT_MESSAGE_LEVELS': ['info', 'warning', 'error']}\", \"assert get_response(MockRequest(['Test'])) == {'messages': ['Test'], 'DEFAULT_MESSAGE_LEVELS': ['info', 'warning', ... | {
"split": "train",
"index": 66016,
"acecode_id": "bigcode_python_fns_26724",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a 3x3 depthwise convolution operation. The function should take the following parameters: in_channels (int), out_channels (int), stride (int or tuple/list of 2 int), padding (int or tuple/list of 2 int, default 1), dila... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert depthwise_conv_params(1, 1, 1) == {'in_channels': 1, 'out_channels': 1, 'stride': 1, 'padding': 1, 'dilation': 1, 'bias': False, 'activation': 'ReLU', 'activate': True, 'groups': 1}\", \"assert depthwise_conv_params(3, 6, (2, 2)) == {'in_channels': 3, 'out_c... | {
"split": "train",
"index": 66017,
"acecode_id": "bigcode_python_fns_7437",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes an array of strings and sorts it in lexicographic order. If the array contains any duplicate strings, return an error message instead of the sorted array. The function should only return the sorted array if there are no duplicates. Write a functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_strings(['apple', 'banana', 'cherry']) == ['apple', 'banana', 'cherry']\", \"assert sort_strings(['grape', 'apple', 'kiwi']) == ['apple', 'grape', 'kiwi']\", \"assert sort_strings(['zebra', 'lion', 'tiger']) == ['lion', 'tiger', 'zebra']\", \"assert sor... | {
"split": "train",
"index": 66018,
"acecode_id": "evol_4769",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that returns the string representation of a geometric shape's name and its area. The function should take three parameters: the type of shape (a string), and the corresponding dimensions needed to calculate the area. The types of shapes c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert shape_representation('Circle', 5) == 'Shape: Circle, Area: 78.54'\", \"assert shape_representation('Rectangle', 4, 6) == 'Shape: Rectangle, Area: 24.00'\", \"assert shape_representation('Triangle', 3, 4) == 'Shape: Triangle, Area: 6.00'\", \"assert shape_rep... | {
"split": "train",
"index": 66019,
"acecode_id": "oss_953",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a collection of tensor data represented as a list of tuples. Each tuple contains a wall time (float), a step (int), a value (float), a group (string), and a variable (string). Your goal is to combine all tensor data from multiple groups into a sin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_tensors([(1.0, 1, 0.5, 'train', 'loss'), (0.5, 1, 0.6, 'valid', 'loss')]) == [(0.5, 1, 0.6, 'valid', 'loss'), (1.0, 1, 0.5, 'train', 'loss')]\", \"assert sort_tensors([(3.0, 2, 0.2, 'train', 'metric1'), (1.0, 1, 0.5, 'train', 'loss'), (2.0, 1, 0.4, 'val... | {
"split": "train",
"index": 66020,
"acecode_id": "bigcode_python_fns_47443",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a function that finds common elements from four distinct arrays, a1, a2, a3, and a4. The function should return a list of elements that are identical at the same index in all four arrays. The output should only include elements up to the length of the shortest array, an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert common_elements([1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]) == [1, 2, 3]\", \"assert common_elements(['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c']) == ['a', 'b', 'c']\", \"assert common_elements([1, 2, 3], [4, 5, 6], [1, 5, 3], [1, 2, 3]... | {
"split": "train",
"index": 66021,
"acecode_id": "evol_30763",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a string containing a numerical expression (e.g., '3 + 2 * (1 - 5)') and returns the evaluated result of that expression. The expression will only contain non-negative integers, basic arithmetic operators (+, -, *, /), and parentheses. You should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_expression('10 / 2 + 5') == 10.0\", \"assert calculate_expression('2 * (3 + 4)') == 14\", \"assert calculate_expression('10 - 2 * 5 + 7') == 7\", \"assert calculate_expression('5 + (6 / 3)') == 7.0\", \"assert calculate_expression('2 + 3 * 4') == 1... | {
"split": "train",
"index": 66022,
"acecode_id": "evol_24381",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given three lists: X, y, and y_hat. The list X contains a set of input data points, the list y contains the actual output data points that correspond to the input data points in X, and the list y_hat contains predicted output values corresponding to the same input data ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert abs(calculate_rmse([1, 2, 3], [1, 1, 1], [1, 1, 1]) - 0.0) < 1e-9\", \"assert abs(calculate_rmse([1, 2], [2, 2], [2, 2]) - 0.0) < 1e-9\", \"assert abs(calculate_rmse([1, 2, 3], [1, 2, 3], [1, 2, 3]) - 0.0) < 1e-9\", \"assert abs(calculate_rmse([1, 2, 3], [1,... | {
"split": "train",
"index": 66023,
"acecode_id": "oss_20956",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given an integer n, return a list of all prime factors of n, treating multiple factors as separate entities, sorted in descending order. Implement this in a memory-efficient manner. Constraints: 2 <= n <= 10^18.\nPlease reason step by step, then write a self-contained Python so... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prime_factors_descending(18) == [3, 3, 2]\", \"assert prime_factors_descending(84) == [7, 3, 2, 2]\", \"assert prime_factors_descending(45) == [5, 3, 3]\", \"assert prime_factors_descending(99) == [11, 3, 3]\", \"assert prime_factors_descending(60) == [5, 3,... | {
"split": "train",
"index": 66024,
"acecode_id": "evol_17839",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of file extensions as strings, and your task is to categorize them into different groups based on their type. Specifically, count how many times the extension 'debpackage' appears, how many times 'file' appears, and how many extensions do not belong to eith... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert categorize_file_extensions(['debpackage', 'file', 'txt', 'debpackage', 'jpg', 'file', 'debpackage']) == {'debpackage': 3, 'file': 2, 'unknown': 2}\", \"assert categorize_file_extensions(['file', 'file', 'file']) == {'debpackage': 0, 'file': 3, 'unknown': 0}\... | {
"split": "train",
"index": 66025,
"acecode_id": "oss_15274",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with validating a set of parameters used for writing header and data files in a specific format. Your function should take four parameters: 'vhdr_fname', 'vmrk_fname', 'eeg_fname', and 'raw', where 'raw' is a dictionary containing the data to be written. The func... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_file_params('header.vhdr', 'marker.vmrk', 'data.eeg', {'orientation': 'horizontal', 'format': 'float'}) == True\", \"assert validate_file_params('header.vhdr', 'marker.vmrk', 'data.eeg', {'orientation': 'vertical', 'format': 'int'}) == True\", \"ass... | {
"split": "train",
"index": 66026,
"acecode_id": "bigcode_python_fns_8043",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `reverse_list(items)` that returns a new list containing the elements of the input list in reverse order. You should not use any built-in functions for reversing the list. The input list may contain any integers, and you need to re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_list([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\", \"assert reverse_list([10, 20, 30]) == [30, 20, 10]\", \"assert reverse_list([0]) == [0]\", \"assert reverse_list([-1, -2, -3]) == [-3, -2, -1]\", \"assert reverse_list([1]) == [1]\", \"assert reverse_list(... | {
"split": "train",
"index": 66027,
"acecode_id": "evol_17428",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that performs a Bubble Sort on a list of integers, rearranging the list in increasing order. The function should take a list of integers as input and return a new list that contains the same integers sorted in ascending order. Do not use any built-in sortin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bubble_sort([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]\", \"assert bubble_sort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert bubble_sort([5]) == [5]\", \"assert bubble_sort([]) == []\", \"assert bubble_sort([3, 3, 3]) == [3, 3, 3]\", \"assert bubble_sort([10, -1,... | {
"split": "train",
"index": 66028,
"acecode_id": "evol_11208",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `set_actor_attributes(user_id: int, sender: str, instance: dict, signal_duid: str, remote_addr: str, additional_request_data: dict) -> None` that updates the `instance` dictionary based on the provided parameters. If the `sender` is 'L... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_actor_attributes(1, 'LogEntry', {'actor': None, 'remote_addr': '', 'additional_request_data': {}, 'signal_duid': '123'}, '123', '192.168.1.1', {'key': 'value'}) == None\", \"assert set_actor_attributes(2, 'LogEntry', {'actor': None, 'remote_addr': '', 'a... | {
"split": "train",
"index": 66029,
"acecode_id": "bigcode_python_fns_24247",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string and two other strings, one representing a substring to find and the other representing a substring to replace it with. Write a function `replace_substring` that takes in a string `text`, a string `find`, and a string `replace`. The function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert replace_substring('hello world', 'world', 'there') == 'hello there'\", \"assert replace_substring('hello hello', 'hello', 'hi') == 'hi hi'\", \"assert replace_substring('abcabcabc', 'abc', 'xyz') == 'xyzxyzxyz'\", \"assert replace_substring('test string', 'T... | {
"split": "train",
"index": 66030,
"acecode_id": "bigcode_python_fns_11000",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two integers 'a' and 'b', implement a function that finds the length of the longest sequence of consecutive prime numbers generated by the function defined as: f(n) = n^2 + a*n + b, where n starts at 0 and increments by 1. The function should continue generating numbers u... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prime_sequence_length(1, 41) == 40\", \"assert prime_sequence_length(-79, 1601) == 80\", \"assert prime_sequence_length(5, 7) == 2\", \"assert prime_sequence_length(1, 2) == 1\", \"assert prime_sequence_length(-2, 2) == 1\"]}"
} | {
"split": "train",
"index": 66031,
"acecode_id": "oss_18878",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given three positive integers a, b, and c, implement a function to calculate the Least Common Multiple (LCM) of these three integers. The integers are guaranteed to be within the range of 32-bit signed integer values. You need to implement the function `lcm(a: int, b: int, c: i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lcm(2, 3, 5) == 30\", \"assert lcm(1, 1, 1) == 1\", \"assert lcm(4, 5, 6) == 60\", \"assert lcm(7, 14, 21) == 42\", \"assert lcm(8, 12, 16) == 48\", \"assert lcm(9, 10, 25) == 450\", \"assert lcm(3, 7, 11) == 231\", \"assert lcm(12, 15, 18) == 180\", \"asser... | {
"split": "train",
"index": 66032,
"acecode_id": "evol_30371",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `update_file` that simulates the process of updating a file in a management system. The function takes the following parameters: \n- `instance_id` (int): The ID of the instance in which the file is being updated. \n- `file_id` (int): The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_file(1, 101, 'file.txt', None, False, False) == {'changed': True}\", \"assert update_file(1, 101, None, 'File contents', False, False) == {'changed': True}\", \"assert update_file(1, 101, 'file.txt', 'File contents', False, False) == {'changed': True}... | {
"split": "train",
"index": 66033,
"acecode_id": "bigcode_python_fns_5463",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates build settings for an AppleScript build phase in an Xcode project. The function should return a dictionary containing the build settings specific to the AppleScript build phase. The dictionary must include the following... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_build_settings() == {'bundleid': 'com.apple.buildphase.applescript', 'phase_type': 'AppleScript', 'script_file': 'script.scpt', 'compiler_flags': ['-O', '-Werror']}\", \"assert generate_build_settings()['bundleid'] == 'com.apple.buildphase.applescri... | {
"split": "train",
"index": 66034,
"acecode_id": "oss_36969",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of tasks where each task is a string. The function should take a list of strings as input and return a new list where each string in the input list is suffixed with the phrase ' processed'. Your function should handl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_tasks([]) == []\", \"assert process_tasks(['Task 1']) == ['Task 1 processed']\", \"assert process_tasks(['Task 1', 'Task 2']) == ['Task 1 processed', 'Task 2 processed']\", \"assert process_tasks(['Single Task']) == ['Single Task processed']\", \"ass... | {
"split": "train",
"index": 66035,
"acecode_id": "oss_8935",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that combines parameters from two lists: `left_sided_parameters` and `parent_fusion_parameters`. Your function should return a list containing the elements from `left_sided_parameters` that are not present in `parent_fusion_parameters... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_fusion_parameters([2, 4, 6, 8], [4, 8, 10]) == [2, 6, 1]\", \"assert generate_fusion_parameters([1, 2, 3], [4, 5, 6]) == [1, 2, 3, 1]\", \"assert generate_fusion_parameters([], [1, 2, 3]) == [1]\", \"assert generate_fusion_parameters([10, 20, 30], [... | {
"split": "train",
"index": 66036,
"acecode_id": "oss_15293",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of product dictionaries and returns a list of serialized product dictionaries. Each product dictionary contains the following fields: 'name' (string), 'price' (float), 'description' (string), and 'category' (string). You... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert serialize_products([]) == []\", \"assert serialize_products([{'name': 'Product A', 'price': 10.99, 'description': 'Description A', 'category': 'Category 1'}]) == [{'name': 'Product A', 'price': 10.99, 'description': 'Description A'}]\", \"assert serialize_pr... | {
"split": "train",
"index": 66037,
"acecode_id": "oss_8471",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that counts the number of occurrences of a specific error message in a list of test failures. The input to the function is a list of strings representing error messages and a string representing the specific error message to count. Yo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_error_occurrences(['Error A', 'Error B', 'Error A', 'Error C'], 'Error A') == 2\", \"assert count_error_occurrences(['Error A', 'Error A', 'Error A'], 'Error A') == 3\", \"assert count_error_occurrences(['Error B', 'Error C', 'Error D'], 'Error A') == ... | {
"split": "train",
"index": 66038,
"acecode_id": "oss_17764",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of dictionaries representing vote data from multiple locations in an election and returns the candidate(s) with the highest total votes along with the maximum vote count. Each dictionary maps candidate names to the number of votes they rec... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_election_results([{'Charlie': 150, 'David': 150}, {'Charlie': 200, 'David': 200}, {'Charlie': 250, 'David': 250}]) == (['Charlie', 'David'], 600)\", \"assert get_election_results([{'Eve': 50}, {'Eve': 20}]) == (['Eve'], 70)\", \"assert get_election_resul... | {
"split": "train",
"index": 66039,
"acecode_id": "evol_32907",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the number of items in various repositories. Implement a function `max_items(repositories: List[int]) -> int` that returns the maximum number of items in any single repository. If the list is empty, return 0. Your function should ha... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_items([1, 2, 3, 4, 5]) == 5\", \"assert max_items([-1, -2, -3, -4, -5]) == -1\", \"assert max_items([5, 3, 8, 1, 2]) == 8\", \"assert max_items([]) == 0\", \"assert max_items([-10, -5, -3, 0]) == 0\", \"assert max_items([0, 0, 0]) == 0\", \"assert max_it... | {
"split": "train",
"index": 66040,
"acecode_id": "bigcode_python_fns_33205",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a mapping of entities to decision variable names for an optimization model. Write a function `create_entity_variables(entities)` that takes a list of strings representing entities as input and returns a dictionary. The keys of the dictionary should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_entity_variables(['entity1', 'entity2', 'entity3']) == {'entity1': 'y1', 'entity2': 'y2', 'entity3': 'y3'}\", \"assert create_entity_variables(['a', 'b', 'c']) == {'a': 'y1', 'b': 'y2', 'c': 'y3'}\", \"assert create_entity_variables(['itemA', 'itemB']... | {
"split": "train",
"index": 66041,
"acecode_id": "oss_16628",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that merges a list of strings by alternating the characters from the strings while reversing the order of the strings and skipping any non-alphabetical characters. The function should take a list of strings as input and return a single merged string. If the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert tailored_merge([]) == ''\", \"assert tailored_merge(['a', 'b', 'c']) == 'cba'\", \"assert tailored_merge(['1a2', '3b4', '5c6']) == 'cba'\", \"assert tailored_merge(['a', 'a', 'a']) == 'aaa'\", \"assert tailored_merge(['1', '2', '3']) == ''\", \"assert tailor... | {
"split": "train",
"index": 66042,
"acecode_id": "evol_19420",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a string sentence and an integer num, implement a function that returns a new string where each word in the sentence is repeated num times, preserving the original order of the words. The words should be separated by a single space in the resulting string.\nPlease reason ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert repeat_words_in_sentence('LeetCode', 1) == 'LeetCode'\", \"assert repeat_words_in_sentence('', 5) == ''\", \"assert repeat_words_in_sentence('One two three', 1) == 'One two three'\", \"assert repeat_words_in_sentence(' Mixed spaces here ', 1) == 'Mi... | {
"split": "train",
"index": 66043,
"acecode_id": "evol_724",
"num_tests": 6
} |
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 numbers from the input list. The function should maintain the order of the even numbers as they appear in the original list. Implement the function `filt... | 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]) == [10, 20]\", \"assert filter_even_numbers([0, -2, -4, 3]) == [0, -2, -4]\", \"assert filter_even_numbers([-1, -3, -5]) == []\", \"assert filter_even_numbers([1... | {
"split": "train",
"index": 66044,
"acecode_id": "oss_16357",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with evaluating the total operational and maintenance (O&M) costs for offshore wind turbine components. Write a function `calculate_total_cost(turbine_cost: float, machine_rating: float, turbine_number: int, project_lifetime: float) -> float` that calculates the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_total_cost(100000.0, 1500.0, 100, 20.0) == 200000000.0\", \"assert calculate_total_cost(200000.0, 2000.0, 50, 15.0) == 150000000.0\", \"assert calculate_total_cost(50000.0, 1200.0, 200, 10.0) == 100000000.0\", \"assert calculate_total_cost(75000.0,... | {
"split": "train",
"index": 66045,
"acecode_id": "oss_36789",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that checks if a given string is a palindrome, ignoring case, punctuation, spaces, and special characters. The function should return True if the string is a palindrome and False otherwise. A palindrome is a word, phrase, number, or other sequence of cha... | 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('Was it a car or a cat I saw?') == True\", \"assert is_palindrome('Hello, W... | {
"split": "train",
"index": 66046,
"acecode_id": "evol_21076",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function called `cleanup_databases()` that simulates a database cleanup operation. The function should return a boolean value indicating whether the cleanup operation should ignore any existing databases at the start of the operation. Specifically... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cleanup_databases() == False\", \"assert isinstance(cleanup_databases(), bool) == True\", \"assert cleanup_databases() is not None\", \"assert cleanup_databases() != True\", \"assert cleanup_databases() == False\", \"assert cleanup_databases() == False\", \"... | {
"split": "train",
"index": 66047,
"acecode_id": "bigcode_python_fns_36675",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two date strings in the format 'YYYY-MM-DD', write a function that returns a random date string between these two dates (inclusive). If the input is invalid or the start date is after the end date, the function should return 'Invalid input'. The function should handle edg... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert random_date_between('2022-01-01', '2022-01-10') in ['2022-01-01', '2022-01-02', '2022-01-03', '2022-01-04', '2022-01-05', '2022-01-06', '2022-01-07', '2022-01-08', '2022-01-09', '2022-01-10']\", \"assert random_date_between('2020-02-28', '2020-03-01') in ['2... | {
"split": "train",
"index": 66048,
"acecode_id": "bigcode_python_fns_48275",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a Skype username as input and returns the complete URL needed to access the Skype API for that user. The function should concatenate a predefined Skype API endpoint with the provided username. Write a function called `construct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert construct_skype_api_url('john_doe') == 'https://api.skype.com/userinfo?username=john_doe'\", \"assert construct_skype_api_url('alice123') == 'https://api.skype.com/userinfo?username=alice123'\", \"assert construct_skype_api_url('user_test') == 'https://api.s... | {
"split": "train",
"index": 66049,
"acecode_id": "oss_18073",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function named 'enhanced_vowels_count' that takes a string as input and returns the total number of vowels in that string. The function should consider the following vowels: 'a', 'e', 'i', 'o', 'u' (including their uppercase versions), as well as non-English vowels ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert enhanced_vowels_count('abcde') == 2\", \"assert enhanced_vowels_count('\\u00e9xampl\\u00eb') == 3\", \"assert enhanced_vowels_count('p@ssw0rd') == 0\", \"assert enhanced_vowels_count('B\\u00e9b\\u00e9') == 2\", \"assert enhanced_vowels_count('Caf\\u00e9') ==... | {
"split": "train",
"index": 66050,
"acecode_id": "evol_35914",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that checks the validity of a URL format. The function should take a URL as input and return a message indicating whether the URL is valid or invalid. A URL is considered valid if it starts with 'http://' or 'https://' and contains... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_url('https://www.google.com') == 'The URL https://www.google.com is valid'\", \"assert validate_url('http://example.org') == 'The URL http://example.org is valid'\", \"assert validate_url('https://example.com/path') == 'The URL https://example.com/p... | {
"split": "train",
"index": 66051,
"acecode_id": "oss_27978",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string representing the output of a command-line tool, write a function that determines if the output indicates that the tool is deprecated. The output contains the word 'DEPRECATED' if the tool is deprecated. Your function should return `True` if the word 'DEPRECATED' ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_tool_deprecated('This is the output of the tool DEPRECATED.') == True\", \"assert is_tool_deprecated('The tool is functioning properly.') == False\", \"assert is_tool_deprecated('DEPRECATED: This tool is no longer supported.') == True\", \"assert is_tool_... | {
"split": "train",
"index": 66052,
"acecode_id": "bigcode_python_fns_30508",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `check_number(num)` that checks if a given integer `num` is within the range of 1 to 10 (inclusive). The function should return `True` if `num` is within the range, and `False` otherwise.\nPlease reason step by step, then write a self-contained Python solut... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_number(1) == True\", \"assert check_number(5) == True\", \"assert check_number(10) == True\", \"assert check_number(0) == False\", \"assert check_number(11) == False\", \"assert check_number(-1) == False\", \"assert check_number(2) == True\", \"assert ... | {
"split": "train",
"index": 66053,
"acecode_id": "evol_28353",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two strings, write a function that finds the longest common substring between them. A substring is defined as a contiguous sequence of characters within a string. If there are multiple substrings of the same maximum length, return the first one encountered. If there is no... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_common_substring('abc', 'abc') == 'abc'\", \"assert longest_common_substring('abcdef', 'zabcf') == 'abc'\", \"assert longest_common_substring('xyz', 'xyzabc') == 'xyz'\", \"assert longest_common_substring('abcdxyz', 'xyzabcd') == 'abcd'\", \"assert l... | {
"split": "train",
"index": 66054,
"acecode_id": "evol_3046",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `get_group_id(api)` that takes an object `api` with two attributes: `gid` (a string representing a group name) and `uid` (an integer representing a user ID). The function should return the group ID (GID) associated with the user or gr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_group_id({'gid': 'admin', 'uid': 1001}) == 1000\", \"assert get_group_id({'gid': 'users', 'uid': 1002}) == 1001\", \"assert get_group_id({'gid': 'admin', 'uid': None}) == 1000\", \"assert get_group_id({'gid': None, 'uid': 1002}) == 1001\", \"assert get_g... | {
"split": "train",
"index": 66055,
"acecode_id": "oss_19141",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Implement a function that merges two sorted lists into one sorted list without using built-in functions. The function should take two lists as input and return a new list that contains all the elements from both input lists in sorted order.\nPlease reason step by step, then wri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_two_lists([1, 2, 3], [4, 5, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert merge_two_lists([1, 3, 5], [2, 4, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert merge_two_lists([], []) == []\", \"assert merge_two_lists([], [1, 2, 3]) == [1, 2, 3]\", \"assert merge_two_lists(... | {
"split": "train",
"index": 66056,
"acecode_id": "evol_8995",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a unit's base speed, weapon weight, and a specific attack speed calculation method, write a function `calculate_attack_speed(base_speed: int, weapon_weight: int, method: str) -> int` that calculates the unit's Attack Speed based on the following methods: \n\n1. 'SPEED': R... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_attack_speed(10, 5, 'SPEED') == 10\", \"assert calculate_attack_speed(10, 5, 'SPEED_MINUS_WEIGHT') == 5\", \"assert calculate_attack_speed(15, 3, 'SPEED') == 15\", \"assert calculate_attack_speed(15, 3, 'SPEED_MINUS_WEIGHT') == 12\", \"assert calcu... | {
"split": "train",
"index": 66057,
"acecode_id": "bigcode_python_fns_35785",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Implement a function `binary_search` that takes a list of sorted numbers (which may include integers and floating point numbers with up to ten decimal places) and a target number. The function should return the index of the first occurrence of the target in the list. If the tar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert binary_search([], 1) == -1\", \"assert binary_search([1], 1) == 0\", \"assert binary_search([1], 2) == -1\", \"assert binary_search([1, 1, 1, 1], 1) == 0\", \"assert binary_search([1, 2, 3, 4, 5], 3) == 2\", \"assert binary_search([1, 2, 3, 4, 5], 6) == -1\"... | {
"split": "train",
"index": 66058,
"acecode_id": "evol_12674",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of non-negative integers, implement a function that returns a Boolean indicating whether the product of the numbers in the list is a prime number. Your function should return False if the list contains more than one number, as the product of multiple numbers cannot... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_product_prime([2]) == True\", \"assert is_product_prime([3]) == True\", \"assert is_product_prime([4]) == False\", \"assert is_product_prime([5]) == True\", \"assert is_product_prime([1]) == False\", \"assert is_product_prime([11]) == True\", \"assert is_... | {
"split": "train",
"index": 66059,
"acecode_id": "evol_26735",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a given list of file paths and a specific file extension. The function should return a list of absolute file paths for all files in the list that have the specified extension. Create a function `find_files_by_extensi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_files_by_extension(['/file1.py', '/file2.py', '/file3.txt'], 'py') == ['/file1.py', '/file2.py']\", \"assert find_files_by_extension(['/file1.csv', '/file2.csv', '/file3.txt'], 'csv') == ['/file1.csv', '/file2.csv']\", \"assert find_files_by_extension([... | {
"split": "train",
"index": 66060,
"acecode_id": "oss_7990",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D list of integers representing a heatmap, return a summary of the maximum value, minimum value, and the average of all values in the heatmap. The input heatmap will be a list of lists where each sub-list has the same length, and the values will be integers. Your funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert (max_min_avg([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == (9, 1, 5.0))\", \"assert (max_min_avg([[0, -1, -2], [-3, -4, -5]]) == (0, -5, -2.5))\", \"assert (max_min_avg([[10]]) == (10, 10, 10.0))\", \"assert (max_min_avg([]) == (None, None, None))\", \"assert (max_m... | {
"split": "train",
"index": 66061,
"acecode_id": "bigcode_python_fns_27984",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an input string, reverse the capitalization of all alphabetic characters, replace each odd digit with the next even digit, and double any non-alphanumeric characters. Implement a function `reverse_capitalization_substitute(string: str) -> str` that performs these transfor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_capitalization_substitute('abc!') == 'ABC!!'\", \"assert reverse_capitalization_substitute('NoChAnGe') == 'nOcHaNgE'\", \"assert reverse_capitalization_substitute('') == ''\", \"assert reverse_capitalization_substitute('!') == '!!'\", \"assert revers... | {
"split": "train",
"index": 66062,
"acecode_id": "evol_25234",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that swaps the elements at two specified indices. The function should take three parameters: a list of integers and two indices i and j. If either index is out of bounds (i.e., less than 0 or greater than or equal to the length of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert swap([10, 20, 30, 40, 50], 0, 3) == [40, 20, 30, 10, 50]\", \"assert swap([1, 2, 3, 4, 5], 1, 4) == [1, 5, 3, 4, 2]\", \"assert swap([5, 4, 3, 2, 1], 2, 2) == [5, 4, 3, 2, 1]\", \"assert swap([10, 20, 30], 0, 2) == [30, 20, 10]\", \"assert swap([1, 1, 1, 1],... | {
"split": "train",
"index": 66063,
"acecode_id": "bigcode_python_fns_44242",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that formats and prints a string representation of the training loss values for a given epoch. The function should take in a float representing the main loss value, an integer representing the current epoch, and optionally, a tuple of two... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_losses(0.12345, 1) == 'Epoch: 1, Loss: 0.12'\", \"assert format_losses(0.56789, 2, (0.23456, 0.1)) == 'Epoch: 2, Loss: 0.57, Validation Loss: 0.23'\", \"assert format_losses(1.23456, 5) == 'Epoch: 5, Loss: 1.23'\", \"assert format_losses(0.98765, 10, ... | {
"split": "train",
"index": 66064,
"acecode_id": "bigcode_python_fns_8751",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `prime_factors(n: int) -> List[int]` that takes an integer `n` and returns a list of all prime factors of `n`. The prime factors should be presented in ascending order. For example, for the input `30`, the output should be `[2, 3, 5]`.\nPlease reason step b... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prime_factors(30) == [2, 3, 5]\", \"assert prime_factors(1) == []\", \"assert prime_factors(2) == [2]\", \"assert prime_factors(3) == [3]\", \"assert prime_factors(4) == [2]\", \"assert prime_factors(5) == [5]\", \"assert prime_factors(6) == [2, 3]\", \"asse... | {
"split": "train",
"index": 66065,
"acecode_id": "evol_28811",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function that takes a string representation of a JSON object that may contain comments and returns a valid JSON object. The comments can be single-line comments that start with '//' or multi-line comments that are enclosed within '/* ... */'. Your functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_json('{\\\"key\\\": \\\"value\\\"}') == {'key': 'value'}\", \"assert parse_json('{\\\"key\\\": \\\"value\\\" /* this is a comment */}') == {'key': 'value'}\", \"assert parse_json('{\\\"key\\\": /* comment */ \\\"value\\\"}') == {'key': 'value'}\", \"as... | {
"split": "train",
"index": 66066,
"acecode_id": "bigcode_python_fns_382",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that calculates the average of a list of numerical values. The function should take in a list of numbers and return the average as a float. If the list is empty, the function should return 0.0. Create a Python function `calculate_a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average([]) == 0.0\", \"assert calculate_average([1, 2, 3]) == 2.0\", \"assert calculate_average([10, 20, 30, 40]) == 25.0\", \"assert calculate_average([5]) == 5.0\", \"assert calculate_average([-1, -2, -3]) == -2.0\", \"assert calculate_average([... | {
"split": "train",
"index": 66067,
"acecode_id": "oss_4027",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that reverses the keys and values of a given dictionary. The function should take a dictionary as input and return a new dictionary where the keys and values are swapped. If there are duplicate values in the original dictionary... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_dict({'a': 1, 'b': 2, 'c': 1, 'd': 3}) == {'1': ['a', 'c'], '2': 'b', '3': 'd'}\", \"assert reverse_dict({'x': 10, 'y': 20, 'z': 10}) == {'10': ['x', 'z'], '20': 'y'}\", \"assert reverse_dict({'key1': 'value1', 'key2': 'value2'}) == {'value1': 'key1'... | {
"split": "train",
"index": 66068,
"acecode_id": "oss_8278",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a program that generates personalized messages based on a person's age. The program should take the person's name and age as input and return a message based on the following criteria: - If the age is less than 18, the message should be '{name} is a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_message('Alice', 15) == 'Alice is a young and energetic 15-year-old!'\", \"assert generate_message('Bob', 18) == 'Bob is like a steady mountain at 18 years old!'\", \"assert generate_message('Charlie', 30) == 'Charlie is like a steady mountain at 30... | {
"split": "train",
"index": 66069,
"acecode_id": "oss_16812",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `check_permutation(s1: str, s2: str) -> str` that takes two strings as inputs and checks if both consist of ASCII printable characters only. If either string contains non-printable ASCII characters, return 'Input strings must only consist of printable ASCII... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_permutation('abc', 'cba') == 'These strings are permutations of each other.'\", \"assert check_permutation('hello', 'olleh') == 'These strings are permutations of each other.'\", \"assert check_permutation('Dog', 'god') == 'These strings are not permut... | {
"split": "train",
"index": 66070,
"acecode_id": "evol_6445",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `find_and_print_primes(n: int) -> List[int]` that finds all prime numbers from 1 to n and returns them as a list. The function should handle the case where n is less than 1 by returning an empty list. A prime number is a natural number greater than 1 that canno... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_and_print_primes(10) == [2, 3, 5, 7]\", \"assert find_and_print_primes(1) == []\", \"assert find_and_print_primes(0) == []\", \"assert find_and_print_primes(20) == [2, 3, 5, 7, 11, 13, 17, 19]\", \"assert find_and_print_primes(30) == [2, 3, 5, 7, 11, 13... | {
"split": "train",
"index": 66071,
"acecode_id": "evol_26132",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the process of creating a cloud infrastructure for a project. The function, `create_infrastructure`, accepts two parameters: `aws_key` and `aws_secret`, which are strings representing AWS credentials. The function shoul... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_infrastructure('valid_key', 'valid_secret') in ['Available', 'Failed']\", \"assert create_infrastructure('valid_key', '') == 'Failed'\", \"assert create_infrastructure('', 'valid_secret') == 'Failed'\", \"assert create_infrastructure('', '') == 'Faile... | {
"split": "train",
"index": 66072,
"acecode_id": "bigcode_python_fns_32410",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `validate_password(password: str) -> bool` that verifies if a given password is valid. A valid password must meet the following criteria: it should be between 8 and 26 characters long, contain at least one uppercase letter, one lowercase letter, one digit, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_password('P@ssw0rd123') == True\", \"assert validate_password('weakpassword') == False\", \"assert validate_password('123456') == False\", \"assert validate_password('P@55w0rd') == True\", \"assert validate_password('Admin@123') == True\", \"assert ... | {
"split": "train",
"index": 66073,
"acecode_id": "evol_33278",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a multiplayer game where players can perform actions during a match. The function should take a list of player names and a list of actions performed by those players. Each action should be represented as a tuple contain... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert action_count(['Alice', 'Bob'], [('Alice', 'jump'), ('Bob', 'run'), ('Alice', 'jump')]) == {'jump': 2, 'run': 1}\", \"assert action_count(['Charlie'], [('Charlie', 'attack'), ('Charlie', 'defend'), ('Charlie', 'attack')]) == {'attack': 2, 'defend': 1}\", \"as... | {
"split": "train",
"index": 66074,
"acecode_id": "oss_36534",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an input string `S`, implement a function that calculates the total number of unique, non-empty subsequences that can be derived from `S`. The result should be returned after applying the modulo operation with `10^9 + 7`. Note that `S` only contains lowercase alphabets an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert distinctSubseqII('abc') == 7\", \"assert distinctSubseqII('aba') == 6\", \"assert distinctSubseqII('aaa') == 3\", \"assert distinctSubseqII('abcd') == 15\", \"assert distinctSubseqII('xyz') == 7\", \"assert distinctSubseqII('abcdefghij') == 1023\", \"assert ... | {
"split": "train",
"index": 66075,
"acecode_id": "evol_35132",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Write a Python function `parse_url(url: str) -> Dict[str, Union[str, Dict[str, List[str]]]]` that extracts components from a given URL, including the protocol, domain, subdomain (if any), path, and query parameters (if any). If the URL is invalid, the function should return Non... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_url('https://sub.example.com/users?id=1') == {'protocol': 'https', 'domain': 'example.com', 'subdomain': 'sub', 'path': '/users', 'query_params': {'id': ['1']}}\", \"assert parse_url('InvalidURL') == None\", \"assert parse_url('https://example.com/user... | {
"split": "train",
"index": 66076,
"acecode_id": "evol_17436",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Implement a function `descending_squares(numbers: list) -> list` that takes a list of integers as an argument, squares each element, sorts the results in descending order, and returns the list. Ensure that the function handles edge cases correctly, such as empty lists and lists... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert descending_squares([3, 2, 4, 6, 1, 2, 9]) == [81, 36, 16, 9, 4, 4, 1]\", \"assert descending_squares([-3, -2, -4, -6, -1, -2, -9]) == [81, 36, 16, 9, 4, 4, 1]\", \"assert descending_squares([0]) == [0]\", \"assert descending_squares([]) == []\", \"assert des... | {
"split": "train",
"index": 66077,
"acecode_id": "evol_22379",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two angles represented as integers, `angle1` and `angle2`, which can range from 0 to 360 degrees. Your task is to compute the smallest angle between the two angles. The smallest angle is defined as the absolute difference between the two angles, considering that a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert smallest_angle(0, 0) == 0\", \"assert smallest_angle(0, 180) == 180\", \"assert smallest_angle(90, 270) == 180\", \"assert smallest_angle(45, 135) == 90\", \"assert smallest_angle(30, 150) == 120\", \"assert smallest_angle(350, 10) == 20\", \"assert smallest... | {
"split": "train",
"index": 66078,
"acecode_id": "bigcode_python_fns_11591",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers that can include both positive and negative numbers, implement a function that sorts the list in ascending order. The function should accept a Boolean variable; if the variable is False, the list should be sorted in ascending order. If the variable is T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert custom_sort([3, 4, -5, 6, 1, -2], False) == [-5, -2, 1, 3, 4, 6]\", \"assert custom_sort([], False) == []\", \"assert custom_sort([], True) == []\", \"assert custom_sort([-3, -1, -2, 0, 1, 2], False) == [-3, -2, -1, 0, 1, 2]\", \"assert custom_sort([1, 2, 3,... | {
"split": "train",
"index": 66079,
"acecode_id": "evol_3102",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that monitors the status of a training run based on command parameters. The function should check if the command is 'package' and whether a training ID is provided. If both conditions are met, the function should return a message indi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert monitor_training_run({'command': 'package', 'training_id': '12345'}) == 'Skipping preparation steps.'\", \"assert monitor_training_run({'command': 'package', 'training_id': None}) == 'Preparation steps required.'\", \"assert monitor_training_run({'command': ... | {
"split": "train",
"index": 66080,
"acecode_id": "oss_21185",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks whether a given user is part of a specific workspace in a project management tool. The function should take two parameters: a list of workspaces (each represented as a dictionary with 'name' as a key) and a string representing... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_part_of_workspace([{'name': 'lakeannebrewhouse.com'}, {'name': 'techstartup.com'}], 'lakeannebrewhouse.com') == True\", \"assert is_part_of_workspace([{'name': 'lakeannebrewhouse.com'}, {'name': 'techstartup.com'}], 'nonexistent.com') == False\", \"assert... | {
"split": "train",
"index": 66081,
"acecode_id": "bigcode_python_fns_29694",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a request containing bibliographic codes (bibcodes) and sorting preferences to return a list of sorted bibcodes. Your function should take a dictionary as input, which simulates the request payload. The input dictionary has... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_request({'bibcode': ['2021A', '2020B', '2019C'], 'sort': 'date desc, bibcode desc'}) == (['2021A', '2020B', '2019C'], 200)\", \"assert process_request({'bibcode': ['2019C', '2020B', '2021A'], 'sort': 'bibcode desc'}) == (['2021A', '2020B', '2019C'], ... | {
"split": "train",
"index": 66082,
"acecode_id": "bigcode_python_fns_37360",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves the international phone number associated with a user's profile. Given a dictionary representing a user's profile, your function should extract and return the value of the 'internationalNumber' key. If the key does not exis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_international_phone_number({'internationalNumber': '+1234567890'}) == '+1234567890'\", \"assert get_international_phone_number({'name': 'John Doe', 'age': 30, 'internationalNumber': '+9876543210'}) == '+9876543210'\", \"assert get_international_phone_num... | {
"split": "train",
"index": 66083,
"acecode_id": "oss_27906",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `enhanced_fibfib(n: int) -> int` that calculates the nth term of a sophisticated series defined as follows: fibfib(0) == 0, fibfib(1) == 0, fibfib(2) == 1, and for n > 2, fibfib(n) is determined by fibfib(n-1) + fibfib(n-2) + fibfib(n-3) + fibfib(n-4). Addi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert enhanced_fibfib(0) == 0\", \"assert enhanced_fibfib(1) == 0\", \"assert enhanced_fibfib(2) == 1\", \"assert enhanced_fibfib(3) == 1\", \"assert enhanced_fibfib(4) == 2\", \"assert enhanced_fibfib(5) == 4\"]}"
} | {
"split": "train",
"index": 66084,
"acecode_id": "evol_18833",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are provided with a DNA alignment represented as a list of tuples, where each tuple contains a reference index, an alignment index, a reference base, and an aligned base. Your task is to implement a function that identifies and returns a list of mismatched pairs from this a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_mismatch_pairs([(1, 0, 'A', 'A'), (2, 1, 'C', 'C')]) == []\", \"assert get_mismatch_pairs([(1, 0, 'A', 'G'), (2, 1, 'C', 'T')]) == [[1, 0, 'A', 'G'], [2, 1, 'C', 'T']]\", \"assert get_mismatch_pairs([(1, 0, 'G', 'A'), (2, 1, 'T', 'T')]) == [[1, 0, 'G', '... | {
"split": "train",
"index": 66085,
"acecode_id": "bigcode_python_fns_4475",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j], and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Write a function find132pattern(nums) that returns a tuple containing a boolean indicating if a 132 pattern exi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find132pattern([1, 2, 3, 4]) == (False, [])\", \"assert find132pattern([5, 4, 3, 2, 1]) == (False, [])\", \"assert find132pattern([1, 2, 1]) == (False, [])\", \"assert find132pattern([5, 5, 5, 5]) == (False, [])\", \"assert find132pattern([1, 1, 1, 1]) == (F... | {
"split": "train",
"index": 66086,
"acecode_id": "evol_13764",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks if a given certificate hash is valid and returns its associated details. The function should accept a list of certificates, where each certificate is represented as a dictionary containing the keys 'hash', 'course_title', 'pro... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_certificate_details('hash1', [{'hash': 'hash1', 'course_title': 'Course 1', 'program_title': 'Program A', 'name': 'John Doe', 'signatories': ['Signatory A']}]) == {'hash': 'hash1', 'course_title': 'Course 1', 'program_title': 'Program A', 'name': 'John D... | {
"split": "train",
"index": 66087,
"acecode_id": "bigcode_python_fns_8842",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a string `blob` that represents capabilities, each capability on a new line. The capabilities can either be a simple key or a key with values separated by commas, represented in the format `key=value1,value2,value3`. Your task is to implement a function `decode_ca... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert decode_caps('cap1=value1,value2,value3\\\\ncap2=value4,value5\\\\ncap3=') == {'cap1': ['value1', 'value2', 'value3'], 'cap2': ['value4', 'value5'], 'cap3': []}\", \"assert decode_caps('cap1=value1\\\\ncap2=') == {'cap1': ['value1'], 'cap2': []}\", \"assert d... | {
"split": "train",
"index": 66088,
"acecode_id": "bigcode_python_fns_23422",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a simplified version of a model architecture similar to YOLO (You Only Look Once) using MobileNet as a backbone. The function should take the following parameters: a tuple of two tensors (f1, f2) representing feature ma... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert predict_output(((13, 13), (26, 26)), (1024, 512), 9, 80) == [((13, 13), 1024), ((26, 26), 512)]\", \"assert predict_output(((10, 10), (20, 20)), (512, 256), 5, 10) == [((10, 10), 512), ((20, 20), 256)]\", \"assert predict_output(((15, 15), (30, 30)), (2048, ... | {
"split": "train",
"index": 66089,
"acecode_id": "bigcode_python_fns_28020",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a recursive function that converts a given list of strings into a single string, where each word is separated by a space. You are not allowed to use any built-in string concatenation methods like 'join', '+', or string formatting. The function should take a list of string... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert list_to_str(['Hello', 'world']) == 'Hello world'\", \"assert list_to_str(['I', 'am', 'a', 'list', 'of', 'strings']) == 'I am a list of strings'\", \"assert list_to_str(['This', 'is', 'a', 'test']) == 'This is a test'\", \"assert list_to_str(['']) == ''\", \"... | {
"split": "train",
"index": 66090,
"acecode_id": "evol_3021",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers and an integer n. Write a function that divides the list into fixed-length chunks (batches) of size n. If the list cannot be evenly divided, the last chunk may contain fewer than n elements. The function should return a list of these chunks, whe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_batches_from_generator([], 3) == []\", \"assert get_batches_from_generator([1, 2, 3], 3) == [[1, 2, 3]]\", \"assert get_batches_from_generator([1, 2, 3, 4, 5], 2) == [[1, 2], [3, 4], [5]]\", \"assert get_batches_from_generator([1, 2, 3, 4, 5, 6], 3) == [... | {
"split": "train",
"index": 66091,
"acecode_id": "bigcode_python_fns_20023",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that counts the occurrences of a specified digit in a given list of integers. The function should take a list of integers and a single digit as parameters and return the count of how many times that digit appears in the list.\nPlease reason step by step, th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_frequency([2, 4, 3, 5, 4, 2, 3], 4) == 2\", \"assert count_frequency([1, 2, 3, 4, 5], 6) == 0\", \"assert count_frequency([7, 8, 9, 7, 7], 7) == 3\", \"assert count_frequency([], 1) == 0\", \"assert count_frequency([1, 1, 1, 1, 1], 1) == 5\", \"assert ... | {
"split": "train",
"index": 66092,
"acecode_id": "evol_16639",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of integers, `map_in` and `psf_alm`. The function you need to implement should convolve `map_in` with `psf_alm` to produce a new list, `map_out`. The convolution process involves the following steps: first, calculate the sum of all elements in `map_in` t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convolve([0, 0, 0], [1, 2, 3]) == [0.0, 0.0, 0.0]\", \"assert convolve([1, 1, 1], [1, 1, 1]) == [1.0, 1.0, 1.0]\", \"assert convolve([1, 2, 3], [4, 5]) == []\", \"assert convolve([], [1]) == []\", \"assert convolve([1, 1, 1], [0, 0, 0]) == [0.0, 0.0, 0.0]\",... | {
"split": "train",
"index": 66093,
"acecode_id": "bigcode_python_fns_16346",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function that sorts a list of integers in ascending order using the quicksort algorithm. The function should take a single parameter, a list of integers, and return a new list that contains the sorted integers. For example, given the input [7, 3, 2, 9, 5, 1], the ou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quickSort([7, 3, 2, 9, 5, 1]) == [1, 2, 3, 5, 7, 9]\", \"assert quickSort([10, 5, 2, 8, 3]) == [2, 3, 5, 8, 10]\", \"assert quickSort([4, 1, 7, 2]) == [1, 2, 4, 7]\", \"assert quickSort([0]) == [0]\", \"assert quickSort([]) == []\", \"assert quickSort([5, 5,... | {
"split": "train",
"index": 66094,
"acecode_id": "evol_22914",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `get_unique_elements` that returns a list of unique integers from the input list, maintaining the original order of their first occurrence. The function should take a single argument, a list of integers, and return a list of integers. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_unique_elements([1, 2, 2, 3, 4, 3, 5]) == [1, 2, 3, 4, 5]\", \"assert get_unique_elements([5, 5, 5, 5]) == [5]\", \"assert get_unique_elements([]) == []\", \"assert get_unique_elements([1, 2, 3]) == [1, 2, 3]\", \"assert get_unique_elements([1, 2, 1, 2, ... | {
"split": "train",
"index": 66095,
"acecode_id": "bigcode_python_fns_3856",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing a collection of numbers. Write a function `find_first_duplicate(nums)` that returns the first duplicate number from the list. If there are no duplicates, return -1. A duplicate is defined as a number that appears more than once in t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_first_duplicate([1, 2, 3, 4, 5, 2]) == 2\", \"assert find_first_duplicate([5, 1, 2, 3, 5, 3]) == 5\", \"assert find_first_duplicate([1, 2, 3, 4]) == -1\", \"assert find_first_duplicate([1, 1, 2, 3, 4]) == 1\", \"assert find_first_duplicate([3, 3, 3, 1, ... | {
"split": "train",
"index": 66096,
"acecode_id": "bigcode_python_fns_34241",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if a module can be imported based on a specified size limit. The function should take two parameters: an integer `importsizelimit` which represents the maximum allowable size for imports, and a list of tuples `modules` whe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_importable_modules(10, [('mod1', 5), ('mod2', 15), ('mod3', 10)]) == ['mod1', 'mod3']\", \"assert check_importable_modules(0, [('mod1', 0), ('mod2', 1)]) == ['mod1']\", \"assert check_importable_modules(100, [('mod1', 50), ('mod2', 75), ('mod3', 200)])... | {
"split": "train",
"index": 66097,
"acecode_id": "oss_9306",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function `calculate(num1, num2, num3, operator)` that takes three numerical parameters (which can be integers or floats) and a string representing a mathematical operation ('+', '-', '*', '/'). The function should apply the operation to the three numbers and return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate(2, 3, 4, '+') == 9\", \"assert calculate(10, 5, 2, '-') == 3\", \"assert calculate(3, 4, 5, '*') == 60\", \"assert calculate(12, 3, 2, '/') == 2.0\", \"assert calculate(2.5, 3.5, 1, '+') == 7.0\", \"assert calculate(10, 5, 2, '*') == 100\", \"asser... | {
"split": "train",
"index": 66098,
"acecode_id": "evol_11645",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that parses a list of requirements for software packages. Each requirement is represented as a string, and may include comments (starting with '#') that should be ignored. Additionally, the function should handle any cases where a requirem... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_requirements(['numpy==1.21.0', '# This is a comment', '', 'pandas', 'requests==2.25.1']) == ['numpy==1.21.0', 'pandas', 'requests==2.25.1']\", \"assert parse_requirements(['# Comment line', '# Another comment', ' ', 'scikit-learn>=0.24']) == ['sciki... | {
"split": "train",
"index": 66099,
"acecode_id": "bigcode_python_fns_41495",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.