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 3D list (matrix) of dimensions m x n x 3, where each element is a list containing three string representations of integers, implement a function `to_int(matrix)` that converts each string representation in the matrix to its integer equivalent. The function should return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert to_int([[['1', '2', '3'], ['4', '5', '6']]]) == [[[1, 2, 3], [4, 5, 6]]]\", \"assert to_int([[['0', '0', '0'], ['0', '0', '0']]]) == [[[0, 0, 0], [0, 0, 0]]]\", \"assert to_int([[['-1', '2', '3'], ['4', '-5', '6']]]) == [[[-1, 2, 3], [4, -5, 6]]]\", \"assert...
{ "split": "train", "index": 70900, "acecode_id": "bigcode_python_fns_6700", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the number of nodes in each layer of a neural network and an integer representing the phase (0 for training and 1 for testing), return a dictionary that maps each layer to its corresponding output nodes. The output nodes for each layer are ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_layer_outputs([3, 5, 2], 0) == {'layer_0': ['layer_1'], 'layer_1': ['layer_2'], 'layer_2': []}\", \"assert get_layer_outputs([4, 6, 1, 3], 1) == {'layer_0': ['layer_1'], 'layer_1': ['layer_2'], 'layer_2': ['layer_3'], 'layer_3': []}\", \"assert get_layer...
{ "split": "train", "index": 70901, "acecode_id": "bigcode_python_fns_44532", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given two lists, `bad_cube_counts` and `bad_cube_maximums`. Each list represents the number of bad cubes of various types and the maximum allowed cubes of those types, respectively. Your task is to implement a function `is_all_maxed_out(bad_cube_counts: List[int], bad_c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_all_maxed_out([3, 5, 2], [3, 5, 2]) == True\", \"assert is_all_maxed_out([3, 5, 1], [3, 5, 2]) == False\", \"assert is_all_maxed_out([0, 0, 0], [0, 0, 0]) == True\", \"assert is_all_maxed_out([2, 2, 2], [2, 3, 2]) == False\", \"assert is_all_maxed_out([4,...
{ "split": "train", "index": 70902, "acecode_id": "bigcode_python_fns_18929", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that manages different types of environments for a simulation program. Your function should take a list of environment types as input, add them to a list of supported environments, and return the final list of supported environments. Addi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_environments(['OneWaypointEnv', 'IncentArrivalEnv'], False) == ['OneWaypointEnv', 'IncentArrivalEnv']\", \"assert manage_environments(['StaticObstacleEnv'], False) == ['StaticObstacleEnv']\", \"assert manage_environments(['NoGforcePenaltyEnv'], True) ...
{ "split": "train", "index": 70903, "acecode_id": "oss_13480", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of lists, where each inner list represents a subset of integers. Your task is to write a function `is_partition_empty(partition)` that takes a list `partition` as input and returns `True` if the partition is empty (i.e., the list contains no subsets), and `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_partition_empty([]) == True\", \"assert is_partition_empty([[1, 2], [3, 4]]) == False\", \"assert is_partition_empty([[], []]) == False\", \"assert is_partition_empty([[5]]) == False\", \"assert is_partition_empty([[1], [2], [3]]) == False\", \"assert is_...
{ "split": "train", "index": 70904, "acecode_id": "oss_21426", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a non-empty list of numbers, write a function that computes the scaled mean and scaled standard deviation of the list. The function should take two parameters: the list of numbers and a scaling factor. The mean is defined as the average of the numbers, and the standard de...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mean_std_dev([1, 2, 3], 1) == (2.0, 0.816496580927726)\", \"assert mean_std_dev([10, 20, 30], 2) == (40.0, 16.32993161855452)\", \"assert mean_std_dev([5], 3) == (15.0, 0.0)\", \"assert mean_std_dev([1, 2, 3, 4, 5], 1) == (3.0, 1.4142135623730951)\", \"asser...
{ "split": "train", "index": 70905, "acecode_id": "bigcode_python_fns_3632", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that checks if a given key is absent in a specified dictionary. The function should take two parameters: a key and a dictionary. Your function should return `True` if the key is not present in the dictionary, and `False` if the key is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert expect('x', {'a': 1, 'b': 2, 'c': 3}) == True\", \"assert expect('a', {'a': 1, 'b': 2, 'c': 3}) == False\", \"assert expect('b', {'a': 1, 'b': 2, 'c': 3}) == False\", \"assert expect('c', {'a': 1, 'b': 2, 'c': 3}) == False\", \"assert expect('y', {}) == True...
{ "split": "train", "index": 70906, "acecode_id": "oss_5808", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a nested dictionary representing a schema, where each key is a field name and the value is either a string (representing the field type) or another nested dictionary representing sub-fields. Your task is to flatten this schema into a single dictionary where each k...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten_schema({'field1': 'type1', 'field2': {'subfield1': 'type2', 'subfield2': 'type3'}}) == {'field1': 'type1', 'field2.subfield1': 'type2', 'field2.subfield2': 'type3'}\", \"assert flatten_schema({'fieldA': {'subfieldA1': 'typeA1'}, 'fieldB': 'typeB'}) =...
{ "split": "train", "index": 70907, "acecode_id": "bigcode_python_fns_40388", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a Python function that calculates the factorial of a given non-negative integer n. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 is 5! = 5 × 4 × 3 × 2 × 1 = 120. Your function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(...
{ "split": "train", "index": 70908, "acecode_id": "evol_5695", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `manage_phone_numbers` that takes a list of operations, each represented as a tuple. The first element of the tuple is a string indicating the operation to perform: 'add', 'remove', 'check', or 'smallest'. The second element is the phone number (as a string...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_phone_numbers([('add', '1234567890'), ('add', '9876543210'), ('check', '1234567890')]) == [True]\", \"assert manage_phone_numbers([('add', '1234567890'), ('add', '9876543210'), ('remove', '1234567890'), ('check', '1234567890')]) == [False]\", \"assert...
{ "split": "train", "index": 70909, "acecode_id": "evol_31802", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a factory function that initializes an object of a class named `AuxSubfieldsPoroelasticity`. Your function should be named `auxiliary_subfields` and should not take any parameters. When called, it should return a new instance of `AuxSubfieldsPoroela...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert auxiliary_subfields().describe() == 'This is an auxiliary subfield for poroelasticity'\", \"assert isinstance(auxiliary_subfields(), AuxSubfieldsPoroelasticity)\", \"assert auxiliary_subfields().describe() == 'This is an auxiliary subfield for poroelasticity...
{ "split": "train", "index": 70910, "acecode_id": "bigcode_python_fns_17908", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a specified number of file names based on a given file type and a suffix. The function should take in four parameters: an integer `num` representing the number of files to create, a string `bucket` representing the name of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_file_names(2, 'mybucket', 'txt', ['orig', 'dup']) == ['mybucket/txt_1_orig', 'mybucket/txt_1_dup', 'mybucket/txt_2_orig', 'mybucket/txt_2_dup']\", \"assert generate_file_names(1, 'testbucket', 'csv', ['backup']) == ['testbucket/csv_1_backup']\", \"a...
{ "split": "train", "index": 70911, "acecode_id": "bigcode_python_fns_46992", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes an array of integers, filters out non-integer elements, and computes the cumulative count of unique unordered pairs of integers from the array. The function should also identify and generate those pairs where the absolute difference is a prime nu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_pairs([]) == (0, [])\", \"assert find_pairs([1]) == (0, [])\", \"assert find_pairs([1, 1, 1]) == (0, [])\", \"assert find_pairs([10, 20, 30, 40, 50]) == (10, [])\", \"assert find_pairs([-20, -10, 0, 10, 20]) == (10, [])\", \"assert find_pairs([100, 200,...
{ "split": "train", "index": 70912, "acecode_id": "evol_18394", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function `mean(num_lst)` that returns the mean (average) of the numbers in the list. The mean is calculated by dividing the sum of the numbers by the count of the numbers. If the list is empty, return 0.0. \n\nFunction Signature: `def mean(num_...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mean([1, 2, 3, 4, 5]) == 3.0\", \"assert mean([10, 20, 30]) == 20.0\", \"assert mean([-1, -2, -3, -4, -5]) == -3.0\", \"assert mean([0, 0, 0]) == 0.0\", \"assert mean([100, 200, 300, 400, 500]) == 300.0\", \"assert mean([1]) == 1.0\", \"assert mean([-10, 0, ...
{ "split": "train", "index": 70913, "acecode_id": "bigcode_python_fns_47330", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an iterable (which could be a list, tuple, or a generator), write a function that returns a tuple containing the original iterable and its first element. If the iterable is empty, raise an IndexError. Note that if a generator is passed, the function should return a new ge...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_first_of_iterable([1, 2, 3]) == ([1, 2, 3], 1)\", \"assert get_first_of_iterable((4, 5, 6)) == ((4, 5, 6), 4)\", \"assert get_first_of_iterable([True, False]) == ([True, False], True)\", \"assert get_first_of_iterable(['a', 'b', 'c']) == (['a', 'b', 'c']...
{ "split": "train", "index": 70914, "acecode_id": "bigcode_python_fns_14988", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of subscription records, each containing a subscription ID and a list of subscriber strings formatted as 'securityGroups/{group_name}', write a function that extracts the group names for each subscription. If the full_uri parameter is set to True, return the full s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_subscriber_groups([{'id': 'sub1', 'subscribers': ['securityGroups/groupA', 'securityGroups/groupB']}, {'id': 'sub2', 'subscribers': ['securityGroups/groupC']}], False) == {'sub1': ['groupA', 'groupB'], 'sub2': ['groupC']}\", \"assert extract_subscrib...
{ "split": "train", "index": 70915, "acecode_id": "bigcode_python_fns_29179", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given the root node of a binary search tree, write a function `rangeSumBST` that computes the cumulative sum of the values of all nodes that fall within a specified range [low, high]. However, the sum should only include nodes that are at an even depth in the tree, and each nod...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rangeSumBST(TreeNode(10, TreeNode(5, TreeNode(3), TreeNode(7)), TreeNode(15, TreeNode(13), TreeNode(18))), 3, 10) == 20\", \"assert rangeSumBST(TreeNode(1), 1, 1) == 0\", \"assert rangeSumBST(None, 1, 5) == 0\", \"assert rangeSumBST(TreeNode(15, None, TreeNo...
{ "split": "train", "index": 70916, "acecode_id": "evol_7662", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a mapping of unique characters to integers and an encoded sequence of those integers, implement a function that takes in these two inputs and outputs the training and testing split of the encoded sequence. The function should return two lists: the training data and the te...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert split_data({'a': 0, 'b': 1}, [[0, 1], [1, 1], [0, 0], [1, 0]]) == ([[0, 1], [1, 1], [0, 0]], [[1, 0]])\", \"assert split_data({'x': 0, 'y': 1, 'z': 2}, [[0, 1, 2], [1, 0, 2], [2, 1, 0], [0, 2, 1]]) == ([[0, 1, 2], [1, 0, 2], [2, 1, 0]], [[0, 2, 1]])\", \"ass...
{ "split": "train", "index": 70917, "acecode_id": "bigcode_python_fns_12693", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with analyzing the status of workspaces set up in a project. Given a list of strings representing the final status of each workspace, write a function `workspace_status_report(statuses: List[str]) -> Tuple[int, int]` that counts the number of workspaces that were...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert workspace_status_report(['Success', 'Failed', 'Success']) == (2, 1)\", \"assert workspace_status_report(['Failed', 'Failed', 'Failed']) == (0, 3)\", \"assert workspace_status_report(['Success', 'Success', 'Success']) == (3, 0)\", \"assert workspace_status_re...
{ "split": "train", "index": 70918, "acecode_id": "bigcode_python_fns_13659", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a Python function that generates the n-th Fibonacci number using memoization. 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 take a single integer n (0 ≤ n ≤ 30) as input and return the n-th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci(0) == 0\", \"assert fibonacci(1) == 1\", \"assert fibonacci(2) == 1\", \"assert fibonacci(3) == 2\", \"assert fibonacci(4) == 3\", \"assert fibonacci(5) == 5\", \"assert fibonacci(6) == 8\", \"assert fibonacci(7) == 13\", \"assert fibonacci(8) == 2...
{ "split": "train", "index": 70919, "acecode_id": "evol_9179", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function to manage the status of an LED indicator and measure frames per second (FPS) in a computer vision application. Implement a function `manage_led_and_fps(ops: List[str]) -> Tuple[bool, float]` where `ops` is a list of operations. The operat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_led_and_fps(['turn_on', 'update_fps', 'turn_off', 'update_fps', 'update_fps']) == (False, 1.0)\", \"assert manage_led_and_fps(['turn_on', 'update_fps', 'turn_on', 'update_fps', 'turn_off', 'update_fps']) == (False, 1.0)\", \"assert manage_led_and_fps(...
{ "split": "train", "index": 70920, "acecode_id": "oss_36024", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the propagation of baggage items in a tracing system. The function should accept the following parameters: a string `baggage` representing the baggage item to be stored, a boolean `enabled` indicating whether tracing is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_trace_propagation('test_baggage', True, 5) == {'baggage': 'test_baggage', 'spans': 5}\", \"assert simulate_trace_propagation('no_trace', False, 0) == {'message': 'Tracing is disabled'}\", \"assert simulate_trace_propagation('another_baggage', True, ...
{ "split": "train", "index": 70921, "acecode_id": "bigcode_python_fns_21833", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to validate international phone numbers. The function should check if the given phone number starts with the international dialing code for Belgium, which is '0032'. If the number starts with '0032', it should be considered a valid in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_international_phone_number('0032123456789') == True\", \"assert validate_international_phone_number('00321234') == True\", \"assert validate_international_phone_number('0032987654321') == True\", \"assert validate_international_phone_number('0032') ...
{ "split": "train", "index": 70922, "acecode_id": "oss_1276", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes a string and returns the character which appears most frequently. The function should be case-sensitive and should consider punctuations and numbers. If two or more characters appear the same maximum number of times, return the character that comes f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert most_common_letter('abababab') == 'a'\", \"assert most_common_letter('####12$$$..') == 'No alphabets'\", \"assert most_common_letter('aabbcc') == 'a'\", \"assert most_common_letter('1234567890') == 'No alphabets'\", \"assert most_common_letter('!@#$%^&*()') ...
{ "split": "train", "index": 70923, "acecode_id": "evol_31566", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to evaluate comparison expressions. Your function should accept a mathematical expression in the form of a string that contains two variables and a comparison operator (either '>' for greater than or '<' for less than). The function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert evaluate_expression('a > b', {'a': 5, 'b': 3}) == True\", \"assert evaluate_expression('a < b', {'a': 2, 'b': 4}) == True\", \"assert evaluate_expression('x > y', {'x': 10, 'y': 10}) == False\", \"assert evaluate_expression('x < y', {'x': 5, 'y': 7}) == True...
{ "split": "train", "index": 70924, "acecode_id": "oss_1081", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that sets the length of a text span element in a vector graphics library. The function will receive a parameter `textLength` which represents the desired length of the text span. Your task is to implement a single function `set_text_l...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_text_length(100) == {'element_type': 'tspan', 'textLength': 100}\", \"assert set_text_length(0) == {'element_type': 'tspan', 'textLength': 0}\", \"assert set_text_length(-50) == {'element_type': 'tspan', 'textLength': -50}\", \"assert set_text_length(255...
{ "split": "train", "index": 70925, "acecode_id": "oss_892", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 3D tensor `X` with shape (N, H, W), where N is the number of matrices, H is the number of rows, and W is the number of columns, implement a function `batch_identity_like(X: List[List[List[float]]]) -> List[List[List[float]]]` that returns a new tensor of the same shape ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert batch_identity_like([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) == [[[1, 0], [0, 1]], [[1, 0], [0, 1]]]\", \"assert batch_identity_like([[[1, 2, 3], [4, 5, 6]]]) == [[[1, 0, 0], [0, 1, 0]]]\", \"assert batch_identity_like([[[1]], [[2]]]) == [[[1]], [[1]]]\", \"ass...
{ "split": "train", "index": 70926, "acecode_id": "bigcode_python_fns_19950", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function `create_literature` that takes in three parameters: a string `name`, a string `writer`, and an integer `leaflets`. The function should return a string that describes the literature in the format: \"{name} by {writer}, {leaflets} pages long.\".\nPlease reaso...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_literature('Pride and Prejudice', 'Jane Austen', 432) == 'Pride and Prejudice by Jane Austen, 432 pages long.'\", \"assert create_literature('1984', 'George Orwell', 328) == '1984 by George Orwell, 328 pages long.'\", \"assert create_literature('The G...
{ "split": "train", "index": 70927, "acecode_id": "evol_20758", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a string representing a format type (e.g. 'html', 'latex') and returns a function that can convert text to that specified format. The converter function should accept a string of text and return the text wrapped in the appropri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert converter('html')('Hello') == '<p>Hello</p>'\", \"assert converter('html')('World') == '<p>World</p>'\", \"assert converter('html')('123') == '<p>123</p>'\", \"assert converter('html')('Test') == '<p>Test</p>'\", \"assert converter('html')('') == '<p></p>'\"...
{ "split": "train", "index": 70928, "acecode_id": "bigcode_python_fns_37898", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with managing a simple file system simulation. Implement a function `file_operations(operations: List[Tuple[str, str]]) -> List[str]` that takes a list of operations to perform on a virtual file. The operations will be in the form of tuples where the first elemen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert file_operations([('open', 'file1.txt'), ('open', 'file2.txt')]) == ['File opened', 'File is already open']\", \"assert file_operations([('write', 'data1')]) == ['File is not open']\", \"assert file_operations([('close', '')]) == ['File is not open']\", \"ass...
{ "split": "train", "index": 70929, "acecode_id": "oss_29566", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a list of point coordinates and an origin point, write a Python function to calculate the Euclidean distance between the origin point and each point in the list. Your function should handle and correct erroneous points from the list (like invalid inputs or non-integer val...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_distances([(1, 1), (4, 4), (3, 3), 'error', (1, 2, 3), 'test', 10, (1, 'error')], (0, 0)) == [1.4142135623730951, 5.656854249492381, 4.242640687119285]\", \"assert calculate_distances(['not', 'a', 'point'], (0, 0)) == []\", \"assert calculate_dista...
{ "split": "train", "index": 70930, "acecode_id": "evol_15083", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Create a function `get_highest_peak(data)` that takes a list of tuples, where each tuple contains the name of a mountain range and its highest peak's height. The function should return the tuple containing the name of the mountain range and the peak that is the highest in the w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_highest_peak([('Himalayas', 8848), ('Andes', 6960), ('Rockies', 4399)]) == ('Himalayas', 8848)\", \"assert get_highest_peak([('K2', 8611), ('Kangchenjunga', 8586), ('Lhotse', 8516)]) == ('K2', 8611)\", \"assert get_highest_peak([('Denali', 6190), ('Mount...
{ "split": "train", "index": 70931, "acecode_id": "evol_7091", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a weighted directed graph represented as an adjacency list. Your task is to implement a function that calculates the shortest path between two specified nodes using Dijkstra's algorithm. The function should take three parameters: the graph (a dictionary where keys...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_shortest_path({'A': {'B': 1, 'C': 4}, 'B': {'C': 2, 'D': 5}, 'C': {'D': 1}, 'D': {}}, 'A', 'D') == ['A', 'B', 'C', 'D']\", \"assert calculate_shortest_path({'A': {'B': 1}, 'B': {'C': 2}, 'C': {'D': 1}, 'D': {}}, 'A', 'D') == ['A', 'B', 'C', 'D']\",...
{ "split": "train", "index": 70932, "acecode_id": "oss_8426", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `merge_sort` that takes a list of integers as input and returns a new list that contains the elements of the input list sorted in ascending order using the merge sort algorithm. The function should not modify the original list. Your i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_sort([1, -1, 31, 23, 9, 4, 2, 3]) == [-1, 1, 2, 3, 4, 9, 23, 31]\", \"assert merge_sort([]) == []\", \"assert merge_sort([5]) == [5]\", \"assert merge_sort([3, 2]) == [2, 3]\", \"assert merge_sort([1, 1, 1, 1]) == [1, 1, 1, 1]\", \"assert merge_sort([1...
{ "split": "train", "index": 70933, "acecode_id": "oss_19887", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a dictionary representing game data, your task is to extract and transform specific attributes from this data into a more simplified format. The input dictionary contains a nested structure with game attributes, including the game's creation time, duration, game mode, and...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_game_data({'data': {'attributes': {'createdAt': '2023-10-10T12:00:00Z', 'duration': 300, 'gameMode': 'Solo', 'mapName': 'Desert_Main'}}}) == {'date': 'Tue, Oct 10', 'duration': 5, 'mode': 'Solo', 'map': 'Miramar'}\", \"assert transform_game_data({'...
{ "split": "train", "index": 70934, "acecode_id": "bigcode_python_fns_42338", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of annotations, where each annotation is represented as a list of four elements: [T, X, Y, Z]. Your task is to filter the annotations by a provided set of valid timepoints and scale the Z value of each valid annotation down to a range of 0 to 1 by multiplyi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_and_scale_annotations([[1, 1, 1, 5], [2, 2, 2, 10], [3, 3, 3, 15]], {2}) == [[2, 2, 2, 2.0]]\", \"assert filter_and_scale_annotations([[0, 0, 0, 100], [0, 1, 1, 20]], {0}) == [[0, 0, 0, 20.0], [0, 1, 1, 4.0]]\", \"assert filter_and_scale_annotations([...
{ "split": "train", "index": 70935, "acecode_id": "bigcode_python_fns_29544", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a string, you need to implement a function that reverses the characters in the string and returns the reversed string. For example, if the input string is 'Hello', the output should be 'olleH'. Your function should handle any string including empty strings and strings wit...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reverse('Alex') == 'xelA'\", \"assert reverse('Hello') == 'olleH'\", \"assert reverse('OpenAI') == 'IAnepO'\", \"assert reverse('') == ''\", \"assert reverse('12345') == '54321'\", \"assert reverse('a b c') == 'c b a'\", \"assert reverse('racecar') == 'racec...
{ "split": "train", "index": 70936, "acecode_id": "bigcode_python_fns_4392", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers `sequence` and an integer `desired_length`, write a function `reduce_sequence(sequence: List[int], desired_length: int) -> List[int]` that reduces the `sequence` to the `desired_length` by uniformly selecting elements from the original list. If the leng...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reduce_sequence([10, 20, 30, 40, 50], 5) == [10, 20, 30, 40, 50]\", \"assert reduce_sequence([1, 1, 1, 1, 1], 1) == [1]\", \"assert reduce_sequence([1, 2, 3, 4, 5, 6], 6) == [1, 2, 3, 4, 5, 6]\", \"assert reduce_sequence([10, 20, 30], 1) == [10]\", \"assert ...
{ "split": "train", "index": 70937, "acecode_id": "bigcode_python_fns_46392", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a credential object based on a given email and password. The credential object should contain the email and password as attributes. Implement the function `generate_credential(email: str, password: str) -> Credential` where...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_credential('user@example.com', 'securePassword123') == Credential('user@example.com', 'securePassword123')\", \"assert generate_credential('admin@domain.com', 'adminPass!') == Credential('admin@domain.com', 'adminPass!')\", \"assert generate_credent...
{ "split": "train", "index": 70938, "acecode_id": "bigcode_python_fns_40444", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string `column` which represents the name of a column in a data structure. Implement a function `groups(column: str) -> str` that returns a formatted string in the style of 'Column: {column}, Aggregation: groups'. This function should simply append the provided ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert groups('foo') == 'Column: foo, Aggregation: groups'\", \"assert groups('bar') == 'Column: bar, Aggregation: groups'\", \"assert groups('baz') == 'Column: baz, Aggregation: groups'\", \"assert groups('qux') == 'Column: qux, Aggregation: groups'\", \"assert gr...
{ "split": "train", "index": 70939, "acecode_id": "bigcode_python_fns_21864", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings representing certificate names for different platforms. Your task is to implement a function that takes this list of strings and returns a dictionary where each key is a platform name (from the list) and each value is a list of certificate names ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert group_certificates_by_platform(['cert1', 'cert2', 'cert3']) == {'Windows': [], 'Linux': [], 'MacOS': []}\", \"assert group_certificates_by_platform(['cert1', 'cert2', 'cert3', 'Windows_cert1', 'Windows_cert2']) == {'Windows': ['Windows_cert1', 'Windows_cert2...
{ "split": "train", "index": 70940, "acecode_id": "bigcode_python_fns_8597", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D list of feature locations and a corresponding list of descriptions, implement a function that combines these lists into a single 2D list where each row contains the feature location followed by its respective description. The input is a list of lists for feature loca...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert combine_features([[1, 2], [3, 4]], ['feature1', 'feature2']) == [[1, 2, 'feature1'], [3, 4, 'feature2']]\", \"assert combine_features([[0, 0], [1, 1], [2, 2]], ['desc1', 'desc2', 'desc3']) == [[0, 0, 'desc1'], [1, 1, 'desc2'], [2, 2, 'desc3']]\", \"assert co...
{ "split": "train", "index": 70941, "acecode_id": "bigcode_python_fns_38678", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of financial transactions and categorizes them based on their currency and type. Each transaction is represented as a dictionary containing 'currency' (a string) and 'category' (a string that can be 'UNKNOWN', 'INCOME', ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_transactions([{'currency': 'USD', 'category': 'EXPENSE'}, {'currency': 'EUR'}]) == [{'currency': 'USD', 'category': 'EXPENSE'}, {'currency': 'EUR', 'category': 'UNKNOWN'}]\", \"assert categorize_transactions([{'currency': 'JPY', 'category': 'INCOM...
{ "split": "train", "index": 70942, "acecode_id": "oss_28479", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two lists of event mentions and their corresponding relations. The first list, `ecb_event_mentions`, contains pairs of event mentions, while the second list, `ecb_coref_relations`, contains pairs of events along with their relations. Your task is to create a funct...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_event_relations([('event1', 'event2'), ('event3', 'event4')], [('event1', 'event2', 'FALLING_ACTION'), ('event3', 'event4', 'PRECONDITION')]) == {('event1', 'event2'): 'FALLING_ACTION', ('event2', 'event1'): 'PRECONDITION', ('event3', 'event4'): 'PRECO...
{ "split": "train", "index": 70943, "acecode_id": "bigcode_python_fns_26317", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a continuous sequence of alphabetic characters represented as a string (including both upper and lower case), write a function that systematically replaces all recurring, successive characters from the sequence with the number of occurrences, thereby producing a novel, al...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert expunge_recurring_chars('') == ''\", \"assert expunge_recurring_chars('a') == 'a'\", \"assert expunge_recurring_chars('aa') == 'a2'\", \"assert expunge_recurring_chars('aab') == 'a2b'\", \"assert expunge_recurring_chars('aaabbaa') == 'a3b2a2'\", \"assert exp...
{ "split": "train", "index": 70944, "acecode_id": "evol_11917", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function to calculate the Body Mass Index (BMI) and categorize it into one of the following categories: 'Underweight' (BMI < 18.5), 'Normal weight' (18.5 <= BMI < 25), 'Overweight' (25 <= BMI < 30), or 'Obese' (BMI >= 30). Implement a funct...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bmi_category(50, 1.60) == 'Normal weight'\", \"assert bmi_category(40, 1.60) == 'Underweight'\", \"assert bmi_category(70, 1.75) == 'Normal weight'\", \"assert bmi_category(80, 1.75) == 'Overweight'\", \"assert bmi_category(60, 1.80) == 'Normal weight'\", \"...
{ "split": "train", "index": 70945, "acecode_id": "oss_23860", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple bank account. The function should accept an initial balance and a list of operations, which can either be deposits or withdrawals. Each operation is a tuple where the first element is a string indicating the op...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_bank_account(100.0, [('deposit', 50)]) == 150.0\", \"assert simulate_bank_account(200.0, [('withdraw', 100)]) == 100.0\", \"assert simulate_bank_account(50.0, [('deposit', 50), ('withdraw', 30)]) == 70.0\", \"assert simulate_bank_account(0.0, [('dep...
{ "split": "train", "index": 70946, "acecode_id": "oss_24474", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two inputs: a bounding box represented as a list of four integers [x_min, y_min, x_max, y_max] and a list of detections, where each detection is represented as a list of two integers [x, y]. Your task is to implement a function that calculates the Manhattan distan...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_distances([0, 0, 10, 10], [[5, 5], [0, 0], [10, 10], [15, 15]]) == [0, 0, 0, 10]\", \"assert calculate_distances([1, 1, 3, 3], [[0, 0], [2, 2], [4, 4], [1, 1]]) == [2, 0, 2, 0]\", \"assert calculate_distances([-1, -1, 1, 1], [[0, 0], [-2, -2], [2, ...
{ "split": "train", "index": 70947, "acecode_id": "bigcode_python_fns_36976", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `s`, a target word `target`, a replacement character `key_char`, and an integer `n`, implement a function called `modify_and_sort` that replaces all occurrences of `target` in `s` with `key_char`. After replacing, the function should return a list of words sorted...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert modify_and_sort('apple banana apple cherry', 'apple', 'orange', 1) == ['banana', 'cherry', 'orange', 'orange']\", \"assert modify_and_sort('hello world hello', 'hello', 'hi', 0) == ['hi', 'hi', 'world']\", \"assert modify_and_sort('one two one three', 'two',...
{ "split": "train", "index": 70948, "acecode_id": "evol_22049", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that checks if the list has at least one even number. The function should return True if there is at least one even number in the list, and False otherwise. The input will be a list of integers. For example, given the input [1, 3, 5, 7...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_even_number([1, 3, 5, 7]) == False\", \"assert has_even_number([1, 2, 3, 4]) == True\", \"assert has_even_number([2, 4, 6]) == True\", \"assert has_even_number([1, 1, 1]) == False\", \"assert has_even_number([0]) == True\", \"assert has_even_number([-1, ...
{ "split": "train", "index": 70949, "acecode_id": "bigcode_python_fns_1693", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two dictionaries, merge them into one dictionary. If the same key exists in both dictionaries, the value from the second dictionary should overwrite the value from the first dictionary. You need to implement a function `merge_dicts(dict1: Dict[str, Any], dict2: Dict[str, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_dicts({'a': 1, 'b': 2}, {'b': 3, 'c': 4}) == {'a': 1, 'b': 3, 'c': 4}\", \"assert merge_dicts({'x': 5}, {'y': 6}) == {'x': 5, 'y': 6}\", \"assert merge_dicts({}, {'k': 7}) == {'k': 7}\", \"assert merge_dicts({'p': 8}, {}) == {'p': 8}\", \"assert merge_...
{ "split": "train", "index": 70950, "acecode_id": "bigcode_python_fns_23287", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates creating a command line argument parser similar to the one used in Python's argparse module. The function should take in a list of arguments (strings) that would typically be passed from the command line. Your function shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_arguments(['--out', 'output.pkl', '--txt', 'output.txt', 'file.nii']) == {'nifti': 'file.nii', 'out': 'output.pkl', 'txt': 'output.txt'}\", \"assert parse_arguments(['file.nii']) == {'nifti': 'file.nii', 'out': None, 'txt': None}\", \"assert parse_argu...
{ "split": "train", "index": 70951, "acecode_id": "bigcode_python_fns_3571", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of tuples, where each tuple contains a key-value pair. The keys are strings and can either start with a specific prefix or be any other string. Your task is to transform this list of tuples into a dictionary. If a key starts with a given prefix, you should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_metadata([('prefix_key1', 'value1'), ('prefix_key2', 'value2'), ('key3', 'value3')], 'prefix_') == {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}\", \"assert transform_metadata([], 'prefix_') == {}\", \"assert transform_metadata([('key1', '...
{ "split": "train", "index": 70952, "acecode_id": "bigcode_python_fns_21592", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates writing data to a file represented as a list. The function should take a list of strings and a header string, and it should return a list that contains the header followed by the strings in the input list. Your function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert write_data_to_memory('Header1', ['data1', 'data2']) == ['Header1', 'data1', 'data2']\", \"assert write_data_to_memory('Header2', []) == ['Header2']\", \"assert write_data_to_memory('Header3', ['data3']) == ['Header3', 'data3']\", \"assert write_data_to_memor...
{ "split": "train", "index": 70953, "acecode_id": "oss_10493", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function to calculate the cube of a number and return the result. Input: 3\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 cube_number(0) == 0\", \"assert cube_number(1) == 1\", \"assert cube_number(2) == 8\", \"assert cube_number(3) == 27\", \"assert cube_number(4) == 64\", \"assert cube_number(5) == 125\", \"assert cube_number(6) == 216\", \"assert cube_number(7) == 343\", \"a...
{ "split": "train", "index": 70954, "acecode_id": "evol_12555", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that configures a server proxy with specific parameters. The function should take in five parameters: a token (string), a certificate authority (ca) (string), a master IP address (string), an API server port (integer), and a hostname overr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert configure_proxy('abc123', 'my_ca', '192.168.1.1', 8080, 'proxy-host') == 'Configuring proxy with token: abc123, CA: my_ca, Master IP: 192.168.1.1, API Port: 8080, Hostname Override: proxy-host'\", \"assert configure_proxy('token456', 'ca_cert', '10.0.0.1', 4...
{ "split": "train", "index": 70955, "acecode_id": "bigcode_python_fns_18272", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of keywords associated with a person. Your task is to implement a function `remove_keyword(person_keywords: List[str], keyword_to_remove: str) -> List[str]` that removes a specified keyword from the list of keywords. If the keyword does not exist in the lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_keyword(['keyword1', 'keyword2', 'keyword3'], 'keyword2') == ['keyword1', 'keyword3']\", \"assert remove_keyword(['keyword1', 'keyword2', 'keyword2'], 'keyword2') == ['keyword1', 'keyword2']\", \"assert remove_keyword(['keyword1', 'keyword1', 'keyword...
{ "split": "train", "index": 70956, "acecode_id": "bigcode_python_fns_39033", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a unique key for identifying verification steps based on the given name. The function should take a string input 'name' and return a string that concatenates 'VerificationSteps_' with the provided name. Implement the functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert GetVerificationStepsKeyName('UserLogin') == 'VerificationSteps_UserLogin'\", \"assert GetVerificationStepsKeyName('EmailVerification') == 'VerificationSteps_EmailVerification'\", \"assert GetVerificationStepsKeyName('PasswordReset') == 'VerificationSteps_Pas...
{ "split": "train", "index": 70957, "acecode_id": "bigcode_python_fns_4951", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes a list of record IDs. Your function should take in a list of record IDs and perform the following operations: 1. Remove any duplicate record IDs from the input list. 2. Sort the record IDs in ascending order. 3. Append ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_record_ids(['A123', 'B456', 'A123', 'C789', 'B456']) == ['A123_mod', 'B456_mod', 'C789_mod']\", \"assert process_record_ids(['X001', 'X002', 'X001', 'X003', 'X002']) == ['X001_mod', 'X002_mod', 'X003_mod']\", \"assert process_record_ids(['D100', 'D20...
{ "split": "train", "index": 70958, "acecode_id": "oss_6115", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function to generate a Docker Compose command based on a given set of parameters. The function should take in the site name, MariaDB root password, admin password, and app name as input and construct a Docker Compose command to set up a new...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_docker_compose_command('site1', 'password1', 'admin1', 'app1') == 'new-site site1 --mariadb-root-password password1 --admin-password admin1 --install-app app1 && docker-compose restart backend'\", \"assert generate_docker_compose_command('site2', 'p...
{ "split": "train", "index": 70959, "acecode_id": "oss_17201", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that generates a circuit based on a given Pauli string and a parameter. The function should take two arguments: an integer `num_qubits` representing the number of qubits in the circuit, and a string `pauli_string` which consists of ch...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_circuit_from_pauli_string(2, 'IX') == 'Circuit with 2 qubits: IX'\", \"assert generate_circuit_from_pauli_string(1, 'Z') == 'Circuit with 1 qubit: Z'\", \"assert generate_circuit_from_pauli_string(3, 'XYZ') == 'Circuit with 3 qubits: XYZ'\", \"asser...
{ "split": "train", "index": 70960, "acecode_id": "bigcode_python_fns_16512", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of layers, where each layer is represented as a dictionary. Each layer may contain a 'subLayers' key, which is a list of additional layers (sub-layers). Your task is to implement a function `get_matching_layers(layers: List[Dict], criterion_fn: Callable[[Di...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_matching_layers([{'name': 'Layer1', 'value': 10}], lambda x: x['value'] > 5) == [{'name': 'Layer1', 'value': 10}]\", \"assert get_matching_layers([{'name': 'Layer1', 'value': 10, 'subLayers': [{'name': 'SubLayer1', 'value': 15}]}], lambda x: x['value'] >...
{ "split": "train", "index": 70961, "acecode_id": "bigcode_python_fns_16114", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a list of dictionaries representing geographical elements, write a function `osm_nodes(raw_elements: List[Dict]) -> List[Dict]` that converts these dictionaries into instances of Node class. Each dictionary may contain the following keys: 'id', 'version', 'lat', 'lon', 't...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert osm_nodes([{'id': 1, 'version': 1, 'lat': 10.0, 'lon': 20.0, 'tags': {}, 'changeset': 123, 'user': 'Alice', 'uid': 1, 'timestamp': '2023-10-01T12:00:00Z', 'type': 'node'}]) == [{'id': 1, 'version': 1, 'lat': 10.0, 'lon': 20.0, 'tags': {}, 'metadata': {'chang...
{ "split": "train", "index": 70962, "acecode_id": "bigcode_python_fns_19617", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a floating-point number E_star_ST representing the baseline primary energy consumption in Joules per year, write a function `calc_E_ST_GJ(E_star_ST)` that converts this value into Gigajoules per year (GJ/year). The conversion should divide the input by 1,000,000,000 (1 bi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc_E_ST_GJ(1000000000) == 1.0\", \"assert calc_E_ST_GJ(1500000000) == 1.5\", \"assert calc_E_ST_GJ(999999999) == 1.0\", \"assert calc_E_ST_GJ(5000000000) == 5.0\", \"assert calc_E_ST_GJ(250000000) == 0.3\", \"assert calc_E_ST_GJ(0) == 0.0\", \"assert calc_...
{ "split": "train", "index": 70963, "acecode_id": "bigcode_python_fns_18775", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of integers and returns the mean of the values in the list. If the list is empty, the function should raise a ValueError with the message 'Empty list: cannot compute mean'. Your function signature should be: \...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_mean([1, 2, 3, 4, 5]) == 3.0\", \"assert calculate_mean([-1, -2, -3, -4, -5]) == -3.0\", \"assert calculate_mean([0]) == 0.0\", \"assert calculate_mean([10, 20, 30]) == 20.0\", \"assert calculate_mean([1, 1, 1, 1]) == 1.0\", \"assert calculate_mean...
{ "split": "train", "index": 70964, "acecode_id": "oss_9285", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that updates the content of a post if the current user is the author of that post. The function `update_post_content` takes three parameters: `current_user` (an integer representing the ID of the current user), `post_id` (an integer r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_post_content(1, 1, 'New content for post 1') == True\", \"assert update_post_content(1, 2, 'New content for post 2') == None\", \"assert update_post_content(2, 1, 'New content for post 1') == None\", \"assert update_post_content(1, 4, 'New content for...
{ "split": "train", "index": 70965, "acecode_id": "bigcode_python_fns_16491", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function `replace_number(inputArray, originNumber, newNumber)` that takes an array of integers `inputArray`, an integer `originNumber`, and an integer `newNumber`. The function should locate all occurrences of `originNumber` in `inputArray` and replace them with `newNum...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replace_number([1, 2, 3, 4, 5], 3, 0) == [1, 2, 0, 4, 5]\", \"assert replace_number([6, 9, 3, 5, 8, 6, 7], 6, 1) == [1, 9, 3, 5, 8, 1, 7]\", \"assert replace_number([1, 1, 1, 1], 1, 9) == [9, 9, 9, 9]\", \"assert replace_number([10, 20, 30, 10], 10, 100) == ...
{ "split": "train", "index": 70966, "acecode_id": "evol_23070", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the heights of bars in a histogram. Write a function `max_area(heights: List[int]) -> int` that computes the maximum rectangular area that can be formed within the bounds of the histogram. The width of each bar is considered to be 1...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_area([2, 1, 5, 6, 2, 3]) == 10\", \"assert max_area([1, 1, 1, 1]) == 4\", \"assert max_area([4, 2, 0, 3, 2, 5]) == 6\", \"assert max_area([1, 2, 3, 4, 5]) == 9\", \"assert max_area([5, 4, 3, 2, 1]) == 9\", \"assert max_area([0, 0, 0, 0]) == 0\", \"assert...
{ "split": "train", "index": 70967, "acecode_id": "bigcode_python_fns_10493", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a string that may contain a SHA256 hash prefixed with 'sha256:'. Write a function called 'extract_sha256_hash' that takes a single string input and returns the SHA256 hash without the 'sha256:' prefix if it exists. If the string does not start with 'sha256:', or i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_sha256_hash('sha256:abcd1234') == 'abcd1234'\", \"assert extract_sha256_hash('sha256:') == ''\", \"assert extract_sha256_hash('abcd1234') == None\", \"assert extract_sha256_hash(None) == None\", \"assert extract_sha256_hash('sha256:abcdef1234567890')...
{ "split": "train", "index": 70968, "acecode_id": "bigcode_python_fns_35076", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that converts a given decimal number into a currency format specifically following the USD standards. The function should take a decimal number as input and return a string formatted as a currency value, with two decimal places and a dollar sign in front. For e...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_currency(68.34567) == '$68.35'\", \"assert format_currency(0) == '$0.00'\", \"assert format_currency(-45.678) == '$-45.68'\", \"assert format_currency(3.14159) == '$3.14'\", \"assert format_currency(0.009) == '$0.01'\", \"assert format_currency(200) =...
{ "split": "train", "index": 70969, "acecode_id": "evol_3245", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a string, write a function that removes all words that appear more than once in the string, preserving the order of the words that appear only once. The words are separated by spaces. Implement the function `remove_duplicate_words(input_string: str) -> str`.\nPlease reaso...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_duplicate_words('Hello world') == 'Hello world'\", \"assert remove_duplicate_words('Hello Hello world') == 'world'\", \"assert remove_duplicate_words('one two three one') == 'two three'\", \"assert remove_duplicate_words('a b a b c d') == 'c d'\", \"a...
{ "split": "train", "index": 70970, "acecode_id": "evol_15910", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that sorts a given list of integers in ascending order without using Python's built-in sorting functions. The function should take a list of integers as input and return a new list that contains the same integers sorted in ascending order. Your implementati...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert my_sort([5,1,4,2,8]) == [1, 2, 4, 5, 8]\", \"assert my_sort([-1, 0, 1]) == [-1, 0, 1]\", \"assert my_sort([3, 3, 2, 1, 2]) == [1, 2, 2, 3, 3]\", \"assert my_sort([10]) == [10]\", \"assert my_sort([]) == []\", \"assert my_sort([2, 1]) == [1, 2]\", \"assert my...
{ "split": "train", "index": 70971, "acecode_id": "evol_8188", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `generate_permutations` that can generate all permutations of a given string, including duplicates. The function should have the following signature: \n\n```python\ndef generate_permutations(s: str) -> List[str]:\n```\n\nInput:\n- `s`: A string containing `n` c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_permutations('ABC') == ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']\", \"assert generate_permutations('A') == ['A']\", \"assert generate_permutations('AA') == ['AA', 'AA']\", \"assert generate_permutations('123') == ['123', '132', '213', '231', '312',...
{ "split": "train", "index": 70972, "acecode_id": "evol_30202", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Write a function `calculate_interest(principal: float, rate_of_interest: float, time_period: float) -> float` that calculates the total amount after applying a simple interest formula. The simple interest is calculated using the formula: total = principal + (principal * rate_of...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_interest(1000, 0.05, 1) == 1050.0\", \"assert calculate_interest(2000, 0.04, 5) == 2400.0\", \"assert calculate_interest(1200, 0.02, 10) == 1440.0\", \"assert calculate_interest(2500, 0.01, 1) == 2525.0\", \"assert calculate_interest(300, 0.10, 2) ...
{ "split": "train", "index": 70973, "acecode_id": "evol_28315", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given an array of integers, implement a function that returns the 3rd largest distinct number in the array. If there are fewer than three distinct numbers, return a message indicating that at least three different integers are required.\nPlease reason step by step, then write a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert third_largest([1, 2, 3]) == 1\", \"assert third_largest([5, 2, 1, 3, 4]) == 3\", \"assert third_largest([20, 30, 40, 50, 60]) == 40\", \"assert third_largest([9, 8, 7, 6, 5, 4, 3, 2, 1]) == 7\", \"assert third_largest([1, 1, 1, 1, 2, 2, 3]) == 1\", \"assert ...
{ "split": "train", "index": 70974, "acecode_id": "evol_10984", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the execution of a command in a shell environment. The function should accept a command as a string and a directory as a string (defaulting to '/') where the command is executed. The function must return a tuple contain...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_command_execution('echo Hello') == ('Hello\\\\n', '', 0)\", \"assert simulate_command_execution('ls') == ('file1\\\\nfile2\\\\n', '', 0)\", \"assert simulate_command_execution('mkdir test') == ('', '', 0)\", \"assert simulate_command_execution('rm t...
{ "split": "train", "index": 70975, "acecode_id": "bigcode_python_fns_42557", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of integers and returns a new list containing only the even numbers from the original list. The function should maintain the order of the even numbers as they appeared in the input list. If there are no even numbers, ret...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5, 6]) == [2, 4, 6]\", \"assert filter_even_numbers([2, 4, 6, 8, 10]) == [2, 4, 6, 8, 10]\", \"assert filter_even_numbers([1, 3, 5]) == []\", \"assert filter_even_numbers([-2, -1, 0, 1, 2]) == [-2, 0, 2]\", \"assert filter_ev...
{ "split": "train", "index": 70976, "acecode_id": "bigcode_python_fns_33448", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that counts the number of unique words in a given string. A unique word is defined as a sequence of characters separated by whitespace, and case sensitivity should be ignored (i.e., 'Hello' and 'hello' are considered the same word)...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_unique_words_in_string('Hello world, hello!') == 2\", \"assert count_unique_words_in_string('Data Science, data science.') == 2\", \"assert count_unique_words_in_string('This is a test. This test is only a test!') == 5\", \"assert count_unique_words_in...
{ "split": "train", "index": 70977, "acecode_id": "oss_14835", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `parse_section(section: str) -> List[str]` that takes a string representing a section name and returns a list containing two strings: the component and the section. The section can either be a simple name or a name prefixed with the compo...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_section('non-free/python') == ['non-free', 'python']\", \"assert parse_section('contrib/libdevel') == ['contrib', 'libdevel']\", \"assert parse_section('invalid/section') == ['main', 'invalid_section']\", \"assert parse_section('python') == ['main', 'p...
{ "split": "train", "index": 70978, "acecode_id": "bigcode_python_fns_47152", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the creation of a directory structure given a file path. The function should take a string representing a file path as input and return a list of directory names that would be created to ensure that the file can be crea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_directory_structure('/a/b/c/d.txt') == ['a', 'b', 'c']\", \"assert create_directory_structure('/a/b/c/d/e.txt') == ['a', 'b', 'c', 'd']\", \"assert create_directory_structure('/x/y/z.txt') == ['x', 'y']\", \"assert create_directory_structure('/home/us...
{ "split": "train", "index": 70979, "acecode_id": "bigcode_python_fns_40475", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple event loop for a GUI application. Your event loop should continuously update the GUI until the application is signaled to terminate. Implement a function `run_event_loop()` that initializes an attribute `alive` to control the terminatio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert run_event_loop() == 'Event Loop Terminated'\", \"assert custom_update() == 'GUI Updated'\", \"assert custom_update() == 'GUI Updated'\", \"assert custom_update() == 'GUI Updated'\", \"assert custom_update() == 'GUI Updated'\", \"assert custom_update() == 'GU...
{ "split": "train", "index": 70980, "acecode_id": "oss_11720", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function to rotate a given list by a specified number of items to the right. The rotation should be performed in place, meaning the list should be modified without using any additional data structure. The function should also handle negative rotation values, which repre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rotate_right([1, 2, 3, 4, 5], 0) == None and [1, 2, 3, 4, 5] == [1, 2, 3, 4, 5]\", \"assert rotate_right([1, 2, 3], 3) == None and [1, 2, 3] == [1, 2, 3]\", \"assert rotate_right([], 5) == None and [] == []\", \"assert rotate_right([1], 1) == None and [1] ==...
{ "split": "train", "index": 70981, "acecode_id": "evol_34822", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Implement a function `enhanced_median(l: list, cmp_func: callable) -> float` that computes and returns the median from an unsorted list, nested lists, or list of tuples without using built-in functions. The function should handle duplicate lists with both even and odd lengths, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert enhanced_median([], lambda x: x) is None\", \"assert enhanced_median([1, 2, 3], lambda x: x) == 2\", \"assert enhanced_median([[1, 2], [3, 4]], lambda x: x) == 2.5\", \"assert enhanced_median([1, 1, 1], lambda x: x) == 1\", \"assert enhanced_median([[1, 3], ...
{ "split": "train", "index": 70982, "acecode_id": "evol_1813", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with generating metadata for a Python package distribution file for a simple event bus library. The metadata includes the package name, version, packages, URL, license, author, author email, description, and download URL. Write a function `generate_metadata()` th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_metadata() == {'name': 'event-bus', 'version': '1.0.4', 'packages': ['event_bus'], 'url': 'https://github.com/summer-wu/event-bus', 'license': 'MIT', 'author': 'Your Name', 'author_email': 'your_email@example.com', 'description': 'A simple python ev...
{ "split": "train", "index": 70983, "acecode_id": "oss_5749", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a datafeed for products in an e-commerce application. Write a function `create_datafeed` that takes two parameters: `name` (a string representing the name of the new datafeed) and `overwrites` (a dictionary containing attributes to overwrite in the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_datafeed('Summer Sale', {}) == {'name': 'Summer Sale', 'contentType': 'products', 'attributeLanguage': 'en', 'contentLanguage': 'en', 'intendedDestinations': ['Shopping']}\", \"assert create_datafeed('Winter Collection', {'contentType': 'clothing'}) =...
{ "split": "train", "index": 70984, "acecode_id": "oss_17900", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a logger that should raise an error when the logging configuration file is set to an invalid channel. Write a function `check_logging_channel` that takes in a string `channel_name` representing the name of the logging channel. If the `channel_name` ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_logging_channel('production') == 'Channel is valid'\", \"assert check_logging_channel('development') == 'Channel is valid'\", \"assert check_logging_channel('testing') == 'Channel is valid'\", \"assert check_logging_channel('staging') == 'Channel is va...
{ "split": "train", "index": 70985, "acecode_id": "bigcode_python_fns_17398", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `calculate_sum(a, b)` that takes two integers `a` and `b` as parameters and returns their sum. The function should adhere to Python PEP8 standards.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_sum(1, 2) == 3\", \"assert calculate_sum(-1, 1) == 0\", \"assert calculate_sum(0, 0) == 0\", \"assert calculate_sum(100, 200) == 300\", \"assert calculate_sum(-50, -50) == -100\", \"assert calculate_sum(5, 5) == 10\", \"assert calculate_sum(10, -10...
{ "split": "train", "index": 70986, "acecode_id": "evol_23908", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings representing lines of a PDB (Protein Data Bank) file, write a function `retrieve_molecule_number(pdb_lines: List[str], resname: str) -> int` that retrieves the molecule number of the first occurrence of a residue with the name `resname`. Each occurrence ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert retrieve_molecule_number(['ATOM 1 N MET A 1 20.154 34.622 27.564 1.00 0.00 N','TER'], 'MET') == 1\", \"assert retrieve_molecule_number(['ATOM 1 N ALA A 1 20.154 34.622 27.564 1.00 0.00 N','TER','ATOM ...
{ "split": "train", "index": 70987, "acecode_id": "bigcode_python_fns_45694", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with simulating the behavior of an LED that flashes continuously on and off. Write a function `led_flash(duration: int, interval: int) -> List[str]` that takes two parameters: `duration`, which represents the total time (in seconds) the LED should flash, and `int...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert led_flash(6, 2) == ['ON', 'ON', 'OFF', 'OFF', 'ON', 'ON']\", \"assert led_flash(5, 1) == ['ON', 'OFF', 'ON', 'OFF', 'ON']\", \"assert led_flash(4, 1) == ['ON', 'OFF', 'ON', 'OFF']\", \"assert led_flash(7, 3) == ['ON', 'ON', 'ON', 'OFF', 'OFF', 'OFF', 'ON']\"...
{ "split": "train", "index": 70988, "acecode_id": "bigcode_python_fns_13872", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a list of tuples, where each tuple represents the sum of red, green, and blue pixel values from individual images in the format (red_sum, green_sum, blue_sum). Your task is to write a function that takes in this list of tuples and calculates the total sum of red, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_pixel_sum([(123, 234, 345)]) == (123, 234, 345)\", \"assert calculate_pixel_sum([(1, 2, 3), (4, 5, 6)]) == (5, 7, 9)\", \"assert calculate_pixel_sum([(10, 20, 30), (40, 50, 60), (70, 80, 90)]) == (120, 150, 180)\", \"assert calculate_pixel_sum([(0,...
{ "split": "train", "index": 70989, "acecode_id": "oss_19397", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that calculates the sum of the cubes of all natural numbers from 1 to n. The function should take a single integer n as input and return the computed sum.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a sin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_cubes(1) == 1\", \"assert sum_of_cubes(2) == 9\", \"assert sum_of_cubes(3) == 36\", \"assert sum_of_cubes(4) == 100\", \"assert sum_of_cubes(5) == 225\", \"assert sum_of_cubes(6) == 441\", \"assert sum_of_cubes(7) == 784\", \"assert sum_of_cubes(8) ==...
{ "split": "train", "index": 70990, "acecode_id": "evol_28652", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the median value of a list of numerical data. The list can contain both integers and floating-point numbers and may be of any size, including edge cases such as an empty list or a list with duplicate values. Your function should handle these...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert correct_median([1, 3, 2]) == 2.0\", \"assert correct_median([1, 2, 3, 4]) == 2.5\", \"assert correct_median([5]) == 5.0\", \"assert correct_median([1, 2, 3, 4, 5]) == 3.0\", \"assert correct_median([1, 1, 1, 1]) == 1.0\", \"assert correct_median([1, 2, 2, 3,...
{ "split": "train", "index": 70991, "acecode_id": "evol_24583", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are required to implement a Python function `get_geant4_variable(geant4_env, variable)` that takes a dictionary `geant4_env` containing environment variable mappings and a string `variable` representing the variable name. The function should return the corresponding value f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_geant4_variable({'G4RADIOACTIVEDATA': 'RadioactiveDecay', 'G4REALSURFACEDATA': 'RealSurface', 'G4ENSDFSTATEDATA': 'G4ENSDFSTATE2.2', 'G4SAIDXSDATA': 'G4SAIDDATA1.1'}, 'G4RADIOACTIVEDATA') == 'RadioactiveDecay'\", \"assert get_geant4_variable({'G4RADIOACT...
{ "split": "train", "index": 70992, "acecode_id": "oss_5212", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of `Psl` objects, where each `Psl` object has two attributes: `mQueryFrom` and `mQueryTo`. Your task is to write a Python function that takes in a list of these `Psl` objects and returns a list of tuples. Each tuple should contain the `mQueryFrom` and `mQue...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_query_ranges([Psl(1, 2)]) == [(1, 2)]\", \"assert extract_query_ranges([Psl(5, 10), Psl(15, 20)]) == [(5, 10), (15, 20)]\", \"assert extract_query_ranges([]) == []\", \"assert extract_query_ranges([Psl(-1, -2)]) == [(-1, -2)]\", \"assert extract_quer...
{ "split": "train", "index": 70993, "acecode_id": "oss_7494", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `categorize_age(name: str, age: int) -> str` that takes a person's name and age as input and returns a string categorizing the person into different age groups: 'child' for ages 0-12, 'adolescent' for ages 13-18, 'adult' for ages 19-60, and 'senior' for age...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_age('Sarah', 70) == 'Sarah is a senior.'\", \"assert categorize_age('Lucy', 9) == 'Lucy is a child.'\", \"assert categorize_age('Tom', 5) == 'Tom is a child.'\", \"assert categorize_age('Alice', 61) == 'Alice is a senior.'\", \"assert categorize_a...
{ "split": "train", "index": 70994, "acecode_id": "evol_29880", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given two strings, `actual_text` and `expected_text`, both representing lines of text. Your task is to implement a function `compare_texts(actual_text: str, expected_text: str) -> bool` that checks if the two strings are equal, line by line, while ignoring differences i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compare_texts('Hello\\\\nWorld', 'Hello\\\\nWorld') == True\", \"assert compare_texts('Hello\\\\r\\\\nWorld', 'Hello\\\\nWorld') == True\", \"assert compare_texts('Line 1\\\\nLine 2', 'Line 1\\\\r\\\\nLine 2') == True\", \"assert compare_texts('Line 1\\\\nLi...
{ "split": "train", "index": 70995, "acecode_id": "bigcode_python_fns_4560", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a data preprocessing function for time series data. The function should take into account different parameters to preprocess the data accordingly. Implement a function `model` that takes four parameters: \n- `typem` (integer): Type of model, de...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert model(1, False, 1, None) == 'Preprocessed data for type 1 with init=1, nc=1, window_length=None'\", \"assert model(1, True, 2, 10) == 'Preprocessed data for type 1 with init=5, nc=2, window_length=10'\", \"assert model(2, False, 3, 5) == 'Preprocessed data f...
{ "split": "train", "index": 70996, "acecode_id": "oss_6917", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple game of rock-paper-scissors. The function takes two parameters: the user's choice and the computer's choice, both of which can be 'rock', 'paper', or 'scissors'. The function should determine the outcome of the gam...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rock_paper_scissors('rock', 'scissors') == 'You win!'\", \"assert rock_paper_scissors('scissors', 'paper') == 'You win!'\", \"assert rock_paper_scissors('paper', 'rock') == 'You win!'\", \"assert rock_paper_scissors('rock', 'paper') == 'You lose!'\", \"asser...
{ "split": "train", "index": 70997, "acecode_id": "oss_28585", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that determines the maximum sum of any contiguous subarray. A contiguous subarray is defined as a non-empty sequence of elements that are adjacent in the original array. The function should return this maximum sum. If the list is empty...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_subarray_sum([-2, -3, -1]) == -1\", \"assert max_subarray_sum([5, 4, -1, 7, 8]) == 23\", \"assert max_subarray_sum([-1, -2, -3, -4]) == -1\", \"assert max_subarray_sum([1, 2, 3, 4]) == 10\", \"assert max_subarray_sum([0, 0, 0, 0]) == 0\", \"assert max_su...
{ "split": "train", "index": 70998, "acecode_id": "bigcode_python_fns_39326", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a custom error handling system for a cloud storage service. You need to implement a function called `handle_cloud_storage_error` that takes two parameters: `error_type` (a string indicating the type of error) and `details` (a string providing additi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_cloud_storage_error('InvalidBucketState', 'example_bucket') == 'Invalid state for bucket: example_bucket'\", \"assert handle_cloud_storage_error('InvalidDigest', 'digest_value') == 'Invalid digest value: digest_value'\", \"assert handle_cloud_storage_...
{ "split": "train", "index": 70999, "acecode_id": "oss_22186", "num_tests": 16 }