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 given a string representing a DNA sequence that contains only the characters 'A', 'C', 'G', and 'T'. Write a Python function `process_genetic_sequence(sequence: str) -> dict` that takes the DNA sequence as input and returns a dictionary containing the count of each nucl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_genetic_sequence('AAACCCGGG') == {'A': 3, 'C': 3, 'G': 3, 'T': 0, 'GC_content': 0.6666666666666666}\", \"assert process_genetic_sequence('') == 'Empty sequence.'\", \"assert process_genetic_sequence('TTTT') == {'A': 0, 'C': 0, 'G': 0, 'T': 4, 'GC_con... | {
"split": "train",
"index": 70100,
"acecode_id": "oss_15833",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing a matrix in row-major order. Your task is to write a function that takes this list and returns a new list that contains the elements of the matrix in column-major order. Column-major order means that you traverse the columns first, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert column_major_order([1, 2, 3, 4], 2, 2) == [1, 3, 2, 4]\", \"assert column_major_order([1, 2, 3], 3, 1) == [1, 2, 3]\", \"assert column_major_order([1], 1, 1) == [1]\", \"assert column_major_order([1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 3) == [1, 4, 7, 2, 5, 8, 3, 6,... | {
"split": "train",
"index": 70101,
"acecode_id": "bigcode_python_fns_24243",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of circular sectors, where each sector is represented as a tuple (radius, angle). Write a function that takes this list and returns a new list containing the areas of the circular sectors. The area of a circular sector can be calculated using the formula: a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_multiple_circular_sectors([(5, 90)]) == [19.63]\", \"assert process_multiple_circular_sectors([(10, 45)]) == [39.27]\", \"assert process_multiple_circular_sectors([(15, 0)]) == [0.0]\", \"assert process_multiple_circular_sectors([(7, 370)]) == [None]... | {
"split": "train",
"index": 70102,
"acecode_id": "evol_24803",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that manages a collection of user attributes in a simple user data system. The function, named `manage_user_data`, takes a list of user attributes and a default value. It checks if each attribute exists; if an attribute does not exist... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_user_data(['name', 'age', 'email'], 'unknown') == {'name': 'unknown', 'age': 'unknown', 'email': 'unknown'}\", \"assert manage_user_data(['name', 'age'], 'N/A') == {'name': 'N/A', 'age': 'N/A'}\", \"assert manage_user_data(['username', 'password'], 'd... | {
"split": "train",
"index": 70103,
"acecode_id": "oss_13034",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a floating-point number x and a non-negative integer n, implement a function that computes x raised to the power of n using exponentiation by squaring. The function should handle cases where n is zero by returning 1, and it should correctly compute the power for both even... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert exp_by_squaring(2.0, 0) == 1.0\", \"assert exp_by_squaring(2.0, 1) == 2.0\", \"assert exp_by_squaring(2.0, 2) == 4.0\", \"assert exp_by_squaring(2.0, 3) == 8.0\", \"assert exp_by_squaring(2.0, 4) == 16.0\", \"assert exp_by_squaring(3.0, 0) == 1.0\", \"assert... | {
"split": "train",
"index": 70104,
"acecode_id": "bigcode_python_fns_5837",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of MQTT messages in JSON format that describe the configuration of devices. Each device has a name, a command topic, and a JSON attributes topic. The messages may update the configuration of a device, including its attributes. Implement a function `update_d... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_device_attributes([ '{ \\\"name\\\": \\\"Beer\\\", \\\"command_topic\\\": \\\"test_topic\\\", \\\"json_attributes_topic\\\": \\\"attr-topic1\\\" }', '{ \\\"name\\\": \\\"Beer\\\", \\\"command_topic\\\": \\\"test_topic\\\", \\\"json_attributes_topic\\\... | {
"split": "train",
"index": 70105,
"acecode_id": "bigcode_python_fns_7247",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that verifies the authenticity of a given signed message using a provided signature. The function `verify_signature` takes in the following parameters: \n- `message`: A string representing the signed message. \n- `signature`: A str... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert verify_signature('Hello, World!', 'valid_signature') == True\", \"assert verify_signature('Hello, World!', 'invalid_signature') == False\", \"assert verify_signature('Test message', 'valid_signature') == True\", \"assert verify_signature('Test message', 'wro... | {
"split": "train",
"index": 70106,
"acecode_id": "oss_15457",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of group labels and a corresponding list of target indices. Write a function `get_indices_by_groups(group_labels: List[int], targets: List[int]) -> List[List[int]]` that returns a list of lists, where each inner list contains the indices of the targets that... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_indices_by_groups([0, 1, 0, 1], [10, 20, 30, 40]) == [[0, 2], [1, 3]]\", \"assert get_indices_by_groups([0, 0, 0], [1, 2, 3]) == [[0, 1, 2]]\", \"assert get_indices_by_groups([0], [99]) == [[0]]\", \"assert get_indices_by_groups([0, 1, 0, 0, 1], [100, 20... | {
"split": "train",
"index": 70107,
"acecode_id": "bigcode_python_fns_39257",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if a given URL is reachable. The function should take a URL as input and return True if the HTTP status code of the response is either 200 (OK) or 300 (Multiple Choices). If the URL cannot be reached due to an exception, t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_url_reachable('http://example.com') == True\", \"assert is_url_reachable('http://nonexistent.url') == False\", \"assert is_url_reachable('http://localhost:9999') == False\", \"assert is_url_reachable('http://example.com/notfound') == False\", \"assert is_... | {
"split": "train",
"index": 70108,
"acecode_id": "bigcode_python_fns_26763",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if a given root directory is valid. A valid root directory is defined as a non-empty string. If the input is not a valid root directory, the function should raise an 'InvalidRootError'. Write a function named 'check_root_d... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_root_directory('valid_directory') == True\", \"assert check_root_directory('another_valid_directory') == True\", \"assert check_root_directory('folder/subfolder') == True\", \"assert check_root_directory('/absolute/path') == True\", \"assert check_root... | {
"split": "train",
"index": 70109,
"acecode_id": "oss_14190",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a token queue system for a ticketing application. Your goal is to create a function that simulates adding tokens to a queue and retrieving them in a first-in-first-out (FIFO) manner. Implement the function `token_queue_operations(operations: Lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert token_queue_operations([('add', 1), ('add', 2), ('get',), ('get',), ('get',)]) == [1, 2, None]\", \"assert token_queue_operations([('get',), ('add', 5), ('get',)]) == [None, 5]\", \"assert token_queue_operations([('add', 3), ('add', 4), ('get',), ('add', 5),... | {
"split": "train",
"index": 70110,
"acecode_id": "oss_22556",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that counts the maximum number of balanced brackets in a given operator expression. The function should return the counts for round brackets '()', square brackets '[]', and curly braces '{}' separately. For example, given the expression '((){[()]})', the functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_brackets('(){}[]') == (1, 1, 1)\", \"assert count_brackets('{[()]}') == (1, 1, 1)\", \"assert count_brackets('((()))') == (3, 0, 0)\", \"assert count_brackets('') == (0, 0, 0)\", \"assert count_brackets('((())') == (2, 0, 0)\", \"assert count_brackets(... | {
"split": "train",
"index": 70111,
"acecode_id": "evol_1307",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a string `text` that consists of words separated by spaces. Each word consists of one or more lowercase English letters, and there are at least one or more spaces between each word. Your task is to rearrange the spaces in such a way that there is an equal number o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rearrange_spaces(' this is a sentence ') == ('this is a sentence', 3, 0)\", \"assert rearrange_spaces('a b') == ('a b', 1, 0)\", \"assert rearrange_spaces('hello world') == ('hello world', 2, 0)\", \"assert rearrange_spaces('one two three') == ... | {
"split": "train",
"index": 70112,
"acecode_id": "evol_32543",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given two lists of numbers representing the daily net asset values (NAV) of an investment and a benchmark, calculate the up-market capture ratio. The up-market capture ratio is defined as the ratio of the returns of the investment to the returns of the benchmark during periods ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert up_market_capture_ratio([100, 105, 110], [100, 99, 98]) == 0.0\", \"assert up_market_capture_ratio([100, 100, 100], [100, 100, 100]) == 0.0\", \"assert up_market_capture_ratio([100], [100]) == 0.0\", \"assert up_market_capture_ratio([100, 105, 110], []) == 0... | {
"split": "train",
"index": 70113,
"acecode_id": "bigcode_python_fns_34748",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the merging of two branches in a version control system. The function takes four parameters: `repo`, `ours_branch`, `theirs_branch`, and `merge_state`. The `repo` parameter is a placeholder for a Git repository, while `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_branches(None, 'main', 'feature', 1) == 'Merge successful'\", \"assert merge_branches(None, 'develop', 'bugfix', 1) == 'Merge successful'\", \"assert merge_branches(None, 'release', 'hotfix', 1) == 'Merge successful'\", \"assert merge_branches(None, 'm... | {
"split": "train",
"index": 70114,
"acecode_id": "oss_14373",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that determines if a user is an adult based on their age. The function should take an integer representing the user's age as input and return a boolean value. The user is considered an adult if their age is 18 or older. If the age pro... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_adult(20) == True\", \"assert is_adult(18) == True\", \"assert is_adult(17) == False\", \"assert is_adult(15) == False\", \"assert is_adult(19) == True\", \"assert is_adult(0) == False\", \"assert is_adult(-1) == False\", \"assert is_adult(100) == True\",... | {
"split": "train",
"index": 70115,
"acecode_id": "oss_10163",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that identifies the indexes of all 'boundary' elements in a list of integers. A boundary element is defined as an element where the product of all elements to the left is equal to the product of all elements to the right. The function should handle cases wh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert boundary_indexes([1, 2, 3, 0, 6]) == [3]\", \"assert boundary_indexes([1, 2, 3, 4, 5]) == []\", \"assert boundary_indexes([1, 2, 1, 2, 1]) == [2]\", \"assert boundary_indexes([1, 2, 3, 4, 0, 6]) == []\", \"assert boundary_indexes([5, 1, 5]) == [1]\", \"asser... | {
"split": "train",
"index": 70116,
"acecode_id": "evol_11537",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function that checks if a given string is an anagram of another string. An anagram is a rearrangement of the letters of a different word or phrase, using all the original letters exactly once. Consider only alphanumeric characters and ignore case sensitivity. Your f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert are_anagrams('listen', 'silent') == True\", \"assert are_anagrams('Triangle', 'Integral') == True\", \"assert are_anagrams('Apple', 'Pabble') == False\", \"assert are_anagrams('Astronomer', 'Moon starer') == True\", \"assert are_anagrams('School master', 'Th... | {
"split": "train",
"index": 70117,
"acecode_id": "evol_8535",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of employee names and a company name as inputs. The function should return a dictionary where the keys are the employees' names and the values are the company name. If the input list is empty, the function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_company_employees('Tech Corp', ['Alice', 'Bob', 'Charlie']) == {'Alice': 'Tech Corp', 'Bob': 'Tech Corp', 'Charlie': 'Tech Corp'}\", \"assert create_company_employees('Health Inc', ['David']) == {'David': 'Health Inc'}\", \"assert create_company_emplo... | {
"split": "train",
"index": 70118,
"acecode_id": "oss_4820",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function called `multiply` that takes two floating-point numbers as parameters and returns their product. The function should handle both positive and negative numbers, as well as zero.\nPlease reason step by step, then write a self-contained Python solution. Give y... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert multiply(2.0, 3.0) == 6.0\", \"assert multiply(-2.0, 3.0) == -6.0\", \"assert multiply(2.0, -3.0) == -6.0\", \"assert multiply(-2.0, -3.0) == 6.0\", \"assert multiply(0.0, 5.0) == 0.0\", \"assert multiply(5.0, 0.0) == 0.0\", \"assert multiply(0.0, 0.0) == 0.... | {
"split": "train",
"index": 70119,
"acecode_id": "evol_26430",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `remove_non_alphanumeric_characters(s: str) -> str` that removes all non-alphanumeric characters from the given string `s`, which may contain UTF-8 encoded characters. The function should return a new string that consists only of alphanumeric characters (letter... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_non_alphanumeric_characters('Hello World \\ud83c\\udf0d\\ud83d\\ude80 ! 42') == 'HelloWorld42'\", \"assert remove_non_alphanumeric_characters('Python3.9 is awesome!') == 'Python39isawesome'\", \"assert remove_non_alphanumeric_characters('1234 @#$%^&*(... | {
"split": "train",
"index": 70120,
"acecode_id": "evol_28975",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Write a function that takes a list of integers as an argument and returns the median of the elements in the list. The input list may have unsorted elements and duplicates; in this case, you should first sort the list and handle duplicates appropriately before calculating the me... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_median([1, 2, 3, 4, 5]) == 3\", \"assert find_median([5, 3, 1, 4, 2]) == 3\", \"assert find_median([1, 1, 1, 1]) == 1\", \"assert find_median([1]) == 1\", \"assert find_median([]) == None\", \"assert find_median([1, 2, 2, 3]) == 2\", \"assert find_media... | {
"split": "train",
"index": 70121,
"acecode_id": "evol_35951",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a multidimensional array `result` that contains stellar mass function (SMF), blue fraction, and stellar mass-halo mass (SMHM) information, along with two arrays `gals_bf` and `halos_bf` representing the best fit stellar and halo mass values, and a float `bf_chi2` represen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compute_max_min_smhm([[[], [1, 2], [3, 4], [5, 6]]], [1, 2], [1, 2], 0.1) == (6, 1)\", \"assert compute_max_min_smhm([[[], [2, 3], [4, 5], [6, 7]]], [2, 3], [2, 3], 0.2) == (7, 2)\", \"assert compute_max_min_smhm([[[], [3, 4], [5, 6], [7, 8]]], [3, 4], [3, 4... | {
"split": "train",
"index": 70122,
"acecode_id": "bigcode_python_fns_2158",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a store name. Your task is to implement a function `getStoreRole(store: str) -> str` that returns the role associated with the given store. The roles are predefined in a dictionary where each store name corresponds to a specific role. If the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert getStoreRole('StoreA') == 'Admin'\", \"assert getStoreRole('StoreB') == 'Manager'\", \"assert getStoreRole('StoreC') == 'Employee'\", \"assert getStoreRole('StoreD') == 'Customer'\", \"assert getStoreRole('StoreE') == 'Unknown Role'\", \"assert getStoreRole(... | {
"split": "train",
"index": 70123,
"acecode_id": "bigcode_python_fns_3281",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the total number of deaths recorded in a given year. The function should take a dictionary as input, where the keys are the names of the years (as strings) and the values are the corresponding number of deaths (as inte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert total_deaths({'2020': 100, '2021': 150, '2022': 200}, '2021') == 150\", \"assert total_deaths({'2020': 100, '2021': 150, '2022': 200}, '2020') == 100\", \"assert total_deaths({'2020': 100, '2021': 150, '2022': 200}, '2022') == 200\", \"assert total_deaths({'... | {
"split": "train",
"index": 70124,
"acecode_id": "bigcode_python_fns_14334",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `fib(n)` that takes a non-negative integer `n` and returns a list containing the Fibonacci series up to the number `n`. The Fibonacci series starts with 0 followed by 1, and each subsequent number is the sum of the previous two numbers. If `n` is less than ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fib(0) == []\", \"assert fib(4) == [0, 1, 1, 2, 3]\", \"assert fib(5) == [0, 1, 1, 2, 3, 5]\", \"assert fib(6) == [0, 1, 1, 2, 3, 5]\", \"assert fib(7) == [0, 1, 1, 2, 3, 5]\", \"assert fib(10) == [0, 1, 1, 2, 3, 5, 8]\", \"assert fib(11) == [0, 1, 1, 2, 3, ... | {
"split": "train",
"index": 70125,
"acecode_id": "evol_21073",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, determine if there exist two distinct integers in the array such that their product is even. An even product occurs if at least one of the integers is even. Implement a function that returns True if such a pair exists, and False otherwise.\nPlease re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_even_product([1, 3, 5, 7]) == False\", \"assert check_even_product([1, 2, 3, 4]) == True\", \"assert check_even_product([6, 8, 10]) == True\", \"assert check_even_product([1, 1, 1, 1]) == False\", \"assert check_even_product([2, 2, 2, 2]) == True\", \"... | {
"split": "train",
"index": 70126,
"acecode_id": "evol_34762",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of random numbers, implement a function that sorts the list in ascending order and then calculates the mean of the sorted numbers. The list can contain both positive and negative numbers. If the provided list is empty, the function should return an error message in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_mean_of_sorted_list([3, 1, 4, 1, 5]) == 2.8\", \"assert find_mean_of_sorted_list([-1, -2, -3, -4]) == -2.5\", \"assert find_mean_of_sorted_list([5, 10, 15]) == 10.0\", \"assert find_mean_of_sorted_list([0]) == 0.0\", \"assert find_mean_of_sorted_list([-... | {
"split": "train",
"index": 70127,
"acecode_id": "evol_11382",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function to check if a specific number is prime. A prime number is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. Your function should take an integer as input and return a boolean value in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_prime(2) == True\", \"assert is_prime(3) == True\", \"assert is_prime(4) == False\", \"assert is_prime(5) == True\", \"assert is_prime(10) == False\", \"assert is_prime(11) == True\", \"assert is_prime(13) == True\", \"assert is_prime(15) == False\", \"as... | {
"split": "train",
"index": 70128,
"acecode_id": "oss_2382",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that resolves mathematical expressions based on a given value and a list of operations. The function should take a float as the initial value and a list of operations, where each operation is represented as a tuple containing the oper... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert resolve_expression(20.0, [('add', 10.0)]) == '(20.0 + 10.0)'\", \"assert resolve_expression(8.0, []) == '8.0'\", \"assert resolve_expression(25.0, [('div', 5.0), ('add', 10.0)]) == '((25.0 / 5.0) + 10.0)'\", \"assert resolve_expression(50.0, [('div', 2.0), (... | {
"split": "train",
"index": 70129,
"acecode_id": "oss_16648",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, implement a function that returns the integer that appears most frequently in the array. If there is a tie, return the first integer that reached that maximum frequency. The array may contain both positive and negative integers, as well as zeros.\nPl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert most_frequent([2, 3, 4, 2, 3, 2, 3, 2]) == 2\", \"assert most_frequent([1, 2, 2, 3, 3, 1, 1]) == 1\", \"assert most_frequent([-3, -3, -2, -1, -3, -2]) == -3\", \"assert most_frequent([0, 0, 1, 1, 1, 0]) == 0\", \"assert most_frequent([1, 2, 3, 4, 5]) == 1\",... | {
"split": "train",
"index": 70130,
"acecode_id": "evol_28174",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of positive floating-point numbers representing frequencies, implement a function that calculates the 1/f weight for each frequency in the list. If the normalize parameter is set to True, the weights should be normalized to the range [0, 1]. The function should ret... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert one_on_f_weight([2.0, 5.0, 10.0], False) == [0.5, 0.2, 0.1]\", \"assert one_on_f_weight([], True) == []\", \"assert one_on_f_weight([1.0], True) == [1.0]\", \"assert one_on_f_weight([0.1, 0.2, 0.3], False) == [10.0, 5.0, 3.3333333333333335]\", \"assert one_o... | {
"split": "train",
"index": 70131,
"acecode_id": "bigcode_python_fns_26409",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of a group of people. Your task is to write a function that calculates the average height of the people in the group. The function should take a list of integers as input and return a single float value representing the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert average_height([160, 170, 180]) == 170.0\", \"assert average_height([150, 160, 165, 170]) == 161.25\", \"assert average_height([180]) == 180.0\", \"assert average_height([]) == 0.0\", \"assert average_height([155, 165]) == 160.0\", \"assert average_height([2... | {
"split": "train",
"index": 70132,
"acecode_id": "bigcode_python_fns_11485",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with developing a function to analyze temperature data for a given date range. Your function should take two date strings as input, representing a start date and an end date in the format 'YYYY-MM-DD'. The function will return the minimum, average, and maximum te... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calc_temps('2023-01-01', '2023-01-05', [30, 32, 35, 31, 29]) == (29, 31.4, 35)\", \"assert calc_temps('2023-01-01', '2023-01-03', [28, 30, 32]) == (28, 30.0, 32)\", \"assert calc_temps('2023-01-04', '2023-01-06', [29, 30, 31]) == (29, 30.0, 31)\", \"assert c... | {
"split": "train",
"index": 70133,
"acecode_id": "bigcode_python_fns_7726",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Create a function that returns the integer part of both positive and negative numbers. If the input is neither an integer nor a float, the function should raise a custom exception with the message 'Input should be integer or float.' The function should only yield the integer pa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert dissect_float_number(5.9) == 5\", \"assert dissect_float_number(-3.5) == -4\", \"assert dissect_float_number(0) == 0\", \"assert dissect_float_number(-1.1) == -2\", \"assert dissect_float_number(3.14) == 3\", \"assert dissect_float_number(2.718) == 2\", \"as... | {
"split": "train",
"index": 70134,
"acecode_id": "evol_2140",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of command dictionaries and a timeline ID, and returns a list of command dictionaries with an additional 'id' field. Each command must contain the keys 'date', 'time', and 'cmd'. The 'id' should start from 1 and incr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insert_cmds([{'date': '2021-10-01', 'time': 1.0, 'cmd': 'start'}], 1) == [{'id': 1, 'date': '2021-10-01', 'time': 1.0, 'cmd': 'start', 'timeline_id': 1}]\", \"assert insert_cmds([{'date': '2021-10-01', 'time': 2.0, 'cmd': 'stop'}, {'date': '2021-10-01', 'tim... | {
"split": "train",
"index": 70135,
"acecode_id": "bigcode_python_fns_43193",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of `m` arrays, each of which is sorted in ascending order. Your task is to find the maximum absolute difference between any two integers selected from two distinct arrays. The absolute difference between two integers `a` and `b` is defined as `|a - b|`. Imp... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_distance([[1, 2, 3], [4, 5], [1, 2, 3]]) == 4\", \"assert max_distance([[1], [1]]) == 0\", \"assert max_distance([[1], [2]]) == 1\", \"assert max_distance([[1, 4], [0, 5]]) == 4\", \"assert max_distance([[1, 3], [8, 10], [5, 6]]) == 9\", \"assert max_dis... | {
"split": "train",
"index": 70136,
"acecode_id": "evol_19741",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of features represented as strings. Your task is to implement a function that takes in this list and a boolean value indicating whether to sort the feature list in ascending order. If the boolean is true, return the sorted feature list; otherwise, return th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_features(['feature1', 'feature2', 'feature3'], True, 5) == [('feature1', 5), ('feature2', 5), ('feature3', 5)]\", \"assert manage_features(['feature3', 'feature2', 'feature1'], False, 10) == [('feature3', 10), ('feature2', 10), ('feature1', 10)]\", \"... | {
"split": "train",
"index": 70137,
"acecode_id": "oss_14951",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that generates all possible unique permutations of a given string. The function should handle erroneous inputs gracefully by raising a custom error if the input is not a string, or if the string contains any repeated characters. The function should return a lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_permutations('ABC') == ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']\", \"assert generate_permutations('A') == ['A']\", \"assert generate_permutations('AB') == ['AB', 'BA']\", \"assert generate_permutations('XYZ') == ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY',... | {
"split": "train",
"index": 70138,
"acecode_id": "evol_21810",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings called `names`. Your task is to write a Python function `perform_operations(names)` that takes this list as input and performs the following operations: 1. Return the length of the list `names`. 2. Return the element at index 1 of the list `names... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert perform_operations(['Alice', 'Bob', 'Charlie']) == (3, 'Bob')\", \"assert perform_operations(['Alice', 'Bob']) == (2, 'Bob')\", \"assert perform_operations(['Alice', 'Bob', 'Charlie', 'David']) == (4, 'Bob')\", \"assert perform_operations(['Alice', 'Bob', 'C... | {
"split": "train",
"index": 70139,
"acecode_id": "oss_1189",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that determines whether a given string is a palindrome. A palindrome is a word, phrase, number, or other sequences of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Write a func... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal, Panama') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('Was it a car or a cat I saw?') == True\", \"assert is_palindrome('Hello, World!') == False\", \"assert is_palindrome('A... | {
"split": "train",
"index": 70140,
"acecode_id": "oss_4106",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of JSON objects where each object has two fields: 'id' (a string) and 'aInt' (an integer). Your task is to implement a function that filters this list to only include objects where 'aInt' is greater than 2, calculates the sum of the 'aInt' values for these ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_json_objects([{'aInt': 5, 'id': '1111'}, {'aInt': 2, 'id': '2222'}, {'aInt': 3, 'id': '3333'}, {'aInt': 4, 'id': '4444'}]) == {'filteredSum': 12, 'filteredObjects': [{'aInt': 5, 'id': '1111'}, {'aInt': 3, 'id': '3333'}, {'aInt': 4, 'id': '4444'}]}\",... | {
"split": "train",
"index": 70141,
"acecode_id": "oss_35122",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates a unique trace ID and span ID for a distributed tracing system in a microservices architecture. The function should take an optional parent span ID and metadata dictionary as input. It should return a dictionary contain... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_trace_context('parent1', {'user': 'test_user'})['parent_span_id'] == 'parent1'\", \"assert generate_trace_context('parent2', {'action': 'fetch'})['metadata'] == {'action': 'fetch'}\", \"assert generate_trace_context(None, {'key': 'value'})['trace_id... | {
"split": "train",
"index": 70142,
"acecode_id": "oss_1754",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes two integers, x and y, representing the coordinates of a point in a 2D plane. The function should return a tuple containing the current coordinates of the point after setting them to the provided values. Implement the function ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_point_position(1, 2) == (1, 2)\", \"assert set_point_position(0, 0) == (0, 0)\", \"assert set_point_position(-1, -1) == (-1, -1)\", \"assert set_point_position(10, 20) == (10, 20)\", \"assert set_point_position(100, 200) == (100, 200)\", \"assert set_poi... | {
"split": "train",
"index": 70143,
"acecode_id": "oss_29890",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates a sequence of integers from 1 to a given number n (inclusive). The function should return a list containing these integers. Your implementation should handle the case where n is less than 1 by returning an empty list. I... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_sequence(1) == [1]\", \"assert generate_sequence(5) == [1, 2, 3, 4, 5]\", \"assert generate_sequence(10) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\", \"assert generate_sequence(0) == []\", \"assert generate_sequence(-5) == []\", \"assert generate_sequence(... | {
"split": "train",
"index": 70144,
"acecode_id": "oss_20166",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of integers, `verts_before` and `verts_after`, which represent the indices of vertices in a mesh before and after a transformation, respectively. Your task is to implement a function that takes these two lists and returns a new list where each element at... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert map_vertex_labels([0, 1, 2], [2, 1, 0]) == [2, 1, 0]\", \"assert map_vertex_labels([], [0]) == [-1]\", \"assert map_vertex_labels([1, 2, 3], []) == []\", \"assert map_vertex_labels([0], [0]) == [0]\", \"assert map_vertex_labels([1, 2, 3], [5, 6]) == [-1, -1]... | {
"split": "train",
"index": 70145,
"acecode_id": "bigcode_python_fns_8919",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of names, implement a function `create_nested_dict(names)` that organizes these names into a nested dictionary structure. The outer dictionary should have keys representing the first letter of the names, and the inner dictionaries should store the names along with ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_nested_dict(['John', 'Alice', 'John', 'Bob']) == {'J': {'John': 2}, 'A': {'Alice': 1}, 'B': {'Bob': 1}}\", \"assert create_nested_dict(['Charlie', 'Alice', 'Charlie', 'David']) == {'C': {'Charlie': 2}, 'A': {'Alice': 1}, 'D': {'David': 1}}\", \"assert... | {
"split": "train",
"index": 70146,
"acecode_id": "evol_22792",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the gravitational force between two masses based on their masses and the distance between them using Newton's law of universal gravitation. The formula for gravitational force is F = G * (m1 * m2) / r^2, where G is the gravitational constant (ap... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert gravitational_force(1.0, 1.0, 1.0) == 6.674e-11\", \"assert gravitational_force(1.0, 1.0, 2.0) == 1.6685e-11\", \"assert gravitational_force(5.0, 10.0, 5.0) == 1.3348e-10\", \"assert gravitational_force(0.0, 10.0, 10.0) == 0.0\", \"assert gravitational_force... | {
"split": "train",
"index": 70147,
"acecode_id": "evol_28460",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `extract_elements` that returns a new list containing the elements positioned at the second, third, and fourth indices of the input list. If the input list has fewer than four elements, return an empty list.\nPlease reason step by ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_elements([9, 3, 6, 2, 8]) == [3, 6, 2]\", \"assert extract_elements([1, 2, 3, 4, 5]) == [2, 3, 4]\", \"assert extract_elements([10, 20]) == []\", \"assert extract_elements([1]) == []\", \"assert extract_elements([]) == []\", \"assert extract_elements... | {
"split": "train",
"index": 70148,
"acecode_id": "evol_13533",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string that represents the name of a configuration file. Your task is to extract the file extension from the filename. The file extension is defined as the substring after the last dot in the filename. If the filename does not contain a dot, return an empty stri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_file_extension('config.yaml') == 'yaml'\", \"assert get_file_extension('data.json') == 'json'\", \"assert get_file_extension('document.pdf') == 'pdf'\", \"assert get_file_extension('image.jpeg') == 'jpeg'\", \"assert get_file_extension('archive.tar.gz') ... | {
"split": "train",
"index": 70149,
"acecode_id": "bigcode_python_fns_11029",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a non-negative integer n, write a function `legendre(n)` that returns the nth order Legendre polynomial, P_n(x), evaluated at x=0. The Legendre polynomial is defined over the interval [-1, 1] and should be computed using the properties of orthogonal polynomials. Your func... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert legendre(0) == 1\", \"assert legendre(1) == 0\", \"assert legendre(3) == 0\", \"assert legendre(5) == 0\", \"assert legendre(7) == 0\", \"assert legendre(9) == 0\", \"assert legendre(11) == 0\", \"assert legendre(13) == 0\", \"assert legendre(15) == 0\", \"a... | {
"split": "train",
"index": 70150,
"acecode_id": "bigcode_python_fns_30391",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given a list of non-negative numbers, write a function that normalizes the list by dividing each element by the sum of all elements in the list. If the sum is zero, return the original list. The function should return a new list containing the normalized values. Write a functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert normalize_list([1, 2, 3]) == [0.16666666666666666, 0.3333333333333333, 0.5]\", \"assert normalize_list([0, 0, 0]) == [0, 0, 0]\", \"assert normalize_list([10, 20, 30, 40]) == [0.1, 0.2, 0.3, 0.4]\", \"assert normalize_list([4, 4, 4, 4]) == [0.25, 0.25, 0.25,... | {
"split": "train",
"index": 70151,
"acecode_id": "bigcode_python_fns_46796",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of intervals, where each interval is represented as a tuple containing a lower bound, an upper bound, and an identifier (id). Write a function `interval_weighting(intervals: List[Tuple[int, int, int]], lower: int, upper: int) -> List[float]` that computes a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert interval_weighting([(1, 3, 1)], 0, 2) == [0.5]\", \"assert interval_weighting([(0, 10, 1)], 0, 10) == [1.0]\", \"assert interval_weighting([(1, 2, 1)], 1, 1) == [0.0]\", \"assert interval_weighting([(1, 3, 1)], 1, 4) == [1.0]\", \"assert interval_weighting([... | {
"split": "train",
"index": 70152,
"acecode_id": "bigcode_python_fns_21174",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function called `resize_image` that takes an image represented as a 2D list of RGB tuples and a tuple representing new dimensions (width, height). The function should resize the image to the new dimensions using nearest-neighbor interpolation. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert resize_image([[(255, 0, 0), (0, 255, 0)], [(0, 0, 255), (255, 255, 0)]], (2, 2)) == [[(255, 0, 0), (0, 255, 0)], [(0, 0, 255), (255, 255, 0)]]\", \"assert resize_image([[(255, 0, 0), (0, 255, 0)], [(0, 0, 255), (255, 255, 0)]], (1, 1)) == [[(255, 0, 0)]]\", ... | {
"split": "train",
"index": 70153,
"acecode_id": "oss_2224",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings representing column names, determine if all specified column names are present in a provided list of valid columns. Implement a function `has_columns(valid_columns: List[str], columns: List[str]) -> bool` that takes in two lists: `valid_columns` which co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert has_columns(['id', 'name', 'age', 'city'], ['name', 'age']) == True\", \"assert has_columns(['id', 'name', 'age', 'city'], ['name', 'country']) == False\", \"assert has_columns(['height', 'width', 'depth'], ['height']) == True\", \"assert has_columns(['heigh... | {
"split": "train",
"index": 70154,
"acecode_id": "bigcode_python_fns_34819",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of floating-point numbers representing the daily temperatures in degrees Celsius for a particular location over a period of time. Your task is to write a function `calculate_average_temperature` that takes this list as input and returns the average temperat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_temperature([15.5, 20.3, 25.8]) == 20.53\", \"assert calculate_average_temperature([0.0, 0.0, 0.0]) == 0.00\", \"assert calculate_average_temperature([-10.0, -5.0, 0.0]) == -5.00\", \"assert calculate_average_temperature([]) == 0.00\", \"as... | {
"split": "train",
"index": 70155,
"acecode_id": "oss_23149",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a spectrum represented by a dictionary containing metadata about a compound, including its name. Your task is to implement a function that adds an adduct to the metadata if it is not already present. An adduct is defined based on a mapping of compound names to the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_adduct({'metadata': {'compound_name': 'compound1'}}) == {'metadata': {'compound_name': 'compound1', 'adduct': 'adduct1'}}\", \"assert add_adduct({'metadata': {'compound_name': 'compound2'}}) == {'metadata': {'compound_name': 'compound2', 'adduct': 'adduc... | {
"split": "train",
"index": 70156,
"acecode_id": "oss_10610",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `combat_outcome(player_health: int, player_damage: int, enemy_health: int, enemy_damage: int) -> str` that simulates a combat encounter between a player and an enemy. The function should return 'Player wins' if the player defeats the enemy, 'Enemy wins' if ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert combat_outcome(100, 20, 50, 10) == 'Player wins'\", \"assert combat_outcome(100, 20, 40, 10) == 'Player wins'\", \"assert combat_outcome(100, 20, 60, 10) == 'Player wins'\", \"assert combat_outcome(50, 20, 40, 10) == 'Player wins'\", \"assert combat_outcome(... | {
"split": "train",
"index": 70157,
"acecode_id": "evol_320",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function `get_positive_and_sort(l: list)` that takes a list of integers as input and returns a new list containing only the positive integers from the input list, sorted in ascending order. You must also include a separate auxiliary function for sorting the list wit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_positive_and_sort([-1, 2, -4, 5, 6]) == [2, 5, 6]\", \"assert get_positive_and_sort([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [1, 2, 3, 3, 5, 9, 123]\", \"assert get_positive_and_sort([]) == []\", \"assert get_positive_and_sort([-10, -5, -1]) == []\", ... | {
"split": "train",
"index": 70158,
"acecode_id": "evol_6877",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that takes a floating-point numeral as an argument and returns the digit that is positioned immediately to the left of the decimal point in that number. If the number does not have a decimal point, return -1.\nPlease reason step by step, then write a self-conta... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_left_of_point(56.7891) == 6\", \"assert get_left_of_point(123.456) == 3\", \"assert get_left_of_point(0.123) == 0\", \"assert get_left_of_point(7.890) == 7\", \"assert get_left_of_point(10.0) == 0\", \"assert get_left_of_point(45.6789) == 5\", \"assert g... | {
"split": "train",
"index": 70159,
"acecode_id": "evol_13431",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a binary string representation (a string composed of '0's and '1's), implement a function that converts this binary string into its corresponding integer value. The function should ignore any leading zeros in the binary string. If the input string is empty, return 0. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert binary_to_integer('1101') == 13\", \"assert binary_to_integer('101010') == 42\", \"assert binary_to_integer('00001') == 1\", \"assert binary_to_integer('0') == 0\", \"assert binary_to_integer('') == 0\", \"assert binary_to_integer('11111111') == 255\", \"ass... | {
"split": "train",
"index": 70160,
"acecode_id": "bigcode_python_fns_28450",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a string representing a file name and returns a string that is a formatted message indicating whether the file is valid or not. A file is considered valid if its name ends with the '.txt' extension. Implement a function named `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_file_name('document.txt') == 'Valid file.'\", \"assert validate_file_name('image.png') == 'Invalid file.'\", \"assert validate_file_name('notes.txt') == 'Valid file.'\", \"assert validate_file_name('archive.zip') == 'Invalid file.'\", \"assert valid... | {
"split": "train",
"index": 70161,
"acecode_id": "bigcode_python_fns_27769",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating the behavior of a ball in a simple Pong game. Write a function `update_ball_position(ball_pos: List[int], ball_vel: List[int], paddle1_pos: int, paddle2_pos: int, canvas_height: int, canvas_width: int) -> List[int]` that updates the ball's positio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_ball_position([50, 50], [2, 3], 40, 40, 100, 200) == [52, 53]\", \"assert update_ball_position([10, 10], [1, 1], 40, 40, 100, 200) == [11, 11]\", \"assert update_ball_position([50, 10], [2, 1], 40, 40, 100, 200) == [52, 11]\", \"assert update_ball_pos... | {
"split": "train",
"index": 70162,
"acecode_id": "bigcode_python_fns_11520",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a list of package names and a list of directories that are expected to contain these packages. Your task is to implement a function that checks if all the packages (excluding those that start with 'test_') are present in the directory list. Write a function `check... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_packages_in_dirs(['pkg1', 'pkg2', 'test_pkg3'], ['pkg1', 'pkg2', 'pkg4']) == True\", \"assert check_packages_in_dirs(['pkg1', 'pkg2', 'test_pkg3'], ['pkg1', 'pkg4']) == False\", \"assert check_packages_in_dirs(['test_pkg1', 'pkg2'], ['pkg2', 'pkg3']) =... | {
"split": "train",
"index": 70163,
"acecode_id": "bigcode_python_fns_21505",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with sending bulk notifications to a list of users identified by their unique registration IDs. Write a function `send_bulk_notifications(registration_ids: List[str], message: str) -> str` that takes a list of registration IDs and a notification message as input ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert send_bulk_notifications(['id1', 'id2', 'id3'], 'Hello World') == 'Sent to: id1,id2,id3 with message: Hello World'\", \"assert send_bulk_notifications(['user123', 'user456'], 'Welcome!') == 'Sent to: user123,user456 with message: Welcome!'\", \"assert send_bu... | {
"split": "train",
"index": 70164,
"acecode_id": "bigcode_python_fns_1412",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a customizable greeting message. The function should take a single argument, `greeting`, which is a string representing the desired greeting message. The function should return a dictionary containing a single key-value pai... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_greeting('Greetings!') == {'text': 'Greetings!'}\", \"assert generate_greeting('Good Morning') == {'text': 'Good Morning'}\", \"assert generate_greeting('') == {'text': 'Hello, World!'}\", \"assert generate_greeting('Hi there!') == {'text': 'Hi ther... | {
"split": "train",
"index": 70165,
"acecode_id": "oss_32665",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers and a target integer, implement a function that returns the number of contiguous subarrays within the list that have a sum equal to the target integer.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_target_subarrays([1, 1, 1, 1, 1], 2) == 4\", \"assert find_target_subarrays([0, 0, 0, 0], 0) == 10\", \"assert find_target_subarrays([], 0) == 0\", \"assert find_target_subarrays([5, 5, 5], 10) == 2\", \"assert find_target_subarrays([10, 2, -2, -10], 0)... | {
"split": "train",
"index": 70166,
"acecode_id": "evol_21448",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are given a list of agency codes and you need to determine which agencies belong to the same group based on specific rules. The grouping rules are as follows: if the agency code is '097', it belongs to the group of agencies ['017', '021', '057', '097']. If the agency code i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert group_agency_codes('097') == ['017', '021', '057', '097']\", \"assert group_agency_codes('1601') == ['1601', '016']\", \"assert group_agency_codes('1125') == ['1125', '011']\", \"assert group_agency_codes('1000') == []\", \"assert group_agency_codes('XYZ') =... | {
"split": "train",
"index": 70167,
"acecode_id": "bigcode_python_fns_15460",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of fragments, where each fragment is represented as a dictionary containing a list of atom indices, implement a function that calculates the centroid of the atoms for each fragment. The centroid is defined as the average position of the atoms in three-dimensional s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_centroid_frags([{'ids': [0, 1]}, {'ids': [2]}], [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0), (2.0, 2.0, 2.0)]) == [{'ids': [0, 1], 'cx': 0.5, 'cy': 0.5, 'cz': 0.5}, {'ids': [2], 'cx': 2.0, 'cy': 2.0, 'cz': 2.0}]\", \"assert add_centroid_frags([{'ids': [0]}, {'ids'... | {
"split": "train",
"index": 70168,
"acecode_id": "bigcode_python_fns_20418",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that retrieves the email address of an author from a given item in a content management system. The item is expected to have an attribute `by` that contains an author object. The author object has two attributes: `name` (a string repr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert item_author_email({'by': {'name': 'John Doe', 'email': 'john@example.com'}}) == 'john@example.com'\", \"assert item_author_email({'by': {'name': 'Jane Smith', 'email': ''}}) == None\", \"assert item_author_email({'by': None}) == None\", \"assert item_author_... | {
"split": "train",
"index": 70169,
"acecode_id": "oss_27757",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array `nums` of integers and an integer `k`, return the maximum `sum` such that there exists `i < j` with `nums[i] + nums[j] = sum` and `sum < k`. If no such pair `i`, `j` exists satisfying this condition, return `-1`. Additionally, the `sum` must be an even number.\nP... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert twoSumLessThanK([10,20,30], 15) == -1\", \"assert twoSumLessThanK([1, 1, 1, 1], 3) == 2\", \"assert twoSumLessThanK([5, 5, 5, 5], 12) == 10\", \"assert twoSumLessThanK([6, 7, 8, 9], 15) == 14\", \"assert twoSumLessThanK([2, 4, 6, 8], 20) == 14\", \"assert tw... | {
"split": "train",
"index": 70170,
"acecode_id": "evol_2040",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary representing a field specification. The dictionary contains an 'ignored' key, which indicates whether the field should be ignored, an 'identifier' which is a unique string for the field, and a 'format' key that contains another dictionary with a 'type... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert spec_from_json_dict({'ignored': True, 'identifier': 'field1', 'format': {'type': 'string'}}) == 'field1'\", \"assert spec_from_json_dict({'ignored': False, 'identifier': 'field2', 'format': {'type': 'number'}}) == 'number'\", \"assert spec_from_json_dict({'i... | {
"split": "train",
"index": 70171,
"acecode_id": "bigcode_python_fns_25382",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D matrix of integers and an integer K, implement a function that returns the lexicographically smallest path of K numbers starting from the smallest number in the matrix, moving to its neighboring cells (up, down, left, right). If no such path exists, return an empty l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_minimum_path([[1, 2], [3, 4]], 2) == [1, 2]\", \"assert get_minimum_path([[1]], 1) == [1]\", \"assert get_minimum_path([[1, 1], [1, 1]], 1) == [1]\", \"assert get_minimum_path([[10, 20], [30, 40]], 2) == [10, 20]\", \"assert get_minimum_path([[0]], 1) ==... | {
"split": "train",
"index": 70172,
"acecode_id": "evol_15412",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a configuration dictionary `config` and a string `donl_type`, implement a function `get_organization_suggestions` that returns a list of organization suggestions based on the provided DONL type. The `config` dictionary contains various keys related to organizations, and t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_organization_suggestions({'org1': {'type': 'A'}, 'org2': {'type': 'B'}, 'org3': {'type': 'A'}}, 'A') == [{'type': 'A'}, {'type': 'A'}]\", \"assert get_organization_suggestions({'org1': {'type': 'X'}, 'org2': {'type': 'Y'}, 'org3': {'type': 'Z'}}, 'A') ==... | {
"split": "train",
"index": 70173,
"acecode_id": "bigcode_python_fns_49668",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing the color code of a card in hexadecimal format. Your task is to implement a function that returns the color name based on the provided color code. The mapping of color codes to color names is as follows: '#ff0101' and '#ffb047' correspond to ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_color('#ff0101') == 'red'\", \"assert get_color('#ffb047') == 'red'\", \"assert get_color('#800080') == 'purple'\", \"assert get_color('#ff47ff') == 'purple'\", \"assert get_color('#00ff00') == 'green'\", \"assert get_color('#0000ff') == 'green'\", \"ass... | {
"split": "train",
"index": 70174,
"acecode_id": "bigcode_python_fns_18077",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a directed graph represented as an adjacency list, determine if a specific node is an intersection node. A node is considered an intersection node if it has at least two incoming edges (predecessors) or at least two outgoing edges (successors). You need to implement a fun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_intersection([[1, 2], [3], [4], []], 1) == False\", \"assert is_intersection([[1], [2], [3], []], 0) == False\", \"assert is_intersection([[1, 2], [1, 3], [3], []], 1) == True\", \"assert is_intersection([[1, 2], [2, 2], [3], []], 1) == True\", \"assert i... | {
"split": "train",
"index": 70175,
"acecode_id": "bigcode_python_fns_43647",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that maps string representations of storage policies to their corresponding integer values. The function `get_storage_policy_value(san_policy_str)` should take a string `san_policy_str` as input, which represents a storage policy. The... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_storage_policy_value('online') == 1\", \"assert get_storage_policy_value('offline') == 2\", \"assert get_storage_policy_value('offline_shared') == 3\", \"assert get_storage_policy_value('unknown_policy') == -1\", \"assert get_storage_policy_value('online... | {
"split": "train",
"index": 70176,
"acecode_id": "oss_16888",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers called `dataset` and a target integer `target`. Your task is to implement a function that determines if there exists a pair of distinct indices (i, j) such that dataset[i] + dataset[j] equals the target. Return True if such a pair exists, otherw... | 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, -2, -3, -4, -5], -8) == True\", \"assert has_pair_with_sum([0, 1, 2, 3], 3) == True\", \"assert has_pair_with_sum([1,... | {
"split": "train",
"index": 70177,
"acecode_id": "bigcode_python_fns_23781",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that calculates the longest streak of consecutive days that a user has completed a specific task based on a list of completion dates. The function should take a list of dates as input and return the length of the longest streak of consecut... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_streak(['2023-01-01', '2023-01-02', '2023-01-03']) == 3\", \"assert longest_streak(['2023-01-01', '2023-01-03', '2023-01-04']) == 2\", \"assert longest_streak(['2023-02-01', '2023-02-02', '2023-02-05']) == 2\", \"assert longest_streak(['2023-03-01', ... | {
"split": "train",
"index": 70178,
"acecode_id": "oss_29198",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `lucas(n)` that accepts a positive integer `n` and returns the nth number in the Lucas sequence. The Lucas sequence is defined as follows: L(1) = 2, L(2) = 1, and for n > 2, L(n) = L(n - 1) + L(n - 2). If the input `n` is not a positive integer, the function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lucas(1) == 2\", \"assert lucas(2) == 1\", \"assert lucas(3) == 3\", \"assert lucas(4) == 4\", \"assert lucas(5) == 7\", \"assert lucas(6) == 11\", \"assert lucas(7) == 18\", \"assert lucas(8) == 29\", \"assert lucas(9) == 47\", \"assert lucas(10) == 76\", \... | {
"split": "train",
"index": 70179,
"acecode_id": "evol_32240",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, find the last odd number in the list that is not a multiple of 5. If such a number does not exist, return None. Implement a function that takes a list of integers as input and returns an integer or None.\nPlease reason step by step, then write a self-c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_last_odd_non_mult_of_five([1, 2, 3, 4, 5]) == 3\", \"assert find_last_odd_non_mult_of_five([10, 12, 14]) == None\", \"assert find_last_odd_non_mult_of_five([5, 15, 25]) == None\", \"assert find_last_odd_non_mult_of_five([21, 22, 23, 24, 25]) == 23\", \"... | {
"split": "train",
"index": 70180,
"acecode_id": "evol_30234",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two integers x and k, implement a function that computes the product of x and the modular multiplicative inverse of 2 in the ring of integers modulo 3 raised to the power of k. The modular multiplicative inverse of 2 is defined as the integer y such that (2 * y) % (3^k) =... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert mul_inv2(1, 1) == 2\", \"assert mul_inv2(2, 1) == 1\", \"assert mul_inv2(0, 1) == 0\", \"assert mul_inv2(2, 2) == 1\", \"assert mul_inv2(2, 3) == 1\", \"assert mul_inv2(0, 3) == 0\", \"assert mul_inv2(2, 4) == 1\", \"assert mul_inv2(4, 4) == 2\", \"assert mu... | {
"split": "train",
"index": 70181,
"acecode_id": "bigcode_python_fns_27789",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that counts the number of unique integers in a given list. The function should take a list of integers as input and return the count of unique integers in the list. Your implementation should handle potential errors gracefully,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unique_numbers([1, 2, 3, 4, 5]) == 5\", \"assert count_unique_numbers([1, 1, 1, 1, 1]) == 1\", \"assert count_unique_numbers([-1, -2, -3, -3, -2, -1]) == 3\", \"assert count_unique_numbers([]) == 0\", \"assert count_unique_numbers([0, 0, 0, 0]) == 1\",... | {
"split": "train",
"index": 70182,
"acecode_id": "oss_30936",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns a list of boolean values indicating whether each integer in the list is even. The output list should have the same length as the input list, where each boolean value corresponds to the evenness of the respective intege... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_evenness([1, 2, 3, 4, 5]) == [False, True, False, True, False]\", \"assert check_evenness([2, 4, 6, 8, 10]) == [True, True, True, True, True]\", \"assert check_evenness([11, 13, 15, 17]) == [False, False, False, False]\", \"assert check_evenness([0, -2... | {
"split": "train",
"index": 70183,
"acecode_id": "evol_25288",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function `generate_sequence(n)` that generates an array of integers starting from 0 up to n-1. The function should return an array of size n, where each element at index i contains the value i. If n is non-positive, the function should return an empty ar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_sequence(0) == []\", \"assert generate_sequence(1) == [0]\", \"assert generate_sequence(2) == [0, 1]\", \"assert generate_sequence(3) == [0, 1, 2]\", \"assert generate_sequence(4) == [0, 1, 2, 3]\", \"assert generate_sequence(5) == [0, 1, 2, 3, 4]\"... | {
"split": "train",
"index": 70184,
"acecode_id": "evol_9898",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integer ports, where each port can either be working, non-working, or available based on certain criteria. Implement a function `categorize_ports(ports: List[int]) -> Tuple[List[int], List[int], List[int]]` that categorizes the ports into three lists: av... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert categorize_ports([-1, 0, 1, 2, -2, 3, 4]) == ([1, 3], [0, 2, 4], [-1, -2])\", \"assert categorize_ports([5, 6, 7, 8, 9, 10]) == ([5, 7, 9], [6, 8, 10], [])\", \"assert categorize_ports([-5, -4, -3, -2, -1]) == ([], [], [-5, -4, -3, -2, -1])\", \"assert categ... | {
"split": "train",
"index": 70185,
"acecode_id": "bigcode_python_fns_40099",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a simple game of guessing a secret number. The function takes two parameters: a secret number between 1 and 100 (inclusive) and a list of guesses. The function should return a list of strings indicating feedback for each gu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert guess_feedback(42, [30, 50, 42]) == ['Too low!', 'Too high!', 'Correct!']\", \"assert guess_feedback(75, [70, 80, 75, 76]) == ['Too low!', 'Too high!', 'Correct!', 'Too high!']\", \"assert guess_feedback(10, [5, 10, 15]) == ['Too low!', 'Correct!', 'Too high... | {
"split": "train",
"index": 70186,
"acecode_id": "oss_36603",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing the multiplicity of elements in a model, implement a function that generates all possible index combinations as strings. Each index combination should be formatted as '[i]' where 'i' is the index for each dimension, starting from zero. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_index_combinations([2, 3]) == ['[0][0]', '[0][1]', '[0][2]', '[1][0]', '[1][1]', '[1][2]']\", \"assert generate_index_combinations([1]) == ['[0]']\", \"assert generate_index_combinations([0]) == []\", \"assert generate_index_combinations([2, 2]) == ... | {
"split": "train",
"index": 70187,
"acecode_id": "bigcode_python_fns_32131",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a representation of a theory in a learning management system. Define a class named `Theory` with the following attributes: `id` (integer, unique identifier), `name` (string, maximum length of 30 characters, must be unique), `description` (string, ca... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Theory(1, 'Physics', 'Study of matter and energy', 'http://physics.example.com', 'Science').theory_details() == 'Theory Name: Physics\\\\nDescription: Study of matter and energy\\\\nCourse: Science'\", \"assert Theory(2, 'Chemistry', '', None, 'Science').the... | {
"split": "train",
"index": 70188,
"acecode_id": "oss_5173",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to determine whether a given string is a valid identifier in Python. A valid identifier must follow these rules: it must start with a letter (a-z, A-Z) or an underscore (_), followed by any combination of letters, digits (0-9), or und... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_identifier('my_variable') == True\", \"assert is_valid_identifier('_private_var') == True\", \"assert is_valid_identifier('2nd_variable') == False\", \"assert is_valid_identifier('var-name') == False\", \"assert is_valid_identifier('myVar123') == Tr... | {
"split": "train",
"index": 70189,
"acecode_id": "oss_25839",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D grid representing an image, where each cell can either be 0 (representing background) or 1 (representing a distinct object). Implement a function `count_objects(grid: List[List[int]]) -> int` that returns the number of distinct objects in the grid. An object ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_objects([[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == 1\", \"assert count_objects([[1, 1, 1], [0, 1, 0], [1, 1, 1]]) == 1\", \"assert count_objects([[1, 1, 0], [0, 0, 0], [1, 1, 1]]) == 2\", \"assert count_objects([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\", \"a... | {
"split": "train",
"index": 70190,
"acecode_id": "oss_21577",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Implement a function `match_substrings(text: str) -> bool` that determines whether the input string `text` contains a sequence of characters that starts with the substring 'abcd' and ends with 'efgh'. The function should be case-insensitive and allow for any amount of whitespac... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert match_substrings('abcd efgh') == True\", \"assert match_substrings('ABCD efgh') == True\", \"assert match_substrings('abcd efgh') == True\", \"assert match_substrings('abcd efgh ') == True\", \"assert match_substrings(' abcd efgh') == True\", \"assert... | {
"split": "train",
"index": 70191,
"acecode_id": "evol_12588",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages a list of integers. Your function should maintain a private list to store the integers and provide two operations: one to add an integer to the list and another to retrieve the current list of integers. Implement a function `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_integers([('add', 1), ('add', 2), ('get',)]) == [[1, 2]]\", \"assert manage_integers([('add', 5), ('get',), ('add', 10), ('get',)]) == [[5], [5, 10]]\", \"assert manage_integers([('get',)]) == [[]]\", \"assert manage_integers([('add', 3), ('add', 4), ... | {
"split": "train",
"index": 70192,
"acecode_id": "oss_6526",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that sorts a list of labels based on specific rules. The labels are represented as strings and stored in a dictionary. Your task is to write a function that takes in a dictionary containing the labels and sorts them according to the f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_labels({'labels': ['b', 'a', 'c', 'a1', 'b2', 'a2']}) == ['a', 'a1', 'a2', 'b', 'b2', 'c']\", \"assert sort_labels({'labels': ['apple', 'banana', 'apricot', 'banana1', 'apple1']}) == ['apple', 'apple1', 'apricot', 'banana', 'banana1']\", \"assert sort_l... | {
"split": "train",
"index": 70193,
"acecode_id": "oss_14904",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of elements, implement a function `set_value(reference, value)` that sets the value of the `reference` to `value` only if the `reference` is a valid reference to an item in the list. If the `reference` is not a valid index (i.e., it is out of bounds or not an integ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_value(0, 10, [1, 2, 3]) == [10, 2, 3]\", \"assert set_value(1, 'hello', ['a', 'b', 'c']) == ['a', 'hello', 'c']\", \"assert set_value(2, True, [False, False, False]) == [False, False, True]\", \"assert set_value(1, 5.5, [1, 2, 3]) == [1, 5.5, 3]\", \"ass... | {
"split": "train",
"index": 70194,
"acecode_id": "bigcode_python_fns_8778",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that validates a set of request parameters for a specific operation. The function should take a dictionary as input and verify that certain banned parameters are not present. If any of the banned parameters are found, the function sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_request_params({'SomeKey': 'SomeValue'}) is None\", \"assert validate_request_params({'Select': 'ALL_ATTRIBUTES'}) is None\", \"assert validate_request_params({'Select': 'ALL_ATTRIBUTES', 'SomeOtherParam': 'Value'}) is None\", \"assert validate_requ... | {
"split": "train",
"index": 70195,
"acecode_id": "bigcode_python_fns_13405",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are given a request object that contains user details and a view type. Your task is to implement a function that returns a context dictionary for rendering a specific view. The context should include the 'user' key with the value taken from the request object, and a 'view' ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_context({'user': 'Alice'}, 'map') == {'user': 'Alice', 'view': 'map'}\", \"assert generate_context({'user': 'Bob'}, 'dashboard') == {'user': 'Bob', 'view': 'dashboard'}\", \"assert generate_context({'user': 'Charlie'}, 'profile') == {'user': 'Charli... | {
"split": "train",
"index": 70196,
"acecode_id": "bigcode_python_fns_33239",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the return on investment (ROI) for a given investment. The ROI is calculated using the formula: ROI = (Net Profit / Cost of Investment) * 100. Write a Python function called `calculate_roi` that takes in two parameters... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_roi(5000, 10000) == 50.0\", \"assert calculate_roi(10000, 5000) == 200.0\", \"assert calculate_roi(0, 10000) == 0.0\", \"assert calculate_roi(5000, 0) == float('inf')\", \"assert calculate_roi(300, 600) == 50.0\", \"assert calculate_roi(100, 100) =... | {
"split": "train",
"index": 70197,
"acecode_id": "oss_1714",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that extracts latitude and longitude coordinates from a given string representation of KML coordinates. The coordinates are provided as a string where each coordinate is separated by a space, and each coordinate consists of longitu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_coordinates('-122.0822035425683,37.42228990140251 -122.0812181915094,37.42315567291919') == [(-122.0822035425683, 37.42228990140251), (-122.0812181915094, 37.42315567291919)]\", \"assert extract_coordinates('-100,0 100,0') == [(-100.0, 0.0), (100.0, ... | {
"split": "train",
"index": 70198,
"acecode_id": "oss_12522",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that initializes a system setup for evaluation. The function should take a single argument `coresys`, which is an instance of a class representing the core system. Your function should return an instance of `EvaluateBase`, which is a clas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert setup(CoreSys()) is not None\", \"assert isinstance(setup(CoreSys()), EvaluateBase)\", \"assert setup(CoreSys()) != setup(CoreSys())\", \"assert isinstance(setup(CoreSys()), EvaluateBase)\", \"assert type(setup(CoreSys())) == EvaluateBase\", \"assert setup(C... | {
"split": "train",
"index": 70199,
"acecode_id": "bigcode_python_fns_23360",
"num_tests": 10
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.