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 writing a function that takes a string input representing a numerical value and converts it into a float. The input string may contain leading or trailing whitespace, and it may also have a '+' or '-' sign at the beginning. If the input string is empty or ca...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_to_float('123.45') == 123.45\", \"assert convert_to_float(' -67.89 ') == -67.89\", \"assert convert_to_float('+100') == 100.0\", \"assert convert_to_float('0') == 0.0\", \"assert convert_to_float('3.14') == 3.14\", \"assert convert_to_float(' +...
{ "split": "train", "index": 3700, "acecode_id": "bigcode_python_fns_19686", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of results from a contest. Each result is a dictionary containing various information about users' performance in that contest. Your task is to implement a function `parse_results(results: List[Dict[str, Any]]) -> List[Dict[str, Any]]` that processes this l...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_results([]) == []\", \"assert parse_results([{'userEntryCount': 5, 'siteScreenName': 'User1', 'rank': 1, 'points': 100, 'salaryUsed': 50, '_contestId': 'contest1', 'lineup': []}]) == [{'userEntryCount': 5, 'siteScreenName': 'User1', 'rank': 1, 'points'...
{ "split": "train", "index": 3701, "acecode_id": "bigcode_python_fns_23614", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with processing multiple arrays of mixed data types. Write a function called `array_processor` that takes a variable number of arrays as input. For each array, the function should filter out the integers and compute the following metrics if there are integers pre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert array_processor([1, 2, 3, 4, 5]) == {'sum': 6, 'max_index': (4, 4), 'min_index': (0, 0), 'median': 3}\", \"assert array_processor(['a', 'b', 2]) == {'sum': 4, 'max_index': (2, 2), 'min_index': (2, 2), 'median': 2}\", \"assert array_processor([1, '2', 3]) == ...
{ "split": "train", "index": 3702, "acecode_id": "evol_30152", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple banking system. The function should take the following parameters: an account number (a string), an initial balance (an integer), a list of deposit amounts (a list of integers), and a list of withdrawal amounts...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert final_balance('67890', 1000, [], [100, 200]) == 700\", \"assert final_balance('33333', 1000, [0, 0], [0]) == 1000\", \"assert final_balance('44444', 1500, [], []) == 1500\", \"assert final_balance('66666', 200, [0], [0]) == 200\", \"assert final_balance('101...
{ "split": "train", "index": 3703, "acecode_id": "oss_18273", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates an episode in a reinforcement learning environment. Write a function `simulate_episode` that takes the following parameters: \n- `game`: a string representing the name of the game (e.g., 'Pong', 'Breakout'). \n- `n_step...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_episode('Breakout', 0, 99, [0.0, 1.0], []) == ([], 0.0, 0)\", \"assert simulate_episode('Pong', 2, 1, [0.5, 0.5], [0.0, 0.0]) == ([0, 1], 0.0, 2)\", \"assert simulate_episode('Pong', 2, 2, [1.0], [3, 4]) == ([0, 0], 7, 2)\", \"assert simulate_episod...
{ "split": "train", "index": 3704, "acecode_id": "bigcode_python_fns_4190", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a list of integers and a window size, write a function that pads the list with zeros on both sides. The number of zeros to be added on each side is equal to half of the window size (rounded up). The function should return the new list with the zeros added. For example, if...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert zero_pad([1], 2) == [0, 1, 0]\", \"assert zero_pad([], 4) == [0, 0, 0, 0]\", \"assert zero_pad([4, 5, 6], 2) == [0, 4, 5, 6, 0]\", \"assert zero_pad([0], 0) == [0]\", \"assert zero_pad([1, 2, 3, 4, 5], 2) == [0, 1, 2, 3, 4, 5, 0]\"]}" }
{ "split": "train", "index": 3705, "acecode_id": "bigcode_python_fns_32448", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a binary matrix represented as a 2D list, where each element is either 0 or 1. Your task is to remove specific rows and columns from this matrix based on the provided indices. The indices are given as a list of integers, and each index corresponds to a row and a c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_rows_and_columns([1], [[1, 0], [0, 1]]) == [[1]]\", \"assert remove_rows_and_columns([0, 1], [[1, 0], [0, 1]]) == []\", \"assert remove_rows_and_columns([], [[1, 0], [0, 1]]) == [[1, 0], [0, 1]]\", \"assert remove_rows_and_columns([1], [[1, 1], [1, 1]...
{ "split": "train", "index": 3706, "acecode_id": "bigcode_python_fns_8123", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a directed graph represented as an adjacency list, where each node is an integer and edges represent directed connections between the nodes. Your task is to implement a function `count_paths(start: int, end: int, graph: Dict[int, List[int]]) -> int` that counts th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_paths(1, 4, {1: [2, 3], 2: [4], 3: [4], 4: []}) == 2\", \"assert count_paths(0, 3, {0: [1, 2], 1: [3], 2: [3], 3: []}) == 2\", \"assert count_paths(1, 5, {1: [2], 2: [3], 3: [4], 4: [5], 5: []}) == 1\", \"assert count_paths(1, 6, {1: [2, 3], 2: [4], 3:...
{ "split": "train", "index": 3707, "acecode_id": "bigcode_python_fns_3403", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a user-defined version string that represents a software version. The version string is expected to follow a specific format: 'major.minor.patch', where 'major', 'minor', and 'patch' are non-negative integers. Your task is to implement a function `parse_version_st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_version_string('1.0.0') == {'major': 1, 'minor': 0, 'patch': 0}\", \"assert parse_version_string('0.1.2') == {'major': 0, 'minor': 1, 'patch': 2}\", \"assert parse_version_string('10.20.30') == {'major': 10, 'minor': 20, 'patch': 30}\", \"assert parse_...
{ "split": "train", "index": 3708, "acecode_id": "bigcode_python_fns_21349", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that validates a list of dark matter halo IDs. Your function should take in a list of integers representing halo IDs and perform the following operations: 1. Check if each ID in the list is a positive integer. 2. Count how many IDs...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_halo_ids([1, 2, 3, -1, 0]) == 3\", \"assert validate_halo_ids([5, 10, 15]) == 3\", \"assert validate_halo_ids([-10, -20, -30]) == 0\", \"assert validate_halo_ids([]) == 0\", \"assert validate_halo_ids([0, 0, 0]) == 0\", \"assert validate_halo_ids([1...
{ "split": "train", "index": 3709, "acecode_id": "oss_16312", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simple LED control system. Your goal is to implement a function `led_control` that takes two parameters: `brightness` and `power`. The `brightness` parameter should be an integer between 0 and 100 (inclusive) representing the brightness of the L...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert led_control(50, True) == 'LED is on at 50% brightness'\", \"assert led_control(0, True) == 'LED is on at 0% brightness'\", \"assert led_control(100, True) == 'LED is on at 100% brightness'\", \"assert led_control(75, False) == 'LED is off at 75% brightness'\...
{ "split": "train", "index": 3710, "acecode_id": "oss_28173", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers and a target integer. Your task is to determine if there are two distinct indices in the list such that the sum of the integers at those indices equals the target integer. Implement a function `has_pair_with_sum(nums: List[int], target: int) -> ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_pair_with_sum([1, 2, 3, 4, 5], 5) == True\", \"assert has_pair_with_sum([1, 2, 3, 4, 5], 10) == False\", \"assert has_pair_with_sum([1, 1, 1, 1], 2) == True\", \"assert has_pair_with_sum([0, 4, 3, 0], 0) == True\", \"assert has_pair_with_sum([-1, -2, -3,...
{ "split": "train", "index": 3711, "acecode_id": "bigcode_python_fns_10528", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `apply_dropout` that simulates a dropout layer for a feed-forward neural network. The function should take a 2D list of floats `input_data`, a float `dropout_ratio` representing the probability of dropping out each unit, and a boolean `training_mode` indica...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert apply_dropout([[1.0, 2.0], [3.0, 4.0]], 0.5, False) == [[1.0, 2.0], [3.0, 4.0]]\", \"assert apply_dropout([[0.0, 0.0], [0.0, 0.0]], 0.2, True) == [[0.0, 0.0], [0.0, 0.0]]\", \"assert apply_dropout([[1.0, 2.0, 3.0]], 0.1, True) == [[1.0, 2.0, 3.0]]\", \"asser...
{ "split": "train", "index": 3712, "acecode_id": "oss_679", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the behavior of a car. The car has a maximum speed limit, and can accelerate and decelerate. Your function should take the following parameters: a maximum speed limit, an array of acceleration amounts, and an array of d...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert car_speed(100, [50, 70], [30, 50]) == 20\", \"assert car_speed(100, [150], [0]) == 100\", \"assert car_speed(80, [80], [10]) == 70\", \"assert car_speed(60, [20, 50], [10, 70]) == 0\", \"assert car_speed(120, [], []) == 0\", \"assert car_speed(90, [50], [50]...
{ "split": "train", "index": 3713, "acecode_id": "oss_29702", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that converts a Quadratic Unconstrained Binary Optimization (QUBO) problem representation into a Quadratic Unconstrained Sum of Objectives (QUSO) representation. The QUBO problem is represented as a dictionary where the keys are tuple...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_qubo_to_quso({(0, 0): 1, (0, 1): -2, (1, 1): 3}) == {0: {0: 1, 1: -2}, 1: {0: -2, 1: 3}}\", \"assert convert_qubo_to_quso({(0, 1): 1, (1, 2): 4, (0, 2): -3}) == {0: {0: 0, 1: 1, 2: -3}, 1: {0: 1, 1: 0, 2: 4}, 2: {0: -3, 1: 4, 2: 0}}\", \"assert conve...
{ "split": "train", "index": 3714, "acecode_id": "oss_27449", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `check_odd_even(hex_number: str) -> str` that takes a hexadecimal number as a string and returns 'Odd' if the number is odd and 'Even' if the number is even. The input will always be a valid hexadecimal string. For example, if the input is '3F', the output ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_odd_even('3F') == 'Odd'\", \"assert check_odd_even('2A') == 'Even'\", \"assert check_odd_even('1') == 'Odd'\", \"assert check_odd_even('0') == 'Even'\", \"assert check_odd_even('FF') == 'Odd'\", \"assert check_odd_even('10') == 'Even'\", \"assert check...
{ "split": "train", "index": 3715, "acecode_id": "evol_14266", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple password cracking mechanism. Your function will take a target MD5 hash and return the corresponding word if it matches any predefined MD5 hashes generated from a range of words. The words are defined as 'word0'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert crack_password('a1b2c3d4e5f67890abcdef1234567890') == 'Password not found'\", \"assert crack_password('a0dc65d83cd6a5d9ff8b30e2d4b3321f') == 'Password not found'\", \"assert crack_password('d41d8cd98f00b204e9800998ecf8427e') == 'Password not found'\", \"asse...
{ "split": "train", "index": 3716, "acecode_id": "oss_26874", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a 0-indexed integer array `nums` containing `n` non-negative integers. You need to implement a function `sumOfSpecialEvenlySpacedElements(nums: List[int], queries: List[List[int]]) -> List[int]` that takes an array `queries`, where each element `queries[i]` is a p...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sumOfSpecialEvenlySpacedElements([0,1,2,3,4,5,6,7], [[0,3],[5,1],[4,2]]) == [9,18,10]\", \"assert sumOfSpecialEvenlySpacedElements([100,200,101,201,102,202,103,203], [[0,7]]) == [303]\", \"assert sumOfSpecialEvenlySpacedElements([1,1,1,1,1], [[0,1],[2,1],[4,...
{ "split": "train", "index": 3717, "acecode_id": "evol_28453", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Given an array of integers and a target sum, implement a function that returns a list of unique pairs (as tuples) from the array that add up to the target sum. Each pair should be represented in the order (first_element, second_element) where first_element comes before second_e...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_pairs([1, 2, 3, 4, 5], 10) == []\", \"assert print_pairs([0, 0, 0, 0], 0) == [(0, 0)]\", \"assert print_pairs([1, 1, 1, 1], 2) == [(1, 1)]\", \"assert print_pairs([5, 5, 5, 5], 10) == [(5, 5)]\", \"assert print_pairs([1, 2, 3, 4, 5, 5], 10) == [(5, 5)]...
{ "split": "train", "index": 3718, "acecode_id": "evol_8035", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given a list of integers, write a Python function that returns a new list containing only the integers that appear an odd number of times in the input list. The order of elements in the output list should match their first occurrence in the input list.\nPlease reason step by st...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert odd_elements([1, 2, 2, 3, 3, 3, 4, 5]) == [1, 3, 4, 5]\", \"assert odd_elements([1, 1, 2, 2, 3, 3, 4]) == [4]\", \"assert odd_elements([1, 2, 2, 1, 3, 3, 3]) == [3]\", \"assert odd_elements([2, 3, 4, 5, 2, 4, 5]) == [3]\", \"assert odd_elements([10, 20, 10, ...
{ "split": "train", "index": 3719, "acecode_id": "evol_32327", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function `median(l: list, cmp_func: callable) -> float` that determines the median of elements in the list 'l' without sorting the list or using native Python functions. The function should handle tuples with an even or odd quantity of elements, as well as non-stand...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert median([3, 1, 2, 4, 5], lambda a, b: a - b) == 3\", \"assert median([1, 2, 2, 4, 5], lambda a, b: a - b) == 2\", \"assert median([], lambda a, b: a - b) == None\", \"assert median([1, 1, 1, 1], lambda a, b: a - b) == 1\", \"assert median([1.5, 2.5, 3.5], lam...
{ "split": "train", "index": 3720, "acecode_id": "evol_9694", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of sentences, where each sentence is represented as a list of words. Your task is to implement a function that calculates Brunet's statistic for the entire set of sentences. The formula for Brunet's statistic is given by: V = N^(V^b), where V is the vocabul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_brunet_statistic([['Hello', 'world'], ['Hello', 'everyone']]) == 3\", \"assert calculate_brunet_statistic([['apple', 'banana', 'apple'], ['banana', 'cherry']]) == 3\", \"assert calculate_brunet_statistic([['sky', 'blue'], ['blue', 'sky'], ['blue', ...
{ "split": "train", "index": 3721, "acecode_id": "oss_15910", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if a specific library, named `library_name`, is available in the current environment. The function should return a string indicating the status of the library. If the library is available, return its name; otherwise, return a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_library(True) == 'library_name'\", \"assert check_library(False) == 'The library is not found.'\", \"assert check_library(True) == 'library_name'\", \"assert check_library(False) == 'The library is not found.'\", \"assert check_library(True) == 'librar...
{ "split": "train", "index": 3722, "acecode_id": "bigcode_python_fns_27044", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a number `g` which represents the age of a person. Write a function `ageClassifier` that categorizes the age into different groups based on the following criteria: If the age is less than 13, return 'child'. If the age is between 13 and 19 (both inclusive), return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert ageClassifier(5) == 'child'\", \"assert ageClassifier(12) == 'child'\", \"assert ageClassifier(13) == 'teenager'\", \"assert ageClassifier(15) == 'teenager'\", \"assert ageClassifier(19) == 'teenager'\", \"assert ageClassifier(20) == 'adult'\", \"assert ageC...
{ "split": "train", "index": 3723, "acecode_id": "oss_11415", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2D list of integers, where each inner list represents a window of time series data. Your task is to implement a function that predicts the next value for each time series window using a simple average of the last three values in that window. If a window has fewe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert predict_next_value([[1, 2, 3], [4, 5, 6, 7], [8]]) == [2.0, 6.0, 8.0]\", \"assert predict_next_value([[10, 20], [30, 40, 50], [60, 70, 80, 90]]) == [15.0, 40.0, 80.0]\", \"assert predict_next_value([[5], [1, 2, 3, 4]]) == [5.0, 3.0]\", \"assert predict_next_...
{ "split": "train", "index": 3724, "acecode_id": "bigcode_python_fns_20841", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a list of student grades and determines the average grade. Your function should take in a list of integers representing student grades (ranging from 0 to 100) and return the average grade as a float, rounded to two d...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_grade([90, 80, 70, 60, 50]) == 70.00\", \"assert calculate_average_grade([100, 90, 95]) == 95.00\", \"assert calculate_average_grade([0, 0, 0, 0]) == 0.00\", \"assert calculate_average_grade([50]) == 50.00\", \"assert calculate_average_grad...
{ "split": "train", "index": 3725, "acecode_id": "oss_11708", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of dictionaries, each representing a person with their name, weight in kilograms, and height in centimeters. The function should calculate the Body Mass Index (BMI) for each person and categorize it according to the World Health Organizati...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_BMI_and_categories([{'name': 'Alex', 'weight(kg)': 75, 'height(cm)': 175}]) == [{'name': 'Alex', 'BMI': 24.49, 'Category': 'Normal'}]\", \"assert add_BMI_and_categories([{'name': 'Lucy', 'weight(kg)': 60, 'height(cm)': 165}]) == [{'name': 'Lucy', 'BMI': ...
{ "split": "train", "index": 3726, "acecode_id": "evol_21617", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that calculates steady-state delays for a system. Your function should return a list of steady-state delays based on predefined values. The function will be called `steady_state_delays` and it should return the following list of delay...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert steady_state_delays() == [2.213, 2.250]\", \"assert steady_state_delays() != [2.213, 2.251]\", \"assert len(steady_state_delays()) == 2\", \"assert isinstance(steady_state_delays(), list)\", \"assert all(isinstance(x, float) for x in steady_state_delays())\"...
{ "split": "train", "index": 3727, "acecode_id": "oss_9311", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `update_lines(lines: List[str], line_nums: List[int], new_contents: List[str]) -> List[str]` that takes a list of strings representing lines of text, a list of integers representing line numbers, and a list of strings representing new content for those line...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_lines(['line 1', 'line 2', 'line 3'], [1], ['updated line 1']) == ['updated line 1', 'line 2', 'line 3']\", \"assert update_lines(['line 1', 'line 2'], [2], ['updated line 2']) == ['line 1', 'updated line 2']\", \"assert update_lines(['line 1'], [1], ...
{ "split": "train", "index": 3728, "acecode_id": "evol_19172", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `median(l: list, cmp_func: callable) -> float` that computes the median of numeric elements in the list `l`. The function should handle nested lists and tuples, and it must also be able to extract numeric values from objects of custom classes using a provid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert median([3, [1, 2], 4, 5], lambda a, b: a - b) == 3\", \"assert median([1, 2, 3], lambda a, b: a - b) == 2\", \"assert median([1, 2, 3, 4], lambda a, b: a - b) == 2.5\", \"assert median([[2], [1]], lambda a, b: a - b) == 1.5\", \"assert median([[10, 20], [30,...
{ "split": "train", "index": 3729, "acecode_id": "evol_16708", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function that returns a new list containing only the unique elements from the input list, preserving the original order of their first occurrences. The input list may contain both positive and negative integers. If the input list is empty, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 3, 1, 2, 4]) == [1, 2, 3, 4]\", \"assert unique_elements([5, 5, 5, 5]) == [5]\", \"assert unique_elements([-1, -1, 0, 1, 1]) == [-1, 0, 1]\", \"assert unique_elements([1, 2, 3, 4]) == [1, 2, 3, 4]\", \"assert unique_elements([]) == []\...
{ "split": "train", "index": 3730, "acecode_id": "bigcode_python_fns_18114", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `calculate_mean(numbers: List[float]) -> float` that takes a list of numeric elements as input and returns the mean (average) of the numbers within the list. The input list can contain both integers and floats. If the list is empty, the function should return 0...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_mean([4, 5, 6]) == 5.0\", \"assert calculate_mean([10.5, 2.5, 3.0]) == 5.333333333333333\", \"assert calculate_mean([-1, 0, 1]) == 0.0\", \"assert calculate_mean([1, 2, 3, 4, 5]) == 3.0\", \"assert calculate_mean([1.5, 2.5]) == 2.0\", \"assert calc...
{ "split": "train", "index": 3731, "acecode_id": "evol_27558", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to manage the statuses of smart home devices. Each device has a unique identifier and a status, which can either be 'on' or 'off'. Your function should accept a list of commands to manipulate the devices. The commands can be one of th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_devices(['add_device device1 on', 'add_device device2 off', 'toggle_device device1', 'force_turn_off device2']) == {'device1': 'off', 'device2': 'off'}\", \"assert manage_devices(['add_device device3 on', 'remove_device device3', 'toggle_device device...
{ "split": "train", "index": 3732, "acecode_id": "oss_25566", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the retrieval of a public key and intermediate certificates from an X.509 certificate. Write a function `get_certificate_info(certificate: str) -> Tuple[Union[str, None], Union[List[str], None]]` that takes a string `ce...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_certificate_info('-----BEGIN CERTIFICATE-----\\\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQ...\\\\n-----END CERTIFICATE-----') == ('MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQ...', None)\", \"assert get_certificate_info('Invalid Certificate') == (None, N...
{ "split": "train", "index": 3733, "acecode_id": "oss_3594", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that takes in a dictionary and a file extension. The function should determine the format of the output based on the file extension provided. If the file extension is '.pkl', the function should return the string 'pickle' to indica...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert determine_serialization_format({'a': 1, 'b': 2}, '.pkl') == 'pickle'\", \"assert determine_serialization_format({'key': 'value'}, '.json') == 'json'\", \"assert determine_serialization_format({}, '.pkl') == 'pickle'\", \"assert determine_serialization_format...
{ "split": "train", "index": 3734, "acecode_id": "oss_13085", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, implement a function that separates the numbers into two lists: one containing all the prime numbers and the other containing all the composite numbers. Both lists should be sorted in descending order. The function should return a tuple containing th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_numbers([11, 14, 23, 26, 29, 31, 35]) == ([31, 29, 23, 11], [35, 26, 14])\", \"assert categorize_numbers([2, 3, 4, 5, 6, 7, 8, 9]) == ([7, 5, 3, 2], [9, 8, 6, 4])\", \"assert categorize_numbers([1, 4, 6, 8, 9, 10]) == ([], [10, 9, 8, 6, 4])\", \"a...
{ "split": "train", "index": 3735, "acecode_id": "evol_15857", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `clear_site_settings(site_name: str) -> Dict[str, Any]` that takes a string `site_name` as input and returns an empty dictionary to represent the cleared settings for that site. Implement this function as simply as possible. The function ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert clear_site_settings('example.com') == {}\", \"assert clear_site_settings('mywebsite.org') == {}\", \"assert clear_site_settings('testsite.net') == {}\", \"assert clear_site_settings('sample.org') == {}\", \"assert clear_site_settings('demo.com') == {}\", \"a...
{ "split": "train", "index": 3736, "acecode_id": "bigcode_python_fns_28572", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of strings, each representing a file path, and a string representing the input type, write a function that checks if all the file paths in the list have the same extension as the given input type. If they do, return True; otherwise, return False. If the input type ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_file_extensions(['file1.txt', 'file2.txt', 'file3.txt'], 'txt') == True\", \"assert check_file_extensions(['file1.txt', 'file2.csv', 'file3.txt'], 'txt') == False\", \"assert check_file_extensions(['file1.txt', 'file2.txt', 'file3.txt'], None) == True\...
{ "split": "train", "index": 3737, "acecode_id": "bigcode_python_fns_21384", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers where every element appears exactly twice except for one element that appears only once, implement a function to find and return the unique element.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_unique_entity([4, 1, 2, 1, 2]) == 4\", \"assert find_unique_entity([2, 2, 1]) == 1\", \"assert find_unique_entity([1]) == 1\", \"assert find_unique_entity([3, 5, 3, 4, 4]) == 5\", \"assert find_unique_entity([7, 8, 8, 9, 9]) == 7\", \"assert find_unique...
{ "split": "train", "index": 3738, "acecode_id": "evol_36173", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `factorial(n: int) -> int` that calculates the factorial of a non-negative integer n. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, factorial(5) = 5 * 4 * 3 * 2 * 1 = 120. The functio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(...
{ "split": "train", "index": 3739, "acecode_id": "evol_23172", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a binary string representing a sequence of bytes. Your task is to implement a function `unpack_bytes` that takes in a binary string and a directory path as arguments. The function should simulate unpacking the binary string into the specified directory by returnin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unpack_bytes(b'\\\\x00\\\\x01\\\\x02', '/path/to/directory') == '/path/to/directory/unpacked_content'\", \"assert unpack_bytes(b'\\\\x03\\\\x04\\\\x05', '/another/path') == '/another/path/unpacked_content'\", \"assert unpack_bytes(b'', '/empty/path') == '/em...
{ "split": "train", "index": 3740, "acecode_id": "bigcode_python_fns_34764", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an unordered list of strings and a target substring, implement a function that returns a list of tuples. Each tuple should contain the index of the string in the list and a list of all positions where the target substring occurs within that string. The search for the subs...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_substring_indices(['test', 'testing', 'tested'], 'test') == [(0, [0]), (1, [0]), (2, [0])]\", \"assert find_substring_indices(['abc', 'def', 'ghi'], 'x') == []\", \"assert find_substring_indices(['Python', 'java', 'C++'], 'P') == [(0, [0])]\", \"assert ...
{ "split": "train", "index": 3741, "acecode_id": "evol_29525", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the scores of students in a class. Your task is to implement a function called `highest_score` that returns the highest score among the students. If the list is empty, the function should return `None`. The function signature is as ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert highest_score([85, 92, 88, 76, 95]) == 95\", \"assert highest_score([70, 75, 80, 65, 90]) == 90\", \"assert highest_score([100, 100, 99]) == 100\", \"assert highest_score([50]) == 50\", \"assert highest_score([]) == None\", \"assert highest_score([0, -1, -2,...
{ "split": "train", "index": 3742, "acecode_id": "oss_20237", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function that uses regular expressions to find and return all occurrences of the words 'hello' and 'world' in a given input string. The function should also be able to match words that have variations of capitalization (e.g., 'Hello', 'WORLD'). The function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_words('Hello there, world!') == ['Hello', 'world']\", \"assert find_words('hello world hello') == ['hello', 'world', 'hello']\", \"assert find_words('This is a test') == []\", \"assert find_words('HELLO WORLD') == ['HELLO', 'WORLD']\", \"assert find_wor...
{ "split": "train", "index": 3743, "acecode_id": "evol_23028", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates a simple password validation system. The function should take a password as input and return a message based on the validity of the password. A password is considered valid if it meets the following criteria: it cont...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_password('StrongP@ssw0rd') == 'Password is valid.'\", \"assert validate_password('WeaKpass1!') == 'Password is valid.'\", \"assert validate_password('12345678!') == 'Password is invalid.'\", \"assert validate_password('NoSpecialChar1') == 'Password ...
{ "split": "train", "index": 3744, "acecode_id": "oss_3490", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that performs mean and variance normalization on a given input array. Mean and variance normalization is a common preprocessing step in machine learning and signal processing to standardize the input data. Your task is to implement th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert normalize([1.0, 2.0, 3.0], 2.0) == [-1.224744871391589, 0.0, 1.224744871391589]\", \"assert normalize([[1.0, 2.0], [3.0, 4.0]], 2.5) == [[-1.3416407864998738, -0.4472135954999579], [0.4472135954999579, 1.3416407864998738]]\", \"assert normalize([5.0, 5.0, 5....
{ "split": "train", "index": 3745, "acecode_id": "oss_1729", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string containing an arithmetic expression involving integers and operator symbols (+, -, *, /), write a Python function that can correct simple errors like extra spaces and spelling errors for numbers (e.g., '2 +2' should be '2+2' and 'twwo + 2' should be '2+2'). The f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calc('2 + 2 * 2 - 3 / 1') == 3\", \"assert calc('5 * 3 + 1') == 16\", \"assert calc('10 / 2') == 5\", \"assert calc('2 + 2 * 2') == 6\", \"assert calc('1 + 1 + 1 + 1') == 4\", \"assert calc('3 * 4 - 2') == 10\", \"assert calc('12 / 4 + 1') == 4\", \"assert c...
{ "split": "train", "index": 3746, "acecode_id": "evol_34398", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that processes a list of page specifications for a web application. The function should take in a list of page specifications and a page factory function, then return a dictionary containing the processed page specifications. E...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_pages_specs([{'name': 'Home', 'url': '/', 'elements': []}], lambda spec: spec['name']) == {'Home': 'Home'}\", \"assert get_pages_specs([{'name': 'Contact', 'url': '/contact', 'elements': []}], lambda spec: spec['name']) == {'Contact': 'Contact'}\", \"ass...
{ "split": "train", "index": 3747, "acecode_id": "oss_3834", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are required to implement a serializer for a Project model. The serializer should be able to serialize the 'id', 'name', and 'organization' fields from the Project model. Additionally, the serializer should have a method to validate the 'name' field to ensure that it is uni...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_project_serializer({'id': 1, 'name': 'Project A', 'organization': 'Org 1'}) == Project(id=1, name='Project A', organization='Org 1')\", \"assert create_project_serializer({'id': 2, 'name': 'Project B', 'organization': 'Org 2'}) == Project(id=2, name='...
{ "split": "train", "index": 3748, "acecode_id": "evol_6212", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `save_issue(title: str) -> str` that simulates saving an issue in a project management system. The function should take a single parameter `title`, which is a string representing the title of the issue. The function should return a su...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert save_issue('Bug in login feature') == \\\"Issue 'Bug in login feature' saved successfully\\\"\", \"assert save_issue('UI improvement for dashboard') == \\\"Issue 'UI improvement for dashboard' saved successfully\\\"\", \"assert save_issue('Database connectio...
{ "split": "train", "index": 3749, "acecode_id": "oss_14155", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes a given expression and two lists of real and imaginary numbers representing eigenvalues of a Hermitian matrix. The function will compute a canonical representation of the nuclear norm. The function should take a string ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert canonicalize_expression('x', [], [0]) == (0, 0)\", \"assert canonicalize_expression('x', [0, 0], [0, 0]) == (0, 0)\", \"assert canonicalize_expression('x', [0], [0]) == (0, 0)\", \"assert canonicalize_expression('x', [100], [0]) == (200, 0)\", \"assert canon...
{ "split": "train", "index": 3750, "acecode_id": "bigcode_python_fns_41533", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function called `process_document_blocks` that processes a list of blocks extracted from a document. Each block is represented as a dictionary containing at least two keys: 'BlockType' and either 'Text' or 'SelectionStatus'. The function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_document_blocks([{'Id': '1', 'BlockType': 'WORD', 'Text': 'Hello'}, {'Id': '2', 'BlockType': 'WORD', 'Text': 'World'}]) == {'1': 'Hello', '2': 'World'}\", \"assert process_document_blocks([{'Id': '1', 'BlockType': 'WORD', 'Text': 'Sample'}, {'Id': '2...
{ "split": "train", "index": 3751, "acecode_id": "oss_29277", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that determines whether a given boot entry string is classified as a 'rescue' entry. A boot entry is considered a 'rescue' entry if the substring 'rescue' (case insensitive) appears anywhere in the string. Write a function `is_rescue_entry...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_rescue_entry('Rescue Mode') == True\", \"assert is_rescue_entry('Normal Boot') == False\", \"assert is_rescue_entry('Booting into rescue') == True\", \"assert is_rescue_entry('REscue') == True\", \"assert is_rescue_entry('System Boot') == False\", \"asser...
{ "split": "train", "index": 3752, "acecode_id": "bigcode_python_fns_31044", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with checking the compatibility of a given package version with the minimum required Python version. Write a Python function `check_package_compatibility` that takes two parameters: `package_version` as a string and `min_python_version` as a tuple of integers. Th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_package_compatibility('3.6.0', (3, 5)) == 'Compatible'\", \"assert check_package_compatibility('3.6.1', (3, 6)) == 'Compatible'\", \"assert check_package_compatibility('3.5.0', (3, 6)) == 'Package version 3.5.0 requires Python 3.6+'\", \"assert check_p...
{ "split": "train", "index": 3753, "acecode_id": "oss_15531", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of stipples, where each stipple is represented as a tuple containing its x-coordinate, y-coordinate, and intensity value, implement a function that sorts these stipples based on their x-coordinate values. Each stipple is represented as (x, y, i) where x and y are t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_stipples([(2.0, 3.0, 0.5), (1.0, 2.0, 0.1), (3.0, 1.0, 0.9)]) == [(1.0, 2.0, 0.1), (2.0, 3.0, 0.5), (3.0, 1.0, 0.9)]\", \"assert sort_stipples([(1.5, 2.1, 0.3), (1.5, 1.5, 0.4), (1.5, 0.5, 0.2)]) == [(1.5, 2.1, 0.3), (1.5, 1.5, 0.4), (1.5, 0.5, 0.2)]\",...
{ "split": "train", "index": 3754, "acecode_id": "bigcode_python_fns_27601", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a representation of a Profile model in a simple database structure. The Profile model should have the following fields: a 'user' represented as a string, a 'bio' represented as a string, and an 'avatar' represented as a string (which could be a file...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_profile('user1', 'Hello World', 'path/to/avatar1.png') == {'user': 'user1', 'bio': 'Hello World', 'avatar': 'path/to/avatar1.png'}\", \"assert create_profile('user2', 'Bio of user2', 'path/to/avatar2.jpg') == {'user': 'user2', 'bio': 'Bio of user2', '...
{ "split": "train", "index": 3755, "acecode_id": "oss_25779", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks for the presence of a specific argument in a list of command-line arguments. The required argument is '--graph-jar', which represents the path to the graph tool JAR file. Your function should take a list of strings representin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_graph_jar(['--graph-jar', 'path/to/graph.jar']) == True\", \"assert check_graph_jar(['--other-arg', '--graph-jar', 'another_path.jar']) == True\", \"assert check_graph_jar(['--graph-jar']) == True\", \"assert check_graph_jar(['--other-arg']) == False\"...
{ "split": "train", "index": 3756, "acecode_id": "oss_8773", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D matrix of integers, write a function `longestIncreasingPath(matrix)` that returns the length of the longest increasing path in the matrix. From each cell, you can move in four directions (up, down, left, right) to an adjacent cell if its value is greater than the cur...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert longestIncreasingPath([[1]]) == 1\", \"assert longestIncreasingPath([[1, 2, 3], [6, 5, 4], [7, 8, 9]]) == 9\", \"assert longestIncreasingPath([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 1\", \"assert longestIncreasingPath([]) == 0\", \"assert longestIncreasingPath...
{ "split": "train", "index": 3757, "acecode_id": "evol_10418", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that returns a list of specific strings. Your function should return a list containing the elements \"Hello\", \"world\", \"from\", and \"other environment!\". Define a function named `create_string_list` that takes no parameters and retu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_string_list() == ['Hello', 'world', 'from', 'other environment!']\", \"assert create_string_list()[0] == 'Hello'\", \"assert create_string_list()[1] == 'world'\", \"assert create_string_list()[2] == 'from'\", \"assert create_string_list()[3] == 'other...
{ "split": "train", "index": 3758, "acecode_id": "oss_28403", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `skip_spaces(st: Tuple[int, str]) -> Tuple[Tuple[int, str], None]` that takes a tuple `st` where the first element is an integer representing the current position in a string and the second element is a string. The function should skip all leading whitespace ch...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert skip_spaces((0, ' Hello World!')) == ((3, ' Hello World!'), None)\", \"assert skip_spaces((0, 'Hello World!')) == ((0, 'Hello World!'), None)\", \"assert skip_spaces((2, ' Hello World!')) == ((3, ' Hello World!'), None)\", \"assert skip_spaces((10, '...
{ "split": "train", "index": 3759, "acecode_id": "bigcode_python_fns_10524", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a tuple of strings representing the names of installed applications, and a string representing the name of an application to uninstall. Write a function `remove_app(INSTALLED_APPS: Tuple[str], app: str) -> Tuple[str]` that removes the specified application from th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_app(('app1', 'app2', 'app3'), 'app2') == ('app1', 'app3')\", \"assert remove_app(('app1', 'app2', 'app2', 'app3'), 'app2') == ('app1', 'app2', 'app3')\", \"assert remove_app(('app1', 'app1', 'app2'), 'app1') == ('app1', 'app2')\", \"assert remove_app(...
{ "split": "train", "index": 3760, "acecode_id": "bigcode_python_fns_32667", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that generates a list of HTML column definitions for a project management tool. Each column should have a specific color and a title associated with it. The function should return a list of dictionaries, where each dictionary represen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_html_columns([('color1', 'Backlog'), ('color8', 'Grooming'), ('color5', 'Upcoming'), ('color3', 'Waiting'), ('color4', 'Inbox'), ('color2', 'MIT'), ('color6', 'Today'), ('color7', 'Next')]) == [{'color': 'color1', 'title': 'Backlog'}, {'color': 'col...
{ "split": "train", "index": 3761, "acecode_id": "bigcode_python_fns_36672", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple profiling system for function execution. Your goal is to create a function called `profile` that takes a function `func`, along with its arguments and keyword arguments, calls the function with the provided arguments, and returns the re...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert profile(lambda x: x + 1, 1) == 2\", \"assert profile(lambda x, y: x * y, 2, 3) == 6\", \"assert profile(lambda x: x ** 2, 5) == 25\", \"assert profile(lambda: sum(range(100)),) == 4950\", \"assert profile(lambda x, y: x - y, 10, 4) == 6\", \"assert profile(l...
{ "split": "train", "index": 3762, "acecode_id": "oss_2904", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of deposit and withdrawal operations on a bank account that starts with a zero balance. The operations can be integers or strings representing integers. Your task is to detect if at any point the balance of the account falls below zero. Additionally, implem...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert below_zero([1, 2, 3]) == False\", \"assert below_zero([1, 2, '-4', 5]) == True\", \"assert below_zero([1, '2', -3], True) == True\", \"assert below_zero([10, -5, -6]) == True\", \"assert below_zero(['5', '-10', '3']) == True\", \"assert below_zero(['-1', '0'...
{ "split": "train", "index": 3763, "acecode_id": "evol_29334", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of three color difference signals represented as floats, calculate the hue angle in degrees. The hue angle is computed using the formula: hue = (180 * atan2(0.5 * (C_2 - C_3) / 4.5, C_1 - (C_2 / 11)) / pi) % 360, where C_1, C_2, and C_3 are the three color differen...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert abs(hue_angle([-5.365865581996587e-05, -0.000571699383647, 0.000625358039467]) - 269.2737594) < 1e-7\", \"assert abs(hue_angle([0.0, 0.0, 0.0]) - 0.0) < 1e-7\", \"assert abs(hue_angle([1.0, 1.0, 1.0]) - 0.0) < 1e-7\", \"assert abs(hue_angle([1.0, 0.0, 0.0]) ...
{ "split": "train", "index": 3764, "acecode_id": "bigcode_python_fns_25674", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given four sentences, write a function `common_words` that returns a list of words that appear in all four sentences. The words should be case-insensitive and returned in lowercase without duplicates. The order of the words in the output list does not matter.\nPlease reason ste...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert common_words('Hello world!', 'Hello there!', 'Hello everyone!', 'Hello again!') == ['hello']\", \"assert common_words('Python is great', 'I love Python', 'Python programming is fun', 'Learn Python') == ['python']\", \"assert common_words('A B C D', 'B C D E'...
{ "split": "train", "index": 3765, "acecode_id": "evol_35171", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `small_aggregate` that takes in a `record` and a list of `records`. This function should return the string 'hello world'. The `record` parameter is an object that has a property `state`, which is a dictionary. Your function should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert small_aggregate(record(), [record()]) == 'hello world'\", \"assert small_aggregate(record(), [record()]) == 'hello world'\", \"assert small_aggregate(record(), [record()]) == 'hello world'\", \"assert small_aggregate(record(), [record()]) == 'hello world'\",...
{ "split": "train", "index": 3766, "acecode_id": "bigcode_python_fns_8936", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a program to analyze and display the light levels in a given environment. The program should take a series of light level readings and output a visual representation of the data. Each reading is represented by a pair of values: the time of the readi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert visualizeLightLevels([('08:00', 3), ('09:00', 7), ('10:00', 5)]) == '08:00 |###\\\\n09:00 |#######\\\\n10:00 |#####\\\\n'\", \"assert visualizeLightLevels([('00:00', 0), ('01:00', 1)]) == '00:00 |\\\\n01:00 |#\\\\n'\", \"assert visualizeLightLevels([('12:00'...
{ "split": "train", "index": 3767, "acecode_id": "oss_2200", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of configuration lines as strings. Each line may contain configuration settings that include paths to directories. Your task is to implement a function `has_self_install_dirs(config_lines: List[str]) -> bool` that checks if any line in the list has a specif...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_self_install_dirs(['hard_drive_1_label = amigaosdir']) == True\", \"assert has_self_install_dirs(['hard_drive_2_label = kickstartdir']) == True\", \"assert has_self_install_dirs(['hard_drive_3_label = userpackagesdir']) == True\", \"assert has_self_insta...
{ "split": "train", "index": 3768, "acecode_id": "bigcode_python_fns_42865", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that sorts a list of alphanumeric strings in ascending order based on their numerical values. If two strings have the same numerical value, sort them alphabetically by their character component. The strings are formatted such that the first part is a number...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_func(['21a', '10b', '3c', '100d', '2e', '21b']) == ['2e', '3c', '10b', '21a', '21b', '100d']\", \"assert sort_func(['5z', '3y', '5a', '2b', '1c']) == ['1c', '2b', '3y', '5a', '5z']\", \"assert sort_func(['2a', '2b', '2c', '2d']) == ['2a', '2b', '2c', '2...
{ "split": "train", "index": 3769, "acecode_id": "evol_5731", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with generating random attributes for a specified number of points. Implement a function `generate_random_points_and_attrs(count: int) -> List[Tuple[Tuple[float, float], int, str, str, bool]]` that takes an integer `count`, representing the number of points to ge...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert len(generate_random_points_and_attrs(0)) == 0\", \"assert len(generate_random_points_and_attrs(5)) == 5\", \"assert len(generate_random_points_and_attrs(10)) == 10\", \"assert all(isinstance(point, tuple) and len(point) == 5 for point in generate_random_poin...
{ "split": "train", "index": 3770, "acecode_id": "bigcode_python_fns_45515", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two lists of prices, `high` and `low`, representing the high and low prices of a stock over a certain period, implement a function `mid_price(high: List[float], low: List[float], timeperiod: int = 14) -> List[float]` that calculates the midpoint price for each correspondi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert mid_price([], []) == []\", \"assert mid_price([10, 20], [5, 15], 3) == []\", \"assert mid_price([5, 10], [5, 10], 1) == [5.0, 10.0]\", \"assert mid_price([10, 20], [5], 14) == []\", \"assert mid_price([1, 4], [2, 5], 3) == []\", \"assert mid_price([100, 200]...
{ "split": "train", "index": 3771, "acecode_id": "bigcode_python_fns_22064", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a date string in the format 'YYYY-MM-DD', write a function `parse_date(date_str: str) -> Tuple[str, str, str]` that parses the date string and returns a tuple containing the year, month, and day as strings. The year should be a 4-digit string, the month should be a 1 or 2...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_date('1982-06-23') == ('1982', '6', '23')\", \"assert parse_date('2023-01-01') == ('2023', '1', '1')\", \"assert parse_date('1999-12-31') == ('1999', '12', '31')\", \"assert parse_date('2000-02-29') == ('2000', '2', '29')\", \"assert parse_date('2020-1...
{ "split": "train", "index": 3772, "acecode_id": "bigcode_python_fns_28250", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create a function `create_review(user: str, title: str = 'Review 1') -> dict` that generates a review dictionary for a user with a default title. The review dictionary should contain the following keys: 'reviewer', 'title', 'rating', 'summary', 'ip', and 'company'. The 'reviewe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_review('user1') == {'reviewer': 'user1', 'title': 'Review 1', 'rating': 5, 'summary': 'This is my first review!!!', 'ip': '190.190.190.1', 'company': 'Test Company'}\", \"assert create_review('user2') == {'reviewer': 'user2', 'title': 'Review 1', 'rat...
{ "split": "train", "index": 3773, "acecode_id": "bigcode_python_fns_43051", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given two lists of integers, `in_distribution` and `ood_distribution`. Your task is to combine these two lists into a single list that contains all the elements from both lists. Additionally, each element from the `in_distribution` list should be marked with a label '1'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert combine_datasets([1, 2, 3], [4, 5, 6]) == [(1, 1), (2, 1), (3, 1), (4, 0), (5, 0), (6, 0)]\", \"assert combine_datasets([], [4, 5, 6]) == [(4, 0), (5, 0), (6, 0)]\", \"assert combine_datasets([1, 2, 3], []) == [(1, 1), (2, 1), (3, 1)]\", \"assert combine_dat...
{ "split": "train", "index": 3774, "acecode_id": "bigcode_python_fns_15515", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of bounding box coordinates represented as a 2D array, return a GeoJSON structure that defines a polygon using these coordinates. Each bounding box is defined by four points, where each point is represented as an array of two floating point numbers (longitude and l...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_geojson_polygon([[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0]]) == {'type': 'Polygon', 'coordinates': [[[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0], [0.0, 0.0]]]}\", \"assert get_geojson_polygon([[5.0, 5.0], [5.0, 10.0], [10.0, 10.0], [10.0, 5.0]]) ...
{ "split": "train", "index": 3775, "acecode_id": "bigcode_python_fns_12577", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Design a function `manage_processes(operations: List[Tuple[str, Union[str, int]]]) -> List[Union[int, bool, Dict[str, Union[str, int]]]]` that simulates a simplified process manager. The `operations` parameter is a list of tuples where each tuple contains an operation and its c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert manage_processes([('start', 'Process1', 'command1'), ('start', 'Process2', 'command2')]) == [1, 2]\", \"assert manage_processes([('start', 'Process1', 'command1'), ('terminate', 1)]) == [1, True]\", \"assert manage_processes([('start', 'Process1', 'command1'...
{ "split": "train", "index": 3776, "acecode_id": "oss_13008", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes in three parameters: a user's name, password, and email, and returns a dictionary containing this information structured as key-value pairs. The dictionary should have the keys 'name', 'password', and 'email' corresponding to t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_user_info('Alice', 'password123', 'alice@example.com') == {'name': 'Alice', 'password': 'password123', 'email': 'alice@example.com'}\", \"assert create_user_info('Bob', 'securepassword', 'bob@domain.com') == {'name': 'Bob', 'password': 'securepassword...
{ "split": "train", "index": 3777, "acecode_id": "oss_8666", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary that contains various details about a task execution in a workflow system. Your goal is to generate a formatted success message string that includes the task ID, DAG ID, execution date, and a log URL. Write a function called `generate_success_message`...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_success_message({'task_instance': {'task_id': 'task_1', 'dag_id': 'dag_1'}, 'execution_date': '2023-10-01T12:00:00', 'log_url': 'http://example.com/logs/1'}) == ':large_blue_circle: Task Succeeded! \\\\n*Task*: task_1 \\\\n*Dag*: dag_1 \\\\n*Execut...
{ "split": "train", "index": 3778, "acecode_id": "bigcode_python_fns_41426", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `run_ml_algorithm` that simulates the execution of specific machine learning algorithms from a hypothetical library named `simple_ml`. The function should take two parameters: a string `algorithm_name` representing the name of the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert run_ml_algorithm('knn', 'sample data') == 'Executed knn algorithm on data: sample data'\", \"assert run_ml_algorithm('svm', 'input features') == 'Executed svm algorithm on data: input features'\", \"assert run_ml_algorithm('decision_tree', 'training set') ==...
{ "split": "train", "index": 3779, "acecode_id": "oss_23043", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given a list of device objects, where each device has a unique identifier represented by the `st` attribute. Write a function `find_device_by_st(devices: List[Device], unique_identifier: str) -> Optional[Device]` that searches for a device with a specific unique identif...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_device_by_st([{'st': 'urn:samsung.com:device:RemoteControlReceiver:1'}, {'st': 'urn:apple.com:device:AppleTV:2'}], 'urn:samsung.com:device:RemoteControlReceiver:1') == {'st': 'urn:samsung.com:device:RemoteControlReceiver:1'}\", \"assert find_device_by_s...
{ "split": "train", "index": 3780, "acecode_id": "oss_25982", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer x, implement a function that prints all integers from 1 to x-1. The function should not return any value. You may assume x will always be greater than 1. Write a single function that performs this task.\nPlease reason step by step, then write a self-con...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert f1(10) == None\", \"assert f1(5) == None\", \"assert f1(2) == None\", \"assert f1(100) == None\", \"assert f1(50) == None\", \"assert f1(20) == None\", \"assert f1(15) == None\", \"assert f1(30) == None\", \"assert f1(1) == None\", \"assert f1(200) == None\"...
{ "split": "train", "index": 3781, "acecode_id": "evol_25231", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a basic bidirectional RNN operation. Your function should take in two lists of integers, where each list represents a sequence of input data from two different sources. The function should return a list of tuples, where...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_bidirectional_rnn([1, 2, 3], [4, 5, 6]) == [(5, 0), (7, 0), (9, 0)]\", \"assert simulate_bidirectional_rnn([0, 0], [0, 0]) == [(0, 0), (0, 0)]\", \"assert simulate_bidirectional_rnn([-1, -2, -3], [-4, -5, -6]) == [(-5, 0), (-7, 0), (-9, 0)]\", \"ass...
{ "split": "train", "index": 3782, "acecode_id": "oss_35264", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function `sum_of_three_numbers(a, b, c)` that takes three integers as input and returns their sum.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block." } ]
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_three_numbers(1, 2, 3) == 6\", \"assert sum_of_three_numbers(-1, -2, -3) == -6\", \"assert sum_of_three_numbers(0, 0, 0) == 0\", \"assert sum_of_three_numbers(5, 10, 15) == 30\", \"assert sum_of_three_numbers(-5, 5, 0) == 0\", \"assert sum_of_three_nu...
{ "split": "train", "index": 3783, "acecode_id": "evol_4103", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers that represent the background colors of a series of elements. Each integer corresponds to a different color. Your task is to implement a function that takes this list of integers and returns a new list containing only the unique background color...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_background_colors([1, 2, 3, 1, 2, 3]) == [1, 2, 3]\", \"assert unique_background_colors([5, 5, 5, 5]) == [5]\", \"assert unique_background_colors([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert unique_background_colors([3, 2, 1, 3, 2, 1]) == [3, 2, 1]...
{ "split": "train", "index": 3784, "acecode_id": "bigcode_python_fns_19579", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `quick_sort(nums)` that takes a list of integers `nums` and returns a new list containing the same integers sorted in ascending order using the Quick Sort algorithm. The input list may contain duplicate values. You need to ensure that the sorting is done in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quick_sort([2, 8, 1, 5, 9]) == [1, 2, 5, 8, 9]\", \"assert quick_sort([5, 3, 8, 1, 2]) == [1, 2, 3, 5, 8]\", \"assert quick_sort([4, 2, 5, 1, 3]) == [1, 2, 3, 4, 5]\", \"assert quick_sort([10, 7, 8, 9, 1, 5]) == [1, 5, 7, 8, 9, 10]\", \"assert quick_sort([3,...
{ "split": "train", "index": 3785, "acecode_id": "evol_31125", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `find_primes_in_range(a: int, b: int) -> List[int]` that generates a list of unique numbers from A to B (inclusive) and returns a list of all the prime numbers within that range. Both A and B are non-negative integers where B is greater than A. The output shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_primes_in_range(0, 20) == [2, 3, 5, 7, 11, 13, 17, 19]\", \"assert find_primes_in_range(1, 10) == [2, 3, 5, 7]\", \"assert find_primes_in_range(10, 30) == [11, 13, 17, 19, 23, 29]\", \"assert find_primes_in_range(5, 15) == [5, 7, 11, 13]\", \"assert fin...
{ "split": "train", "index": 3786, "acecode_id": "evol_1681", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that takes in an array, an index, and a numeric offset. The function should first reverse the array, then add the given offset to the provided index, and return the value at the updated index in the reversed array. If the updated index is out of range, return '...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_reversed_array_val([1, 2, 3, 4, 5], 2, 1) == 2\", \"assert print_reversed_array_val([10, 20, 30, 40], 1, 2) == 10\", \"assert print_reversed_array_val([5, 4, 3, 2, 1], 0, 0) == 1\", \"assert print_reversed_array_val([7, 8, 9], 0, 2) == 7\", \"assert pr...
{ "split": "train", "index": 3787, "acecode_id": "evol_32756", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Implement a function that checks if a given string is a palindrome. A palindrome is a string that reads the same backward as forward. The function should return True if the string is a palindrome and False otherwise. For this problem, consider only alphanumeric characters and i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome('racecar') == True\", \"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('Was it a car or a cat I saw?') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('Hello') ...
{ "split": "train", "index": 3788, "acecode_id": "evol_11528", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a function `mapper` that returns a key, and a dictionary `sources` that maps keys to corresponding values. Your task is to implement a function `case(mapper: Callable[[], str], sources: Dict[str, int], default_source: Optional[int] = None) -> int` that returns the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert case(lambda: '1', {'1': 10, '2': 20}, 0) == 10\", \"assert case(lambda: '2', {'1': 10, '2': 20}, 0) == 20\", \"assert case(lambda: '3', {'1': 10, '2': 20}, 0) == 0\", \"assert case(lambda: '3', {'1': 10, '2': 20}, 5) == 5\", \"assert case(lambda: '1', {'1': ...
{ "split": "train", "index": 3789, "acecode_id": "bigcode_python_fns_46836", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a function that takes this list as input and returns a new list containing only the unique elements from the original list, sorted in ascending order. The input list can contain both positive and negative integers, as well...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_sorted([3, 1, 2, 1, 3]) == [1, 2, 3]\", \"assert unique_sorted([-1, -2, -2, 0, 1]) == [-2, -1, 0, 1]\", \"assert unique_sorted([5, 5, 5]) == [5]\", \"assert unique_sorted([]) == []\", \"assert unique_sorted([10, 1, 10, 2, 3]) == [1, 2, 3, 10]\", \"ass...
{ "split": "train", "index": 3790, "acecode_id": "bigcode_python_fns_25057", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with generating a plan to transform a given dense state represented as a list of integers into a goal state represented as a list of integers. Your task is to implement a function `generate_plan(start, goal)` that returns a list of steps needed to convert the sta...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_plan([1, 2, 3], [3, 2, 1]) == [2, 0, -2]\", \"assert generate_plan([4, 5, 6], [1, 5, 6]) == [-3, 0, 0]\", \"assert generate_plan([5, 5, 5], [5, 0, 5]) == [0, -5, 0]\", \"assert generate_plan([10, 20, 30], [15, 25, 35]) == [5, 5, 5]\", \"assert gener...
{ "split": "train", "index": 3791, "acecode_id": "oss_14617", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function for a number guessing game. The function should take two parameters: a secret number and a list of guesses. The function should return a list of boolean values where each boolean indicates whether the corresponding guess matches the s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert guess_game(15, [15], 1) == [True]\", \"assert guess_game(0, [0], 1) == [True]\", \"assert guess_game(42, [41, 42, 43], 3) == [False, True, False]\", \"assert guess_game(50, [51, 52], 1) == 'Omae wa mo shindeiru'\", \"assert guess_game(9, [9, 9], 1) == [True,...
{ "split": "train", "index": 3792, "acecode_id": "oss_16590", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a 2D array of integers representing a grid. Your task is to implement a function that computes the bounding box for non-zero values in the grid. The bounding box is defined as the smallest rectangle that contains all the non-zero values, represented by the coordin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_bounding_box([[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == [1, 1, 1, 1]\", \"assert get_bounding_box([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == [0, 0, 2, 2]\", \"assert get_bounding_box([[0, 0], [0, 0], [0, 0]]) == []\", \"assert get_bounding_box([[0, 0], [0, 0], [0,...
{ "split": "train", "index": 3793, "acecode_id": "bigcode_python_fns_39478", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that processes a dictionary mapping XML tag names to corresponding functions. Given an XML tag name, your goal is to return the corresponding function from the dictionary. If the tag name is not found, the function should retur...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_function_for_tag('http://www.music-encoding.org/ns/mei/dot') == dotFromElement\", \"assert get_function_for_tag('http://www.music-encoding.org/ns/mei/rest') == restFromElement\", \"assert get_function_for_tag('http://www.music-encoding.org/ns/mei/note') ...
{ "split": "train", "index": 3794, "acecode_id": "oss_10889", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python class that simulates a family tree. The family tree should be able to store information about family members and their relationships. Your task is to implement the `Family` class with the following methods: \n1. `__init__(self, name)`: ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert Family(\\\"Smith\\\").add_member(\\\"Mike\\\", \\\"husband\\\", None) is None\", \"assert Family(\\\"Smith\\\").add_member(\\\"Jane\\\", \\\"wife\\\", \\\"Mike\\\") is None\", \"assert Family(\\\"Smith\\\").add_member(\\\"John\\\", \\\"son\\\", \\\"Mike\\\")...
{ "split": "train", "index": 3795, "acecode_id": "oss_14916", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function to determine the academic letter grade of a student based on the given arithmetic grade value. The grading scale is defined as follows: A (>90), B (>80), C (>70), D (>60), and F (<60). Your function should validate the grade value to ensure it is between 0 ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_academic_grade(85) == 'B'\", \"assert get_academic_grade(95) == 'A'\", \"assert get_academic_grade(50) == 'F'\", \"assert get_academic_grade(100) == 'A'\", \"assert get_academic_grade(0) == 'F'\", \"assert get_academic_grade(-1) == 'Error: Invalid grade ...
{ "split": "train", "index": 3796, "acecode_id": "evol_23500", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of dictionaries where each dictionary contains information about a student and their scores in various subjects, implement a function `aggregate_student_scores(chosen: List[Dict[str, Union[str, float]]]) -> Dict[str, float]` that aggregates the scores for each subj...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert aggregate_student_scores([{'name': 'Alice', 'math': 90, 'science': 80}, {'name': 'Bob', 'math': 70, 'science': 90}, {'name': 'Charlie', 'math': 100}]) == {'math': 86.66666666666667, 'science': 85.0}\", \"assert aggregate_student_scores([{'name': 'Grace', 'en...
{ "split": "train", "index": 3797, "acecode_id": "bigcode_python_fns_43917", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of images represented by their coordinates (latitude and longitude) and a specified bounding box defined by the lower left and upper right corners, write a function `search_images` that filters the images to return only those that fall within the specified bounding...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert search_images([(1, 1), (2, 2), (3, 3)], (0, 0), (2, 2)) == [(1, 1), (2, 2)]\", \"assert search_images([(0, 0), (5, 5), (1, 1)], (0, 0), (3, 3)) == [(0, 0), (1, 1)]\", \"assert search_images([], (0, 0), (10, 10)) == []\", \"assert search_images([(3, 3), (4, 4...
{ "split": "train", "index": 3798, "acecode_id": "bigcode_python_fns_17985", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that retrieves the value of a specified attribute from a given place object represented as a dictionary. The function should take two parameters: 'attr' which is a string representing the attribute name you want to retrieve, and 'place_ob...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_attribute('name', {'name': 'Central Park', 'location': 'New York'}) == 'Central Park'\", \"assert get_attribute('location', {'name': 'Eiffel Tower', 'location': 'Paris'}) == 'Paris'\", \"assert get_attribute('rating', {'name': 'Great Wall', 'rating': 4.7...
{ "split": "train", "index": 3799, "acecode_id": "oss_1137", "num_tests": 16 }