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": "Write a function called 'concatenate_elements'. This function should receive four parameters: a list of strings 'words', a string 'separator', and two additional boolean parameters 'odd_positions_only' and 'consecutive_primes'. By default, these last parameters should be set to... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert concatenate_elements([], '-') == ''\", \"assert concatenate_elements(['one', 'two', 'three'], '-') == 'one-two-three'\", \"assert concatenate_elements(['apple', 'banana', 'cherry'], ', ') == 'apple, banana, cherry'\", \"assert concatenate_elements(['a', 'b',... | {
"split": "train",
"index": 2800,
"acecode_id": "evol_15548",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `find_max_sum_subarray(arr, k)` that finds the maximum sum of any contiguous subarray of size `k`. The function should return the maximum sum. If the array has fewer than `k` elements, return 0.\nPlease reason step by step, then write ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_max_sum_subarray([1, 2, 3, 4, 5], 2) == 9\", \"assert find_max_sum_subarray([2, 1, 5, 1, 3, 2], 3) == 9\", \"assert find_max_sum_subarray([1, 2, 3, 4, 5], 5) == 15\", \"assert find_max_sum_subarray([2, 3], 3) == 0\", \"assert find_max_sum_subarray([5], ... | {
"split": "train",
"index": 2801,
"acecode_id": "bigcode_python_fns_43427",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string s, implement a function that performs an in-place reversal of the string, excluding special characters and numbers. Additionally, ensure that all consonants in the reversed string are converted to uppercase while vowels remain unchanged. Write a single function `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_string('1234!@#$') == '1234!@#$'\", \"assert reverse_string('AeIoU') == 'UoIeA'\", \"assert reverse_string('A1E2I3O4U!') == 'U1O2I3E4A!'\", \"assert reverse_string('') == ''\", \"assert reverse_string('!@#$%^&*()') == '!@#$%^&*()'\", \"assert reverse... | {
"split": "train",
"index": 2802,
"acecode_id": "evol_35562",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function `print_unique_chars(s: str) -> List[str]` that takes a string as input and returns a list of unique characters present in the string, excluding any spaces. The order of the characters in the output list should be the order in which they first appeared in th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_unique_chars('Hello World') == ['H', 'e', 'l', 'o', 'W', 'r', 'd']\", \"assert print_unique_chars('') == []\", \"assert print_unique_chars('A B C A B C') == ['A', 'B', 'C']\", \"assert print_unique_chars('123 321') == ['1', '2', '3']\", \"assert print_... | {
"split": "train",
"index": 2803,
"acecode_id": "evol_3194",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with designing a function that processes a list of building attributes and filters them based on specific criteria. Given a list of buildings, where each building is represented as a dictionary with keys 'height' (an integer), 'name' (a string), and 'floors' (an ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_buildings([{'height': 10, 'name': 'Building A', 'floors': 3}, {'height': 20, 'name': 'Building B', 'floors': 5}], 15, 4) == [{'height': 20, 'name': 'Building B', 'floors': 5}]\", \"assert filter_buildings([{'height': 30, 'name': 'Building C', 'floors'... | {
"split": "train",
"index": 2804,
"acecode_id": "bigcode_python_fns_12856",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a numerical value `obj`, implement a function `to_percent(obj: float, significant_digits: int) -> str` that converts the value into a percentage format with a specified number of significant digits. The function should return the percentage as a string followed by the '%'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert to_percent(0.0001, 4) == '0.01%'\", \"assert to_percent(None, 3) == ''\", \"assert to_percent('invalid', 2) == ''\", \"assert to_percent(0.0456, 2) == '4.6%'\", \"assert to_percent(0.0, 3) == '0.0%'\", \"assert to_percent(10, 3) == '1000.0%'\"]}"
} | {
"split": "train",
"index": 2805,
"acecode_id": "oss_14122",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Write a function `normalized_state_to_tensor(state: Dict[str, float], global_state_variables: List[str]) -> List[float]` that transforms a normalized state represented as a dictionary into a list. The function should ensure that the elements are ordered according to the list of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert normalized_state_to_tensor({'a': 1.0, 'b': 2.0}, ['b', 'a', 'c']) == [2.0, 1.0, 0.0]\", \"assert normalized_state_to_tensor({'x': 0.5, 'y': 0.3}, ['y', 'x', 'z']) == [0.3, 0.5, 0.0]\", \"assert normalized_state_to_tensor({}, ['alpha', 'beta']) == [0.0, 0.0]\... | {
"split": "train",
"index": 2806,
"acecode_id": "bigcode_python_fns_47276",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `find_common_prime_coordinates(lst1: List[List[int]], lst2: List[List[int]]) -> Tuple[List[int], List[Tuple[int, int]], List[Tuple[int, int]]]` that accepts two 2D lists of integers. The function should return a tuple containing a list of unique prime numbe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_common_prime_coordinates([[1, 4, 6], [8, 9, 10]], [[12, 14, 15], [16, 18, 20]]) == ([], [], [])\", \"assert find_common_prime_coordinates([[2, 3, 5]], [[2, 3, 5]]) == ([2, 3, 5], [(0, 0), (0, 1), (0, 2)], [(0, 0), (0, 1), (0, 2)])\", \"assert find_commo... | {
"split": "train",
"index": 2807,
"acecode_id": "evol_11833",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes in a list of strings representing car brands and a list of strings representing car models. The function should return a list of strings, where each string is a concatenation of a brand and a model, formatted as 'brand model'. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert combine_brands_and_models(['Ford'], ['Mustang']) == 'Ford Mustang'\", \"assert combine_brands_and_models(['Chevrolet'], ['Impala', 'Malibu']) == 'Chevrolet Impala, Chevrolet Malibu'\", \"assert combine_brands_and_models([], ['Civic']) == ''\", \"assert combi... | {
"split": "train",
"index": 2808,
"acecode_id": "oss_25025",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function to manage a game's high scores. The function should take a list of tuples containing player names and scores, and return a list of dictionaries where each dictionary contains the player's name and score, ordered by the score in descending... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_high_scores([('Player1', 100), ('Player2', 150)]) == [{'name': 'Player2', 'score': 150}, {'name': 'Player1', 'score': 100}]\", \"assert manage_high_scores([('Alice', 200), ('Bob', 200), ('Charlie', 150)]) == [{'name': 'Alice', 'score': 200}, {'name': ... | {
"split": "train",
"index": 2809,
"acecode_id": "oss_8855",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that initializes a sensor object with an ID or name and a comment. The function should take three parameters: a dictionary 'data' which will hold the sensor information, a string 'name' representing the ID or name of the sensor, and a str... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert (data := {}) or True; initialize_sensor(data, 'sensor1', 'This is a test sensor'); assert data['id_or_name'] == 'sensor1' and data['comment'] == 'This is a test sensor'\", \"assert (data := {}) or True; initialize_sensor(data, 'sensor2', 'Monitoring temperat... | {
"split": "train",
"index": 2810,
"acecode_id": "bigcode_python_fns_36398",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a decimal number representing an angle in turns, write a function that converts this angle to radians. The function should take a single parameter, `turns`, which is a float, and return the equivalent angle in radians as a float. The conversion formula is: radians = 2 * π... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert turns_to_radians(0) == 0.0\", \"assert turns_to_radians(0.25) == 1.5707963267948966\", \"assert turns_to_radians(0.5) == 3.141592653589793\", \"assert turns_to_radians(0.75) == 4.71238898038469\", \"assert turns_to_radians(1) == 6.283185307179586\", \"assert... | {
"split": "train",
"index": 2811,
"acecode_id": "evol_1161",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of prices representing the cost of items in a store. Your task is to write a Python function named `calculate_total_cost` that calculates and returns the total cost of all the items in the list. The function should take a single parameter: `prices`, which i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_total_cost([10, 20, 30, 40]) == 100\", \"assert calculate_total_cost([5, 15, 25]) == 45\", \"assert calculate_total_cost([1000]) == 1000\", \"assert calculate_total_cost([1, 2, 3, 4, 5]) == 15\", \"assert calculate_total_cost([250, 750]) == 1000\",... | {
"split": "train",
"index": 2812,
"acecode_id": "oss_652",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a color code validator. The validator should check whether the input color code is valid based on specified criteria. The function `validate_color(value: str, allow_alpha: bool) -> bool` should be implemented, which performs the following checks... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_color('#FFA500', False) == True\", \"assert validate_color('#000000', False) == True\", \"assert validate_color('#FFFFFF', False) == True\", \"assert validate_color('#123456', False) == True\", \"assert validate_color('#ZZZZZZ', False) == False\", \... | {
"split": "train",
"index": 2813,
"acecode_id": "oss_32946",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `highest_odd_number` that returns the largest odd integer from the list. If there are no odd integers, return -1.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```pyth... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert highest_odd_number([1, 2, 3, 4, 5]) == 5\", \"assert highest_odd_number([2, 4, 6, 8]) == -1\", \"assert highest_odd_number([7, 3, 1, 9]) == 9\", \"assert highest_odd_number([-1, -3, -5]) == -1\", \"assert highest_odd_number([0, 1, 2, 3, 4]) == 3\", \"assert ... | {
"split": "train",
"index": 2814,
"acecode_id": "evol_11327",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that manages game data diffs and timestamps for different patch versions. The function should be able to update and retrieve the latest game data diff and timestamp based on given inputs. You will receive a list of updates, where each... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_game_patches([]) == ('', '')\", \"assert manage_game_patches([(1, 'Diff for patch 1', '2023-01-01 10:00:00')]) == ('Diff for patch 1', '2023-01-01 10:00:00')\", \"assert manage_game_patches([(1, 'Diff for patch 1', '2023-01-01 10:00:00'), (2, 'Diff fo... | {
"split": "train",
"index": 2815,
"acecode_id": "oss_8243",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function `generate_password` that generates a strong password of a specified length between 16 and 30 characters. The password must include at least one uppercase letter, one lowercase letter, one digit, and one special character. Additionally, the password must not... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_password(16) is not None\", \"assert 16 <= len(generate_password(16)) <= 30\", \"assert any(c.isupper() for c in generate_password(17))\", \"assert any(c.islower() for c in generate_password(18))\", \"assert any(c.isdigit() for c in generate_passwor... | {
"split": "train",
"index": 2816,
"acecode_id": "evol_13428",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `generate_pdf` that takes three optional boolean parameters: `clean`, `clean_tex`, and `silent`. The `clean` parameter specifies whether to clean up temporary files after PDF generation (returns True if files are cleaned, otherwise Fa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_pdf(True, False, False) == ('Output generated', True)\", \"assert generate_pdf(True, True, False) == ('Output generated', True)\", \"assert generate_pdf(False, False, False) == ('Output generated', False)\", \"assert generate_pdf(True, False, True) ... | {
"split": "train",
"index": 2817,
"acecode_id": "oss_7428",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a mathematical model as input and returns a specific representation of that model. The function should accept one of the following types of models: 'SympyOpt', 'Docplex', 'LpProblem', 'QuadraticProgram', 'PauliSumOp', 'BinaryQu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transpile('SympyOpt') == 'SympyOpt'\", \"assert transpile('Docplex') == 'Docplex'\", \"assert transpile('LpProblem') == 'LpProblem'\", \"assert transpile('QuadraticProgram') == 'QuadraticProgram'\", \"assert transpile('PauliSumOp') == 'PauliSumOp'\", \"asser... | {
"split": "train",
"index": 2818,
"acecode_id": "bigcode_python_fns_19757",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a version number represented as a tuple of integers and increments the version number by a specified component (major, minor, or patch). The version number is represented as (major, minor, patch). The function should increm... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert increment_version((1, 0, 0), 0, 1) == (2, 0, 0)\", \"assert increment_version((1, 0, 0), 1, 1) == (1, 1, 0)\", \"assert increment_version((1, 0, 0), 2, 1) == (1, 0, 1)\", \"assert increment_version((1, 2, 3), 0, 1) == (2, 0, 0)\", \"assert increment_version(... | {
"split": "train",
"index": 2819,
"acecode_id": "oss_24220",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to perform an in-place sorting algorithm on a list of integers using a variation of the quicksort algorithm. Instead of choosing the last element as the pivot, you should choose the median of the first, middle, and last elements as th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert median_quick_sort([3, 6, 8, 10, 1, 2, 1]) is None and [1, 1, 2, 3, 6, 8, 10] == [1, 1, 2, 3, 6, 8, 10]\", \"assert median_quick_sort([5, 3, 8, 1, 2]) is None and [1, 2, 3, 5, 8] == [1, 2, 3, 5, 8]\", \"assert median_quick_sort([9, 7, 5, 3, 1]) is None and [1... | {
"split": "train",
"index": 2820,
"acecode_id": "oss_458",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function named `calculate_remaining_fuel` that determines the remaining fuel in a car after traveling a specified distance. The car has a model, speed (in mph), mileage (in miles per gallon), fuel type, and fuel capacity (in gallons). The function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_remaining_fuel(60, 30, 15, 60) == 13.0\", \"assert calculate_remaining_fuel(50, 25, 10, 50) == 8.0\", \"assert calculate_remaining_fuel(70, 35, 20, 140) == 16.0\", \"assert calculate_remaining_fuel(100, 20, 10, 200) == 0.0\", \"assert calculate_rem... | {
"split": "train",
"index": 2821,
"acecode_id": "evol_16439",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of tags represented as dictionaries, where each tag has an 'id' and a 'name'. Your task is to return a list of tags that are alive (i.e., the tags that are not marked as deleted). A tag is considered alive if its 'alive' property is set to True. The returne... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_alive_tags([{'id': 1, 'name': 'v1.0', 'alive': True}, {'id': 2, 'name': 'v1.1', 'alive': False}, {'id': 3, 'name': 'v1.2', 'alive': True}]) == [{'id': 1, 'name': 'v1.0'}, {'id': 3, 'name': 'v1.2'}]\", \"assert get_alive_tags([{'id': 1, 'name': 'v1.0', 'a... | {
"split": "train",
"index": 2822,
"acecode_id": "bigcode_python_fns_4867",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that takes a string `sentence` and a single character `character`, and returns the total count of how many times `character` appears in `sentence`. The function should be case-sensitive and should return 0 if the character is not found.\nPlease reason step by s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_char('Hello, World!', 'l') == 3\", \"assert count_char('Python Programming', 'P') == 2\", \"assert count_char('Data Science', 'a') == 2\", \"assert count_char('abcdefg', 'z') == 0\", \"assert count_char('CaseSensitive', 'c') == 0\", \"assert count_char... | {
"split": "train",
"index": 2823,
"acecode_id": "evol_22636",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to manage a server's shutdown status. Your goal is to create a function named `server_shutdown_process` that takes a list of commands and returns the final shutdown status of the server. The function should handle the following comman... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert server_shutdown_process(['status', 'initiate', 'status', 'cancel', 'status']) == [False, True, False]\", \"assert server_shutdown_process(['initiate', 'status', 'initiate', 'status', 'cancel', 'status']) == [True, True, False]\", \"assert server_shutdown_pro... | {
"split": "train",
"index": 2824,
"acecode_id": "oss_33682",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that checks the login status of an administrator based on a session represented as a dictionary. Implement the function `check_admin_login_status(session)` that takes a dictionary `session` as input and returns a JSON response base... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_admin_login_status({'username': 'admin', 'admin_id': 1, 'avatar': 'avatar_url'}) == {'code': 200, 'msg': '\\u5df2\\u767b\\u5f55', 'data': {'username': 'admin', 'admin_id': 1, 'avatar': 'avatar_url'}}\", \"assert check_admin_login_status({'username': No... | {
"split": "train",
"index": 2825,
"acecode_id": "oss_19102",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Create a function `generate_array_sum(n)` that generates an array of n integers such that each element is the square of the index modulo 20, i.e., if the index is i, then the element should be (i^2) % 20. The function should return the generated array. Let n range from 0 to 20,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_array_sum(0) == [0]\", \"assert generate_array_sum(1) == [0, 1]\", \"assert generate_array_sum(2) == [0, 1, 4]\", \"assert generate_array_sum(3) == [0, 1, 4, 9]\", \"assert generate_array_sum(4) == [0, 1, 4, 9, 16]\", \"assert generate_array_sum(5) ... | {
"split": "train",
"index": 2826,
"acecode_id": "evol_11886",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that simulates the provisioning of a writable segment in a data storage system. The function should take a `segment_id` (a string) and a `schema_id` (a string) as input parameters and return a response in JSON format. If the provis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert provision_segment('segment123', 'schema456') == '{\\\"segment_id\\\": \\\"segment123\\\", \\\"status\\\": \\\"provisioned\\\"}'\", \"assert provision_segment('segment789', 'schema012') == '{\\\"segment_id\\\": \\\"segment789\\\", \\\"status\\\": \\\"provisio... | {
"split": "train",
"index": 2827,
"acecode_id": "oss_16165",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a connection string for a flight client. The connection string is formatted as \"param1=value1;param2=value2;...\" and contains parameters for connecting to a server. Your function should extract and return the values o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_parameters('username=user;password=pass;host=localhost;port=8080') == {'username': 'user', 'password': 'pass', 'host': 'localhost', 'port': '8080'}\", \"assert extract_parameters('username=user;host=localhost;port=8080') == {'username': 'user', 'pass... | {
"split": "train",
"index": 2828,
"acecode_id": "oss_11469",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string template that contains placeholders in the form of `{key}`. You also have a dictionary called context that maps these keys to their corresponding values. Your task is to implement a function `expand_template(context: dict, template: str) -> str` that repl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert expand_template({'name': 'Alice', 'age': '25'}, 'Hello, {name}. You are {age} years old.') == 'Hello, Alice. You are 25 years old.'\", \"assert expand_template({'color': 'blue'}, 'The sky is {color}.') == 'The sky is blue.'\", \"assert expand_template({}, 'T... | {
"split": "train",
"index": 2829,
"acecode_id": "bigcode_python_fns_38174",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `count_elements_greater_than_or_equal(ref: List[float], threshold: float) -> int` that calculates the number of elements in the `ref` list that are greater than or equal to the given `threshold`. The function should return the count o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_elements_greater_than_or_equal([1.0, 0.5, 0.0], 0.5) == 2\", \"assert count_elements_greater_than_or_equal([1.2, 1.5, 1.8, 2.0], 1.5) == 3\", \"assert count_elements_greater_than_or_equal([0.0, 0.0, 0.0], 0.0) == 3\", \"assert count_elements_greater_th... | {
"split": "train",
"index": 2830,
"acecode_id": "oss_16031",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the total number of hours for service submissions based on their status. You are given two lists of submissions, each represented as a list of dictionaries. Each submission contains the keys 'status' (which can be 'pending', 'submitted', or 'appr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_hours([{'status': 'pending', 'hours': 1}, {'status': 'submitted', 'hours': 2}]) == (3, 0)\", \"assert calculate_hours([{'status': 'approved', 'hours': 10}, {'status': 'approved', 'hours': 5}]) == (0, 15)\", \"assert calculate_hours([{'status': 'pen... | {
"split": "train",
"index": 2831,
"acecode_id": "bigcode_python_fns_21016",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `binary_search(arr: List[int], x: int) -> int` that performs a binary search on a sorted array `arr` and returns the index of the element `x` if it is present in the array. If `x` is not present in the array, return -1. The input array is guaranteed to be s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert binary_search([1, 2, 3, 4, 5], 3) == 2\", \"assert binary_search([10, 20, 30, 40, 50], 10) == 0\", \"assert binary_search([1, 3, 5, 7, 9], 1) == 0\", \"assert binary_search([1, 3, 5, 7, 9], 9) == 4\", \"assert binary_search([2, 4, 6, 8, 10], 6) == 2\", \"ass... | {
"split": "train",
"index": 2832,
"acecode_id": "evol_31968",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the retrieval of a versioned workflow given a unique identifier and a version string. Implement a function `retrieve_workflow(workflow_id: str, version: str) -> str` that takes a `workflow_id` and a `version` as input and r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert retrieve_workflow('workflow_1', '1.0') == 'Workflow ID: workflow_1, Version: 1.0'\", \"assert retrieve_workflow('test_workflow', '2.1.5') == 'Workflow ID: test_workflow, Version: 2.1.5'\", \"assert retrieve_workflow('example_workflow', '0.0.1') == 'Workflow ... | {
"split": "train",
"index": 2833,
"acecode_id": "bigcode_python_fns_7990",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that utilizes the Quick sort algorithm to reorder a given list of alphanumeric strings in lexicographical order. The function should take a list of strings as input and return a new list that contains the same strings sorted in lexicographical order.\nPleas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quick_sort(['apple', 'banana', 'cherry']) == ['apple', 'banana', 'cherry']\", \"assert quick_sort(['banana', 'apple', 'cherry']) == ['apple', 'banana', 'cherry']\", \"assert quick_sort(['cherry', 'apple', 'banana']) == ['apple', 'banana', 'cherry']\", \"asse... | {
"split": "train",
"index": 2834,
"acecode_id": "evol_35839",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `make_palindrome` that builds the shortest possible palindrome that starts with the given string, ignoring case and non-alphanumeric characters. Your function should first create a helper function, `longest_palindromic_postfix`, that finds the longest palindrom... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_palindrome('') == ''\", \"assert make_palindrome('cat') == 'catac'\", \"assert make_palindrome('cata') == 'catac'\", \"assert make_palindrome('race') == 'racecar'\", \"assert make_palindrome('a') == 'a'\", \"assert make_palindrome('a!b@c#d$c#b@a!') == '... | {
"split": "train",
"index": 2835,
"acecode_id": "evol_16762",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a simplified priority queue. The function should accept a list of tasks, where each task is represented as a tuple containing the task name (a string) and its priority (an integer). The priority levels are defined as fo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_tasks([('taskA', 8), ('taskB', 8), ('taskC', 4)]) == ['taskA', 'taskB', 'taskC']\", \"assert process_tasks([('task1', 0), ('task2', 0), ('task3', 0)]) == ['task1', 'task2', 'task3']\", \"assert process_tasks([]) == []\", \"assert process_tasks([('tas... | {
"split": "train",
"index": 2836,
"acecode_id": "oss_21025",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the absolute magnitude of stars given their apparent magnitude and distance from Earth. Write a function `calculate_absolute_magnitude(apparent_magnitude: float, distance: float) -> float` that takes in two parameters: `apparent_magnitude` (a flo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_absolute_magnitude(0.0, 1.0) == 5.0\", \"assert calculate_absolute_magnitude(1.0, 0.0) == None\", \"assert calculate_absolute_magnitude(1.0, -1.0) == None\", \"assert calculate_absolute_magnitude(4.0, 1.0) == 9.0\", \"assert calculate_absolute_magn... | {
"split": "train",
"index": 2837,
"acecode_id": "oss_431",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Implement a function `rgb_to_hsv(r: int, g: int, b: int) -> Tuple[float, float, float]` that converts RGB color values to HSV color values. The input values for RGB must be integers in the range [0, 255]. If the input values are out of bounds, raise a ValueError with the messag... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rgb_to_hsv(255, 0, 0) == (0.0, 1.0, 1.0)\", \"assert rgb_to_hsv(0, 255, 0) == (120.0, 1.0, 1.0)\", \"assert rgb_to_hsv(0, 0, 255) == (240.0, 1.0, 1.0)\", \"assert rgb_to_hsv(255, 255, 0) == (60.0, 1.0, 1.0)\", \"assert rgb_to_hsv(0, 255, 255) == (180.0, 1.0,... | {
"split": "train",
"index": 2838,
"acecode_id": "evol_6723",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given an integer array `nums` where the `ith` basket contains `nums[i]` apples. You are also given an integer `maxOperations`. You can perform the following operation at most `maxOperations` times: Take any basket of apples and divide it into two new baskets with a posi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert maximumPenalty([9], 2) == 3\", \"assert maximumPenalty([2, 4, 8, 2], 4) == 2\", \"assert maximumPenalty([7, 17], 2) == 7\", \"assert maximumPenalty([5, 5, 5], 2) == 5\", \"assert maximumPenalty([10], 1) == 5\", \"assert maximumPenalty([1, 2, 3, 4], 3) == 2\"... | {
"split": "train",
"index": 2839,
"acecode_id": "evol_13636",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given a string `s`, a start substring `start`, and an end substring `end`, write a function `shortest_string_between_substrings(s: str, start: str, end: str) -> str` that finds the shortest substring between the first occurrence of `start` and the first occurrence of `end` that... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert shortest_string_between_substrings('This is a string', 'is', 'a') == ' '\", \"assert shortest_string_between_substrings('abc xyz abc', 'abc', 'xyz') == ' '\", \"assert shortest_string_between_substrings('abc def ghi jkl', 'def', 'jkl') == ' ghi '\", \"assert... | {
"split": "train",
"index": 2840,
"acecode_id": "evol_1068",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given a natural number or a list of natural numbers, implement a function that checks if each number is a palindrome. A palindrome is a number that remains the same when its digits are reversed. The function should not convert the number or individual numbers in a list into str... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_palindrome([121, 123, 11]) == [True, False, True]\", \"assert check_palindrome([0, 1, 2]) == [True, True, True]\", \"assert check_palindrome([10, 20, 30]) == [False, False, False]\", \"assert check_palindrome([999, 123456789987654321]) == [True, True]\... | {
"split": "train",
"index": 2841,
"acecode_id": "evol_24018",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Write a function `secs_to_str(secs: int) -> str` that converts a given number of seconds into a string representation of time. The output should format the time in weeks, days, hours, minutes, and seconds, using the format `02w 02d 02h 02m 02s`. If any unit is zero, it should s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert secs_to_str(0) == '00w 00d 00h 00m 00s'\", \"assert secs_to_str(59) == '00w 00d 00h 00m 59s'\", \"assert secs_to_str(60) == '00w 00d 00h 01m 00s'\", \"assert secs_to_str(3600) == '00w 00d 01h 00m 00s'\", \"assert secs_to_str(86400) == '00w 01d 00h 00m 00s'\"... | {
"split": "train",
"index": 2842,
"acecode_id": "bigcode_python_fns_43661",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple encryption and decryption system. Write a function `process_text(mode: str, key: str, text: str) -> str` that takes three parameters: a mode ('e' for encode or 'd' for decode), a key (a string used for encryption or decryption), and a text ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_text('e', '', 'data') == 'data'\", \"assert process_text('d', '', 'data') == 'data'\", \"assert process_text('e', 'key', '') == ''\", \"assert process_text('d', 'key', '') == ''\", \"assert process_text('x', 'key', 'hello') == 'Invalid Mode'\", \"ass... | {
"split": "train",
"index": 2843,
"acecode_id": "bigcode_python_fns_15656",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes two distinct integers as parameters, calculates the square of each integer, and returns the sum of these squared values.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert squared_agg(2, 3) == 13\", \"assert squared_agg(-2, -3) == 13\", \"assert squared_agg(0, 4) == 16\", \"assert squared_agg(5, 12) == 169\", \"assert squared_agg(-5, 12) == 169\", \"assert squared_agg(7, -8) == 113\", \"assert squared_agg(-7, 8) == 113\", \"as... | {
"split": "train",
"index": 2844,
"acecode_id": "evol_29571",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `monotonic_advanced` that checks if a list of numbers is monotonically increasing or decreasing based on certain conditions. The function should take in the following parameters: a list `l`, a boolean `strict` that determines if consecutive identical elemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert monotonic_advanced([1, 2, 3, 4], strict=False, zero_crossing=False) == True\", \"assert monotonic_advanced([4, 3, 2, 1], strict=False, zero_crossing=False) == True\", \"assert monotonic_advanced([1, 2, 2, 4], strict=False, zero_crossing=False) == True\", \"a... | {
"split": "train",
"index": 2845,
"acecode_id": "evol_13778",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `median(lst: list, cmp_func: callable) -> Union[float, tuple]` that computes and returns the median from an unsorted list or list of tuples without using built-in functions. The function should handle duplicates, support lists with both even and odd lengths... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert median([(1, 2), (2, 4), (5, 6)], compare_fn) == (2, 4)\", \"assert median([(3, 4), (1, 2), (3, 4), (7, 8)], compare_fn) == (3, 4)\", \"assert median([(5,), (5,), (5,), (5,)], compare_fn) == (5,)\", \"assert median([(1, 2), (3, 4), (5, 6), (7, 8)], compare_fn... | {
"split": "train",
"index": 2846,
"acecode_id": "evol_29631",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simple event handling system for a game. Your job is to create a function that simulates key press events and executes corresponding callback functions based on a provided keymap. The keymap is a dictionary that maps string keys (representing ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert execute_key_press({'a': lambda: 'action_a', 'b': lambda: 'action_b'}, 'a') == 'action_a'\", \"assert execute_key_press({'x': lambda: 'action_x', 'y': lambda: 'action_y'}, 'y') == 'action_y'\", \"assert execute_key_press({'1': lambda: 'action_1', '2': lambda:... | {
"split": "train",
"index": 2847,
"acecode_id": "oss_2975",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a mapping of category IDs to their corresponding category names in the form of a dictionary. Write a function `getCategoryName` that takes two parameters: a dictionary `categoryMapping` containing the mapping of category IDs to category names, and an integer `cate... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert getCategoryName({1: 'Comedy', 2: 'Drama', 3: 'Documentary'}, 1) == 'Comedy'\", \"assert getCategoryName({1: 'Comedy', 2: 'Drama', 3: 'Documentary'}, 2) == 'Drama'\", \"assert getCategoryName({1: 'Comedy', 2: 'Drama', 3: 'Documentary'}, 3) == 'Documentary'\",... | {
"split": "train",
"index": 2848,
"acecode_id": "oss_33607",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing a collection of scenes represented by their paths and associated data. Implement a function `manage_scenes` that performs the following operations based on a list of commands: 1. `add scene_path scene_data`: Adds a new scene to the collection with t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_scenes(['add scene1 Scene 1 data', 'add scene2 Scene 2 data', 'get scene1']) == ['Scene 1 data']\", \"assert manage_scenes(['add scene1 Scene 1 data', 'get scene3']) == [None]\", \"assert manage_scenes(['add scene1 Scene 1 data', 'update scene1 new_sc... | {
"split": "train",
"index": 2849,
"acecode_id": "oss_19386",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, write a function `check_order(arr)` that checks if the array is sorted in ascending order, descending order, or not sorted at all. The function should return one of the following strings: 'Array is sorted in ascending order', 'Array is sorted in desc... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_order([1, 2, 3, 4, 5]) == 'Array is sorted in ascending order'\", \"assert check_order([5, 4, 3, 2, 1]) == 'Array is sorted in descending order'\", \"assert check_order([1, 3, 2, 4, 5]) == 'Array is not sorted'\", \"assert check_order([2, 2, 2]) == 'Ar... | {
"split": "train",
"index": 2850,
"acecode_id": "evol_10358",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that organizes the numbers based on their last digit in ascending order. The function should take a list of integers as input and return a new list sorted by the last digit of each integer. If two integers have the same last digit,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert organize_by_last_digit([10, 20, 30, 41, 51]) == [10, 20, 30, 41, 51]\", \"assert organize_by_last_digit([21, 32, 43, 54, 65]) == [21, 32, 43, 54, 65]\", \"assert organize_by_last_digit([100, 200, 301, 401, 501]) == [100, 200, 301, 401, 501]\", \"assert organ... | {
"split": "train",
"index": 2851,
"acecode_id": "evol_30141",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers, return a new list that contains the elements that are present in both lists, without duplicates. If either list is empty, return an empty list. The order of elements in the resulting list should be the same as their first appearance in the first lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert intersection([1, 2, 3], [2, 3, 4]) == [2, 3]\", \"assert intersection([5, 6, 7], [8, 9, 10]) == []\", \"assert intersection([], [1, 2, 3]) == []\", \"assert intersection([1, 2, 2, 3], [2, 3, 3, 4]) == [2, 3]\", \"assert intersection([1, 2, 3], []) == []\", \... | {
"split": "train",
"index": 2852,
"acecode_id": "bigcode_python_fns_30225",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with formatting a chemical reaction equation based on the coefficients and formulas of the substances involved. Your function should take two lists as input: one list containing the coefficients of four substances and another list containing their respective chem... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert monta_reacao([1, 1, 1, 1], ['H2', 'O2', 'H2O', 'O']) == 'H2 + O2 \\u2192 H2O + O'\", \"assert monta_reacao([2, 1, 2, 2], ['C', 'O2', 'CO2', 'H2O']) == '2 C + O2 \\u2192 2 CO2 + 2 H2O'\", \"assert monta_reacao([5, 3, 2, 1], ['P', 'O', 'PO2', 'H2O']) == '5 P +... | {
"split": "train",
"index": 2853,
"acecode_id": "bigcode_python_fns_34016",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of words and performs a Caesar shift of 2 on each alphabetical character in those words. The function should return a new list containing the modified words, where each non-alphabetical character is ignored. For example, for the input list... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert caesar_shift_words(['abc', 'xyz']) == ['cde', 'zab']\", \"assert caesar_shift_words(['']) == ['']\", \"assert caesar_shift_words(['123', '!!!']) == ['', '']\", \"assert caesar_shift_words(['a', 'b', 'c']) == ['c', 'd', 'e']\", \"assert caesar_shift_words(['A... | {
"split": "train",
"index": 2854,
"acecode_id": "evol_34433",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given an n-ary tree, return the level order traversal of its nodes' values along with the sum of the node values for each level. The input n-ary tree is represented in level order, where each group of children is separated by a null value. Implement a function `level_order_with... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert level_order_with_sum(None) == []\", \"assert level_order_with_sum(Node(1, [Node(3), Node(2), Node(4)])) == [[1, 1], [3, 2, 4, 9]]\", \"assert level_order_with_sum(Node(0)) == [[0, 0]]\", \"assert level_order_with_sum(Node(1, [Node(0), Node(1), Node(2)])) == ... | {
"split": "train",
"index": 2855,
"acecode_id": "evol_35539",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a file management function that renames files based on their positions within a given category. Write a Python function `rename_files` that takes the following parameters: \n- `categoryContents`: a list of lists, where each sublist contains names of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rename_files([['file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', 'file5.txt', 'file6.txt'], ['fileA.txt', 'fileB.txt', 'fileC.txt']], ['Category1', 'Category2']) == None\", \"assert rename_files([['file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', 'file5.... | {
"split": "train",
"index": 2856,
"acecode_id": "oss_37741",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 4x4 matrix represented as a list of lists. Your task is to check if the given matrix is a valid transformation matrix. A transformation matrix is considered valid if it is a square matrix of size 4x4 and its last row is [0, 0, 0, 1]. Implement a function `is_val... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_transformation_matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) == True\", \"assert is_valid_transformation_matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]]) == False\", \"assert is_valid_transformation_matrix([[1, 0, ... | {
"split": "train",
"index": 2857,
"acecode_id": "bigcode_python_fns_12030",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given two rectangles defined by their corner points in a 2D plane, determine if they intersect. Each rectangle is represented by a tuple of four integers (x1, y1, x2, y2), where (x1, y1) is the bottom-left corner and (x2, y2) is the top-right corner. Implement the function `rec... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rectangle_intersection((0, 0, 2, 2), (1, 1, 3, 3)) == True\", \"assert rectangle_intersection((0, 0, 1, 1), (1, 1, 2, 2)) == False\", \"assert rectangle_intersection((1, 1, 3, 3), (2, 2, 4, 4)) == True\", \"assert rectangle_intersection((0, 0, 1, 1), (0, 0, ... | {
"split": "train",
"index": 2858,
"acecode_id": "evol_2149",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary where the keys represent configuration settings, but instead of using periods ('.') in the keys, they use dollar signs ('$'). Your task is to create a function that converts this dictionary into a new dictionary by replacing all occurrences of '$' wit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_settings({'setting$A': 42, 'setting$B': 'test'}) == {'setting.A': '42', 'setting.B': 'test'}\", \"assert convert_settings({'a$b$c': 'value', 'another$key': 3.14}) == {'a.b.c': 'value', 'another.key': '3.14'}\", \"assert convert_settings({}) == {}\", ... | {
"split": "train",
"index": 2859,
"acecode_id": "bigcode_python_fns_36133",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given an array of strings, reorder the elements of the array in ascending order based on the length of each string. If two strings have the same length, maintain their original relative order in the output. Implement a function called `order_by_length` that takes a list of stri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert order_by_length(['this', 'is', 'a', 'test']) == ['a', 'is', 'this', 'test']\", \"assert order_by_length(['apple', 'banana', 'pear', 'kiwi']) == ['pear', 'kiwi', 'apple', 'banana']\", \"assert order_by_length(['a', 'abc', 'ab']) == ['a', 'ab', 'abc']\", \"ass... | {
"split": "train",
"index": 2860,
"acecode_id": "evol_30445",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of pairs of integers, implement a function that finds the GCD of each pair. If the input is invalid (not a list of pairs, contains non-integer values, or has a pair of zeros), the function should raise a ValueError. The function should return the results in a sorte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert solve([[12, 15], [30, 45], [6, 9]]) == [15, 3, 3]\", \"assert solve([[10, 5], [8, 4]]) == [5, 4]\", \"assert solve([[2, 3], [4, 6], [8, 10]]) == [2, 2, 1]\", \"assert solve([[14, 28], [35, 49]]) == [14, 7]\", \"assert solve([[1, 1], [2, 2], [3, 3]]) == [3, 2... | {
"split": "train",
"index": 2861,
"acecode_id": "evol_6259",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Write a function that generates a random string consisting of alphanumeric characters, with a specified length. The function should take an integer parameter 'length' and return a string of exactly that length, containing a mix of uppercase letters, lowercase letters, and digit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert len(generate_random_string(8)) == 8\", \"assert len(generate_random_string(10)) == 10\", \"assert len(generate_random_string(12)) == 12\", \"assert len(generate_random_string(5)) == 5\", \"assert len(generate_random_string(1)) == 1\", \"assert len(generate_r... | {
"split": "train",
"index": 2862,
"acecode_id": "evol_11106",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a temperature in Celsius, implement a function `convert_celsius_to_fahrenheit(celsius: float) -> float` that converts it to Fahrenheit using the formula: \\[ F = \\frac{9}{5}C + 32 \\]. The function should accept a floating-point number as input and return the correspondi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_celsius_to_fahrenheit(0) == 32.0\", \"assert convert_celsius_to_fahrenheit(100) == 212.0\", \"assert convert_celsius_to_fahrenheit(-40) == -40.0\", \"assert convert_celsius_to_fahrenheit(37.5) == 99.5\", \"assert convert_celsius_to_fahrenheit(-10) ==... | {
"split": "train",
"index": 2863,
"acecode_id": "oss_37371",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of tuples containing integer values, where each tuple has the same length. Your task is to write a function `find_common_set_of_column_names` that identifies and returns a set of indices corresponding to the column names that are present in all tuples. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_common_set_of_column_names([(1, 2, 3), (4, 2, 5), (6, 2, 8)]) == {1}\", \"assert find_common_set_of_column_names([(1, 1, 1), (1, 1, 1), (1, 1, 1)]) == {0, 1, 2}\", \"assert find_common_set_of_column_names([(1, 2, 3), (1, 2, 3), (1, 2, 3)]) == {0, 1, 2}\... | {
"split": "train",
"index": 2864,
"acecode_id": "oss_23617",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a list of numbers, write a function that computes the cumulative sum of the numbers in the list. The cumulative sum at each index is defined as the sum of all previous elements plus the current element. The function should return a new list containing the cumulative sums.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cumulative_sum([]) == []\", \"assert cumulative_sum([1]) == [1]\", \"assert cumulative_sum([1, 2, 3]) == [1, 3, 6]\", \"assert cumulative_sum([0, 0, 0]) == [0, 0, 0]\", \"assert cumulative_sum([1, -1, 1]) == [1, 0, 1]\", \"assert cumulative_sum([5, 5, 5]) ==... | {
"split": "train",
"index": 2865,
"acecode_id": "bigcode_python_fns_49148",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function called `get_cumulative_data` that takes a list of integers representing equipment data points and returns a list of cumulative sums. The cumulative sum at each index i should be the sum of all elements from index 0 to i in the input l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_cumulative_data([]) == []\", \"assert get_cumulative_data([1]) == [1]\", \"assert get_cumulative_data([1, 2]) == [1, 3]\", \"assert get_cumulative_data([1, 2, 3]) == [1, 3, 6]\", \"assert get_cumulative_data([5, -1, 2]) == [5, 4, 6]\", \"assert get_cumul... | {
"split": "train",
"index": 2866,
"acecode_id": "bigcode_python_fns_41284",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the average time taken for a list of tasks. Each task is represented by a tuple containing the task name (a string) and the time taken to complete the task (an integer). Write a function `calculate_average_time(tasks: List[Tuple[str, int]]) -> fl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_time([('Task1', 10), ('Task2', 15), ('Task3', 20)]) == 15.0\", \"assert calculate_average_time([('Task1', 5)]) == 5.0\", \"assert calculate_average_time([]) == 0.0\", \"assert calculate_average_time([('Task1', 10), ('Task2', 10)]) == 10.0\"... | {
"split": "train",
"index": 2867,
"acecode_id": "oss_6122",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `transfer_funds(source_account: BankAccount, target_account: BankAccount, amount: float) -> bool` that transfers a specified amount of funds from a source bank account to a target bank account. The transfer should only succeed if the source account has suff... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transfer_funds(BankAccount(100), BankAccount(50), 30) == True\", \"assert transfer_funds(BankAccount(50), BankAccount(50), 50) == True\", \"assert transfer_funds(BankAccount(200), BankAccount(50), 100) == True\", \"assert transfer_funds(BankAccount(200), Ban... | {
"split": "train",
"index": 2868,
"acecode_id": "evol_4744",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function to manipulate a given string: \n\n def manipulate_string(s): \n ''' \n Given a string, return a list of words separated by either periods or semicolons. If neither exist, count the number of upper-case alphabetic characters with an even index (ord('A') = 0, ord... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manipulate_string('Hello. world!') == ['Hello', ' world!']\", \"assert manipulate_string('Hello;world!') == ['Hello', 'world!']\", \"assert manipulate_string('ABCDEF') == 3\", \"assert manipulate_string('A.B.C.D') == ['A', 'B', 'C', 'D']\", \"assert manipula... | {
"split": "train",
"index": 2869,
"acecode_id": "evol_7809",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Implement a QuickSort algorithm that sorts a double-ended queue (deque) containing integers. The algorithm should handle duplicate elements correctly. You need to define a function named 'quick_sort_deque' that takes a deque as input and sorts it in ascending order. The functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quick_sort_deque(collections.deque([4, 2, 9, 6, 7, 1, 7, 9, 4])) == collections.deque([1, 2, 4, 4, 6, 7, 7, 9, 9])\", \"assert quick_sort_deque(collections.deque([5, 3, 8, 6, 2, 7, 6])) == collections.deque([2, 3, 5, 6, 6, 7, 8])\", \"assert quick_sort_deque... | {
"split": "train",
"index": 2870,
"acecode_id": "evol_22317",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer representing a spot color, convert it to its corresponding CMYK values. The conversion is done in two steps: first, convert the spot color to RGB, and then convert that RGB value to CMYK. If the spot color does not exist, return the default CMYK value of black ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert spot_to_cmyk(10000000) == (0, 0, 0, 1)\", \"assert spot_to_cmyk(0) == (0, 0, 0, 1)\", \"assert spot_to_cmyk(100) == (0, 0, 0, 1)\", \"assert spot_to_cmyk(80) == (0, 0, 0, 1)\", \"assert spot_to_cmyk(1200) == (0, 0, 0, 1)\"]}"
} | {
"split": "train",
"index": 2871,
"acecode_id": "bigcode_python_fns_13369",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Implement an adaptive quicksort algorithm in Python that selects the pivot dynamically based on the input data for optimal performance. The algorithm should efficiently handle duplicate elements. Write a function `adaptive_sort(arr: List[int]) -> List[int]` that takes a list of... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert adaptive_sort([1, 9, 4, 6, 5, 8, 2]) == [1, 2, 4, 5, 6, 8, 9]\", \"assert adaptive_sort([1, 7, 4, 2, 2, 8, 8, 9, 3, 5]) == [1, 2, 2, 3, 4, 5, 7, 8, 8, 9]\", \"assert adaptive_sort([]) == []\", \"assert adaptive_sort([5]) == [5]\", \"assert adaptive_sort([2, ... | {
"split": "train",
"index": 2872,
"acecode_id": "evol_12830",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of paths in a build media storage. Your task is to create a function `remove_build_storage_paths(paths: List[str]) -> List[str]` that simulates the removal of these paths from storage. The function should return a list of paths that were successfully remove... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_build_storage_paths(['path1', 'path2', 'path1']) == ['path1', 'path2']\", \"assert remove_build_storage_paths(['pathA', 'pathB', 'pathC', 'pathA']) == ['pathA', 'pathB', 'pathC']\", \"assert remove_build_storage_paths(['path1']) == ['path1']\", \"asse... | {
"split": "train",
"index": 2873,
"acecode_id": "bigcode_python_fns_30007",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a number `num` represented as an integer. Your task is to return the next number in a sequence based on the following rules: \n1. If the number is even, the next number is half of the current number. \n2. If the number is odd, the next number is the number minus... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_next_number(10) == 5\", \"assert get_next_number(5) == 4\", \"assert get_next_number(4) == 2\", \"assert get_next_number(2) == 1\", \"assert get_next_number(1) == 0\", \"assert get_next_number(0) == 'End of sequence'\", \"assert get_next_number(15) == 14... | {
"split": "train",
"index": 2874,
"acecode_id": "bigcode_python_fns_15334",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of probabilities representing the likelihood of different states for a sequence of observations in a time series. Write a function `calculate_mean_probability` that calculates the average probability of the most likely state for the entire time series. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_mean_probability([[0.3, 0.7], [0.2, 0.8], [0.5, 0.5]]) == 0.6666666666666666\", \"assert calculate_mean_probability([[0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]) == 0.0\", \"assert calculate_mean_probability([[1.0, 0.0], [0.0, 1.0], [0.0, 1.0]]) == 1.0\", ... | {
"split": "train",
"index": 2875,
"acecode_id": "bigcode_python_fns_28903",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to create a project. The function should accept the following parameters: a string `project` representing the name of the project to be created, a dictionary `body` containing the details and configuration for the project, and an opti... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_project('Project A', {'description': 'A sample project'}, async_req=False) == 'Creating project Project A synchronously.'\", \"assert create_project('Project B', {'description': 'Another sample project'}, async_req=True) == 'Creating project Project B... | {
"split": "train",
"index": 2876,
"acecode_id": "oss_30317",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the configuration of a smart TV system. Your function should take in a configuration dictionary and return a result dictionary. If the TV is already configured (i.e., if the unique ID exists in the configuration), the funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert configure_tv({'host': '192.168.1.2', 'client_secret': 'secret123', 'unique_id': 'tv1'}) == {'type': 'create_entry', 'title': 'Smart TV', 'data': {'host': '192.168.1.2', 'client_secret': 'secret123', 'unique_id': 'tv1'}}\", \"assert configure_tv({'host': '192... | {
"split": "train",
"index": 2877,
"acecode_id": "bigcode_python_fns_3866",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given a binary tree, implement a function that returns the maximum value in the tree. A binary tree is defined as follows: each node has a value and can have a left and a right child. If the tree is empty, return None.\nPlease reason step by step, then write a self-contained Py... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert getMax(None) == None\", \"assert getMax(TreeNode(1)) == 1\", \"assert getMax(TreeNode(1, TreeNode(2), TreeNode(3))) == 3\", \"assert getMax(TreeNode(5, TreeNode(3, TreeNode(1), TreeNode(4)), TreeNode(7, TreeNode(6), TreeNode(8)))) == 8\", \"assert getMax(Tre... | {
"split": "train",
"index": 2878,
"acecode_id": "evol_33506",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Design a function that takes a string input representing a name and returns a greeting message in the format 'Hello, {name}!' if the input is a valid string. If the input is not a valid string, it should raise a ValueError with the message 'Input must be a string.'\nPlease reas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert greet('Alice') == 'Hello, Alice!'\", \"assert greet('Bob') == 'Hello, Bob!'\", \"assert greet('Charlie') == 'Hello, Charlie!'\", \"assert greet('') == 'Hello, !'\", \"assert greet(' ') == 'Hello, !'\", \"assert greet('123') == 'Hello, 123!'\", \"assert ... | {
"split": "train",
"index": 2879,
"acecode_id": "evol_35357",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a caching mechanism for a workflow management system. The system uses a Python library called `Workflow` to manage various aspects of workflow execution. Your goal is to create a script that caches data related to tasks and user assignments for ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cache_tiger_data(['task1', 'task2'], ['user1', 'user2']) == {'tiger_all_tasks': ['task1', 'task2'], 'tiger_user_assignments': ['user1', 'user2']}\", \"assert cache_tiger_data([], []) == {'tiger_all_tasks': [], 'tiger_user_assignments': []}\", \"assert cache_... | {
"split": "train",
"index": 2880,
"acecode_id": "oss_17460",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of images represented as 2D arrays and a list of noise metrics. Your task is to create a function that estimates the noise level for each image based on the provided metrics. The function should return a list of lists, where each inner list corresponds to t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert estimate_noises([[[0]], [[1]]], [1]) == [[0.0], [1.0]]\", \"assert estimate_noises([[[1, 1]], [[2, 2]], [[3, 3]]], [1]) == [[1.0], [2.0], [3.0]]\", \"assert estimate_noises([[[1]], [[2]], [[3]], [[4]]], [1]) == [[1.0], [2.0], [3.0], [4.0]]\", \"assert estima... | {
"split": "train",
"index": 2881,
"acecode_id": "bigcode_python_fns_7938",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `product_range(lst: List[int], start: int, end: int) -> int` that calculates the product of the elements in the list from index `start` to index `end` (inclusive). The function should return the product as an integer. You can assum... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert product_range([2, 3, 5, 7, 11, 13, 17, 19], 0, 3) == 210\", \"assert product_range([2, 3, 5, 7, 11, 13, 17, 19], 0, 0) == 2\", \"assert product_range([2, 3, 5, 7, 11, 13, 17, 19], 1, 1) == 3\", \"assert product_range([2, 3, 5, 7, 11, 13, 17, 19], 2, 2) == 5\... | {
"split": "train",
"index": 2882,
"acecode_id": "evol_17433",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `highest_palindrome(low: int, high: int) -> int` that returns the highest palindrome integer within the given range from `low` to `high` (inclusive). If no palindrome is found, the function should return zero. A palindrome is a number that reads the same fo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert highest_palindrome(100, 200) == 191\", \"assert highest_palindrome(9998, 10000) == 9999\", \"assert highest_palindrome(78, 81) == 0\", \"assert highest_palindrome(1, 1) == 1\", \"assert highest_palindrome(22, 22) == 22\", \"assert highest_palindrome(0, 0) ==... | {
"split": "train",
"index": 2883,
"acecode_id": "evol_14375",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a binary tree where the node values range from 1 to 9. A route in the binary tree is considered quasi-palindromic if there exists at least one permutation of the node values in the route that forms a palindrome. Your task is to calculate the total number of quasi-... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quasi_palindromic_routes(TreeNode(2, TreeNode(3, TreeNode(3)), TreeNode(1, None, TreeNode(1)))) == (2, [2, 3, 3])\", \"assert quasi_palindromic_routes(TreeNode(2, TreeNode(1, TreeNode(1), TreeNode(3)), None)) == (1, [2, 1, 1])\", \"assert quasi_palindromic_r... | {
"split": "train",
"index": 2884,
"acecode_id": "evol_33463",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a list of links based on a specific context. Implement a function that takes a list of links and a context string as input, and returns a new list containing only those links that contain the context string. The resulting list should maintain the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_links_in_context([\\\"link1\\\", \\\"link2_context\\\", \\\"link3_context\\\"], \\\"context\\\") == [\\\"link2_context\\\", \\\"link3_context\\\"]\", \"assert merge_links_in_context([\\\"example_link1\\\", \\\"example_link2\\\", \\\"example_link3\\\"],... | {
"split": "train",
"index": 2885,
"acecode_id": "oss_32391",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that generates a list of display fields for a user administration panel based on a boolean input parameter. The function should take a boolean parameter `hardware_enabled`, which indicates whether hardware-related fields should be included... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_display_fields(False) == ['email', 'name', 'type', 'admin_is_organizer', 'admin_is_volunteer_accepted', 'is_director', 'have_application', 'is_judge']\", \"assert generate_display_fields(True) == ['email', 'name', 'type', 'admin_is_organizer', 'admi... | {
"split": "train",
"index": 2886,
"acecode_id": "oss_19623",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that subtracts two integers. Your function should take two parameters, `a` and `b`, both integers, and return the result of subtracting `b` from `a`. Implement the function `subtract_two_numbers(a: int, b: int) -> int`. For example, if `a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert subtract_two_numbers(10, 3) == 7\", \"assert subtract_two_numbers(5, 5) == 0\", \"assert subtract_two_numbers(0, 0) == 0\", \"assert subtract_two_numbers(-1, -1) == 0\", \"assert subtract_two_numbers(-5, -3) == -2\", \"assert subtract_two_numbers(3, -2) == 5... | {
"split": "train",
"index": 2887,
"acecode_id": "bigcode_python_fns_44111",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of boundary condition strings that represent different types of boundary conditions in an image processing or computational context. Your task is to convert these boundary condition strings into a standardized format. The mapping of input strings to the sta... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_boundary_conditions(['replicate', 'zero', 'dct2']) == ['replicate', 'zero', 'dct2']\", \"assert convert_boundary_conditions('mirror') == 'dct1'\", \"assert convert_boundary_conditions(['wrap', 'antireflect']) == ['dft', 'dst2']\", \"assert convert_bo... | {
"split": "train",
"index": 2888,
"acecode_id": "bigcode_python_fns_2135",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a simple button press event in Python. Create a function called `simulate_button_event` that takes two callback functions as input: `pressed_callback` and `released_callback`. When `simulate_button_event` is called, it should execute the `pressed_... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_button_event(lambda: print('Pressed'), lambda: print('Released')) is None\", \"assert simulate_button_event(lambda: 1 + 1, lambda: 2 * 2) is None\", \"assert simulate_button_event(lambda: 'Button Pressed', lambda: 'Button Released') is None\", \"ass... | {
"split": "train",
"index": 2889,
"acecode_id": "oss_36175",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of ligand IDs and a list of decoy IDs, along with a list of score lines. Each score line is a string that contains an ID followed by some additional information. Your task is to implement a function `select_own(ligands: List[str], decoys: List[str], scores:... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert select_own(['ligand1', 'ligand2'], ['decoy1', 'decoy2'], ['ligand1.extra', 'something', 'decoy2.info']) == ['ligand1.extra', 'decoy2.info']\", \"assert select_own(['ligandA'], ['decoyB'], ['ligandA.123', 'decoyB.456', 'otherC.789']) == ['ligandA.123', 'decoy... | {
"split": "train",
"index": 2890,
"acecode_id": "bigcode_python_fns_23377",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries where each dictionary represents a parameter with a 'Parameter' key and a 'Value' key. Your task is to implement a function that takes this list of dictionaries and returns a list of tuples, where each tuple contains the 'Parameter' and 'Val... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_parameters([]) == []\", \"assert extract_parameters([{ 'Parameter': 'a', 'Value': '1' }, { 'Parameter': 'b', 'Value': '2' }]) == [('a', '1'), ('b', '2')]\", \"assert extract_parameters([{ 'Parameter': 'x', 'Value': '10' }, { 'Parameter': 'y', 'Value'... | {
"split": "train",
"index": 2891,
"acecode_id": "bigcode_python_fns_5267",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a positive integer `n`, where `n` represents the height and width of a square pattern, write a function that generates a square pattern of 1s and 0s. The pattern should have a border of 1s and the interior filled with 0s. The function should return the pattern as a list o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_square_pattern(1) == [[1]]\", \"assert generate_square_pattern(2) == [[1, 1], [1, 1]]\", \"assert generate_square_pattern(3) == [[1, 1, 1], [1, 0, 1], [1, 1, 1]]\", \"assert generate_square_pattern(4) == [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1... | {
"split": "train",
"index": 2892,
"acecode_id": "oss_30887",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a string `node_name` and a string `CONFIG_FILE`. Your task is to implement a function `set_installator(step: int, node_name: str, CONFIG_FILE: str) -> str` that will return a string `installator`. If `CONFIG_FILE` is found within `node_name`, return the string `CO... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_installator(1, 'test_node', 'config.vm') == 'test_node'\", \"assert set_installator(1, 'config.vm_host', 'config.vm') == 'CONFIG_VM_HOSTNAME'\", \"assert set_installator(1, 'production_node', 'config.vm') == 'production_node'\", \"assert set_installator(... | {
"split": "train",
"index": 2893,
"acecode_id": "bigcode_python_fns_37899",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a translation process. The function, `translate_text`, should take the following parameters: `text` (a string representing the text to be translated), `scheme` (a string representing the translation scheme), `from_lang` (a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert translate_text('Hello', 'default_scheme', 'en', 'fr') == 'HELLO'\", \"assert translate_text('Hello', 'reverse', 'en', 'fr') == 'olleH'\", \"assert translate_text('Bonjour', 'default_scheme', 'fr', 'en') == 'BONJOUR'\", \"assert translate_text('Hello', 'defau... | {
"split": "train",
"index": 2894,
"acecode_id": "oss_12350",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes in a list of application roles and a target role name, and returns a list of dictionaries representing the resource access for applications that match the target role. Each dictionary should contain the role's ID and type, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_resource_access([{'id': '1', 'value': 'read'}, {'id': '2', 'value': 'write'}, {'id': '3', 'value': 'read'}], 'read') == [{'id': '1', 'type': 'Scope'}, {'id': '3', 'type': 'Scope'}]\", \"assert get_resource_access([{'id': '4', 'value': 'execute'}, {'id': ... | {
"split": "train",
"index": 2895,
"acecode_id": "bigcode_python_fns_275",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates a standard deck of playing cards. A standard deck contains 52 cards, with 13 cards for each of the 4 suits: 'Hearts', 'Diamonds', 'Clubs', and 'Spades'. Each card has a value which can be one of the following: 'A', '2',... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_deck() == ['A of Hearts', '2 of Hearts', '3 of Hearts', '4 of Hearts', '5 of Hearts', '6 of Hearts', '7 of Hearts', '8 of Hearts', '9 of Hearts', '10 of Hearts', 'J of Hearts', 'Q of Hearts', 'K of Hearts', 'A of Diamonds', '2 of Diamonds', '3 of Di... | {
"split": "train",
"index": 2896,
"acecode_id": "oss_7547",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that validates a dictionary representing a user profile against a predefined schema. The schema defines the required and optional profile attributes along with their respective types. Your task is to write a function that check... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_user_profile({'name': 'John', 'age': 25, 'email': 'john@example.com'}, {'required_profile_attributes': {'name': str, 'age': int}, 'optional_profile_attributes': {'email': str}}) == True\", \"assert validate_user_profile({'name': 'Jane', 'age': 28}, ... | {
"split": "train",
"index": 2897,
"acecode_id": "oss_28096",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string pattern that represents an XML regular expression, implement a function that converts it into a Python regular expression format. The conversion should follow the rules of XML regular expressions and ensure that the output is a valid Python regex that matches the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert XMLToPython('a|b') == '^a|b$'\", \"assert XMLToPython('ab') == '^ab$'\", \"assert XMLToPython('a?') == '^a?$'\", \"assert XMLToPython('a*') == '^a*$'\", \"assert XMLToPython('a+') == '^a+$'\", \"assert XMLToPython('[abc]') == '^[abc]$'\", \"assert XMLToPytho... | {
"split": "train",
"index": 2898,
"acecode_id": "bigcode_python_fns_22194",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a hexadecimal string representing a XOR encrypted ciphertext, implement a function that finds the single-byte XOR key used to encrypt the message. Your function should then decrypt the ciphertext using the found key and return the original plaintext string. The input will... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_single_xor_key_and_decrypt('48656c6c6f20576f726c6421') == 'Hello World!'\", \"assert find_single_xor_key_and_decrypt('7465737420737472696e67') == 'test string'\", \"assert find_single_xor_key_and_decrypt('73696d706c6520737472696e67') == 'simple string'\... | {
"split": "train",
"index": 2899,
"acecode_id": "bigcode_python_fns_30660",
"num_tests": 12
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.