data_source
large_stringclasses
1 value
prompt
listlengths
1
1
ability
large_stringclasses
1 value
reward_model
dict
extra_info
dict
acecode
[ { "role": "user", "content": "You are given a dictionary representing a component with parameters. The dictionary may contain a key called 'disabled', which is itself a dictionary that has a boolean value under the key 'val'. Your task is to implement a function `check_component_status(component: dict) -> b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_component_status({'params': {'name': 'Component A'}}) == True\", \"assert check_component_status({'params': {'name': 'Component B', 'disabled': {'val': False}}}) == True\", \"assert check_component_status({'params': {'name': 'Component E', 'disabled': ...
{ "split": "train", "index": 69700, "acecode_id": "bigcode_python_fns_9323", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function that inserts an element at a specific position in a 2D list. The function should handle exceptions for invalid insert positions and maintain the original data structure's dimensions after insertion. If the insert position is invalid, return the original 2D ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert insert_in_2d_list([[1, 2], [3, 4]], 5, -1, 0) == [[1, 2], [3, 4]]\", \"assert insert_in_2d_list([[1, 2], [3, 4]], 5, 2, 0) == [[1, 2], [3, 4]]\", \"assert insert_in_2d_list([], 5, 0, 0) == []\", \"assert insert_in_2d_list([[1, 2], [3, 4]], 5, 2, 2) == [[1, 2...
{ "split": "train", "index": 69701, "acecode_id": "evol_17003", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of floating-point numbers and returns the second largest number in the list. If there is no second largest number (for example, if all numbers are the same), return None.\nPlease reason step by step, then write a self-contained Python solu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert second_largest([14.1, 25.2, 120.6, 66.9, 5.3]) == 66.9\", \"assert second_largest([1.1, 2.2, 3.3, 4.4, 5.5]) == 4.4\", \"assert second_largest([5.5, 5.5, 5.5]) == None\", \"assert second_largest([-1.1, -2.2, -3.3, -4.4]) == -2.2\", \"assert second_largest([1...
{ "split": "train", "index": 69702, "acecode_id": "evol_21134", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing events in a gaming environment. Each event is represented by a dictionary containing an event type and associated data. Your goal is to implement a function `process_game_event(row_i: int, col_i: int, event_dict: Dict[str, Any]) -> str` that proce...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_game_event(0, 0, {'type': 'move'}) == 'Move event processed successfully'\", \"assert process_game_event(1, 1, {'type': 'attack'}) == 'Attack event processed successfully'\", \"assert process_game_event(2, 2, {'type': 'defend'}) == 'Defend event proc...
{ "split": "train", "index": 69703, "acecode_id": "oss_18136", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function to rotate a 2D list of items by n steps in a clockwise direction. The function should take a 2D list and an integer n as input and return the rotated 2D list. The rotation is to be done in such a way that the elements wrap around. For example, given the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rotate_2d_list([['apple', 'banana', 'cherry'], ['dates', 'elderberry', 'fig'], ['grape', 'honeydew', 'ice cream']], 1) == [['ice cream', 'apple', 'banana'], ['cherry', 'dates', 'elderberry'], ['fig', 'grape', 'honeydew']]\", \"assert rotate_2d_list([['apple'...
{ "split": "train", "index": 69704, "acecode_id": "evol_7086", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the colors of hats worn by four friends. Each friend can wear a hat of color 0, 1, or 2. The colors of the hats are represented as a list with four elements (e.g., [0, 1, 2, 1]). Your task is to determine the maximum number of frien...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_correct_guesses([0, 1, 2, 1]) == 2\", \"assert max_correct_guesses([0, 0, 0, 0]) == 4\", \"assert max_correct_guesses([0, 1, 2, 0]) == 2\", \"assert max_correct_guesses([1, 2, 1, 2]) == 2\", \"assert max_correct_guesses([1, 0, 0, 2]) == 2\", \"assert max...
{ "split": "train", "index": 69705, "acecode_id": "bigcode_python_fns_26126", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of strings and returns a list of the same strings without duplicates while maintaining the original order of appearance of the unique elements. You cannot use any built-in Python functions or libraries for handling duplicates.\nPlease reas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicates(['a', 'b', 'c', 'a', 'd']) == ['a', 'b', 'c', 'd']\", \"assert remove_duplicates(['apple', 'banana', 'apple', 'orange']) == ['apple', 'banana', 'orange']\", \"assert remove_duplicates(['x', 'y', 'x', 'z', 'y']) == ['x', 'y', 'z']\", \"asser...
{ "split": "train", "index": 69706, "acecode_id": "evol_31619", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a grid represented as a two-dimensional list, where each cell contains an integer value: 0 for an empty cell and 1 for an obstacle. You need to implement a function that finds the shortest path from a starting position to a goal position in the grid. The vehicle c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_shortest_path([[0, 0], [0, 1]], (0, 0), (1, 0)) == [(0, 0), (1, 0)]\", \"assert find_shortest_path([[0, 0, 0], [1, 1, 0], [0, 0, 0]], (0, 0), (2, 2)) == [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2)]\", \"assert find_shortest_path([[0, 1, 0], [0, 1, 0], [0, 0...
{ "split": "train", "index": 69707, "acecode_id": "oss_31504", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the behavior of a simple calculator which only performs subtraction. The function should take two integer inputs, `a` and `b`, and return the result of subtracting `b` from `a`. Implement a function named `subtract(a: int, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert subtract(10, 5) == 5\", \"assert subtract(5, 10) == -5\", \"assert subtract(0, 0) == 0\", \"assert subtract(-5, -5) == 0\", \"assert subtract(-5, 5) == -10\", \"assert subtract(5, -5) == 10\", \"assert subtract(100, 50) == 50\", \"assert subtract(50, 100) ==...
{ "split": "train", "index": 69708, "acecode_id": "oss_13221", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, compute the running mean of the list over a specified number of points. The running mean is defined as the average of the last 'nav' elements in the list. Your task is to implement a function that takes in a list of integers and an integer 'nav', and r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert running_mean([1, 2, 3, 4, 5], 3) == [2.0, 3.0, 4.0]\", \"assert running_mean([1, 2, 3, 4, 5], 5) == [3.0]\", \"assert running_mean([5, 10, 15], 2) == [7.5, 12.5]\", \"assert running_mean([1], 1) == [1.0]\", \"assert running_mean([], 1) == []\", \"assert runn...
{ "split": "train", "index": 69709, "acecode_id": "bigcode_python_fns_27734", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integer values, implement a function that generates the maximum positive whole number by concatenating the non-negative integers in the array. If there are no non-negative integers, return 0.\nPlease reason step by step, then write a self-contained Python solu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_positive_whole_number([3, -2, -1, 7, 12]) == 7312\", \"assert max_positive_whole_number([-1, -2, -3]) == 0\", \"assert max_positive_whole_number([0, 1, 2, 3]) == 3210\", \"assert max_positive_whole_number([-5, -3, -2, 0]) == 0\", \"assert max_positive_wh...
{ "split": "train", "index": 69710, "acecode_id": "evol_26324", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that parses a web scraping result related to torrent files and extracts specific details from it. The function should take a dictionary as input, which represents the web scraping result with the following keys: 'url' (string), 'ti...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_torrent_info({'url': 'torrent/123', 'title': 'Sample Torrent', 'content': 'This is a test torrent.', 'files_data': ['700', 'MB'], 'magnetlink': 'magnet:?xt=urn:btih:12345'}) == {'url': 'torrent/123', 'title': 'Sample Torrent', 'content': 'This is a tes...
{ "split": "train", "index": 69711, "acecode_id": "oss_3408", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `issym(b3)` that determines if the list has an equal number of positive and negative values. Note that zeros are considered to belong to both categories. The function should return `True` if the counts are equal, and `False` otherwise....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert issym([1, -1, 0]) == True\", \"assert issym([1, 2, 0, -1]) == False\", \"assert issym([0, 0, 0]) == True\", \"assert issym([-1, -2, 1, 2]) == True\", \"assert issym([-3, 3, -1, 1, 0]) == True\", \"assert issym([5, 5, -5, -5]) == True\", \"assert issym([-10, ...
{ "split": "train", "index": 69712, "acecode_id": "bigcode_python_fns_10674", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that takes a list of dictionaries, where each dictionary represents a mapped apartment with various attributes (like 'id', 'name', 'location', and 'price'). Your function should serialize these dictionaries into a list of JSON stri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert serialize_apartments([{'id': 1, 'name': 'Apartment A', 'location': 'New York', 'price': 2500.0}]) == ['{\\\"id\\\": 1, \\\"name\\\": \\\"Apartment A\\\", \\\"location\\\": \\\"New York\\\", \\\"price\\\": 2500.0}']\", \"assert serialize_apartments([{'id': 1,...
{ "split": "train", "index": 69713, "acecode_id": "oss_31130", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that finds the character with the maximum consecutive repeating sequences in a given string and counts the number of such maximum repeating sequences. The function should return a tuple containing the character(s) with the maximum repetitions, the count of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_repeating('aaabbb') == (['a', 'b'], 3, 2)\", \"assert max_repeating('aabbccdd') == (['a', 'b', 'c', 'd'], 2, 4)\", \"assert max_repeating('abc') == (['a', 'b', 'c'], 1, 3)\", \"assert max_repeating('') == ([], 0, 0)\", \"assert max_repeating('a') == (['a...
{ "split": "train", "index": 69714, "acecode_id": "evol_13758", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of property objects, each with a name and a value. Each property object has the ability to return its name and value, and can also return a list of attributes. Your task is to implement a function `get_property_values` that takes a list of property objects ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_property_values([], as_strings=False, inc_attributes=False) == {}\", \"assert get_property_values([Property('color', 'blue')], as_strings=False, inc_attributes=False) == {'color': 'blue'}\", \"assert get_property_values([Property('color', 'blue')], as_st...
{ "split": "train", "index": 69715, "acecode_id": "bigcode_python_fns_23328", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a list that may contain integers and non-integer values (like strings or floats). Write a function `remove_non_integers(data)` that removes all non-integer values from the list and returns the updated list containing only integers. The input list can contain any m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_non_integers([1, 2, 3, 4, 'a', 'b']) == [1, 2, 3, 4]\", \"assert remove_non_integers([1, 'a', 2.5, 3, 4, 'b']) == [1, 3, 4]\", \"assert remove_non_integers(['x', 'y', 'z']) == []\", \"assert remove_non_integers([10, 20, 30]) == [10, 20, 30]\", \"asser...
{ "split": "train", "index": 69716, "acecode_id": "evol_8768", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes two dictionaries as input and returns a new dictionary containing only the keys that are present in both dictionaries. The value for each common key should be a tuple containing the corresponding values from both dictionaries.\nPlease reason step...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_dictionaries({'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'b': 4, 'd': 6, 'f': 8, 'g': 10}) == {'b': (2, 4), 'd': (4, 6)}\", \"assert merge_dictionaries({'x': 10, 'y': 20}, {'y': 30, 'z': 40}) == {'y': (20, 30)}\", \"assert merge_dictionaries({'k': 5, 'm': 15}, ...
{ "split": "train", "index": 69717, "acecode_id": "evol_19041", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string containing alphanumeric characters, implement a function that utilizes the quick sort algorithm to sort the characters in the string in alphabetical order. The function should be case-sensitive, meaning that uppercase letters should come before lowercase letters....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_string('edbca') == 'abcde'\", \"assert sort_string('123abc') == '123abc'\", \"assert sort_string('abc123') == '123abc'\", \"assert sort_string('A1B2C3') == '123ABC'\", \"assert sort_string('!@#abc') == '!#@abc'\", \"assert sort_string('') == ''\", \"ass...
{ "split": "train", "index": 69718, "acecode_id": "evol_70", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given an array of integers `arr` of length `n` and an integer `k`. Your task is to find the number of pairs of indices `(i, j)` where `i < j` and `arr[i] + arr[j] >= k`. Write a function `countPairs` that takes in the array `arr` and the integer `k` as input and returns...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert countPairs([1, 1, 1, 1], 2) == 6\", \"assert countPairs([10, 20, 30], 25) == 3\", \"assert countPairs([5, 5, 5, 5], 10) == 6\", \"assert countPairs([0, 0, 0], 1) == 0\", \"assert countPairs([10, 20, 30, 40], 50) == 4\", \"assert countPairs([1, 2, 3], 8) == 0...
{ "split": "train", "index": 69719, "acecode_id": "oss_19085", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Write a function `anagram_and_count(first_word: str, second_word: str, third_word: str, sentence: str) -> Tuple[str, Dict[str, int]]` that takes three words and a sentence as input. The function should first check if the three words are anagrams of each other. Then, it should c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert anagram_and_count('listen', 'silent', 'enlist', 'Listen to the silent night.') == ('Anagram words', {'listen': 1, 'silent': 1, 'enlist': 0})\", \"assert anagram_and_count('hello', 'world', 'delloh', 'Hello world') == ('Non-anagram words', {'hello': 1, 'world...
{ "split": "train", "index": 69720, "acecode_id": "evol_35988", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a sequential list of banking interactions (credits and debits) on an initially zero-balance account and a deposit amount to be received. Your task is to identify whether the account balance becomes non-zero and matches the deposit value at least once during the se...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert on_receiving_deposit([1, 2, 3], 6) == True\", \"assert on_receiving_deposit([1, 2, -4, 5], 4) == True\", \"assert on_receiving_deposit([-1, -1, 2, 1], 1) == True\", \"assert on_receiving_deposit([0, 0, 0], 1) == False\", \"assert on_receiving_deposit([2, 2, ...
{ "split": "train", "index": 69721, "acecode_id": "evol_30081", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that extracts specific metadata from a given string representing a setup file used for packaging a Python module. The metadata includes the module name, version, author, and author's email. Your function should parse the provided s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_metadata('setup(name = \\\"example_module\\\", version = \\\"0.1\\\", author = \\\"Alice\\\", author_email = \\\"alice@example.com\\\")') == {'name': 'example_module', 'version': '0.1', 'author': 'Alice', 'author_email': 'alice@example.com'}\", \"ass...
{ "split": "train", "index": 69722, "acecode_id": "oss_5376", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of 2D points represented as tuples (x, z). Your task is to transform these points into a 3D space by rotating them around the z-axis 'nrot' times. Each rotation is a 90-degree counterclockwise rotation. Specifically, the transformation for a point (x, z) af...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rotate_points([(1, 2)], 1) == [(-2, 1)]\", \"assert rotate_points([(1, 2)], 2) == [(-1, -2)]\", \"assert rotate_points([(1, 2)], 3) == [(2, -1)]\", \"assert rotate_points([(1, 2)], 4) == [(1, 2)]\", \"assert rotate_points([(0, 0)], 1) == [(0, 0)]\", \"assert...
{ "split": "train", "index": 69723, "acecode_id": "bigcode_python_fns_31319", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates user authentication. The function should take a boolean parameter `is_authenticated`. If `is_authenticated` is True, the function should return a dictionary with user information containing 'id', 'name', and 'email'. If `is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_user_info(True) == {'id': 1, 'name': 'John Doe', 'email': 'john.doe@example.com'}\", \"assert get_user_info(False) == {'error': 'User not authenticated'}\", \"assert get_user_info(False) == {'error': 'User not authenticated'}\", \"assert get_user_info(Fa...
{ "split": "train", "index": 69724, "acecode_id": "oss_27377", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `impute_missing_values(data: List[int], missing_value: int) -> List[int]` that replaces all occurrences of `missing_value` in the list with the average of the non-missing values. If there are no non-missing values, return the original ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert impute_missing_values([1, 2, 3, 4, 5], 0) == [1, 2, 3, 4, 5]\", \"assert impute_missing_values([-1, -1, -1, -1], -1) == [-1, -1, -1, -1]\", \"assert impute_missing_values([], -1) == []\", \"assert impute_missing_values([5, 10, -1, 20], -1) == [5, 10, 11.6666...
{ "split": "train", "index": 69725, "acecode_id": "bigcode_python_fns_37781", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function that takes the number of sides of a polygon and returns a string describing the polygon based on its number of sides. The function should return 'Triangle' for 3 sides, 'Square' for 4 sides, 'Pentagon' for 5 sides, and 'Polygon with N sides' for any other n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert describe_polygon(3) == 'Triangle'\", \"assert describe_polygon(4) == 'Square'\", \"assert describe_polygon(5) == 'Pentagon'\", \"assert describe_polygon(6) == 'Polygon with 6 sides'\", \"assert describe_polygon(7) == 'Polygon with 7 sides'\", \"assert descri...
{ "split": "train", "index": 69726, "acecode_id": "evol_2745", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that processes data in a specific format. The function should take a list of dictionaries, where each dictionary contains information about a student. Each dictionary has the keys: 'name' (a string), 'age' (an integer), and 'grades' (a lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_student_data([{'name': 'Alice', 'age': 20, 'grades': [85, 90, 92]}, {'name': 'Bob', 'age': 21, 'grades': [70, 75, 80]}]) == [{'name': 'Alice', 'average_grade': 89.0}, {'name': 'Bob', 'average_grade': 75.0}]\", \"assert process_student_data([{'name': ...
{ "split": "train", "index": 69727, "acecode_id": "bigcode_python_fns_16678", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that validates whether a given dictionary matches a specified pattern. The pattern is represented by another dictionary, where the keys represent the expected keys in the input dictionary, and the values represent the expected ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_pattern({'a': int, 'b': str}, {'a': 1, 'b': 'text'}) == True\", \"assert validate_pattern({'a': int, 'b': str}, {'a': 'not an int', 'b': 'text'}) == False\", \"assert validate_pattern({'x': list}, {'x': [1, 2, 3]}) == True\", \"assert validate_patte...
{ "split": "train", "index": 69728, "acecode_id": "oss_19793", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the Greatest Common Divisor (GCD) of two integers, a and b, using an efficient algorithm. You need to ensure that the function correctly handles all edge cases, including when the inputs are prime numbers and when one is a multiple of the ot...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert gcd(48, 18) == 6\", \"assert gcd(42, 56) == 14\", \"assert gcd(18, 24) == 6\", \"assert gcd(101, 103) == 1\", \"assert gcd(91, 35) == 7\", \"assert gcd(100, 25) == 25\", \"assert gcd(15, 10) == 5\", \"assert gcd(37, 60) == 1\", \"assert gcd(77, 14) == 7\", \...
{ "split": "train", "index": 69729, "acecode_id": "evol_1333", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates fetching attachment data from an API. The function `get_attachment_data(entry_id: str, attachment_id: str) -> bytes` takes in two parameters: `entry_id` and `attachment_id`, which are both strings representing unique id...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_attachment_data('12345', '67890') == b'example_attachment_data_1'\", \"assert get_attachment_data('54321', '09876') == b'example_attachment_data_2'\", \"assert get_attachment_data('00000', '11111') == b''\", \"assert get_attachment_data('12345', '11111')...
{ "split": "train", "index": 69730, "acecode_id": "oss_20361", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to extract routes from a list of strategies. Each strategy contains a `route` and a `target`. Your function should take a list of these strategies and return a list of all routes. If the list of strategies is empty, the function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_routes([]) == []\", \"assert find_routes([{ 'route': 'A -> B', 'target': 'B' }]) == ['A -> B']\", \"assert find_routes([{ 'route': 'A -> B', 'target': 'B' }, { 'route': 'C -> D', 'target': 'D' }]) == ['A -> B', 'C -> D']\", \"assert find_routes([{ 'rout...
{ "split": "train", "index": 69731, "acecode_id": "oss_27265", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of integers and returns the largest integer in the list along with its frequency of occurrence. The function should return a tuple containing the largest integer and the count of how many times it appears in the list.\nPlease reason step b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_largest_element_and_frequency([10, 100, 200, 500, 400, 500, 500]) == (500, 3)\", \"assert find_largest_element_and_frequency([1, 2, 3, 4, 5]) == (5, 1)\", \"assert find_largest_element_and_frequency([-1, -2, -3, -4]) == (-1, 1)\", \"assert find_largest_...
{ "split": "train", "index": 69732, "acecode_id": "evol_136", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of interactions between residues, where each interaction is represented as a tuple containing a pair of residues, their Q values, and an annihilation flag. Write a function `calculate_pKa(interactions: List[Tuple[Tuple[str, str], Tuple[float, float], bool]]...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_pKa([(('A', 'B'), (0.0, 0.0), False)]) == [0.0, 0.0]\", \"assert calculate_pKa([]) == []\", \"assert calculate_pKa([(('A', 'B'), (0.0, 0.0), False), (('B', 'C'), (0.0, 0.0), True)]) == [0.0, 0.0, 0.0]\", \"assert calculate_pKa([(('A', 'B'), (0.005,...
{ "split": "train", "index": 69733, "acecode_id": "bigcode_python_fns_2192", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a string representing a tag name in XML Clark notation. The notation includes a namespace and a tag, formatted as '{namespace}tag'. Your task is to convert the XML Clark notation into a human-readable form by replacing the namespace with its corresponding human-re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_clark_tag('{http://www.w3.org/1999/xhtml}div') == 'html:div'\", \"assert convert_clark_tag('{http://www.w3.org/2000/svg}circle') == 'svg:circle'\", \"assert convert_clark_tag('{http://www.w3.org/1999/xhtml}span') == 'html:span'\", \"assert convert_cl...
{ "split": "train", "index": 69734, "acecode_id": "bigcode_python_fns_2917", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the number of subscribers to different collections over a period of time. Your task is to implement a function that calculates the total number of weekly subscribers and the total number of monthly subscribers for all collections. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_subscribers([(1, 0, 1), (2, 1, 1), (3, 2, 1)]) == (3, 3)\", \"assert calculate_subscribers([(1, 1, 100), (2, 2, 150), (3, 3, 200)]) == (450, 450)\", \"assert calculate_subscribers([(1, 0, 0), (2, 0, 0), (3, 0, 0)]) == (0, 0)\", \"assert calculate_s...
{ "split": "train", "index": 69735, "acecode_id": "bigcode_python_fns_45330", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a list of strings, implement a function that extracts and returns all words that consist solely of vowels (a, e, i, o, u). The function should take a single parameter, a list of strings, and return a list of words that meet the criteria.\nPlease reason step by step, then ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_vowel_words(['a', 'e', 'i', 'o', 'u']) == ['a', 'e', 'i', 'o', 'u']\", \"assert extract_vowel_words(['aeiou', 'iou', 'aei', 'uoiea']) == ['aeiou', 'iou', 'aei', 'uoiea']\", \"assert extract_vowel_words(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']) =...
{ "split": "train", "index": 69736, "acecode_id": "evol_28171", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the progress of a file download. The function should take three integer parameters: 'count' (the number of blocks downloaded), 'blockSize' (the size of each block in bytes), and 'totalSize' (the total size of the file in by...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert download_progress(0, 20, 1000) == '0%'\", \"assert download_progress(1, 20, 1000) == '2%'\", \"assert download_progress(5, 20, 1000) == '10%'\", \"assert download_progress(10, 20, 1000) == '20%'\", \"assert download_progress(25, 20, 1000) == '50%'\", \"asser...
{ "split": "train", "index": 69737, "acecode_id": "evol_2831", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, compute the maximum product of three distinct integers in the array. If there is no such product that is a prime number, return -1. The function should only consider products of distinct integers. Write a function `maxDistinctPrimeProduct(arr: List[i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxDistinctPrimeProduct([0, -1, -2, -3]) == -1\", \"assert maxDistinctPrimeProduct([5, 5, 5]) == -1\", \"assert maxDistinctPrimeProduct([-10, -10, 5, 6]) == -1\", \"assert maxDistinctPrimeProduct([0]) == -1\", \"assert maxDistinctPrimeProduct([-1, -1, -1, -1...
{ "split": "train", "index": 69738, "acecode_id": "evol_5525", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a system for counting updates to different containers based on their labels. The function `count_updates(labels: List[str]) -> Dict[str, int]` should take a list of strings, where each string represents a label of a contain...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_updates(['A', 'B', 'A']) == {'A': 2, 'B': 1}\", \"assert count_updates(['C', 'C', 'D', 'E', 'C']) == {'C': 3, 'D': 1, 'E': 1}\", \"assert count_updates(['X', 'Y', 'X', 'Z', 'Y', 'X']) == {'X': 3, 'Y': 2, 'Z': 1}\", \"assert count_updates(['A', 'A', 'A'...
{ "split": "train", "index": 69739, "acecode_id": "bigcode_python_fns_40789", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, write a function that returns a sorted list of all distinct factors of n. A factor of n is defined as a positive integer that divides n without leaving a remainder. Implement the function `find_factors(n)` which takes an integer n as input and return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_factors(1) == [1]\", \"assert find_factors(2) == [1, 2]\", \"assert find_factors(3) == [1, 3]\", \"assert find_factors(4) == [1, 2, 4]\", \"assert find_factors(5) == [1, 5]\", \"assert find_factors(6) == [1, 2, 3, 6]\", \"assert find_factors(7) == [1, 7...
{ "split": "train", "index": 69740, "acecode_id": "evol_1965", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes a sequence of random numbers and runs various statistical tests on them. The function takes two arguments: a list of integers representing the random number series and a boolean flag indicating whether to include binary...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert run([1, 1, 2, 2, 3], False) == {'mean': 1.8, 'median': 2, 'mode': 1, 'range': 2}\", \"assert run([], False) == {}\", \"assert run([2, 2, 2, 2], False) == {'mean': 2.0, 'median': 2, 'mode': 2, 'range': 0}\", \"assert run([1], False) == {'mean': 1.0, 'median':...
{ "split": "train", "index": 69741, "acecode_id": "bigcode_python_fns_49243", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given two lists of equal length: xdata and ydata, where xdata represents the x-coordinates and ydata represents the y-coordinates of points to be plotted on a 2D plane. Your task is to implement a function that generates a list of tuples, where each tuple contains the x...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_plot_points([1, 2, 3], [4, 5, 6], '-o') == [(1, 4), (2, 5), (3, 6)]\", \"assert generate_plot_points([0, 1, 2], [2, 3, 4]) == [(0, 2), (1, 3), (2, 4)]\", \"assert generate_plot_points([-1, 0, 1], [0, 1, 2], '--') == [(-1, 0), (0, 1), (1, 2)]\", \"as...
{ "split": "train", "index": 69742, "acecode_id": "bigcode_python_fns_3294", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates the title of a webpage for student admissions and a notice board for Pt D D U S V M Inter College. Implement a function `get_page_title(page_type: str) -> str` that returns the title of the specified page. The function shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_page_title('admission_enquiry') == 'Admission Enquiry | Pt D D U S V M Inter College'\", \"assert get_page_title('notice_board') == 'Notice Board | Pt D D U S V M Inter College'\", \"assert get_page_title('invalid_page') == 'Invalid Page Type'\", \"asser...
{ "split": "train", "index": 69743, "acecode_id": "oss_30761", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates fetching data from a consumer application given the host and port. The `get_consumer` function takes the host and port as arguments, and it returns an object that has a method `fetch_data` which simulates retrieving data. Y...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fetch_data_from_consumer('127.0.0.1', 9000) == 'Data from 127.0.0.1:9000'\", \"assert fetch_data_from_consumer('example.com', 8080) == 'Data from example.com:8080'\", \"assert fetch_data_from_consumer('localhost', 3000) == 'Data from localhost:3000'\", \"ass...
{ "split": "train", "index": 69744, "acecode_id": "oss_21754", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given an adjacency matrix representing a directed graph, where each element of the matrix is either 0 or 1. Your task is to implement a function `add_col(adjMatrix: List[List[int]]) -> int` that adds a new column to the end of the adjacency matrix and returns the index ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_col([[0, 1], [1, 0]]) == 2\", \"assert add_col([[0]]) == 1\", \"assert add_col([[0, 0], [0, 0]]) == 2\", \"assert add_col([[0, 0, 1], [1, 0, 0], [0, 1, 1]]) == 3\", \"assert add_col([[0, 1, 0], [0, 1, 0], [0, 1, 0]]) == 3\"]}" }
{ "split": "train", "index": 69745, "acecode_id": "bigcode_python_fns_48423", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with simulating player actions in a game called \"Among Us\". Create a function called \"handle_player_action\" that simulates a player's action in the game based on the following parameters: \n1. player_id (int): The unique identifier of the player performing th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_player_action(1, 'move', {'target_location': 'cafeteria'}) == {'player_positions': {1: 'cafeteria'}, 'incidents': []}\", \"assert handle_player_action(2, 'move', {'target_location': 'medbay'}) == {'player_positions': {2: 'medbay'}, 'incidents': []}\",...
{ "split": "train", "index": 69746, "acecode_id": "oss_5391", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function `get_prime_fibonacci(p: int) -> List[int]` that returns a list of prime numbers found in the Fibonacci series up to the p-th term. The value of p will be a positive integer and should not exceed 20.\nPlease reason step by step, then write a self-contained P...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_prime_fibonacci(1) == []\", \"assert get_prime_fibonacci(2) == []\", \"assert get_prime_fibonacci(4) == [2]\", \"assert get_prime_fibonacci(5) == [2, 3]\", \"assert get_prime_fibonacci(6) == [2, 3, 5]\", \"assert get_prime_fibonacci(7) == [2, 3, 5]\", \"...
{ "split": "train", "index": 69747, "acecode_id": "evol_3290", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given an array `points`, an integer `angle`, and your `location`, where `location = [posx, posy]` and `points[i] = [xi, yi]` both denote integral coordinates on the X-Y plane. Additionally, you are given an array `obstacles` where `obstacles[i] = [oxi, oyi]` denotes the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_visible_points([[2,1],[2,2],[3,3]], [[2,1]], 90, [1,1]) == 2\", \"assert max_visible_points([[2,1],[2,2],[3,4],[1,1]], [[2,2]], 90, [1,1]) == 3\", \"assert max_visible_points([[1,0],[2,1]], [], 13, [1,1]) == 1\", \"assert max_visible_points([[0,1],[1,0],...
{ "split": "train", "index": 69748, "acecode_id": "evol_32254", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with extracting a quality score from a given string that contains a specific format. The score is represented in the format: 'Your code has been rated at X/Y', where X is the quality score and Y is the maximum possible score. Your function should take an input st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_score('Your code has been rated at 8.5/10') == 8.5\", \"assert get_score('Your code has been rated at 9.0/10') == 9.0\", \"assert get_score('Your code has been rated at 0.0/10') == 0.0\", \"assert get_score('Your code has been rated at 10.0/10') == 10.0\...
{ "split": "train", "index": 69749, "acecode_id": "bigcode_python_fns_7171", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a custom tabbed widget in a PyQt application. Your goal is to implement a simple tabbed interface that allows users to dynamically add and remove tabs. Specifically, you need to implement the following functionalities in a single function `manage_ta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_tabs(['Tab1', 'Tab2'], [('add', 'Tab3'), ('remove', 0)]) == ['Tab2', 'Tab3']\", \"assert manage_tabs(['Tab1'], [('add', 'Tab2'), ('add', 'Tab3'), ('remove', 1)]) == ['Tab1', 'Tab3']\", \"assert manage_tabs([], [('add', 'Tab1')]) == ['Tab1']\", \"asser...
{ "split": "train", "index": 69750, "acecode_id": "oss_18507", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function called `adaptive_quicksort` that sorts a list of integers or dictionaries based on a specified key while maintaining the stability of the sort. The function should choose the pivot using the median-of-three method, selecting the first, middle, and last elem...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert adaptive_quicksort([]) == []\", \"assert adaptive_quicksort([5, 5, 5]) == [5, 5, 5]\", \"assert adaptive_quicksort([{'name': 'Alice'}, {'name': 'Bob'}, {'name': 'Charlie'}], key=lambda x: x['name']) == [{'name': 'Alice'}, {'name': 'Bob'}, {'name': 'Charlie'}...
{ "split": "train", "index": 69751, "acecode_id": "evol_6620", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a non-negative integer n, write a function `fibonacci_memoized` that returns the n-th Fibonacci number using memoization. The Fibonacci sequence is defined as follows: the first two numbers are 0 and 1, and each subsequent number is the sum of the two preceding ones. Your...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci_memoized(0) == 0\", \"assert fibonacci_memoized(1) == 1\", \"assert fibonacci_memoized(2) == 1\", \"assert fibonacci_memoized(3) == 2\", \"assert fibonacci_memoized(4) == 3\", \"assert fibonacci_memoized(5) == 5\", \"assert fibonacci_memoized(6) ==...
{ "split": "train", "index": 69752, "acecode_id": "oss_23621", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a recursive function in Python to calculate the least common multiple (LCM) of three integers without using any predefined Python functions like gcd() or math.gcd(). The function should be named `lcm_of_three(a: int, b: int, c: int) -> int` and return the LCM of the three...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lcm_of_three(3, 5, 7) == 105\", \"assert lcm_of_three(4, 6, 8) == 24\", \"assert lcm_of_three(1, 2, 3) == 6\", \"assert lcm_of_three(10, 15, 20) == 60\", \"assert lcm_of_three(5, 10, 15) == 30\", \"assert lcm_of_three(9, 12, 15) == 180\", \"assert lcm_of_thr...
{ "split": "train", "index": 69753, "acecode_id": "evol_24346", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing weights of different modules in a neural network. Your task is to implement a function that initializes these weights. The initialization should follow these rules: if the weight is a positive integer, multiply it by a given scale f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert initialize_weights([1, 2, 3], 2) == [2, 4, 6]\", \"assert initialize_weights([0, -1, 5], 3) == [0, 0, 15]\", \"assert initialize_weights([-5, -10, -15], 1) == [0, 0, 0]\", \"assert initialize_weights([10, 0, 20], 5) == [50, 0, 100]\", \"assert initialize_wei...
{ "split": "train", "index": 69754, "acecode_id": "bigcode_python_fns_8504", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that calculates a person's age based on their date of birth. The function should take in three parameters: the year, month, and day of birth, and return the person's age as an integer. The current date is fixed at January 1, 2023. If the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_age(2000, 1, 1) == 23\", \"assert calculate_age(1995, 12, 31) == 27\", \"assert calculate_age(2023, 1, 1) == 0\", \"assert calculate_age(2022, 12, 31) == 0\", \"assert calculate_age(1990, 6, 15) == 32\", \"assert calculate_age(1985, 2, 10) == 37\",...
{ "split": "train", "index": 69755, "acecode_id": "oss_29516", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `execute_python_commands(commands: List[str]) -> List[str]` that takes a list of Python commands as input, executes each command, and returns a list of strings representing the datatype of each command's output. If a command is invalid, the function should retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert execute_python_commands([\\\"print('Hello World')\\\", \\\"5 + 3\\\", \\\"invalid syntax\\\"]) == ['None', 'int', 'Error']\", \"assert execute_python_commands([\\\"'Hello' + ' World'\\\", \\\"len('Hello')\\\", \\\"3 / 0\\\"]) == ['str', 'int', 'Error']\", \"...
{ "split": "train", "index": 69756, "acecode_id": "evol_30416", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `determine_winner(user_choice: int, computer_choice: int) -> str` that simulates the outcome of a game of rock, paper, scissors, lizard, Spock. The input `user_choice` and `computer_choice` are integers representing the player's choice: 1 for Rock, 2 for Pa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert determine_winner(1, 2) == 'Computer wins!'\", \"assert determine_winner(1, 3) == 'User wins!'\", \"assert determine_winner(1, 4) == 'User wins!'\", \"assert determine_winner(1, 5) == 'Computer wins!'\", \"assert determine_winner(2, 1) == 'User wins!'\", \"as...
{ "split": "train", "index": 69757, "acecode_id": "evol_16273", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of backpressure events, where each event contains a start timestamp and a pod identifier. Your task is to create a function that organizes these events into time windows of a specified width (in hours) and returns both the time windows along with the unique...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert build_windows_and_pods_from_events([('2023-10-01 12:00:00', 'pod1'), ('2023-10-01 12:30:00', 'pod2'), ('2023-10-01 13:15:00', 'pod1')], 1) == ([{'interval': '2023-10-01 12:00:00', 'events': [('2023-10-01 12:00:00', 'pod1'), ('2023-10-01 12:30:00', 'pod2')]},...
{ "split": "train", "index": 69758, "acecode_id": "bigcode_python_fns_28432", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Implement a function that checks if a given string is a valid IPv6 address. The function should return True if the string is a valid IPv6 address, and False otherwise. An IPv6 address is represented as eight groups of four hexadecimal digits, each group separated by a colon. An...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_ipv6_address('2001:0db8:85a3:0000:0000:8a2e:0370:7334') == True\", \"assert validate_ipv6_address('::1') == True\", \"assert validate_ipv6_address('2001:db8::1') == True\", \"assert validate_ipv6_address('fe80::1ff:fe23:4567:890a') == True\", \"asse...
{ "split": "train", "index": 69759, "acecode_id": "evol_14355", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given an integer nbytes which represents the new size of a task in bytes for a hypothetical parallel IO system. Your task is to implement a function `reset_task_size(nbytes: int) -> None` that will take this integer as an input and reset the default task size used for p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reset_task_size(256) is None\", \"assert reset_task_size(1024) is None\", \"assert reset_task_size(2048) is None\", \"assert reset_task_size(4096) is None\", \"assert reset_task_size(8192) is None\", \"assert reset_task_size(16384) is None\", \"assert reset_...
{ "split": "train", "index": 69760, "acecode_id": "bigcode_python_fns_5402", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that validates test case data based on specified criteria. The function `validate_test_case` will take in the following parameters: a `case_id` (string), a `method` (string), a `data` (dictionary), a `check_item` (dictionary), a `stat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_test_case('test1', 'methodA', {'key1': 'value1', 'key2': 'value2'}, {'key1': 'value1', 'key2': 'value2'}, 'Initial Status', {}, '') == ('Validation Passed', {'key1': 'value1', 'key2': 'value2'}, 'Success')\", \"assert validate_test_case('test2', 'me...
{ "split": "train", "index": 69761, "acecode_id": "oss_19555", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the identification of different operating system platforms. The function `get_host_platform()` should return the name of the platform based on a given input string representing the platform type. The function should acc...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_host_platform('darwin') == 'OSX'\", \"assert get_host_platform('win32') == 'Windows'\", \"assert get_host_platform('linux') == 'Linux'\", \"assert get_host_platform('unix') == 'Unknown Platform'\", \"assert get_host_platform('macOS') == 'Unknown Platform...
{ "split": "train", "index": 69762, "acecode_id": "oss_23579", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Develop a function that merges two strings together and sorts the combined string alphabetically. The output string should contain unique alphabetic characters only, with all characters converted to lowercase. Any numbers or special characters in the input strings should be rem...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_and_sort('Hello', 'World!') == 'dehlorw'\", \"assert merge_and_sort('abc', 'def') == 'abcdef'\", \"assert merge_and_sort('12345', 'abc') == 'abc'\", \"assert merge_and_sort('Hello123', 'World!') == 'dehlorw'\", \"assert merge_and_sort('1234', '5678') =...
{ "split": "train", "index": 69763, "acecode_id": "evol_9671", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that updates a global dictionary of format specifiers based on the provided input. The input will be a dictionary where the keys are data types (like `int`, `float`, etc.) and the values are the format specifiers (like `d`, `g`, etc.). Yo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_global_format_spec({int: 'd', float: 'g'}) == {'int': 'd', 'float': 'g'}\", \"assert set_global_format_spec({float: '#.2f'}) == {'int': 'd', 'float': 'g'}\", \"assert set_global_format_spec({int: 'x'}) == {'int': 'd', 'float': 'g'}\", \"assert set_global...
{ "split": "train", "index": 69764, "acecode_id": "bigcode_python_fns_2595", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two lists of integers, `target_ftrs` and `identity_ftrs`. Your task is to create a new list that contains the unique integers from both lists. The new list should include all integers from `target_ftrs`, and any integers from `identity_ftrs` that are not already p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert combine_unique_integers([1, 2, 3], [3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert combine_unique_integers([], [1, 2, 3]) == [1, 2, 3]\", \"assert combine_unique_integers([5, 7, 9], []) == [5, 7, 9]\", \"assert combine_unique_integers([10, 20, 30], [30, 40, 50]) =...
{ "split": "train", "index": 69765, "acecode_id": "bigcode_python_fns_19657", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function `reverse_string(s: str) -> str` that takes a string `s` as input and returns the string in reversed order. You cannot use any built-in functions or iterative techniques to perform the reversal. Instead, utilize recursion to achieve the desired output.\nPlease r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_string('Hello World') == 'dlroW olleH'\", \"assert reverse_string('Python') == 'nohtyP'\", \"assert reverse_string('12345') == '54321'\", \"assert reverse_string('a') == 'a'\", \"assert reverse_string('') == ''\", \"assert reverse_string('racecar') =...
{ "split": "train", "index": 69766, "acecode_id": "evol_8582", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of numeric cache entries, each represented as a dictionary containing 'collection', 'template', 'value', and 'last_modified', write a function `get_entries_by_hostname(entries: List[Dict[str, Any]], hostname: str) -> List[Dict[str, Any]]` that returns all entries c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_entries_by_hostname([{'collection': 'A', 'template': 'T1', 'value': 10, 'last_modified': '2023-01-01'}, {'collection': 'B', 'template': 'T2', 'value': 20, 'last_modified': '2023-01-02'}, {'collection': 'A', 'template': 'T3', 'value': 30, 'last_modified':...
{ "split": "train", "index": 69767, "acecode_id": "bigcode_python_fns_48576", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `get_facade(name: str, version: str) -> str` that retrieves the facade name from a simulated clients dictionary based on the specified version. The function should attempt to retrieve the facade from the client versions in descending ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_facade('facadeA', '3') == 'Facade A v2'\", \"assert get_facade('facadeB', '3') == 'Facade B v3'\", \"assert get_facade('facadeC', '2') == 'Facade C v2'\", \"assert get_facade('facadeD', '1') == 'Not Found'\", \"assert get_facade('facadeA', '1') == 'Facad...
{ "split": "train", "index": 69768, "acecode_id": "bigcode_python_fns_26396", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given three lists of strings, create a function that calculates the unique and overlapping elements among them. Specifically, you need to determine the number of unique elements in each list, the number of elements that are common to exactly two lists, and the number of element...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_elements(['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']) == (3, 3, 3, 0, 0)\", \"assert count_elements(['a', 'b', 'c'], [], []) == (3, 0, 0, 0, 0)\", \"assert count_elements(['foo', 'bar'], ['baz', 'qux'], ['quux', 'corge']) == (2, 2, 2, 0, 0)\", \"...
{ "split": "train", "index": 69769, "acecode_id": "bigcode_python_fns_16680", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a non-negative integer n, write a function `optimalFibonacci(n)` that returns the nth Fibonacci number. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n >= 2. Your implementation should be efficient in terms of both time a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert optimalFibonacci(0) == 0\", \"assert optimalFibonacci(1) == 1\", \"assert optimalFibonacci(2) == 1\", \"assert optimalFibonacci(3) == 2\", \"assert optimalFibonacci(4) == 3\", \"assert optimalFibonacci(5) == 5\", \"assert optimalFibonacci(6) == 8\", \"assert...
{ "split": "train", "index": 69770, "acecode_id": "evol_12811", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with developing a function that reads configuration settings for a machine learning training process from given parameters. The function should accept the following arguments: learning_rate (a float), batch_size (an integer), and num_epochs (an integer). The func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert read_training_config() == {'learning_rate': 0.001, 'batch_size': 32, 'num_epochs': 10}\", \"assert read_training_config(0.01) == {'learning_rate': 0.01, 'batch_size': 32, 'num_epochs': 10}\", \"assert read_training_config(0.001, 64) == {'learning_rate': 0.00...
{ "split": "train", "index": 69771, "acecode_id": "oss_4347", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the duration of a time phase given its start time and end time. Write a function named `calculate_duration` that takes two parameters: `start_time` and `end_time`, both of which are strings formatted as 'YYYY-MM-DD HH:MM:SS'. The function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_duration('2023-10-01 10:00:00', '2023-10-01 12:30:00') == 150\", \"assert calculate_duration('2023-10-01 10:00:00', '2023-10-01 10:00:00') == -1\", \"assert calculate_duration('2023-10-01 10:00:00', '2023-10-01 11:00:00') == 60\", \"assert calculat...
{ "split": "train", "index": 69772, "acecode_id": "oss_34530", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of edges representing a graph, determine if the graph is a tree. A tree is defined as a connected graph with no cycles. You will be given the number of edges and vertices, along with a list of edge pairs. Implement a function `is_tree(num_edges: int, num_vertices: ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_tree(3, 4, [(0, 1), (1, 2), (2, 3)]) == True\", \"assert is_tree(3, 3, [(0, 1), (1, 2), (2, 0)]) == False\", \"assert is_tree(4, 4, [(0, 1), (1, 2), (2, 3), (3, 0)]) == False\", \"assert is_tree(0, 1, []) == True\", \"assert is_tree(4, 5, [(0, 1), (0, 2),...
{ "split": "train", "index": 69773, "acecode_id": "bigcode_python_fns_28145", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates an object being dropped in a grid environment. The function should take in a grid represented as a 2D list, the current position of an agent, the object to be dropped, and the drop location. The grid is represented by a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert drop_object([['', '', ''], ['', '', ''], ['', '', '']], (0, 0), 'Ball', (1, 1)) == 'Drop Successful'\", \"assert drop_object([['', '', ''], ['', 'Box', ''], ['', '', '']], (0, 0), 'Ball', (1, 1)) == 'Invalid Drop Location'\", \"assert drop_object([['', '', '...
{ "split": "train", "index": 69774, "acecode_id": "bigcode_python_fns_41039", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Write a function `generate_random_number` that generates a random float number between 1 (inclusive) and 2 (exclusive). You should use the built-in `random` module to achieve this. The function should not take any parameters and should return the generated random number.\nPleas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert 1 <= generate_random_number() < 2\", \"assert 1 <= generate_random_number() < 2\", \"assert 1 <= generate_random_number() < 2\", \"assert 1 <= generate_random_number() < 2\", \"assert 1 <= generate_random_number() < 2\", \"assert 1 <= generate_random_number(...
{ "split": "train", "index": 69775, "acecode_id": "evol_15544", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with generating a notification header for a given object. Each object has a metadata dictionary that contains a 'crits_type' key, representing the type of the object, and an 'id' key, representing a unique identifier for that object. Your task is to implement a f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_notification_header({'crits_type': 'User', 'id': '12345'}) == 'User Notification: 12345'\", \"assert generate_notification_header({'crits_type': 'Admin', 'id': '67890'}) == 'Admin: 67890'\", \"assert generate_notification_header({'crits_type': 'Gues...
{ "split": "train", "index": 69776, "acecode_id": "bigcode_python_fns_1890", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `calculate_sum` that returns the sum of all the integers in the list. If the list is empty, the function should return 0. The input will be a single list of integers and the output will be a single integer representing the sum.\nPlease...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_sum([]) == 0\", \"assert calculate_sum([1]) == 1\", \"assert calculate_sum([-1]) == -1\", \"assert calculate_sum([1, 2, 3]) == 6\", \"assert calculate_sum([-1, -2, -3]) == -6\", \"assert calculate_sum([5, 5, 5]) == 15\", \"assert calculate_sum([0, ...
{ "split": "train", "index": 69777, "acecode_id": "oss_26439", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings, where each string represents a webpage title. Your task is to write a function that validates whether each title in the list matches an expected title string. The function should return a list of boolean values, where each value indicates whethe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_titles(['Home Page', 'About Us', 'Contact'], 'Home Page') == [True, False, False]\", \"assert validate_titles(['Welcome', 'Welcome', 'Welcome'], 'Welcome') == [True, True, True]\", \"assert validate_titles([], 'Empty Title') == []\", \"assert valida...
{ "split": "train", "index": 69778, "acecode_id": "oss_19200", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of file names and their corresponding sizes in bytes. The function should return a list of strings where each string contains the details of each file in the format: 'File: {file_name}, Size: {size} bytes'. Your func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert file_details([], []) == []\", \"assert file_details(['file1.txt'], [100]) == ['File: file1.txt, Size: 100 bytes']\", \"assert file_details(['file2.txt', 'file3.txt'], [200, 300]) == ['File: file2.txt, Size: 200 bytes', 'File: file3.txt, Size: 300 bytes']\", ...
{ "split": "train", "index": 69779, "acecode_id": "oss_15988", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string s, your task is to implement a function `strip_outer_parentheses(s: str) -> str` that removes all the outer parentheses from the string. The string s may include any combination of parentheses and other characters. If the input string contains no outer parenthese...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert strip_outer_parentheses('') == ''\", \"assert strip_outer_parentheses('((a))') == '(a)'\", \"assert strip_outer_parentheses('()') == ''\", \"assert strip_outer_parentheses('((a)(b))') == '(a)(b)'\", \"assert strip_outer_parentheses('((x)(y)(z))') == '(x)(y)(...
{ "split": "train", "index": 69780, "acecode_id": "bigcode_python_fns_28428", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with processing a log file containing information about different ancestries. Each log entry is a string that may include details on the ancestry being searched, the number of rows, and the number of ancestry-specific columns found. You will write a function `gen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_table_row(['Searching for ancestry: B', 'Original number of rows: 20', 'Found 0 ancestry specific columns:'], 'B', False, 'CODE456') == {'ancestry': 'B', 'phenotype_code': 'CODE456', 'original_nrow': 20, 'ancestry_specific_ncols': 0, 'missing_data_n...
{ "split": "train", "index": 69781, "acecode_id": "bigcode_python_fns_3667", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a list of sentences and a mapping of words to their corresponding IDs, write a function that converts each sentence into a list of IDs. Each sentence is represented as a string, and the mapping is provided as a dictionary where the keys are words (strings) and the values ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_sentences_to_ids(['hello world', 'python is great'], {'hello': 1, 'world': 2, 'python': 3, 'is': 4, 'great': 5}) == [[1, 2], [3, 4, 5]]\", \"assert convert_sentences_to_ids(['good morning', 'have a nice day'], {'good': 1, 'morning': 2, 'have': 3}) ==...
{ "split": "train", "index": 69782, "acecode_id": "bigcode_python_fns_36542", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the behavior of a chunking operation on a given sequence. The function should take a sequence of elements (such as a list, tuple, or string) and an integer representing the size of each chunk as input. Your implementati...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert list(chunker([1, 2, 3, 4, 5, 6, 7, 8, 9], 3)) == [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\", \"assert list(chunker([1, 2, 3, 4, 5], 2)) == [[1, 2], [3, 4], [5]]\", \"assert list(chunker([1], 1)) == [[1]]\", \"assert list(chunker([], 5)) == []\", \"assert list(chunk...
{ "split": "train", "index": 69783, "acecode_id": "oss_32883", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with checking whether a submission should be removed based on user reports and its linked submission status. Given a list of user reports for a submission and a configuration object that can retrieve linked submissions, implement a function `check_removal_require...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_removal_required([('original_post_deleted_or_locked', True)], False) == (True, True)\", \"assert check_removal_required([('post_violates_rules', True)], False) == (True, True)\", \"assert check_removal_required([], False) == (False, False)\", \"assert ...
{ "split": "train", "index": 69784, "acecode_id": "bigcode_python_fns_4220", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of three integer values representing pixel intensities, calculate the centroid interpolation for two specific values: the first three values and the second value in the list. The centroid interpolation for a set of pixel intensities is defined as the difference bet...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert centroid_interpolation([0, 0, 0]) == (None, None)\", \"assert centroid_interpolation([255, 255, 255]) == (0.0, 0.0)\", \"assert centroid_interpolation([5, 5, 5]) == (0.0, 0.0)\", \"assert centroid_interpolation([7, 7, 7]) == (0.0, 0.0)\", \"assert centroid_i...
{ "split": "train", "index": 69785, "acecode_id": "bigcode_python_fns_31421", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Implement a function `send_notification(notification_type: str) -> str` that accepts a notification type as input and returns a string indicating the status of the notification. The function should recognize three types of notifications: 'email', 'sms', and 'push'. If the notif...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert send_notification('email') == 'Email sent successfully'\", \"assert send_notification('sms') == 'SMS sent successfully'\", \"assert send_notification('push') == 'Push notification sent successfully'\", \"assert send_notification('invalid') == 'Invalid notifi...
{ "split": "train", "index": 69786, "acecode_id": "evol_31276", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a vector and a matrix, implement a function that broadcasts the vector to match the shape of the matrix following NumPy broadcasting rules. The function should take in a vector (which can be a flat list, row, or column) and a matrix (a 2D list) and return a new matrix whe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert broadcast([1, 2], [[0, 0], [0, 0]]) == [[1, 2], [1, 2]]\", \"assert broadcast([[5], [6]], [[1, 2, 3], [4, 5, 6]]) == [[5, 5, 5], [6, 6, 6]]\", \"assert broadcast([0], [[1], [2], [3]]) == [[0], [0], [0]]\", \"assert broadcast([1], [[1], [2], [3]]) == [[1], [1...
{ "split": "train", "index": 69787, "acecode_id": "bigcode_python_fns_14936", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that manages a simple field in a configuration system. The function should take two inputs: a `name` (a string representing the name of the field) and a `value` (which can be of any type). The function should be able to set and retrie...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_field('field1', 10) == 'Value set successfully'\", \"assert manage_field('field2', 5) == 'Value set successfully'\", \"assert manage_field('field3', None) == 'Field not set'\", \"assert manage_field('field4', 'test') == 'Value set successfully'\", \"a...
{ "split": "train", "index": 69788, "acecode_id": "oss_15989", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple HTTP request handler function in Python. The handler should support the HTTP methods GET, HEAD, POST, PUT, DELETE, TRACE, and CONNECT, as well as the HTTP version 1.0. Create a function called `handle_request` that takes three parameter...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_request('GET', '/index.html', '1.0') == '200 OK'\", \"assert handle_request('HEAD', '/index.html', '1.0') == '200 OK'\", \"assert handle_request('POST', '/data', '1.0') == '403 Forbidden'\", \"assert handle_request('PUT', '/file', '1.0') == '403 Forbi...
{ "split": "train", "index": 69789, "acecode_id": "oss_24959", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of keyboard events represented as integers, where each integer corresponds to a specific key action. The integers are defined as follows: 0 for 'RIGHT', 1 for 'LEFT', 2 for 'UP', and 3 for 'DOWN'. You need to implement a function that processes these events...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_ship_movement([0]) == (True, False, False, False)\", \"assert check_ship_movement([1]) == (False, True, False, False)\", \"assert check_ship_movement([2]) == (False, False, True, False)\", \"assert check_ship_movement([3]) == (False, False, False, True...
{ "split": "train", "index": 69790, "acecode_id": "bigcode_python_fns_17891", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a function `create_empty_record` that returns a dictionary representing an empty record for a library management system. The record should contain the following keys: 'metadata' (a string indicating the metadata structure), 'is_published' (a boolean indicating whether the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_empty_record() == {'metadata': '<record> <leader>00000nam a2200000zca4500</leader></record>', 'is_published': False, 'files': {'enabled': True}}\", \"assert create_empty_record()['metadata'] == '<record> <leader>00000nam a2200000zca4500</leader></reco...
{ "split": "train", "index": 69791, "acecode_id": "bigcode_python_fns_4636", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that performs namespace flattening on a nested dictionary. Namespace flattening involves transforming a nested dictionary into a flattened dictionary, where the keys are concatenated with a specified delimiter to represent the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten_dict({'a': {'b': 2, 'c': {'d': 3}}}) == {'a.b': 2, 'a.c.d': 3}\", \"assert flatten_dict({'x': {'y': 5, 'z': {'a': 10}}}) == {'x.y': 5, 'x.z.a': 10}\", \"assert flatten_dict({'key1': {'key2': {'key3': 1}}}) == {'key1.key2.key3': 1}\", \"assert flatten...
{ "split": "train", "index": 69792, "acecode_id": "oss_5663", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of news articles, each represented as a dictionary. Each article has the following keys: 'title' (a string), 'hot' (an integer, where 1 indicates the article is hot and 0 indicates it is not), and 'date' (a string in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_news([{'title': 'News A', 'hot': 1, 'date': '2021-04-01'}, {'title': 'News B', 'hot': 0, 'date': '2021-04-02'}]) == ([{'title': 'News A', 'hot': 1, 'date': '2021-04-01'}], [{'title': 'News B', 'hot': 0, 'date': '2021-04-02'}])\", \"assert process_new...
{ "split": "train", "index": 69793, "acecode_id": "bigcode_python_fns_4182", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that validates the format of an S3 URL. The function should take a string as input and return True if the input string is a valid S3 URL, and False otherwise. An S3 URL is considered valid if it starts with the format \"simpleflow+...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_s3_url(\\\"simpleflow+s3://my-bucket/path/to/file\\\") == True\", \"assert validate_s3_url(\\\"simpleflow+s3://another-bucket/another/path/\\\") == True\", \"assert validate_s3_url(\\\"simpleflow+s3://bucket-name/with/subdir/\\\") == True\", \"asser...
{ "split": "train", "index": 69794, "acecode_id": "oss_5068", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `find_max_index(arr: List[int]) -> int` that returns the index of the maximum value in the list. If there are multiple occurrences of the maximum value, return the index of the first occurrence. The list will have at least one element....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_max_index([1, 2, 3, 2, 1]) == 2\", \"assert find_max_index([-1, -2, -3, -2, -1]) == 0\", \"assert find_max_index([5, 3, 5, 2]) == 0\", \"assert find_max_index([7]) == 0\", \"assert find_max_index([0, 0, 0, 0]) == 0\", \"assert find_max_index([1, 5, 3, 5...
{ "split": "train", "index": 69795, "acecode_id": "bigcode_python_fns_40809", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a warmup cosine learning rate schedule for a machine learning optimizer. The warmup cosine schedule involves linearly increasing the learning rate from 0 to 1 over a specified number of warmup steps, followed by a cosine decay to decrease the le...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_learning_rate(0, 10, 20) == 0.0\", \"assert calculate_learning_rate(5, 10, 20) == 0.5\", \"assert calculate_learning_rate(10, 10, 20) == 1.0\", \"assert calculate_learning_rate(0, 5, 10) == 0.0\", \"assert calculate_learning_rate(2, 5, 10) == 0.4\"...
{ "split": "train", "index": 69796, "acecode_id": "oss_31592", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Write a Python function named \"check_perfect_squares\" that takes a list of integers as an argument and returns a list of booleans. Each boolean should indicate whether the corresponding integer in the original list is a perfect square. The function should also handle edge cas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_perfect_squares([0, 1, 4, 9]) == [True, True, True, True]\", \"assert check_perfect_squares([2, 3, 5, 6]) == [False, False, False, False]\", \"assert check_perfect_squares([16, 25, 36, 49]) == [True, True, True, True]\", \"assert check_perfect_squares(...
{ "split": "train", "index": 69797, "acecode_id": "evol_6805", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries, where each dictionary represents the financial ratios of a company for a specific year. Each dictionary contains the keys 'year', 'benchmark', and 'price_to_free_cash_flow_ttm'. Your task is to implement a function that calculates the price...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_price_to_free_cash_flow_ratio([{'year': 2023, 'benchmark': 'company', 'price_to_free_cash_flow_ttm': 15.5}, {'year': 2022, 'benchmark': 'company', 'price_to_free_cash_flow_ttm': 14.0}], 2023) == 15.5\", \"assert get_price_to_free_cash_flow_ratio([{'year'...
{ "split": "train", "index": 69798, "acecode_id": "bigcode_python_fns_21344", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that takes a string as input and formats it to be centered within a specified width, surrounded by a specified character. Write a Python function called `format_centered` that takes three parameters: - `text` (string): The input te...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_centered('A', 5, '-') == '--A--'\", \"assert format_centered('TEST', 8, '#') == '##TEST##'\", \"assert format_centered('CODE', 4, '@') == 'CODE'\", \"assert format_centered('TEXT', 12, '.') == '....TEXT....'\", \"assert format_centered('EXTRA', 3, '!'...
{ "split": "train", "index": 69799, "acecode_id": "oss_14926", "num_tests": 7 }