data_source
large_stringclasses
1 value
prompt
listlengths
1
1
ability
large_stringclasses
1 value
reward_model
dict
extra_info
dict
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a list of certificate chains and a dictionary of log URLs with their corresponding submission results. Your function should process each certificate in the certificate chains, validate them against the logs, and return a li...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_scts([[{'key_id': 'id1', 'signature': 'sig1'}, {'key_id': 'id2', 'signature': 'sig2'}]], {'log1': {'key_id': 'id1', 'signature': 'sig1'}, 'log2': None}) == [{'key_id': 'id1', 'signature': 'sig1'}]\", \"assert validate_scts([[{'key_id': 'id3', 'signa...
{ "split": "train", "index": 63700, "acecode_id": "bigcode_python_fns_4369", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `s`, write a function that returns a list containing all unique permutations of the characters in `s`. A permutation is an arrangement of all or part of a set of objects, with regard to the order of the arrangement. If the input string contains duplicate characte...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_permutations('abc') == ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']\", \"assert unique_permutations('a') == ['a']\", \"assert unique_permutations('ab') == ['ab', 'ba']\", \"assert unique_permutations('aab') == ['aab', 'aba', 'baa']\", \"assert unique_pe...
{ "split": "train", "index": 63701, "acecode_id": "oss_33057", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of strings, computes their lengths, and returns a dictionary mapping each string to its corresponding length. The function should be defined as `compute_string_lengths(strings: List[str]) -> Dict[str, int]`. The inpu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compute_string_lengths(['hello', 'world']) == {'hello': 5, 'world': 5}\", \"assert compute_string_lengths([''] ) == {'': 0}\", \"assert compute_string_lengths(['Python', 'AI', 'GPT']) == {'Python': 6, 'AI': 2, 'GPT': 3}\", \"assert compute_string_lengths(['t...
{ "split": "train", "index": 63702, "acecode_id": "oss_25896", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the coordinates of a molecule. Your task is to implement a function that checks if the coordinates of the molecule remain unchanged after a torsion scan is performed. A torsion scan is defined as creating a new set of coordinates by...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_coordinates_unchanged([1, 2, 3], [1, 2, 3]) == True\", \"assert check_coordinates_unchanged([0, 0, 0], [0, 0, 0]) == True\", \"assert check_coordinates_unchanged([4, 5, 6], [4, 5, 6]) == True\", \"assert check_coordinates_unchanged([1, 2, 3], [1, 2, 4]...
{ "split": "train", "index": 63703, "acecode_id": "bigcode_python_fns_22663", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that calculates the nth Fibonacci number using recursion. Additionally, the function should return the number of levels of recursion that occurred during the calculation. The function signature should be: def fibonacci(n: int) -> Tuple[int, int]: where t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci(0) == (0, 1)\", \"assert fibonacci(1) == (1, 1)\", \"assert fibonacci(2) == (1, 2)\", \"assert fibonacci(3) == (2, 3)\", \"assert fibonacci(4) == (3, 4)\", \"assert fibonacci(5) == (5, 5)\", \"assert fibonacci(6) == (8, 6)\", \"assert fibonacci(7) ...
{ "split": "train", "index": 63704, "acecode_id": "evol_19649", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of strings, write a function that merges all the strings into a single string without any separators. For example, given the input array ['apple', 'orange', 'banana'], the function should return 'appleorangebanana'.\nPlease reason step by step, then write a self-...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_strings(['apple', 'orange', 'banana']) == 'appleorangebanana'\", \"assert merge_strings(['hello', 'world']) == 'helloworld'\", \"assert merge_strings(['a', 'b', 'c', 'd']) == 'abcd'\", \"assert merge_strings(['123', '456', '789']) == '123456789'\", \"a...
{ "split": "train", "index": 63705, "acecode_id": "evol_26237", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers containing at least two elements, implement a function `closest_numbers(lst)` that returns the two integers from the list that are closest in value. The returned pair should be sorted in ascending order. Ensure that your solution efficiently handles cas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert closest_numbers([1, 2]) == (1, 2)\", \"assert closest_numbers([4, 2, 1, 3]) == (1, 2)\", \"assert closest_numbers([10, 20, 30, 25]) == (20, 25)\", \"assert closest_numbers([1, 100, 50, 49]) == (49, 50)\", \"assert closest_numbers([5, 5, 5, 5]) == (5, 5)\", \...
{ "split": "train", "index": 63706, "acecode_id": "evol_31682", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple graphics library for drawing shapes on a screen. The library allows you to clear the screen and draw basic shapes. You need to implement a function `draw_shapes` that takes the following parameters: `commands`, a list of tuples where ea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert draw_shapes([('clear',), ('rectangle', 1, 2, 3, 4), ('circle', 5, 5, 2)]) == ['Cleared', 'Drawn rectangle from (1, 2) to (3, 4)', 'Drawn circle at (5, 5) with radius 2']\", \"assert draw_shapes([('rectangle', 0, 0, 5, 5), ('clear',), ('circle', 10, 10, 3)]) ...
{ "split": "train", "index": 63707, "acecode_id": "oss_14992", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Write a function `array_info(arr: List[int]) -> Dict[str, Union[int, bool]]` that returns a dictionary containing the following information about the list: \n1. The length of the list (number of elements in the list) under the key 'length'. \n2...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert array_info([1, 2, 3]) == {'length': 3, 'is_empty': False, 'is_singleton': False}\", \"assert array_info([]) == {'length': 0, 'is_empty': True, 'is_singleton': False}\", \"assert array_info([42]) == {'length': 1, 'is_empty': False, 'is_singleton': True}\", \"...
{ "split": "train", "index": 63708, "acecode_id": "bigcode_python_fns_20055", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings, return the last string converted to an integer if it represents a positive integer. If the last string does not represent a positive integer or the list is empty, return a default value of 50. The input list will only contain strings. Implement the func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert make_count(['Emacs']) == 50\", \"assert make_count(['20']) == 20\", \"assert make_count(['\\u0431\\u0440\\u0435\\u0434', '15']) == 15\", \"assert make_count(['apple', 'banana', '30']) == 30\", \"assert make_count(['1', '2', '3', '4', '5']) == 5\", \"assert m...
{ "split": "train", "index": 63709, "acecode_id": "bigcode_python_fns_5356", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that sorts an array of integers in descending order using the quicksort algorithm. The function should take a list of integers as input and return a new list that contains the elements of the original list sorted from largest to smallest.\nPlease reason ste...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quicksort([3, 2, 9, 10, 1]) == [10, 9, 3, 2, 1]\", \"assert quicksort([5, 1, 4, 2, 8]) == [8, 5, 4, 2, 1]\", \"assert quicksort([20, 15, 30, 5]) == [30, 20, 15, 5]\", \"assert quicksort([-1, -3, -2]) == [-1, -2, -3]\", \"assert quicksort([0, 0, 0]) == [0, 0,...
{ "split": "train", "index": 63710, "acecode_id": "evol_12535", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, implement a function that checks whether the array contains any duplicates. The function should return true if the array does not contain any duplicates, and false if it does. You must implement this function without using any pre-defined methods or ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_duplicates([1, 2, 3, 4]) == True\", \"assert check_duplicates([1, 2, 3, 1]) == False\", \"assert check_duplicates([5, 6, 7, 8, 9]) == True\", \"assert check_duplicates([10, 20, 10]) == False\", \"assert check_duplicates([]) == True\", \"assert check_du...
{ "split": "train", "index": 63711, "acecode_id": "evol_24492", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two lists of integers, `poly1` and `poly2`, representing the coefficients of two polynomials in increasing order (i.e., the coefficient at index 0 is the constant term), write a function `multiply_polynomials(poly1: List[int], poly2: List[int]) -> List[int]` that returns ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multiply_polynomials([1, 2], [3, 4]) == [3, 10, 8]\", \"assert multiply_polynomials([2], [3]) == [6]\", \"assert multiply_polynomials([1, 0, 2], [2, 1]) == [2, 1, 4, 2]\", \"assert multiply_polynomials([], [1]) == []\", \"assert multiply_polynomials([1, 2, 3...
{ "split": "train", "index": 63712, "acecode_id": "bigcode_python_fns_33445", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes in a 1D list of numerical data and a list of labels. The function should return a list of formatted strings, where each string corresponds to a label and its associated data point. The format should be 'label: value'. Implement...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_label_data([10.5, 20.0, 30.75], ['A', 'B', 'C']) == ['A: 10.5', 'B: 20.0', 'C: 30.75']\", \"assert format_label_data([0.0, 1.1, 2.2], ['X', 'Y', 'Z']) == ['X: 0.0', 'Y: 1.1', 'Z: 2.2']\", \"assert format_label_data([-1.0, -2.0, -3.0], ['Neg1', 'Neg2',...
{ "split": "train", "index": 63713, "acecode_id": "bigcode_python_fns_139", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that filters video files from a list of filenames based on their extensions. You are given a list of filenames and a predefined list of video file extensions. Your goal is to create a function that takes this list of filenames as inpu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_video_files(['movie.mp4', 'photo.jpg', 'clip.avi']) == ['movie.mp4', 'clip.avi']\", \"assert get_video_files(['document.pdf', 'video.mkv', 'music.mp3']) == ['video.mkv']\", \"assert get_video_files(['video.mov', 'image.png', 'file.wmv']) == ['video.mov',...
{ "split": "train", "index": 63714, "acecode_id": "oss_29929", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of file paths, write a function `filter_file_extensions` that returns a sorted list of unique file extensions from those paths. The function should ignore hidden files (those starting with a dot) and should only consider files with extensions (i.e., files that cont...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_file_extensions(['file.txt', 'image.png', 'document', '.hiddenfile', 'script.py']) == ['.png', '.py', '.txt']\", \"assert filter_file_extensions(['.gitignore', 'README.md', 'app.py', 'favicon.ico']) == ['.ico', '.md', '.py']\", \"assert filter_file_ex...
{ "split": "train", "index": 63715, "acecode_id": "bigcode_python_fns_11248", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a user-friendly prompt for collecting login credentials. The function should accept two parameters: `login` and `password`. If either `login` or `password` is not provided (i.e., it is `None`), the function should return a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert collect_credentials(None, None) == 'Missing both login and password.'\", \"assert collect_credentials(None, 'mypassword') == 'Missing login.'\", \"assert collect_credentials('mylogin', None) == 'Missing password.'\", \"assert collect_credentials('admin', Non...
{ "split": "train", "index": 63716, "acecode_id": "bigcode_python_fns_48482", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given two matrices represented as lists of lists, `A` and `B`, where `A` has dimensions m x n and `B` has dimensions n x p, implement a function `matrix_multiply(A, B)` that returns the product of the two matrices. The resulting matrix should have dimensions m x p. You can assu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert matrix_multiply([[1, 2], [3, 4]], [[5, 6], [7, 8]]) == [[19, 22], [43, 50]]\", \"assert matrix_multiply([[1]], [[2]]) == [[2]]\", \"assert matrix_multiply([[1, 2, 3]], [[4], [5], [6]]) == [[32]]\", \"assert matrix_multiply([[1, 0], [0, 1]], [[1, 2], [3, 4]])...
{ "split": "train", "index": 63717, "acecode_id": "bigcode_python_fns_41731", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the volumes of different cases, write a function `convert_volumes(volumes: List[int]) -> List[str]` that returns a list of strings where each string describes the case ID and its corresponding volume in the format 'Case ID: X, Volume: Y'. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_volumes([10, 20, 0, -5, 15]) == ['Case ID: 1, Volume: 10', 'Case ID: 2, Volume: 20', 'Case ID: 5, Volume: 15']\", \"assert convert_volumes([-1, -2, -3]) == []\", \"assert convert_volumes([]) == []\", \"assert convert_volumes([1, 2, 3, 4, 5]) == ['Cas...
{ "split": "train", "index": 63718, "acecode_id": "bigcode_python_fns_34443", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates a simplified API request validation. The function will take in a list of host objects and validate certain conditions based on the host's primary key. The function should check if the list of hosts is empty and retur...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_api_request([]) == False\", \"assert simulate_api_request([Host(1)]) == False\", \"assert simulate_api_request([Host(2)]) == True\", \"assert simulate_api_request([Host(3)]) == False\", \"assert simulate_api_request([Host(4)]) == True\", \"assert si...
{ "split": "train", "index": 63719, "acecode_id": "oss_37181", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `is_prime(num: int) -> bool` that determines if a given integer is a prime number. A prime number is defined as an integer greater than 1 that has no positive divisors other than 1 and itself. Your function should return True if the number is prime and Fals...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_prime(1) == False\", \"assert is_prime(2) == True\", \"assert is_prime(3) == True\", \"assert is_prime(4) == False\", \"assert is_prime(5) == True\", \"assert is_prime(6) == False\", \"assert is_prime(7) == True\", \"assert is_prime(8) == False\", \"asser...
{ "split": "train", "index": 63720, "acecode_id": "evol_1428", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `find_twin_primes(num_pairs: int) -> List[Tuple[int, int]]` that returns the first `num_pairs` twin prime pairs. A twin prime pair is defined as a pair of prime numbers that differ by two. The function should be efficient in terms of both time and space com...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_twin_primes(1) == [(3, 5)]\", \"assert find_twin_primes(2) == [(3, 5), (5, 7)]\", \"assert find_twin_primes(3) == [(3, 5), (5, 7), (11, 13)]\", \"assert find_twin_primes(4) == [(3, 5), (5, 7), (11, 13), (17, 19)]\", \"assert find_twin_primes(5) == [(3, ...
{ "split": "train", "index": 63721, "acecode_id": "evol_14199", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function `multiply_primes(limit: int) -> int` that computes the multiplied total of all prime numbers less than the given numerical input `limit`. For example, if the input is 10, the function should return the product of the prime numbers 2, 3, 5, and 7, which is 210.\...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert multiply_primes(1) == 1\", \"assert multiply_primes(2) == 1\", \"assert multiply_primes(3) == 2\", \"assert multiply_primes(4) == 6\", \"assert multiply_primes(5) == 6\", \"assert multiply_primes(10) == 210\", \"assert multiply_primes(20) == 9699690\", \"ass...
{ "split": "train", "index": 63722, "acecode_id": "evol_12947", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that takes two integer parameters, `n` and `j`. The function should return a string that represents the value calculated by the expression `n - j + 1`. Your implementation should replicate this calculation and return the result as a string...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_output(5, 2) == '4'\", \"assert generate_output(10, 1) == '10'\", \"assert generate_output(8, 8) == '1'\", \"assert generate_output(15, 5) == '11'\", \"assert generate_output(7, 0) == '8'\", \"assert generate_output(1, 1) == '1'\", \"assert generate...
{ "split": "train", "index": 63723, "acecode_id": "oss_20314", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string that represents the filename of a Landsat scene in the format 'SENSOR_LANDSAT_LPATH_LROW_DATE.ext', write a function that extracts and returns a dictionary containing the sensor name, the path, the row, and the date of the scene. The keys in the dictionary should...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_scene_info('L8_OLI_TIRS_010_020_20210101.tif') == {'sensor': 'L8', 'lpath': '010', 'lrow': '020', 'date': '20210101'}\", \"assert get_scene_info('L5_TM_044_034_20000715.tif') == {'sensor': 'L5', 'lpath': '044', 'lrow': '034', 'date': '20000715'}\", \"ass...
{ "split": "train", "index": 63724, "acecode_id": "bigcode_python_fns_43375", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of file and folder names in a directory. Your task is to implement a function that filters out only the folder names from this list and returns them in a new list. Assume that a folder name is any string that does not contain a file extension (i.e., it does...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_folders(['Documents', 'file.txt', 'Photos', 'image.png', 'Videos', 'script.py']) == ['Documents', 'Photos', 'Videos']\", \"assert filter_folders(['Music', 'song.mp3', 'Archive', 'data.zip', 'Backup']) == ['Music', 'Archive', 'Backup']\", \"assert filt...
{ "split": "train", "index": 63725, "acecode_id": "bigcode_python_fns_2366", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that generates a list of n Fibonacci numbers. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. Your function should take an integer n as input and return ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci(0) == []\", \"assert fibonacci(1) == [0]\", \"assert fibonacci(2) == [0, 1]\", \"assert fibonacci(3) == [0, 1, 1]\", \"assert fibonacci(4) == [0, 1, 1, 2]\", \"assert fibonacci(5) == [0, 1, 1, 2, 3]\", \"assert fibonacci(6) == [0, 1, 1, 2, 3, 5]\",...
{ "split": "train", "index": 63726, "acecode_id": "oss_17803", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes a string representing a section of HTML content and counts the number of <h2> tags present in that section. Ensure your function appropriately handles any potential errors or exceptions that may arise during the processing of the HTML content. The fu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_h2_in_section('<div><h2>Title 1</h2><h2>Title 2</h2></div>') == 2\", \"assert count_h2_in_section('<div><h2>Header</h2><p>Some text</p></div>') == 1\", \"assert count_h2_in_section('<div><h3>Subheader</h3><h2>Another Title</h2></div>') == 1\", \"assert...
{ "split": "train", "index": 63727, "acecode_id": "evol_26763", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that sets a parent-child relationship between two nodes in a hierarchy. Each node is represented by a unique identifier (ID) which is a non-negative integer. The function should take two parameters: `child_id` and `parent_id`. The functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_parent(1, 2) == 1\", \"assert set_parent(3, 5) == 3\", \"assert set_parent(4, 4) == -1\", \"assert set_parent(10, 15) == 10\", \"assert set_parent(20, 19) == -1\", \"assert set_parent(7, 10) == 7\", \"assert set_parent(0, 1) == 0\", \"assert set_parent(2...
{ "split": "train", "index": 63728, "acecode_id": "bigcode_python_fns_37029", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of file names in a folder, where each file name consists of a simple name followed by a list of tags enclosed in square brackets. Your task is to implement a function that takes this list of file names and a list of filters, which represent the order of imp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert best_files(['report[summary]', 'report[details]', 'report[final]'], ['details', 'summary']) == ['report[details]']\", \"assert best_files(['video[hd]', 'video[sd]', 'video[4k]'], ['4k', 'hd']) == ['video[4k]']\", \"assert best_files(['fileA[version1]', 'file...
{ "split": "train", "index": 63729, "acecode_id": "bigcode_python_fns_48642", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given a sorted list of integers `array` and an integer `value`, write a function `find_ceil_index(array: List[int], value: int) -> int` that returns the smallest index `i` such that `array[i] >= value`. If no such index exists (i.e., `value` is greater than all elements in `arr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_ceil_index([], 5) == 0\", \"assert find_ceil_index([1, 2, 3, 4, 5], 0) == 0\", \"assert find_ceil_index([1, 2, 3, 4, 5], 3) == 2\", \"assert find_ceil_index([1, 2, 3, 4, 5], 6) == 5\", \"assert find_ceil_index([1, 2, 3, 4, 5], 5) == 4\", \"assert find_c...
{ "split": "train", "index": 63730, "acecode_id": "bigcode_python_fns_5771", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes texture coordinates for a 2D image. The function should take in the minimum and maximum UV coordinates and return a list containing the UV coordinates in a specific format. The function signature should be: `def proc...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_texture_coordinates((0.0, 0.0), (1.0, 1.0)) == [0.0, 0.0, 1.0, 1.0]\", \"assert process_texture_coordinates((0.1, 0.2), (0.3, 0.4)) == [0.1, 0.2, 0.3, 0.4]\", \"assert process_texture_coordinates((0.5, 0.5), (0.5, 0.5)) == [0.5, 0.5, 0.5, 0.5]\", \"a...
{ "split": "train", "index": 63731, "acecode_id": "oss_16651", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `classify_ip(ip: str) -> str` that takes a string representing an IP address and classifies it into one of the following categories: 'Class A', 'Class B', 'Class C', or 'Not a private IP'. The function should identify private IP addresses based on the following...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert classify_ip('10.0.0.1') == 'Class A'\", \"assert classify_ip('10.255.255.255') == 'Class A'\", \"assert classify_ip('172.16.0.1') == 'Class B'\", \"assert classify_ip('172.31.255.255') == 'Class B'\", \"assert classify_ip('172.32.0.1') == 'Not a private IP'\...
{ "split": "train", "index": 63732, "acecode_id": "evol_16253", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string `text` and a character `divider`, you need to sort the unique characters in `text` based on their frequency in descending order, and return a new string that contains the characters from the start of the sorted list up to (but not including) the `divider` charact...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_sorted_characters_before_divider('abacabad', 'c') == 'ab'\", \"assert get_sorted_characters_before_divider('aaabbbccc', 'b') == 'a'\", \"assert get_sorted_characters_before_divider('aabbcc', 'd') == 'abc'\", \"assert get_sorted_characters_before_divider(...
{ "split": "train", "index": 63733, "acecode_id": "bigcode_python_fns_11575", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Implement a function `check_prime(n)` that determines if a given integer n is a prime number. A prime number is defined as a number greater than 1 that has no positive divisors other than 1 and itself. The function should handle various types of inputs, including non-integer va...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_prime(2) == True\", \"assert check_prime(3) == True\", \"assert check_prime(4) == False\", \"assert check_prime(5) == True\", \"assert check_prime(10) == False\", \"assert check_prime(11) == True\", \"assert check_prime(13) == True\", \"assert check_pr...
{ "split": "train", "index": 63734, "acecode_id": "evol_28951", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating symbolic links based on a set of instructions provided in a list of strings. Each instruction specifies a source file and a destination link. Write a function `create_symlinks(instructions: List[str]) -> List[Tuple[str, str]]` that takes a list of i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_symlinks(['file1.txt -> link1', 'file2.txt -> link2']) == [('file1.txt', 'link1'), ('file2.txt', 'link2')]\", \"assert create_symlinks(['file1.txt -> link1', 'file1.txt -> link1']) == [('file1.txt', 'link1')]\", \"assert create_symlinks(['file1.txt ->...
{ "split": "train", "index": 63735, "acecode_id": "bigcode_python_fns_42913", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings where each string is formatted as 'timestamp;other_info;id;index', implement a function that processes this list and returns a list of dictionaries. Each dictionary should represent an update operation for Elasticsearch, containing the keys '_index', '_o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_updates(['2023-01-01T00:00:00;info1;1;index1', '2023-01-02T00:00:00;info2;2;index2']) == [{'_index': 'index1', '_op_type': 'update', '_id': '1', '_type': 'doc', '_source': {'doc': {'tsa': '2023-01-01T00:00:00'}}}, {'_index': 'index2', '_op_type': 'up...
{ "split": "train", "index": 63736, "acecode_id": "bigcode_python_fns_45976", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a product menu and updates the quantities based on user input. The function should take a list of products, where each product is represented as a dictionary with 'id', 'name', 'price', and 'quantity' keys. The function sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_product_quantities([{'id': 1, 'name': 'Pizza', 'price': 10.99, 'quantity': 20}], [25]) == [{'id': 1, 'name': 'Pizza', 'price': 10.99, 'quantity': 25}]\", \"assert update_product_quantities([{'id': 1, 'name': 'Pizza', 'price': 10.99, 'quantity': 20}, {...
{ "split": "train", "index": 63737, "acecode_id": "oss_11979", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list that may contain both integers and strings, implement a function `get_sum_and_product(lst)` that returns the sum and product of the integer elements in the list. If a string is encountered, it should be ignored. The function should return a tuple containing the sum...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_sum_and_product([1, 2, 3]) == (6, 6)\", \"assert get_sum_and_product([1, 'a', 3]) == (4, 3)\", \"assert get_sum_and_product(['a', 'b', 'c']) == (0, 1)\", \"assert get_sum_and_product([1, 0, 2]) == (3, 0)\", \"assert get_sum_and_product([-1, 2, 3]) == (4,...
{ "split": "train", "index": 63738, "acecode_id": "evol_25844", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of altitudes, a boolean list indicating a safe and ergodic set, and the shape of the world as a tuple representing the number of rows and columns. Implement a function that transforms the altitudes into a normalized 2D grid representation of the world, wher...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert transform_altitudes_to_grid([1.0, 2.0, 3.0], [True, False, True], (2, 2)) == [[1.0, None], [3.0, None]]\", \"assert transform_altitudes_to_grid([None, None, None], [False, False, False], (1, 3)) == [[None, None, None]]\", \"assert transform_altitudes_to_grid...
{ "split": "train", "index": 63739, "acecode_id": "bigcode_python_fns_16176", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `generate_results()` that generates all possible outcomes for a single instance of a Rock-paper-scissors game between two players. The function should return a list of strings representing each possible result based on the moves of Player 1 and Player 2. Ea...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_results() == ['Draw', 'Player 2 wins', 'Player 1 wins', 'Player 1 wins', 'Draw', 'Player 2 wins', 'Player 2 wins', 'Player 1 wins', 'Draw']\", \"assert generate_results() == ['Draw', 'Player 2 wins', 'Player 1 wins', 'Player 1 wins', 'Draw', 'Player...
{ "split": "train", "index": 63740, "acecode_id": "evol_35823", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a ReferenceLibrary class that holds a collection of ReferenceBook objects. Each ReferenceBook is initialized with a title. Implement a function `create_library(books: List[ReferenceBook]) -> List[ReferenceBook]` that takes a list of ReferenceBook ob...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_library([ReferenceBook('Book A'), ReferenceBook('Book B')]) == [ReferenceBook('Book A'), ReferenceBook('Book B')]\", \"assert create_library([ReferenceBook('Title 1')]) == [ReferenceBook('Title 1')]\", \"assert create_library([]) == []\", \"assert cre...
{ "split": "train", "index": 63741, "acecode_id": "bigcode_python_fns_26647", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of user IDs and a user ID of the creator. Your task is to create a function `create_relationships(secateur_user_pk: int, user_ids: List[int], screen_name: Optional[str] = None, until: Optional[datetime.datetime] = None) -> List[str]` that simulates creating...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_relationships(1, [2, 3, 4], 'Alice', datetime.datetime(2023, 10, 1)) == ['Created relationship with user 2 by Alice until 2023-10-01 00:00:00', 'Created relationship with user 3 by Alice until 2023-10-01 00:00:00', 'Created relationship with user 4 by...
{ "split": "train", "index": 63742, "acecode_id": "bigcode_python_fns_46695", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a function that identifies all elements within the list that can be expressed as the sum of two square numbers. The function should return a list of these integers. For example, if the input list is [2, 3, 4, 6, 8, 10], the output should be [2, 4...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert identify_two_square_sum_elements([2, 3, 4, 6, 8, 10]) == [2, 4, 8, 10]\", \"assert identify_two_square_sum_elements([5, 6, 7, 8, 9]) == [5, 8, 9]\", \"assert identify_two_square_sum_elements([30, 31, 32]) == [32]\", \"assert identify_two_square_sum_elements(...
{ "split": "train", "index": 63743, "acecode_id": "evol_2547", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing 'abscissas' and a probability distribution function 'dist' (as a callable). Your task is to implement a function that creates a local objective function based on the following criteria: The local objective function takes a single in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_objective(lambda x: 1 if x == 0 else 0, [1, 2, 3])(2) == 0\", \"assert create_objective(lambda x: 1, [0, 1, 2])(1) == 0\", \"assert create_objective(lambda x: 0.5, [1, 3, 5])(3) == 0\", \"assert create_objective(lambda x: 0.1, [1, 4, 7])(4) == 0\", \"...
{ "split": "train", "index": 63744, "acecode_id": "bigcode_python_fns_26649", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `greet_user(name: str) -> str` that takes a person's name as an input and returns a greeting message. The greeting message should be in the format 'Hello, {name}!', where {name} is the input name. If the input name is an empty string, the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert greet_user('Alice') == 'Hello, Alice!'\", \"assert greet_user('Bob') == 'Hello, Bob!'\", \"assert greet_user('') == 'Hello, Guest!'\", \"assert greet_user('Charlie') == 'Hello, Charlie!'\", \"assert greet_user('Diana') == 'Hello, Diana!'\", \"assert greet_us...
{ "split": "train", "index": 63745, "acecode_id": "bigcode_python_fns_33785", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the plotting of probability distributions based on a given set of parameters. Your function should take three inputs: a list of strings representing the names of degrees of freedom (`dof_names`), a 2D list of floats represe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert plot_distribution(['dof1', 'dof2'], [[0.1, 0.2], [0.3, 0.4]], [[0.5, 0.6], [0.7, 0.8]], [[0.01, 0.02], [0.03, 0.04]]) == [{'dof_name': 'dof1', 'mean': [0.1, 0.2], 'upper_bound': [0.5, 0.6], 'lower_bound': [0.01, 0.02]}, {'dof_name': 'dof2', 'mean': [0.3, 0.4...
{ "split": "train", "index": 63746, "acecode_id": "bigcode_python_fns_13414", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function named `is_staff_or_read_only` that determines whether a user has permission to perform a certain action on a resource based on their staff status. The function will take two parameters: a boolean `is_staff` indicating whether the user...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_staff_or_read_only(True, 'read') == True\", \"assert is_staff_or_read_only(True, 'create') == True\", \"assert is_staff_or_read_only(True, 'update') == True\", \"assert is_staff_or_read_only(True, 'delete') == True\", \"assert is_staff_or_read_only(False,...
{ "split": "train", "index": 63747, "acecode_id": "oss_20291", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with processing a list of instructions where each instruction contains a filepath and a boolean mask that indicates whether to include the corresponding example from the file. Your goal is to create a new list of filepaths based on the instructions provided. If t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_filepaths([{'filepath': 'file1.txt', 'mask': True}, {'filepath': 'file2.txt', 'mask': True}]) == ['file1.txt', 'file2.txt']\", \"assert filter_filepaths([{'filepath': 'file1.txt', 'mask': True}, {'filepath': 'file2.txt', 'mask': False}]) == ['file1.tx...
{ "split": "train", "index": 63748, "acecode_id": "bigcode_python_fns_2224", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dataset represented as a dictionary with the following keys: 'x', 'mean', 'std', 'y', and 'y0'. The 'x' key holds a list of numerical values, while 'mean' and 'std' are single numerical values representing the mean and standard deviation of 'x'. The 'y' key hold...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_data({'x': [1.0, 2.0, 3.0], 'mean': 2.0, 'std': 1.0, 'y': [1.0, 2.0, 3.0], 'y0': [0.5, 1.5, 2.5]}) == ([-2.0, 0.0, 2.0], [1.0, 2.0, 3.0], [1.0, 2.0, 3.0], [0.5, 1.5, 2.5], [-1.0, 0.0, 1.0])\", \"assert process_data({'x': [0.0, 0.0, 0.0], 'mean': 0.0,...
{ "split": "train", "index": 63749, "acecode_id": "bigcode_python_fns_20384", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a positive integer N, compute the quantity of unique canonical ellipsoidal triplets (a, b, c) such that a, b, and c are positive integers and a ≤ N, where the triplet satisfies the condition b^2 + c^2 = a^2. You need to implement a function `count_triplets(N: int) -> int`...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_triplets(1) == 0\", \"assert count_triplets(2) == 0\", \"assert count_triplets(3) == 0\", \"assert count_triplets(5) == 1\", \"assert count_triplets(10) == 2\"]}" }
{ "split": "train", "index": 63750, "acecode_id": "evol_25274", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that manages and processes data counts related to fixtures and models. Your function should keep track of three counts: the total count of fixtures, the total count of loaded objects, and the total count of fixture objects. Additional...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_data(0, 0, 0, ['model1']) == {'total_fixture_count': 0, 'total_loaded_object_count': 0, 'total_fixture_object_count': 0, 'unique_models': ['model1']}\", \"assert process_data(2, 4, 1, ['model1', 'model1']) == {'total_fixture_count': 2, 'total_loaded_...
{ "split": "train", "index": 63751, "acecode_id": "oss_15968", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Write a python function to count the number of rotations required to generate a sorted array. The function should be able to handle both ascending and descending sorted arrays, as well as arrays containing duplicate values. The function should return -1 if the array is not sort...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_rotations([3, 4, 5, 1, 2]) == 3\", \"assert count_rotations([1, 2, 3, 4, 5]) == 0\", \"assert count_rotations([5, 1, 2, 3, 4]) == 1\", \"assert count_rotations([4, 5, 1, 2, 3]) == 2\", \"assert count_rotations([2, 3, 4, 5, 1]) == 4\", \"assert count_ro...
{ "split": "train", "index": 63752, "acecode_id": "evol_25340", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of integers and returns the maximum sum of non-adjacent elements. Non-adjacent elements are those that are not next to each other in the list. For example, if the input list is [3, 2, 7, 10], the maximum sum of non-adjac...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_non_adjacent_sum([3, 2, 5, 10, 7]) == 15\", \"assert max_non_adjacent_sum([5, 1, 1, 5]) == 10\", \"assert max_non_adjacent_sum([1]) == 1\", \"assert max_non_adjacent_sum([1, 2]) == 2\", \"assert max_non_adjacent_sum([]) == 0\", \"assert max_non_adjacent_...
{ "split": "train", "index": 63753, "acecode_id": "oss_24034", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates executing a command-line interface (CLI) tool for code modification. Your function should take a command as input, represented as a list of strings, and return a tuple containing the simulated standard output and sta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert execute_command(['python', '-m', 'libcst.tool', 'codemod']) == ('Command executed successfully', None)\", \"assert execute_command(['python', '-m', 'libcst.tool', 'codemod', 'error']) == ('Command executed successfully', 'An error occurred')\", \"assert exec...
{ "split": "train", "index": 63754, "acecode_id": "oss_21259", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given `n` servers, each assigned a unique identifier from `0` to `n-1`. These servers are interconnected through a series of undirected `connections`, where each connection is represented as `connections[i] = [a, b]`, indicating a link between servers `a` and `b`. A con...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert critical_connections(4, [[0,1],[1,2],[2,0],[1,3]]) == [[1,3]] or critical_connections(4, [[0,1],[1,2],[2,0],[1,3]]) == [[3,1]]\", \"assert critical_connections(2, [[0,1]]) == [[0,1]]\", \"assert critical_connections(3, [[0,1],[0,2],[1,2]]) == []\", \"assert ...
{ "split": "train", "index": 63755, "acecode_id": "evol_16900", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the process of starting and stopping a screen recording. The function should accept a string input that represents the command to start the recording and another string input that represents the command to stop the recordin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert screen_recording('start', '') == 'Screen Recording Started'\", \"assert screen_recording('', 'stop') == 'Screen Recording Ended'\", \"assert screen_recording('', '') == 'No Action Taken'\", \"assert screen_recording('begin', 'stop') == 'No Action Taken'\", \...
{ "split": "train", "index": 63756, "acecode_id": "bigcode_python_fns_33914", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Implement a function `is_all_vowels(s: str) -> bool` that checks if the given string `s` consists entirely of vowel characters. The function should return `True` if all characters in the string are vowels (case-insensitive) and `False` otherwise. Vowels are defined as 'a', 'e',...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_all_vowels('aeiou') == True\", \"assert is_all_vowels('AEIOU') == True\", \"assert is_all_vowels('aeiouAEIOU') == True\", \"assert is_all_vowels('abc') == False\", \"assert is_all_vowels('123') == False\", \"assert is_all_vowels('!@#') == False\", \"asser...
{ "split": "train", "index": 63757, "acecode_id": "evol_15038", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the rate for a set of records based on their processing time in milliseconds. Write a function `calculate_rate(ms_per_record: List[float]) -> List[float]` that takes a list of floating-point numbers representing the processing time (in millisecon...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_rate([1000.0]) == [1.0]\", \"assert calculate_rate([500.0]) == [2.0]\", \"assert calculate_rate([250.0]) == [4.0]\", \"assert calculate_rate([100.0, 200.0, 300.0]) == [10.0, 5.0, 3.3333333333333335]\", \"assert calculate_rate([1.0, 2.0, 3.0, 4.0, 5...
{ "split": "train", "index": 63758, "acecode_id": "bigcode_python_fns_38228", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the total electricity consumption in kilowatt-hours (kWh) and the total cost for a residential property based on given inputs. Implement a function `calculate_electricity_cost(start_reading: int, end_reading: int, cost_per_kwh: float) -> float` t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_electricity_cost(100, 200, 0.15) == 15.0\", \"assert calculate_electricity_cost(50, 100, 0.20) == 10.0\", \"assert calculate_electricity_cost(0, 100, 0.10) == -1\", \"assert calculate_electricity_cost(100, 100, 0.10) == -1\", \"assert calculate_ele...
{ "split": "train", "index": 63759, "acecode_id": "oss_21756", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that generates a random integer representing a number of GitHub stars for a repository within a specified range. Your function should take in two parameters: `min_stars` and `max_stars`, which are integers that represent the minimu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_random_stars(1, 5) in {1, 2, 3, 4, 5}\", \"assert generate_random_stars(0, 0) == 0\", \"assert generate_random_stars(10, 10) == 10\", \"assert generate_random_stars(-5, 5) in {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}\", \"assert generate_random_stars(1...
{ "split": "train", "index": 63760, "acecode_id": "oss_26640", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of weights and a list of values representing items, along with a weight limit. Your task is to implement a function `knapsack(weight_limit, weights, values)` that returns a list of tuples representing the weights and values of the items that can be included...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert knapsack(50, [10, 20, 30], [60, 100, 120]) == [(20, 100), (30, 120)]\", \"assert knapsack(0, [1, 2, 3], [10, 20, 30]) == []\", \"assert knapsack(10, [15, 25], [10, 20]) == []\", \"assert knapsack(55, [20, 20, 20], [10, 20, 30]) == [(20, 20), (20, 30)]\", \"a...
{ "split": "train", "index": 63761, "acecode_id": "evol_19719", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a square 2D array (matrix), construct a function that returns a list containing the sums of both the main and secondary diagonals of the matrix. The main diagonal is defined as the diagonal that runs from the top left to the bottom right, while the secondary diagonal runs...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_diagonal_sums([[1]]) == [1, 1]\", \"assert get_diagonal_sums([[1, 2], [3, 4]]) == [5, 5]\", \"assert get_diagonal_sums([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [15, 15]\", \"assert get_diagonal_sums([[0, 0], [0, 0]]) == [0, 0]\", \"assert get_diagonal_sums(...
{ "split": "train", "index": 63762, "acecode_id": "evol_8799", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Given a 2D list of integers, write a function `variance_thresholding(arr: List[List[int]]) -> List[int]` that computes the variance of each row in the 2D list and returns a list of indices of the rows where the variance is less than or equal to 2. The variance of a row is defin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert variance_thresholding([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == [0, 1, 2]\", \"assert variance_thresholding([[0, 0, 0], [1, 1, 1], [2, 2, 2]]) == [0, 1, 2]\", \"assert variance_thresholding([[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == [0, 1, 2, 3, 4]\", \"assert...
{ "split": "train", "index": 63763, "acecode_id": "bigcode_python_fns_32061", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given a string consisting of alphanumeric characters and special symbols, implement a function called `reorder_chain` that rearranges the string such that every alternate character is reversed from its original position, while ignoring case sensitivity for alphanumeric characte...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reorder_chain('!@#$%^&*()') == ')(*&^%$#@!'\", \"assert reorder_chain('12345') == '54321'\", \"assert reorder_chain('test!test') == 'tset!tset'\", \"assert reorder_chain('') == ''\", \"assert reorder_chain('ZyXwVuT') == 'TuVwXyZ'\", \"assert reorder_chain('U...
{ "split": "train", "index": 63764, "acecode_id": "evol_13485", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Implement a function that computes the area of a triangle and classifies its type based on the lengths of its sides. The function should take three parameters representing the lengths of the triangle's sides. It should first validate whether these lengths can form a legitimate ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert area_triangle(3, 4, 5) == (6.00, 'Scalene')\", \"assert area_triangle(1, 2, 10) == -1\", \"assert area_triangle(3, 3, 3) == (3.90, 'Equilateral')\", \"assert area_triangle(5, 5, 8) == (12.00, 'Isosceles')\", \"assert area_triangle(2, 2, 3) == (1.98, 'Isoscel...
{ "split": "train", "index": 63765, "acecode_id": "evol_21739", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that calculates the Peak Signal-to-Noise Ratio (PSNR) for a pair of original and reconstructed images. The original image is represented as a 2D array of pixel values, `original_image`, and the reconstructed image is represente...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_psnr([[0]], [[0]]) == float('inf')\", \"assert calculate_psnr([[255]], [[255]]) == float('inf')\", \"assert calculate_psnr([[0, 0], [0, 0]], [[0, 0], [0, 0]]) == float('inf')\", \"assert calculate_psnr([[255, 255], [255, 255]], [[255, 255], [255, 2...
{ "split": "train", "index": 63766, "acecode_id": "oss_33288", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the instantiation of a client for a service based on provided parameters. The function should take the following input parameters: `api_name` (a string representing the API name), `api_version` (a string representing the AP...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_client('tacker', 'v1', 'us-west', 'public') == {'service_type': 'nfv-orchestration', 'region_name': 'us-west', 'endpoint_type': 'public', 'session': 'default_session'}\", \"assert create_client('nova', 'v2', 'eu-central', 'internal') == {'service_type...
{ "split": "train", "index": 63767, "acecode_id": "bigcode_python_fns_6400", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with verifying whether a given list of top-level domains (TLDs) is correctly loaded into a database. Write a function `is_tld_loaded(tld_list: List[str]) -> bool` that checks if the list of TLDs is non-empty and returns True if it contains at least one valid TLD,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_tld_loaded(['.com', '.org']) == True\", \"assert is_tld_loaded(['.net']) == True\", \"assert is_tld_loaded(['.xyz', '.info']) == True\", \"assert is_tld_loaded(['.edu', '.gov']) == True\", \"assert is_tld_loaded(['.io']) == True\", \"assert is_tld_loaded(...
{ "split": "train", "index": 63768, "acecode_id": "bigcode_python_fns_19427", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if a given hexadecimal transaction string is valid. A valid hexadecimal transaction string is defined as a string that: \n1. Contains only characters from the set [0-9, a-f].\n2. Has a length that is an even number.\n\nImpleme...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_hex_transaction('1a2b3c') == True\", \"assert is_valid_hex_transaction('abcdef') == True\", \"assert is_valid_hex_transaction('1234567890abcdef') == True\", \"assert is_valid_hex_transaction('1f') == True\", \"assert is_valid_hex_transaction('123g')...
{ "split": "train", "index": 63769, "acecode_id": "bigcode_python_fns_48349", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the power of a given base number 'n' raised to an exponent 'm' without using the direct exponentiation operator or any looping constructs. The exponent 'm' will be a non-negative integer. The function should return the result of n^m.\nPlease...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert power(2, 0) == 1\", \"assert power(2, 1) == 2\", \"assert power(2, 2) == 4\", \"assert power(2, 3) == 8\", \"assert power(3, 2) == 9\", \"assert power(5, 0) == 1\", \"assert power(5, 1) == 5\", \"assert power(7, 3) == 343\", \"assert power(10, 2) == 100\", \...
{ "split": "train", "index": 63770, "acecode_id": "evol_11734", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer n, implement a function `make_a_pile(n)` that returns a list of integers representing a pile of stones. The list should contain n elements where the i-th element (0-indexed) is equal to n + 2 * i. For example, if n = 3, the result should be [3, 5, 7].\nPlease r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert make_a_pile(0) == []\", \"assert make_a_pile(1) == [1]\", \"assert make_a_pile(2) == [2, 4]\", \"assert make_a_pile(3) == [3, 5, 7]\", \"assert make_a_pile(4) == [4, 6, 8, 10]\", \"assert make_a_pile(5) == [5, 7, 9, 11, 13]\", \"assert make_a_pile(6) == [6, ...
{ "split": "train", "index": 63771, "acecode_id": "evol_13030", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of gems, where each gem is represented as a dictionary containing the fields: 'id', 'name', 'description', and 'token_id'. Your task is to implement a function named `find_gem_by_token_id` that takes a list of gem dictionaries and a token ID. The function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_gem_by_token_id([{'id': 1, 'name': 'Ruby', 'description': 'Red gem', 'token_id': 100}, {'id': 2, 'name': 'Emerald', 'description': 'Green gem', 'token_id': 200}], 100) == {'id': 1, 'name': 'Ruby', 'description': 'Red gem', 'token_id': 100}\", \"assert f...
{ "split": "train", "index": 63772, "acecode_id": "oss_4319", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with validating a list of social media URLs. Write a function `validate_social_media_urls(urls: List[str]) -> List[bool]` that takes in a list of URLs and returns a list of boolean values. Each boolean value should indicate whether the corresponding URL is valid....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_social_media_urls(['http://facebook.com', 'https://twitter.com', 'ftp://example.com']) == [True, True, False]\", \"assert validate_social_media_urls(['https://linkedin.com', 'http://youtube.com']) == [True, True]\", \"assert validate_social_media_ur...
{ "split": "train", "index": 63773, "acecode_id": "oss_32833", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates pagination for a collection of items. The function should take a list of items and an integer `page_size` as input, and return a list of items for a specific page. The page number is zero-based, meaning page 0 refers...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_items_by_page(['a', 'b', 'c', 'd', 'e'], 2, 0) == ['a', 'b']\", \"assert get_items_by_page(['a', 'b', 'c', 'd', 'e'], 2, 1) == ['c', 'd']\", \"assert get_items_by_page(['a', 'b', 'c', 'd', 'e'], 2, 2) == ['e']\", \"assert get_items_by_page(['a', 'b', 'c'...
{ "split": "train", "index": 63774, "acecode_id": "oss_34498", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string containing a paragraph, write a function `word_frequency(paragraph: str, word: str) -> int` that separates each word, removes punctuation, and returns the frequency of the specified word in the paragraph. The function should ignore case and punctuation while coun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert word_frequency('The quick brown fox jumps over the lazy dog.', 'the') == 2\", \"assert word_frequency('Hello world! Hello everyone.', 'hello') == 2\", \"assert word_frequency('Python is great. Python is fun!', 'python') == 2\", \"assert word_frequency('A jou...
{ "split": "train", "index": 63775, "acecode_id": "evol_19032", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are designing a chatbot message handling function. The function should receive a user's message and a set of parameters that define the chatbot's behavior. The parameters include: 'max_turns_history' (an integer that indicates how many previous interactions should be consid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_bot_response('Hello!', 2, 0.1, 10) == 'Hello from the bot!'\", \"assert generate_bot_response('How are you?', 3, 0.2, 5) == 'Hello from the bot!'\", \"assert generate_bot_response('Tell me a joke @gif', 1, 0.5, 8) == 'Hello from the bot!'\", \"asser...
{ "split": "train", "index": 63776, "acecode_id": "bigcode_python_fns_21692", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `replace_start(text: str, pattern: str, repl: str, ignore_case: bool = False, escape: bool = True) -> str` that replaces the `pattern` at the start of the `text` string with the `repl` string. If `ignore_case` is set to `True`, the function should ignore ca...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replace_start('hello world', 'hello', 'hi') == 'hi world'\", \"assert replace_start('Hello world', 'hello', 'hi', ignore_case=True) == 'hi world'\", \"assert replace_start('hello world', 'world', 'everyone') == 'hello world'\", \"assert replace_start('abc', ...
{ "split": "train", "index": 63777, "acecode_id": "bigcode_python_fns_42650", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `substitute_numeral(text: str) -> str` that takes a string `text` as input and replaces every numeral (0-9) found within the string with the hashtag symbol (#). The function should return the modified string.\nPlease reason step by step, then write a self-conta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert substitute_numeral('Hello World 123!') == 'Hello World ###!'\", \"assert substitute_numeral('No numbers here!') == 'No numbers here!'\", \"assert substitute_numeral('Year 2023 is here.') == 'Year #### is here.'\", \"assert substitute_numeral('My age is 30.')...
{ "split": "train", "index": 63778, "acecode_id": "evol_11229", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that validates a configuration dictionary for a webDAV setup. The dictionary may or may not contain a 'webdav' key. If it contains the 'webdav' key, it should also contain 'server', 'username', and 'password' as its keys. If any of these ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_webdav_config({'webdav': {'server': 'http://example.com', 'username': 'user', 'password': 'pass'}}) == {'server': 'http://example.com', 'username': 'user', 'password': 'pass'}\", \"assert validate_webdav_config({'webdav': {'server': 'http://another-...
{ "split": "train", "index": 63779, "acecode_id": "bigcode_python_fns_26615", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a grading system for a fictional course. The function should take a student's score as input and return the corresponding letter grade based on the following grading scale: 90-100: A, 80-89: B, 70-79: C, 60-69: D, 0-59: F. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_grade(95) == 'A'\", \"assert calculate_grade(88) == 'B'\", \"assert calculate_grade(75) == 'C'\", \"assert calculate_grade(65) == 'D'\", \"assert calculate_grade(50) == 'F'\", \"assert calculate_grade(100) == 'A'\", \"assert calculate_grade(90) == ...
{ "split": "train", "index": 63780, "acecode_id": "oss_31695", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, rearrange the list in descending order without duplicates and compute the sum of the first 3 elements in the modified list. Implement a function `sum_of_top_three(lst)` that takes a list of integers as input and returns the sum of the first 3 elements ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_top_three([5, 3, 9, 2, 5, 9, 3]) == 17\", \"assert sum_of_top_three([1, 2, 3, 4, 5]) == 12\", \"assert sum_of_top_three([10, 10, 10, 5, 3]) == 18\", \"assert sum_of_top_three([7, 9, 8, 9, 6]) == 24\", \"assert sum_of_top_three([20, 15, 10, 5]) == 45\"...
{ "split": "train", "index": 63781, "acecode_id": "evol_34092", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a lazy deserialization mechanism for a custom data structure called `AuxData`. The `AuxData` class should have two attributes: `data` (a string) and `type_name` (also a string). The data should not be deserialized immediately when an `AuxData` o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert lazy_deserialize('test data 1', 'string') == \\\"AuxData(type_name='string', data='test data 1', )\\\"\", \"assert lazy_deserialize('another test', 'json') == \\\"AuxData(type_name='json', data='another test', )\\\"\", \"assert lazy_deserialize('12345', 'num...
{ "split": "train", "index": 63782, "acecode_id": "oss_17589", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that determines whether a given list of integers contains any even numbers. Your function should take a list of integers as input and return a boolean value. If the list contains at least one even number, the function should return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert contains_even([1, 3, 5]) == False\", \"assert contains_even([2, 3, 5]) == True\", \"assert contains_even([1, 2, 3]) == True\", \"assert contains_even([0]) == True\", \"assert contains_even([-1, -3, -5]) == False\", \"assert contains_even([-2, -3, -5]) == Tru...
{ "split": "train", "index": 63783, "acecode_id": "oss_9074", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string that may contain duplicate characters, write a function `print_permutations(s: str) -> List[str]` that returns all unique permutations of the characters in the string. The order of the permutations in the returned list should not matter. If the input string is em...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_permutations('a') == ['a']\", \"assert print_permutations('') == ['']\", \"assert print_permutations('aa') == ['aa']\", \"assert print_permutations('ab') == ['ab', 'ba']\", \"assert print_permutations('aaa') == ['aaa']\"]}" }
{ "split": "train", "index": 63784, "acecode_id": "evol_9359", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the compression and decompression of two file trees. The function should take two lists of strings, where each list represents the file names in a directory (tree), and return a boolean indicating whether the second tre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert can_find_second_tree(['file1.txt', 'file2.txt'], ['file3.txt']) == False\", \"assert can_find_second_tree(['file1.txt', 'file2.txt'], ['file1.txt']) == True\", \"assert can_find_second_tree(['a.txt', 'b.txt', 'c.txt'], ['b.txt']) == True\", \"assert can_find...
{ "split": "train", "index": 63785, "acecode_id": "bigcode_python_fns_37053", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings that represent file paths. Your task is to implement a function that takes this list of paths and returns a dictionary where each key is the filename (the last part of the path) and the value is the full path of that file. If the same filename ap...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert map_filenames_to_paths(['home/user/docs/file1.txt', 'home/user/docs/file2.txt', 'home/user/docs/file1.txt']) == {'file1.txt': 'home/user/docs/file1.txt', 'file2.txt': 'home/user/docs/file2.txt'}\", \"assert map_filenames_to_paths(['home/user/docs/file1.txt',...
{ "split": "train", "index": 63786, "acecode_id": "bigcode_python_fns_32697", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing an address in the format 'protocol://host:port', implement a function that extracts and returns the host and port as a tuple. If the address does not conform to this format, the function should raise a ValueError. The protocol can be any alphanumeric...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_address_host_port('tcp://1.2.3.4:80') == ('1.2.3.4', 80)\", \"assert get_address_host_port('http://example.com:8080') == ('example.com', 8080)\", \"assert get_address_host_port('udp://localhost:53') == ('localhost', 53)\", \"assert get_address_host_port(...
{ "split": "train", "index": 63787, "acecode_id": "bigcode_python_fns_18655", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that converts a floating-point number into its fixed-point representation. The fixed-point representation is derived by multiplying the floating-point number by 2 raised to the power of a specified number of fractional bits and then r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fxp(3.75, 2) == 15\", \"assert fxp(1.5, 1) == 3\", \"assert fxp(0.1, 4) == 2\", \"assert fxp(-2.25, 3) == -18\", \"assert fxp(5.125, 3) == 41\", \"assert fxp(0, 5) == 0\", \"assert fxp(2.5, 1) == 5\", \"assert fxp(-1.75, 2) == -7\", \"assert fxp(7.875, 3) ==...
{ "split": "train", "index": 63788, "acecode_id": "oss_3394", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a number of individuals, each identified by a unique number from 1 to N. Each individual may dislike certain other individuals, and you need to determine if it is possible to split these individuals into two groups such that no two individuals who dislike each oth...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert possibleBipartition(4, [[1,2],[1,3],[2,4]]) == True\", \"assert possibleBipartition(3, [[1,2],[1,3],[2,3]]) == False\", \"assert possibleBipartition(5, [[1,2],[2,3],[3,4],[4,5],[1,5]]) == False\", \"assert possibleBipartition(2, [[1,2]]) == True\", \"assert ...
{ "split": "train", "index": 63789, "acecode_id": "evol_27444", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of file names with their extensions. Write a function `get_file_extension(file_name: str) -> str` that takes a single string `file_name` as input, which represents the name of a file including its extension, and returns the extension of the file. The extens...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_file_extension('document.pdf') == 'pdf'\", \"assert get_file_extension('archive.tar.gz') == 'gz'\", \"assert get_file_extension('file_without_extension') == ''\", \"assert get_file_extension('image.jpeg ') == 'jpeg'\", \"assert get_file_extension('exampl...
{ "split": "train", "index": 63790, "acecode_id": "bigcode_python_fns_9289", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two dictionaries representing time scores with the following structure: `valid_time_scores` and `test_time_scores`, implement a function that calculates the general Intersection over Union (gIOU) score for the time intervals represented in these dictionaries. Each diction...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_giou_scores({'fact1': (1, 3), 'fact2': (2, 5)}, {'fact1': (2, 4), 'fact2': (5, 7)}) == {'fact1': 0.3333333333333333, 'fact2': 0.0}\", \"assert calculate_giou_scores({'fact1': (1, 3)}, {'fact1': (1, 2)}) == {'fact1': 0.5}\", \"assert calculate_giou_...
{ "split": "train", "index": 63791, "acecode_id": "bigcode_python_fns_37216", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given two lists of strings, `subdomain` and `domain`, each representing a domain and its subdomain in reversed order, write a function `domain_in_domain(subdomain: List[str], domain: List[str]) -> bool` that returns `True` if `subdomain` is a subdomain of `domain`, and `False` ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert domain_in_domain(['com', 'example'], ['com', 'example', 'www']) == True\", \"assert domain_in_domain(['com'], ['com', 'example', 'www']) == True\", \"assert domain_in_domain(['org', 'example'], ['com', 'example', 'www']) == False\", \"assert domain_in_domain...
{ "split": "train", "index": 63792, "acecode_id": "bigcode_python_fns_3507", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates the behavior of a command-line argument parser. Write a function `parse_command_line_args(verbose: bool, prune: bool, check: str, data: List[str], out: str) -> Dict[str, Union[bool, str, List[str]]]` that takes the followin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_command_line_args(True, False, 'normal', ['dir1', 'dir2'], 'output_dir') == {'verbose': True, 'prune': False, 'check': 'normal', 'data': ['dir1', 'dir2'], 'out': 'output_dir'}\", \"assert parse_command_line_args(False, True, 'strict', ['data1.xml'], 'o...
{ "split": "train", "index": 63793, "acecode_id": "bigcode_python_fns_20586", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of strings and returns a new list containing the same words but with all vowels removed. The order of the words in the new list should be reversed. Ensure that your function handles cases where the input is not a list or contains non-strin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_vowels_and_reverse(['hello', 'world']) == ['wrld', 'hll']\", \"assert remove_vowels_and_reverse(['python', 'is', 'fun']) == ['fn', 's', 'pythn']\", \"assert remove_vowels_and_reverse(['example', 'testing']) == ['tstng', 'xmpl']\", \"assert remove_vowe...
{ "split": "train", "index": 63794, "acecode_id": "evol_24454", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes a directed graph represented as an adjacency list. Given a directed graph in the form of a dictionary where the keys are nodes and the values are lists of nodes that each key points to, your function should return a lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert topological_sort({'A': ['B', 'C'], 'B': ['D'], 'C': ['D'], 'D': []}) == ['A', 'B', 'C', 'D']\", \"assert topological_sort({'A': ['B'], 'B': ['C'], 'C': ['D'], 'D': []}) == ['A', 'B', 'C', 'D']\", \"assert topological_sort({'A': ['B'], 'B': ['C'], 'C': ['A']}...
{ "split": "train", "index": 63795, "acecode_id": "bigcode_python_fns_17358", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a 2D grid represented as a list of lists, where each inner list contains integers, write a function `find_row_mins(grid)` that returns a list of the minimum values from each row of the grid in the order they appear. If a row is empty, it should not contribute to the outpu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_row_mins([[3, 7, 2, 8], [4, 1, 9, 5], [6, 0, 7, 2]]) == [2, 1, 0]\", \"assert find_row_mins([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [1, 4, 7]\", \"assert find_row_mins([[10, 20, 30], [5, 15, 25]]) == [10, 5]\", \"assert find_row_mins([[1], [2], [3]]) == [...
{ "split": "train", "index": 63796, "acecode_id": "oss_10288", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `bounded_list(max_length: int, elements: List[int]) -> List[int]` that simulates adding integers to a list with a maximum capacity. The function should take an integer `max_length` that represents the maximum capacity of the list and a list of integers `ele...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bounded_list(3, [1, 2, 3]) == [1, 2, 3]\", \"assert bounded_list(3, [1, 2, 3, 4]) == [2, 3, 4]\", \"assert bounded_list(2, [1, 2, 3, 4, 5]) == [4, 5]\", \"assert bounded_list(5, [1, 2, 3, 4]) == [1, 2, 3, 4]\", \"assert bounded_list(1, [1, 2, 3]) == [3]\", \...
{ "split": "train", "index": 63797, "acecode_id": "evol_6671", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function in Python that uses recursion to find the largest numerical value in a given list of integers. The function should be able to handle any list of integers. The function should be named 'find_max' and take a single parameter 'input_list', which is a list of i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_max([500, 20, 8, 1000, 1024]) == 1024\", \"assert find_max([-1, -5, -3]) == -1\", \"assert find_max([1, 2, 3, 4, 5]) == 5\", \"assert find_max([10]) == 10\", \"assert find_max([0, 0, 0]) == 0\", \"assert find_max([-10, -20, -30]) == -10\", \"assert find...
{ "split": "train", "index": 63798, "acecode_id": "evol_25129", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates the total size of all files with a specific file extension within a given list of file sizes and their corresponding extensions. You should write a Python function `calculate_total_file_size(file_sizes, file_extensions...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_total_file_size([100, 150, 200, 300], ['.txt', '.txt', '.txt', '.jpg'], '.txt') == 450\", \"assert calculate_total_file_size([50, 25, 75, 100], ['.jpg', '.jpg', '.png', '.png'], '.jpg') == 75\", \"assert calculate_total_file_size([500, 300, 400, 60...
{ "split": "train", "index": 63799, "acecode_id": "oss_10070", "num_tests": 15 }