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 stores a redirect URL in a session for a remote application. The function `store_redirect_url(remote_app: str, url: str) -> None` takes in two parameters: a string `remote_app` representing the name of the remote application and a st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert store_redirect_url('app1', 'http://example.com/redirect1') == None\", \"assert store_redirect_url('app2', 'http://example.com/redirect2') == None\", \"assert store_redirect_url('app3', 'http://example.com/redirect3') == None\", \"assert store_redirect_url('a...
{ "split": "train", "index": 1500, "acecode_id": "bigcode_python_fns_41366", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_cylinder_volume_and_surface_areas(cylinders: List[Tuple[float, float, float]]) -> List[Tuple[float, float, float]]` that takes a list of cylinders, where each cylinder is represented as a tuple containing its radius, height, and an arbitrary y-co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_cylinder_volume_and_surface_areas([(1, 1, 0)]) == [(3.141592653589793, 12.566370614359172, 6.283185307179586)]\", \"assert calculate_cylinder_volume_and_surface_areas([(0, 1, 1)]) == []\", \"assert calculate_cylinder_volume_and_surface_areas([(1, 0...
{ "split": "train", "index": 1501, "acecode_id": "evol_23900", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Implement a function `hypervolume(length: float, width: float, height: float, depth: float) -> float` that calculates the hypervolume of a four-dimensional figure (hyper-rectangle) given its length, width, height, and depth. The function should raise a ValueError if any of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert hypervolume(1, 1, 1, 1) == 1\", \"assert hypervolume(2, 3, 4, 5) == 120\", \"assert hypervolume(0.5, 0.5, 0.5, 0.5) == 0.0625\", \"assert hypervolume(10, 10, 10, 10) == 10000\", \"assert hypervolume(1, 2, 3, 4) == 24\", \"assert hypervolume(7, 8, 9, 10) == 5...
{ "split": "train", "index": 1502, "acecode_id": "evol_10800", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function `median(l: list, cmp_func: callable)` that returns the median of the elements in the list `l` without using sorting or built-in functions. The function should handle cases with both even and odd numbers of elements, manage duplicates, and utilize the provid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert median([3, 1, 2, 4, 5], lambda a, b: a - b) == 3\", \"assert median([1, 2, 2, 4, 5], lambda a, b: a - b) == 2\", \"assert median([1, 3, 3], lambda a, b: a - b) == 3\", \"assert median([5, 5, 5, 5], lambda a, b: a - b) == 5\", \"assert median([7, 3, 1, 4], la...
{ "split": "train", "index": 1503, "acecode_id": "evol_893", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the activation and deactivation of various sub-systems in a building model. Each sub-system can either be activated or deactivated, and you will be given a list of operations to perform on these sub-systems. The function sh...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_sub_systems(['HVAC', 'Lift Control', 'Lighting'], ['activate:HVAC', 'deactivate:Lighting']) == {'HVAC': 'active', 'Lift Control': 'inactive', 'Lighting': 'inactive'}\", \"assert manage_sub_systems(['HVAC', 'Security'], ['activate:HVAC', 'activate:Secu...
{ "split": "train", "index": 1504, "acecode_id": "oss_18930", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `bool_like(value: Any, name: str, optional: bool = False, strict: bool = False) -> Optional[bool]` that converts a given value to a boolean. The function should raise a TypeError if the value is not a boolean or not compatible with boolean conversion, based...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bool_like(True, 'test1') == True\", \"assert bool_like(False, 'test2') == False\", \"assert bool_like(1, 'test3') == True\", \"assert bool_like(0, 'test4') == False\", \"assert bool_like(5, 'test5') == True\", \"assert bool_like(-1, 'test6') == True\", \"ass...
{ "split": "train", "index": 1505, "acecode_id": "bigcode_python_fns_38827", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings representing file names, write a function `count_file_extensions(file_list)` that returns a dictionary containing the count of files with each unique file extension. If a file name does not have an extension, it should be counted under an empty string ke...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_file_extensions(['file1.txt', 'file2.txt', 'file3.txt']) == {'txt': 3}\", \"assert count_file_extensions(['image.jpg', 'photo.jpeg', 'icon.png']) == {'jpg': 1, 'jpeg': 1, 'png': 1}\", \"assert count_file_extensions(['archive.zip', 'file.zip', 'data.tar...
{ "split": "train", "index": 1506, "acecode_id": "oss_4287", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of words and a list of corresponding field identifiers. Your function should return a dictionary where each word is a key and the value is another dictionary containing the field identifier as a key and a list of fil...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert query_multifield(['apple', 'banana', 'apple'], ['field1', 'field2', 'field1']) == {'apple': {'field1': [0, 2]}, 'banana': {'field2': [1]}}\", \"assert query_multifield(['cat', 'dog'], ['animal', 'animal']) == {'cat': {'animal': [0]}, 'dog': {'animal': [1]}}\...
{ "split": "train", "index": 1507, "acecode_id": "bigcode_python_fns_39036", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with identifying duplicate words in a given string. A duplicate word is defined as any word that appears more than once in the input string, regardless of case. Your function should ignore punctuation and consider words separated by spaces. Implement a function `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_duplicate_words('Hello world! Hello everyone. World is nice.') == ['hello', 'world']\", \"assert find_duplicate_words('No duplicates here') == []\", \"assert find_duplicate_words('Test test test') == ['test']\", \"assert find_duplicate_words('The quick ...
{ "split": "train", "index": 1508, "acecode_id": "oss_33691", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string of text and returns a list of unique words from that text. A word is defined as a sequence of characters separated by whitespace. The function should ignore any punctuation and consider words case-insensitively. If the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_unique_words('Hello world! Hello') == ['hello', 'world']\", \"assert extract_unique_words('') == []\", \"assert extract_unique_words('A B C D E F G H I J K L M N O P Q R S T U V W X Y Z') == ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'...
{ "split": "train", "index": 1509, "acecode_id": "bigcode_python_fns_17579", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Implement a function called `binary_insertion_sort` that takes a list of integers and sorts it in ascending order using the binary insertion sort algorithm. The function should return the sorted list. For example, given the input list [8, 6, 1, 9, 4], the output should be [1, 4...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert binary_insertion_sort([8, 6, 1, 9, 4]) == [1, 4, 6, 8, 9]\", \"assert binary_insertion_sort([5, 3, 8, 6, 2]) == [2, 3, 5, 6, 8]\", \"assert binary_insertion_sort([1]) == [1]\", \"assert binary_insertion_sort([]) == []\", \"assert binary_insertion_sort([4, 4,...
{ "split": "train", "index": 1510, "acecode_id": "evol_2740", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with designing a function that counts the number of match errors in a given rules collection. The function should take two arguments: a list of rules (as strings) and a string representing a file path (which you can ignore in your implementation). Each rule may c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_match_errors(['rule1', 'rule2 error', 'rule3 error'], 'some/path.yml') == 2\", \"assert count_match_errors(['error in rule1', 'error in rule2', 'error in rule3'], 'some/path.yml') == 3\", \"assert count_match_errors(['this is fine', 'error found here',...
{ "split": "train", "index": 1511, "acecode_id": "bigcode_python_fns_33491", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing a dataset, where each integer corresponds to a class label. Your task is to implement a function that filters this dataset to include at most 'k' examples from each class, maintaining the original order of the dataset. If there are ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_to_k_shot([0, 1, 0, 1, 2, 2, 2], 2) == [0, 1, 0, 1, 2, 2]\", \"assert filter_to_k_shot([0, 1, 2, 0, 1, 2, 3, 3, 3], 1) == [0, 1, 2, 3]\", \"assert filter_to_k_shot([0, 1, 1, 0, 2, 2, 3], 3) == [0, 1, 1, 0, 2, 2, 3]\", \"assert filter_to_k_shot([0, 0, ...
{ "split": "train", "index": 1512, "acecode_id": "bigcode_python_fns_36571", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that reorders words in a given sentence based on specific rules. The function takes in a sentence and a question word as input and rearranges the words in the sentence according to the following rules:\n\n1. If the question word is \"...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reorder_sentence('Who is the author of this book', 'who') == 'Who is the author of this book'\", \"assert reorder_sentence('Who wrote the book on Python', 'who') == 'Who wrote the book on Python'\", \"assert reorder_sentence('When is the meeting scheduled', ...
{ "split": "train", "index": 1513, "acecode_id": "oss_24651", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the total area of coverage represented by a set of rectangles. Each rectangle is defined by its bottom-left and top-right coordinates. The function should merge overlapping rectangles and return the total area covered ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert total_area([(0, 0, 1, 1), (1, 0, 2, 1), (2, 0, 3, 1)]) == 3\", \"assert total_area([(1, 1, 2, 2), (2, 2, 3, 3), (1, 1, 3, 3)]) == 4\", \"assert total_area([(1, 1, 3, 3)]) == 4\", \"assert total_area([(0, 0, 2, 1), (2, 0, 4, 1)]) == 4\", \"assert total_area([...
{ "split": "train", "index": 1514, "acecode_id": "oss_32887", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given the distributive property of multiplication over addition in mathematics, implement a function `verify_distributive_property(a: int, b: int, c: int) -> bool` that checks if the expression a * (b + c) is equal to (a * b) + (a * c).\nPlease reason step by step, then write a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert verify_distributive_property(5, 2, 8) == True\", \"assert verify_distributive_property(1, 1, 1) == True\", \"assert verify_distributive_property(3, 4, 5) == True\", \"assert verify_distributive_property(0, 5, 10) == True\", \"assert verify_distributive_prope...
{ "split": "train", "index": 1515, "acecode_id": "evol_14292", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that generates all unique permutations of a given string. The input string may contain duplicate characters, and the output should include each unique permutation exactly once. The order of the permutations in the output does not matter. For example, given ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_permutations('abc') == ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']\", \"assert unique_permutations('a') == ['a']\", \"assert unique_permutations('ab') == ['ab', 'ba']\", \"assert unique_permutations('aabb') == ['aabb', 'abab', 'abba', 'baab', 'baba', '...
{ "split": "train", "index": 1516, "acecode_id": "evol_21029", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `calculate_sum` that takes a list of integers as input and returns the sum of the integers in that list. The input list can contain both positive and negative integers. If the input list is empty, the function should return 0. Impl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_sum([1, 2, 3]) == 6\", \"assert calculate_sum([-1, -2, -3]) == -6\", \"assert calculate_sum([1, -1, 2]) == 2\", \"assert calculate_sum([]) == 0\", \"assert calculate_sum([0, 0, 0]) == 0\", \"assert calculate_sum([5, 10, 15]) == 30\", \"assert calcu...
{ "split": "train", "index": 1517, "acecode_id": "bigcode_python_fns_34394", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, write a function that returns the largest prime factor of n. A prime factor is a factor that is a prime number. You can assume that n is at least 2.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert largest_prime_factor(2) == 2\", \"assert largest_prime_factor(3) == 3\", \"assert largest_prime_factor(4) == 2\", \"assert largest_prime_factor(10) == 5\", \"assert largest_prime_factor(15) == 5\", \"assert largest_prime_factor(28) == 7\", \"assert largest_p...
{ "split": "train", "index": 1518, "acecode_id": "evol_33447", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string 's' and an integer 'k'. Your task is to rearrange the string such that the characters are sorted in ascending order while ensuring that the last 'k' characters of the resulting string are moved to the front. If 'k' is greater than the length of the string...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert orderlyString('abc', 1) == 'cab'\", \"assert orderlyString('a', 1) == 'a'\", \"assert orderlyString('abcd', 4) == 'abcd'\", \"assert orderlyString('zzzzzz', 0) == 'zzzzzz'\", \"assert orderlyString('abcde', 5) == 'abcde'\", \"assert orderlyString('', 1) == '...
{ "split": "train", "index": 1519, "acecode_id": "evol_28898", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that calculates the weighted average of student grades based on two dictionaries: 'grades' and 'credits'. The 'grades' dictionary contains course names as keys and lists of grades as values, while the 'credits' dictionary conta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert weighted_average({'Chemistry': [60, 70]}, {'Chemistry': 3}) == 65.0\", \"assert weighted_average({'History': [100]}, {'History': 5}) == 100.0\", \"assert weighted_average({'Math': [50, 60], 'Physics': [70]}, {'Math': 0, 'Physics': 3}) == 70.0\", \"assert wei...
{ "split": "train", "index": 1520, "acecode_id": "oss_90", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Write a function `count_elements_2d(arr)` that takes a two-dimensional list (array) as input and returns the total number of elements in that array. The input array will consist of sub-arrays of varying lengths. For example, given the input [[1, 2], [3, 4], [5, 6]], the functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_elements_2d([[1, 2], [3, 4], [5, 6]]) == 6\", \"assert count_elements_2d([[1], [2], [3]]) == 3\", \"assert count_elements_2d([[], [], []]) == 0\", \"assert count_elements_2d([[1, 2, 3], [4, 5]]) == 5\", \"assert count_elements_2d([[1], [2], [3], [4], [...
{ "split": "train", "index": 1521, "acecode_id": "evol_15567", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the nth day from a given starting day of the week. The days of the week are represented as integers where 1 corresponds to Monday, 2 to Tuesday, 3 to Wednesday, 4 to Thursday, 5 to Friday, 6 to Saturday, and 7 to Sunday. Write a function called `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert nth_day_from(0, 1) == 1\", \"assert nth_day_from(1, 1) == 2\", \"assert nth_day_from(2, 1) == 3\", \"assert nth_day_from(7, 1) == 1\", \"assert nth_day_from(10, 1) == 4\", \"assert nth_day_from(0, 7) == 7\", \"assert nth_day_from(1, 7) == 1\", \"assert nth_d...
{ "split": "train", "index": 1522, "acecode_id": "oss_18838", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of strings, where each string represents a 'child' in a hierarchical structure. Each child can either be a single letter (representing a child at the current level) or a nested list of children (indicating a deeper level). Your task is to implement a functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert are_children_flat(['a', 'b', 'c'], 1) == True\", \"assert are_children_flat(['a', 'b', 'c', 'd'], 1) == True\", \"assert are_children_flat(['a', 'b', 'ab', 'abc'], 1) == False\", \"assert are_children_flat(['a', 'abc', 'def'], 1) == False\", \"assert are_chi...
{ "split": "train", "index": 1523, "acecode_id": "bigcode_python_fns_18113", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a response object with a status code and a JSON body, and returns an error message based on the status code. The response object will have a structure where the JSON can contain fields like 'error_code', 'description_detail', '...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_error({'status_code': 400, 'json': {'error_code': 'bad_request', 'description': 'Invalid input'}}) == 'bad_request Invalid input (None)'\", \"assert handle_error({'status_code': 402, 'json': {'error_code': 'payment_required', 'description': 'Payment r...
{ "split": "train", "index": 1524, "acecode_id": "bigcode_python_fns_18859", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function `fibonacci(n)` that generates the first n numbers of the Fibonacci series. The Fibonacci series starts with 0 and 1, and each subsequent number is the sum of the two preceding ones. The function should return a list containing the first n Fibonacci numbers. For...
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": 1525, "acecode_id": "evol_6574", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two dictionaries: `to_update` and `update_from`. Your task is to implement a function that updates `to_update` with the key-value pairs from `update_from`, but only for those keys that do not already exist in `to_update`. If `to_update` is None, treat it as an emp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_dict({'a': 1, 'b': 2}, {'b': 3, 'c': 4}) == {'a': 1, 'b': 2, 'c': 4}\", \"assert update_dict(None, {'x': 10}) == {'x': 10}\", \"assert update_dict({}, {'a': 1, 'b': 2}) == {'a': 1, 'b': 2}\", \"assert update_dict({'k1': 'v1'}, {}) == {'k1': 'v1'}\", \...
{ "split": "train", "index": 1526, "acecode_id": "bigcode_python_fns_7471", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of devices represented as dictionaries, each containing various string properties, write a function `get_device_property(devices: List[Dict[str, str]], property: str) -> Optional[str]` that searches for the specified property in the list of devices and returns the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_device_property([{'name': 'Device1', 'type': 'sensor'}, {'name': 'Device2', 'type': 'actuator'}], 'name') == 'Device1'\", \"assert get_device_property([{'name': 'Device1', 'type': 'sensor'}, {'name': 'Device2', 'type': 'actuator'}], 'type') == 'sensor'\"...
{ "split": "train", "index": 1527, "acecode_id": "bigcode_python_fns_5273", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a numerical sequential array containing unique elements ranging from 1 to 100, with one integer missing from the sequence. Your task is to implement a function `find_missing(arr)` that identifies the omitted integer in the array. For example, if `arr = [1, 2, 4, 6...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_missing([1, 3, 4, 5, 6]) == 2\", \"assert find_missing([2, 3, 4, 5, 6, 7, 8, 9, 10]) == 1\", \"assert find_missing([1, 2, 3, 4, 5, 7]) == 6\", \"assert find_missing([1]) == 2\", \"assert find_missing([1, 2, 3]) == 4\", \"assert find_missing([1, 2, 3, 5,...
{ "split": "train", "index": 1528, "acecode_id": "evol_23611", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given an account object with attributes such as `dbinstance_id`, `account_name`, `account_status`, `account_type`, `account_description`, and `database_privileges`, write a function `get_account_info(account)` that takes an account object as input and returns a dictionary conta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_account_info(None) == {}\", \"assert get_account_info(MockAccount('123', 'JohnDoe', 'active', 'admin', 'Test account', ['read', 'write'])) == {'db_instance_id': '123', 'account_name': 'JohnDoe', 'account_status': 'active', 'account_type': 'admin', 'accou...
{ "split": "train", "index": 1529, "acecode_id": "bigcode_python_fns_23481", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple function that manages a list of books. Each book has a title, an author, and a publication year. Your function should receive a list of books and a new book to be added to this list. The function should return the updated list of books ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_book([('Book 1', 'Author 1', 2020)], ('Book 2', 'Author 2', 2021)) == [('Book 1', 'Author 1', 2020), ('Book 2', 'Author 2', 2021)]\", \"assert add_book([], ('Book 1', 'Author 1', 2020)) == [('Book 1', 'Author 1', 2020)]\", \"assert add_book([('Book 1', '...
{ "split": "train", "index": 1530, "acecode_id": "oss_24012", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `initialize_tv_session` that simulates the initialization of a TV session based on hyperparameters provided as a dictionary. The function should take a dictionary of hyperparameters, which contains the following keys: 'solver' (a dictiona...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_tv_session({'solver': {'keep_checkpoint_every_n_hours': 5.0}, 'dirs': {'output_dir': 'output/'}}) == ('session_1', 'saver_1', 'summary_op', 'summary_writer_1', 'coord_1', 'threads_1')\", \"assert initialize_tv_session({'solver': {}, 'dirs': {'outp...
{ "split": "train", "index": 1531, "acecode_id": "bigcode_python_fns_27510", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that initializes a graph convolutional network (GCN) model based on the specified number of layers. The GCN model is used for node classification in a social network graph. Your function should take in the number of layers and the tra...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_gcn(2, [1, 2, 3], [0.1, 0.2, 0.3], [0.5, 0.6]) == {'layers': 3, 'C_train': [1, 2], 'X_train': [0.1, 0.2], 'e_train': [0.5, 0.6]}\", \"assert initialize_gcn(1, [1, 2], [0.1, 0.2], [0.5]) == {'layers': 2, 'C_train': [1], 'X_train': [0.1], 'e_train':...
{ "split": "train", "index": 1532, "acecode_id": "oss_13500", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a Signal-to-Noise Ratio (SNR) in decibels (dB), write a function that computes the expected time of arrival error variance (in seconds squared) for a peak detection algorithm based on the given SNR. The function should convert the SNR from decibels to linear units and the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_error_variance(0) == 0.5\", \"assert compute_error_variance(10) == 0.05\", \"assert compute_error_variance(20) == 0.005\", \"assert compute_error_variance(30) == 0.0005\", \"assert compute_error_variance(-10) == 5.0\", \"assert compute_error_variance...
{ "split": "train", "index": 1533, "acecode_id": "bigcode_python_fns_29462", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that inserts a given string of content before the closing </head> tag in a provided HTML string. If the </head> tag is not present in the HTML, the function should return the original HTML string unchanged. Your function should have the fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert inject_content_head_last('<html><head></head><body></body></html>', '<meta charset=\\\"UTF-8\\\">') == '<html><head><meta charset=\\\"UTF-8\\\"></head><body></body></html>'\", \"assert inject_content_head_last('<html><head><title>Test</title></head><body></b...
{ "split": "train", "index": 1534, "acecode_id": "bigcode_python_fns_15825", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the process of uploading files in a web application. The function `upload_files(file_paths: List[str]) -> List[str]` should take a list of file paths as input and return a list of statuses indicating whether each file w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert upload_files([]) == []\", \"assert upload_files(['file1.txt']) == ['Uploaded successfully']\", \"assert upload_files(['nonexistent.txt']) == ['Error: File not found']\", \"assert upload_files(['file1.txt', 'file2.txt']) == ['Uploaded successfully', 'Uploaded...
{ "split": "train", "index": 1535, "acecode_id": "oss_12472", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that merges two lists of complex numbers and returns a new list containing the sum of corresponding complex numbers. Each complex number is represented as a tuple with two elements: the real part and the imaginary part. If one list is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_complex_numbers([(1, 2), (3, 4)], [(5, 6), (7, 8)]) == [(6, 8), (10, 12)]\", \"assert add_complex_numbers([(1, 1)], [(2, 2), (3, 3)]) == [(3, 3), (3, 3)]\", \"assert add_complex_numbers([], [(1, 1), (2, 2)]) == [(1, 1), (2, 2)]\", \"assert add_complex_nu...
{ "split": "train", "index": 1536, "acecode_id": "oss_17910", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of Zotero bibliographic records, implement a function that processes the records to ensure it only retains the first record in the case where multiple records are provided. If the input is not a list or if the list is empty, the function should raise a ValueError. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_zotero_data([{ 'title': 'Book 1', 'author': 'Author A' }]) == [{ 'title': 'Book 1', 'author': 'Author A' }]\", \"assert process_zotero_data([{ 'title': 'Book 1', 'author': 'Author A' }, { 'title': 'Note 1', 'author': 'Author B' }]) == [{ 'title': 'Bo...
{ "split": "train", "index": 1537, "acecode_id": "bigcode_python_fns_16620", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of software dependencies and their associated patches. The function should extract and organize the information from the given input and return a structured representation of the dependencies and patches. The ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_dependencies(['dependency(\\\"libA\\\", when=\\\"1.0\\\", sha256=\\\"abc123\\\")']) == {'dependencies': {'libA': {'1.0': 'abc123'}}, 'patches': {}}\", \"assert process_dependencies(['patch(\\\"urlA\\\", sha256=\\\"hashA\\\", when=\\\"libA\\\")']) == ...
{ "split": "train", "index": 1538, "acecode_id": "oss_30830", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a game category selector for a gaming platform. The platform has a dictionary `game_dict` containing game categories as keys and corresponding game details as values. Your goal is to implement a function `select_game_category` that returns a random ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert select_game_category() in ['action', 'adventure', 'puzzle']\", \"assert select_game_category() in ['action', 'adventure', 'puzzle']\", \"assert select_game_category() in ['action', 'adventure', 'puzzle']\", \"assert select_game_category() in ['action', 'adve...
{ "split": "train", "index": 1539, "acecode_id": "oss_21243", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the parsing of command line arguments for a simple application. The function should accept a list of strings, which represent the command line arguments, and return a dictionary that maps the commands to their respective ar...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_args(['create', 'config.txt']) == {'command': 'create', 'argument': 'config.txt'}\", \"assert parse_args(['run', 'config.json']) == {'command': 'run', 'argument': 'config.json'}\", \"assert parse_args(['create']) == 'Invalid command or missing argument...
{ "split": "train", "index": 1540, "acecode_id": "bigcode_python_fns_47459", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function to process and summarize usage statistics for a software application. The function should take a dictionary of usage statistics where the keys are feature names (strings) and the values are counts of usage (integers). Your goal is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert summarize_usage_statistics({'feature1': 100, 'feature2': 200}) == {'total_usage': 300, 'used_features_count': 2}\", \"assert summarize_usage_statistics({'feature1': 0, 'feature2': 0}) == {'total_usage': 0, 'used_features_count': 0}\", \"assert summarize_usag...
{ "split": "train", "index": 1541, "acecode_id": "oss_31656", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string representing a VBA operator. Your task is to convert this operator to its equivalent Python operator. The VBA operators and their corresponding Python operators are as follows: 'Not' to 'not', 'And' and 'AndAlso' to 'and', 'Or' and 'OrElse' to 'or', '=' t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_vba_operator('Not') == 'not'\", \"assert convert_vba_operator('And') == 'and'\", \"assert convert_vba_operator('AndAlso') == 'and'\", \"assert convert_vba_operator('Or') == 'or'\", \"assert convert_vba_operator('OrElse') == 'or'\", \"assert convert_v...
{ "split": "train", "index": 1542, "acecode_id": "bigcode_python_fns_23110", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that verifies if a given user data matches an expected structure and data. The function should take a dictionary as input that represents user data, and return True if the input dictionary matches the expected user data structure, and Fal...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_user_data({'id': 123, 'username': 'testuser', 'email': 'testuser@example.com'}) == True\", \"assert is_valid_user_data({'id': 123, 'username': 'testuser'}) == False\", \"assert is_valid_user_data({'username': 'testuser', 'email': 'testuser@example.c...
{ "split": "train", "index": 1543, "acecode_id": "oss_16004", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the creation of a database table for storing service information. The function should take no input parameters and return a dictionary representing the table schema. The schema must include the following columns: 'id', 'nam...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_service_table()['table_name'] == 'service'\", \"assert len(create_service_table()['columns']) == 4\", \"assert create_service_table()['columns'][0]['name'] == 'id'\", \"assert create_service_table()['columns'][0]['type'] == 'Integer'\", \"assert creat...
{ "split": "train", "index": 1544, "acecode_id": "oss_12061", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a custom validation function that ensures a given string starts with the prefix 'ABC'. The function should accept a string input and check if it adheres to this format. If the input string starts with 'ABC', the function should return True, indicating succ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_format_validator('ABC123') == True\", \"assert custom_format_validator('ABC') == True\", \"assert custom_format_validator('ABCD') == True\", \"assert custom_format_validator('ABCxyz') == True\", \"assert custom_format_validator('ABC!@#') == True\", \"...
{ "split": "train", "index": 1545, "acecode_id": "oss_10695", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function `generate_non_prime(lower: int, upper: int) -> int` that generates a random integer within the given range [lower, upper], ensuring all numbers have equal probability of being chosen. Additionally, the function should reject any generated number that is a prime...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_non_prime(0, 10) in [0, 1, 4, 6, 8, 9, 10]\", \"assert generate_non_prime(0, 0) in [0]\", \"assert generate_non_prime(2, 2) == -1\", \"assert generate_non_prime(4, 10) in [4, 6, 8, 9, 10]\", \"assert generate_non_prime(10, 10) in [10]\", \"assert ge...
{ "split": "train", "index": 1546, "acecode_id": "evol_16710", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of strings representing class names, implement a function `find_subclasses` that identifies and returns a list of subclasses of a specified superclass name. The function should take two parameters: a list of class names (strings) and the name of the superclass (str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_subclasses(['Module.Class1', 'Module.Class2', 'Module.Class3'], 'Module.Class4') == []\", \"assert find_subclasses(['Module1.ClassA', 'Module1.ClassB'], 'Module1.ClassC') == []\", \"assert find_subclasses(['X.Y.ClassX', 'X.Z.ClassY'], 'X.Y.ClassY') == [...
{ "split": "train", "index": 1547, "acecode_id": "bigcode_python_fns_18890", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a 2D list of integers representing a matrix, write a function that checks if the matrix has the allowed number of dimensions and if the size of the last dimension matches a specified value. The function should return True if the matrix has the specified number of dimensio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_matrix([[1, 2], [3, 4]], [2], 2) == True\", \"assert is_valid_matrix([[1, 2], [3, 4]], [2], 'any') == True\", \"assert is_valid_matrix([[1, 2, 3], [4, 5, 6]], [2], 3) == True\", \"assert is_valid_matrix([[1, 2], [3, 4]], [2], 3) == False\", \"assert...
{ "split": "train", "index": 1548, "acecode_id": "bigcode_python_fns_28026", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of objects, write a function `check_failures(objects: List[Any]) -> List[bool]` that returns a list of boolean values indicating whether each object in the input list is an instance of the class `Fail`. The class `Fail` is defined as follows: `class Fail: pass`. Th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_failures([Fail(), 1, 'string', Fail()]) == [True, False, False, True]\", \"assert check_failures([1, 2, 3]) == [False, False, False]\", \"assert check_failures([]) == []\", \"assert check_failures([Fail()]) == [True]\", \"assert check_failures([Fail(),...
{ "split": "train", "index": 1549, "acecode_id": "bigcode_python_fns_25247", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string input, return the string with 'Hello, ' prefixed to it. Implement a function called `greet(name: str) -> str` that takes a single parameter `name`, which is a string. The function should return the greeting message as a new string. For example, if the input is 'A...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert greet('Alice') == 'Hello, Alice'\", \"assert greet('Bob') == 'Hello, Bob'\", \"assert greet('Charlie') == 'Hello, Charlie'\", \"assert greet('David') == 'Hello, David'\", \"assert greet('Eve') == 'Hello, Eve'\", \"assert greet('Frank') == 'Hello, Frank'\", \...
{ "split": "train", "index": 1550, "acecode_id": "bigcode_python_fns_31778", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates an OAuth invite link for a user on a platform. The function should take a user ID as input and return a string representing the invite link. The permissions for the invite link are predefined and include the following: view...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_invite_link('436251140376494080') == 'https://discord.com/api/oauth2/authorize?client_id=436251140376494080&permissions=65960640&scope=bot%20applications.commands'\", \"assert generate_invite_link('123456789012345678') == 'https://discord.com/api/oa...
{ "split": "train", "index": 1551, "acecode_id": "bigcode_python_fns_3758", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings where each string represents a document. Your task is to filter out the documents that do not match a specified language code. Implement a function `filter_documents_by_language(documents: List[str], lang_code: str) -> List[str]` that takes in a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_documents_by_language(['Hello world.', 'Bonjour le monde.'], 'en') == ['Hello world.']\", \"assert filter_documents_by_language(['Hello world.', 'Bonjour le monde.'], 'fr') == ['Bonjour le monde.']\", \"assert filter_documents_by_language(['Hello ther...
{ "split": "train", "index": 1552, "acecode_id": "bigcode_python_fns_34106", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of URL patterns and their corresponding view names, and returns a dictionary mapping each URL pattern to its view name. Each URL pattern is represented as a string and the view name is represented as a string. The input ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_endpoints_and_views([('hook', 'v1.sqlorders.hook-sqlorders'), ('export/download/<str:base64_filename>', 'v1.sqlorders.download-export-files'), ('versions/get', 'v1.sqlorders.versions.get'), ('versions/list', 'v1.sqlorders.versions.list'), ('versions/...
{ "split": "train", "index": 1553, "acecode_id": "oss_6952", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two matrices represented as 2D lists, `x_mat` and `y_mat`, write a function `squared_euclidean_distance(x_mat: List[List[float]], y_mat: List[List[float]]) -> List[List[float]]` that calculates the squared Euclidean distance between each row in `x_mat` and each row in `y_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert squared_euclidean_distance([[1]], [[1]]) == [[0]]\", \"assert squared_euclidean_distance([[1]], [[2]]) == [[1]]\", \"assert squared_euclidean_distance([[1, 2]], [[1, 2]]) == [[0]]\", \"assert squared_euclidean_distance([[1, 2]], [[2, 3]]) == [[2]]\", \"asser...
{ "split": "train", "index": 1554, "acecode_id": "bigcode_python_fns_3292", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function to parse a package configuration dictionary for a Python package management system. The configuration dictionary contains information about the package, including keywords, packages, installation requirements, and other settings. Your fun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_package_config({'keywords': ['boleto', 'extractor', 'pdf'], 'packages': ['package1', 'package2'], 'include_package_data': True, 'zip_safe': False, 'install_requires': ['requirement1'], 'dependency_links': ['link1']}) == {'keywords': ['boleto', 'extract...
{ "split": "train", "index": 1555, "acecode_id": "oss_25453", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given a string representing the code of a station. The code can either represent a North American station or an International station. Your task is to implement a function `uses_na_format(station: str) -> bool` that returns `True` if the station code uses the North Amer...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert uses_na_format('A123') == True\", \"assert uses_na_format('B456') == True\", \"assert uses_na_format('C789') == True\", \"assert uses_na_format('X123') == False\", \"assert uses_na_format('Y456') == False\", \"assert uses_na_format('Z789') == False\", \"asse...
{ "split": "train", "index": 1556, "acecode_id": "bigcode_python_fns_28964", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating the counting of vehicles on two arms of a traffic intersection. Each arm has a set of vehicles represented by agents. Each vehicle agent has a `unique_id` and a `count_cars()` method that returns the number of cars it represents. You need to imple...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_vehicles([{'agent_type': 1, 'unique_id': 0, 'count_cars': lambda: 3}, {'agent_type': 1, 'unique_id': 1, 'count_cars': lambda: 2}, {'agent_type': 1, 'unique_id': 2, 'count_cars': lambda: 5}]) == (5, 5)\", \"assert count_vehicles([{'agent_type': 1, 'uniq...
{ "split": "train", "index": 1557, "acecode_id": "oss_12504", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a sparse data storage system that only stores non-default values for various fields. Your goal is to implement a function called `sparse_field_storage` that takes a list of field-value pairs, where each field name is a string and its correspondi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sparse_field_storage([('boolean', True), ('integer', 0), ('float', 0.0), ('string', 'Hello'), ('tuple', (1, 2)), ('list', [1, 2, 3]), ('dict', {'key': 'value'})]) == {'boolean': True, 'string': 'Hello', 'tuple': (1, 2), 'list': [1, 2, 3], 'dict': {'key': 'va...
{ "split": "train", "index": 1558, "acecode_id": "oss_15746", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Develop a function that finds the second smallest positive odd number from a given list of integers. The list can contain negative numbers and duplicates. If there is no second smallest positive odd number, return None.\nPlease reason step by step, then write a self-contained P...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert second_smallest_odd_element([5, -2, -1, 0, -1, 3, 8, -8, -9, 2, -11]) == 5\", \"assert second_smallest_odd_element([7, 1, 1, 9]) == 7\", \"assert second_smallest_odd_element([2, 4, 6]) == None\", \"assert second_smallest_odd_element([3, 3, 3, 3]) == None\", ...
{ "split": "train", "index": 1559, "acecode_id": "evol_15537", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Construct a function that takes in an array of words as input and returns a transformed array where the final letter of each word is capitalized, while ensuring that all other characters in the word are converted to lowercase. The function should correctly handle special charac...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform(['a', 'B', 'c']) == ['A', 'B', 'C']\", \"assert transform(['!@#$', 'hello']) == ['!@#$', 'hellO']\", \"assert transform(['testcase', 'foo_bar']) == ['testcasE', 'foo_baR']\", \"assert transform(['MixedCASE', 'special#chars']) == ['mixedcasE', 'spec...
{ "split": "train", "index": 1560, "acecode_id": "evol_3511", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a two-dimensional array (matrix) consisting of heterogeneous string elements. Some elements may contain special symbols that render them invalid. Your task is to implement a function that filters out these invalid strings and returns the longest valid string from ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert solve([['Hello', 'World'], ['I', 'Am']]) == 'Hello'\", \"assert solve([['One', 'Two'], ['Three', 'Four']]) == 'Three'\", \"assert solve([['Short', 'Invalid{String'], ['AnotherInvalid/']]) == 'Short'\", \"assert solve([['', 'Empty'], ['Faulty/', 'Invalid{']])...
{ "split": "train", "index": 1561, "acecode_id": "evol_13020", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simplified bus tracking system. Your goal is to implement a function `track_bus_locations(buses: List[Tuple[str, float, float, str]]) -> Dict[str, Tuple[float, float, str]]` that takes a list of buses along with their respective locations and di...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert track_bus_locations([('bus1', 40.7128, -74.0060, 'N'), ('bus2', 34.0522, -118.2437, 'E'), ('bus1', 41.0000, -75.0000, 'W')]) == {'bus1': (41.0, -75.0, 'W'), 'bus2': (34.0522, -118.2437, 'E')}\", \"assert track_bus_locations([('bus1', 30.0, 40.0, 'N'), ('bus1...
{ "split": "train", "index": 1562, "acecode_id": "oss_31297", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the COVID-19 model for a given country. The function should take a country name as input and return a string indicating that the COVID-19 model has been successfully run for that country. The function should only accept cou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert run_covid_model('USA') == 'COVID-19 model has been successfully run for USA.'\", \"assert run_covid_model('Canada') == 'COVID-19 model has been successfully run for Canada.'\", \"assert run_covid_model('India') == 'COVID-19 model has been successfully run fo...
{ "split": "train", "index": 1563, "acecode_id": "bigcode_python_fns_26990", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a function that takes this list as input and returns a new list containing only the even numbers from the original list, in the same order they appeared. If there are no even numbers, return an empty list. Write a function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25]) == [10, 20]\", \"assert filter_even_numbers([-1, -2, -3, -4]) == [-2, -4]\", \"assert filter_even_numbers([0, 1, 2, 3]) == [0, 2]\", \"assert filter_even_numbers...
{ "split": "train", "index": 1564, "acecode_id": "bigcode_python_fns_10028", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that accepts two inputs: a unique string and a Boolean flag. If the Boolean flag is set to 'True', convert the string to its lowercase form. If the flag is set to 'False', reverse the string while maintaining its original case. Additionally, the function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_string('Hello World', True) == 'hello world'\", \"assert convert_string('Hello World', False) == 'dlroW olleH'\", \"assert convert_string('Python', True) == 'python'\", \"assert convert_string('Python', False) == 'nohtyP'\", \"assert convert_string('...
{ "split": "train", "index": 1565, "acecode_id": "evol_5784", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of features represented as strings. Your task is to create a function that returns a dictionary where the keys are the features and the values are their respective indices in the list. If a feature appears multiple times, only the index of its first occurre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert enumerate_features(['feature1', 'feature2', 'feature3']) == {'feature1': 0, 'feature2': 1, 'feature3': 2}\", \"assert enumerate_features(['feature1', 'feature1', 'feature2']) == {'feature1': 0, 'feature2': 2}\", \"assert enumerate_features(['a', 'b', 'a', 'c...
{ "split": "train", "index": 1566, "acecode_id": "bigcode_python_fns_43481", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function to calculate the least common multiple (LCM) of all the numbers in the list. The LCM of two or more integers is the smallest positive integer that is divisible by each of the integers. Your function should take a list of integers as in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lcm([1, 2, 3]) == 6\", \"assert lcm([4, 5, 6]) == 60\", \"assert lcm([7, 14, 21]) == 42\", \"assert lcm([12, 15, 20]) == 60\", \"assert lcm([1]) == 1\", \"assert lcm([10]) == 10\", \"assert lcm([25, 30, 35]) == 1050\", \"assert lcm([2, 4, 8, 16]) == 16\", \"...
{ "split": "train", "index": 1567, "acecode_id": "bigcode_python_fns_31790", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `sigmoid(inp, lim=350.0)` that calculates the sigmoid function for an input list of real numbers. The sigmoid function is defined as: \n\n sigmoid(x) = 1 / (1 + exp(-x))\n\nwhere `exp` is the exponential function. The function should handle each value in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sigmoid([0]) == [0.5]\", \"assert sigmoid([-1]) == [0.2689414213699951]\", \"assert sigmoid([1]) == [0.7310585786300049]\", \"assert sigmoid([100]) == [1.0]\", \"assert sigmoid([350]) == [1.0]\", \"assert sigmoid([0, 0, 0]) == [0.5, 0.5, 0.5]\", \"assert sig...
{ "split": "train", "index": 1568, "acecode_id": "oss_2690", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that checks whether a user has enough funds to transfer a specified amount to another user in a banking system. The function `has_enough_funds` takes three parameters: `users` (a dictionary where keys are user IDs and values are dicti...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_enough_funds({'user1': {'balance': 500}, 'user2': {'balance': 300}}, 'user1', 'user2', 200) == True\", \"assert has_enough_funds({'user1': {'balance': 500}, 'user2': {'balance': 300}}, 'user1', 'user2', 600) == False\", \"assert has_enough_funds({'user1'...
{ "split": "train", "index": 1569, "acecode_id": "oss_18024", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a database connection URL for a PostgreSQL database using given credentials. The function should take a dictionary containing the database credentials and return a formatted connection string. The input dictionary will have...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_db_url({'db': 'test_db', 'user': 'admin', 'host': 'localhost', 'port': 5432, 'pwd': 'secret'}) == 'postgresql://admin:secret@localhost:5432/test_db'\", \"assert generate_db_url({'db': 'my_database', 'user': 'user1', 'host': '192.168.1.1', 'port': 54...
{ "split": "train", "index": 1570, "acecode_id": "bigcode_python_fns_36988", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a unique pattern based on a given length. The pattern is generated by repeating the sequence of characters 'ABC' until the length of the pattern reaches the specified length. For example, if the input length is 5, the output should be 'ABCAB'. Write...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_pattern(1) == 'A'\", \"assert create_pattern(2) == 'AB'\", \"assert create_pattern(3) == 'ABC'\", \"assert create_pattern(4) == 'ABCA'\", \"assert create_pattern(5) == 'ABCAB'\", \"assert create_pattern(6) == 'ABCABC'\", \"assert create_pattern(7) == ...
{ "split": "train", "index": 1571, "acecode_id": "bigcode_python_fns_35244", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple logging mechanism. This function, named `log_message`, takes two parameters: a string `message` and a string `level`. The `level` can be one of the following: 'INFO', 'WARNING', or 'ERROR'. The function should retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert log_message('System is starting', 'INFO') == '[INFO] - System is starting'\", \"assert log_message('Disk space is low', 'WARNING') == '[WARNING] - Disk space is low'\", \"assert log_message('Connection lost', 'ERROR') == '[ERROR] - Connection lost'\", \"asse...
{ "split": "train", "index": 1572, "acecode_id": "oss_22722", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Write a function `find_maximum_sum_subarray(arr: List[int], k: int) -> int` that finds the maximum sum of a contiguous subarray of size `k`. The input list may contain both positive and negative integers. If `k` is greater than the length of th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_maximum_sum_subarray([1, 2, 3, 4, 5], 2) == 9\", \"assert find_maximum_sum_subarray([2, 1, 5, 1, 3, 2], 3) == 9\", \"assert find_maximum_sum_subarray([1, 2, 3, 4, 5], 5) == 15\", \"assert find_maximum_sum_subarray([-1, -2, -3, -4, -5], 2) == -3\", \"ass...
{ "split": "train", "index": 1573, "acecode_id": "bigcode_python_fns_17528", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of stream targets and returns a dictionary containing the number of stream targets and a list of those targets. Write a function `get_stream_targets_info(stream_targets: List[str]) -> Dict[str, Union[int, List[str]]]...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_stream_targets_info(['target1', 'target2']) == {'count': 2, 'stream_targets': ['target1', 'target2']}\", \"assert get_stream_targets_info(['targetA']) == {'count': 1, 'stream_targets': ['targetA']}\", \"assert get_stream_targets_info([]) == {'count': 0, ...
{ "split": "train", "index": 1574, "acecode_id": "bigcode_python_fns_11390", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `is_anagram_of_reverse(word: str) -> bool` that determines whether a given word is an anagram of its reverse. The function should ignore case sensitivity when comparing the characters. You should only consider the characters in the word and not any addition...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_anagram_of_reverse('madam') == True\", \"assert is_anagram_of_reverse('hello') == False\", \"assert is_anagram_of_reverse('racecar') == True\", \"assert is_anagram_of_reverse('A man a plan a canal Panama') == False\", \"assert is_anagram_of_reverse('noon'...
{ "split": "train", "index": 1575, "acecode_id": "evol_12529", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, write a function `sum_of_multiples(n)` that returns the sum of all multiples of 3 that are less than n. The function should initialize an empty set, add multiples of 3 to the set starting from 3, and stop adding when the next multiple is greater than...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_multiples(10) == 18\", \"assert sum_of_multiples(3) == 0\", \"assert sum_of_multiples(1) == 0\", \"assert sum_of_multiples(20) == 63\", \"assert sum_of_multiples(30) == 135\", \"assert sum_of_multiples(5) == 3\", \"assert sum_of_multiples(0) == 0\", \...
{ "split": "train", "index": 1576, "acecode_id": "oss_26759", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a list of sentences, where each sentence is represented as a list of tuples. Each tuple contains two elements: a sign (a string) and a translation (a string). Your task is to reorganize this data such that for each sentence, you return a tuple containing two lists...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reorganize_data([[('a', 'alpha'), ('b', 'beta')]]) == [(['a', 'b'], ['alpha', 'beta'])]\", \"assert reorganize_data([[('hello', 'world')], [('foo', 'bar'), ('baz', 'qux')]]) == [(['hello'], ['world']), (['foo', 'baz'], ['bar', 'qux'])]\", \"assert reorganize...
{ "split": "train", "index": 1577, "acecode_id": "bigcode_python_fns_27471", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a social media following system. The function should take in two arguments: a list of users that a specific user is currently following, and a username of a user to follow. The function should return an updated list of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_following_list(['user1', 'user2', 'user3'], 'user4') == ['user1', 'user2', 'user3', 'user4']\", \"assert update_following_list(['user1', 'user2', 'user3'], 'user2') == ['user1', 'user2', 'user3']\", \"assert update_following_list([], 'user5') == ['use...
{ "split": "train", "index": 1578, "acecode_id": "oss_15403", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a tensor represented as a list of lists (2D list) and an integer axis, write a function 'unsqueeze_tensor' that inserts a single-dimensional entry at the specified axis into the shape of the input tensor. The input tensor can contain any numerical values (integers or floa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unsqueeze_tensor([[1, 2], [3, 4]], 0) == [[[1, 2], [3, 4]]]\", \"assert unsqueeze_tensor([[1, 2]], 0) == [[[1, 2]]]\", \"assert unsqueeze_tensor([[1, 2]], 1) == [[1], [2]]\", \"assert unsqueeze_tensor([[1], [2]], 0) == [[[1], [2]]]\", \"assert unsqueeze_tens...
{ "split": "train", "index": 1579, "acecode_id": "bigcode_python_fns_41915", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of strings called `all_names` which represents the names of various classes and functions defined in a module. You also have a string `cls_name` representing the name of a class. Your task is to implement a function called `check_class_exists` that checks w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_class_exists(['ClassA', 'ClassB', 'FunctionC'], 'ClassA') == True\", \"assert check_class_exists(['ClassA', 'ClassB', 'FunctionC'], 'ClassC') == False\", \"assert check_class_exists(['Alpha', 'Beta', 'Gamma'], 'Beta') == True\", \"assert check_class_ex...
{ "split": "train", "index": 1580, "acecode_id": "bigcode_python_fns_1137", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a request body represented as a dictionary that may contain two optional keys: 'page_token' (a string) and 'page_size' (an integer). Your task is to implement a function `process_request(req_body)` that processes this request. If 'page_token' is not provided, it s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_request({'page_token': '5', 'page_size': 20}) == {'page_token': '5', 'page_size': 20}\", \"assert process_request({'page_token': '1'}) == {'page_token': '1', 'page_size': 100}\", \"assert process_request({'page_size': 50}) == {'page_token': '0', 'pag...
{ "split": "train", "index": 1581, "acecode_id": "bigcode_python_fns_32725", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating the basic functionalities of an inventory management system for a role-playing game character named Takeda Shingen. Implement a function `manage_inventory(operations)` where `operations` is a list of tuples containing a command and its associated ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_inventory([('add_item', 'Potion', 5), ('check_item', 'Potion')]) == [5]\", \"assert manage_inventory([('add_item', 'Elixir', 3), ('check_item', 'Elixir')]) == [3]\", \"assert manage_inventory([('add_item', 'Potion', 5), ('remove_item', 'Potion', 3), (...
{ "split": "train", "index": 1582, "acecode_id": "oss_14651", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the creation of an anonymous client for accessing resources. The function should return a dictionary that represents an anonymous client configuration. The client should have the following properties: 'service' set to 's3',...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_anonymous_client() == {'service': 's3', 'access_level': 'anonymous', 'signature_version': 'unsigned'}\", \"assert create_anonymous_client()['service'] == 's3'\", \"assert create_anonymous_client()['access_level'] == 'anonymous'\", \"assert create_anon...
{ "split": "train", "index": 1583, "acecode_id": "bigcode_python_fns_28599", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D list of integers representing the brightness values of an image, convert the brightness values into a corresponding ASCII representation based on a predefined mapping of brightness levels. Each brightness value will be an integer ranging from 0 to 255. The mapping is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_brightness_to_ascii([[255]]) == [['@']]\", \"assert convert_brightness_to_ascii([[0]]) == [['`']]\", \"assert convert_brightness_to_ascii([[255, 255], [255, 255]]) == [['@', '@'], ['@', '@']]\", \"assert convert_brightness_to_ascii([[1]]) == [['`']]\...
{ "split": "train", "index": 1584, "acecode_id": "bigcode_python_fns_87", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_area(radius: float) -> float` that calculates the area of a circle given its radius. The area of a circle can be calculated using the formula `area = π * radius^2`. The function should return the area as a float. Note that the radius will be a no...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_area(0) == 0.0\", \"assert calculate_area(1) == math.pi\", \"assert calculate_area(2) == 4 * math.pi\", \"assert calculate_area(3) == 9 * math.pi\", \"assert calculate_area(4.5) == 20.25 * math.pi\", \"assert calculate_area(5.5) == 30.25 * math.pi\...
{ "split": "train", "index": 1585, "acecode_id": "evol_19523", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that verifies if a given string starts with a special character (not alphanumeric or whitespace), followed by exactly 3 lowercase letters, then optionally contains any number of uppercase letters, and ends with at least 2 but not more than 4 digits. The functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert verify_string('@abc12') == True\", \"assert verify_string('#xyzAB34') == True\", \"assert verify_string('&ghi') == False\", \"assert verify_string('*jkl123') == True\", \"assert verify_string('!mnoPQR99') == True\", \"assert verify_string('~pqr4567') == True...
{ "split": "train", "index": 1586, "acecode_id": "evol_2170", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that generates a sequence of messages in the format 'hello {number}\\n' where {number} starts from 1 and increments by 1 with each message. The function should take an integer n as input and return a list of the first n messages. If n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_messages(0) == []\", \"assert generate_messages(1) == ['hello 1\\\\n']\", \"assert generate_messages(2) == ['hello 1\\\\n', 'hello 2\\\\n']\", \"assert generate_messages(3) == ['hello 1\\\\n', 'hello 2\\\\n', 'hello 3\\\\n']\", \"assert generate_mes...
{ "split": "train", "index": 1587, "acecode_id": "oss_27736", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `list_files(directory: str) -> List[str]` that simulates the behavior of the UNIX command `ls`. The function should return a list of filenames in the specified directory. If the directory does not exist, return an empty list. Do not use any external librari...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert list_files('/') == ['bin', 'etc', 'usr']\", \"assert list_files('/home') == ['user1', 'user2']\", \"assert list_files('/nonexistent') == []\", \"assert list_files('/') == ['bin', 'etc', 'usr']\", \"assert list_files('/etc/passwd') == []\", \"assert list_file...
{ "split": "train", "index": 1588, "acecode_id": "evol_23072", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a string that may contain parentheses and other non-parenthesis characters, determine if the parentheses in the string are properly balanced. A string is considered properly balanced if every opening parenthesis has a corresponding closing parenthesis and they are correct...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_balanced('()') == True\", \"assert is_balanced('(())') == True\", \"assert is_balanced('(()())') == True\", \"assert is_balanced('(()') == False\", \"assert is_balanced('())') == False\", \"assert is_balanced('abc') == True\", \"assert is_balanced('((a)b)...
{ "split": "train", "index": 1589, "acecode_id": "bigcode_python_fns_43893", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the backup IDs of a series of backups and an integer representing a specific backup ID, your task is to find and return a dictionary containing the following information: \n- 'backup_id': the provided backup ID if found, otherwise None \n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_backup_info([1, 2, 3, 4, 5], 3) == {'backup_id': 3, 'prev_backup_id': 2, 'next_backup_id': 4}\", \"assert find_backup_info([10, 20, 30, 40], 10) == {'backup_id': 10, 'prev_backup_id': None, 'next_backup_id': 20}\", \"assert find_backup_info([5, 15, 25],...
{ "split": "train", "index": 1590, "acecode_id": "bigcode_python_fns_11026", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `generate_first_n_primes(n: int) -> List[int]` that returns a list of the first n prime numbers. The function should take an integer n (1 <= n <= 1000) as input and return a list containing the first n prime numbers in increasing order.\nPlease reason step ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_first_n_primes(1) == [2]\", \"assert generate_first_n_primes(2) == [2, 3]\", \"assert generate_first_n_primes(3) == [2, 3, 5]\", \"assert generate_first_n_primes(4) == [2, 3, 5, 7]\", \"assert generate_first_n_primes(5) == [2, 3, 5, 7, 11]\", \"asse...
{ "split": "train", "index": 1591, "acecode_id": "evol_10516", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Write a function that takes a list of strings (names) as input and returns a list of tuples, where each tuple contains a unique name (ignoring case), its length, and its frequency in the original list. The output should be sorted in descending order based on the names' lengths,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert analyze_names(['John', 'Alice', 'Paul', 'John', 'john', 'ALICE']) == [('Alice', 5, 2), ('John', 4, 3), ('Paul', 4, 1)]\", \"assert analyze_names(['a', 'A', 'b', 'B', 'c', 'C']) == [('A', 1, 2), ('B', 1, 2), ('C', 1, 2)]\", \"assert analyze_names(['Zoe', 'zoe...
{ "split": "train", "index": 1592, "acecode_id": "evol_16182", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a list of pixels represented as tuples of three integers (r, g, b), where r, g, and b are the red, green, and blue color components of a pixel, respectively. Your task is to implement a function `get_best_pixel` that takes this list as input and returns the pixel ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_best_pixel([(10, 20, 30), (40, 50, 60), (70, 80, 90)]) == (70, 80, 90)\", \"assert get_best_pixel([(1, 2, 3), (4, 5, 6), (7, 8, 9)]) == (7, 8, 9)\", \"assert get_best_pixel([(0, 0, 0), (0, 0, 0), (0, 0, 0)]) == (0, 0, 0)\", \"assert get_best_pixel([(255,...
{ "split": "train", "index": 1593, "acecode_id": "oss_32153", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function named 'count_letters' that takes a string as an input and returns the total number of characters in that string. The function should handle all types of characters including letters, digits, punctuation, and whitespace.\nPlease reason step by step, then wri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_letters('hello') == 5\", \"assert count_letters('') == 0\", \"assert count_letters('12345') == 5\", \"assert count_letters('Hello, World!') == 13\", \"assert count_letters('Python 3.8') == 10\", \"assert count_letters('A B C') == 5\", \"assert count_le...
{ "split": "train", "index": 1594, "acecode_id": "evol_12314", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with filtering weather forecast data based on specific criteria. Write a function that filters a list of weather forecast records, given a target city, a target provider, and a specific date. Each forecast record is represented as a dictionary with the following ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_forecasts('New York', 'WeatherAPI', '2022-07-15', [{'city': 'New York', 'provider': 'WeatherAPI', 'date': '2022-07-15', 'temperature': 85}, {'city': 'Los Angeles', 'provider': 'WeatherAPI', 'date': '2022-07-15', 'temperature': 75}, {'city': 'New York'...
{ "split": "train", "index": 1595, "acecode_id": "bigcode_python_fns_27786", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, write a function `find_min_and_max(arr)` that returns a tuple containing the minimum and maximum values in the array. The function should take one parameter, `arr`, which is a list of integers. If the array is empty, return (None, None).\nPlease reas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_min_and_max([12, 1234, 45, 67, 1]) == (1, 1234)\", \"assert find_min_and_max([-5, -10, 0, 5]) == (-10, 5)\", \"assert find_min_and_max([100, 200, 300]) == (100, 300)\", \"assert find_min_and_max([0]) == (0, 0)\", \"assert find_min_and_max([1, 2, 3, 4, 5...
{ "split": "train", "index": 1596, "acecode_id": "evol_26143", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a Python function that filters and organizes information from two input tuples. The function should take two input tuples: `list_editable` containing field names and `ordering` containing ordering criteria. The function should return a dictionary with two ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_query_criteria(('description', '', 'name'), ('cls_id', '', 'date_created')) == {'editable_fields': ['description', 'name'], 'ordering_criteria': ['cls_id', 'date_created']}\", \"assert process_query_criteria(('', 'field1', 'field2'), ('order1', '', '...
{ "split": "train", "index": 1597, "acecode_id": "oss_34655", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two lists of integers, `offspring` and `population`, representing the fitness scores of offspring and a population of individuals respectively. You are also given an integer `lambda_` which specifies how many top candidates you want to retain based on their fitnes...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lambda_plus_mu_elimination([2, 3, 5], [1, 4, 6], 3) == [1, 2, 3]\", \"assert lambda_plus_mu_elimination([], [5, 10, 15], 2) == [5, 10]\", \"assert lambda_plus_mu_elimination([1, 2], [], 1) == [1]\", \"assert lambda_plus_mu_elimination([9, 8, 7], [6, 5], 3) =...
{ "split": "train", "index": 1598, "acecode_id": "bigcode_python_fns_37690", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of readers and a new reader, implement a function to determine if the new reader is already present in the list. If the new reader is not present, add them to the list and return the updated list of readers. The reader is represented as a dictionary with an 'id' ke...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_reader_if_not_present([{'id': 1}, {'id': 2}], {'id': 3}) == [{'id': 1}, {'id': 2}, {'id': 3}]\", \"assert add_reader_if_not_present([{'id': 1}], {'id': 1}) == [{'id': 1}]\", \"assert add_reader_if_not_present([], {'id': 5}) == [{'id': 5}]\", \"assert add...
{ "split": "train", "index": 1599, "acecode_id": "bigcode_python_fns_6844", "num_tests": 16 }