data_source
large_stringclasses
1 value
prompt
listlengths
1
1
ability
large_stringclasses
1 value
reward_model
dict
extra_info
dict
acecode
[ { "role": "user", "content": "Given a string consisting of lowercase and uppercase letters, implement a function that translates each letter of the string to its corresponding letter in a predefined translation dictionary. The translation should ignore non-alphabetic characters and return a new string with ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert translate_to_fictional('Hello') == 'Hello'\", \"assert translate_to_fictional('abc') == 'abc'\", \"assert translate_to_fictional('XYZ') == 'XYZ'\", \"assert translate_to_fictional('Translate 123!') == 'Translate'\", \"assert translate_to_fictional('Python3.8...
{ "split": "train", "index": 5800, "acecode_id": "evol_17545", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function called `reverse_words` that takes a list of words as input and reverses the order of the words in the list without using any built-in functions or methods. Additionally, ignore any stopwords such as 'is', 'this', 'an', 'the', 'in', 'a', 'on', 'and' while revers...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_words(['word', 'one', 'is', 'this']) == ['one', 'word']\", \"assert reverse_words(['hello', 'world']) == ['world', 'hello']\", \"assert reverse_words(['this', 'is', 'a', 'test']) == ['test']\", \"assert reverse_words(['the', 'quick', 'brown', 'fox'])...
{ "split": "train", "index": 5801, "acecode_id": "evol_11089", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the haplotypes of individuals in a genetic dataset. Each haplotype is a binary representation of genes, where '1' indicates the presence of a specific allele and '0' indicates its absence. Your task is to implement a function that c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_haplotypes([1, 0, 1, 0, 1]) == 2\", \"assert count_unique_haplotypes([1, 1, 1, 1, 1]) == 1\", \"assert count_unique_haplotypes([0, 0, 0, 0, 0]) == 1\", \"assert count_unique_haplotypes([1, 0, 1, 0, 1, 1, 0]) == 2\", \"assert count_unique_haploty...
{ "split": "train", "index": 5802, "acecode_id": "bigcode_python_fns_32795", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that extracts suitable entries from a list of text strings based on specific criteria. The function should take a list of raw text entries as input and return a list of entries that meet the criteria. The criteria for suitable entr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_entries(['short', 'long enough entry']) == ['long enough entry']\", \"assert extract_entries(['tiny', 'small', 'adequate length']) == ['adequate length']\", \"assert extract_entries(['1', '22', '333', '4444', '55555', '666666']) == []\", \"assert ext...
{ "split": "train", "index": 5803, "acecode_id": "oss_2370", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with classifying wildlife species based on their scientific names. Implement a function `classify_species` that takes a string input representing the scientific name of a species (in the format 'Genus species') and returns the classification of that species as on...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert classify_species('Felis catus') == 'Mammalia'\", \"assert classify_species('Canis lupus') == 'Mammalia'\", \"assert classify_species('Gallus gallus') == 'Aves'\", \"assert classify_species('Crocodylus niloticus') == 'Reptilia'\", \"assert classify_species('V...
{ "split": "train", "index": 5804, "acecode_id": "evol_19310", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that generates a scaled gradient for a given numerical value. The gradient is calculated by scaling the input value by a specified maximum gradient value. Your function should take the following parameters: \n- `f_h`: A numerical valu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_scaled_gradient(0.5, 1.0, 0.01) == 0.5\", \"assert generate_scaled_gradient(1.0, 1.0, 0.01) == 1.0\", \"assert generate_scaled_gradient(2.0, 1.0, 0.01) == 'Gradient too large'\", \"assert generate_scaled_gradient(-1.0, 1.0, 0.01) == -1.0\", \"assert...
{ "split": "train", "index": 5805, "acecode_id": "oss_35698", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if a given string is a valid identifier in Python. An identifier is a name used to identify a variable, function, class, module, or other object. A valid identifier must follow these rules: 1. It can only contain alphanumeric ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_identifier('valid_identifier') == True\", \"assert is_valid_identifier('anotherValid123') == True\", \"assert is_valid_identifier('_leadingUnderscore') == True\", \"assert is_valid_identifier('2startWithDigit') == False\", \"assert is_valid_identifi...
{ "split": "train", "index": 5806, "acecode_id": "bigcode_python_fns_42842", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a list of mocked presets based on the input arguments. The function should take a variable number of string arguments and return a list where each string argument is transformed into a MockPreset object. Each MockPreset obj...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_mocked_presets('preset1') == [{'value': 'preset1'}]\", \"assert generate_mocked_presets('preset1', 'preset2') == [{'value': 'preset1'}, {'value': 'preset2'}]\", \"assert generate_mocked_presets('presetA', 'presetB', 'presetC') == [{'value': 'presetA...
{ "split": "train", "index": 5807, "acecode_id": "bigcode_python_fns_26626", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of materials, where each material is represented by a dictionary containing its 'name', 'formula', and 'properties'. The function should return a new list containing only the materials that have a specific property w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_materials_by_property([{'name': 'Silicon', 'formula': 'Si', 'properties': {'density': 2.33}}, {'name': 'Copper', 'formula': 'Cu', 'properties': {'density': 8.96}}], 'density', 2.33) == [{'name': 'Silicon', 'formula': 'Si', 'properties': {'density': 2....
{ "split": "train", "index": 5808, "acecode_id": "oss_30717", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with counting the total number of parameters in a neural network model. Given a list of tuples where each tuple represents the shape of a layer's parameters in the model (e.g., (input_size, output_size)), implement a function `count_parameters(layers: List[Tuple[...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_parameters([(1, 2), (2, 0), (0, 3)], False) == 2\", \"assert count_parameters([], True) == 0\", \"assert count_parameters([], False) == 0\", \"assert count_parameters([(10, 0)], True) == 0\", \"assert count_parameters([(10, 0), (5, 5)], False) == 25\",...
{ "split": "train", "index": 5809, "acecode_id": "bigcode_python_fns_27475", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the total observation time based on the number of bins in the field of view offset and the observation time for individual events. Write a Python function `calculate_total_observation_time` that takes in two parameters: `fov_offset_bins`, which i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_total_observation_time(10, 100) == 1000\", \"assert calculate_total_observation_time(5, 60) == 300\", \"assert calculate_total_observation_time(0, 50) == 0\", \"assert calculate_total_observation_time(15, 10) == 150\", \"assert calculate_total_obse...
{ "split": "train", "index": 5810, "acecode_id": "oss_37405", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `text` and a substring `sub`, write a function that counts the number of non-overlapping occurrences of `sub` in `text`. The function should only consider the substring `sub` that appears in the original string `text`, without any specified start or end indices. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_str('hello world', 'lo') == 1\", \"assert count_str('abababab', 'aba') == 2\", \"assert count_str('abcabcabc', 'abc') == 3\", \"assert count_str('aaaaaa', 'aa') == 3\", \"assert count_str('xyzxyzxyz', 'xyz') == 3\", \"assert count_str('abcdefg', 'h') =...
{ "split": "train", "index": 5811, "acecode_id": "bigcode_python_fns_10185", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing a list of text entries to label them based on a predefined set of labels. Write a function `label_text_entries(data_set: List[Tuple[str, str]], labels: List[str]) -> List[Tuple[str, str]]` that takes a list of text entries along with their corresp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert label_text_entries([('Hello world', ''), ('Python programming', 'Programming')], ['Greeting', 'Programming']) == [('Hello world', 'Greeting'), ('Python programming', 'Programming')]\", \"assert label_text_entries([('Text without label', ''), ('Another text',...
{ "split": "train", "index": 5812, "acecode_id": "bigcode_python_fns_36727", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function called `draw_circle` that creates a 20x20 grid representing a circle using ASCII characters. The circle should have a diameter of 10 characters, centered within the grid. The grid should be represented as a 2D list of character...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert len(draw_circle()) == 20\", \"assert all(len(row) == 20 for row in draw_circle())\", \"assert draw_circle()[10][10] == 'o'\", \"assert draw_circle()[8][10] == ' '\", \"assert draw_circle()[12][10] == ' '\", \"assert draw_circle()[10][8] == ' '\", \"assert dr...
{ "split": "train", "index": 5813, "acecode_id": "oss_5988", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that manages a collection of patches for a given bundle. Your function should take a bundle ID and a list of patch IDs, and return a list of patch IDs that includes both the provided patch IDs and the existing patch IDs associated with th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_patches('bundle1', ['patch3', 'patch4']) == ['patch3', 'patch4', 'patch1', 'patch2']\", \"assert add_patches('bundle2', ['patch1']) == ['patch1', 'patch3']\", \"assert add_patches('bundle3', ['patch5']) == ['patch5']\", \"assert add_patches('bundle1', []...
{ "split": "train", "index": 5814, "acecode_id": "bigcode_python_fns_41234", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design a function that manages the price data of multiple equities in a stock market. The function should allow you to add a new equity with its price and update the price of an existing equity. Additionally, it should return the minimum and maximum prices of the equities curre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_equities([('add', 'AAPL', 150), ('add', 'GOOG', 1200), ('update', 'AAPL', 155)]) == (155, 1200)\", \"assert manage_equities([('add', 'TSLA', 700), ('update', 'TSLA', 650), ('add', 'AMZN', 3300)]) == (650, 3300)\", \"assert manage_equities([]) == (None...
{ "split": "train", "index": 5815, "acecode_id": "evol_26599", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of sets, where each set contains sample identifiers belonging to a unique cluster. You also have a dictionary that maps sample identifiers to their respective external cluster identifiers. Your task is to create a function that processes the list of cluster...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_clusters([{'sample1', 'sample2', 'sample3'}], {'sample1': ['ext1'], 'sample2': ['ext1', 'ext2'], 'sample3': ['ext3']}, True) == {'sample1': {'ext1': ['ext1']}, 'sample2': {'ext1': ['ext1'], 'ext2': ['ext2']}, 'sample3': {'ext3': ['ext3']}}\", \"asser...
{ "split": "train", "index": 5816, "acecode_id": "bigcode_python_fns_21601", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Design a function that converts temperature from Celsius to Fahrenheit. The function should take a single parameter, `celsius_temperature`, which is a float representing the temperature in Celsius. The function should return the corresponding temperature in Fahrenheit, rounded ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert celsius_to_fahrenheit(0) == 32.00\", \"assert celsius_to_fahrenheit(100) == 212.00\", \"assert celsius_to_fahrenheit(30) == 86.00\", \"assert celsius_to_fahrenheit(-40) == -40.00\", \"assert celsius_to_fahrenheit(37) == 98.60\", \"assert celsius_to_fahrenhei...
{ "split": "train", "index": 5817, "acecode_id": "evol_24348", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that determines the encoding type of a given string based on the available system encoding. Your function should take a single string input and return 'utf-8' if the string can be encoded in UTF-8 without any errors. Otherwise, it should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_encoding('Hello, World!') == 'utf-8'\", \"assert check_encoding('\\u041f\\u0440\\u0438\\u0432\\u0435\\u0442, \\u043c\\u0438\\u0440!') == 'utf-8'\", \"assert check_encoding('\\u3053\\u3093\\u306b\\u3061\\u306f\\u4e16\\u754c') == 'utf-8'\", \"assert chec...
{ "split": "train", "index": 5818, "acecode_id": "bigcode_python_fns_37060", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a tuple containing three integers, your task is to write a Python function `generate_multiples(tuple2)` that takes a tuple of three integers as input and returns a list containing the first three positive multiples of the third integer in the tuple. The input tuple is str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_multiples((1, 2, 3)) == [3, 6, 9]\", \"assert generate_multiples((0, 0, 1)) == [1, 2, 3]\", \"assert generate_multiples((-1, -2, 5)) == [5, 10, 15]\", \"assert generate_multiples((10, 20, 2)) == [2, 4, 6]\", \"assert generate_multiples((1, 1, 10)) =...
{ "split": "train", "index": 5819, "acecode_id": "oss_8216", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string representation of a subscript operation used in array slicing in Python. Your task is to implement a function that takes this string as input and returns a list of the inferred slice values. The input string can contain ':' to represent a full slice, or c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert infer_subscript_values(':') == [None, None, None]\", \"assert infer_subscript_values(':3') == [None, 3, None]\", \"assert infer_subscript_values('1:5:2') == [1, 5, 2]\", \"assert infer_subscript_values('5:') == [5, None, None]\", \"assert infer_subscript_val...
{ "split": "train", "index": 5820, "acecode_id": "bigcode_python_fns_20117", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `find_emails(text: str) -> List[str]` that takes a string `text` as input and returns a list of all unique email identifiers found within the text. An email identifier is defined as a sequence of characters that follows the format 'local_part@domain', where...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_emails('Contact us at support@example.com for more info.') == ['support@example.com']\", \"assert find_emails('Here are two emails: test.email@gmail.com, test.email@gmail.com') == ['test.email@gmail.com']\", \"assert find_emails('No email here!') == []\...
{ "split": "train", "index": 5821, "acecode_id": "evol_29629", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `are_anagrams(str1: str, str2: str) -> bool` that checks if two given strings are anagrams of each other. The function should handle cases where the strings include numbers, special characters, and both lowercase and uppercase letters. Two strings are consi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert are_anagrams('abc#$', 'bc$#a') == True\", \"assert are_anagrams('Abc123', 'bAc321') == True\", \"assert are_anagrams('hello', 'world') == False\", \"assert are_anagrams('12345', '54321') == True\", \"assert are_anagrams('!@#$%', '%$#@!') == True\", \"assert ...
{ "split": "train", "index": 5822, "acecode_id": "evol_28306", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the total number of parameters in a convolutional neural network (CNN) layer. The function should take the input shape of the layer as a tuple in the format (filter_width, filter_height, input_channels, output_channels...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_cnn_parameters((3, 3, 3, 64)) == 1792\", \"assert calculate_cnn_parameters((5, 5, 1, 32)) == 832\", \"assert calculate_cnn_parameters((3, 3, 32, 32)) == 9248\", \"assert calculate_cnn_parameters((2, 2, 4, 8)) == 136\", \"assert calculate_cnn_parame...
{ "split": "train", "index": 5823, "acecode_id": "oss_19724", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function that counts the number of occurrences of a specified substring in a given string. The function should be case-sensitive and should return the total count of non-overlapping occurrences of the substring within the string.\nPlease reason step by step, then wr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_substring('Hello, there! Hello again! Oh hello!', 'Hello') == 2\", \"assert find_substring('abcabcabc', 'abc') == 3\", \"assert find_substring('Python programming', 'gram') == 1\", \"assert find_substring('This is a test. This test is only a test.', 'te...
{ "split": "train", "index": 5824, "acecode_id": "evol_34902", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of integers and returns a new list containing only the unique integers from the original list, maintaining the original order. The function should be named `get_unique_integers`. The input will be a list of integers,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_unique_integers([1, 2, 2, 3, 4, 4]) == [1, 2, 3, 4]\", \"assert get_unique_integers([5, 5, 5, 5, 5]) == [5]\", \"assert get_unique_integers([]) == []\", \"assert get_unique_integers([1, 2, 3]) == [1, 2, 3]\", \"assert get_unique_integers([1, 2, 2, 1, 3, ...
{ "split": "train", "index": 5825, "acecode_id": "oss_31513", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries, where each dictionary represents a build pair with a key 'jobpairs' that contains a list of job identifiers. Your task is to write a function that calculates the total number of job identifiers across all build pairs. Implement a function `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_job_pairs([{'jobpairs': ['job1', 'job2']}, {'jobpairs': ['job3', 'job4', 'job5']}]) == 5\", \"assert count_job_pairs([{'jobpairs': ['job1']}, {'jobpairs': []}, {'jobpairs': ['job2', 'job3', 'job4']}]) == 4\", \"assert count_job_pairs([{'jobpairs': []},...
{ "split": "train", "index": 5826, "acecode_id": "bigcode_python_fns_46021", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a configuration for a Django admin interface to manage customer data. Your goal is to set the site title and header to '客户管理' (which translates to 'Customer Management' in English) and register a model called `Customer` with an admin class named `Ad...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert admin_configuration() == \\\"from django.contrib import admin\\\\nfrom .models import Customer\\\\n\\\\nadmin.site.site_title = '\\u5ba2\\u6237\\u7ba1\\u7406'\\\\nadmin.site.site_header = '\\u5ba2\\u6237\\u7ba1\\u7406'\\\\n\\\\nclass AdminCustomer(admin.Mode...
{ "split": "train", "index": 5827, "acecode_id": "oss_24384", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array that may contain integers, floating point numbers, complex numbers, boolean values, None values, and nested arrays, write a function `find_min_disparity(arr)` that determines the least difference between any two numeric elements within the supplied array. The fun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_min_disparity([]) == 'Input array is empty or contains only one valid numeric value'\", \"assert find_min_disparity([1]) == 'Input array is empty or contains only one valid numeric value'\", \"assert find_min_disparity([None]) == 'Input array is empty o...
{ "split": "train", "index": 5828, "acecode_id": "evol_24019", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Design a Python function that accepts two strings as input - a main string and a search string - and returns the number of times the search string appears in the main string, including overlapping occurrences. For example, in the main string 'aaa' with the search string 'aa', t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert search_frequency('hellohello', 'lo') == 2\", \"assert search_frequency('abcabcabc', 'abc') == 3\", \"assert search_frequency('aaaaaa', 'aa') == 5\", \"assert search_frequency('abababab', 'abab') == 3\", \"assert search_frequency('mississippi', 'iss') == 2\",...
{ "split": "train", "index": 5829, "acecode_id": "evol_8613", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2x3 grid of axes, where each axis can have a title, x-label, y-label, and can also display a legend. Write a function `setup_axes(axarr: List[List[Axis]], edir: str, ysize: int, xsize: int, tick_size: int, legend_size: int, title_size: int)` that modifies the ax...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert setup_axes([[Axis(), Axis(), Axis()], [Axis(), Axis(), Axis()]], 'test_dir', 12, 10, 8, 5, 14) == None\", \"assert setup_axes([[Axis(), Axis(), Axis()], [Axis(), Axis(), Axis()]], 'example', 15, 11, 9, 6, 20) == None\", \"assert setup_axes([[Axis(), Axis(), ...
{ "split": "train", "index": 5830, "acecode_id": "bigcode_python_fns_21614", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of characters, implement a function `uppercase_characters(chars: List[str]) -> List[str]` that converts all characters in the list to uppercase. The function should return a new list containing the uppercase versions of the input characters. You can assume that the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert uppercase_characters(['a', 'b', 'c']) == ['A', 'B', 'C']\", \"assert uppercase_characters(['x', 'y', 'z']) == ['X', 'Y', 'Z']\", \"assert uppercase_characters(['a', 'e', 'i', 'o', 'u']) == ['A', 'E', 'I', 'O', 'U']\", \"assert uppercase_characters(['hello', ...
{ "split": "train", "index": 5831, "acecode_id": "bigcode_python_fns_33644", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a query parameter validation system for a web API. The system should enforce specific rules regarding the combination of query parameters and their values. The validation rules are as follows: 1. If the query parameter `exclude_fields` is provid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_query_parameters(False, False, [], False, 'param1', 'value1') is None\", \"assert validate_query_parameters(True, False, [], False, 'param2', 'value2') is None\", \"assert validate_query_parameters(False, True, [], False, 'param3', 'value3') is None...
{ "split": "train", "index": 5832, "acecode_id": "oss_27258", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that extracts an access token from a JSON-like dictionary. The dictionary contains various fields, and the access token is stored within the 'access_token' key. Write a function that takes this dictionary as input and returns the acce...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_access_token({'access_token': 'token123', 'expires_in': 3600}) == 'token123'\", \"assert extract_access_token({'access_token': 'abc.def.ghi', 'token_type': 'Bearer'}) == 'abc.def.ghi'\", \"assert extract_access_token({'expires_in': 7200}) == ''\", \"...
{ "split": "train", "index": 5833, "acecode_id": "oss_21521", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple scoring system for a board game based on a series of moves. Each move is represented as a tuple of two coordinates (start_x, start_y) and (end_x, end_y) on a 2D board. The scoring rules are as follows: \n- A legal move, which is moving ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_score([((0, 0), (1, 1))]) == 1\", \"assert calculate_score([((1, 1), (2, 2))]) == 1\", \"assert calculate_score([((1, 1), (3, 3))]) == 5\", \"assert calculate_score([((1, 1), (4, 4))]) == 5\", \"assert calculate_score([((1, 1), (1, 2))]) == 1\", \"...
{ "split": "train", "index": 5834, "acecode_id": "oss_25369", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, create a game field of size n x n, where each cell is represented as a string of three spaces (' '). Return a 2D list representing the field structure, where each element is a list containing a string representation of the cell. The valid values fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert choose_field_size(2) == []\", \"assert choose_field_size(6) == []\", \"assert choose_field_size(10) == []\", \"assert choose_field_size(0) == []\", \"assert choose_field_size(-1) == []\", \"assert choose_field_size(1) == []\", \"assert choose_field_size(3.5)...
{ "split": "train", "index": 5835, "acecode_id": "bigcode_python_fns_28865", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes an integer event_id representing an event and returns a list of dictionaries containing the reservation details for that event. Each dictionary should include the reservation_id (an integer) and an email (a string) of the perso...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_event_reservations(1) == [{'reservation_id': 1001, 'email': 'user1@example.com'}, {'reservation_id': 1002, 'email': 'user2@example.com'}]\", \"assert get_event_reservations(2) == [{'reservation_id': 1003, 'email': 'user3@example.com'}]\", \"assert get_ev...
{ "split": "train", "index": 5836, "acecode_id": "bigcode_python_fns_49187", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that organizes a collection of supercell states and transitions into a structured format. The input to your function will be a dictionary called `superdict`, which contains the following keys: 'states', 'transitions', 'transmapping', 'ind...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert organize_supercells({'states': {'a': {}, 'b': {}}, 'transitions': {'ab': ('a', 'b')} }) == ['State: a', 'State: b', 'Transition: ab (a -> b)']\", \"assert organize_supercells({'states': {'state1': {}, 'state2': {}}, 'transitions': {'t1': ('state1', 'state2')...
{ "split": "train", "index": 5837, "acecode_id": "bigcode_python_fns_928", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of user IDs and a list of group IDs, write a function that takes these two lists as input and returns a list of strings representing the user and group IDs in a specific format. Each user ID should be prefixed with 'u' and each group ID should be prefixed with 'g'....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_ids([1, 2, 3], [1, 2]) == ['u1', 'u2', 'u3', 'g1', 'g2']\", \"assert format_ids([], [1]) == ['g1']\", \"assert format_ids([1], []) == ['u1']\", \"assert format_ids([], []) == []\", \"assert format_ids([5, 10], [3, 6]) == ['u5', 'u10', 'g3', 'g6']\", \...
{ "split": "train", "index": 5838, "acecode_id": "bigcode_python_fns_42798", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Design a Python function that reverses a given list of integers in place. The function should not use any built-in reverse methods, slicing, or additional lists for storage. Implement the function `reverse_list(input_list)` which modifies the input list directly and returns it....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse_list([1, 2, 3, 4]) == [4, 3, 2, 1]\", \"assert reverse_list([10, 20, 30]) == [30, 20, 10]\", \"assert reverse_list([-1, 0, 1]) == [1, 0, -1]\", \"assert reverse_list([5]) == [5]\", \"assert reverse_list([]) == []\", \"assert reverse_list([2, 4, 6, 8,...
{ "split": "train", "index": 5839, "acecode_id": "evol_15424", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two distinct lists of integers and a target integer, write a function that finds if there is a pair in either of the arrays that sum up to the target integer and returns the indices of the pair from their respective arrays. If there are multiple pairs that meet the condit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_pair([8, 12], [3, 5, 7], 15) == [0, 2]\", \"assert find_pair([], [1, 2, 3], 4) == None\", \"assert find_pair([1, 2, 3], [], 4) == None\", \"assert find_pair([1, 2, 3], [4, 5, 6], 12) == None\", \"assert find_pair([2, 4, 6], [1, 3, 5], 9) == [1, 2]\", \"...
{ "split": "train", "index": 5840, "acecode_id": "evol_8564", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Write a function 'lcm_of_prime_factors' that takes two lists of integers as input - a list of prime numbers and a list of corresponding frequencies. The function should return the Least Common Multiple (LCM) of these prime factors raised to their respective frequencies using an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lcm_of_prime_factors([2, 7, 11], [2, 1, 1]) == 308\", \"assert lcm_of_prime_factors([5, 13], [1, 1]) == 65\", \"assert lcm_of_prime_factors([2, 3, 5, 7, 11], [1, 1, 1, 1, 1]) == 2310\", \"assert lcm_of_prime_factors([2, 3], [3, 3]) == 216\", \"assert lcm_of_...
{ "split": "train", "index": 5841, "acecode_id": "evol_31411", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Implement a function that returns the longest palindromic string from a nested list of strings. If there are multiple longest palindromic strings, return the last one encountered. If the list is empty, return None.\nPlease reason step by step, then write a self-contained Python...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert longest_palindromic_string([]) is None\", \"assert longest_palindromic_string(['aaa', ['bb', ['dad']]]) == 'dad'\", \"assert longest_palindromic_string(['level', ['deified', 'civic']]) == 'deified'\", \"assert longest_palindromic_string(['hello', ['world', [...
{ "split": "train", "index": 5842, "acecode_id": "evol_30156", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a two-dimensional grid represented as a list of lists, where each cell can either be 0 (unknown) or 1 (known), write a function `get_unknown_neighbors(grid: List[List[int]], x: int, y: int) -> List[Tuple[int, int]]` that returns a list of tuples representing the coordinat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_unknown_neighbors([[1, 1], [1, 1]], 0, 0) == []\", \"assert get_unknown_neighbors([[0]], 0, 0) == []\", \"assert get_unknown_neighbors([[1, 0, 1], [0, 0, 1], [1, 1, 1]], 0, 1) == [(1, 1)]\", \"assert get_unknown_neighbors([[0, 1], [0, 0], [1, 1]], 2, 0) ...
{ "split": "train", "index": 5843, "acecode_id": "bigcode_python_fns_6596", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Implement a function `find_second_smallest(arr)` that takes an array of numbers as input and returns the second smallest number along with its index. If the array has fewer than two valid numeric elements, or if there are no two distinct numeric values, the function should retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_second_smallest([5, 3, 1, 2]) == (2, 3)\", \"assert find_second_smallest([2, 2, 2]) == 'Invalid input. At least two distinct numeric elements are required.'\", \"assert find_second_smallest([1]) == 'Invalid input. At least two distinct numeric elements ...
{ "split": "train", "index": 5844, "acecode_id": "evol_18152", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `generate_alphanumeric_string(length: int) -> str` that generates a random alphanumeric string of a specified length. The string should consist of uppercase letters (A-Z) and digits (0-9).\nPlease reason step by step, then write a self-contained Python solution...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_alphanumeric_string(5).isalnum() and len(generate_alphanumeric_string(5)) == 5\", \"assert generate_alphanumeric_string(10).isalnum() and len(generate_alphanumeric_string(10)) == 10\", \"assert generate_alphanumeric_string(0) == ''\", \"assert gener...
{ "split": "train", "index": 5845, "acecode_id": "evol_32301", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with developing a function that calculates the adjusted spent time for a list of tasks represented as dictionaries. Each task has a 'spent_time' key which is a float representing the time spent on the task. Your function should round the adjusted spent time to fo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_adjusted_spent_time([{ 'spent_time': 5.0 }, { 'spent_time': 10.0 }, { 'spent_time': 20.0 }]) == [7.5, 12.0, 24.0]\", \"assert calculate_adjusted_spent_time([{ 'spent_time': 0.0 }, { 'spent_time': 8.0 }, { 'spent_time': 15.0 }]) == [0.0, 12.0, 18.0]...
{ "split": "train", "index": 5846, "acecode_id": "oss_26800", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given a real number or a list of real numbers, compute the inverse cosine (arccos) of each element. The arccos function should return a real number in the interval [0, π] for values in the range [-1, 1]. For values outside this range, return the complex principal value. Impleme...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert arccos(1) == 0.0\", \"assert arccos(-1) == 3.141592653589793\", \"assert arccos(0) == 1.5707963267948966\", \"assert arccos(0.5) == 1.0471975511965979\", \"assert arccos(-0.5) == 2.0943951023931957\", \"assert arccos([1, 0, -1]) == [0.0, 1.5707963267948966, ...
{ "split": "train", "index": 5847, "acecode_id": "bigcode_python_fns_33663", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a formatted string for a person, given their name, age, and job title. The function should take three parameters: a string 'name', an integer 'age', and a string 'job_title'. The function should return a string in the forma...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_person_string('Alice', 30, 'Engineer') == 'Alice, 30 years old, is a Engineer'\", \"assert generate_person_string('Bob', 25, 'Designer') == 'Bob, 25 years old, is a Designer'\", \"assert generate_person_string('Charlie', 40, 'Manager') == 'Charlie, ...
{ "split": "train", "index": 5848, "acecode_id": "evol_33282", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings, each representing a word followed by a comma and a number that indicates the length of the word. Your task is to sort the list based on the length of the word in ascending order. If two words have the same length, they should be sorted lexicogra...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_words_by_length([\\\"iii,18\\\", \\\"jjj,18\\\", \\\"abc,3\\\", \\\"def,3\\\", \\\"xy,2\\\"]) == [\\\"xy,2\\\", \\\"abc,3\\\", \\\"def,3\\\", \\\"iii,18\\\", \\\"jjj,18\\\"]\", \"assert sort_words_by_length([\\\"apple,5\\\", \\\"banana,6\\\", \\\"kiwi,4...
{ "split": "train", "index": 5849, "acecode_id": "oss_9919", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `manage_database(operations: List[Tuple[str, Any]]) -> Tuple[List[str], List[Any]]` that simulates basic CRUD operations on a simple database of key-value pairs. The function should take a list of operations where each operation is re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_database([('insert', 'a', 1), ('insert', 'b', 2)]) == (['a', 'b'], [1, 2])\", \"assert manage_database([('insert', 'a', 1), ('get', 'a')]) == (['a'], [1])\", \"assert manage_database([('insert', 'a', 1), ('update', 'a', 2)]) == (['a'], [2])\", \"asser...
{ "split": "train", "index": 5850, "acecode_id": "oss_1415", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a list of todo items, where each todo is represented as a dictionary containing keys and values that describe its attributes. Your task is to implement a function `filter_todos(todos: List[Dict[str, Any]], filters: Dict[str, Any]) -> List[Dict[str, Any]]` that ret...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_todos([{'task': 'Buy milk', 'priority': 'high'}, {'task': 'Read book', 'priority': 'medium'}, {'task': 'Write code', 'priority': 'low'}], {'priority': 'high'}) == [{'task': 'Buy milk', 'priority': 'high'}]\", \"assert filter_todos([{'task': 'Buy milk'...
{ "split": "train", "index": 5851, "acecode_id": "bigcode_python_fns_20552", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates adding arguments to a command-line interface (CLI) for managing AWS load balancers. The function should take a dictionary representing an argument parser and add specific arguments for load balancer management functionality...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert 'list_loadbalancers' in arg_parser\", \"assert 'delete_loadbalancer' in arg_parser\", \"assert 'health_check' in arg_parser\", \"assert len(arg_parser) == 3\"]}" }
{ "split": "train", "index": 5852, "acecode_id": "oss_2414", "num_tests": 4 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the loan amounts requested by borrowers. Your task is to implement a function `calculate_average_loan_amount(loan_amounts: List[int]) -> float` that returns the average loan amount requested. If the input list is empty, your functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_loan_amount([1000, 2000, 3000]) == 2000.0\", \"assert calculate_average_loan_amount([500, 1500, 2500, 3500]) == 2000.0\", \"assert calculate_average_loan_amount([100, 200, 300]) == 200.0\", \"assert calculate_average_loan_amount([10000, 200...
{ "split": "train", "index": 5853, "acecode_id": "evol_20720", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the Fibonacci number at a given index using recursion and memoization. The function should not use any looping structures (like for, while, etc.) or arrays. It should take a single integer input and return the Fibonacci number at that index....
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": 5854, "acecode_id": "evol_16261", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of gemstones, each represented by a string of characters. Each gemstone has a specific color represented by the characters in the string. Your task is to find the minimum number of characters that need to be removed from the gemstones in the list so that ea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert min_seconds_to_palindrome(['a', 'b', 'c']) == 0\", \"assert min_seconds_to_palindrome(['aaa', 'aaa', 'aaa']) == 0\", \"assert min_seconds_to_palindrome(['xyzzyx', 'xy', 'zyx']) == 3\", \"assert min_seconds_to_palindrome(['abcdeedcba', 'abcdefg']) == 6\", \"a...
{ "split": "train", "index": 5855, "acecode_id": "oss_25537", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given three strings X, Y, and Z, write a function `lcs_of_three_strings(X: str, Y: str, Z: str) -> int` that returns the length of the longest common subsequence (LCS) among the three strings. The comparison should be case-sensitive and should account for special characters. Yo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lcs_of_three_strings('abc', 'abc', 'abc') == 3\", \"assert lcs_of_three_strings('abc', 'def', 'ghi') == 0\", \"assert lcs_of_three_strings('xyz', 'xzy', 'zyx') == 1\", \"assert lcs_of_three_strings('hello', 'world', 'hold') == 1\", \"assert lcs_of_three_stri...
{ "split": "train", "index": 5856, "acecode_id": "evol_12442", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the number of time series tiles produced by different processes. Your task is to write a function `merge_time_series(tiles: List[int]) -> List[int]` that merges the time series tiles by summing the corresponding elements from the li...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_time_series([2, 3, 5]) == [2, 3, 5]\", \"assert merge_time_series([0, 0, 0]) == [0, 0, 0]\", \"assert merge_time_series([1]) == [1]\", \"assert merge_time_series([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert merge_time_series([3, 2, 1, 4]) == [3, 2, ...
{ "split": "train", "index": 5857, "acecode_id": "bigcode_python_fns_35318", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the average of a list of position values for stationary samples. Given a list of positions, your function should return the average value rounded to four decimal places. If the list is empty, return None. Implement a f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_position([1.0, 2.0, 3.0]) == 2.0\", \"assert calculate_average_position([4.5, 5.5, 6.5, 7.5]) == 6.0\", \"assert calculate_average_position([-1.0, -2.0, -3.0]) == -2.0\", \"assert calculate_average_position([0.0]) == 0.0\", \"assert calcula...
{ "split": "train", "index": 5858, "acecode_id": "oss_37628", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that calculates the total memory usage of GPUs in a system based on a list of memory usage values. The function should be called `calculate_total_memory_usage` and take a list of integers as input, where each integer represents...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_total_memory_usage([100, 200, 300]) == 600\", \"assert calculate_total_memory_usage([0, 0, 0]) == 0\", \"assert calculate_total_memory_usage([128, 256, 512]) == 896\", \"assert calculate_total_memory_usage([1024]) == 1024\", \"assert calculate_tota...
{ "split": "train", "index": 5859, "acecode_id": "oss_20483", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a sparse matrix represented in COO (Coordinate) format. The matrix is defined by three components: a list of row indices, a list of column indices, and a list of corresponding non-zero values. Your task is to convert this representation into a more compact format ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_sparse_matrix([0, 1, 2], [0, 2, 1], [1, 2, 3]) == [[1, 0, 0], [0, 0, 2], [0, 3, 0]]\", \"assert convert_sparse_matrix([0], [0], [7]) == [[7]]\", \"assert convert_sparse_matrix([1], [1], [6]) == [[0, 0], [0, 6]]\", \"assert convert_sparse_matrix([1, 0...
{ "split": "train", "index": 5860, "acecode_id": "bigcode_python_fns_26900", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a non-negative integer n, implement a function that counts the number of prime numbers less than n. A prime number is defined as a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. Your function should take an integer n and re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_primes(0) == 0\", \"assert count_primes(1) == 0\", \"assert count_primes(2) == 0\", \"assert count_primes(3) == 1\", \"assert count_primes(4) == 2\", \"assert count_primes(10) == 4\", \"assert count_primes(20) == 8\", \"assert count_primes(30) == 10\",...
{ "split": "train", "index": 5861, "acecode_id": "evol_23260", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a string `pattern` that represents a light pattern name and two floating-point numbers `delay` and `pause`. Your task is to implement a function `start_light_pattern(pattern: str, delay: float, pause: float) -> str`. The function should return an empty string if t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert start_light_pattern('', 0.1, 0.5) == ''\", \"assert start_light_pattern('Blink', 0.1, 0.5) == 'Pattern started: Blink, Delay: 0.1, Pause: 0.5'\", \"assert start_light_pattern('Fade', 0.2, 1.0) == 'Pattern started: Fade, Delay: 0.2, Pause: 1.0'\", \"assert st...
{ "split": "train", "index": 5862, "acecode_id": "bigcode_python_fns_44726", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `send_request(api_service: str) -> dict` that takes the URL of an ML API service as input, sends a GET request to that URL, and returns the JSON response as a dictionary. If the request fails or returns an error, the function should return None. Please ensu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert send_request('https://api.example.com/nonexistent') is None\", \"assert send_request('https://api.example.com/bad_request') is None\", \"assert send_request('https://api.example.com/service5') is None\", \"assert send_request('https://api.example.com/service...
{ "split": "train", "index": 5863, "acecode_id": "evol_34173", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a string that may contain letters, numbers, and special characters. Your task is to create a function that removes any non-alphabetic characters (excluding spaces) from the string and returns the cleaned string with leading and trailing spaces removed. Write a fun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert clean_string('JOHN SMITH 2000') == 'JOHN SMITH'\", \"assert clean_string('ALICE 123!@#') == 'ALICE'\", \"assert clean_string('BOB ') == 'BOB'\", \"assert clean_string(' CHARLIE') == 'CHARLIE'\", \"assert clean_string(' DAVE 1234!') == 'DAVE'\", \"assert...
{ "split": "train", "index": 5864, "acecode_id": "bigcode_python_fns_40652", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `validate_key_iv(key_iv: str) -> bytes` that checks whether the provided key or initialization vector (IV) is valid. The function should perform the following validations: 1. If `key_iv` is None or not a string, raise a TypeError with the message 'Parameter...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_key_iv('123456789012345') == b'123456789012345'\", \"assert validate_key_iv('valid_key') == b'valid_key'\", \"assert validate_key_iv('a' * 16) == b'a' * 16\", \"assert validate_key_iv('key') == b'key'\", \"assert validate_key_iv('1234') == b'1234'\"...
{ "split": "train", "index": 5865, "acecode_id": "bigcode_python_fns_24239", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Develop a Python function that takes a list of integers as input, processes the integers by summing them up, and returns the total sum. The function should handle exceptions that may arise from invalid input types and ensure that only integers are processed. If the input list i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_integers([1, 2, 3, 4, 5]) == 15\", \"assert sum_integers([-1, -2, -3]) == -6\", \"assert sum_integers([0, 0, 0]) == 0\", \"assert sum_integers([]) == 0\", \"assert sum_integers([1, -1, 2, -2]) == 0\", \"assert sum_integers([10]) == 10\", \"assert sum_int...
{ "split": "train", "index": 5866, "acecode_id": "evol_371", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of strings, where each string represents a unique geographical location. Your task is to write a function that accepts this list and returns a dictionary where the keys are the unique locations and the values are the counts of how many times each location a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_locations(['New York', 'Los Angeles', 'New York', 'Chicago', 'Los Angeles']) == {'New York': 2, 'Los Angeles': 2, 'Chicago': 1}\", \"assert count_locations(['Paris', 'Paris', 'Rome']) == {'Paris': 2, 'Rome': 1}\", \"assert count_locations(['Tokyo', 'To...
{ "split": "train", "index": 5867, "acecode_id": "bigcode_python_fns_33312", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a function that takes this list as input and returns a new list containing only the even numbers from the original list, in the same order they appeared. If there are no even numbers, return an empty list. Write a function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([6, 7, 8, 9, 10]) == [6, 8, 10]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([0, 1, 2, 3]) == [0, ...
{ "split": "train", "index": 5868, "acecode_id": "oss_12261", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function called `limited_set_final_elements`. This function represents a set with a maximum capacity. The function should take an integer `capacity` and a list of elements to add to the set. The elements should be added to the set with the fol...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert limited_set_final_elements(1, ['A', 'B', 'C']) == ['C']\", \"assert limited_set_final_elements(4, ['M', 'N', 'O', 'P', 'Q']) == ['M', 'N', 'O', 'Q']\", \"assert limited_set_final_elements(5, []) == []\", \"assert limited_set_final_elements(5, ['A', 'B', 'A',...
{ "split": "train", "index": 5869, "acecode_id": "oss_23160", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that extracts the values from the list at the specified indices. The function should take two parameters: a list of integers 'values' and a list of indices 'indices'. The function should return a new list containing the elements from '...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_values([1, 2, 3, 4, 5], [0, 2, 4]) == [1, 3, 5]\", \"assert extract_values([10, 20, 30, 40], [1, 0, 3]) == [20, 10, 40]\", \"assert extract_values([5, 6, 7, 8], [2, 2, 1]) == [7, 7, 6]\", \"assert extract_values([0, 1, 2], [3, 2]) == [2]\", \"assert ...
{ "split": "train", "index": 5870, "acecode_id": "bigcode_python_fns_26639", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the behavior of a routing method in a web framework. The function should accept a routing rule as a string and an optional keyword argument `auto_store_subjects` which is a boolean. If `auto_store_subjects` is set to `True`...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert route('/home') == 'Route set without enhancements'\", \"assert route('/about', auto_store_subjects=True) == 'Route enhanced with subject wrapping'\", \"assert route('/contact') == 'Route set without enhancements'\", \"assert route('/products', auto_store_sub...
{ "split": "train", "index": 5871, "acecode_id": "oss_6030", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that determines if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequences of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Implement a function ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('racecar') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('Was it a car or a cat I saw?') == True\", \"assert is_palindrome('Hello, W...
{ "split": "train", "index": 5872, "acecode_id": "bigcode_python_fns_44444", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simple banking transaction system. You need to implement a function `bank_account_transactions(transactions: List[Tuple[str, int]]) -> int` that processes a list of transactions on a bank account. The transactions are represented as tuples, wher...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bank_account_transactions([('deposit', 100), ('withdraw', 50)]) == 50\", \"assert bank_account_transactions([('deposit', 200), ('withdraw', 300)]) == 200\", \"assert bank_account_transactions([('withdraw', 100)]) == 0\", \"assert bank_account_transactions([(...
{ "split": "train", "index": 5873, "acecode_id": "oss_5543", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a feed updater module for a social media platform. This module should be able to handle various types of feed updates, including text posts, image posts, and video posts. Each type of post has specific attributes. Your task is to create a functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_feed([]) == 'No posts available.'\", \"assert update_feed([('text', 'Hello World!')]) == 'Text Post: Hello World!'\", \"assert update_feed([('image', 'http://example.com/image.jpg', 'A beautiful sunset')]) == 'Image Post: http://example.com/image.jpg ...
{ "split": "train", "index": 5874, "acecode_id": "oss_31727", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that configures a logger based on given settings. The function `configure_logging` takes a dictionary `conf` that contains two keys: 'loglevel' (a string representing the logging level) and 'logtostderr' (a boolean indicating whether to l...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert configure_logging({'loglevel': 'DEBUG', 'logtostderr': True}) == 'Log level set to DEBUG. Logging to stderr'\", \"assert configure_logging({'loglevel': 'INFO', 'logtostderr': False}) == 'Log level set to INFO. Not logging to stderr'\", \"assert configure_log...
{ "split": "train", "index": 5875, "acecode_id": "bigcode_python_fns_35218", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Develop a function that identifies the rarest element in a provided list and calculates its frequency relative to the total number of elements. If there are multiple elements with the same least frequency, the function should return a list of these elements along with their rel...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rarest_elements([1, 2, 3, 4, 5]) == [(1, 0.2), (2, 0.2), (3, 0.2), (4, 0.2), (5, 0.2)]\", \"assert rarest_elements([1, 1, 2, 3, 3]) == [(2, 0.2)]\", \"assert rarest_elements([]) == []\", \"assert rarest_elements([1, 1, 1, 2, 2, 3]) == [(3, 0.1666666666666666...
{ "split": "train", "index": 5876, "acecode_id": "evol_33179", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with checking if two dictionaries are identical in terms of their keys and values. Write a function `are_dicts_equal(dict1: Dict[str, Any], dict2: Dict[str, Any]) -> bool`, where `dict1` and `dict2` are dictionaries that can contain string keys and any type of va...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert are_dicts_equal({}, {}) == True\", \"assert are_dicts_equal({'key1': 'value1'}, {'key1': 'value1'}) == True\", \"assert are_dicts_equal({'key1': 'value1'}, {'key1': 'value2'}) == False\", \"assert are_dicts_equal({'a': 1, 'b': 2}, {'b': 2, 'a': 1}) == True\"...
{ "split": "train", "index": 5877, "acecode_id": "bigcode_python_fns_11744", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Develop a Python function that takes an integer n as input and returns the product of all prime numbers less than or equal to n. If there are no prime numbers less than or equal to n, return 1.\nPlease reason step by step, then write a self-contained Python solution. Give your ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert product_of_primes(1) == 1\", \"assert product_of_primes(2) == 2\", \"assert product_of_primes(3) == 6\", \"assert product_of_primes(4) == 6\", \"assert product_of_primes(5) == 30\", \"assert product_of_primes(6) == 30\", \"assert product_of_primes(7) == 210\...
{ "split": "train", "index": 5878, "acecode_id": "evol_33966", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the deletion of a mapping. The function should take a mapping as input and return a boolean indicating whether the deletion was successful. If the mapping is None, the function should return False. If the mapping is a v...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert delete_mapping(None) == False\", \"assert delete_mapping('mapping_1') == True\", \"assert delete_mapping('') == True\", \"assert delete_mapping('mapping_2') == True\", \"assert delete_mapping('test_mapping') == True\", \"assert delete_mapping('mapping_3') ==...
{ "split": "train", "index": 5879, "acecode_id": "bigcode_python_fns_22755", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates a simple HTTP response code generator. The function should take an integer input representing an HTTP response code and return the corresponding HTTP response message as a string. The known HTTP response codes and th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_http_response_code(200) == 'OK'\", \"assert generate_http_response_code(201) == 'Created'\", \"assert generate_http_response_code(204) == 'No Content'\", \"assert generate_http_response_code(301) == 'Moved Permanently'\", \"assert generate_http_resp...
{ "split": "train", "index": 5880, "acecode_id": "oss_11103", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create the function: \n\ndef median(l: list, cmp_func: callable):\n \"\"\"Returns the median of nested list and tuple elements in 'l' avoiding sorting or inbuilt functions. \n Handles duplicates, tuples characterized by even and uneven number, employs cmp_func for compari...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert median([[3, 1], 2, 4, 5], lambda a, b: a - b) == 3\", \"assert median([1, [2, 2], 4, 5], lambda a, b: a - b) == 2\", \"assert median([1, 2, 3, 4, 5], lambda a, b: a - b) == 3\", \"assert median([1, [2, 3], 4, 5, [6, 7]], lambda a, b: a - b) == 4\", \"assert ...
{ "split": "train", "index": 5881, "acecode_id": "evol_29636", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a string representing a class name of a window, implement a function that returns the length of the class name. If the given class name is longer than 1024 characters, return 1024. The function should handle any unicode characters. The function will be defined as follows:...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_class_name_length('WindowClass') == 11\", \"assert get_class_name_length('A' * 500) == 500\", \"assert get_class_name_length('A' * 1024) == 1024\", \"assert get_class_name_length('A' * 1025) == 1024\", \"assert get_class_name_length('') == 0\", \"assert ...
{ "split": "train", "index": 5882, "acecode_id": "bigcode_python_fns_2569", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function `fib_memo(n: int) -> int` that calculates the nth Fibonacci number using memoization. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and for n > 1, F(n) = F(n-1) + F(n-2). Your function should return the nth Fibonacci number.\nPlease reas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fib_memo(0) == 0\", \"assert fib_memo(1) == 1\", \"assert fib_memo(2) == 1\", \"assert fib_memo(3) == 2\", \"assert fib_memo(4) == 3\", \"assert fib_memo(5) == 5\", \"assert fib_memo(6) == 8\", \"assert fib_memo(7) == 13\", \"assert fib_memo(8) == 21\", \"as...
{ "split": "train", "index": 5883, "acecode_id": "evol_32594", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `clear_figures` that clears all marks and axes from a given figure object. The figure object is represented as a dictionary with the following structure: {'marks': List, 'axes': List, 'axis_registry': Dict}. The function should also r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert clear_figures({'marks': [1, 2, 3], 'axes': [4, 5], 'axis_registry': {'x': 1}}, {'scales': {'scale1': 1}, 'current_key': 'key1', 'scale_registry': {'key1': {'scale1': 1}}}) is None\", \"assert clear_figures({'marks': [], 'axes': [], 'axis_registry': {}}, {'sc...
{ "split": "train", "index": 5884, "acecode_id": "bigcode_python_fns_38710", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a URL routing system for a web application using Django. Your goal is to define URL patterns for various views in the application. Each URL pattern should map to a specific view function and have a unique name associated with it. Given the following...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_url_patterns() == [('^comment/(?P<pk>\\\\d+)/approve/$', 'comment_approve', 'comment_approve'), ('^comment/(?P<pk>\\\\d+)/remove/$', 'comment_remove', 'comment_remove'), ('^acercademi/$', 'acerca_de_mi', 'acerca_de_mi')]\", \"assert len(generate_url...
{ "split": "train", "index": 5885, "acecode_id": "oss_8247", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of a series of buildings. Your task is to implement a function `max_height(buildings: List[int]) -> int` that returns the maximum height among the buildings. If the list is empty, return 0. The function should only proce...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_height([3, 5, 1, 2, 4]) == 5\", \"assert max_height([10, 20, 30]) == 30\", \"assert max_height([1, 2, 3, 4, 5]) == 5\", \"assert max_height([5, 3, 8, 1, 4]) == 8\", \"assert max_height([7]) == 7\", \"assert max_height([]) == 0\", \"assert max_height([0, ...
{ "split": "train", "index": 5886, "acecode_id": "bigcode_python_fns_41137", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to implement a function `gcd_multi` that calculates the greatest common divisor (GCD) of all the integers in the list. The function should take a list of integers as an input and return the GCD. Implement the following function: \n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert gcd_multi([12, 15, 21]) == 3\", \"assert gcd_multi([100, 200, 300]) == 100\", \"assert gcd_multi([17, 34, 51]) == 17\", \"assert gcd_multi([7, 14, 28, 49]) == 7\", \"assert gcd_multi([1, 2, 3, 4, 5]) == 1\", \"assert gcd_multi([48, 64, 16]) == 16\", \"assert...
{ "split": "train", "index": 5887, "acecode_id": "oss_6832", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the product of all elements in a given list of non-negative floating-point numbers. The function should take a list of numbers as input and return a single floating-point number representing the product of the numbers....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_product([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]) == 5040.0\", \"assert calculate_product([0.0, 1.0, 2.0]) == 0.0\", \"assert calculate_product([2.0, 3.0]) == 6.0\", \"assert calculate_product([]) == 1.0\", \"assert calculate_product([1.5, 2.0, 3.0]) ==...
{ "split": "train", "index": 5888, "acecode_id": "bigcode_python_fns_46883", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates saving a product in an e-commerce system. The function should perform the following operations: First, it should log that the product is being saved. Then, it should invoke a hypothetical method called `save_product` to...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert save_product('Laptop') == 'Product Laptop has been saved successfully.'\", \"assert save_product('Smartphone') == 'Product Smartphone has been saved successfully.'\", \"assert save_product('Headphones') == 'Product Headphones has been saved successfully.'\",...
{ "split": "train", "index": 5889, "acecode_id": "oss_32004", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers `a`, your task is to implement a function `build_min_heap(a)` that converts the given array into a min-heap and returns the resulting min-heap array. A min-heap is a complete binary tree where the value of each node is less than or equal to the values...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert build_min_heap([5, 3, 8, 4, 1, 2]) == [1, 3, 2, 4, 5, 8]\", \"assert build_min_heap([10, 20, 15, 30, 40]) == [10, 20, 15, 30, 40]\", \"assert build_min_heap([3, 1, 6, 5, 2, 4]) == [1, 2, 4, 5, 3, 6]\", \"assert build_min_heap([7]) == [7]\", \"assert build_mi...
{ "split": "train", "index": 5890, "acecode_id": "oss_13022", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer x, write a function `solve(x)` that reverses the digits of the integer and returns the reversed integer. If the reversed integer exceeds the 32-bit signed integer range, return 0. The function should handle both positive and negative integers. For example, if t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert solve(123) == 321\", \"assert solve(-123) == -321\", \"assert solve(0) == 0\", \"assert solve(100) == 1\", \"assert solve(-100) == -1\", \"assert solve(1534236469) == 0\", \"assert solve(-1534236469) == 0\", \"assert solve(2147483647) == 0\", \"assert solve(...
{ "split": "train", "index": 5891, "acecode_id": "oss_326", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer `num`, write a function `isUgly(num)` that determines whether `num` is an ugly number. An ugly number is defined as a positive integer whose only prime factors are 2, 3, and 5. The function should return `True` if `num` is an ugly number, and `False` ot...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert isUgly(1) == True\", \"assert isUgly(2) == True\", \"assert isUgly(3) == True\", \"assert isUgly(4) == True\", \"assert isUgly(5) == True\", \"assert isUgly(6) == True\", \"assert isUgly(8) == True\", \"assert isUgly(9) == True\", \"assert isUgly(10) == True...
{ "split": "train", "index": 5892, "acecode_id": "oss_33277", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two sorted lists of integers, `list1` and `list2`, write a function `merge_sorted` that returns a new sorted list containing all elements from both `list1` and `list2`. The function should take two parameters: `list1` and `list2`, both of which are lists of integers. Your...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_sorted([1, 3, 5], [2, 4, 6]) == [1, 2, 3, 4, 5, 6]\", \"assert merge_sorted([], [1, 2, 3]) == [1, 2, 3]\", \"assert merge_sorted([1, 2, 3], []) == [1, 2, 3]\", \"assert merge_sorted([1, 2, 3], [0]) == [0, 1, 2, 3]\", \"assert merge_sorted([5, 10, 15], ...
{ "split": "train", "index": 5893, "acecode_id": "evol_24960", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of files and directories represented as a list of tuples. Each tuple contains either a file name and its size in bytes or a directory name and the number of files it contains. Your function should take this list as i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_files_and_directories([('file1.txt', 1200), ('file2.jpg', 2500), ('dir1', 5)]) == ['File: file1.txt, Size: 1200 bytes', 'File: file2.jpg, Size: 2500 bytes', 'Directory: dir1, Number of files: 5']\", \"assert process_files_and_directories([('file3.doc...
{ "split": "train", "index": 5894, "acecode_id": "oss_790", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that returns the current time in the format \"HH MM SS\" (hours, minutes, seconds). Your function should utilize the built-in time module to fetch the current local time and format it accordingly. The function should not take any paramete...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert isinstance(get_current_time(), str)\", \"assert len(get_current_time()) == 8\", \"assert get_current_time()[2] == ' '\", \"assert get_current_time()[5] == ' '\", \"assert all(part.isdigit() for part in get_current_time().split())\", \"assert all(0 <= int(par...
{ "split": "train", "index": 5895, "acecode_id": "oss_6532", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a grid representation of a simple environment for a reinforcement learning agent. The grid is defined by a 2D list, where each cell can either be occupied (represented by 1) or empty (represented by 0). Your task is to impl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert render_grid([[0, 0], [0, 0]]) == ['..', '..']\", \"assert render_grid([[1, 0], [0, 1]]) == ['#.', '.#']\", \"assert render_grid([[1, 1], [1, 1]]) == ['##', '##']\", \"assert render_grid([[0, 1], [1, 0]]) == ['.#', '#.']\", \"assert render_grid([[0]]) == ['.'...
{ "split": "train", "index": 5896, "acecode_id": "oss_31149", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `below_threshold(l: list, t: int) -> bool` that checks if all integers in a given list `l` are less than or equal to a specified integer threshold `t`. The function should ignore any non-integer elements in the list. Return `True` if all integers are within...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert below_threshold([1, 2, '4', 10], 100) == True\", \"assert below_threshold([1, 20, 4, '10'], 5) == False\", \"assert below_threshold([5, 10, 15], 15) == True\", \"assert below_threshold([], 10) == True\", \"assert below_threshold(['a', 'b', 'c'], 5) == True\"...
{ "split": "train", "index": 5897, "acecode_id": "evol_3478", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that calculates the natural logarithm of 1 plus the input value using a specific transformation. The transformation involves using a helper function, which returns 1 plus the input if the input is greater than or equal to 0, an...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert log_exp1p(0.5) == 0.4054651081081644\", \"assert log_exp1p(0) == 0.0\", \"assert log_exp1p(1) == 0.6931471805599453\", \"assert log_exp1p(10) == 2.3978952727983707\", \"assert log_exp1p(100) == 4.61512051684126\", \"assert log_exp1p(2) == 1.0986122886681098\...
{ "split": "train", "index": 5898, "acecode_id": "oss_32481", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given two n-by-n matrices represented as lists of lists, implement a function `subtract_matrices(matrix1, matrix2)` that performs the subtraction of these matrices. Validate if both matrices are n-by-n and return an error message if they are not. If they are valid, return a new...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert subtract_matrices([[1]], [[1]]) == [[0]]\", \"assert subtract_matrices([[2, 3], [4, 5]], [[1, 1], [1, 1]]) == [[1, 2], [3, 4]]\", \"assert subtract_matrices([[10]], [[5]]) == [[5]]\", \"assert subtract_matrices([[0, 0], [0, 0]], [[0, 0], [0, 0]]) == [[0, 0],...
{ "split": "train", "index": 5899, "acecode_id": "evol_27720", "num_tests": 15 }