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 implementing a function that takes in four parameters representing the scalar and vector parts of a quaternion. A quaternion is represented as a 4-tuple (w, x, y, z), where w is the scalar part and (x, y, z) forms the vector part. Your function should return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quaternion_representation(1, 0, 0, 0) == '1 + 0i + 0j + 0k'\", \"assert quaternion_representation(0, 1, 0, 0) == '0 + 1i + 0j + 0k'\", \"assert quaternion_representation(0, 0, 1, 0) == '0 + 0i + 1j + 0k'\", \"assert quaternion_representation(0, 0, 0, 1) == '...
{ "split": "train", "index": 67600, "acecode_id": "oss_8020", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing configurations of a single variable. Each configuration is either a positive integer, which represents a true value, or a negative integer, which represents a false value. Your task is to implement a function that takes this list of...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert binary_representation([1]) == [1]\", \"assert binary_representation([-1]) == [-1]\", \"assert binary_representation([3]) == [1]\", \"assert binary_representation([-5]) == [-1]\", \"assert binary_representation([1, 2]) == [0]\", \"assert binary_representation...
{ "split": "train", "index": 67601, "acecode_id": "bigcode_python_fns_10384", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with analyzing a directory structure represented as a list of file paths. Your goal is to write a Python function that extracts unique file extensions from the provided list of file paths. Write a function `find_file_extensions(file_paths: List[str]) -> List[str]...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_file_extensions(['/home/user/file1', '/home/user/file2', '/home/user/file3']) == []\", \"assert find_file_extensions(['file1', 'file2', 'file3']) == []\", \"assert find_file_extensions(['archive.zip', 'archive.rar', 'archive.7z']) == ['.zip', '.rar', '....
{ "split": "train", "index": 67602, "acecode_id": "oss_5824", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given two matrices, write a function that sums the two matrices and then finds the transpose of the resulting matrix. If the two input matrices are not of the same dimensions, your function should return an appropriate error message. The function should have the following signa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_and_transpose([[1]], [[2]]) == [[3]]\", \"assert sum_and_transpose([[1, 0], [0, 1]], [[0, 1], [1, 0]]) == [[1, 1], [1, 1]]\", \"assert sum_and_transpose([[1, 2, 3]], [[4, 5, 6]]) == [[5], [7], [9]]\", \"assert sum_and_transpose([[1, 1], [1, 1]], [[1, 1],...
{ "split": "train", "index": 67603, "acecode_id": "evol_8429", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that retrieves an incident based on a given incident ID. The function should take an integer 'incident_id' as input and return a dictionary representing the incident. If the incident ID does not correspond to any incident, the function sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_incident(1) == {'id': 1, 'title': 'Incident 1', 'description': 'Description for incident 1'}\", \"assert get_incident(2) == {'id': 2, 'title': 'Incident 2', 'description': 'Description for incident 2'}\", \"assert get_incident(4) == None\", \"assert get_...
{ "split": "train", "index": 67604, "acecode_id": "bigcode_python_fns_21124", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function `find_min_value(arr)` that takes a list of integers `arr` as input and returns the smallest integer from the list. If the list is empty, return None.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a sing...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_min_value([3, 1, 4, 1, 5, 9]) == 1\", \"assert find_min_value([-10, -5, 0, 5, 10]) == -10\", \"assert find_min_value([100, 200, 300, 400]) == 100\", \"assert find_min_value([7]) == 7\", \"assert find_min_value([2, 2, 2, 2]) == 2\", \"assert find_min_val...
{ "split": "train", "index": 67605, "acecode_id": "evol_29966", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that counts the characters in a given string that have vowels as their immediate neighbors. The function should return a dictionary where each character that meets this criterion is a key, and its value is the count of its occurrences. The function should only ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert vowel_neighbors('abc!d@e#f') == {'b': 1}\", \"assert vowel_neighbors('xyz') == {}\", \"assert vowel_neighbors('!@#') == {}\", \"assert vowel_neighbors('abcde') == {'b': 1, 'd': 1}\", \"assert vowel_neighbors('') == {}\", \"assert vowel_neighbors('!') == {}\"...
{ "split": "train", "index": 67606, "acecode_id": "evol_35517", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Implement a function `is_figure_eight_oscillator(generations: int) -> bool` that determines if the Figure Eight lifeform returns to its original configuration after a specified number of generations. The function should take an integer `generations`, which represents the number...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_figure_eight_oscillator(0) == False\", \"assert is_figure_eight_oscillator(1) == False\", \"assert is_figure_eight_oscillator(2) == False\", \"assert is_figure_eight_oscillator(3) == False\", \"assert is_figure_eight_oscillator(4) == True\", \"assert is_f...
{ "split": "train", "index": 67607, "acecode_id": "oss_18069", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a JSON-like dictionary representation for an error response. The function should take a message string as input and return a dictionary containing two key-value pairs: an 'error' key with the value 'bad request', and a 'mes...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bad_request('Invalid input') == {'error': 'bad request', 'message': 'Invalid input'}\", \"assert bad_request('User not found') == {'error': 'bad request', 'message': 'User not found'}\", \"assert bad_request('Missing parameters') == {'error': 'bad request', ...
{ "split": "train", "index": 67608, "acecode_id": "bigcode_python_fns_22293", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `get_extension_names(namespace: str)` that takes a string `namespace` as input and returns a list of extension names associated with that namespace. The extension names are represented as keys in a predefined dictionary `_PLUGINS`. If the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_extension_names('namespace1') == ['ext1', 'ext2']\", \"assert get_extension_names('namespace2') == ['extA', 'extB', 'extC']\", \"assert get_extension_names('namespace3') == []\", \"assert get_extension_names('namespace_nonexistent') == []\", \"assert get...
{ "split": "train", "index": 67609, "acecode_id": "bigcode_python_fns_9080", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Write a function `generate_pin()` that generates a random 4-digit PIN number. The PIN must meet the following criteria: it should not start with the digit 0, and it must not contain any consecutive repeating digits. The function should return the generated PIN as a string.\nPle...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_pin()[0] != '0'\", \"assert len(generate_pin()) == 4\", \"assert generate_pin()[0] != '0'\", \"assert generate_pin()[1] != generate_pin()[2]\", \"assert generate_pin()[2] != generate_pin()[3]\", \"assert generate_pin()[0] != generate_pin()[1]\", \"a...
{ "split": "train", "index": 67610, "acecode_id": "evol_16340", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design a function in Python that counts the number of unique words in a given paragraph and identifies their frequency of occurrence, storing them in a dictionary where keys are the unique words and values are their respective frequencies. The function should return this dictio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert word_counter('Hello world Hello') == {'hello': 2, 'world': 1}\", \"assert word_counter('One two three One two') == {'one': 2, 'two': 2, 'three': 1}\", \"assert word_counter('A quick brown fox jumps over the lazy dog') == {'a': 1, 'quick': 1, 'brown': 1, 'fox...
{ "split": "train", "index": 67611, "acecode_id": "evol_21291", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with managing a feature model for a custom data analysis application. Your job is to implement a function that adds a new feature to this model. The function takes the following parameters: `model`, a dictionary representing the feature model; `feature`, a string...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_feature({}, 'new_feature', 'New Feature', 'NF', '3D', True) is None\", \"assert add_feature({'features': {}, 'names': {}, 'short_names': {}, 'dimensions': {}, 'is_ints': {}}, 'height', 'Height', 'H', '3D', True) is None\", \"assert add_feature({'features...
{ "split": "train", "index": 67612, "acecode_id": "bigcode_python_fns_9666", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with encoding a list of syllogistic tasks. Each task is represented as a list containing three strings: the quantifier ('All' or 'Some'), the subject, and the predicate. Your goal is to implement a function `encode_task(task: List[List[str]]) -> str` that encodes...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert encode_task([['Some', 'A', 'B']]) == 'I1'\", \"assert encode_task([['All', 'A', 'B']]) == 'A1'\", \"assert encode_task([['Some', 'A', 'C']]) == 'I1'\", \"assert encode_task([['Some', 'X', 'Y']]) == 'I1'\", \"assert encode_task([['All', 'M', 'N']]) == 'A1'\"]...
{ "split": "train", "index": 67613, "acecode_id": "bigcode_python_fns_30307", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a multi-line string representing a documentation section. This section contains information about deprecated features, formatted in a specific way. Your task is to implement a function `parse_deprecated_section(docstring: str) -> Tuple[List[Dict[str, str]]]` that ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_deprecated_section('''\\nNot Deprecated\\n----------\\n1.0.0\\n This feature is still available.\\n''') == []\", \"assert parse_deprecated_section('''\\nNo relevant section\\n\\nSome other text here.\\n''') == []\", \"assert parse_deprecated_section...
{ "split": "train", "index": 67614, "acecode_id": "bigcode_python_fns_24733", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a string that contains a series of space-separated values representing different parameters of a star's properties in astrophysics. The first line gives the MIST version, the second gives the MESA revision, the fourth line provides Yinit, Zinit, FeH, aFe, and vvcr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_star_properties('MIST_version 1.0\\\\nMESA_revision 1.0\\\\n\\\\n\\\\n0.25 0.02 -0.1 0.0 0.0\\\\n\\\\n\\\\n1.0 100 10 5 main_sequence star') == {'MIST_version': '1.0', 'MESA_revision': '1.0', 'Yinit': 0.25, 'Zinit': 0.02, 'FeH': -0.1, 'aFe': 0.0, 'vv...
{ "split": "train", "index": 67615, "acecode_id": "bigcode_python_fns_8146", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the number of changes made in a version control system. Your task is to implement a function `has_uncommitted_changes(changes: List[int]) -> bool` that checks if there are any uncommitted changes. The function should return `True` i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_uncommitted_changes([0, 0, 0]) == False\", \"assert has_uncommitted_changes([1, 0, 0]) == True\", \"assert has_uncommitted_changes([0, 2, 0]) == True\", \"assert has_uncommitted_changes([0, 0, 3]) == True\", \"assert has_uncommitted_changes([0, 0, 0, 0])...
{ "split": "train", "index": 67616, "acecode_id": "bigcode_python_fns_47063", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary `token_lookup` that maps cryptocurrency symbols (like 'ETH', 'BTC', etc.) to their corresponding token addresses. You also have a function `calculate_price_history_in_eth(symbol)` that computes the price history for the given symbol in terms of Ethere...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_price_history_for_symbols({'ETH': 'address1', 'BTC': 'address2'}, ['ETH', 'BTC']) == None\", \"assert calculate_price_history_for_symbols({'ETH': 'address1', 'BTC': 'address2'}, ['LTC', 'DOGE']) == None\", \"assert calculate_price_history_for_symbo...
{ "split": "train", "index": 67617, "acecode_id": "oss_6552", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing genomic data represented in a BED format. Your function should take a list of strings, where each string represents a line in a BED file. Each line contains a chromosome name, a start position, and an end position, all separated by tabs. Your func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_bed_data(['chr1\\\\t100\\\\t200', 'chr1\\\\t300\\\\t400', 'chr2\\\\t500\\\\t600']) == [('chr1', (100, 200)), ('chr1', (300, 400)), ('chr2', (500, 600))]\", \"assert process_bed_data(['chr1\\\\t150\\\\t250', 'chr2\\\\t0\\\\t10', 'chr2\\\\t20\\\\t15'])...
{ "split": "train", "index": 67618, "acecode_id": "bigcode_python_fns_31141", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `date_difference(date1: str, date2: str) -> int` that calculates the absolute difference in days between two dates provided in the format 'YYYY-MM-DD'. The function should return the total number of days between the two dates, regardless of which date is ea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert date_difference('2023-10-01', '2023-10-05') == 4\", \"assert date_difference('2023-01-01', '2023-01-01') == 0\", \"assert date_difference('2022-12-31', '2023-01-01') == 1\", \"assert date_difference('2023-05-15', '2023-05-10') == 5\", \"assert date_differenc...
{ "split": "train", "index": 67619, "acecode_id": "evol_994", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates the behavior of a command-line program that accepts a specific flag. Your function should accept a boolean parameter `log_device_placement`. If the parameter is True, the function should return the string 'Device pla...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert log_device_status(True) == 'Device placement logging is enabled.'\", \"assert log_device_status(False) == 'Device placement logging is not enabled.'\", \"assert log_device_status(True) == 'Device placement logging is enabled.'\", \"assert log_device_status(F...
{ "split": "train", "index": 67620, "acecode_id": "oss_23896", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple state machine that processes a series of numeric actions. The state machine has a current state represented by an integer, and it transitions between states based on the input actions, which are also integers. Your goal is to write a fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert state_machine_transition(1, 1) == (True, 2)\", \"assert state_machine_transition(1, 2) == (True, 3)\", \"assert state_machine_transition(1, 3) == (True, 1)\", \"assert state_machine_transition(2, 1) == (True, 3)\", \"assert state_machine_transition(2, 2) == ...
{ "split": "train", "index": 67621, "acecode_id": "oss_28391", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `fibfib(n: int) -> int` that calculates the nth element of the FibFib succession, which is defined as follows: fibfib(0) == 0, fibfib(1) == 0, fibfib(2) == 1, and for n >= 3, fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). The function should efficien...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibfib(0) == 0\", \"assert fibfib(1) == 0\", \"assert fibfib(2) == 1\", \"assert fibfib(3) == 1\", \"assert fibfib(4) == 2\", \"assert fibfib(5) == 4\", \"assert fibfib(6) == 7\", \"assert fibfib(7) == 13\", \"assert fibfib(8) == 24\", \"assert fibfib(9) == ...
{ "split": "train", "index": 67622, "acecode_id": "evol_15420", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `count_letters(text: str) -> Tuple[Dict[str, int], Dict[str, int], Optional[str], Optional[str]]` that takes a string `text` as input and returns a tuple containing four elements: a dictionary of the count of each lowercase letter, a dictionary of the count of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_letters('test') == ({'e': 1, 's': 1, 't': 2}, {}, 't', None)\", \"assert count_letters('TEST') == ({}, {'T': 2, 'E': 1, 'S': 1}, None, 'T')\", \"assert count_letters('') == ({}, {}, None, None)\", \"assert count_letters('12345') == ({}, {}, None, None)...
{ "split": "train", "index": 67623, "acecode_id": "evol_19563", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that manages the distribution of servings for various fruits based on their quantities in a basket. You will receive a list of strings representing the quantity of different fruits in the basket in the format 'X fruit_name', where 'X'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fruit_distribution(['5 apples', '6 oranges'], 19, ['apples', 'oranges', 'mangoes'], {'apples': 2, 'oranges': 3, 'mangoes': 4}) == {'mangoes': 2}\", \"assert fruit_distribution(['100 apples', '1 oranges'], 120, ['apples', 'oranges', 'mangoes'], {'apples': 1, ...
{ "split": "train", "index": 67624, "acecode_id": "evol_4827", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a code snippet for adding buttons to a GUI sizer. Each button has a name and a specific position within the sizer. Your function will take a list of button names and their positions as input, and it should return the code s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_button_code([(\\\"train_button\\\", (0, 0)), (\\\"test_button\\\", (1, 0)), (\\\"send_button\\\", (0, 1))]) == 'self.button_sizer.Add(\\\\n self.train_button,\\\\n pos=(0, 0),\\\\n flag=wx.EXPAND)\\\\nself.button_sizer.Add(\\\\n self.tes...
{ "split": "train", "index": 67625, "acecode_id": "oss_28517", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that generates the Fibonacci sequence up to the n-th term, where n is a positive integer. The function should return a list of Fibonacci numbers starting from 0 up to the (n-1)-th term. If n is not a positive integer, the function should return an error mes...
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": 67626, "acecode_id": "evol_11", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the levels of users in a system. Your task is to write a function `calculate_average_level(user_levels)` that computes the average user level. The function should return the average as a float, rounded to two decimal places. If the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_level([1, 2, 3, 4, 5]) == 3.00\", \"assert calculate_average_level([10, 20, 30]) == 20.00\", \"assert calculate_average_level([5]) == 5.00\", \"assert calculate_average_level([]) == 0.00\", \"assert calculate_average_level([100, 200, 300, 4...
{ "split": "train", "index": 67627, "acecode_id": "oss_27017", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of buildings. Each building can be represented as a vertical bar in a histogram. Your task is to calculate the total area of the largest rectangle that can be formed within the histogram. Write a function `largest_rectan...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert largest_rectangle_area([2, 1, 5, 6, 2, 3]) == 10\", \"assert largest_rectangle_area([1, 1, 1, 1, 1]) == 5\", \"assert largest_rectangle_area([0, 0, 0, 0]) == 0\", \"assert largest_rectangle_area([1, 2, 3, 4, 5]) == 9\", \"assert largest_rectangle_area([5, 4,...
{ "split": "train", "index": 67628, "acecode_id": "bigcode_python_fns_34861", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function to process a list of university majors. The function should take a list of strings representing major names and return a new list containing only the unique major names, maintaining the original order of their first appearance. You...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_majors(['Computer Science', 'Mathematics', 'Engineering', 'Computer Science']) == ['Computer Science', 'Mathematics', 'Engineering']\", \"assert unique_majors(['Physics', 'Chemistry', 'Mathematics', 'Physics', 'Mathematics']) == ['Physics', 'Chemistry...
{ "split": "train", "index": 67629, "acecode_id": "oss_4523", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given two lists, `values` and `weights`, where `values` contains numerical values and `weights` contains non-negative weights corresponding to those values, implement a function that computes the weighted mean and weighted standard deviation of the `values` based on the provide...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert weighted_moments([1, 2, 3], [1, 1, 1]) == (2.0, 0.816496580927726)\", \"assert weighted_moments([10, 20, 30], [0, 1, 1]) == (25.0, 5.0)\", \"assert weighted_moments([5, 5, 5], [2, 2, 2]) == (5.0, 0.0)\", \"assert weighted_moments([0, 0, 0], [0, 0, 0]) == (0,...
{ "split": "train", "index": 67630, "acecode_id": "bigcode_python_fns_9261", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a list of items, and your task is to select multiple unique items from that list. The selection process should ensure that no duplicates are chosen, and the output should be a list containing the selected items in the order they were chosen. Write a function that ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert select_unique_items(['apple', 'banana', 'cherry', 'date'], [0, 1, 2, 2]) == ['apple', 'banana', 'cherry']\", \"assert select_unique_items(['red', 'green', 'blue'], [0, 1, 2]) == ['red', 'green', 'blue']\", \"assert select_unique_items(['cat', 'dog', 'fish'],...
{ "split": "train", "index": 67631, "acecode_id": "bigcode_python_fns_8731", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with designing a function that simulates a simple neural network structure. Your function should take three parameters: input_shape (an integer representing the size of the input layer), hidden_neurons (an integer representing the number of neurons in the hidden ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_neural_network_description(5, 16, 1) == 'Input Layer: 5 neurons, Hidden Layer: 16 neurons with ReLU activation, Output Layer: 1 neuron with sigmoid activation.'\", \"assert create_neural_network_description(10, 32, 1) == 'Input Layer: 10 neurons, Hidd...
{ "split": "train", "index": 67632, "acecode_id": "oss_8536", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates the behavior of a robot equipped with a distance sensor. The robot should continuously read distance values from a list until it detects a distance reading that falls below a specified threshold. The function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert detect_obstacle([250, 300, 150, 400], 200) == 150\", \"assert detect_obstacle([400, 250, 300], 200) == None\", \"assert detect_obstacle([100, 200, 300, 150], 150) == 100\", \"assert detect_obstacle([], 200) == None\", \"assert detect_obstacle([350, 250, 180,...
{ "split": "train", "index": 67633, "acecode_id": "oss_16481", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a string as input and continuously transforms it until no further changes occur. The transformation involves replacing every occurrence of the substring 'abc' with 'xyz' in the string. Your function should return the final ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_string('abc') == 'xyz'\", \"assert transform_string('abcabc') == 'xyzxyz'\", \"assert transform_string('abca') == 'xyza'\", \"assert transform_string('a') == 'a'\", \"assert transform_string('xyz') == 'xyz'\", \"assert transform_string('abcabcabc')...
{ "split": "train", "index": 67634, "acecode_id": "bigcode_python_fns_41053", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes a string as input and converts it to its lowercase version. Additionally, the function should identify the indices of any numbers or special characters in the string and return these indices in a list. If the input is not a string, the function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_and_find_specials('F0O!') == ('f0o!', [1, 3])\", \"assert convert_and_find_specials('Special@Character#') == ('special@character#', [7, 17])\", \"assert convert_and_find_specials('JustLetters') == ('justletters', [])\", \"assert convert_and_find_spec...
{ "split": "train", "index": 67635, "acecode_id": "evol_6613", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the behavior of an AWS CloudFormation intrinsic function called `ImportValue`. This function should take a string input representing the name of an exported value and return a dictionary that represents the `Fn::ImportValue...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert import_value('${NetworkStackNameParameter}-SecurityGroupID') == {'Fn::ImportValue': {'Fn::Sub': '${NetworkStackNameParameter}-SecurityGroupID'}}\", \"assert import_value('MyExportedValue') == {'Fn::ImportValue': {'Fn::Sub': 'MyExportedValue'}}\", \"assert im...
{ "split": "train", "index": 67636, "acecode_id": "bigcode_python_fns_37397", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries, where each dictionary represents an item with various attributes. Your task is to implement a function that finds the first dictionary in the list that matches a given comparison dictionary. The comparison dictionary contains keys and their...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_first_matching([{'a': 1, 'b': 2}, {'a': 3, 'b': 4}], {'a': 1}) == {'a': 1, 'b': 2}\", \"assert get_first_matching([{'x': 5, 'y': 10}, {'x': 15, 'y': 20}], {'y': 20}) == {'x': 15, 'y': 20}\", \"assert get_first_matching([{'name': 'Alice', 'age': 25}, {'na...
{ "split": "train", "index": 67637, "acecode_id": "bigcode_python_fns_15972", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a number x and a uniform distribution defined by its minimum and maximum values, write a function that calculates the probability density function (PDF) at point x for the specified uniform distribution. The function should take three parameters: a float x, a float minimu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(uniform_pdf(0.5, 0, 1) - 1.0) < 1e-9\", \"assert abs(uniform_pdf(0, 0, 1) - 1.0) < 1e-9\", \"assert abs(uniform_pdf(1, 0, 1) - 1.0) < 1e-9\", \"assert abs(uniform_pdf(-1, 0, 1) - 0.0) < 1e-9\", \"assert abs(uniform_pdf(2, 0, 1) - 0.0) < 1e-9\", \"assert ...
{ "split": "train", "index": 67638, "acecode_id": "bigcode_python_fns_17937", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates parsing command line arguments. Your function should take a list of strings as input, where the first element is the command name and the remaining elements are the command line arguments. The function should return a tuple...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_command_line([]) == (None, [])\", \"assert parse_command_line(['start']) == ('start', [])\", \"assert parse_command_line(['stop', 'arg1', 'arg2']) == ('stop', ['arg1', 'arg2'])\", \"assert parse_command_line(['restart']) == ('restart', [])\", \"assert ...
{ "split": "train", "index": 67639, "acecode_id": "bigcode_python_fns_39841", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2D list of integers representing a matrix. You need to implement a function that retrieves the elements of the matrix in a spiral order, starting from the top left corner and proceeding clockwise. Your function should take the matrix as an input and return a lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert spiral_order([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [1, 2, 3, 6, 9, 8, 7, 4, 5]\", \"assert spiral_order([[1, 2], [3, 4]]) == [1, 2, 4, 3]\", \"assert spiral_order([[1]]) == [1]\", \"assert spiral_order([[1, 2, 3, 4]]) == [1, 2, 3, 4]\", \"assert spiral_order...
{ "split": "train", "index": 67640, "acecode_id": "bigcode_python_fns_15438", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a data validation function that checks if a given input data is valid based on specific rules. The function should accept a single parameter, `data`, which can be of various types including an IP address (IPv4 or IPv6), a URL, a UUID, a custom i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_data(ipaddress.ip_network('192.168.1.1')) == None\", \"assert validate_data(urllib.parse.urlparse('https://www.example.com')) == None\", \"assert validate_data(uuid.UUID('12345678-1234-5678-1234-567812345678')) == None\", \"assert validate_data([1, ...
{ "split": "train", "index": 67641, "acecode_id": "oss_36060", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a string document as input and returns a list of clean tokens. The function should remove any punctuation marks, convert all characters to lowercase, and split the document into individual words. Implement the function `cle...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert clean_tokens('Hello, this is a sample document! It contains some punctuation.') == ['hello', 'this', 'is', 'a', 'sample', 'document', 'it', 'contains', 'some', 'punctuation']\", \"assert clean_tokens('Python is fun!') == ['python', 'is', 'fun']\", \"assert c...
{ "split": "train", "index": 67642, "acecode_id": "oss_22846", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a dictionary containing weather data, your task is to create a function that generates an HTML string representing the weather data in a structured format. The HTML string should include a title, a header indicating 'WEATHER DATA', and a table that displays the weather at...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_weather_html({'temperature': '25\\u00b0C', 'humidity': '60%', 'wind_speed': '10 km/h', 'description': 'Partly Cloudy'}, 'https://example.com/weather-icon.png', 'Weather Icon') == '<html>\\\\n<head>\\\\n<title>Python Weather HTML</title>\\\\n</head>\...
{ "split": "train", "index": 67643, "acecode_id": "oss_15753", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given three integers `m`, `a`, and `b`, and two integers `y` and `z`. Your task is to write a function to calculate the minimum cost, `cost_0`, to achieve a specific goal. The goal is to distribute `m` items among two groups, such that the first group receives items in ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_min_cost(100, 10, 20, 1, 2) == 10\", \"assert calculate_min_cost(7, 7, 3, 10, 5) == 10\", \"assert calculate_min_cost(14, 7, 5, 2, 3) == 4\", \"assert calculate_min_cost(1, 1, 1, 1, 1) == 1\", \"assert calculate_min_cost(4, 2, 3, 2, 3) == 4\", \"as...
{ "split": "train", "index": 67644, "acecode_id": "oss_2682", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that converts a given binary tree node into an ASDF representation. The binary tree node has attributes `offset`, `size`, and `name`. The ASDF representation is a dictionary containing the node's `offset`, `size`, and `name` if it is ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert to_tree(BinaryTreeNode(1, 10, 'Node1')) == {'offset': 1, 'size': 10, 'name': 'Node1'}\", \"assert to_tree(BinaryTreeNode(2, 20, None)) == {'offset': 2, 'size': 20}\", \"assert to_tree(BinaryTreeNode(3, 30, 'Node3')) == {'offset': 3, 'size': 30, 'name': 'Node...
{ "split": "train", "index": 67645, "acecode_id": "oss_13571", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating the behavior of a slider and winch control system. You need to implement a function `control_winch_system` that simulates two actions: retracting a slider and winding a winch. The function should take two parameters: `action` (a string that can ei...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert control_winch_system('retract', 1) == 'Slider retracted'\", \"assert control_winch_system('wind', 1) == 'Slider stopped and winch wound'\", \"assert control_winch_system('wind', 2) == 'Winch wound'\", \"assert control_winch_system('wind', 3) == 'Winch wound'...
{ "split": "train", "index": 67646, "acecode_id": "oss_28293", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a function that generates a default logging configuration. The function should return a dictionary containing the default settings for logging. The configuration dictionary should have the following structure: {'version': 1, 'disable_existing_loggers': Fal...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_default_log_config() == {'version': 1, 'disable_existing_loggers': False, 'handlers': {'console': {'class': 'logging.StreamHandler', 'level': 'DEBUG'}}, 'loggers': {'my_logger': {'level': 'DEBUG', 'handlers': ['console'], 'propagate': False}}}\", \"asser...
{ "split": "train", "index": 67647, "acecode_id": "bigcode_python_fns_4708", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple key-value storage system using Python dictionaries. Your goal is to create a function `manage_storage(operations)` that processes a list of operations and returns the result of each operation. The operations can be of three types: 'add'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_storage([('add', 'a', 1), ('get', 'a'), ('delete', 'a'), ('get', 'a')]) == [None, 1, None, 'Key not found']\", \"assert manage_storage([('add', 'b', 2), ('get', 'b'), ('add', 'b', 3), ('get', 'b')]) == [None, 2, None, 3]\", \"assert manage_storage([('...
{ "split": "train", "index": 67648, "acecode_id": "oss_10294", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a singly linked list where each node contains a key-value pair. Write a function `iterate_linked_list(head)` that takes the head of the linked list as input and returns a list of strings, where each string represents a key-value pair in the format 'key: value'. Th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert iterate_linked_list(None) == []\", \"assert iterate_linked_list(Node('key1', 'value1')) == ['key1: value1']\", \"assert iterate_linked_list(Node('x', '10')) == ['x: 10']\", \"assert iterate_linked_list(Node('single', 'only')) == ['single: only']\", \"assert ...
{ "split": "train", "index": 67649, "acecode_id": "evol_1961", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Implement a function `hunnyb_search(name: str) -> Tuple[Callable, Callable, None, None]` that simulates a search function for encoding and decoding. The function should check if the input `name` matches a predefined encoding name 'hunnyb' or any of its aliases. If it does, retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert hunnyb_search('random') == None\", \"assert hunnyb_search('HUNNYB') == None\", \"assert hunnyb_search('HB') == None\", \"assert hunnyb_search('HUNNY_B') == None\", \"assert hunnyb_search('H_B') == None\", \"assert hunnyb_search('hunny') == None\", \"assert h...
{ "split": "train", "index": 67650, "acecode_id": "bigcode_python_fns_7539", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that extracts specific segments from a given URL string that follows a defined pattern. Write a function `parse_url_segments(url: str) -> dict` that takes a URL as input and returns a dictionary containing the extracted segments. The URL ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_url_segments('http://example.com/instance_id/abcd-1234/model_respositories/567/upload') == {'domain': 'example.com', 'instance_id': 'abcd-1234', 'model_id': '567'}\", \"assert parse_url_segments('http://test.org/instance_id/xyz-789/model_respositories/...
{ "split": "train", "index": 67651, "acecode_id": "oss_6866", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of numerical entities, implement a function that returns the outcome of multiplying together the absolute values of these numbers, but only after considering the closest integer value less than or equal to each number in their absolute forms. For example, if the in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multiply_abs_values([2, -3, 4]) == 24\", \"assert multiply_abs_values([1, -5, 9, -3]) == 135\", \"assert multiply_abs_values([0, 0, 0]) == 0\", \"assert multiply_abs_values([10, -10, 10]) == 1000\", \"assert multiply_abs_values([-5.5, 5.5, -5.5]) == 125\", \...
{ "split": "train", "index": 67652, "acecode_id": "evol_21668", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of edges representing a connected, undirected graph and returns the total weight of the Minimum Spanning Tree (MST) using Kruskal's algorithm. Each edge is represented as a tuple (u, v, w) where u and v are the vertices connected by the ed...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert kruskal_total_weight([(0, 1, 10), (0, 2, 6), (0, 3, 5), (1, 3, 15), (2, 3, 4)]) == 19\", \"assert kruskal_total_weight([(0, 1, 1), (1, 2, 2), (2, 3, 3), (0, 3, 4)]) == 6\", \"assert kruskal_total_weight([(0, 1, 2), (0, 2, 3), (1, 2, 1), (1, 3, 4), (2, 3, 5)]...
{ "split": "train", "index": 67653, "acecode_id": "evol_32681", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that creates a shortened version of a given list of integers. The function `shorten_list(lst, n)` takes in a list of integers `lst` and an integer `n` and returns a new list that contains only the first `n` elements of `lst`. If `n` i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shorten_list([1, 2, 3, 4, 5], 3) == [1, 2, 3]\", \"assert shorten_list([1, 2, 3, 4, 5], 0) == []\", \"assert shorten_list([1, 2, 3, 4, 5], 6) == [1, 2, 3, 4, 5]\", \"assert shorten_list([], 5) == []\", \"assert shorten_list([10, 20, 30], 2) == [10, 20]\", \"...
{ "split": "train", "index": 67654, "acecode_id": "oss_29358", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that checks if two given strings are anagrams of each other. Two strings are considered anagrams if they can be rearranged to form the same string, meaning they have the same characters with the same frequency. The function should return True if they are anagra...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert are_anagrams('listen', 'silent') == True\", \"assert are_anagrams('triangle', 'integral') == True\", \"assert are_anagrams('apple', 'papel') == True\", \"assert are_anagrams('rat', 'car') == False\", \"assert are_anagrams('evil', 'vile') == True\", \"assert ...
{ "split": "train", "index": 67655, "acecode_id": "evol_26785", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function `shared_chars(s1: str, s2: str) -> List[str]` that determines the distinct shared characters in two provided strings, ignoring case and handling Unicode characters. The function should return the shared characters in alphabetical order. For example, give...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shared_chars('abc', 'def') == []\", \"assert shared_chars('hello', 'world') == ['l', 'o']\", \"assert shared_chars('TEST', 'test') == ['e', 's', 't']\", \"assert shared_chars('aBcDe', 'ABCDE') == ['a', 'b', 'c', 'd', 'e']\", \"assert shared_chars('abcXYZ', '...
{ "split": "train", "index": 67656, "acecode_id": "evol_89", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function that returns the median of a list of numerical values without sorting the list. The median is defined as the value that minimizes the absolute difference from the average of the list. You should handle both even and odd distributions of numbers in the input...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert median([3, 1, 2, 4, 5]) == 3\", \"assert median([1, 2, 3]) == 2\", \"assert median([5, 5, 5, 5]) == 5\", \"assert median([1, 3, 5, 7, 9]) == 5\", \"assert median([2, 4, 6, 8, 10]) == 6\", \"assert median([10, 20, 30, 25]) == 20.0\", \"assert median([100, 200...
{ "split": "train", "index": 67657, "acecode_id": "evol_15723", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given two lists of integers, `left` and `right`. Your task is to create a new list by 'broadcasting' values from the `right` list based on their indices in the `left` list. The `right` list will only contain unique values. You must create a new list where each element c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert broadcast([0, 1, 2], [10, 20, 30]) == [10, 20, 30]\", \"assert broadcast([0, 1, 2, 1], [10, 20, 30]) == [10, 20, 30, 20]\", \"assert broadcast([0, 1, 2, 3], [30, 40]) == [30, 40, None, None]\", \"assert broadcast([2, 2, 2], [10, 20]) == [None, None, None]\",...
{ "split": "train", "index": 67658, "acecode_id": "bigcode_python_fns_3415", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string and an integer as input and returns a custom representation of an object in the format 'CustomObject(name, value)'. This representation should mimic the behavior of a class's __repr__ method. Your function should be na...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert custom_repr('example', 10) == \\\"CustomObject('example', 10)\\\"\", \"assert custom_repr('test', 5) == \\\"CustomObject('test', 5)\\\"\", \"assert custom_repr('data', 0) == \\\"CustomObject('data', 0)\\\"\", \"assert custom_repr('sample', -1) == \\\"CustomO...
{ "split": "train", "index": 67659, "acecode_id": "oss_18362", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function `count_executable_files(permissions: List[str]) -> int` that takes a list of permission strings and returns the count of files that have executable permissions. Each permission string is of the form 'rwx', where each character represents t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_executable_files(['r--', 'r--', 'r--']) == 0\", \"assert count_executable_files(['rwx', 'rwx', 'rwx']) == 3\", \"assert count_executable_files(['---', '---', '---']) == 0\", \"assert count_executable_files(['r-x', 'r-x', 'r-x']) == 3\", \"assert count_...
{ "split": "train", "index": 67660, "acecode_id": "oss_3477", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with setting up a data processing pipeline for a machine learning project. Your function should accept a base data path and a dictionary of hyperparameters. Write a Python function `setup_data_pipeline(data_path, hyper_par)` that takes two parameters: \n- `data_p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert setup_data_pipeline('/data/', {'learning_rate': 0.01, 'batch_size': 32}) == (['parsed_hyperparameters'], '/data/patches/source/', '/data/patches/reference/', '/data/models/')\", \"assert setup_data_pipeline('/train/', {'num_epochs': 50}) == (['parsed_hyperpa...
{ "split": "train", "index": 67661, "acecode_id": "oss_36215", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of timestamps represented as strings in the format 'YYYY-MM-DD HH:MM:SS', write a function that returns a tuple containing the earliest and latest timestamps. The timestamps are guaranteed to be in chronological order. If the list is empty, return (None, None).\nPl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_start_and_end_time(['2023-01-01 12:00:00', '2023-01-02 12:00:00', '2023-01-03 12:00:00']) == ('2023-01-01 12:00:00', '2023-01-03 12:00:00')\", \"assert get_start_and_end_time(['2022-12-31 23:59:59', '2023-01-01 00:00:01']) == ('2022-12-31 23:59:59', '202...
{ "split": "train", "index": 67662, "acecode_id": "bigcode_python_fns_47505", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `add_two_lists(list1, list2)` that takes in two lists of integers and returns a new list where each element is the sum of the corresponding elements from the input lists. If the lists are of different lengths, the shorter list should be padded with zeros at...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_two_lists([1, 2, 3], [4, 5, 6]) == [5, 7, 9]\", \"assert add_two_lists([1, 2], [3, 4, 5]) == [4, 6, 5]\", \"assert add_two_lists([], [1, 2, 3]) == [1, 2, 3]\", \"assert add_two_lists([1, 2, 3], []) == [1, 2, 3]\", \"assert add_two_lists([1, 2, 3], [0]) =...
{ "split": "train", "index": 67663, "acecode_id": "evol_20233", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `intersperse` that takes a list of integers `numbers` and an integer `delimeter`. The function should return a new list where the `delimeter` is inserted between every pair of successive elements from the `numbers` list. If the `delimeter` is negative, inte...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert intersperse([], 4) == []\", \"assert intersperse([1, 2, 3], 4) == [1, 4, 2, 4, 3]\", \"assert intersperse([5, 6, 7, 8], 0) == [5, 0, 6, 0, 7, 0, 8]\", \"assert intersperse([10], 3) == [10]\", \"assert intersperse([1, 2], -1) == [1, 2]\", \"assert intersperse...
{ "split": "train", "index": 67664, "acecode_id": "evol_28717", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of polling location records represented as dictionaries. Each polling location may contain the keys 'we_vote_id', 'line1', 'city', 'state', 'polling_location_id', 'location_name', 'polling_hours_text', 'directions_text', 'line2', and 'zip_long'. Your task i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_polling_locations([]) == {'success': True, 'status': 'POLLING_LOCATIONS_IMPORT_PROCESS_COMPLETE', 'saved': 0, 'updated': 0, 'not_processed': 0}\", \"assert process_polling_locations([{'we_vote_id': '1', 'line1': '123 Main St', 'city': 'Sample City', ...
{ "split": "train", "index": 67665, "acecode_id": "bigcode_python_fns_47690", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a Python function that calculates and returns the sum of these integers along with a status message that indicates whether the input list was non-empty. The function should return a dictionary with the following keys: 'result' for the sum of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_integers([1, 2, 3, 4, 5]) == {'result': 15, 'status': 'success'}\", \"assert process_integers([-1, -2, -3]) == {'result': -6, 'status': 'success'}\", \"assert process_integers([0, 0, 0]) == {'result': 0, 'status': 'success'}\", \"assert process_integ...
{ "split": "train", "index": 67666, "acecode_id": "oss_12228", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `text` and a substring `substring`, implement a function that determines the frequency of occurrences of the substring within the text. The substring can have a length ranging from 2 to 6 characters, and overlapping occurrences should be counted. The substring is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_substring_frequency('abraacadabrabracabracabracabra', 'br') == 6\", \"assert find_substring_frequency('abraacadabrabracabracabracabra', 'ada') == 1\", \"assert find_substring_frequency('ababababab', 'ab') == 5\", \"assert find_substring_frequency('hello...
{ "split": "train", "index": 67667, "acecode_id": "evol_25057", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing API message IDs. Your task is to implement a function that removes the specified ID from the list and returns a new list of remaining IDs. If the specified ID is not present in the original list, return the list unchanged. Implement...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_api_msg([1, 2, 3, 4, 5], 3) == [1, 2, 4, 5]\", \"assert remove_api_msg([1, 1, 2, 3, 1], 1) == [2, 3]\", \"assert remove_api_msg([4, 5, 6], 7) == [4, 5, 6]\", \"assert remove_api_msg([], 1) == []\", \"assert remove_api_msg([1, 2, 3, 2, 1], 2) == [1, 3,...
{ "split": "train", "index": 67668, "acecode_id": "bigcode_python_fns_12567", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You need to implement a function `register_module()` that registers a module in a hypothetical registry. The function should set up a parser for content verification and establish specific routes for handling requests. The function should return a dictionary that contains the m...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert register_module() == {'name': 'Course', 'description': 'FAQ Module', 'attributes': [], 'routes': [('/faq', utils_faq.FaqHandler), ('/allresources', utils_allresources.AllResourcesHandler)]}\", \"assert type(register_module()) == dict\", \"assert 'name' in re...
{ "split": "train", "index": 67669, "acecode_id": "bigcode_python_fns_13939", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of student scores, where each inner list contains the scores of a student across different subjects. Write a function `top_students(scores, N)` that processes this list and returns the top N students based on their average scores. The function should also c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert top_students([[95, 95], [95, 95], [95, 95]], 2) == ([(0, 95.0), (1, 95.0)], 95.0, [])\", \"assert top_students([[100], [90], [80], [70]], 2) == ([(0, 100.0), (1, 90.0)], 85.0, [2, 3])\", \"assert top_students([[40, 50, 60], [60, 70, 80], [80, 90, 100]], 2) =...
{ "split": "train", "index": 67670, "acecode_id": "oss_16302", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of strings, implement a function `check_anagrams(lst)` that checks if each consecutive pair of strings in the list are anagrams of each other. The function should return a list of tuples, where each tuple contains the pair of strings and a boolean indicating whethe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_anagrams(['bombe', 'bemob', 'pin', 'nip', 'bin', 'nib']) == [('bombe', 'bemob', True), ('pin', 'nip', True), ('bin', 'nib', True)]\", \"assert check_anagrams(['listen', 'silent', 'evil', 'vile']) == [('listen', 'silent', True), ('evil', 'vile', True)]\...
{ "split": "train", "index": 67671, "acecode_id": "evol_6012", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes a paragraph as input and identifies any unique rare typographical symbols it contains. A typographical symbol is considered rare if it is not an alphanumeric character and is not included in a predefined list of common symbols. The function should re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert detect_rare_symbols('Just a simple paragraph with no symbols.', [' ', '.', ',', '!', '?', ';', ':', '-', '\\\\'', '\\\"']) == []\", \"assert detect_rare_symbols('Testing with some emojis \\ud83d\\ude0a, \\ud83d\\ude80, and symbols \\u00a9, \\u2122.', [' ', '...
{ "split": "train", "index": 67672, "acecode_id": "evol_27315", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to process a list of payment transactions in Python. Each transaction is represented as a dictionary with the following keys: 'payer', 'iban', 'bic', 'id', and 'amount'. The 'payer' key holds the name of the payer in the format 'Last,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_transactions([]) == {'total_transactions': 0, 'total_amount': Decimal('0.00'), 'unique_payers': [], 'unique_iban': [], 'unique_bic': [], 'unique_ids': []}\", \"assert process_transactions([{ 'payer': 'Doe, John', 'iban': 'DE111111111111111111111', 'b...
{ "split": "train", "index": 67673, "acecode_id": "oss_9428", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Write a Python function that calculates the 'n' th Fibonacci number using memoization to optimize for large inputs (n <= 10^6). The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. Your function should return the nth Fibonacci ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fib(0) == 0\", \"assert fib(1) == 1\", \"assert fib(2) == 1\", \"assert fib(3) == 2\", \"assert fib(4) == 3\", \"assert fib(5) == 5\", \"assert fib(6) == 8\", \"assert fib(7) == 13\", \"assert fib(8) == 21\", \"assert fib(9) == 34\", \"assert fib(10) == 55\"...
{ "split": "train", "index": 67674, "acecode_id": "evol_1805", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a square matrix, implement a function that calculates the number of unique elements located on the anti-diagonal of the matrix. The anti-diagonal of a matrix is defined as the diagonal that runs from the top-right corner to the bottom-left corner. For example, in a 3x3 ma...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_diagonal_elements([[2, 4, 6], [3, 5, 1], [7, 3, 9]]) == 3\", \"assert unique_diagonal_elements([[1, 2], [3, 4]]) == 2\", \"assert unique_diagonal_elements([[5]]) == 1\", \"assert unique_diagonal_elements([[1, 1], [1, 1]]) == 1\", \"assert unique_diago...
{ "split": "train", "index": 67675, "acecode_id": "evol_12103", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function `upload_to_bucket(bucket_name: str, source_file_name: str, destination_blob_name: str) -> str` that simulates the upload of a file to a Google Cloud Storage bucket. The function should return a string indicating that the file has been uploaded successfully....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert upload_to_bucket('my_bucket', '/path/to/my/file.jpg', 'new_file.jpg') == 'File /path/to/my/file.jpg uploaded to new_file.jpg.'\", \"assert upload_to_bucket('test_bucket', '/local/file.txt', 'file_in_bucket.txt') == 'File /local/file.txt uploaded to file_in_b...
{ "split": "train", "index": 67676, "acecode_id": "evol_34501", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of a group of people. Your task is to implement a function `can_form_triangle(heights)` that determines whether any three people can form a triangle with their heights. A triangle can be formed if the sum of the lengths ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert can_form_triangle([3, 4, 5]) == True\", \"assert can_form_triangle([1, 2, 3]) == False\", \"assert can_form_triangle([5, 10, 25]) == False\", \"assert can_form_triangle([7, 10, 5]) == True\", \"assert can_form_triangle([6, 8, 10]) == True\", \"assert can_for...
{ "split": "train", "index": 67677, "acecode_id": "oss_20929", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a tree-like dictionary structure representing a node in an abstract syntax tree (AST), implement a function that retrieves the name of the node. The node can have a 'name' key which is a string, or it can have a 'parts' key containing a list of strings. If the node has a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_name({'name': 'example'}) == 'example'\", \"assert get_name({'parts': ['part1', 'part2', 'part3']}) == 'part1.part2.part3'\", \"assert get_name({'name': 'test', 'parts': ['partA', 'partB']}) == 'test'\", \"assert get_name({'parts': []}) == ''\", \"assert...
{ "split": "train", "index": 67678, "acecode_id": "bigcode_python_fns_14888", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of Roman numerals, implement a function `construct_doubly_linked_list(roman_numerals: List[str]) -> List[str]` that constructs a doubly linked list containing these Roman numerals in ascending order based on their integer values. The function should return the list...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert construct_doubly_linked_list(['I', 'I', 'V']) == ['I', 'I', 'V']\", \"assert construct_doubly_linked_list(['M', 'M', 'D', 'C']) == ['C', 'D', 'M', 'M']\", \"assert construct_doubly_linked_list(['L', 'X', 'I']) == ['I', 'X', 'L']\", \"assert construct_doubly_...
{ "split": "train", "index": 67679, "acecode_id": "evol_1325", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the linear and angular velocities of a differential drive robot based on the angular velocities of its two wheels and its current angular position. You are given the following parameters: the radius of the robot's wheels (in meters), the distance...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_velocity_and_position(0.2, 0.4, 0.0, 0.0, 0.0, 2.0) == (0.0, 0.0, 0.0)\", \"assert calculate_velocity_and_position(0.1, 0.5, 2.0, 2.0, 0.0, 0.5) == (0.2, 0.0, 0.0)\", \"assert calculate_velocity_and_position(0.3, 0.5, 1.0, 1.0, 0.0, 0.5) == (0.3, 0...
{ "split": "train", "index": 67680, "acecode_id": "oss_12856", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given an integer, implement a function `even_odd_sum_and_count(num)` that returns a dictionary containing the sums and counts of even and odd digits within the input integer. The output should be in the following format: { 'even': {'sum' : sum_of_even_digits, 'count' : count_of...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert even_odd_sum_and_count(-12) == {'even': {'sum': 2, 'count': 1}, 'odd': {'sum': 1, 'count': 1}}\", \"assert even_odd_sum_and_count(123) == {'even': {'sum': 2, 'count': 1}, 'odd': {'sum': 4, 'count': 2}}\", \"assert even_odd_sum_and_count(2468) == {'even': {'s...
{ "split": "train", "index": 67681, "acecode_id": "evol_15843", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_disparity(lst: List[List[Union[int, float, str]]]) -> Union[int, float, str]` that calculates the disparity between the maximum and minimum numerical values present in a provided list of lists. The function should ignore any non-numerical values,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_disparity([[1, 2, 3], [4, 5, 6]]) == 5\", \"assert calculate_disparity([[1.5, 2.5, 3.5], [4.0, 5.0]]) == 3.5\", \"assert calculate_disparity([[10, 'a', 20], [30.0, None]]) == 20\", \"assert calculate_disparity([[1, 2, 'text', 3.5], [], [4]]) == 3\"...
{ "split": "train", "index": 67682, "acecode_id": "evol_33425", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a URL, implement a function `is_absolute_url(url: str) -> bool` that determines whether the URL is an absolute URL or a relative URL. An absolute URL is one that contains a scheme (like 'http', 'https', 'ftp', etc.) and is fully qualified, while a re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_absolute_url('http://example.com') == True\", \"assert is_absolute_url('https://www.google.com/search') == True\", \"assert is_absolute_url('ftp://files.example.com/resource') == True\", \"assert is_absolute_url('file:///C:/path/to/file.txt') == True\", \...
{ "split": "train", "index": 67683, "acecode_id": "bigcode_python_fns_6245", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two strings, determine if they are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once. Implement a function `are_anagrams(string1: str, string2: str) -> bool` ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert are_anagrams('listen', 'silent') == True\", \"assert are_anagrams('triangle', 'integral') == True\", \"assert are_anagrams('apple', 'papel') == True\", \"assert are_anagrams('rat', 'car') == False\", \"assert are_anagrams('evil', 'vile') == True\", \"assert ...
{ "split": "train", "index": 67684, "acecode_id": "evol_18507", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with generating a string that represents a folder structure containing a specified number of valid image files. Each image file should have a specific resolution and number of channels. Write a function `generate_image_folder_structure(n_files: int, resolution: T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_image_folder_structure(6, (300, 300), 4) == 'folder_with_6_images_300x300_4channels'\", \"assert generate_image_folder_structure(1, (640, 480), 3) == 'folder_with_1_images_640x480_3channels'\", \"assert generate_image_folder_structure(10, (1920, 108...
{ "split": "train", "index": 67685, "acecode_id": "bigcode_python_fns_37515", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that removes all words from a given string that contain a specified letter. The function should take a string `text` and a character `target_letter` as inputs and return a new string with the words containing the `target_letter` removed. Words are defined as se...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_words_containing_letter('This is a test', 'i') == 'a test'\", \"assert remove_words_containing_letter('A quick brown fox', 'z') == 'A quick brown fox'\", \"assert remove_words_containing_letter('The quick brown fox jumps over the lazy dog', 'a') == 'T...
{ "split": "train", "index": 67686, "acecode_id": "evol_16589", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Write a function that returns the indices of the two smallest prime numbers in a list of integers and floats. The list can contain both negative and positive integers, as well as decimal numbers. If there are less than two prime numbers in the list, return an empty list.\nPleas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert smallest_pair_primes([4,6,8,10,2,3,13.5,1,5,-2,-11,5,-7]) == [(4, 2), (5, 3)]\", \"assert smallest_pair_primes([10,20,30]) == []\", \"assert smallest_pair_primes([-1, -2, -3]) == []\", \"assert smallest_pair_primes([0, 1, 4, 6]) == []\", \"assert smallest_pa...
{ "split": "train", "index": 67687, "acecode_id": "evol_7456", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string representing a database filename and returns a tuple containing a mock cursor and a mock connection object. The mock cursor should simply return a string 'cursor' when called, and the mock connection object should retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_mock_db_objects('test.db') == ('cursor', 'connection')\", \"assert get_mock_db_objects('sample.db') == ('cursor', 'connection')\", \"assert get_mock_db_objects('data.sqlite') == ('cursor', 'connection')\", \"assert get_mock_db_objects('my_database.db') =...
{ "split": "train", "index": 67688, "acecode_id": "bigcode_python_fns_7716", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to implement a function that returns a new list containing only the integers from the original list that are greater than a specified threshold value. The function should handle both positive and negative integers. Implement the fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_above_threshold([1, 2, 3, 4, 5], 3) == [4, 5]\", \"assert filter_above_threshold([-1, -2, -3, 0, 1], 0) == [1]\", \"assert filter_above_threshold([10, 20, 30], 25) == [30]\", \"assert filter_above_threshold([0, 0, 0, 0], 0) == []\", \"assert filter_ab...
{ "split": "train", "index": 67689, "acecode_id": "bigcode_python_fns_46470", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of employee dictionaries, each containing the keys 'name', 'age', 'role', 'experience', and 'active', write a function `average_age_experience` that calculates and returns the average age and average years of experience of all currently active employees in the list...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert average_age_experience([{'name': 'Michael', 'age': 40, 'role': 'Manager', 'experience': 5, 'active': True}, {'name': 'Jim', 'age': 30, 'role': 'Salesman', 'experience': 3, 'active': True}, {'name': 'Pam', 'age': 28, 'role': 'Secretary', 'experience': 2, 'act...
{ "split": "train", "index": 67690, "acecode_id": "evol_34475", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing class IDs and an integer representing an interesting class ID (in the range [0, 2]), return the count of occurrences of the interesting class ID in the list. The function should be defined as `def count_interesting_class(class_ids: List[int...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_interesting_class([0, 1, 2, 0, 1, 2], 0) == 2\", \"assert count_interesting_class([0, 1, 2, 0, 1, 2], 1) == 2\", \"assert count_interesting_class([0, 1, 2, 0, 1, 2], 2) == 2\", \"assert count_interesting_class([0, 0, 0, 0, 0], 0) == 5\", \"assert count...
{ "split": "train", "index": 67691, "acecode_id": "bigcode_python_fns_6863", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `manage_list` that accepts a list of integers and a series of operations (as a list of tuples). Each operation is represented as a tuple where the first element is a string indicating the type of operation ('add' or 'remove'), the second element is an integ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_list([1, 2, 3], [('add', 4), ('remove', 2), ('add', 5)]) == [1, 3, 4, 5]\", \"assert manage_list([], [('add', 1), ('add', 2)]) == [1, 2]\", \"assert manage_list([5, 10], [('remove', 15)]) == [5, 10]\", \"assert manage_list([1, 2, 3], [('remove', 1), (...
{ "split": "train", "index": 67692, "acecode_id": "evol_2293", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a dice game. Your program should take two integers as input, representing the results of rolling two dice (each ranging from 1 to 6). Your task is to determine if the two integers are equal. If they are equal, return the string \"You rolled a doub...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert dice_game(1, 1) == 'You rolled a double!'\", \"assert dice_game(2, 2) == 'You rolled a double!'\", \"assert dice_game(3, 3) == 'You rolled a double!'\", \"assert dice_game(4, 4) == 'You rolled a double!'\", \"assert dice_game(5, 5) == 'You rolled a double!'\...
{ "split": "train", "index": 67693, "acecode_id": "oss_26187", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that validates and extracts IPv4 and IPv6 addresses from a given input string. The function should return a tuple containing the extracted IPv4 and IPv6 addresses. IPv4 addresses are represented in the standard dot-decimal notation...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_ip('This is a test string with no IP addresses.') == ('', '')\", \"assert extract_ip('Invalid IP 256.256.256.256 and valid 2001:0db8:85a3:0000:0000:8a2e:0370:7334') == ('', '2001:0db8:85a3:0000:0000:8a2e:0370:7334')\", \"assert extract_ip('Just a ran...
{ "split": "train", "index": 67694, "acecode_id": "oss_2386", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a dictionary representing the information of an application. Your task is to implement a function `get_app_version(app_info: dict) -> str` that retrieves the application version from the dictionary. The dictionary will contain a key 'app_version' which holds a str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_app_version({'app_version': '4.2.6'}) == '4.2.6'\", \"assert get_app_version({'app_version': '1.0.0'}) == '1.0.0'\", \"assert get_app_version({'app_version': '3.5.1'}) == '3.5.1'\", \"assert get_app_version({'app_version': '2.3.4'}) == '2.3.4'\", \"asser...
{ "split": "train", "index": 67695, "acecode_id": "bigcode_python_fns_3621", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `find_sequence(input_list)` that finds the longest increasing contiguous sequences of integers within the list. The function should return a list of tuples, where each tuple contains the starting index of the sequence and the sequence ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_sequence([1, 2, 3, 4, 5]) == [(0, [1, 2, 3, 4, 5])]\", \"assert find_sequence([1]) == [(0, [1])]\", \"assert find_sequence([-1, 0, 1, 2]) == [(0, [-1, 0, 1, 2])]\", \"assert find_sequence([-5, -3, -2, -1, 0, 1]) == [(0, [-5, -3, -2, -1, 0, 1])]\", \"ass...
{ "split": "train", "index": 67696, "acecode_id": "evol_6649", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Write a function that converts a day of the year (1-365) into its corresponding date in the format DD-MMM-YYYY. Assume the year is 2021.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block." } ]
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert day_to_date(1) == '01-Jan-2021'\", \"assert day_to_date(31) == '31-Jan-2021'\", \"assert day_to_date(32) == '01-Feb-2021'\", \"assert day_to_date(59) == '28-Feb-2021'\", \"assert day_to_date(60) == '01-Mar-2021'\", \"assert day_to_date(90) == '31-Mar-2021'\"...
{ "split": "train", "index": 67697, "acecode_id": "evol_24345", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary where each key is a unique string and each value is an integer. Your task is to implement a function `get_key_by_value(val: int, data: dict) -> str` that returns the key associated with the given integer value from the dictionary. If the value does no...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_key_by_value(1, {'a': 1, 'b': 2, 'c': 3}) == 'a'\", \"assert get_key_by_value(2, {'a': 1, 'b': 2, 'c': 3}) == 'b'\", \"assert get_key_by_value(3, {'a': 1, 'b': 2, 'c': 3}) == 'c'\", \"assert get_key_by_value(4, {'a': 1, 'b': 2, 'c': 3}) == ''\", \"assert...
{ "split": "train", "index": 67698, "acecode_id": "bigcode_python_fns_26482", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two arrays of integers, write a function that returns the average of all unique integers present in both arrays. If both arrays are empty or if there are no unique integers, the function should return 0.\nPlease reason step by step, then write a self-contained Python solu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_avg([1, 2, 3], [4, 5, 6]) == 3.5\", \"assert unique_avg([1, 1, 1], [2, 2, 2]) == 1.5\", \"assert unique_avg([], []) == 0\", \"assert unique_avg([1, 2, 3], []) == 2.0\", \"assert unique_avg([], [4, 5, 6]) == 5.0\", \"assert unique_avg([7, 8, 9], [8, 9,...
{ "split": "train", "index": 67699, "acecode_id": "evol_1002", "num_tests": 16 }