data_source large_stringclasses 1
value | prompt listlengths 1 1 | ability large_stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a 1D geological model represented as a string in a specific format. The function should take in four lists: `dz`, `vp`, `vs`, and `rho`, which correspond to the depth increments, P-wave velocity, S-wave velocity, and densit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_model_string([10, 20], [1500, 1800], [1000, 1200], [2000, 2200]) == 'MODEL_HEADER\\\\n10 1500 1000 2000\\\\n20 1800 1200 2200'\", \"assert create_model_string([5], [1200], [800], [2500]) == 'MODEL_HEADER\\\\n5 1200 800 2500'\", \"assert create_model_s... | {
"split": "train",
"index": 68700,
"acecode_id": "bigcode_python_fns_24133",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Implement a function that determines whether a specified item exists in a given list of elements. The function should return True if the item is found, and False otherwise. Write the function as follows: def search_list(lst: List[Any], item: Any) -> bool:\nPlease reason step by... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert search_list([1, 2, 3, 4, 5], 3) == True\", \"assert search_list([1, 2, 3, 4, 5], 6) == False\", \"assert search_list(['apple', 'banana', 'cherry'], 'banana') == True\", \"assert search_list(['apple', 'banana', 'cherry'], 'orange') == False\", \"assert search... | {
"split": "train",
"index": 68701,
"acecode_id": "evol_8777",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of strings and returns a dictionary where each string is a key, and its value is the number of times that string appears in the list. Implement the function `count_strings(strings: List[str]) -> Dict[str, int]` which acc... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_strings(['apple', 'banana', 'apple', 'orange', 'banana', 'banana']) == {'apple': 2, 'banana': 3, 'orange': 1}\", \"assert count_strings(['cat', 'dog', 'cat', 'fish']) == {'cat': 2, 'dog': 1, 'fish': 1}\", \"assert count_strings(['hello', 'world', 'hell... | {
"split": "train",
"index": 68702,
"acecode_id": "oss_20726",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `get_prime_factors(m)` that takes an integer `m` as input and returns a list of all unique prime factors of `m`. The prime factors should be listed in ascending order. If `m` is less than 2, return an empty list. For example, if `m = ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_prime_factors(60) == [2, 3, 5]\", \"assert get_prime_factors(1) == []\", \"assert get_prime_factors(2) == [2]\", \"assert get_prime_factors(3) == [3]\", \"assert get_prime_factors(4) == [2]\", \"assert get_prime_factors(5) == [5]\", \"assert get_prime_fa... | {
"split": "train",
"index": 68703,
"acecode_id": "oss_36097",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a contact form submission. The function should accept a dictionary containing the following keys: 'name' (a string representing the contact's name), 'email' (a string representing the contact's email), and 'message' (a stri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_contact_form({'name': 'Alice', 'email': 'alice@example.com', 'message': 'Hello!'}) == {'name': 'Alice', 'email': 'alice@example.com', 'message': 'Hello!', 'status': 'success'}\", \"assert process_contact_form({'name': 'Bob', 'email': 'bob@example.com... | {
"split": "train",
"index": 68704,
"acecode_id": "bigcode_python_fns_15366",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a user access control function for a web application. Write a Python function `access_resource_extended` that takes in a `request` object and a `prop_name` parameter. The `request` object has a `user` attribute that determines the user's authent... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert access_resource_extended(Request(user=AnonymousUser()), 'resource1') == 'Please log in to access this resource.'\", \"assert access_resource_extended(Request(user=AnonymousUser()), 'resource2') == 'Please log in to access this resource.'\", \"assert access_r... | {
"split": "train",
"index": 68705,
"acecode_id": "oss_21341",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Write a function `find_first_n_primes(n)` that returns a list of the first `n` prime numbers. A prime number is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. The function should take a single integer parameter `n` (1 <= n <= 1... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_first_n_primes(1) == [2]\", \"assert find_first_n_primes(2) == [2, 3]\", \"assert find_first_n_primes(3) == [2, 3, 5]\", \"assert find_first_n_primes(4) == [2, 3, 5, 7]\", \"assert find_first_n_primes(5) == [2, 3, 5, 7, 11]\", \"assert find_first_n_prim... | {
"split": "train",
"index": 68706,
"acecode_id": "evol_7918",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string containing a file name and an optional comment character. Your task is to implement a function that returns a modified string where the comment character is stripped from the comment parts of the string. A comment part starts with the comment character an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert strip_comment('example.py', '#') == 'example.py'\", \"assert strip_comment('example.py # This is a comment', '#') == 'example.py '\", \"assert strip_comment('example.py #Comment', '#') == 'example.py '\", \"assert strip_comment('example.py#Comment', '#') == ... | {
"split": "train",
"index": 68707,
"acecode_id": "bigcode_python_fns_25634",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a caching system for a public transportation application that handles stops and buses. Your goal is to create a simple cache for stops and buses, allowing you to store, retrieve, and delete information about each stop and bus by their unique ide... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_cache([('set', 'stop', 1, 'Stop A'), ('set', 'bus', 101, 'Bus X'), ('get', 'stop', 1)]) == ({1: 'Stop A'}, {101: 'Bus X'})\", \"assert manage_cache([('set', 'stop', 2, 'Stop B'), ('get', 'stop', 2)]) == ({2: 'Stop B'}, {})\", \"assert manage_cache([('... | {
"split": "train",
"index": 68708,
"acecode_id": "oss_23482",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks if a user can access a certain page based on their login status. The function, `can_access_page`, takes a boolean parameter `is_logged_in`. If `is_logged_in` is True, the function should return the string 'Access granted to ho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert can_access_page(True) == 'Access granted to home page'\", \"assert can_access_page(False) == 'Access denied, please log in to continue'\", \"assert can_access_page(True) == 'Access granted to home page'\", \"assert can_access_page(False) == 'Access denied, p... | {
"split": "train",
"index": 68709,
"acecode_id": "bigcode_python_fns_6935",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that generates a cryptogram from a given sentence. Each letter in the sentence should be replaced by a different letter, maintaining the original letter's case. Non-alphabetical characters should remain unchanged. The function should ensure that no two letters ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cryptogram('Hello World!') != 'Hello World!'\", \"assert cryptogram('Every cloud has a silver lining.') != 'Every cloud has a silver lining.'\", \"assert cryptogram('Python is fun!') != 'Python is fun!'\", \"assert cryptogram('Data Science') != 'Data Science... | {
"split": "train",
"index": 68710,
"acecode_id": "evol_20274",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string containing a series of words and punctuation marks, write a function that extracts all the unique words enclosed within asterisks (*) and returns them in the order they appear in the string. If a word is enclosed within multiple pairs of asterisks, it should only... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_words_in_asterisks('*hello* world *hello*') == ['hello']\", \"assert extract_words_in_asterisks('*word* *word* *word*') == ['word']\", \"assert extract_words_in_asterisks('*test* this is a *test*') == ['test']\", \"assert extract_words_in_asterisks('... | {
"split": "train",
"index": 68711,
"acecode_id": "oss_710",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `get_signature(signature_hex: str) -> str` that takes a cryptographic signature in hexadecimal format as input and returns its ASCII representation. If the input is not a valid hexadecimal string or cannot be decoded into ASCII, the function should return '... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_signature('48656c6c6f20776f726c64') == 'Hello world'\", \"assert get_signature('5468697320697320612074657374') == 'This is a test'\", \"assert get_signature('4e6f742061206c6f746c65737320737472696e67') == 'Not a lotless string'\", \"assert get_signature('... | {
"split": "train",
"index": 68712,
"acecode_id": "evol_4352",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `cloneGraph` that takes a reference to a node in an undirected graph and returns a deep copy (clone) of that graph. Each node in the graph is represented by the `Node` class, which contains an integer value and a list of its neighbors... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Solution().cloneGraph(None) == None\", \"assert Solution().cloneGraph(Node(1, [])).val == 1\", \"assert Solution().cloneGraph(Node(1, [Node(2, [])])).val == 1\", \"assert Solution().cloneGraph(Node(1, [Node(2, []), Node(3, [])])).val == 1\", \"assert Solutio... | {
"split": "train",
"index": 68713,
"acecode_id": "oss_27046",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python class that holds configuration settings for a web application. Your task is to implement the `LocalConfig` class, which should contain the following attributes: `DEBUG`, `SECRET_KEY`, and `DATABASE_URI`. The `DEBUG` attribute should be a bo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert LocalConfig.DEBUG == True\", \"assert LocalConfig.SECRET_KEY == 'my_secret_key'\", \"assert isinstance(LocalConfig.DEBUG, bool)\", \"assert isinstance(LocalConfig.SECRET_KEY, str)\", \"assert isinstance(LocalConfig.DATABASE_URI, str)\", \"assert LocalConfig.... | {
"split": "train",
"index": 68714,
"acecode_id": "oss_23681",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that checks if two given strings are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once. You should implement the function without using any ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_anagram('listen', 'silent') == True\", \"assert check_anagram('triangle', 'integral') == True\", \"assert check_anagram('apple', 'pale') == False\", \"assert check_anagram('anagram', 'nagaram') == True\", \"assert check_anagram('rat', 'car') == False\"... | {
"split": "train",
"index": 68715,
"acecode_id": "evol_20998",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `error` that represents a type of error message. Your task is to implement a function `is_network_failure(error: str) -> bool` that returns True if the error message indicates a network failure. A network failure is defined as any string that contains the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_network_failure('RETRY_CONNECTION_FAILED') == True\", \"assert is_network_failure('HTTP_TIMEOUT') == True\", \"assert is_network_failure('SOCKET_DISCONNECTED') == True\", \"assert is_network_failure('REQUEST_ABORTED') == True\", \"assert is_network_failur... | {
"split": "train",
"index": 68716,
"acecode_id": "bigcode_python_fns_3136",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that evaluates a submitted solution against a list of test cases. The function should take in a string representing the submitted solution (a Python function named `main` that takes a single argument) and a list of test cases. Each te... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_submission('def main(x): return x * 2', [{'input': 2, 'output': 4}, {'input': 3, 'output': 6}]) == {'Test Case 1': 'Passed', 'Test Case 2': 'Passed'}\", \"assert evaluate_submission('def main(x): return x + 1', [{'input': 5, 'output': 6}, {'input': ... | {
"split": "train",
"index": 68717,
"acecode_id": "oss_8329",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a floating-point number x. Your task is to implement a function `format_float(x: float) -> str` that returns a string representation of the float formatted to two decimal places, ensuring that the total width of the output string is 10 characters. If the input flo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_float(5.1) == ' 5.10'\", \"assert format_float(-3.5) == ' -3.50'\", \"assert format_float(0.0) == ' 0.00'\", \"assert format_float(float('nan')) == ' .'\", \"assert format_float(100.0) == ' 100.00'\", \"assert format_float(-0.1) ==... | {
"split": "train",
"index": 68718,
"acecode_id": "bigcode_python_fns_45514",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the linear power spectrum P(k) for a given wave number k and a scale factor a. The function 'linear_powspec(k, a)' should return the value of the linear power spectrum based on these two inputs. The linear power spectrum is defined as a mathemati... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert linear_powspec(1, 1) == 1\", \"assert linear_powspec(2, 1) == 4\", \"assert linear_powspec(1, 2) == 1\", \"assert linear_powspec(1, 3) == 1\", \"assert linear_powspec(0, 1) == 0\", \"assert linear_powspec(-1, 1) == 1\", \"assert linear_powspec(1, -1) == 1\",... | {
"split": "train",
"index": 68719,
"acecode_id": "bigcode_python_fns_13012",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of unique integers representing the ratings of soldiers standing in a line. Your task is to implement a function that counts how many valid teams of three soldiers can be formed. A valid team is defined as a triple (i, j, k) such that either (rating[i] < ra... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert numTeams([5,4,3,2,1]) == [(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]\", \"assert numTeams([4,3,2,1]) == [(0, 0), (0, 0), (0, 0), (0, 0)]\", \"assert numTeams([7, 8, 9]) == [(0, 0), (0, 0), (0, 0)]\", \"assert numTeams([1, 1, 1, 1, 1]) == [(0, 0), (0, 0), (0, 0)... | {
"split": "train",
"index": 68720,
"acecode_id": "evol_34636",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary containing tasks and their corresponding descriptions. Write a function `get_task_description(tasks: dict, name: str) -> str` that takes in this dictionary and a task name as input. The function should return the description of the task if it exists i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_task_description({'task1': 'Do the laundry', 'task2': 'Buy groceries'}, 'task1') == 'Do the laundry'\", \"assert get_task_description({'task1': 'Do the laundry', 'task2': 'Buy groceries'}, 'task2') == 'Buy groceries'\", \"assert get_task_description({'ta... | {
"split": "train",
"index": 68721,
"acecode_id": "bigcode_python_fns_22975",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing the function `write_string_to_list` that simulates writing a string value to a specified collection represented by a list in Python. The function takes three parameters: `collection` (a list of strings representing the collection), and `value` (... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert write_string_to_list([], 'hello') == ['hello']\", \"assert write_string_to_list(['hello'], 'world') == ['hello', 'world']\", \"assert write_string_to_list(['hello', 'world'], 'hello') == ['hello', 'world']\", \"assert write_string_to_list(['apple', 'banana']... | {
"split": "train",
"index": 68722,
"acecode_id": "oss_32867",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers and a desired sum, implement a function that returns the total number of elements in the list and the total number of subsets whose sum equals the desired sum. The list can contain both positive and negative integers. The function should return the resu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_subsets_equal([1, 2, 3], 6) == (3, 1)\", \"assert find_subsets_equal([], 5) == (0, 0)\", \"assert find_subsets_equal([1, 1, 1, 1], 2) == (4, 6)\", \"assert find_subsets_equal([-1, -2, -3], -3) == (3, 1)\", \"assert find_subsets_equal([4, 4, 4], 8) == (3... | {
"split": "train",
"index": 68723,
"acecode_id": "evol_3643",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given a list of 2D points, implement a function `generate_arrows(startPoints: List[Tuple[float, float]], endPoints: Optional[List[Tuple[float, float]]] = None) -> List[Tuple[Tuple[float, float], Tuple[float, float]]]:\n\nThis function should generate a list of arrows defined by... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_arrows([(0, 0), (1, 1)], [(2, 2), (3, 3)]) == [((0, 0), (2, 2)), ((1, 1), (3, 3))]\", \"assert generate_arrows([(0, 0), (1, 1)]) == [((0, 0), (0, 0)), ((1, 1), (1, 1))]\", \"assert generate_arrows([(1, 2)], [(3, 4)]) == [((1, 2), (3, 4))]\", \"asser... | {
"split": "train",
"index": 68724,
"acecode_id": "bigcode_python_fns_5586",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of resource details and returns a list of formatted strings representing each resource's details. Each resource detail is a dictionary containing the keys 'name', 'type', 'address', 'phone', 'latitude', 'longitude', and ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_resources([{'name': 'Feed Me Now', 'type': 'restaurant', 'address': '123 1st Street, New York, NY', 'phone': '555-5555', 'latitude': 123.123, 'longitude': -123.123, 'description': 'stub'}]) == ['Name: Feed Me Now, Type: restaurant, Address: 123 1st St... | {
"split": "train",
"index": 68725,
"acecode_id": "oss_10428",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that determines the outcome of a game of rock-paper-scissors between two players. The function should take two arguments representing the choices of the two players and return the result as a string indicating the winner or a t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rock_paper_scissors_winner('rock', 'scissors') == 'Player 1 wins'\", \"assert rock_paper_scissors_winner('scissors', 'paper') == 'Player 1 wins'\", \"assert rock_paper_scissors_winner('paper', 'rock') == 'Player 1 wins'\", \"assert rock_paper_scissors_winner... | {
"split": "train",
"index": 68726,
"acecode_id": "oss_10608",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `swarm_post_deploy(deploy_results: List[Union[str, Exception]], swarm_id: int, swarm_trace_id: int) -> None`. This function simulates the callback run after deployments in a swarm system. The function takes in a list of deployment res... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert swarm_post_deploy(['success', 'success'], 1, 100) is None\", \"assert swarm_post_deploy(['success', 'success', 'success'], 4, 400) is None\", \"assert swarm_post_deploy(['success'], 7, 700) is None\", \"assert swarm_post_deploy(['success']*100, 10, 1000) is ... | {
"split": "train",
"index": 68727,
"acecode_id": "bigcode_python_fns_1988",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Write a function that removes all occurrences of a specified letter from a given string. The function should take in two parameters: a string 'text' and a character 'letter'. The function should return a new string that does not contain the specified letter.\nPlease reason step... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_letter('Hello, World!', 'o') == 'Hell, Wrld!'\", \"assert remove_letter('Leetcode', 'e') == 'Ltcod'\", \"assert remove_letter('Remove all vowels', 'a') == 'Remove ll vowels'\", \"assert remove_letter('ABCDABCD', 'C') == 'ABDABD'\", \"assert remove_let... | {
"split": "train",
"index": 68728,
"acecode_id": "evol_2527",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if a given string completely matches a specified regular expression pattern. Write a function `is_fullmatch(regex: str, string: str) -> bool` that takes in a regular expression pattern `regex` and a string `string`. The fu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_fullmatch('a*b', 'aaab') == True\", \"assert is_fullmatch('a*b', 'b') == True\", \"assert is_fullmatch('a*b', 'aab') == True\", \"assert is_fullmatch('a*b', 'aaa') == False\", \"assert is_fullmatch('a*b', 'ab') == True\", \"assert is_fullmatch('a*b', 'a')... | {
"split": "train",
"index": 68729,
"acecode_id": "bigcode_python_fns_25079",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that generates the Fibonacci number at a specific index. The function should take an integer n as input and return the nth Fibonacci number. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n >= 2.\nPlease rea... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fibonacci(0) == 0\", \"assert fibonacci(1) == 1\", \"assert fibonacci(2) == 1\", \"assert fibonacci(3) == 2\", \"assert fibonacci(4) == 3\", \"assert fibonacci(5) == 5\", \"assert fibonacci(6) == 8\", \"assert fibonacci(7) == 13\", \"assert fibonacci(8) == 2... | {
"split": "train",
"index": 68730,
"acecode_id": "evol_18437",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an input string, write a Python function that returns a dictionary containing the frequency of each character in the string, including special characters and whitespace. The keys of the dictionary should be the characters and the values should be their respective counts.\... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert char_frequency('Hello, World!') == {'H': 1, 'e': 1, 'l': 3, 'o': 2, ',': 1, ' ': 1, 'W': 1, 'r': 1, 'd': 1, '!': 1}\", \"assert char_frequency('') == {}\", \"assert char_frequency('abcabc') == {'a': 2, 'b': 2, 'c': 2}\", \"assert char_frequency('a') == {'a':... | {
"split": "train",
"index": 68731,
"acecode_id": "evol_20462",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `delete_routing_segment(segment_id: int) -> bool` that simulates the deletion of a routing segment based on its numeric identifier. The function should return `True` if the segment is successfully deleted (simulated by checking if `se... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert delete_routing_segment(1) == True\", \"assert delete_routing_segment(5) == True\", \"assert delete_routing_segment(10) == True\", \"assert delete_routing_segment(100) == True\", \"assert delete_routing_segment(200) == True\", \"assert delete_routing_segment(... | {
"split": "train",
"index": 68732,
"acecode_id": "bigcode_python_fns_6876",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a '/', '\\', '#', or blank space. These characters divide the square into contiguous regions. The '#' character represents an obstacle and divides the square into a separate region. Write a function `regio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert regions_by_slashes([' /', '/#']) == 3\", \"assert regions_by_slashes([' /', ' #']) == 2\", \"assert regions_by_slashes(['//', '/#']) == 4\", \"assert regions_by_slashes(['/#', '/#']) == 3\", \"assert regions_by_slashes(['# ', ' #']) == 2\", \"assert regions_... | {
"split": "train",
"index": 68733,
"acecode_id": "evol_35965",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a URL pattern for a web application. The URL pattern should map the empty path to a specific view function and should be formatted as a string. Write a function `create_url_pattern(view_function: str, name: str) -> str` that takes the view function'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_url_pattern('views.HomeView.as_view()', 'home') == \\\"path('', views.HomeView.as_view(), name='home')\\\"\", \"assert create_url_pattern('views.AboutView.as_view()', 'about') == \\\"path('', views.AboutView.as_view(), name='about')\\\"\", \"assert cr... | {
"split": "train",
"index": 68734,
"acecode_id": "oss_24693",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of usernames and a product, implement a function that checks if each user in the list has access to the specified product. The function should return a list of booleans, where each boolean corresponds to whether the user at the same index has access to the product.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_user_product_access(['alice', 'bob', 'charlie'], 'photoshop', {'alice': ['photoshop', 'illustrator'], 'bob': ['lightroom'], 'charlie': []}) == [True, False, False]\", \"assert check_user_product_access(['dave', 'eve'], 'illustrator', {'dave': ['photosh... | {
"split": "train",
"index": 68735,
"acecode_id": "bigcode_python_fns_17369",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating a class that represents an enumeration in Python. The enumeration will be defined by a list of symbols (strings) and an optional documentation string. Write a function `generate_enum_class(enum_name: str, symbols: List[str], doc: Optional[str] = N... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_enum_class('Direction', ['NORTH', 'SOUTH', 'EAST', 'WEST'], 'Cardinal directions') == 'class DirectionClass(object):\\\\n \\\"\\\"\\\"\\\\n Cardinal directions\\\\n \\\"\\\"\\\"\\\\n NORTH = \\\"NORTH\\\"\\\\n SOUTH = \\\"SOUTH\\\"\\\... | {
"split": "train",
"index": 68736,
"acecode_id": "bigcode_python_fns_28928",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function to process scheduling for different environments based on a given configuration. The function should iterate through the list of environments in the configuration, call a `process_scheduling` function for each environment, and log ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert main_processing({'environments': [{'asg': 'asg1'}, {'asg': 'asg2'}, {'asg': 'asg3'}]}) is None\", \"assert main_processing({'environments': [{'asg': 'test1'}, {'asg': 'test2'}]}) is None\", \"assert main_processing({'environments': [{'asg': 'prod-a'}, {'asg'... | {
"split": "train",
"index": 68737,
"acecode_id": "oss_15188",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that computes the sum of two integers without using the '+' operator. The function should take two parameters, x and y, which are both integers, and return their sum. You are required to use bitwise operations to achieve this.\nPlease reason step by step, t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_without_plus(10, 20) == 30\", \"assert add_without_plus(0, 0) == 0\", \"assert add_without_plus(15, 10) == 25\", \"assert add_without_plus(-10, -20) == -30\", \"assert add_without_plus(100, 200) == 300\", \"assert add_without_plus(1, 1) == 2\", \"assert ... | {
"split": "train",
"index": 68738,
"acecode_id": "evol_29009",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given an initial float value. You need to implement a function that performs a series of operations on this float value based on the provided commands. The function should take a starting float value and a list of operations, each specifying an operation type and a valu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert perform_operations(1.0, [('increment', 5)]) == 6.0\", \"assert perform_operations(1.0, [('set', 20)]) == 20.0\", \"assert perform_operations(20.0, [('decrement', 5)]) == 15.0\", \"assert perform_operations(15.0, [('multiply', 2)]) == 30.0\", \"assert perform... | {
"split": "train",
"index": 68739,
"acecode_id": "bigcode_python_fns_27361",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "In a turn-based game, two players, Alice and Bob, take turns subtracting a number from `n` which is currently written on the board. Alice starts first. If `n` is a prime number, the player must subtract a prime number `x` such that `0 < x < n` and `n % x == 0`. If `n` is not a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sophisticatedDivisorContest(2) == True\", \"assert sophisticatedDivisorContest(3) == False\", \"assert sophisticatedDivisorContest(4) == True\", \"assert sophisticatedDivisorContest(5) == False\", \"assert sophisticatedDivisorContest(6) == True\", \"assert s... | {
"split": "train",
"index": 68740,
"acecode_id": "evol_29484",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that searches for an artist in a given list of artist names. The function should take a string representing the artist's name and a list of artist names. If the artist exists in the list, return True; otherwise, return False. Implemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert search_artist('Adele', ['Adele', 'Beyonce', 'Drake']) == True\", \"assert search_artist('Taylor Swift', ['Adele', 'Beyonce', 'Drake']) == False\", \"assert search_artist('Ed Sheeran', ['Ed Sheeran', 'Ariana Grande', 'Bruno Mars']) == True\", \"assert search_... | {
"split": "train",
"index": 68741,
"acecode_id": "bigcode_python_fns_8631",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string `key` that represents an AWS S3 file reference, extract and return the year and month specified in the key after the substrings 'ano=' and 'mes='. The year is represented as a four-digit number immediately following 'ano=' and the month is represented as a two-di... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_year_month_from_key('file_path/ano=2023/mes=05') == (2023, 5)\", \"assert extract_year_month_from_key('file_path/ano=2010/mes=12') == (2010, 12)\", \"assert extract_year_month_from_key('file_path/ano=1999/mes=01') == (1999, 1)\", \"assert extract_yea... | {
"split": "train",
"index": 68742,
"acecode_id": "bigcode_python_fns_38762",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing angles in degrees, write a function that returns the number of unique angles in the list. The angles can be in the range of 0 to 360 degrees, and angles that are equivalent under rotation (e.g., 0 degrees and 360 degrees) should be consider... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unique_angles([0, 360, 180, 90, 270]) == 4\", \"assert count_unique_angles([0, 0, 0, 0]) == 1\", \"assert count_unique_angles([45, 135, 225, 315]) == 4\", \"assert count_unique_angles([10, 370, -350, 10]) == 1\", \"assert count_unique_angles([30, 60, 9... | {
"split": "train",
"index": 68743,
"acecode_id": "bigcode_python_fns_12073",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the LCM (Least Common Multiple) of three integers. The function should take three positive integers as parameters and return their LCM.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lcm_of_three(5, 10, 15) == 30\", \"assert lcm_of_three(1, 2, 3) == 6\", \"assert lcm_of_three(4, 5, 6) == 60\", \"assert lcm_of_three(7, 14, 21) == 42\", \"assert lcm_of_three(8, 9, 12) == 72\", \"assert lcm_of_three(10, 20, 30) == 60\", \"assert lcm_of_thre... | {
"split": "train",
"index": 68744,
"acecode_id": "evol_32077",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `generate_table(rows: int, columns: int) -> List[List[int]]` that generates a table represented as a list of lists containing random integers ranging from 1 to 100. The function should take two parameters: `rows`, the number of horizontal subsections (rows), an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert len(generate_table(15, 10)) == 15\", \"assert len(generate_table(15, 10)[0]) == 10\", \"assert all(1 <= cell <= 100 for row in generate_table(15, 10) for cell in row)\", \"assert len(generate_table(1, 1)) == 1\", \"assert len(generate_table(1, 1)[0]) == 1\",... | {
"split": "train",
"index": 68745,
"acecode_id": "evol_17174",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string `argument`, validate if it represents a valid time offset format. The string should end with one of the characters 'd', 'w', or 'y', representing days, weeks, or years respectively, and should be preceded by a non-negative integer. If the string is invalid, the f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_time_offset('3d') is None\", \"assert validate_time_offset('5w') is None\", \"assert validate_time_offset('2y') is None\", \"assert validate_time_offset('0d') is None\", \"assert validate_time_offset('10w') is None\", \"assert validate_time_offset('... | {
"split": "train",
"index": 68746,
"acecode_id": "bigcode_python_fns_13999",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of content items on an educational platform. Each content item is represented by a dictionary containing the following attributes: 'source_id', 'title', 'license', and 'files' (a list of file paths). Your function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_content_items([{'source_id': '1', 'title': 'Python Basics', 'license': 'CC BY', 'files': []}], '1', 'Advanced Python', '', 'nonexistent.zip') == [{'source_id': '1', 'title': 'Advanced Python', 'license': 'CC BY', 'files': []}]\", \"assert update_conte... | {
"split": "train",
"index": 68747,
"acecode_id": "oss_34202",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating a crontab entry for a backup job based on a given configuration. The configuration contains a command and a schedule. Your function should take in the command as a string and a schedule as a string. If the schedule is empty or invalid, you should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_crontab_entry('backup.sh', '0 3 * * *') == '0 3 * * * backup.sh\\\\n'\", \"assert generate_crontab_entry('backup.sh', 'invalid schedule') == '0 2 * * * backup.sh\\\\n'\", \"assert generate_crontab_entry('backup.sh', '') == '0 2 * * * backup.sh\\\\n'... | {
"split": "train",
"index": 68748,
"acecode_id": "bigcode_python_fns_33361",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of materials and a query string. Your task is to implement a function that returns the top K most relevant materials based on the query. The relevance is determined by how many times the query appears in each material. If two materials have the same relevan... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rank_materials(['rock', 'water', 'air'], 'e', 1) == ['water']\", \"assert rank_materials(['paper', 'pen', 'pencil'], 'p', 2) == ['paper', 'pen']\", \"assert rank_materials(['fabric', 'cotton', 'silk', 'wool'], 'o', 2) == ['cotton', 'wool']\", \"assert rank_m... | {
"split": "train",
"index": 68749,
"acecode_id": "bigcode_python_fns_23367",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `calculate_average` that returns the average value of the integers in the list. The average should be calculated as the sum of the integers divided by the number of integers in the list. If the list is empty, return 0. Your function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average([1, 2, 3, 4, 5]) == 3.0\", \"assert calculate_average([-1, -2, -3, -4, -5]) == -3.0\", \"assert calculate_average([1, -1, 2, -2]) == 0.0\", \"assert calculate_average([0, 0, 0]) == 0.0\", \"assert calculate_average([10]) == 10.0\", \"assert... | {
"split": "train",
"index": 68750,
"acecode_id": "bigcode_python_fns_48470",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating a unique identifier for database entries. Write a function `generate_unique_id()` that returns a string representing a universally unique identifier (UUID) in lowercase and without dashes. The UUID should be generated randomly each time the functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_unique_id().isalnum() == True and len(generate_unique_id()) == 32\", \"assert generate_unique_id() != generate_unique_id()\", \"assert len(generate_unique_id()) == 32\", \"assert all(c in '0123456789abcdef' for c in generate_unique_id())\", \"assert... | {
"split": "train",
"index": 68751,
"acecode_id": "bigcode_python_fns_38109",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers, write a function `set_intersection(s1, s2)` that returns a sorted list of unique integers that are present in both lists. The function should handle duplicate integers in the input lists by considering them only once in the output list.\nPlease reas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_intersection([1, 2, 3], [2, 3, 4]) == [2, 3]\", \"assert set_intersection([1, 1, 2], [2, 3, 3]) == [2]\", \"assert set_intersection([], [1, 2, 3]) == []\", \"assert set_intersection([1, 2, 3], []) == []\", \"assert set_intersection([1, 2, 3], [1, 2, 3]) ... | {
"split": "train",
"index": 68752,
"acecode_id": "evol_34738",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of elements and an integer shift value, implement a function `shift_and_sort(lst, shift)` that shifts the list to the left by the specified shift value and then sorts the remaining elements according to their data type. The sorting order should be: integers first, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert shift_and_sort([], 0) == []\", \"assert shift_and_sort([1, 2, 3], 3) == [1, 2, 3]\", \"assert shift_and_sort([1, 2, 3], 4) == [1, 2, 3]\", \"assert shift_and_sort([1, 2, 3, 4, 5], 0) == [1, 2, 3, 4, 5]\", \"assert shift_and_sort([1, 2, 3, 4, 5], 5) == [1, 2,... | {
"split": "train",
"index": 68753,
"acecode_id": "evol_501",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Write a Python function called `print_pattern(n, step_size)` that takes two integer parameters, `n` and `step_size`, where 1 ≤ n ≤ 5000 and 1 ≤ step_size ≤ n. The function should return a list of strings, each representing a line of a reversed numeric pattern starting from `n` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_pattern(4, 1) == ['4 3 2 1', '3 2 1', '2 1', '1']\", \"assert print_pattern(5, 1) == ['5 4 3 2 1', '4 3 2 1', '3 2 1', '2 1', '1']\", \"assert print_pattern(3, 1) == ['3 2 1', '2 1', '1']\", \"assert print_pattern(15, 1) == ['15 14 13 12 11 10 9 8 7 6 ... | {
"split": "train",
"index": 68754,
"acecode_id": "evol_31783",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with developing a function that takes a list of integers representing the intensity values of a masked MRI image and estimates the tumor volume based on specified intensity thresholds. The function `estimate_tumor_volume` should take the following parameters: \n-... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert estimate_tumor_volume([5, 15, 25, 35, 45], 10, 30) == 2\", \"assert estimate_tumor_volume([100, 200, 150, 50, 75], 100, 200) == 3\", \"assert estimate_tumor_volume([1, 2, 3, 4, 5], 0, 2) == 2\", \"assert estimate_tumor_volume([], 0, 10) == 0\", \"assert esti... | {
"split": "train",
"index": 68755,
"acecode_id": "oss_16641",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a date rule in the format 'Xd', 'Xw', 'Xm', or 'Xy', where 'X' is an integer and 'd', 'w', 'm', 'y' represent days, weeks, months, and years respectively. Your task is to implement a function that converts this date rule into the correspondin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert relative_date_add('1d') == 1\", \"assert relative_date_add('2d') == 2\", \"assert relative_date_add('3w') == 21\", \"assert relative_date_add('1w') == 7\", \"assert relative_date_add('4m') == 120\", \"assert relative_date_add('1m') == 30\", \"assert relative... | {
"split": "train",
"index": 68756,
"acecode_id": "bigcode_python_fns_11667",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves specific information for a user from a list of information records. Each record contains a user's ID and the name of the information associated with that user. You need to implement a function `get_user_information(user_id,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_user_information(1, [(1, 'Info1'), (1, 'Info2'), (2, 'Info3')]) == ['Info1', 'Info2']\", \"assert get_user_information(2, [(1, 'Info1'), (1, 'Info2'), (2, 'Info3')]) == ['Info3']\", \"assert get_user_information(3, [(1, 'Info1'), (1, 'Info2'), (2, 'Info3... | {
"split": "train",
"index": 68757,
"acecode_id": "oss_21544",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of buildings arranged in a row. Your task is to implement a function that calculates the maximum amount of water that can be trapped between the buildings after it rains. The amount of water that can be trapped on top of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert trap_water([0,1,0,2,1,0,1,3,2,1,2,1]) == 6\", \"assert trap_water([4,2,0,3,2,5]) == 9\", \"assert trap_water([1,0,2]) == 1\", \"assert trap_water([0,1,0]) == 0\", \"assert trap_water([1,2,3,4,5]) == 0\", \"assert trap_water([5,4,3,2,1]) == 0\", \"assert trap... | {
"split": "train",
"index": 68758,
"acecode_id": "bigcode_python_fns_26060",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of sentences and a list of crowd labels, where each crowd label contains a worker ID and a list of labels corresponding to words in the sentence. Your task is to create a function `generate_label_matrix(sentences: List[str], crowd_labels: List[List[Tuple[in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_label_matrix([''], [[(0, [0]), (1, [9])]]) == []\", \"assert generate_label_matrix(['Single sentence'], [[(0, [9]), (1, [9])]]) == [[0, 0]]\", \"assert generate_label_matrix(['Another test case'], [[(0, [1]), (1, [9])]]) == [[1, 0]]\", \"assert gene... | {
"split": "train",
"index": 68759,
"acecode_id": "bigcode_python_fns_30834",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a unique identifier for a geostore, implement a function that returns a formatted string representing the geostore's URI. The function should take two parameters: a string `geostore_id` which represents the unique identifier of the geostore, and an optional string `format... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_geostore('12345') == '/geostore/12345?format=esri'\", \"assert get_geostore('67890') == '/geostore/67890?format=esri'\", \"assert get_geostore('abcde') == '/geostore/abcde?format=esri'\", \"assert get_geostore('xyz123', 'geojson') == '/geostore/xyz123?fo... | {
"split": "train",
"index": 68760,
"acecode_id": "bigcode_python_fns_44926",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing a history of events. Each integer corresponds to an event identifier. Your task is to determine if there exists a merge point in the event history. A merge point is defined as an integer that appears at least twice in the list. Impl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert has_merge_point([1, 2, 3, 4, 5, 6]) == False\", \"assert has_merge_point([1, 2, 3, 4, 5, 1]) == True\", \"assert has_merge_point([1, 2, 3, 2, 4, 5]) == True\", \"assert has_merge_point([5, 5, 5, 5, 5]) == True\", \"assert has_merge_point([7, 8, 9, 10, 11, 12... | {
"split": "train",
"index": 68761,
"acecode_id": "bigcode_python_fns_19304",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a program that processes a series of commands to manipulate a list of excluded letters. The program should support the following commands: 'r <letter>': Remove the specified letter from the list of excluded letters only if it is not already excl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_commands(['r a', 'r b', 'r c', 'r b'], ['a', 'e', 'i', 'o', 'u']) == ['a', 'e', 'i', 'o', 'u', 'b', 'c']\", \"assert process_commands(['r x', 'r y', 'r z'], []) == ['x', 'y', 'z']\", \"assert process_commands(['r a', 'r b', 'r c'], ['b']) == ['b', 'a... | {
"split": "train",
"index": 68762,
"acecode_id": "oss_35673",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer s representing the semi-perimeter of a right angle triangle, implement a function `count_solutions(s: int) -> int` that returns the number of unique sets of integer lengths {x, y, z} that can form a right angle triangle with semi-perimeter s. The lengths must s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_solutions(12) == 1\", \"assert count_solutions(36) == 1\", \"assert count_solutions(40) == 1\", \"assert count_solutions(80) == 1\", \"assert count_solutions(300) == 3\", \"assert count_solutions(450) == 4\"]}"
} | {
"split": "train",
"index": 68763,
"acecode_id": "evol_693",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function that filters an array of strings based on a user-defined symbol and returns the filtered strings sorted in ascending alphabetical order. The function should be case-sensitive, meaning that symbols of different cases should be treated as distinct. For exampl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_and_sort(['Apple', 'Peach', 'pear', 'Tangerine', 'Plum', 'Grape', 'Banana', 'banana'], 'P') == ['Peach', 'Plum']\", \"assert filter_and_sort(['Apple', 'Peach', 'pear', 'Tangerine', 'Plum', 'Grape', 'Banana', 'banana'], 'Z') == []\", \"assert filter_an... | {
"split": "train",
"index": 68764,
"acecode_id": "evol_28985",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Implement a function `generate_random_number` that returns a random integer between 1 and 10, inclusive. Each time the function is called, it should return a new random integer within this range.\nPlease reason step by step, then write a self-contained Python solution. Give you... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert 1 <= generate_random_number() <= 10\", \"assert 1 <= generate_random_number() <= 10\", \"assert 1 <= generate_random_number() <= 10\", \"assert 1 <= generate_random_number() <= 10\", \"assert 1 <= generate_random_number() <= 10\", \"assert 1 <= generate_rand... | {
"split": "train",
"index": 68765,
"acecode_id": "evol_26380",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a binary tree represented as a list, implement a function `preorder_traversal(tree: List[Optional[int]]) -> List[int]` that returns a list of values representing the pre-order traversal of the binary tree. In a pre-order traversal, the nodes are visited in the following o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert preorder_traversal([1, 2, 3, None, 4]) == [1, 2, 4, 3]\", \"assert preorder_traversal([1, None, 2]) == [1, 2]\", \"assert preorder_traversal([]) == []\", \"assert preorder_traversal([1]) == [1]\", \"assert preorder_traversal([1, 2, 3]) == [1, 2, 3]\", \"asse... | {
"split": "train",
"index": 68766,
"acecode_id": "bigcode_python_fns_20734",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a mixed alphanumeric string as input and returns the sum of all distinct numerical digits present in the string. For example, given the input 'a1b2c3d4e5', the function should return 15, as it includes the digits 1, 2, 3, 4, and 5.\nPlease reason... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert aggregate_digit('a1b2c3d4e5') == 15\", \"assert aggregate_digit('abc') == 0\", \"assert aggregate_digit('123abc456') == 21\", \"assert aggregate_digit('9876543210') == 45\", \"assert aggregate_digit('hello123') == 6\", \"assert aggregate_digit('noDigitsHere'... | {
"split": "train",
"index": 68767,
"acecode_id": "evol_19459",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings, where each string represents a word. Your task is to implement a function that returns a dictionary containing the frequency of each unique word in the list. The comparison of words should be case-insensitive, meaning that 'Word' and 'word' shou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert word_frequency(['Hello', 'world', 'hello', 'WORLD']) == {'hello': 2, 'world': 2}\", \"assert word_frequency(['Python', 'is', 'great', 'python', 'Great']) == {'python': 2, 'is': 1, 'great': 2}\", \"assert word_frequency(['apple', 'banana', 'Apple', 'Banana', ... | {
"split": "train",
"index": 68768,
"acecode_id": "oss_11956",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Create a function to parse the following XML document and return the author's name. The XML structure will always contain an <author> element within a <book> element. Your function should take a string representing the XML document as input and return the text content of the <a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_author_name('<book><title>The Great Gatsby</title><author>F. Scott Fitzgerald</author><year>1925</year></book>') == 'F. Scott Fitzgerald'\", \"assert get_author_name('<book><title>1984</title><author>George Orwell</author><year>1949</year></book>') == 'G... | {
"split": "train",
"index": 68769,
"acecode_id": "evol_9607",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `update_user` that updates a user's name and age in an in-memory user database represented as a list of dictionaries. Each user is represented as a dictionary with keys 'id', 'name', and 'age'. The function should take three parameters: `id` (an integer), `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_user(1, 'John', 26) == None\", \"assert update_user(2, 'Alice', 30) == None\", \"assert update_user(1, 'John Doe', 28) == None\", \"assert update_user(3, 'Bob', -5) == None\", \"assert update_user(1, '', 26) == None\", \"assert update_user(1, 'Charlie... | {
"split": "train",
"index": 68770,
"acecode_id": "evol_16958",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of edges in the form of tuples, where each tuple can either contain two elements (source, destination) for an unweighted edge or three elements (source, destination, weight) for a weighted edge. Your task is to implement a function that takes in this list o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert build_graph([(1, 2), (2, 3)], True) == {1: [(2, 1)], 2: [(3, 1)]}\", \"assert build_graph([(1, 2), (2, 3), (1, 2)], True) == {1: [(2, 2)], 2: [(3, 1)]}\", \"assert build_graph([(1, 2), (2, 3)], False) == {1: [(2, 1)], 2: [(1, 1), (3, 1)], 3: [(2, 1)]}\", \"a... | {
"split": "train",
"index": 68771,
"acecode_id": "bigcode_python_fns_32913",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that parses a given string and extracts specific information related to a Python package. The function should extract the author's email, package description, and the required dependencies for the package from the given string. Wri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_package_config(\\\"author_email='test@example.com', description='Sample package', install_requires=['requests', 'flask']\\\") == {'author_email': 'test@example.com', 'description': 'Sample package', 'install_requires': ['requests', 'flask']}\", \"asser... | {
"split": "train",
"index": 68772,
"acecode_id": "oss_11547",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `transform_string(input_string: str) -> str` that takes a string as input and performs the following transformations: 1. Replace every instance of a single space with an underscore. 2. Replace any occurrence of two or more consecutive spaces with a hyphen. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_string('hello world') == 'HELLO_WORLD'\", \"assert transform_string('example 1') == 'EXAMPLE_1'\", \"assert transform_string(' example 2') == '_EXAMPLE_2'\", \"assert transform_string('example 3') == 'EXAMPLE-3'\", \"assert transform_string('this... | {
"split": "train",
"index": 68773,
"acecode_id": "evol_5356",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes messages of different types in a network application. The messages are categorized into three types: `TEXT`, `IMAGE`, and `VIDEO`. Your function should take a list of messages as input, where each message is represented... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_message_types([{'type': 'TEXT', 'content': 'Hello!'}, {'type': 'IMAGE', 'content': 'image1.png'}, {'type': 'VIDEO', 'content': 'video1.mp4'}, {'type': 'TEXT', 'content': 'Hi there!'}]) == {'TEXT': 2, 'IMAGE': 1, 'VIDEO': 1}\", \"assert count_message_ty... | {
"split": "train",
"index": 68774,
"acecode_id": "oss_5580",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that determines if one software version is less than another based on semantic versioning rules. The function should take two version strings in the format \"major.minor.patch[-pre_release]\" where `major`, `minor`, and `patch` are intege... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_versions(\\\"1.0.0\\\", \\\"1.0.1\\\") == True\", \"assert compare_versions(\\\"1.2.0\\\", \\\"1.2.0\\\") == False\", \"assert compare_versions(\\\"1.2.4-alpha\\\", \\\"1.2.4\\\") == True\", \"assert compare_versions(\\\"2.0.0\\\", \\\"1.9.9\\\") == ... | {
"split": "train",
"index": 68775,
"acecode_id": "oss_2985",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a list of strings representing different machine learning models. The function should filter out the models that contain a specific keyword and return the remaining models in a sorted list. Implement the function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_and_sort_models(['SVM', 'RandomForest', 'KMeans', 'LinearRegression'], 'K') == ['LinearRegression', 'RandomForest', 'SVM']\", \"assert filter_and_sort_models(['DecisionTree', 'LogisticRegression', 'NaiveBayes', 'XGBoost'], 'X') == ['DecisionTree', 'Lo... | {
"split": "train",
"index": 68776,
"acecode_id": "oss_16092",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `generate_numbers(distribution: List[float], size: int) -> List[int]` that generates a sequence of random integers based on a specific probability distribution. The integers should be in the range of 0 to len(distribution) - 1, where the probability of each... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_numbers([0.05, 0.2, 0.3, 0.45], 10) is not None\", \"assert len(generate_numbers([0.05, 0.2, 0.3, 0.45], 100)) == 100\", \"assert all(0 <= x < 4 for x in generate_numbers([0.05, 0.2, 0.3, 0.45], 50))\", \"assert len(set(generate_numbers([0.1, 0.3, 0... | {
"split": "train",
"index": 68777,
"acecode_id": "evol_1608",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the cleanup of a filesystem directory. The function should take two strings as input: `directory1` and `directory2`, representing paths to two directories. The function should return a list of strings, where each string... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cleanup_directories('map/tiles', 'map/exports') == ['All files in map/tiles have been removed.', 'All files in map/exports have been removed.']\", \"assert cleanup_directories('data/images', 'data/videos') == ['All files in data/images have been removed.', '... | {
"split": "train",
"index": 68778,
"acecode_id": "bigcode_python_fns_13699",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the weights of different items. Your task is to implement a function `canCarry(weights: List[int], capacity: int) -> bool` that determines if it is possible to carry all the items in one trip given a maximum weight capacity. The fun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert canCarry([10, 20, 30], 60) == True\", \"assert canCarry([10, 20, 30], 50) == False\", \"assert canCarry([5, 15, 10], 30) == True\", \"assert canCarry([10, 5, 15, 20], 50) == True\", \"assert canCarry([1, 2, 3, 4, 5], 15) == True\", \"assert canCarry([10], 10... | {
"split": "train",
"index": 68779,
"acecode_id": "bigcode_python_fns_3574",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with setting up a notification system for a postal service. Your function should take in a configuration dictionary that contains the types of notifications to be set up and return a list of strings representing the notifications that have been successfully added... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert setup_notifications({'package': True, 'mail': True}) == ['Package Notification', 'Mail Notification']\", \"assert setup_notifications({'package': True, 'mail': False}) == ['Package Notification']\", \"assert setup_notifications({'package': False, 'mail': Tru... | {
"split": "train",
"index": 68780,
"acecode_id": "bigcode_python_fns_34753",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary representing model configuration and a list of dummy features. Your task is to collate both simple features from the model configuration and the dummy features into a single list. The simple features are extracted from the keys of the 'simple_features... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert collate_features({'simple_features': {'feature1': 1, 'feature2': 2}}, ['dummy1', 'dummy2']) == ['feature1', 'feature2', 'dummy1', 'dummy2']\", \"assert collate_features({'simple_features': {}}, ['dummy1']) == ['dummy1']\", \"assert collate_features({'simple_... | {
"split": "train",
"index": 68781,
"acecode_id": "bigcode_python_fns_12034",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a class named CondType21 that has an attribute Hbar, which represents the height of a bar in meters. Your task is to implement a function that takes an instance of CondType21 as input and returns the height of the bar (Hbar). The height will be a floating-point nu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_bar_height(CondType21(Hbar=10.5)) == 10.5\", \"assert get_bar_height(CondType21(Hbar=0.0)) == 0.0\", \"assert get_bar_height(CondType21(Hbar=-3.2)) == -3.2\", \"assert get_bar_height(CondType21(Hbar=5.1)) == 5.1\", \"assert get_bar_height(CondType21(Hbar... | {
"split": "train",
"index": 68782,
"acecode_id": "bigcode_python_fns_32444",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D array of floating-point numbers, where each column represents a different financial asset's value over time, implement a function that calculates the total return of each asset from the first to the last time period. The return for each asset is computed as the ratio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert total_asset_return([[50.0, 150.0], [50.0, 150.0]]) == [0.0, 0.0]\", \"assert total_asset_return([[10.0, 20.0], [20.0, 40.0]]) == [1.0, 1.0]\", \"assert total_asset_return([[1.0, 1.0], [2.0, 2.0]]) == [1.0, 1.0]\", \"assert total_asset_return([[1.0, 2.0], [0.... | {
"split": "train",
"index": 68783,
"acecode_id": "bigcode_python_fns_28751",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Write a function `triangle_area(a, b, c)` that calculates the area of a triangle given the lengths of its three sides a, b, and c using Heron's Formula. The function should return the area of the triangle. If the provided dimensions do not form a valid triangle, return a messag... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert triangle_area(3, 4, 5) == 6.0\", \"assert triangle_area(10, 10, 10) == 43.30127018922193\", \"assert triangle_area(5, 12, 13) == 30.0\", \"assert triangle_area(7, 8, 9) == 26.832815729997478\", \"assert triangle_area(4, 5, 6) == 9.921567416492215\", \"assert... | {
"split": "train",
"index": 68784,
"acecode_id": "evol_17294",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of accessory tags represented as strings. Each tag can belong to one of the following types: 'clothing', 'jewelry', 'shoes', or 'other'. Your task is to write a function `categorize_tags(tags)` that takes this list of tags as input and returns a dictionary ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert categorize_tags(['bracelet', 'hat', 'shoes']) == {'clothing': 1, 'jewelry': 1, 'shoes': 1, 'other': 0}\", \"assert categorize_tags(['hat', 'scarf', 'gloves', 'socks']) == {'clothing': 4, 'jewelry': 0, 'shoes': 0, 'other': 0}\", \"assert categorize_tags(['bra... | {
"split": "train",
"index": 68785,
"acecode_id": "oss_22530",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Create a function that takes a string containing placeholders and a dictionary. The function should replace the placeholders in the string with the corresponding values from the dictionary and return the modified string. If a placeholder does not have a corresponding value in t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_statements('Hello, {name}!', {'name': 'World'}) == 'Hello, World!'\", \"assert print_statements('Welcome to {place}.', {'place': 'Python Land'}) == 'Welcome to Python Land.'\", \"assert print_statements('{greeting}, {name}!', {'greeting': 'Hi', 'name':... | {
"split": "train",
"index": 68786,
"acecode_id": "evol_26535",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a sequence, determine if it is a list of integers. You need to implement a function that checks whether the provided sequence is of type list and contains only integer elements. If the sequence is empty, it should return True. The function should return True if the sequen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_seq_of([], int) == True\", \"assert is_seq_of([1, 2, 3], int) == True\", \"assert is_seq_of([1, '2', 3], int) == False\", \"assert is_seq_of([1, 2.5, 3], int) == False\", \"assert is_seq_of([1, 2, 3, 4], int) == True\", \"assert is_seq_of([0, -1, 2], int)... | {
"split": "train",
"index": 68787,
"acecode_id": "bigcode_python_fns_33303",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, write a function that calculates and returns the difference between the maximum and minimum values in the array. The function should handle both positive and negative integers, as well as an array containing a single element.\nPlease reason step by s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_difference([12, 24, 3, 8, -1]) == 25\", \"assert find_difference([1, 2, 3, 4, 5]) == 4\", \"assert find_difference([-5, -1, -3, -10]) == 9\", \"assert find_difference([0, 0, 0]) == 0\", \"assert find_difference([7]) == 0\", \"assert find_difference([-1,... | {
"split": "train",
"index": 68788,
"acecode_id": "evol_4731",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a two-dimensional list (matrix) and a specified value, implement a function `replace_first_element(matrix, new_value)` that replaces the first element of each inner list (row) with the provided `new_value`. The function should return the modified matrix.\nPlease reason st... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert replace_first_element([[1, 2], [3, 4]], 10) == [[10, 2], [10, 4]]\", \"assert replace_first_element([[5, 6, 7], [8, 9, 10]], 0) == [[0, 6, 7], [0, 9, 10]]\", \"assert replace_first_element([[1]], 99) == [[99]]\", \"assert replace_first_element([[1, 2, 3], [4... | {
"split": "train",
"index": 68789,
"acecode_id": "evol_2448",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that instantiates a node active learning heuristic based on a given name. The function should take a string input representing the name of the heuristic and a variable number of keyword arguments. Your function should return an instance o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_node_active_learning_heuristic_by_name('heuristic_a') is not None\", \"assert get_node_active_learning_heuristic_by_name('heuristic_b') is not None\", \"assert get_node_active_learning_heuristic_by_name('unknown_heuristic') is None\", \"assert get_node_a... | {
"split": "train",
"index": 68790,
"acecode_id": "bigcode_python_fns_41981",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of student details, where each detail is represented as a tuple containing a student's ID (integer), full name (string), age (integer), and GPA (float). The function should return a dictionary with the student ID as the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_student_details([(1, 'John', 24, 3.2), (2, 'Tom', 26, 2.9), (3, 'Harry', 20, 3.5)]) == {1: ('John', 24, 3.2), 2: ('Tom', 26, 2.9), 3: ('Harry', 20, 3.5)}\", \"assert add_student_details([(101, 'Alice', 30, 3.8)]) == {101: ('Alice', 30, 3.8)}\", \"assert ... | {
"split": "train",
"index": 68791,
"acecode_id": "evol_22890",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that creates a new work item in a project management system. The function takes in a list of child work item IDs, an ID for the new work item, and a title for the new work item. Write a function `create_work_item` that takes in the fo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_work_item([101, 102, 103], 100, 'New Feature Implementation') == \\\"Work item with ID 100 and title 'New Feature Implementation' created and associated with child work items [101, 102, 103].\\\"\", \"assert create_work_item([], 200, 'Bug Fix') == \\\... | {
"split": "train",
"index": 68792,
"acecode_id": "oss_15150",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string representing a JSONPath expression, create a function that validates whether this expression references a single child field in a JSON object. The function should return True if the expression is valid and references exactly one field, and False otherwise. The in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_jsonpath('$.name') == True\", \"assert validate_jsonpath('$.age') == True\", \"assert validate_jsonpath('$.user.name') == False\", \"assert validate_jsonpath('$.name.1') == False\", \"assert validate_jsonpath('$.name[]') == False\", \"assert validat... | {
"split": "train",
"index": 68793,
"acecode_id": "bigcode_python_fns_14613",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a binary string `s` consisting of only '0's and '1's, write a function `countBinarySubstrings` to count the number of non-empty binary substrings that have the same number of consecutive '0's and '1's. A binary substring is defined as a substring that contains an equal nu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert countBinarySubstrings('00110011') == 6\", \"assert countBinarySubstrings('000111') == 3\", \"assert countBinarySubstrings('111000') == 3\", \"assert countBinarySubstrings('111') == 0\", \"assert countBinarySubstrings('000') == 0\", \"assert countBinarySubstr... | {
"split": "train",
"index": 68794,
"acecode_id": "oss_10175",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function named `vowels_count` that takes a string as input and returns the count of vowels in the string. The vowels considered are 'a', 'e', 'i', 'o', 'u', and 'y' is only counted when it appears at the end of the string. The function should ignore the case of the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert vowels_count('abcde') == 2\", \"assert vowels_count('ACEDY') == 3\", \"assert vowels_count('hello world') == 3\", \"assert vowels_count('Y') == 1\", \"assert vowels_count('xyz') == 0\", \"assert vowels_count('aerial') == 4\", \"assert vowels_count('rhythm') ... | {
"split": "train",
"index": 68795,
"acecode_id": "evol_28973",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Your task is to implement a function that takes this list and returns a new list containing the squares of each number in the original list, maintaining the original order. The function should not modify the input list. Write a function `square... | 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([1000]) == [1000000]\", \"assert square_numbers([]) == []\", \"assert square_numbers([-1000, 0, 100... | {
"split": "train",
"index": 68796,
"acecode_id": "bigcode_python_fns_16859",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries, where each dictionary represents a record with various fields. Your task is to transform this data based on a provided schema, which can be a list of column names or a dictionary mapping field names. Implement a function `transform_data(dat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_data([{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}], ['name']) == [{'name': 'Alice'}, {'name': 'Bob'}]\", \"assert transform_data([{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}], ['age']) == [{'age': 30}, {'age': 25}]\", \"as... | {
"split": "train",
"index": 68797,
"acecode_id": "bigcode_python_fns_32007",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a command-line interface (CLI) for a simple logging system. Implement a function `run_command(args: List[str]) -> str` that takes a list of strings representing command arguments. If the command is 'log', it should echo back the message provided a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_command(['log', 'Hello, World!']) == 'Hello, World!'\", \"assert run_command(['log', 'Test message']) == 'Test message'\", \"assert run_command(['exit']) == 'TERMINATED'\", \"assert run_command(['exit', 'with extra args']) == 'TERMINATED'\", \"assert run... | {
"split": "train",
"index": 68798,
"acecode_id": "bigcode_python_fns_12741",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of stock positions, each represented as a dictionary with 'symbol', 'current_price', and 'avg_entry_price', calculate the percentage profit or loss for each position. The percentage profit or loss is calculated using the formula ((current_price - avg_entry_price) /... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_percent_profit([{'symbol': 'AAPL', 'current_price': 150, 'avg_entry_price': 100}]) == {'AAPL': 50.0}\", \"assert calculate_percent_profit([{'symbol': 'GOOG', 'current_price': 2800, 'avg_entry_price': 1400}]) == {'GOOG': 100.0}\", \"assert calculate... | {
"split": "train",
"index": 68799,
"acecode_id": "bigcode_python_fns_1426",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.