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": "Given a list of integers, write a function `sum_of_squares` that calculates the sum of the squares of all the even numbers in the list. The input will be a list of integers, and the output should be a single integer representing the sum of the squares of the even numbers. If th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_squares([1, 2, 3, 4]) == 20\", \"assert sum_of_squares([0, 1, 2, 3]) == 4\", \"assert sum_of_squares([1, 3, 5]) == 0\", \"assert sum_of_squares([-2, -1, 0, 1]) == 4\", \"assert sum_of_squares([2, 4, 6, 8]) == 120\", \"assert sum_of_squares([1, 2, 3, 4...
{ "split": "train", "index": 70400, "acecode_id": "bigcode_python_fns_41941", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a program to decrypt a message that has been encoded using a simple Caesar cipher. The Caesar cipher is a substitution cipher where each letter in the plaintext is shifted a certain number of places down or up the alphabet. Your task is to implement...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decrypt_caesar_cipher('khoor', 3) == 'hello'\", \"assert decrypt_caesar_cipher('abc', 0) == 'abc'\", \"assert decrypt_caesar_cipher('xyz', 3) == 'uvw'\", \"assert decrypt_caesar_cipher('z', 1) == 'y'\", \"assert decrypt_caesar_cipher('hello', 1) == 'gdkkn'\"...
{ "split": "train", "index": 70401, "acecode_id": "oss_15000", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a variable `c`. Write a function `is_code(c)` that checks if `c` is a list of strings, which represents lines of code. The function should return `True` if `c` is a list and each element in the list is a string. If `c` is an empty list, it should also return `True...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_code(['print(\\\"Hello, World!\\\")', 'def add(a, b): return a + b']) == True\", \"assert is_code([]) == True\", \"assert is_code(['Hello', 'World']) == True\", \"assert is_code(['Hello', 2]) == False\", \"assert is_code('Hello') == False\", \"assert is_c...
{ "split": "train", "index": 70402, "acecode_id": "bigcode_python_fns_9453", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `add_vectors(v1: List[float], v2: List[float]) -> List[float]` that takes two 3D vectors represented as lists of three floats each, and returns their sum as a new list. The input lists `v1` and `v2` will always contain exactly three elements. The output sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_vectors([1.0, 2.0, 3.0], [4.0, 5.0, 6.0]) == [5.0, 7.0, 9.0]\", \"assert add_vectors([0.0, 0.0, 0.0], [0.0, 0.0, 0.0]) == [0.0, 0.0, 0.0]\", \"assert add_vectors([-1.0, -2.0, -3.0], [1.0, 2.0, 3.0]) == [0.0, 0.0, 0.0]\", \"assert add_vectors([1.5, 2.5, 3...
{ "split": "train", "index": 70403, "acecode_id": "evol_12399", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes in a list of family members, where each family member is represented by a dictionary containing their first name, last name, and eye color. Your function should return a list of eye colors of the family members in the order the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_eye_colors([{'first_name': 'Emma', 'last_name': 'Johnson', 'eye_color': 'Blue'}, {'first_name': 'Kevin', 'last_name': 'Smith', 'eye_color': 'Brown'}]) == ['Blue', 'Brown']\", \"assert get_eye_colors([{'first_name': 'Alice', 'last_name': 'Brown', 'eye_col...
{ "split": "train", "index": 70404, "acecode_id": "oss_7631", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the deployment of a web application. The function should accept a list of strings representing the filenames of the application code that needs to be deployed. The function should process the list and return a new list cont...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_python_files(['app.py', 'config.yml', 'main.py', 'README.md']) == ['app.py', 'main.py']\", \"assert filter_python_files(['index.html', 'style.css', 'script.js']) == []\", \"assert filter_python_files(['test.py', 'test.txt', 'example.py']) == ['test.py...
{ "split": "train", "index": 70405, "acecode_id": "oss_23112", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of unique integers, implement a function that takes this list and returns a new list where each integer is multiplied by a constant factor of 2. The input list will not be empty and will contain only unique integers.\nPlease reason step by step, then write a self-c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multiply_by_two([1]) == [2]\", \"assert multiply_by_two([0]) == [0]\", \"assert multiply_by_two([-1]) == [-2]\", \"assert multiply_by_two([-5, -10, -15]) == [-10, -20, -30]\", \"assert multiply_by_two([3, 5, 7]) == [6, 10, 14]\", \"assert multiply_by_two([10...
{ "split": "train", "index": 70406, "acecode_id": "evol_6551", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simplified version of managing a list of channels in a guild. The function should take in a list of channel names and return a list of newly created channels based on the names provided. Each channel name in the list shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_channels(['general', 'music', 'gaming']) == ['text_general', 'voice_general', 'text_music', 'voice_music', 'text_gaming', 'voice_gaming']\", \"assert manage_channels(['news']) == ['text_news', 'voice_news']\", \"assert manage_channels(['']) == ['text_...
{ "split": "train", "index": 70407, "acecode_id": "oss_18010", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design a function that inserts a given element into the penultimate position of a specified list. The function should take in two arguments: a list 'arr' and an element 'elem'. If the list is empty, the function should return an error message indicating that the list has no ele...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert insert_penultimate([1, 2, 3], 99) == [1, 2, 99, 3]\", \"assert insert_penultimate(['a', 'b'], 'c') == ['a', 'c', 'b']\", \"assert insert_penultimate([True, False], None) == [True, None, False]\", \"assert insert_penultimate(['1', '2', '3'], '0') == ['1', '2'...
{ "split": "train", "index": 70408, "acecode_id": "evol_20142", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a function `plot_spectrum` that simulates plotting the Fourier spectrum of mystery data. The function takes multiple parameters, where `fns` is a list of frequency values, `s` is a boolean indicating whether to show the spectrum, `o` is an optional output filename...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert plot_spectrum([1.0, 2.0, 3.0], True, None, False, False) == 'Showing spectrum plot'\", \"assert plot_spectrum([1.0, 2.0, 3.0], False, 'output.png', True, False) == 'Saving spectrum plot as output.png with format png at dpi 300'\", \"assert plot_spectrum([0.5...
{ "split": "train", "index": 70409, "acecode_id": "bigcode_python_fns_28464", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a function that generates a random Social Security Number (SSN) in the format 'AAA-GG-SSSS', where 'AAA' is a three-digit area number, 'GG' is a two-digit group number, and 'SSSS' is a four-digit serial number. Implement a function `generate_ssn()` that returns a string r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_ssn() != generate_ssn()\", \"assert len(generate_ssn()) == 11\", \"assert generate_ssn()[3] == '-'\", \"assert generate_ssn()[6] == '-'\", \"assert all(c.isdigit() for c in generate_ssn() if c != '-')\", \"assert generate_ssn().count('-') == 2\", \"...
{ "split": "train", "index": 70410, "acecode_id": "bigcode_python_fns_37883", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that takes in the list and returns a new list containing only the even numbers from the original list. The function should preserve the order of the original even numbers in the new list. If there are no even numbers, the function shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25, 30]) == [10, 20, 30]\", \"assert filter_even_numbers([1, 3, 5, 7, 9]) == []\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([2, 4, 6, 8]...
{ "split": "train", "index": 70411, "acecode_id": "bigcode_python_fns_30345", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design an algorithm that verifies if a given mathematical expression in string format is correctly formatted. The algorithm should determine if the expression has balanced parentheses, valid operator precedence, and can handle nested parentheses and complex operator combination...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_expression('x + (y * z)', ['x', 'y', 'z']) == False\", \"assert is_valid_expression('5 + (3 * (2 - 1))', []) == False\", \"assert is_valid_expression('5 + (3 * 2', []) == False\", \"assert is_valid_expression('5 + )3 * 2(', []) == False\", \"assert ...
{ "split": "train", "index": 70412, "acecode_id": "evol_4135", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a matrix representing a 2D grid of integers, write a function `zeroMatrix(matrix)` that modifies the matrix such that if any element in the original matrix is 0, the entire row and column containing that element should be set to 0. The function should return the modified ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert zeroMatrix([[1, 2, 3], [4, 0, 6], [7, 8, 9]]) == [[1, 0, 3], [0, 0, 0], [7, 0, 9]]\", \"assert zeroMatrix([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) == [[0, 0, 0], [0, 4, 5], [0, 7, 8]]\", \"assert zeroMatrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [[1, 2, 3], [4, 5, ...
{ "split": "train", "index": 70413, "acecode_id": "oss_12036", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `calculate_average_cost` that computes the average cost of items in the list. The average cost is defined as the total sum of the items divided by the total number of items in the list. If the list is empty, return 0.0. Your function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_cost([10, 20, 30]) == 20.0\", \"assert calculate_average_cost([5, 15, 25, 35]) == 20.0\", \"assert calculate_average_cost([100, 200, 300]) == 200.0\", \"assert calculate_average_cost([1]) == 1.0\", \"assert calculate_average_cost([]) == 0.0...
{ "split": "train", "index": 70414, "acecode_id": "bigcode_python_fns_42578", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to extract the instance ID from a given sample string. The instance ID is defined as the substring that occurs after the hyphen ('-') and before the first occurrence of a digit in the sample string. If no such substring exists, the fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_instance_id('abc-xyz') == 'No instance ID found'\", \"assert extract_instance_id('') == 'Sample string is empty'\", \"assert extract_instance_id('test-abc123xyz') == 'abc'\", \"assert extract_instance_id('data-') == 'No instance ID found'\", \"assert...
{ "split": "train", "index": 70415, "acecode_id": "oss_646", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with processing a series of banking transactions represented as a list of integers, where positive integers indicate deposits and negative integers indicate withdrawals. Implement a function `below_zero(operations: List[int]) -> Tuple[bool, int]` that checks if t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert below_zero([1, 2, 3]) == (False, 6)\", \"assert below_zero([10, -5, -6]) == (True, -1)\", \"assert below_zero([5, 5, 5]) == (False, 15)\", \"assert below_zero([0, 0, 0]) == (False, 0)\", \"assert below_zero([100, -50, -60]) == (True, -10)\", \"assert below_z...
{ "split": "train", "index": 70416, "acecode_id": "evol_11245", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates triggering code actions at a specified location in a codebase. The function `trigger_code_actions` takes two parameters: `location` (a string representing the location in the codebase) and `config_name` (a string representi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert trigger_code_actions('location1', 'config1') == {'action1': 'Description of action 1', 'action2': 'Description of action 2'}\", \"assert trigger_code_actions('location2', 'config1') == {'action1': 'Description of action 1', 'action2': 'Description of action ...
{ "split": "train", "index": 70417, "acecode_id": "oss_20958", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two integers `m` and `n`, write a function that returns a list of random integers where the list contains `m` integers, each ranging from 1 to `n` (inclusive). The integers in the list should be uniformly distributed. The function should not take any input other than the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert len(generate_random_list(0, 10)) == 0\", \"assert len(generate_random_list(5, 5)) == 5\", \"assert all(1 <= x <= 10 for x in generate_random_list(5, 10))\", \"assert all(1 <= x <= 100 for x in generate_random_list(10, 100))\", \"assert generate_random_list(1...
{ "split": "train", "index": 70418, "acecode_id": "bigcode_python_fns_40449", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that uses the sigmoid scaling method to transform a given number by a specified factor. The sigmoid function is defined as f(x) = 1 / (1 + e^(-x)). Your function should take two parameters: a number 'num' and an optional factor (default value of 0.5). The f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert scale_sigmoid(1) == 0.6224593312018546\", \"assert scale_sigmoid(-1) == 0.3775406687981454\", \"assert scale_sigmoid(-2) == 0.2689414213699951\", \"assert scale_sigmoid(0, factor=1) == 0.5\", \"assert scale_sigmoid(1, factor=1) == 0.7310585786300049\", \"ass...
{ "split": "train", "index": 70419, "acecode_id": "evol_30197", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given an object and a string representing an attribute name. Your task is to implement a function `has_attribute(obj: Any, attr: str) -> bool` that returns `True` if the object has the specified attribute, and `False` otherwise. The attribute check should be performed u...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_attribute({'a': 1, 'b': 2}, 'c') == False\", \"assert has_attribute([], 'append') == True\", \"assert has_attribute([], 'extend') == True\", \"assert has_attribute([], 'pop') == True\", \"assert has_attribute([], 'nonexistent') == False\", \"assert has_a...
{ "split": "train", "index": 70420, "acecode_id": "bigcode_python_fns_39486", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that sets the endianness of a transport and creates transport-specific constructors based on that endianness. The function should accept a parameter for the endianness, which can either be 'little' or 'big'. Based on the provided endi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert setup_constructors('little') == {'intep': 'LittleEndianConstructor', 'inep': 'LittleEndianInputConstructor', 'outep': 'LittleEndianOutputConstructor'}\", \"assert setup_constructors('big') == {'intep': 'BigEndianConstructor', 'inep': 'BigEndianInputConstruct...
{ "split": "train", "index": 70421, "acecode_id": "oss_15752", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement the function 'count_nums' that takes an integer array and returns the count of elements whose sum of absolute values of digits (considering the sign of the number) is positive and divisible by 4. For this problem, you must ensure that the sum of the digits is calculat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_nums([1, 2, 3, 4]) == 1\", \"assert count_nums([0, -0]) == 0\", \"assert count_nums([-4, 8, 12, -16]) == 2\", \"assert count_nums([-11, 21, -31]) == 1\", \"assert count_nums([1000, 2000, 3000]) == 0\", \"assert count_nums([-1, -2, -3]) == 0\"]}" }
{ "split": "train", "index": 70422, "acecode_id": "evol_36184", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to calculate the average of a list of floating-point numbers. The function should take a list of floating-point numbers as input and return the average as a floating-point number rounded to a specified number of decimal places. If the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average([1.0, 2.0, 3.0], 2) == 2.0\", \"assert calculate_average([10.0, 20.0, 30.0, 40.0], 1) == 25.0\", \"assert calculate_average([0.1, 0.2, 0.3], 1) == 0.2\", \"assert calculate_average([], 2) == 0.0\", \"assert calculate_average([5.555, 5.555],...
{ "split": "train", "index": 70423, "acecode_id": "oss_33663", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that returns a new list containing only the unique elements from the original list, preserving their order. The input list may contain both positive and negative integers, as well as duplicates. Your function should handle an empty...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 2, 3, 4]) == [1, 2, 3, 4]\", \"assert unique_elements([5, 5, 5, 5]) == [5]\", \"assert unique_elements([]) == []\", \"assert unique_elements([-1, -2, -1, -3, -2]) == [-1, -2, -3]\", \"assert unique_elements([1, -1, 1, -1, 2]) == [1, -1...
{ "split": "train", "index": 70424, "acecode_id": "bigcode_python_fns_10840", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design a function `insert_into_bst(root: Optional[Node], key: int) -> None` that takes the root of a binary search tree and a key as inputs, and inserts the key into the tree while maintaining the properties of the binary search tree. The function should not return any value. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert insert_into_bst(None, 10) is not None\", \"assert insert_into_bst(Node(10), 5).left.val == 5\", \"assert insert_into_bst(Node(10), 15).right.val == 15\", \"assert insert_into_bst(Node(10), 10).val == 10\", \"assert insert_into_bst(Node(20), 25).right.val == ...
{ "split": "train", "index": 70425, "acecode_id": "evol_16122", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `get_exclusive_storage_flags(node_uuids: List[str]) -> Dict[str, bool]` that returns a mapping from node UUIDs to their exclusive storage flags. Each node UUID is represented as a string. The exclusive storage flag is determined by th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_exclusive_storage_flags(['node1', 'node2', 'node3', 'node4']) == {'node1': False, 'node2': True, 'node3': False, 'node4': True}\", \"assert get_exclusive_storage_flags(['uuid1', 'uuid2', 'uuid3', 'uuid4', 'uuid5']) == {'uuid1': False, 'uuid2': True, 'uui...
{ "split": "train", "index": 70426, "acecode_id": "bigcode_python_fns_5433", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a command as a string that consists of a sequence of words separated by spaces. Your task is to create a function `parse_command(cmd: str) -> List[str]` that takes this command string and returns a list of individual words (tokens) in the order they appear in the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_command('ls -l /home/user') == ['ls', '-l', '/home/user']\", \"assert parse_command('git commit -m \\\"Initial commit\\\"') == ['git', 'commit', '-m', '\\\"Initial', 'commit\\\"']\", \"assert parse_command('echo hello world') == ['echo', 'hello', 'worl...
{ "split": "train", "index": 70427, "acecode_id": "bigcode_python_fns_8229", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that extracts specific pieces of information from an HTTP request represented as a JSON object. The function should extract and return the following details: the 'referer' URL without any URL encoding, the 'user-agent' value, and the 'cli...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_http_details({\\\"headers\\\": {\\\"referer\\\": \\\"https%3A%2F%2Fexample.com\\\", \\\"user-agent\\\": \\\"Mozilla/5.0\\\"}, \\\"client_ip\\\": \\\"192.168.1.1\\\"}) == 'Referer: https://example.com\\\\nUser-Agent: Mozilla/5.0\\\\nClient-IP: 192.168...
{ "split": "train", "index": 70428, "acecode_id": "oss_32219", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing a dataset. Your task is to split this dataset into two parts: a training set and a test set based on a specified fraction or a list of indices. The function should return the training set and test set as two separate lists. If the f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert split_dataset([1, 2, 3, 4, 5], 0.6) == ([1, 2, 3], [4, 5])\", \"assert split_dataset([10, 20, 30, 40, 50], 0.4) == ([10, 20], [30, 40, 50])\", \"assert split_dataset([5, 10, 15, 20, 25], [0, 1]) == ([5, 10], [15, 20, 25])\", \"assert split_dataset([1, 2, 3, ...
{ "split": "train", "index": 70429, "acecode_id": "bigcode_python_fns_11993", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the average entropy coefficient from a given list of entropy coefficients. The function should take a list of floats representing the entropy coefficients for different iterations and return the average value. If the i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_entropy_coefficients([0.75, 0.80, 0.70]) == 0.75\", \"assert calculate_average_entropy_coefficients([1.0, 2.0, 3.0, 4.0]) == 2.5\", \"assert calculate_average_entropy_coefficients([0.0, 0.0, 0.0]) == 0.0\", \"assert calculate_average_entrop...
{ "split": "train", "index": 70430, "acecode_id": "oss_37295", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `complex_match(lst1, lst2, unique_chars=True, ignore_nums=True)` that compares two lists of strings and returns a list of matched strings from the second list that are present in the first list. If `ignore_nums` is set to True, numbers should be removed fro...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert complex_match([], []) == []\", \"assert complex_match(['hi', 'admin'], ['hI', 'Hi']) == ['hI', 'Hi']\", \"assert complex_match(['hello'], ['HELLO']) == ['HELLO']\", \"assert complex_match(['test123'], ['test']) == ['test']\", \"assert complex_match(['apple',...
{ "split": "train", "index": 70431, "acecode_id": "evol_17184", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Implement a function that takes an integer n as input and returns a dictionary containing three keys: 'primes', 'composites', and 'perfect_squares'. Each key should map to a list of integers, representing the prime numbers, composite numbers, and perfect square numbers, respect...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert classify_numbers(1) == {'primes': [], 'composites': [], 'perfect_squares': [1], 'prime_sum': 0, 'composite_product': 0}\", \"assert classify_numbers(2) == {'primes': [2], 'composites': [], 'perfect_squares': [1], 'prime_sum': 2, 'composite_product': 0}\", \"...
{ "split": "train", "index": 70432, "acecode_id": "evol_15511", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a string `input` and a string `actor`, your task is to format the strings such that the `input` is enclosed within a specific format that includes the `actor`. If the `actor` contains spaces, it should be wrapped in angle brackets. The formatted output should be in the fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_as_actor('Hello World!', 'John Doe') == '[as <John Doe>]Hello World![endas]'\", \"assert format_as_actor('Goodbye!', 'Alice') == '[as Alice]Goodbye![endas]'\", \"assert format_as_actor('This is a test.', 'Bob') == '[as Bob]This is a test.[endas]'\", \...
{ "split": "train", "index": 70433, "acecode_id": "bigcode_python_fns_17853", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a fixture dictionary based on the parameters provided. The function should take in a request string, an index integer, a received output string, a comment string, an optional testname string, and an optional additional_info...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_fixture('test_request_1', 0, 'output_data_1', 'This is a comment') == {'name': 'test_request_1', 'index': 0, 'comment': 'This is a comment', 'output': 'output_data_1'}\", \"assert generate_fixture('test_request_2', 1, 'output_data_2', 'Another comme...
{ "split": "train", "index": 70434, "acecode_id": "bigcode_python_fns_2919", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a dictionary and a list of keys, and ensures that all specified keys are present in the dictionary with valid values. A valid value is defined as any value that is not None or an empty string. If a key is missing or its val...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert clean_data({'name': 'John', 'age': 30, 'city': None, 'email': ''}, ['name', 'age', 'city', 'email'], 'N/A') == {'name': 'John', 'age': 30, 'city': 'N/A', 'email': 'N/A'}\", \"assert clean_data({'name': 'Alice', 'age': 25, 'city': 'Paris'}, ['name', 'age', 'c...
{ "split": "train", "index": 70435, "acecode_id": "oss_30784", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `max_repeating_substring` that determines the substring which appears the most number of times in the given original string. If there are multiple substrings that have the same maximum count, return the first one that appears in the string.\nPlease reason s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_repeating_substring('abc') == 'a'\", \"assert max_repeating_substring('aabbcc') == 'a'\", \"assert max_repeating_substring('aaaaaa') == 'a'\", \"assert max_repeating_substring('abcdefg') == 'a'\", \"assert max_repeating_substring('A man a plan a canal Pa...
{ "split": "train", "index": 70436, "acecode_id": "evol_19036", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes in a dictionary of request information and populates it with default configurations for email notifications and helpdesk settings. Your function should ensure that a subject line is created based on the 'csr_type' key from the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert notify_helpdesk({'csr_type': 'Type1'}) == {'csr_type': 'Type1', 'project': 'N/A', 'subject': 'MOC Type1'}\", \"assert notify_helpdesk({'csr_type': 'Type2', 'project': 'ProjectX'}) == {'csr_type': 'Type2', 'project': 'ProjectX', 'subject': 'MOC Type2'}\", \"a...
{ "split": "train", "index": 70437, "acecode_id": "bigcode_python_fns_48136", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of states and a dictionary of town forecast products, and returns a dictionary where each town is mapped to a tuple containing its corresponding forecast product ID and the state it belongs to. The function should ignore...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert map_forecast_products(['NSW', 'VIC'], {'Sydney': 'A123', 'Melbourne': 'B456', 'Brisbane': None}) == {'Sydney': ('A123', 'NSW'), 'Melbourne': ('B456', 'VIC')}\", \"assert map_forecast_products(['QLD', 'WA'], {'Perth': 'C789', 'Brisbane': 'D012', 'Darwin': Non...
{ "split": "train", "index": 70438, "acecode_id": "bigcode_python_fns_26939", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the pixel values of a grayscale image. Your task is to implement a function that normalizes these pixel values. Normalization is defined as transforming each pixel value to a new value by applying the formula: (pixel_value - min_val...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert normalize_image([0, 255, 128]) == [0.0, 1.0, 0.5019607843137255]\", \"assert normalize_image([100, 200, 300]) == [0.0, 0.5, 1.0]\", \"assert normalize_image([50, 50, 50]) == [0.0, 0.0, 0.0]\", \"assert normalize_image([255]) == [0.0]\", \"assert normalize_im...
{ "split": "train", "index": 70439, "acecode_id": "bigcode_python_fns_46398", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings, where each string may contain alphanumeric characters and special symbols. Your task is to implement a function `filter_valid_strings(strings: List[str]) -> List[str]` that returns a list of strings that contain only alphanumeric characters (let...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_valid_strings(['hello', 'world', '123', 'test!']) == ['hello', 'world', '123']\", \"assert filter_valid_strings(['@home', 'test', 'data123']) == ['test', 'data123']\", \"assert filter_valid_strings(['', '!!!']) == []\", \"assert filter_valid_strings([...
{ "split": "train", "index": 70440, "acecode_id": "bigcode_python_fns_45270", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string, determine whether it is a valid unary mathematical operator function. A valid unary function is defined as any of the following: 'negation', 'absolute', 'square', 'square_root', 'factorial'. Implement a function `is_unary_operator(string: str) -> bool` that retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_unary_operator('negation') == True\", \"assert is_unary_operator('absolute') == True\", \"assert is_unary_operator('square') == True\", \"assert is_unary_operator('square_root') == True\", \"assert is_unary_operator('factorial') == True\", \"assert is_una...
{ "split": "train", "index": 70441, "acecode_id": "bigcode_python_fns_45709", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that determines if a process, identified by its PID (Process ID), is currently running on the system. The function should take a PID as input and return a boolean value indicating whether that process is running. To simulate this, you wil...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_process_running(100) == True\", \"assert is_process_running(200) == True\", \"assert is_process_running(300) == True\", \"assert is_process_running(400) == True\", \"assert is_process_running(500) == True\", \"assert is_process_running(600) == True\", \"a...
{ "split": "train", "index": 70442, "acecode_id": "bigcode_python_fns_31282", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a hexadecimal string, implement a function that counts the occurrences of a specified integer in the string and returns both the count and a list of the specific indices where the integer appears. The integer should be converted into its hexadecimal representation for the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_integer_in_hex('2a3b4c5d', 3) == (1, [2])\", \"assert find_integer_in_hex('abcdef', 1) == (0, [])\", \"assert find_integer_in_hex('2222333344445555', 2) == (4, [0, 1, 2, 3])\", \"assert find_integer_in_hex('fffffff', 15) == (7, [0, 1, 2, 3, 4, 5, 6])\",...
{ "split": "train", "index": 70443, "acecode_id": "evol_20499", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a list of segments, where each segment is represented by a dictionary containing 'start' and 'end' times (both are floats). Write a function that takes this list of segments and returns a list of tuples, where each tuple contains the rounded start and end times of...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert round_segments([{'start': 0.3, 'end': 0.6}], None) == [(0.3, 0.6)]\", \"assert round_segments([{'start': 0.25, 'end': 0.75}], 0.2) == [(0.2, 0.8)]\", \"assert round_segments([{'start': 0.0, 'end': 1.0}], 0.1) == [(0.0, 1.0)]\", \"assert round_segments([], 0....
{ "split": "train", "index": 70444, "acecode_id": "bigcode_python_fns_28549", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given two positive integers, implement a function `compute_LCM(n, m)` that calculates the Least Common Multiple (LCM) of the two numbers. The function should raise a ValueError if either input is a negative integer or a non-integer value. If either input is zero, the function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_LCM(15, 10) == 30\", \"assert compute_LCM(1, 1) == 1\", \"assert compute_LCM(0, 5) == 0\", \"assert compute_LCM(5, 0) == 0\", \"assert compute_LCM(12, 15) == 60\", \"assert compute_LCM(7, 3) == 21\", \"assert compute_LCM(24, 36) == 72\", \"assert com...
{ "split": "train", "index": 70445, "acecode_id": "evol_13483", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that retrieves annotations for a specific image based on given data. You are provided with two dictionaries: `images`, which maps `image_id` to a list of associated annotation IDs, and `annotations`, which maps `annotation_id` to anno...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_annotations(1, {1: {'anns': [101, 102]}, 2: {'anns': [103]}}, {101: 'Cat', 102: 'Dog', 103: 'Bird'}) == ['Cat', 'Dog']\", \"assert get_annotations(2, {1: {'anns': [101, 102]}, 2: {'anns': [103]}}, {101: 'Cat', 102: 'Dog', 103: 'Bird'}) == ['Bird']\", \"a...
{ "split": "train", "index": 70446, "acecode_id": "oss_11885", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `display_question_choices(question_id)` that simulates retrieving a specific question and its associated choices from a hypothetical database. The function should take an integer `question_id` as input and return a dictionary containing t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert display_question_choices(1) == {'question_text': 'What is your favorite programming language?', 'choices': ['Python', 'JavaScript', 'Java', 'C++']}\", \"assert display_question_choices(2) == {'question_text': 'What is your favorite fruit?', 'choices': ['Appl...
{ "split": "train", "index": 70447, "acecode_id": "oss_15118", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a probability map represented as a 2D list of floats, where each value indicates the likelihood of a certain event occurring at that location. Your task is to identify the coordinates of the centers of predicted events based on a specified probability threshold an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert detect_events([[0.0, 0.0], [0.0, 0.0]], 1, 0.1) == []\", \"assert detect_events([[0.9]], 1, 0.5) == [(0, 0)]\", \"assert detect_events([[0.1, 0.2], [0.4, 0.7]], 1, 0.4) == [(1, 1)]\", \"assert detect_events([[0.3, 0.4, 0.5], [0.1, 0.2, 0.3]], 1, 0.4) == [(0,...
{ "split": "train", "index": 70448, "acecode_id": "bigcode_python_fns_26611", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of sequences represented as tuples. Each tuple contains a sequence ID (a string), a variant ID (a string), and the actual sequence (a string). Your task is to create a function that processes these sequences into a batch format where each batch contains a m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_sequences([('seq1', '1', 'AAAA'), ('seq2', '1', 'GGGG')], 2) == [[('seq1', '1', 'AAAA'), ('seq2', '1', 'GGGG')]]\", \"assert process_sequences([('seq1', '1', 'AAAA'), ('seq2', '1', 'GGGG')], 1) == [[('seq1', '1', 'AAAA')], [('seq2', '1', 'GGGG')]]\",...
{ "split": "train", "index": 70449, "acecode_id": "bigcode_python_fns_41466", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that removes all HTML tags from a given string and returns the cleaned text. The function should take a single parameter, a string containing HTML content, and return a string with all HTML tags removed. For example, given the input '<p>This is a <b>test</b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert clean_html('<p>This is a <b>test</b> string</p>') == 'This is a test string'\", \"assert clean_html('<div>Hello <span>World</span></div>') == 'Hello World'\", \"assert clean_html('<h1>Title</h1><p>Paragraph</p>') == 'TitleParagraph'\", \"assert clean_html('<...
{ "split": "train", "index": 70450, "acecode_id": "evol_2503", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the numerical mean of a list of integers. The function should take a list of integers as input and return the mean as a float. If the input list is empty, return 0.0.\nPlease reason step by step, then write a self-contained Python solution. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_mean([1, 2, 3, 4, 5]) == 3.0\", \"assert calculate_mean([10, 20, 30]) == 20.0\", \"assert calculate_mean([-1, -2, -3, -4]) == -2.5\", \"assert calculate_mean([0, 0, 0]) == 0.0\", \"assert calculate_mean([5]) == 5.0\", \"assert calculate_mean([1, 2,...
{ "split": "train", "index": 70451, "acecode_id": "evol_28968", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the average of a fixed number of student grades. Implement a function `calculate_average` that takes a list of 20 integers representing grades as input and returns the average of these grades. If the list does not contain exactly 20 integers, the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0.00\", \"assert calculate_average([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 10.50\", \"assert calculate_average([100, 90, 100, 90, 100, 90, ...
{ "split": "train", "index": 70452, "acecode_id": "oss_17386", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Write a function called `reorder_dict` that takes a dictionary `my_dict` where the keys are strings representing names and the values are integers. The function should return a new dictionary that contains the same key-value pairs but sorted in ascending order based on the valu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reorder_dict({'Alice': 5, 'Bob': 2, 'Charlie': 8}) == {'Bob': 2, 'Alice': 5, 'Charlie': 8}\", \"assert reorder_dict({'Eve': 7, 'Mallory': 1, 'Oscar': 7}) == {'Mallory': 1, 'Eve': 7, 'Oscar': 7}\", \"assert reorder_dict({'Tom': 3, 'Jerry': 3, 'Spike': 1}) == ...
{ "split": "train", "index": 70453, "acecode_id": "evol_14926", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of coefficients representing a polynomial in descending order of powers, implement a function `evaluate_polynomial(coefficients, x)` that evaluates the polynomial at a specific value `x`. The polynomial can be expressed as `coeff[0] * x^n + coeff[1] * x^(n-1) + ......
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert evaluate_polynomial([1, 0, -1], 1) == 0\", \"assert evaluate_polynomial([0, 0, 0], 10) == 0\", \"assert evaluate_polynomial([1, -1, 1], 2) == 3\", \"assert evaluate_polynomial([5, 0], 5) == 25\", \"assert evaluate_polynomial([1, 1], 1) == 2\", \"assert evalu...
{ "split": "train", "index": 70454, "acecode_id": "oss_3715", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function `analyze_number` that takes an integer as input and returns a tuple. The first element of the tuple should be a boolean indicating whether the integer is a palindrome, and the second element should be another boolean indicating if the integer is a prime num...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert analyze_number(12321) == (True, False)\", \"assert analyze_number(987) == (False, False)\", \"assert analyze_number(2) == (True, True)\", \"assert analyze_number(3) == (True, True)\", \"assert analyze_number(5) == (True, True)\", \"assert analyze_number(10) ...
{ "split": "train", "index": 70455, "acecode_id": "evol_23760", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function `areAnagrams(str1: str, str2: str) -> bool` that takes two strings as input and determines if they are anagrams of each other. An anagram means that both strings contain the same characters in the same frequency, disregarding spaces, special characters, and cap...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert areAnagrams('Listen', 'Silent') == True\", \"assert areAnagrams('Hello, World!', 'dlroW ,olleH') == True\", \"assert areAnagrams('The Morse Code', 'Here come dots') == True\", \"assert areAnagrams('Astronomer', 'Moon starer') == True\", \"assert areAnagrams(...
{ "split": "train", "index": 70456, "acecode_id": "evol_30592", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes three strings as input and returns the shortest string among them after removing all vowels (both uppercase and lowercase) from each string. If there are ties in length, return the first one encountered.\nPlease reason step by step, then write a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shortest_string('hello', 'world', 'python') == 'hll'\", \"assert shortest_string('testing', 'test', 'tst') == 'tst'\", \"assert shortest_string('cat', 'dog', 'elephant') == 'ct'\", \"assert shortest_string('super', 'califragilistic', 'expialidocious') == 'sp...
{ "split": "train", "index": 70457, "acecode_id": "evol_27730", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that calculates the product of every third element starting from the first element of the list. The function should take a list of integers as input and return the calculated product.\nPlease reason step by step, then write a self-...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert product_of_every_third_element([10, 20, 30, 40, 50, 60]) == 10 * 40\", \"assert product_of_every_third_element([]) == 1\", \"assert product_of_every_third_element([5]) == 5\", \"assert product_of_every_third_element([10, 20]) == 10\", \"assert product_of_eve...
{ "split": "train", "index": 70458, "acecode_id": "evol_27548", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of prices represented as floats and a list of timestamps represented as integers (in milliseconds), write a function that returns a dictionary containing the minimum price, maximum price, and average price of the given prices. The average price should be rounded to...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert analyze_prices([10.0, 20.0, 30.0, 40.0], [1610000000000, 1610003600000, 1610007200000, 1610010800000]) == {'min': 10.0, 'max': 40.0, 'average': 25.0}\", \"assert analyze_prices([5.5, 15.5, 25.5], [1610000000000, 1610003600000, 1610007200000]) == {'min': 5.5,...
{ "split": "train", "index": 70459, "acecode_id": "bigcode_python_fns_4050", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `initialize_libertem()` that simulates the initialization of a library called 'libertem'. The function should return a string indicating whether the initialization was successful or if there was an error. The function should accept...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_libertem(True) == 'Initialization successful'\", \"assert initialize_libertem(False) == 'Initialization failed: Library not ready'\", \"assert initialize_libertem(True) != 'Initialization failed: Library not ready'\", \"assert initialize_libertem(...
{ "split": "train", "index": 70460, "acecode_id": "oss_2010", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings representing keys, and a dictionary that may contain metadata as strings, write a function `get_utctime(md_keys: List[str], md: Dict[str, str]) -> Union[datetime, None]` that extracts the universal coordinated time (UTC) from the metadata. The UTC should...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_utctime(['Exif.Image.DateTime'], {'Exif.Image.DateTime': '2021:08:30 15:45:12'}) == datetime(2021, 8, 30, 15, 45, 12)\", \"assert get_utctime(['Exif.Image.DateTime'], None) == None\", \"assert get_utctime(['Exif.Image.DateTime', 'Exif.Photo.SubSecTime'],...
{ "split": "train", "index": 70461, "acecode_id": "bigcode_python_fns_32380", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `find_mode` that returns the mode of the list. The mode is defined as the number that appears most frequently in the list. If there are multiple numbers with the same highest frequency, return the first one that reaches that frequency....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_mode([1, 2, 3, 4, 4]) == 4\", \"assert find_mode([1, 1, 2, 2, 3]) == 1\", \"assert find_mode([5, 5, 5, 1, 1, 2, 2]) == 5\", \"assert find_mode([0, 0, 0]) == 0\", \"assert find_mode([]) == 0\", \"assert find_mode([3, 4, 5, 6, 6, 3, 3]) == 3\", \"assert f...
{ "split": "train", "index": 70462, "acecode_id": "bigcode_python_fns_38491", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to design a function that calculates the area of different shapes based on their type and dimensions provided as parameters. The function should take three parameters: `shape_type` (a string which can either be 'rectangle' or 'circle'), and the dimensions needed to cal...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_area('rectangle', 5, 4) == 20\", \"assert calculate_area('circle', 3) == 28.274333882308138\", \"assert calculate_area('rectangle', 0, 0) == 0\", \"assert calculate_area('rectangle', 10, 5) == 50\", \"assert calculate_area('circle', 0) == 0\", \"as...
{ "split": "train", "index": 70463, "acecode_id": "oss_24041", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a user management system for a web application. The system should allow for the retrieval of user information from a session-based user database. The user information is stored as a dictionary in the session under the key 'user_db', with the use...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_user_info('001') == {'id': '001', 'token': 'abc123', 'email': 'user1@example.com', 'name': 'User One'}\", \"assert get_user_info('002') == {'id': '002', 'token': 'def456', 'email': 'user2@example.com', 'name': 'User Two'}\", \"assert get_user_info('003')...
{ "split": "train", "index": 70464, "acecode_id": "oss_18429", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of a series of bars in a histogram. Write a function `largestRectangleArea(heights: List[int]) -> int` that computes the area of the largest rectangle that can be formed within the histogram. The function should take in ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert largestRectangleArea([2,1,5,6,2,3]) == 10\", \"assert largestRectangleArea([1,1,1,1]) == 4\", \"assert largestRectangleArea([0]) == 0\", \"assert largestRectangleArea([]) == 0\", \"assert largestRectangleArea([1,2,3,4,5]) == 9\", \"assert largestRectangleAre...
{ "split": "train", "index": 70465, "acecode_id": "bigcode_python_fns_30947", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with developing a function to calculate the multinomial loss for a batch of item recommendations generated by a model. The multinomial loss measures the dissimilarity between the actual user preferences and the recommendations. Implement a function `calculate_mul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_multinomial_loss([[0.25, 0.25, 0.25, 0.25]], [1]) == 1.3862943611198906\", \"assert calculate_multinomial_loss([[0.75, 0.25]], [1]) == 0.2876820724517809\", \"assert calculate_multinomial_loss([[0.2, 0.2, 0.2, 0.2, 0.2]], [3]) == 1.6094379124341003...
{ "split": "train", "index": 70466, "acecode_id": "oss_28338", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries representing pets, where each dictionary contains information about a pet's species, proper name, and lifespan in years. Implement a function that finds and returns the pet with the longest lifespan from the provided list. If there are multi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert longest_lifespan([{'pet': {'species': 'canine', 'properName': 'Fortunate', 'lifespanInYears': 5}}, {'pet': {'species': 'feline', 'properName': 'Lucky', 'lifespanInYears': 10}}, {'pet': {'species': 'rabbit', 'properName': 'Bouncy', 'lifespanInYears': 8}}]) ==...
{ "split": "train", "index": 70467, "acecode_id": "evol_1977", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a Python function called `linear_search` that takes an array of integers and an integer value as input. The function should return the index of the first occurrence of the value in the array. If the value is not found, return -1. The input array will contain distinct ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert linear_search([8, 2, 5, 6, 9], 5) == 2\", \"assert linear_search([8, 2, 5, 6, 9], 8) == 0\", \"assert linear_search([8, 2, 5, 6, 9], 9) == 4\", \"assert linear_search([8, 2, 5, 6, 9], 2) == 1\", \"assert linear_search([8, 2, 5, 6, 9], 6) == 3\", \"assert lin...
{ "split": "train", "index": 70468, "acecode_id": "evol_535", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that retrieves information about devices and their backup sets. The function should take the following parameters: a list of devices, a boolean indicating whether to include usernames, and a format string for output. The function should r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_device_backup_info([{'guid': '123', 'userUid': 'user1', 'has_backup_settings': True}], True, 'json') == [{'guid': '123', 'userUid': 'user1', 'backupSetSettings': 'default'}]\", \"assert get_device_backup_info([{'guid': '124', 'userUid': 'user2', 'has_bac...
{ "split": "train", "index": 70469, "acecode_id": "bigcode_python_fns_44991", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of vulnerability IDs and a boolean flag for overwriting existing records. The function should return a dictionary containing the counts of vulnerabilities added, updated, and skipped based on the provided IDs. If a vulne...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert vulnerability_summary(['VULN001', 'VULN002'], False) == {'added': 2, 'updated': 0, 'skipped': 0}\", \"assert vulnerability_summary(['VULN001', 'VULN002'], True) == {'added': 2, 'updated': 0, 'skipped': 0}\", \"assert vulnerability_summary([], False) == {'add...
{ "split": "train", "index": 70470, "acecode_id": "bigcode_python_fns_49254", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the frequency of attractors in a network. Your task is to determine if the analysis of node correlations is possible based on the number of aggregated attractors and their total frequency. The analysis is only possible if there is m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_analysis_possible([1, 1]) == False\", \"assert is_analysis_possible([1, 3]) == False\", \"assert is_analysis_possible([2, 1]) == False\", \"assert is_analysis_possible([3, 3]) == True\", \"assert is_analysis_possible([2, 5]) == True\", \"assert is_analysi...
{ "split": "train", "index": 70471, "acecode_id": "bigcode_python_fns_46415", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a dictionary representing data, implement a function `transform_function(data: Dict)` that transforms the data as required. For simplicity, this function should just return the data received. You can modify it as you see fit. The function should handle any exceptions that...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_function({'key1': 'value1', 'key2': 'value2'}) == {'key1': 'value1', 'key2': 'value2'}\", \"assert transform_function({'a': 1, 'b': 2, 'c': 3}) == {'a': 1, 'b': 2, 'c': 3}\", \"assert transform_function({'name': 'Alice', 'age': 30}) == {'name': 'Al...
{ "split": "train", "index": 70472, "acecode_id": "evol_4157", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `safe_divide(num1, num2)` that takes two parameters, `num1` and `num2`, and returns the result of `num1` divided by `num2`. If `num2` is zero, the function should return the string 'Division by zero error'. If either `num1` or `num2` is not a number (i.e., a ty...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert safe_divide(10, 2) == 5.0\", \"assert safe_divide(10, 0) == 'Division by zero error'\", \"assert safe_divide('10', 2) == 'Type error'\", \"assert safe_divide(10, '2') == 'Type error'\", \"assert safe_divide(10, None) == 'Type error'\", \"assert safe_divide(N...
{ "split": "train", "index": 70473, "acecode_id": "evol_2237", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that defines a stack variable. The function should take the following parameters: a string representing the variable name, an integer representing the offset of the stack variable (negative for local variables and positive for functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert define_stack_variable('var1', -4, 1, 0, 4) == True\", \"assert define_stack_variable('arg1', 8, 2, 0, 8) == True\", \"assert define_stack_variable('temp_var', -16, 1, 0, 2) == True\", \"assert define_stack_variable('data', 12, 3, 1, 1) == True\", \"assert de...
{ "split": "train", "index": 70474, "acecode_id": "bigcode_python_fns_47497", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `extract(element: List[Dict[str, Any]]) -> Dict[str, Any]` that extracts specific fields from a given list of dictionaries representing events from Kafka. The function should return a dictionary containing the 'user_id' and 'song_id' extracted from the firs...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract([{'user_id': 'user1', 'song_id': 'songA'}]) == {'user_id': 'user1', 'song_id': 'songA'}\", \"assert extract([{'user_id': 'user2', 'song_id': 'songB'}, {'user_id': 'user3', 'song_id': 'songC'}]) == {'user_id': 'user2', 'song_id': 'songB'}\", \"assert ...
{ "split": "train", "index": 70475, "acecode_id": "evol_13317", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with converting angular velocity from radians per second to revolutions per minute (RPM). Implement a function `convert_rads_to_rpm(rads: float) -> float` that takes an angle in radians per second as input and returns the equivalent angular velocity in RPM. The c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert round(convert_rads_to_rpm(7642), 0) == 72976\", \"assert round(convert_rads_to_rpm(0), 0) == 0\", \"assert round(convert_rads_to_rpm(2 * 3.141592653589793), 0) == 60\", \"assert round(convert_rads_to_rpm(3.141592653589793), 0) == 30\", \"assert round(convert...
{ "split": "train", "index": 70476, "acecode_id": "bigcode_python_fns_43603", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that performs 1D linear interpolation on a given set of data points. Linear interpolation is a method of curve fitting using linear polynomials to construct new data points within the range of a discrete set of known data point...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert linear_interpolation([1, 2], [1, 2], [10, 20]) == [10, 20]\", \"assert linear_interpolation([1.5], [1, 2], [10, 20]) == [15.0]\", \"assert linear_interpolation([0, 1, 2], [0, 1, 2], [0, 1, 2]) == [0, 1, 2]\", \"assert linear_interpolation([1.5, 2.5], [1, 2, ...
{ "split": "train", "index": 70477, "acecode_id": "oss_32966", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given an integer x, write a function `reverse_integer(x)` that returns the reverse of the integer. If the reversed integer overflows a 32-bit signed integer, return 0. For negative integers, reverse the absolute value and apply the negative sign to the result. Your function sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_integer(123) == 321\", \"assert reverse_integer(-123) == -321\", \"assert reverse_integer(0) == 0\", \"assert reverse_integer(100) == 1\", \"assert reverse_integer(-100) == -1\", \"assert reverse_integer(1534236469) == 0\", \"assert reverse_integer(-...
{ "split": "train", "index": 70478, "acecode_id": "oss_22896", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `serialize_object(obj)` that takes a Python object as input and returns its JSON string representation. The input object can be of any type, including lists, dictionaries, strings, and numbers. The function should handle serialization errors by raising a cu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert serialize_object({'name': 'Alice', 'age': 30}) == '{\\\"name\\\": \\\"Alice\\\", \\\"age\\\": 30}'\", \"assert serialize_object([1, 2, 3]) == '[1, 2, 3]'\", \"assert serialize_object('Hello, World!') == '\\\"Hello, World!\\\"'\", \"assert serialize_object(42...
{ "split": "train", "index": 70479, "acecode_id": "bigcode_python_fns_24521", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple messaging bot. The bot should send a message to the user asking if they are still present in the chat. The function should take an optional parameter 'event', which is not used in the current implementation but is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert poke() == None\", \"assert poke('some_event') == None\", \"assert poke() == None\", \"assert poke(event='test') == None\", \"assert poke() == None\", \"assert poke('another_event') == None\", \"assert poke() == None\", \"assert poke(event='test_event') == No...
{ "split": "train", "index": 70480, "acecode_id": "bigcode_python_fns_36883", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that removes all elements that have duplicates, leaving only those elements that appear exactly once in the list. The order of the remaining elements should be preserved. For example, given the input list [4, 5, 6, 4, 7, 5, 8], the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates([4, 5, 6, 4, 7, 5, 8]) == [6, 7, 8]\", \"assert remove_duplicates([1, 2, 2, 3, 4, 4, 5]) == [1, 3, 5]\", \"assert remove_duplicates([10, 20, 10, 30, 40]) == [20, 30, 40]\", \"assert remove_duplicates([1, 1, 1, 1, 1]) == []\", \"assert remov...
{ "split": "train", "index": 70481, "acecode_id": "evol_9917", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that escapes HTML special characters in a given string. In HTML, certain characters have special meanings and should be escaped when they are part of the content. The characters that need to be escaped are: '&' should be replaced with '&a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert html_escape('Hello & World!') == 'Hello &amp; World!'\", \"assert html_escape('<div>Test</div>') == '&lt;div&gt;Test&lt;/div&gt;'\", \"assert html_escape('No special characters here.') == 'No special characters here.'\", \"assert html_escape('3 < 5 and 5 > 3...
{ "split": "train", "index": 70482, "acecode_id": "bigcode_python_fns_33829", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to implement a function `create_linked_list` that takes this list as input and returns the head of a linked list formed by these integers. Each node in the linked list should be represented by a class called `ListNode`, which has t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_linked_list([1, 2, 3]).__str__() == '1, 2, 3'\", \"assert create_linked_list([]) == None\", \"assert create_linked_list([0]).__str__() == '0'\", \"assert create_linked_list([-1, -2, -3]).__str__() == '-1, -2, -3'\", \"assert create_linked_list([10, 20...
{ "split": "train", "index": 70483, "acecode_id": "oss_28905", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Develop a function in Python that calculates the Shannon entropy of a given string. The function should take a single string input and return the calculated Shannon entropy value. For example, given the string 'abc', the function should return the entropy value based on the cha...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_shannon_entropy('abc') == 1.584962500721156\", \"assert calc_shannon_entropy('aabbcc') == 1.584962500721156\", \"assert calc_shannon_entropy('aaaa') == 0.0\", \"assert calc_shannon_entropy('') == 0.0\", \"assert calc_shannon_entropy('a') == 0.0\", \"ass...
{ "split": "train", "index": 70484, "acecode_id": "evol_26321", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a list of plots based on given parameters. The function should take three parameters: an integer `parameter1`, a float `parameter2`, and a string `parameter3`. It should return a dictionary where each key corresponds to a p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_plots(10, 0.5, 'example') == {'plot1': 'Plot with parameter1=10', 'plot2': 'Plot with parameter2=0.5', 'plot3': 'Plot with parameter3=example'}\", \"assert generate_plots(5, 1.0, 'test') == {'plot1': 'Plot with parameter1=5', 'plot2': 'Plot with par...
{ "split": "train", "index": 70485, "acecode_id": "oss_5278", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers and a chunk size, implement a function that divides the list into equally-sized chunks. If the list cannot be divided evenly, the last chunk should contain the remaining elements. The function should return a list of these chunks, where each chunk is al...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert chunk_list([1, 2, 3, 4, 5], 2) == [[1, 2], [3, 4], [5]]\", \"assert chunk_list([1, 2, 3, 4, 5, 6, 7], 3) == [[1, 2, 3], [4, 5, 6], [7]]\", \"assert chunk_list([1, 2, 3], 1) == [[1], [2], [3]]\", \"assert chunk_list([], 2) == []\", \"assert chunk_list([1, 2, ...
{ "split": "train", "index": 70486, "acecode_id": "bigcode_python_fns_31691", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an unsorted list of integers, implement a function `quickSort(arr: List[int]) -> List[int]` that sorts the list in ascending order using the quicksort algorithm. The function should return the sorted list. The input list can contain duplicate integers and the length of th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quickSort([3, 2, 7, 4, 6, 5]) == [2, 3, 4, 5, 6, 7]\", \"assert quickSort([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5]\", \"assert quickSort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert quickSort([2, 3, 2, 1, 4, 1]) == [1, 1, 2, 2, 3, 4]\", \"assert quickSort([]) ...
{ "split": "train", "index": 70487, "acecode_id": "bigcode_python_fns_11203", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2D list of integers representing a grid. Each cell in the grid can either be 0 (empty) or 1 (filled). Your task is to implement a function that counts the number of distinct clusters of filled cells (1s) in the grid. A cluster is defined as a group of horizontal...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_clusters([[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == 1\", \"assert count_clusters([[1, 1, 0], [0, 0, 0], [1, 1, 1]]) == 2\", \"assert count_clusters([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\", \"assert count_clusters([[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 5\",...
{ "split": "train", "index": 70488, "acecode_id": "bigcode_python_fns_33296", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `classify_number(x: int) -> str` that takes an integer 'x' as an input and returns a string describing the classification of 'x'. The function should return 'positive', 'negative', or 'zero' depending on whether the input is a positive integer, a negative i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert classify_number(10) == 'positive even'\", \"assert classify_number(-5) == 'negative odd'\", \"assert classify_number(0) == 'zero'\", \"assert classify_number(1) == 'positive odd fibonacci'\", \"assert classify_number(2) == 'positive even prime fibonacci'\", ...
{ "split": "train", "index": 70489, "acecode_id": "evol_14945", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, implement a function that returns a new array where each element at index i is the cumulative product of all the elements in the input array except the one at index i. The function should correctly handle negative numbers and zeros without using divi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert products([1, 2, 3, 4]) == [24, 12, 8, 6]\", \"assert products([1, 0, 3, 4]) == [0, 12, 0, 0]\", \"assert products([0, 0, 0, 0]) == [0, 0, 0, 0]\", \"assert products([-1, -2, -3, -4]) == [-24, -12, -8, -6]\", \"assert products([0, 1, 2, 3]) == [6, 0, 0, 0]\",...
{ "split": "train", "index": 70490, "acecode_id": "evol_30922", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of points represented as tuples (x, y) and a reference point (rx, ry), implement a function that calculates the coordinates of a new point that is horizontally aligned with the reference point and vertically centered among the provided points. The resulting point s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert point_at_center_bottom([(1, 2), (3, 4), (5, 6)], (10, 5)) == (10, 4.0)\", \"assert point_at_center_bottom([(0, 0), (0, 0), (0, 0)], (10, 5)) == (10, 0.0)\", \"assert point_at_center_bottom([(10, 10), (20, 20)], (15, 15)) == (15, 15.0)\", \"assert point_at_ce...
{ "split": "train", "index": 70491, "acecode_id": "bigcode_python_fns_9565", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a database connection string in the format 'username@host:port/dbname' and a filename. Your task is to parse the connection string and return a dictionary with the following keys: 'username', 'host', 'port', and 'dbname'. If the connection string does not contain ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_dsn('user@localhost:5432/mydb', 'output.txt') == {'username': 'user', 'host': 'localhost', 'port': 5432, 'dbname': 'mydb'}\", \"assert parse_dsn('admin@192.168.1.1/dbname', 'output.txt') == {'username': 'admin', 'host': '192.168.1.1', 'port': 5432, 'db...
{ "split": "train", "index": 70492, "acecode_id": "bigcode_python_fns_10962", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of buildings in a city skyline. Your task is to implement a function that determines the maximum height of the buildings that can be seen from the left side of the skyline. A building is considered visible if it is talle...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_visible_buildings([3, 7, 8, 3, 6, 1]) == [3, 7, 8]\", \"assert max_visible_buildings([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert max_visible_buildings([5, 4, 3, 2, 1]) == [5]\", \"assert max_visible_buildings([1, 3, 2, 5, 4]) == [1, 3, 5]\", \"assert...
{ "split": "train", "index": 70493, "acecode_id": "bigcode_python_fns_37309", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the withdrawal fee for a user based on their withdrawal history. The function should take two parameters: `user_id` (an integer representing the user's unique identifier) and `amount` (a Decimal representing the amount...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_user_withdraw_fee(1, Decimal('100.00')) == Decimal('2.00')\", \"assert calc_user_withdraw_fee(3, Decimal('75.50')) == Decimal('0.00')\", \"assert calc_user_withdraw_fee(5, Decimal('0.00')) == Decimal('0.00')\", \"assert calc_user_withdraw_fee(7, Decimal...
{ "split": "train", "index": 70494, "acecode_id": "bigcode_python_fns_21675", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that calculates the maximum absolute value from the list. If the list is empty, return 0. The function should be defined as `def max_absolute_value(nums: List[int]) -> int:`. \n\n### Input \n- A list of integers `nums` where 1 <= len(n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_absolute_value([1, -2, 3, -4]) == 4\", \"assert max_absolute_value([-1, -2, -3, -4]) == 4\", \"assert max_absolute_value([5, -5, 10, -10]) == 10\", \"assert max_absolute_value([]) == 0\", \"assert max_absolute_value([0, 0, 0]) == 0\", \"assert max_absolu...
{ "split": "train", "index": 70495, "acecode_id": "bigcode_python_fns_7157", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the loading of a JSON-like structure. The function should accept a string representing a file name and return a dictionary representing the contents of that file. If the file name is 'data.json', return a dictionary wit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert load_json('data.json') == {'name': 'LeetCode'}\", \"assert load_json('other.json') == {}\", \"assert load_json('test.json') == {}\", \"assert load_json('example.json') == {}\", \"assert load_json('sample.json') == {}\", \"assert load_json('input.json') == {}...
{ "split": "train", "index": 70496, "acecode_id": "bigcode_python_fns_13157", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing indices in a batch. Your task is to replace a specified index of selected elements in the list with random integers. The random integers should be drawn from the range [0, max_index - 1], ensuring that no integer in the selected ele...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replace_indices([0, 1, 2, 3, 4], 1, [True, True, False, False, False], 5) is None\", \"assert replace_indices([1, 1, 1, 1], 0, [True, True, True, True], 2) is None\", \"assert replace_indices([0, 0, 0, 0], 0, [True, True, True, False], 3) is None\", \"assert...
{ "split": "train", "index": 70497, "acecode_id": "bigcode_python_fns_28509", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a natural number n, implement a function `convert_to_octal(n)` that converts the number to its octal representation and returns it as a string. The input n will always be a non-negative integer.\nPlease reason step by step, then write a self-contained Python solution. Giv...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_to_octal(0) == '0'\", \"assert convert_to_octal(1) == '1'\", \"assert convert_to_octal(2) == '2'\", \"assert convert_to_octal(3) == '3'\", \"assert convert_to_octal(4) == '4'\", \"assert convert_to_octal(5) == '5'\", \"assert convert_to_octal(6) == '...
{ "split": "train", "index": 70498, "acecode_id": "evol_3954", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `fibonacci(n: int) -> List[int]` that generates and returns a list of the first N Fibonacci numbers, where N is a positive integer input by the user. The function should raise a ValueError if the input is less than or equal to zero or if the input is not an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci(1) == [0]\", \"assert fibonacci(2) == [0, 1]\", \"assert fibonacci(3) == [0, 1, 1]\", \"assert fibonacci(4) == [0, 1, 1, 2]\", \"assert fibonacci(5) == [0, 1, 1, 2, 3]\", \"assert fibonacci(6) == [0, 1, 1, 2, 3, 5]\", \"assert fibonacci(7) == [0, 1...
{ "split": "train", "index": 70499, "acecode_id": "evol_14734", "num_tests": 16 }