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 an integer 'epoch' and a dictionary 'settings' which contains two keys: 'baseline' (a boolean indicating if the baseline is active) and 'update' (a dictionary with a key 'start_epoch' indicating the epoch number at which updates start). Write a function that deter...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_has_started(5, {'baseline': True, 'update': {'start_epoch': 3}}) == True\", \"assert update_has_started(2, {'baseline': True, 'update': {'start_epoch': 3}}) == False\", \"assert update_has_started(3, {'baseline': True, 'update': {'start_epoch': 3}}) =...
{ "split": "train", "index": 80000, "acecode_id": "bigcode_python_fns_19989", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates the behavior of a dependency resolver for a build system. The function should take a list of initial dependencies and a list of additional artifacts, and return the final list of dependencies after adding the new art...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert resolve_dependencies([], []) == []\", \"assert resolve_dependencies(['artifact1'], []) == ['artifact1']\", \"assert resolve_dependencies([], ['artifact2']) == ['artifact2']\", \"assert resolve_dependencies(['artifact1'], ['artifact2']) == ['artifact1', 'arti...
{ "split": "train", "index": 80001, "acecode_id": "oss_33498", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that performs a binary search on a sorted list of integers. Your function should take in a sorted list and a number to be searched for, and return a boolean indicating whether the number is present in the list or not. Implement...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert busca_binaria_it([1, 2, 3, 4, 5], 3) == True\", \"assert busca_binaria_it([1, 2, 3, 4, 5], 6) == False\", \"assert busca_binaria_it([], 1) == False\", \"assert busca_binaria_it([10, 20, 30, 40, 50], 10) == True\", \"assert busca_binaria_it([10, 20, 30, 40, 5...
{ "split": "train", "index": 80002, "acecode_id": "oss_1247", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that checks for the presence of specific modules and their submodules within a given code snippet. The code snippet provided contains import statements for various modules and submodules. Your task is to create a function that ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_module_imports('import torch') == False\", \"assert check_module_imports('from latte.metrics.core import interpolatability') == False\", \"assert check_module_imports('from torch import interpolatability') == False\", \"assert check_module_imports('imp...
{ "split": "train", "index": 80003, "acecode_id": "oss_26251", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `calculate_sum` that takes an integer list and returns the sum of its elements. If the list is empty, return 0. The function should have the following signature: `def calculate_sum(nums: List[int]) -> int:`. Your implementation should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_sum([]) == 0\", \"assert calculate_sum([1, 2, 3]) == 6\", \"assert calculate_sum([-1, -2, -3]) == -6\", \"assert calculate_sum([1, -1, 2, -2]) == 0\", \"assert calculate_sum([5, 10, 15]) == 30\", \"assert calculate_sum([-5, 5]) == 0\", \"assert cal...
{ "split": "train", "index": 80004, "acecode_id": "bigcode_python_fns_38889", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a unique set of coin denominations and a target total monetary sum, implement a function that returns the minimal quantity of coins needed to reach that total. If it is not possible to reach the target sum with the given denominations, return -1.\nPlease reason step by st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert minCoins([1, 2, 5], 11) == 3\", \"assert minCoins([1, 3, 4], 6) == 2\", \"assert minCoins([25, 10, 5], 30) == 2\", \"assert minCoins([1, 2, 3], 4) == 2\", \"assert minCoins([5, 7, 10], 14) == 2\", \"assert minCoins([1], 0) == 0\", \"assert minCoins([2, 3], 5...
{ "split": "train", "index": 80005, "acecode_id": "evol_10985", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a server accepting client connections in a simplified manner. The function should take a list of tuples, where each tuple contains the address (as a string) and port (as an integer) of a client. The function should return a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_connections([('192.168.1.1', 8080), ('10.0.0.1', 9090)]) == ['Client connected from 192.168.1.1:8080', 'Client connected from 10.0.0.1:9090']\", \"assert simulate_connections([('127.0.0.1', 12345)]) == ['Client connected from 127.0.0.1:12345']\", \"...
{ "split": "train", "index": 80006, "acecode_id": "oss_34668", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are developing a fitness chatbot that responds to user commands. When a user sends the command '/treino', the chatbot should respond with a list of available training categories. Your task is to implement the function `send_category` that takes a `message` object as input a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert send_category(mock_message) == 'Available training categories:\\\\nOp\\u00e7\\u00e3o 1: Cardio\\\\nOp\\u00e7\\u00e3o 2: Strength Training\\\\nOp\\u00e7\\u00e3o 3: Yoga\\\\nOp\\u00e7\\u00e3o 4: Pilates\\\\nOp\\u00e7\\u00e3o 5: HIIT\\\\nOp\\u00e7\\u00e3o 6: Cr...
{ "split": "train", "index": 80007, "acecode_id": "oss_26790", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer n, write a function called `find_palindromes` that returns a list of all integer palindromes between 1 and n (inclusive). A palindrome is a number that remains the same when its digits are reversed. For example, 121 and 131 are palindromes, while 123 is not. Yo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_palindromes(1) == [1]\", \"assert find_palindromes(2) == [1, 2]\", \"assert find_palindromes(10) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\", \"assert find_palindromes(11) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11]\", \"assert find_palindromes(121) == [1, 2, 3, 4, 5, 6, 7...
{ "split": "train", "index": 80008, "acecode_id": "evol_16965", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that computes the sum of all even numbers in the list. If there are no even numbers, return 0. The function should take a single argument, which is a list of integers, and return a single integer representing the sum of the even nu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_even_numbers([1, 2, 3, 4, 5]) == 6\", \"assert sum_of_even_numbers([2, 4, 6, 8]) == 20\", \"assert sum_of_even_numbers([1, 3, 5]) == 0\", \"assert sum_of_even_numbers([-2, -4, -6]) == -12\", \"assert sum_of_even_numbers([-1, -2, -3, -4]) == -6\", \"as...
{ "split": "train", "index": 80009, "acecode_id": "bigcode_python_fns_17145", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple job scheduling system. Your job scheduling system will determine if a given task and its associated argument should be executed based on a provided schedule. The schedule is represented as a dictionary where the keys are task names and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert should_run_task({'task1': ['arg1', 'arg2'], 'task2': ['arg3']}, 'task1', 'arg1') == True\", \"assert should_run_task({'task1': ['arg1', 'arg2'], 'task2': ['arg3']}, 'task1', 'arg2') == True\", \"assert should_run_task({'task1': ['arg1', 'arg2'], 'task2': ['a...
{ "split": "train", "index": 80010, "acecode_id": "oss_11478", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that generates a shareable URL based on a given dictionary input. Your function should take a dictionary `data` as input, and the key from this dictionary will be used to construct a shareable URL. The shareable URL will be in the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_shareable_url({'key': 'abc123'}) == 'https://example.com/abc123'\", \"assert generate_shareable_url({'key': 'xyz789'}) == 'https://example.com/xyz789'\", \"assert generate_shareable_url({'name': 'Alice'}) == 'Key not found'\", \"assert generate_shar...
{ "split": "train", "index": 80011, "acecode_id": "oss_20257", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a configuration represented as a dictionary for a code analysis tool. The function should take in a configuration dictionary and a list of additional arguments, and then return a dictionary of options based on the co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_config({'select': 'E11, E34, E402, W, F'}, ['--exclude', 'tests/*']) == {'select': ['E11', 'E34', 'E402', 'W', 'F'], 'ignore': None, 'exclude': ['tests/*']}\", \"assert process_config({'select': 'E11, W'}, []) == {'select': ['E11', 'W'], 'ignore': No...
{ "split": "train", "index": 80012, "acecode_id": "oss_35564", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of items and an integer n. Your task is to implement a function `generate_ngrams` that generates n-grams from the given input sequence. An n-gram is defined as a contiguous sequence of n items from the list. The function should return a list of n-grams, whe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_ngrams([1, 2, 3, 4, 5], 2) == [(1, 2), (2, 3), (3, 4), (4, 5)]\", \"assert generate_ngrams([1, 2, 3, 4, 5], 3) == [(1, 2, 3), (2, 3, 4), (3, 4, 5)]\", \"assert generate_ngrams(['a', 'b', 'c'], 1) == [('a',), ('b',), ('c',)]\", \"assert generate_ngra...
{ "split": "train", "index": 80013, "acecode_id": "oss_9086", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of integers representing the fitness scores of neural network genomes and returns the index of the genome with the highest fitness score. If there are multiple genomes with the highest score, return the index of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_winning_genome([1, 2, 3, 4, 5]) == 4\", \"assert find_winning_genome([5, 1, 2, 3, 4]) == 0\", \"assert find_winning_genome([1, 2, 3, 2, 1]) == 2\", \"assert find_winning_genome([3, 3, 2, 1]) == 0\", \"assert find_winning_genome([1]) == 0\", \"assert fin...
{ "split": "train", "index": 80014, "acecode_id": "oss_2750", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers and a format type that determines how to transform these integers into packed values. The format type can either be 'packed_U4' for unsigned 4-bit integers or 'packed_I4' for signed 4-bit integers. Your task is to implement a function `get_packe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_packed_values([14, 1], 'packed_U4') == [14, 1]\", \"assert get_packed_values([0, 0, 0], 'packed_U4') == [0, 0, 0]\", \"assert get_packed_values([-1, -2, -3], 'packed_I4') == [255, 254, 253]\", \"assert get_packed_values([-128, 127], 'packed_I4') == [128,...
{ "split": "train", "index": 80015, "acecode_id": "oss_4724", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes another function as input and returns a new function. This new function should log its arguments and the result of the function it wraps. The logging should be done by calling a helper function `log_args_kwargs_results`, which ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert log_arguments(lambda x: x + 1)(2) == 3\", \"assert log_arguments(lambda x, y: x * y)(3, 4) == 12\", \"assert log_arguments(lambda: 'Hello, World!')() == 'Hello, World!'\", \"assert log_arguments(lambda x: x)(5) == 5\", \"assert log_arguments(lambda a, b, c: ...
{ "split": "train", "index": 80016, "acecode_id": "bigcode_python_fns_34288", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a retry mechanism for a function that starts an application and waits for it to finish loading. Write a function `start_and_wait` that takes the following parameters: \n- `app_start_function`: A function that starts the application. This functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert start_and_wait(lambda: True, 3, 2) is None\", \"assert start_and_wait(lambda: True, 1, 2) is None\", \"assert start_and_wait(lambda: True, 5, 1) is None\", \"assert start_and_wait(lambda: True, 0, 2) is None\", \"assert start_and_wait(lambda: False, 0, 2) is...
{ "split": "train", "index": 80017, "acecode_id": "oss_31396", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_area(length: float, width: float) -> float` that calculates the area of a rectangle given its length and width. The function should raise a ValueError if either length or width is not a number or if either is negative. If the inputs are valid, re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_area(20, 15) == 300\", \"assert calculate_area(5.5, 10.0) == 55.0\", \"assert calculate_area(7, 3) == 21\", \"assert calculate_area(0.5, 4) == 2.0\", \"assert calculate_area(10, 10) == 100\", \"assert calculate_area(1.5, 2.5) == 3.75\", \"assert ca...
{ "split": "train", "index": 80018, "acecode_id": "evol_19586", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of gene IDs as strings and a mapping of gene IDs to gene symbols represented as a dictionary. Write a function that takes the list of gene IDs and returns a new list containing the corresponding gene symbols. If a gene ID does not have a corresponding gene ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_gene_ids_to_symbols(['gene1', 'gene2', 'gene3'], {'gene1': 'Symbol1', 'gene2': 'Symbol2'}) == ['Symbol1', 'Symbol2', 'N/A']\", \"assert convert_gene_ids_to_symbols(['gene4', 'gene5'], {'gene4': 'Symbol4', 'gene5': 'Symbol5'}) == ['Symbol4', 'Symbol5'...
{ "split": "train", "index": 80019, "acecode_id": "bigcode_python_fns_9615", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `permute_list(lst)` that takes a list of integers and returns a list of all possible permutations of the input list. The function should not use any built-in methods for generating permutations. The output should be a list of lists, where each inner list is one...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert permute_list([]) == []\", \"assert permute_list([1]) == [[1]]\", \"assert permute_list([1, 2]) == [[1, 2], [2, 1]]\", \"assert permute_list([1, 2, 3]) == [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]\", \"assert permute_list([0]) == [[0]...
{ "split": "train", "index": 80020, "acecode_id": "evol_10041", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Design a function that simulates bank transactions on a bank account, allowing for both deposits and withdrawals using floating-point amounts. The function should take a list of transaction amounts and an optional parameter that specifies if overdraft is allowed. If a withdrawa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert BankAccount().transaction([1, 2, 3]) == False\", \"assert BankAccount().transaction([1, 2, -4, 5]) == True\", \"assert BankAccount().transaction([-1, -2, -3]) == True\", \"assert BankAccount().transaction([0.5, -0.5]) == False\", \"assert BankAccount().trans...
{ "split": "train", "index": 80021, "acecode_id": "evol_26921", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given the `root` of a binary tree, where each node has a value of either `0` or `1`. Each path from the root to any node in the tree represents a binary number, with the most significant bit at the start. Your task is to implement a function that calculates the sum of a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sumBinaryNumbers(TreeNode(1)) == 1\", \"assert sumBinaryNumbers(TreeNode(0)) == 0\", \"assert sumBinaryNumbers(TreeNode(1, TreeNode(0), TreeNode(1))) == 5\", \"assert sumBinaryNumbers(TreeNode(0, TreeNode(0), TreeNode(0))) == 0\", \"assert sumBinaryNumbers(T...
{ "split": "train", "index": 80022, "acecode_id": "evol_19677", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if a user has the ability to execute the command `SHOW USERS`. The function will take as input a list of privileges granted directly to a user. Each privilege is represented as a string. Your function should return a boolean v...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_show_users_privilege(['SHOW USERS', 'ALTER']) == True\", \"assert has_show_users_privilege(['SELECT', 'UPDATE']) == False\", \"assert has_show_users_privilege(['INSERT', 'SHOW USERS', 'DELETE']) == True\", \"assert has_show_users_privilege(['CREATE', 'DR...
{ "split": "train", "index": 80023, "acecode_id": "bigcode_python_fns_49617", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a file upload widget URL based on a specified storage type and path. The function should accept two parameters: a 'storage' string indicating the storage type (either 'public' or 'private') and a 'path' string that specifie...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_upload_url('public', 'foo/bar') == '/upload/public/foo/bar'\", \"assert generate_upload_url('private', 'documents/report.pdf') == '/upload/private/documents/report.pdf'\", \"assert generate_upload_url('public', 'images/pic.jpg') == '/upload/public/i...
{ "split": "train", "index": 80024, "acecode_id": "bigcode_python_fns_29170", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a function that processes user data and returns a boolean value indicating whether the processing was successful. Your task is to implement a function `process_user_data(user_data: dict) -> bool` that takes a dictionary `user_data` as input. The function should ch...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_user_data({'name': 'Alice', 'age': 30}) == True\", \"assert process_user_data({'name': 'Bob'}) == False\", \"assert process_user_data({'age': 25}) == False\", \"assert process_user_data({'name': '', 'age': 40}) == True\", \"assert process_user_data({...
{ "split": "train", "index": 80025, "acecode_id": "bigcode_python_fns_28114", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a simple data structure to represent various projects. Each project should have the following attributes: a title (a string with a maximum length of 30 characters), an image (a string representing the file path to the image), a description (a string...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_project('Project 1', 'images/image1.jpg', 'This is a description of project 1.') == {'title': 'Project 1', 'image': 'images/image1.jpg', 'description': 'This is a description of project 1.', 'link': None}\", \"assert create_project('Project 2', 'image...
{ "split": "train", "index": 80026, "acecode_id": "oss_21278", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that converts a given hexadecimal number (as a string) to its binary representation (as a string). The input hexadecimal number can include both uppercase and lowercase letters. The function should handle leading zeros in the binary output appropriately. For ex...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert hex_to_bin('1A') == '11010'\", \"assert hex_to_bin('0') == '0'\", \"assert hex_to_bin('10') == '10000'\", \"assert hex_to_bin('F') == '1111'\", \"assert hex_to_bin('2B') == '101011'\", \"assert hex_to_bin('A5') == '10100101'\", \"assert hex_to_bin('c') == '1...
{ "split": "train", "index": 80027, "acecode_id": "evol_6913", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked to implement a function `message_queue(frontend:int, backend:int) -> str` that simulates a simple message queuing system. The function takes two integer parameters, `frontend` and `backend`, which represent the number of messages sent to the frontend and backend ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert message_queue(5, 3) == 'Frontend'\", \"assert message_queue(2, 3) == 'Backend'\", \"assert message_queue(4, 4) == 'Equal'\", \"assert message_queue(10, 0) == 'Frontend'\", \"assert message_queue(0, 10) == 'Backend'\", \"assert message_queue(7, 7) == 'Equal'\...
{ "split": "train", "index": 80028, "acecode_id": "bigcode_python_fns_23303", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a package name, a service name, and a method name, return the fully qualified service name. If the package name is empty, the fully qualified service name should simply be the service name. If the package name is not empty, the fully qualified service name should be in th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_fully_qualified_service('', 'SearchService', 'Search') == 'SearchService'\", \"assert get_fully_qualified_service('com.example', 'SearchService', 'Search') == 'com.example.SearchService'\", \"assert get_fully_qualified_service('org.test', 'UserService', ...
{ "split": "train", "index": 80029, "acecode_id": "bigcode_python_fns_15046", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that determines if a given string is a palindrome, which means that the string reads the same backward as forward. Your function should ignore spaces, punctuation, and capitalization. Implement a function called `is_palindrome(s: str)...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('race a car') == False\", \"assert is_palindrome('') == True\", \"assert is_palindrome(' ') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_pal...
{ "split": "train", "index": 80030, "acecode_id": "oss_25131", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `divide_elements_by_scalar` that divides each element in the list by a given scalar. The function should return a new list containing the results. If the scalar is zero, the function should return an error message 'Division by zero is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert divide_elements_by_scalar([10, 20, 30], 2) == [5.0, 10.0, 15.0]\", \"assert divide_elements_by_scalar([-10, -20, -30], 2) == [-5.0, -10.0, -15.0]\", \"assert divide_elements_by_scalar([1, 2, 3], 0) == 'Division by zero is not allowed'\", \"assert divide_elem...
{ "split": "train", "index": 80031, "acecode_id": "bigcode_python_fns_15134", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create a function to count the vowels in a given string, returning a dictionary that contains the frequency of each vowel. The function should consider both lowercase and uppercase vowels separately. For example, in the string 'Advanced Algorithms', the function should return t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_vowels('AEIOUaeiou') == {'A': 1, 'E': 1, 'I': 1, 'O': 1, 'U': 1, 'a': 1, 'e': 1, 'i': 1, 'o': 1, 'u': 1}\", \"assert count_vowels('') == {}\", \"assert count_vowels('1234567890') == {}\", \"assert count_vowels('This is a Test') == {'i': 2, 'a': 1, 'e':...
{ "split": "train", "index": 80032, "acecode_id": "evol_32869", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that validates uploaded image files. The function should take a list of image file names and their corresponding file sizes (in bytes) as input. Each image file should be validated based on the following criteria: 1) The file name mus...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_images([('image1.jpg', 4000000), ('image2.png', 6000000), ('image3.gif', 3000000)]) == [True, False, True]\", \"assert validate_images([('photo.jpeg', 5000000), ('document.pdf', 2000000), ('picture.bmp', 600000)]) == [True, False, False]\", \"assert...
{ "split": "train", "index": 80033, "acecode_id": "oss_35516", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes two strings, rfam_acc and rfamseq_acc, representing RNA family accession and family specific sequence accession, respectively. Your function should return a string that indicates whether the entry is significant or not base...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_significant('Rfam123', 'seq456') == 'Significant'\", \"assert is_significant('R123', 'abcd') == 'Not Significant'\", \"assert is_significant('Rfam001', 'test1') == 'Significant'\", \"assert is_significant('Xfam', 'xyz') == 'Not Significant'\", \"assert is...
{ "split": "train", "index": 80034, "acecode_id": "bigcode_python_fns_14473", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function `power(base: int, exponent: int) -> int` that calculates the exponentiation of a base number `base`, where `base` is an integer between 1 and 10, elevated to a specified power `exponent`, where `exponent` is a prime number less than 20. The function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert power(1, 2) == 1\", \"assert power(2, 2) == 4\", \"assert power(3, 2) == 9\", \"assert power(4, 2) == 16\", \"assert power(5, 2) == 25\", \"assert power(6, 2) == 36\", \"assert power(7, 2) == 49\", \"assert power(8, 2) == 64\", \"assert power(9, 2) == 81\", ...
{ "split": "train", "index": 80035, "acecode_id": "evol_8909", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, write a function that rotates the elements of the array to the right by a specified number of positions. The rotation should be done in such a way that elements that are rotated beyond the last index wrap around to the beginning of the array. For exa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rotate_array([1, 2, 3, 4, 5], 2) == [4, 5, 1, 2, 3]\", \"assert rotate_array([1, 2, 3], 1) == [3, 1, 2]\", \"assert rotate_array([1, 2, 3, 4, 5], 5) == [1, 2, 3, 4, 5]\", \"assert rotate_array([1], 10) == [1]\", \"assert rotate_array([10, 9, 8], 2) == [9, 8,...
{ "split": "train", "index": 80036, "acecode_id": "evol_16688", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of ethnicity items, each represented by a code and a display value. Your function should take a list of tuples, where each tuple contains an ethnicity code (a string) and its corresponding display value (also a strin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_ethnicity_items([('001', 'Asian'), ('002', 'Black'), ('003', 'White')]) == ['001: Asian', '002: Black', '003: White']\", \"assert format_ethnicity_items([('004', 'Hispanic'), ('005', 'Native American')]) == ['004: Hispanic', '005: Native American']\",...
{ "split": "train", "index": 80037, "acecode_id": "oss_1328", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function called `get_view_by_title` that takes in a list of view objects and a string representing the title of a view. The function should return the view object that matches the given title. If no view with the given title exists, the functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_view_by_title([{'Title': 'View1'}, {'Title': 'View2'}, {'Title': 'View3'}], 'View2') == {'Title': 'View2'}\", \"assert get_view_by_title([{'Title': 'View1'}, {'Title': 'View2'}, {'Title': 'View3'}], 'View4') == None\", \"assert get_view_by_title([], 'Vie...
{ "split": "train", "index": 80038, "acecode_id": "oss_5971", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that performs element-wise addition of two input lists, which may be None or empty. The function should handle these cases appropriately and return the result as a new list. Your function should meet the following requirements:...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_ignore_empty(None, None) == None\", \"assert add_ignore_empty([], []) == None\", \"assert add_ignore_empty([1, 2], None) == [1, 2]\", \"assert add_ignore_empty(None, [3, 4]) == [3, 4]\", \"assert add_ignore_empty([], [5, 6]) == [5, 6]\", \"assert add_ign...
{ "split": "train", "index": 80039, "acecode_id": "oss_15036", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the prices of items in a store. Your task is to write a function that calculates the maximum profit you can achieve by buying and selling one item. You can only buy an item before you sell it. The function should return the maximum ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_profit([7, 1, 5, 3, 6, 4]) == 5\", \"assert max_profit([7, 6, 4, 3, 1]) == 0\", \"assert max_profit([2, 4, 1]) == 2\", \"assert max_profit([1, 2]) == 1\", \"assert max_profit([]) == 0\", \"assert max_profit([5, 3, 2, 4]) == 2\", \"assert max_profit([3, 2...
{ "split": "train", "index": 80040, "acecode_id": "bigcode_python_fns_22065", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary `influxdb_parameters` that contains configuration settings for an InfluxDB datasource, including the server protocol (either 'http' or 'https'), container name, organization, bucket, and token. Based on these parameters, implement a function `create_i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_influxdb_datasource_config({'InfluxDBServerProtocol': 'http', 'InfluxDBContainerName': 'my_container', 'InfluxDBOrg': 'my_org', 'InfluxDBBucket': 'my_bucket', 'InfluxDBToken': 'my_token'}, 'cert_value', 'key_value') == {'name': 'datasource_name', 'typ...
{ "split": "train", "index": 80041, "acecode_id": "bigcode_python_fns_42013", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function called `bubble_sort` that takes a list of integers as input and sorts the list in non-decreasing order using the Bubble Sort algorithm. The function should return the sorted list.\nPlease reason step by step, then write a self-contained Python solution. Giv...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bubble_sort([3, 2, 6, 4, 1]) == [1, 2, 3, 4, 6]\", \"assert bubble_sort([5]) == [5]\", \"assert bubble_sort([2, 1]) == [1, 2]\", \"assert bubble_sort([4, 3, 2, 1]) == [1, 2, 3, 4]\", \"assert bubble_sort([1, 2, 3, 4]) == [1, 2, 3, 4]\", \"assert bubble_sort(...
{ "split": "train", "index": 80042, "acecode_id": "evol_34910", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the process of updating documentation files. The function should take a list of component names as input and return a list of strings, where each string is formatted as 'Component <name> documentation updated.' for each com...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_documentation(['ComponentA', 'ComponentB']) == ['Component ComponentA documentation updated.', 'Component ComponentB documentation updated.']\", \"assert update_documentation(['ComponentX']) == ['Component ComponentX documentation updated.']\", \"asse...
{ "split": "train", "index": 80043, "acecode_id": "bigcode_python_fns_26085", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a function that processes a list of personal blog objects, each represented as a dictionary. Each blog object contains attributes including 'objectId', 'title', 'originalUrl', 'viewsCount', 'createdAt', and 'verifyCreatedAt'. Your task is to extract the re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_blogs([{ 'objectId': '1', 'title': 'Blog A', 'originalUrl': 'http://example.com/a', 'viewsCount': 10, 'createdAt': '2022-05-01T10:00:00.000Z', 'verifyCreatedAt': '2022-05-01T10:00:00.000Z' }]) == '2022-05-01T10:00:00.000Z'\", \"assert process_blogs([...
{ "split": "train", "index": 80044, "acecode_id": "oss_2209", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D array 'nums' representing a matrix and two positive integers 'r' and 'c' representing the number of rows and columns respectively, implement a function reshape_mat that reshapes the matrix into a new matrix with the specified number of rows and columns. If the reshap...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reshape_mat([[1,2],[3,4]], 1, 4) == [[1, 2, 3, 4]]\", \"assert reshape_mat([[1,2],[3,4]], 2, 4) == [[1, 2], [3, 4]]\", \"assert reshape_mat([[1]], 1, 1) == [[1]]\", \"assert reshape_mat([[1,2,3]], 3, 1) == [[1], [2], [3]]\", \"assert reshape_mat([[1,2,3],[4,...
{ "split": "train", "index": 80045, "acecode_id": "evol_23705", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the export of trace data based on specific parameters. The function `export_trace_data` takes a dictionary containing the following keys: 'RM_ROITrace', 'GDM_outputType', 'GDM_chunkPostStim', and 'GDM_chunkPreStim'. The fun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert export_trace_data({'RM_ROITrace': 3, 'GDM_outputType': 'chunks_only', 'GDM_chunkPostStim': 2, 'GDM_chunkPreStim': 2}) == 'Exporting chunks_only for RM_ROITrace 3 with pre-stimulus time 2 seconds and post-stimulus time 2 seconds.'\", \"assert export_trace_dat...
{ "split": "train", "index": 80046, "acecode_id": "bigcode_python_fns_25055", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D array of integers, write a function that determines the total number of unique elements within the array. A unique element is defined as an element that appears exactly once across the entire 2D array. Your function should return the count of such unique elements.\nP...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert solve([[1, 1, 1], [2, 2, 2], [3, 3, 3]]) == 0\", \"assert solve([[5, 5], [5, 5], [5, 5]]) == 0\", \"assert solve([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 9\", \"assert solve([[1, 2], [1, 2], [3, 4]]) == 2\", \"assert solve([[10, 20, 30], [10, 20, 30], [40, 50, ...
{ "split": "train", "index": 80047, "acecode_id": "evol_24322", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a 2D array of integers, implement a function that calculates a hash value for each row in the array. The hash value should be generated using a built-in hash function on the tuple representation of the row. The function should return a new 2D array containing the hash val...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_hash([[1]]) == [[hash((1,)), 1]]\", \"assert calculate_hash([[1, 2], [3, 4]]) == [[hash((1, 2)), 1, 2], [hash((3, 4)), 3, 4]]\", \"assert calculate_hash([[5, 6, 7]]) == [[hash((5, 6, 7)), 5, 6, 7]]\", \"assert calculate_hash([[0]]) == [[hash((0,)),...
{ "split": "train", "index": 80048, "acecode_id": "evol_33840", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function named `identity_func` that takes a single argument `x`. The function should return the value of `x` unchanged. The input can be of any type including integers, floats, strings, lists, or dictionaries. Your task is to ensure that the function behaves as an i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert identity_func(42) == 42\", \"assert identity_func('test') == 'test'\", \"assert identity_func(3.14) == 3.14\", \"assert identity_func([1, 2, 3]) == [1, 2, 3]\", \"assert identity_func({'key': 'value'}) == {'key': 'value'}\", \"assert identity_func(None) == N...
{ "split": "train", "index": 80049, "acecode_id": "bigcode_python_fns_8125", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the arithmetic mean of a list of numbers without using any libraries. The arithmetic mean is the sum of the numbers divided by the count of the numbers. The function should take a list of floats or integers as input and return a float repres...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert arithmetic_mean([1, 2, 3, 4, 5]) == 3.0\", \"assert arithmetic_mean([10, 20, 30]) == 20.0\", \"assert arithmetic_mean([-1, 0, 1]) == 0.0\", \"assert arithmetic_mean([5]) == 5.0\", \"assert arithmetic_mean([-10, -20, -30]) == -20.0\", \"assert arithmetic_mean...
{ "split": "train", "index": 80050, "acecode_id": "evol_20941", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers and a target sum, implement a function that counts the number of unique pairs (a, b) such that a + b equals the target sum. The pairs must be unique in the sense that (a, b) is considered the same as (b, a), and should not be counted more than once. The...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_duos([1, 2, 3, 2, 4], 5) == 2\", \"assert count_unique_duos([1, 1, 1, 1], 2) == 1\", \"assert count_unique_duos([0, 0, 0, 0], 0) == 1\", \"assert count_unique_duos([1, 2, 3, 4, 5], 10) == 0\", \"assert count_unique_duos([], 5) == 0\", \"assert c...
{ "split": "train", "index": 80051, "acecode_id": "evol_31293", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a dictionary represented as a list of tuples, where each tuple contains a key-value pair. Write a function that returns a list of all the keys in the dictionary. The function should handle edge cases such as an empty dictionary. The input will be a list of tuples,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_keys([('a', 1), ('b', 2), ('c', 3)]) == ['a', 'b', 'c']\", \"assert get_keys([]) == []\", \"assert get_keys([('x', 10)]) == ['x']\", \"assert get_keys([('key1', 100), ('key2', 200)]) == ['key1', 'key2']\", \"assert get_keys([('first', 1), ('second', 2), ...
{ "split": "train", "index": 80052, "acecode_id": "bigcode_python_fns_38628", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a string and a delimiter as input and returns a list of substrings obtained by splitting the string at each occurrence of the delimiter. The function should handle cases where the delimiter is not found in the string, or where the string is empty...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert dissect_string('apple,banana,cherry', ',') == ['apple', 'banana', 'cherry']\", \"assert dissect_string('apple;banana;cherry', ';') == ['apple', 'banana', 'cherry']\", \"assert dissect_string('apple', ',') == ['apple']\", \"assert dissect_string('', ',') == [...
{ "split": "train", "index": 80053, "acecode_id": "evol_13500", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create a function to validate a URL. Implement the function `url_check(url_name)` which takes a string representing a URL and returns 'Valid' if the URL is valid, and 'Invalid' otherwise. A URL is considered valid only if all the below conditions are met: - The URL contains onl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert url_check('https://exampleWebsite1.com') == 'Valid'\", \"assert url_check('http://example-site.org') == 'Valid'\", \"assert url_check('http://example-123.gov') == 'Valid'\", \"assert url_check('http://example..com') == 'Invalid'\", \"assert url_check('http:/...
{ "split": "train", "index": 80054, "acecode_id": "evol_8342", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function `fibonacci_series(n)` that returns a list of the first n Fibonacci numbers. The function should raise a ValueError with a meaningful message if a non-integer value is provided for n. For example, if n is a string or a float, the function should raise an err...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci_series(0) == []\", \"assert fibonacci_series(1) == [0]\", \"assert fibonacci_series(2) == [0, 1]\", \"assert fibonacci_series(3) == [0, 1, 1]\", \"assert fibonacci_series(4) == [0, 1, 1, 2]\", \"assert fibonacci_series(5) == [0, 1, 1, 2, 3]\", \"as...
{ "split": "train", "index": 80055, "acecode_id": "evol_7540", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `check_appellation(appellation: str) -> bool` that checks whether a given string `appellation` consists of exactly 5 lowercase alphabetic characters, and that the first character is a consonant. The function should return `True` if both conditions are satis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_appellation('apple') == False\", \"assert check_appellation('raven') == True\", \"assert check_appellation('tiger') == True\", \"assert check_appellation('eagle') == False\", \"assert check_appellation('mango') == True\", \"assert check_appellation('gr...
{ "split": "train", "index": 80056, "acecode_id": "evol_16997", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `intersperse` that takes a list of integers, a delimiter integer, a boolean flag `even_positions_only` (default is False), and an optional integer `skip_first_n` (default is 0). The function should return a new list with the delimiter inserted after every e...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert intersperse([1, 2, 3], 0) == [1, 0, 2, 0, 3]\", \"assert intersperse([1, 2, 3, 4], 9) == [1, 9, 2, 9, 3, 9, 4]\", \"assert intersperse([], 5) == []\", \"assert intersperse([7, 8, 9], 2, even_positions_only=True, skip_first_n=2) == [7, 8, 9]\", \"assert inter...
{ "split": "train", "index": 80057, "acecode_id": "evol_10263", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes in a list of strings representing entities in an e-discovery system. Each string contains an `id` followed by a `type`, separated by a space. Your goal is to transform this list into a dictionary where the keys are the `id`s an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_entities(['1 document', '2 email', '3 image']) == {'1': 'document', '2': 'email', '3': 'image'}\", \"assert transform_entities(['a report', 'b spreadsheet', 'c presentation']) == {'a': 'report', 'b': 'spreadsheet', 'c': 'presentation'}\", \"assert ...
{ "split": "train", "index": 80058, "acecode_id": "oss_30614", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `flatten_and_sort(matrix)` that takes a two-dimensional matrix of integers as input and returns a one-dimensional list containing all the elements of the matrix sorted in ascending order. The matrix can have a size up to 1000x1000.\nPlease reason step by st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten_and_sort([[1, 2], [3, 4]]) == [1, 2, 3, 4]\", \"assert flatten_and_sort([[5, 3], [8, 1]]) == [1, 3, 5, 8]\", \"assert flatten_and_sort([[1, 1, 1], [1, 1, 1]]) == [1, 1, 1, 1, 1, 1]\", \"assert flatten_and_sort([[10, 20], [30, 40]]) == [10, 20, 30, 40...
{ "split": "train", "index": 80059, "acecode_id": "evol_3738", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `find_primes(max_limit)` that returns a list of all prime numbers up to a predefined positive integer `max_limit`. The function should not use any inbuilt mathematical functions or modules. If the input is invalid (i.e., negative or non-numerical), the func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_primes('10') == [2, 3, 5, 7]\", \"assert find_primes('20') == [2, 3, 5, 7, 11, 13, 17, 19]\", \"assert find_primes('0') == []\", \"assert find_primes('-5') == []\", \"assert find_primes('abc') == []\", \"assert find_primes('1') == []\", \"assert find_pr...
{ "split": "train", "index": 80060, "acecode_id": "evol_26452", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that calculates the recurrence rate of a specified pair of characters (dyad) within a given text string. The recurrence rate is defined as the number of times the dyad appears in the text string divided by the total number of possible positions for the dyad in ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert dyad_recurrence_rate('hello world', 'lo') == 0.1\", \"assert dyad_recurrence_rate('', 'ab') == 0.0\", \"assert dyad_recurrence_rate('abracadabra', '') == 0.0\", \"assert dyad_recurrence_rate('abracadabra', 'xyz') == 0.0\", \"assert dyad_recurrence_rate('a', ...
{ "split": "train", "index": 80061, "acecode_id": "evol_31425", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given an IP address and a subnet mask, implement a function to compute the network address. The function should take two parameters: a string `ip_address` representing the IP address in the format 'x.x.x.x' (where x is an integer between 0 and 255) and a string `subnet_mask` re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_network_address('192.168.1.1', '255.255.255.0') == '192.168.1.0'\", \"assert compute_network_address('10.0.0.5', '255.0.0.0') == '10.0.0.0'\", \"assert compute_network_address('172.16.254.1', '255.240.0.0') == '172.16.0.0'\", \"assert compute_network...
{ "split": "train", "index": 80062, "acecode_id": "evol_3809", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer n, write a function that generates a list of dictionaries. Each dictionary should have two keys: 'content' and 'destination'. The 'content' key should contain a string formatted as 'the key is **{i}**' where i is the index from 0 to n-1. The 'destination' key s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_items(0) == []\", \"assert generate_items(1) == [{'content': 'the key is **0**', 'destination': '1.rst'}]\", \"assert generate_items(2) == [{'content': 'the key is **0**', 'destination': '1.rst'}, {'content': 'the key is **1**', 'destination': '1.rs...
{ "split": "train", "index": 80063, "acecode_id": "bigcode_python_fns_11716", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of email addresses as input and returns a tuple containing two elements: a list of email addresses sorted by their character count (including subdomains) and a dictionary that counts the number of different email providers. An email provider i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_providers_and_sort(['john@google.com', 'jane@google.com', 'admin@site.com']) == (['admin@site.com', 'john@google.com', 'jane@google.com'], {'google': 2, 'site': 1})\", \"assert count_providers_and_sort(['foo@bar.com', 'baz@qux.com', 'quux@corge.com', '...
{ "split": "train", "index": 80064, "acecode_id": "evol_13306", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that takes an integer `N` and a function `fn` as input and returns a list of strings. The function should execute the given function `fn` `N` times and collect the results in a list. Each time `fn` is called, it returns a strin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert repeat_module_names(1, lambda: 'module1') == ['module1']\", \"assert repeat_module_names(2, lambda: 'module2') == ['module2', 'module2']\", \"assert repeat_module_names(3, lambda: 'module3') == ['module3', 'module3', 'module3']\", \"assert repeat_module_name...
{ "split": "train", "index": 80065, "acecode_id": "oss_386", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the distance between two sets of observations. The function should accept two lists of integers, `obs_first` and `obs_second`, and two additional lists of integers, `infos_first` and `infos_second`. If either `infos_fi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_distance([1, 2, 3], [4, 5, 6], None, None) == 9\", \"assert calculate_distance([1, 2, 3], [4, 5, 6], [1, 2, 3], [4, 5, 6]) == 32\", \"assert calculate_distance([1, 1, 1], [1, 1, 1], None, None) == 0\", \"assert calculate_distance([1, 2, 3], [1, 2, ...
{ "split": "train", "index": 80066, "acecode_id": "oss_9246", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a quadratic objective function defined as f(x) = ax^2 + bx + c, where a, b, and c are constants, implement a function `find_minimum(a: float, b: float, c: float) -> float` that returns the value of x that minimizes the function. You can assume the coefficients a, b, and c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_minimum(1, 6, 9) == -3.0\", \"assert find_minimum(2, -4, 1) == 1.0\", \"assert find_minimum(3, 0, 0) == 0.0\", \"assert find_minimum(1, 0, 0) == 0.0\", \"assert find_minimum(4, -8, 5) == 1.0\", \"assert find_minimum(1, -2, 1) == 1.0\", \"assert find_min...
{ "split": "train", "index": 80067, "acecode_id": "evol_36230", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of file types represented as strings, determine if each file type is automatically synchronized. A file type is considered automatically synchronized if it is either 'image', 'video', or 'document'. Implement a function `is_autosync(file_types: List[str]) -> List[b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_autosync(['image', 'video', 'document']) == [True, True, True]\", \"assert is_autosync(['text', 'audio', 'image']) == [False, False, True]\", \"assert is_autosync(['document', 'spreadsheet', 'video']) == [True, False, True]\", \"assert is_autosync(['archi...
{ "split": "train", "index": 80068, "acecode_id": "bigcode_python_fns_37094", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of 2D points represented as tuples, write a function that computes the Euclidean distance matrix between all pairs of points. The distance between two points (x1, y1) and (x2, y2) is calculated as the square root of ((x2 - x1)² + (y2 - y1)²). The output should be a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_distance_matrix([(1, 2), (3, 4), (5, 6)]) == [[0.0, 2.8284271247461903, 5.656854249492381], [2.8284271247461903, 0.0, 2.8284271247461903], [5.656854249492381, 2.8284271247461903, 0.0]]\", \"assert compute_distance_matrix([(0, 0), (0, 0)]) == [[0.0, 0...
{ "split": "train", "index": 80069, "acecode_id": "bigcode_python_fns_21754", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of integers, and your task is to implement a function that takes this list as input and returns a new list containing only the unique elements from the original list, preserving the order they first appeared. Write a function `remove_duplicates(arr: List[in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates([1, 2, 3, 2, 1, 4]) == [1, 2, 3, 4]\", \"assert remove_duplicates([5, 5, 5, 5]) == [5]\", \"assert remove_duplicates([]) == []\", \"assert remove_duplicates([1, 2, 3, 4]) == [1, 2, 3, 4]\", \"assert remove_duplicates([10, 20, 10, 30, 20]) =...
{ "split": "train", "index": 80070, "acecode_id": "bigcode_python_fns_24823", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a singly linked list and a value, implement a function that deletes all nodes with that value from the list and returns the number of occurrences of that value before deletion. Additionally, for each remaining node in the list, return a list of strings that indicate the o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert delete_and_count(create_linked_list([1, 1, 1, 1]), 1) == ([], 4)\", \"assert delete_and_count(create_linked_list([10]), 10) == ([], 1)\", \"assert delete_and_count(create_linked_list([]), 5) == ([], 0)\", \"assert delete_and_count(create_linked_list([5, 5, 5...
{ "split": "train", "index": 80071, "acecode_id": "evol_15217", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function that takes a multi-dimensional array of characters as input and returns a dictionary containing the frequency of each character present in the array. Each character should be a key in the dictionary, and its corresponding value should be the count of occurr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_chars([['a', 'b', 'c'], ['b', 'b', 'a'], ['c', 'a', 'a']]) == {'a': 4, 'b': 3, 'c': 2}\", \"assert count_chars([['x', 'y', 'z'], ['x', 'x', 'y']]) == {'x': 3, 'y': 2, 'z': 1}\", \"assert count_chars([['$', '%', '#'], ['$', '#', '$']]) == {'$': 3, '%': ...
{ "split": "train", "index": 80072, "acecode_id": "evol_32325", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a domain name and an access token as input and simulates an update process for a DNS entry. Your function should return True if the update is successful or False if it fails. The update is considered successful if the domai...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_dns_entry('example.com', 'validtoken123') == True\", \"assert update_dns_entry('example.com', 'short') == False\", \"assert update_dns_entry('', 'validtoken123') == False\", \"assert update_dns_entry('anotherexample.com', '1234567890') == True\", \"as...
{ "split": "train", "index": 80073, "acecode_id": "bigcode_python_fns_9827", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes a string containing a paragraph as input and returns a dictionary demonstrating the frequency of each unique character in the string, excluding spaces. The function should ignore the case of the characters, treating 'A' and 'a' as the same character....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert char_frequency('The quick brown fox jumps over the lazy dog') == {'t': 2, 'h': 2, 'e': 3, 'q': 1, 'u': 2, 'i': 1, 'c': 1, 'k': 1, 'b': 1, 'r': 2, 'o': 4, 'w': 1, 'n': 1, 'f': 1, 'x': 1, 'j': 1, 'm': 1, 'p': 1, 's': 1, 'v': 1, 'l': 1, 'a': 1, 'z': 1, 'y': 1, ...
{ "split": "train", "index": 80074, "acecode_id": "evol_2947", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a confusion matrix represented as a 2D list where each element at position (i, j) indicates the number of instances classified as class i that actually belong to class j, and an index representing a specific class label, write a function to calculate the positive predicti...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert positive_predictive_value([[5, 1], [2, 7]], 0) == 0.8333333333333334\", \"assert positive_predictive_value([[0, 0], [0, 0]], 0) == 0\", \"assert positive_predictive_value([[3, 2, 1], [0, 4, 0], [1, 0, 5]], 1) == 1.0\", \"assert positive_predictive_value([[0,...
{ "split": "train", "index": 80075, "acecode_id": "bigcode_python_fns_42397", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers, where each integer represents the weight of an item. Your task is to implement a function that takes this list of weights and returns a new list containing only the weights that are greater than a specified threshold. The function should be nam...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_weights([10, 20, 30, 40], 25) == [30, 40]\", \"assert filter_weights([1, 2, 3, 4], 5) == []\", \"assert filter_weights([100, 200, 300, 400], 250) == [300, 400]\", \"assert filter_weights([5, 10, 15, 20, 25], 15) == [20, 25]\", \"assert filter_weights(...
{ "split": "train", "index": 80076, "acecode_id": "bigcode_python_fns_31601", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes character ownership data for a gaming application. The function will take in a list of character ownership information and return a dictionary containing the total number of unique characters owned by each user. Each...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_character_ownership([{'user_id': 1, 'character_id': 101}, {'user_id': 1, 'character_id': 101}]) == {1: 1}\", \"assert count_character_ownership([]) == {}\", \"assert count_character_ownership([{'user_id': 1, 'character_id': 101}, {'user_id': 2, 'charac...
{ "split": "train", "index": 80077, "acecode_id": "oss_2312", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given two lists of integers, `predicted_curve` and `experimental_curve`, representing the predicted and experimental values of a certain measurement, respectively. Your task is to compute the area between these two curves using the trapezoidal rule. The area is defined ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert area_between_curves([1, 2, 3], [1, 2, 3]) == 0.0\", \"assert area_between_curves([1, 2, 3, 4], [4, 3, 2, 1]) == 5.0\", \"assert area_between_curves([5, 5, 5], [5, 5, 5]) == 0.0\", \"assert area_between_curves([-1, -2, -3], [-3, -2, -1]) == 2.0\", \"assert ar...
{ "split": "train", "index": 80078, "acecode_id": "bigcode_python_fns_33609", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Implement a function `calculate` that takes three parameters: `num1`, `num2`, and `operation`. The `operation` parameter can be either 'add' or 'subtract'. The function should return the result of adding or subtracting `num1` and `num2` based on the value of `operation`. If the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate(5, 3, 'add') == 8\", \"assert calculate(10, 4, 'subtract') == 6\", \"assert calculate(-1, -1, 'add') == -2\", \"assert calculate(-5, 3, 'subtract') == -8\", \"assert calculate(0, 0, 'add') == 0\", \"assert calculate(7, 5, 'subtract') == 2\", \"asse...
{ "split": "train", "index": 80079, "acecode_id": "evol_31305", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to split a list of image file paths into two separate lists: a training set and a validation set. The function should take a list of strings representing image file paths and a ratio (default value 0.8) that determines the proportion ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert split_dataset(['img1.jpg', 'img2.jpg'], 0.5) == (['img1.jpg'], ['img2.jpg'])\", \"assert split_dataset([], 0.5) == ([], [])\", \"assert split_dataset(['img1.jpg'], 0.0) == ([], ['img1.jpg'])\", \"assert split_dataset(['img1.jpg', 'img2.jpg', 'img3.jpg'], 1.0...
{ "split": "train", "index": 80080, "acecode_id": "oss_23963", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a sorted array of integers and a target integer. Your task is to implement a function that returns the last index of the target integer in the array. If the target is not present in the array, return the index where it could be inserted to maintain the sorted orde...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_last_index([1, 1, 1, 1, 1], 0, 0, 4) == 0\", \"assert find_last_index([1, 3, 5, 7, 9], 8, 0, 4) == 4\", \"assert find_last_index([2], 1, 0, 0) == 0\", \"assert find_last_index([-5, -3, -1, 0, 2], -6, 0, 4) == 0\", \"assert find_last_index([1, 2, 3, 4, 5...
{ "split": "train", "index": 80081, "acecode_id": "bigcode_python_fns_14104", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the behavior of a network device managing its ports and their descriptions. The function `manage_ports` should accept a list of port operations and return a list of results based on the operations. The operations consist of...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_ports(['add_port(1)', 'add_port(2)', 'add_description(1, \\\"Main server connection\\\")', 'get_description(1)']) == ['Port 1 added.', 'Port 2 added.', 'Description added to port 1.', 'Main server connection']\", \"assert manage_ports(['add_port(1)', ...
{ "split": "train", "index": 80082, "acecode_id": "oss_33796", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that initializes a variable based on an action space and an initializer. The function should take in two parameters: 'action_space', which is a list of numerical values representing the action space, and 'initializer', which is a numerica...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_variable([1, 2, 3], 0) == {'ou_state': 0, 'action_space': [1, 2, 3]}\", \"assert initialize_variable([10, 20], 5) == {'ou_state': 5, 'action_space': [10, 20]}\", \"assert initialize_variable([-1, -2], 3) == {'ou_state': 3, 'action_space': [-1, -2]...
{ "split": "train", "index": 80083, "acecode_id": "oss_23925", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with analyzing mutation types in a genetic dataset. Write a function `mutation_count(mutations: List[str]) -> Dict[str, int]` that takes a list of strings representing mutation types and returns a dictionary where the keys are the unique mutation types and the va...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mutation_count(['A', 'C', 'G', 'A', 'T', 'C', 'A']) == {'A': 3, 'C': 2, 'G': 1, 'T': 1}\", \"assert mutation_count(['T', 'T', 'G', 'G', 'G', 'C', 'T', 'A']) == {'T': 3, 'G': 3, 'C': 1, 'A': 1}\", \"assert mutation_count(['A', 'A', 'A', 'A', 'A']) == {'A': 5}...
{ "split": "train", "index": 80084, "acecode_id": "bigcode_python_fns_29239", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to compute the best mode for a given set of angles and their corresponding trajectories. The best mode is defined as the angle that maximizes the trajectory value, provided that the trajectory value is above a certain threshold. If no...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_best_mode([(90, 0), (80, 1), (70, 2)], 1) == 70\", \"assert compute_best_mode([(10, 5), (20, 10), (30, 15)], 5) == 30\", \"assert compute_best_mode([(0, 0), (45, 1), (90, 3)], 2) == 90\", \"assert compute_best_mode([(0, 1), (45, 2), (90, 3)], 2) == 9...
{ "split": "train", "index": 80085, "acecode_id": "oss_20467", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that removes all numeric characters from a given string. The function should take a single string parameter and return a new string that contains only the non-numeric characters from the input string.\nPlease reason step by step, then write a self-contai...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_nums('Hello123') == 'Hello'\", \"assert filter_nums('This is a test! 456') == 'This is a test! '\", \"assert filter_nums('No numbers here!') == 'No numbers here!'\", \"assert filter_nums('2023 is the year') == ' is the year'\", \"assert filter_nums('P...
{ "split": "train", "index": 80086, "acecode_id": "evol_23201", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of 2D points represented as (x, y) coordinates. Your task is to write a function that calculates the minimum bounding rectangle (MBR) that encloses all the points, and then returns the maximum y-coordinate among the four vertices of this MBR. The function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert upmost_vertex([(1, 2), (3, 4), (5, 6)]) == 6\", \"assert upmost_vertex([(0, 0), (1, 1), (2, 2)]) == 2\", \"assert upmost_vertex([(-1, -1), (-2, -2), (-3, -3)]) == -1\", \"assert upmost_vertex([(5, 10), (10, 5), (5, 0)]) == 10\", \"assert upmost_vertex([(0, 3...
{ "split": "train", "index": 80087, "acecode_id": "oss_4201", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of points in a 2D plane, each represented as a tuple of (x, y) coordinates, implement a function that calculates the area of the convex hull formed by these points. The convex hull is the smallest convex boundary that can encompass all the points. The function shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(convex_hull_area([(0, 0), (1, 0), (0, 1), (1, 1), (0.5, 0.5)]) - 1.0) < 1e-9\", \"assert abs(convex_hull_area([(0, 0), (2, 0), (1, 1)]) - 1.0) < 1e-9\", \"assert abs(convex_hull_area([(1, 1), (2, 2), (3, 3)]) - 0.0) < 1e-9\", \"assert abs(convex_hull_are...
{ "split": "train", "index": 80088, "acecode_id": "bigcode_python_fns_35283", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of 15 integers, write a function that returns the sum of these integers.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block." } ]
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_integers([-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15]) == -120\", \"assert sum_of_integers([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\", \"assert sum_of_integers([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 15\", \"...
{ "split": "train", "index": 80089, "acecode_id": "evol_4947", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates a simple user authentication process. The function should take in user credentials in the form of an email and password and return an indicator of whether the authentication was successful based on predefined user da...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert authenticate_user('user1@example.com', 'password1') == 'Authentication Successful'\", \"assert authenticate_user('user2@example.com', 'password2') == 'Authentication Successful'\", \"assert authenticate_user('user3@example.com', 'password3') == 'Authenticati...
{ "split": "train", "index": 80090, "acecode_id": "oss_26097", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `shuffle_numbers` that takes a list of natural numbers in chronological order and returns a new list containing the same numbers but in a shuffled order. The input list will contain unique natural numbers starting from 1 up to N, where N can be as large as ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shuffle_numbers([1, 2, 3]) != [1, 2, 3]\", \"assert sorted(shuffle_numbers([1, 2, 3, 4])) == [1, 2, 3, 4]\", \"assert len(shuffle_numbers([1, 2, 3, 4, 5])) == 5\", \"assert shuffle_numbers([1]) == [1]\", \"assert shuffle_numbers([1, 2, 3, 4, 5]) != [1, 2, 3,...
{ "split": "train", "index": 80091, "acecode_id": "evol_3932", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two registers, 'h' and 'l', each containing a sequence of bits, implement a function that combines these two sequences into a single sequence of bits by concatenating the bits from register 'l' followed by the bits from register 'h'. After concatenation, return the first ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_first_8_bits('1111', '0000') == 15\", \"assert get_first_8_bits('0000', '0000') == 0\", \"assert get_first_8_bits('1', '1') == 3\", \"assert get_first_8_bits('11111111', '11111111') == 255\", \"assert get_first_8_bits('00000001', '11111110') == 254\", \"...
{ "split": "train", "index": 80092, "acecode_id": "bigcode_python_fns_6850", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a program to analyze the frequency of words in a given list of strings and convert them into sequences of tokens. Your task is to implement a function that takes a list of strings `totalText` as input and performs the following steps: 1. Use a simpl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert tokenize_text([\\\"hello world\\\", \\\"world hello\\\"]) == [[1, 2], [2, 1]]\", \"assert tokenize_text([\\\"apple banana\\\", \\\"banana apple apple\\\"]) == [[1, 2], [2, 1, 1]]\", \"assert tokenize_text([\\\"dog cat\\\", \\\"cat dog dog\\\"]) == [[1, 2], [...
{ "split": "train", "index": 80093, "acecode_id": "oss_26826", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing an interface configuration, write a function `parse_interface_config(interface_str: str) -> dict` that extracts and returns a dictionary containing the interface name, IP address, subnet mask, status, description, VRF, and negotiation fields. The inp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_interface_config('interface Gig0/2;') == {'interface': 'Gig0/2', 'ip': None, 'mask': None, 'status': None, 'description': None, 'vrf': None, 'negotiation': None}\", \"assert parse_interface_config('interface Gig0/3; ip 10.0.0.1; mask 255.0.0.0;') == {'...
{ "split": "train", "index": 80094, "acecode_id": "bigcode_python_fns_42809", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a Gerrit fetch URL given a Gerrit host name. The function should take a single string input representing the host name (e.g., 'gerrit.example.com') and return a complete URL string in the format 'https://{host}/'. Implement...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_gerrit_fetch_url('gerrit.example.com') == 'https://gerrit.example.com/'\", \"assert get_gerrit_fetch_url('mygerrit.org') == 'https://mygerrit.org/'\", \"assert get_gerrit_fetch_url('test-gerrit.com') == 'https://test-gerrit.com/'\", \"assert get_gerrit_f...
{ "split": "train", "index": 80095, "acecode_id": "bigcode_python_fns_42364", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simplified message processing function in Python. The function should take a telegram object as input and check the type of its payload attribute. If the payload is not of type DPTArray, the function should raise a CouldNotParseTelegram except...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_message(Telegram(DPTArray())) == 'Message processed successfully'\", \"assert process_message(Telegram(DPTArray())) == 'Message processed successfully'\", \"assert process_message(Telegram(DPTArray())) == 'Message processed successfully'\", \"assert ...
{ "split": "train", "index": 80096, "acecode_id": "oss_32634", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function called `factorial` that takes a non-negative integer `num` as input and returns the factorial of that number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, factorial(5) should return ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(...
{ "split": "train", "index": 80097, "acecode_id": "evol_34012", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a shopping cart application that allows users to add, remove, and update items in their cart. The application will store cart data using a dictionary to represent the shopping cart for each user. Each cart will be represented as a dictionary wit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_cart({}, 'user1', 'add', 'item1', 2) == {'user1': [{'item_id': 'item1', 'quantity': 2}]}\", \"assert manage_cart({'user1': [{'item_id': 'item1', 'quantity': 2}]}, 'user1', 'remove', 'item1', 0) == {'user1': []}\", \"assert manage_cart({'user1': [{'ite...
{ "split": "train", "index": 80098, "acecode_id": "evol_17400", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a numerical array, implement a function that returns the first five prime numbers from the array and calculates their sum. If there are fewer than five prime numbers in the array, return the primes found and their sum. If there are no prime numbers, return an empty list a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_primes_and_sum([3, 4, 1, 6, 8, 9, 7, 2, 10]) == ([3, 7, 2], 12)\", \"assert find_primes_and_sum([10, 12, 14, 15]) == ([], 0)\", \"assert find_primes_and_sum([11, 13, 17, 19, 23]) == ([11, 13, 17, 19, 23], 83)\", \"assert find_primes_and_sum([0, 1, 4, 6,...
{ "split": "train", "index": 80099, "acecode_id": "evol_23292", "num_tests": 16 }