data_source large_stringclasses 1
value | prompt listlengths 1 1 | ability large_stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|
acecode | [
{
"role": "user",
"content": "Write a function that reverses the characters of a given string without using any built-in functions or libraries. The function should handle any potential exceptions that may arise during the process. The function signature is: def reverse_string(string: str) -> str.\nPlease r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_string('Programming') == 'gnimmargorP'\", \"assert reverse_string('Hello World') == 'dlroW olleH'\", \"assert reverse_string('Python') == 'nohtyP'\", \"assert reverse_string('OpenAI') == 'IAnepO'\", \"assert reverse_string('12345') == '54321'\", \"as... | {
"split": "train",
"index": 5300,
"acecode_id": "evol_43",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string containing multiple words separated by spaces, generate all possible n-grams of a specified size from the string. An n-gram consists of a sequence of n words taken from the string, maintaining their original order. The function should return a list of n-grams as ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_ngrams('I love programming in Python', 2) == ['I love', 'love programming', 'programming in', 'in Python']\", \"assert generate_ngrams('Data science is the future', 3) == ['Data science is', 'science is the', 'is the future']\", \"assert generate_ng... | {
"split": "train",
"index": 5301,
"acecode_id": "bigcode_python_fns_21454",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple chatbot function that processes user input and generates a response based on the input. Your function `pensa` should take a string as input and return a string as output. It should generate responses according to the following rules: If the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pensa('How are you?') == \\\"I'm doing well, thank you for asking.\\\"\", \"assert pensa('hello') == 'Hello there!'\", \"assert pensa('Hi there!') == 'Hello there!'\", \"assert pensa('What is your name?') == \\\"I'm not sure how to respond to that.\\\"\", \"... | {
"split": "train",
"index": 5302,
"acecode_id": "oss_19800",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with building a function that assembles a structured result based on a given type specification, a binding, and a mapping of tensor names to actual tensors. Your function should take three arguments: `type_spec`, `binding`, and `output_map`. The `type_spec` indic... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert assemble_result_from_graph('TensorType', 'tensor_binding', {'tensor_name': 'tensor_value'}) == 'tensor_value'\", \"assert assemble_result_from_graph('NamedTupleType', 'tuple_binding', {'element1': 'value1', 'element2': 'value2'}) == [('element1', 'value1'), ... | {
"split": "train",
"index": 5303,
"acecode_id": "bigcode_python_fns_30863",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing distances in kilometers. Your task is to implement a function that takes this list and returns a new list where each element is the square of the corresponding element from the input list. Write a function called `square_distances(d... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert square_distances([1, 2, 3]) == [1, 4, 9]\", \"assert square_distances([-1, -2, -3]) == [1, 4, 9]\", \"assert square_distances([0, 0, 0]) == [0, 0, 0]\", \"assert square_distances([5, -5, 10]) == [25, 25, 100]\", \"assert square_distances([-10, 10, 0]) == [10... | {
"split": "train",
"index": 5304,
"acecode_id": "bigcode_python_fns_37351",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 3D matrix of dimensions p x m x n, where p is the height, m is the number of rows, and n is the number of columns. Implement a function that takes in this 3D matrix and returns a flattened version of it as a 1D list. The function should iterate through each elem... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert flatten_3D_matrix([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) == [1, 2, 3, 4, 5, 6, 7, 8]\", \"assert flatten_3D_matrix([[[10]]]) == [10]\", \"assert flatten_3D_matrix([[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]\", \"assert flatten_3D_m... | {
"split": "train",
"index": 5305,
"acecode_id": "evol_27678",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple library management system. Your job is to implement a function `library_system(books, actions)` that simulates borrowing and returning of books by library members. The input to the function will be a dictionary `books`, where the keys are b... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert library_system({'Book A': 0, 'Book B': 1}, [('borrow', '1', 'Book A'), ('borrow', '1', 'Book B')]) == ['Book not available', 'Book successfully borrowed']\", \"assert library_system({'Book A': 1}, [('borrow', '1', 'Book A'), ('return', '1', 'Book A'), ('retu... | {
"split": "train",
"index": 5306,
"acecode_id": "oss_3411",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given two lists: 'targets' and 'outputs'. The 'targets' list contains integers representing the true labels, while the 'outputs' list contains lists of predicted labels for each corresponding true label. Your task is to implement a function that calculates the accuracy ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_accuracy([1, 2, 3], [[1, 3], [2, 4], [3, 5]], k=2, ignore_index=None) == (1.0, 3, 3)\", \"assert get_accuracy([1, 2, 3, 4], [[5], [6], [7], [8]], k=1, ignore_index=None) == (0.0, 0, 4)\", \"assert get_accuracy([1], [[1]], k=1, ignore_index=None) == (1.0,... | {
"split": "train",
"index": 5307,
"acecode_id": "bigcode_python_fns_42295",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Implement a function `insert_at_position(linked_list: List[int], data: Union[int, str], position: int) -> List[Union[int, str]]` that inserts a given `data` into a specified `position` of a singly linked list represented as a list of integers and/or strings. The function should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insert_at_position([1, 2, 3, 4, 5], 'Hello', 1) == [1, 'Hello', 2, 3, 4, 5]\", \"assert insert_at_position([1, 2, 3, 4, 5], 'World', 0) == ['World', 1, 2, 3, 4, 5]\", \"assert insert_at_position([1, 2, 3], 42, 3) == [1, 2, 3, 42]\", \"assert insert_at_positi... | {
"split": "train",
"index": 5308,
"acecode_id": "evol_18157",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `remove_duplicates(input_list)` that removes duplicate elements from the list while maintaining the original order of elements. You should not use any built-in or library functions. The function should return a new list containing ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_duplicates([1, 2, 3, 1, 2, 3]) == [1, 2, 3]\", \"assert remove_duplicates([4, 5, 6, 4, 5]) == [4, 5, 6]\", \"assert remove_duplicates([]) == []\", \"assert remove_duplicates([1, 1, 1, 1]) == [1]\", \"assert remove_duplicates([7, 8, 9, 8, 7, 10]) == [7... | {
"split": "train",
"index": 5309,
"acecode_id": "evol_18997",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an object, write a function `is_iterable(obj)` that returns `True` if the object is iterable (i.e., it has an iterator) but is not a string. Otherwise, the function should return `False`. Your function should handle various data types such as lists, tuples, dictionaries, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_iterable([1, 2, 3]) == True\", \"assert is_iterable((1, 2, 3)) == True\", \"assert is_iterable({'a': 1, 'b': 2}) == True\", \"assert is_iterable({'a', 'b', 'c'}) == True\", \"assert is_iterable('hello') == False\", \"assert is_iterable(42) == False\", \"a... | {
"split": "train",
"index": 5310,
"acecode_id": "bigcode_python_fns_29047",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simplified stack-like data structure that supports specific operations. Your task is to write a function `custom_stack_operations(operations: List[Tuple[str, int]]) -> List[int]` that takes a list of operations to perform on a stack and return... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert custom_stack_operations([('push', 1), ('push', 2), ('pop', 0), ('increment', 2, 1), ('pop', 0)]) == [2, 2]\", \"assert custom_stack_operations([('push', 3), ('increment', 1, 2), ('pop', 0), ('push', 4), ('pop', 0)]) == [5, 4]\", \"assert custom_stack_operati... | {
"split": "train",
"index": 5311,
"acecode_id": "oss_10514",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simple state management system in Python. This system will allow you to manage stages, each represented by a name and associated data. Your task is to implement a function `manage_stages(stages: List[Tuple[str, str]], enter_stage: str, exit_st... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_stages([('stage1', 'data1'), ('stage2', 'data2')], 'stage1', 'stage2') == ('data1', 'data2')\", \"assert manage_stages([('stage1', 'data1'), ('stage2', 'data2')], 'stage2', 'stage1') == ('data2', 'data1')\", \"assert manage_stages([('stage1', 'data1')... | {
"split": "train",
"index": 5312,
"acecode_id": "oss_28804",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `is_valid_word(word: str) -> bool` that checks if a given word is a valid English word. The function should return True if the word is found in a predefined set of valid English words, and False otherwise. You may assume that the input word will only contain lo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_word('apple') == True\", \"assert is_valid_word('banana') == True\", \"assert is_valid_word('orange') == True\", \"assert is_valid_word('grape') == True\", \"assert is_valid_word('kiwi') == True\", \"assert is_valid_word('strawberry') == True\", \"a... | {
"split": "train",
"index": 5313,
"acecode_id": "bigcode_python_fns_20278",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a byte string representing the content of an image in PNG format. Your task is to implement a function that checks if the image contains the word 'microsoft' in its logo annotations. If it does, return 'ok', otherwise return 'not found'. You should implement the f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_logo_presence(b'\\\\x89PNG\\\\r\\\\n\\\\x1a\\\\n\\\\x00\\\\x00\\\\x00\\\\rIHDR\\\\x00\\\\x00\\\\x00\\\\xd8\\\\x00\\\\x00\\\\x00.\\\\x08\\\\x03\\\\x00\\\\x00\\\\x00}5\\\\'\\\\xdb\\\\x00\\\\x00\\\\x01\\\\x11PLTE\\\\x00\\\\x00\\\\x00sssssssssssssss') == '... | {
"split": "train",
"index": 5314,
"acecode_id": "bigcode_python_fns_19995",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Write a Python function `compound_interest(principal: float, rate: float, time: int) -> float` that calculates the compound interest based on the given principal amount, annual interest rate, and time in years. The function should return the total amount after the specified tim... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compound_interest(1000, 5, 5) == 1276.2815625000003\", \"assert compound_interest(0, 5, 10) == 0.0\", \"assert compound_interest(1500, 0, 5) == 1500.0\", \"assert compound_interest(3000, 6, 1) == 3180.0\", \"assert compound_interest(100, 8, 0) == 100.0\", \"... | {
"split": "train",
"index": 5315,
"acecode_id": "evol_26591",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `heartbeat_cycle(username: str, password: str) -> int` that simulates a login process to a server and retrieves the heartbeat cycle value. The function should take a username and password as inputs and return the heartbeat cycle as an int... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert heartbeat_cycle('user1', 'pass1') == 30\", \"assert heartbeat_cycle('user2', 'pass2') == 60\", \"assert heartbeat_cycle('user1', 'pass1') == 30\", \"assert heartbeat_cycle('user2', 'pass2') == 60\", \"assert heartbeat_cycle('user2', 'pass2') == 60\", \"asser... | {
"split": "train",
"index": 5316,
"acecode_id": "oss_3931",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given two integers `fib0` and `fib1`, generate a Fibonacci sequence of length `count` where each number is derived by multiplying the two preceding numbers instead of adding them. The sequence should start with `fib0` and `fib1`. Implement a function `fibonacci_mult_sequence(fi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fibonacci_mult_sequence(2, 3, 0) == ()\", \"assert fibonacci_mult_sequence(2, 3, 1) == (2,)\", \"assert fibonacci_mult_sequence(2, 3, 2) == (2, 3)\", \"assert fibonacci_mult_sequence(2, 3, 3) == (2, 3, 6)\", \"assert fibonacci_mult_sequence(2, 3, 4) == (2, 3... | {
"split": "train",
"index": 5317,
"acecode_id": "bigcode_python_fns_18976",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an XML node represented as a dictionary where keys are attribute names and values are attribute values, and a list of child nodes (each child node is also a dictionary), write a function `xml_attr_or_element(xml_node: dict, name: str) -> bytes` that attempts to get the va... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert xml_attr_or_element({'attr1': 'value1', 'attr2': 'value2', 'children': [{'name': 'child1', 'value': 'child_value1'}, {'name': 'child2', 'value': 'child_value2'}]}, 'attr1') == b'value1'\", \"assert xml_attr_or_element({'attr1': 'value1', 'attr2': 'value2', '... | {
"split": "train",
"index": 5318,
"acecode_id": "bigcode_python_fns_2398",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of event signals and their corresponding handlers. The function should take two parameters: a list of event signals and a dictionary that maps each event signal to its handler function. The function should return... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_events(['event1', 'event2', 'event3'], {'event1': lambda: 'Handled event 1', 'event2': lambda: 'Handled event 2'}) == ['Handled event 1', 'Handled event 2', 'No handler']\", \"assert process_events(['start', 'stop'], {'start': lambda: 'Started', 'sto... | {
"split": "train",
"index": 5319,
"acecode_id": "oss_24386",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that generates a placeholder name based on the base name of a given variable. The base name is obtained by removing any leading or trailing underscores from the variable name. The placeholder name should be in the format 'place... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_placeholder_name('__hidden_variable__') == 'placeholder_hidden_variable'\", \"assert generate_placeholder_name('_temp_') == 'placeholder_temp'\", \"assert generate_placeholder_name('___') == 'placeholder_'\", \"assert generate_placeholder_name('var1... | {
"split": "train",
"index": 5320,
"acecode_id": "oss_13159",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the weights of items. Your task is to implement a function that calculates the maximum weight that can be achieved by selecting items from the list such that no two selected items are adjacent in the list. Return this maximum weight... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_weight([3, 2, 5, 10, 7]) == 15\", \"assert max_weight([1, 2, 3, 4, 5]) == 9\", \"assert max_weight([5, 1, 1, 5]) == 10\", \"assert max_weight([2, 4, 6, 2, 5]) == 13\", \"assert max_weight([1, 3, 1, 5]) == 8\", \"assert max_weight([10, 5, 1, 10]) == 20\",... | {
"split": "train",
"index": 5321,
"acecode_id": "bigcode_python_fns_24569",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates basic bank account operations. The function should take an initial balance, a series of deposit and withdrawal operations, and an interest rate to apply at the end. The function should return the final balance after app... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bank_account_operations(200.0, [('deposit', 300.0), ('withdraw', 100.0)], 0.0) == 400.0\", \"assert bank_account_operations(0.0, [('deposit', 100.0)], 2.0) == 102.0\", \"assert bank_account_operations(100.0, [], 10.0) == 110.0\", \"assert bank_account_operat... | {
"split": "train",
"index": 5322,
"acecode_id": "oss_18876",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function called `calculate_speed` that computes the speed of a vehicle based on its type and gear. The function takes two parameters: a string `vehicle_type`, which can either be 'trailer' or 'saloon', and an integer `gear`. The speed is calcu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_speed('trailer', 1) == 11.0\", \"assert calculate_speed('trailer', 2) == 22.0\", \"assert calculate_speed('trailer', 3) == 33.0\", \"assert calculate_speed('saloon', 1) == 333.3333333333333\", \"assert calculate_speed('saloon', 2) == 666.6666666666... | {
"split": "train",
"index": 5323,
"acecode_id": "oss_25169",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a month in numeric format (1 to 12). Write a function that checks if the given month is valid. A valid month is a string that can either be a single digit from 1 to 9 or the two-digit numbers 10, 11, or 12. Return True if the month is valid, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_month('1') == True\", \"assert is_valid_month('2') == True\", \"assert is_valid_month('3') == True\", \"assert is_valid_month('4') == True\", \"assert is_valid_month('5') == True\", \"assert is_valid_month('6') == True\", \"assert is_valid_month('7'... | {
"split": "train",
"index": 5324,
"acecode_id": "bigcode_python_fns_2206",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that computes the nth root of a numerical value x using a binary search approach. The function should take two parameters: a floating-point number x (the value for which we want to find the root) and a positive integer n (the degree of the root). Handle cas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert abs(nth_root(27, 3) - 3) < 0.00001\", \"assert abs(nth_root(16, 4) - 2) < 0.00001\", \"assert abs(nth_root(1, 5) - 1) < 0.00001\", \"assert abs(nth_root(0.5, 2) - 0.70711) < 0.00001\", \"assert abs(nth_root(0.25, 2) - 0.5) < 0.00001\", \"assert abs(nth_root(... | {
"split": "train",
"index": 5325,
"acecode_id": "evol_10520",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes an array of numerical values as input and returns a new array with each value rounded to four decimal places. The function should handle both integers and floating-point numbers. If the input array is empty, the function should return an empty ar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert adjustToFourDecimalPlaces([1.23456789, 2.87654321, 3.45678901, 4.12345678]) == [1.2346, 2.8765, 3.4568, 4.1235]\", \"assert adjustToFourDecimalPlaces([0, 1, 2, 3]) == [0.0, 1.0, 2.0, 3.0]\", \"assert adjustToFourDecimalPlaces([]) == []\", \"assert adjustToFo... | {
"split": "train",
"index": 5326,
"acecode_id": "evol_5967",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a Python function that takes a list of integers and returns a new list containing only the even numbers from the original list, sorted in ascending order. Your function should handle an empty list by returning an empty list as well. Implement a funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_and_sort_evens([1, 2, 3, 4, 5, 6]) == [2, 4, 6]\", \"assert filter_and_sort_evens([10, 1, 3, 5, 2, 8]) == [2, 8, 10]\", \"assert filter_and_sort_evens([7, 5, 3, 1]) == []\", \"assert filter_and_sort_evens([]) == []\", \"assert filter_and_sort_evens([0... | {
"split": "train",
"index": 5327,
"acecode_id": "oss_14285",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `create_html_list` that generates an HTML unordered list (`<ul>`) containing each integer as a list item (`<li>`). The function should return a string representing the formatted HTML list.\nPlease reason step by step, then write a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_html_list([3, 12, 13]) == '<ul>\\\\n\\\\t<li>3</li>\\\\n\\\\t<li>12</li>\\\\n\\\\t<li>13</li>\\\\n</ul>'\", \"assert create_html_list([]) == '<ul>\\\\n</ul>'\", \"assert create_html_list([1]) == '<ul>\\\\n\\\\t<li>1</li>\\\\n</ul>'\", \"assert create_... | {
"split": "train",
"index": 5328,
"acecode_id": "evol_18143",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of routes: `standard_routes` and `custom_routes`, each representing a list of strings. Write a function `get_routes(standard_routes: List[str], custom_routes: List[str]) -> List[str]` that combines these two lists into a single list. The resulting list s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_routes(['route1', 'route2'], ['route3', 'route4']) == ['route1', 'route2', 'route3', 'route4']\", \"assert get_routes([], []) == []\", \"assert get_routes(['route1'], []) == ['route1']\", \"assert get_routes([], ['route1']) == ['route1']\", \"assert get_... | {
"split": "train",
"index": 5329,
"acecode_id": "bigcode_python_fns_9806",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a tree structure representing a music library, where each node can either be a song (leaf node) or a playlist (non-leaf node) containing other playlists or songs. Write a function `num_songs(t)` that returns the total number of songs in the given tree. A song is r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert num_songs(('Root', [('Playlist1', [('Song1', []), ('Song2', [])]), ('Playlist2', [('Song3', []), ('Playlist3', [('Song4', []), ('Song5', [])])])])) == 5\", \"assert num_songs(('Playlist1', [('Song1', []), ('Song2', []), ('Song3', [])])) == 3\", \"assert num_... | {
"split": "train",
"index": 5330,
"acecode_id": "bigcode_python_fns_47747",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of integers and returns a new list containing only the even numbers from the original list, while maintaining their original order. Your function should ignore any odd numbers and return an empty list if there are no... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 21, 32, 43, 54]) == [10, 32, 54]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([-2, -1, 0, 1, ... | {
"split": "train",
"index": 5331,
"acecode_id": "oss_5991",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the execution of a command to start a Python script in the background and redirect its output to a specific file. The function should take a string representing the script name and a string representing the output file name... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_command('Tulsi.py', 'nohup.out') == 'nohup python Tulsi.py >> nohup.out 2>&1 &'\", \"assert create_command('test_script.py', 'output.log') == 'nohup python test_script.py >> output.log 2>&1 &'\", \"assert create_command('example.py', 'log.txt') == 'no... | {
"split": "train",
"index": 5332,
"acecode_id": "oss_27521",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a function that takes a username and a password as input. Your task is to implement a function that transforms the input username by appending '_1' to it and the password by appending '_2' to it. The function should return a dictionary containing the transformed u... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_credentials('user', 'pass') == {'user': 'user_1', 'password': 'pass_2'}\", \"assert transform_credentials('admin', '1234') == {'user': 'admin_1', 'password': '1234_2'}\", \"assert transform_credentials('testUser', 'testPass') == {'user': 'testUser_... | {
"split": "train",
"index": 5333,
"acecode_id": "bigcode_python_fns_9686",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer 'value', return a list containing all integers from 0 up to, but not including, 'value'. If 'value' is less than or equal to 0, return an empty list. Implement a function named 'make_range' that takes an integer as input and outputs the desired list.\nPlease re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_range(5) == [0, 1, 2, 3, 4]\", \"assert make_range(0) == []\", \"assert make_range(-3) == []\", \"assert make_range(1) == [0]\", \"assert make_range(10) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\", \"assert make_range(7) == [0, 1, 2, 3, 4, 5, 6]\", \"assert mak... | {
"split": "train",
"index": 5334,
"acecode_id": "bigcode_python_fns_8570",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of repositories, each represented by a dictionary containing the keys 'repo' (a string URL of the repository) and 'rev' (a string representing the version of the repository). Write a function `get_repo_version(repositories: List[Dict[str, str]], repo: str) ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_repo_version([{'repo': 'https://github.com/user/repo1', 'rev': 'v1.0.0'}, {'repo': 'https://github.com/user/repo2', 'rev': 'v2.0.0'}], 'https://github.com/user/repo1') == 'v1.0.0'\", \"assert get_repo_version([{'repo': 'https://github.com/user/repo1', 'r... | {
"split": "train",
"index": 5335,
"acecode_id": "bigcode_python_fns_3892",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the sum of the squares of two given integers. Write a function `sum_of_squares(a: int, b: int) -> int` that takes two integers `a` and `b` as parameters and returns the sum of their squares. For example, if `a` is 3 an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_squares(0, 0) == 0\", \"assert sum_of_squares(1, 1) == 2\", \"assert sum_of_squares(-1, -1) == 2\", \"assert sum_of_squares(3, 4) == 25\", \"assert sum_of_squares(5, 12) == 169\", \"assert sum_of_squares(-5, 12) == 169\", \"assert sum_of_squares(10, 0... | {
"split": "train",
"index": 5336,
"acecode_id": "oss_933",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating an alarm configuration for a given network service instance. Write a function `create_alarm` that takes the following parameters: `name` (string), `ns_id` (string), `vnf_member_index` (integer), `vdu_name` (string), `metric_name` (string), `severity... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_alarm('HighCPUUsage', 'ns1', 0, 'vdu1', 'cpu_usage', 'critical', 85, '>', 'average') == {'alarm_name': 'HighCPUUsage', 'ns_id': 'ns1', 'vnf_member_index': 0, 'vdu_name': 'vdu1', 'metric_name': 'cpu_usage', 'severity': 'critical', 'threshold_value': 85... | {
"split": "train",
"index": 5337,
"acecode_id": "bigcode_python_fns_15880",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Design a function `assign_number` that takes no parameters and assigns the number `5` to a variable. The function should return the value of that variable. Validate that the function returns the correct value when called.\nPlease reason step by step, then write a self-contained... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert assign_number() == 5\", \"assert assign_number() == 5\", \"assert assign_number() == 5\", \"assert assign_number() == 5\", \"assert assign_number() == 5\", \"assert assign_number() == 5\", \"assert assign_number() == 5\", \"assert assign_number() == 5\", \"a... | {
"split": "train",
"index": 5338,
"acecode_id": "evol_30688",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that takes two integers, `start` and `end`, and returns the sum of all odd cubic roots of numbers in the range from `start` to `end` (inclusive). A cubic root is considered valid if it is an integer and the cube of that integer equals the original number... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_odd_cubic_root(1, 10) == 1\", \"assert sum_of_odd_cubic_root(15, 15) == 0\", \"assert sum_of_odd_cubic_root(8, 27) == 3\", \"assert sum_of_odd_cubic_root(200, 300) == 0\", \"assert sum_of_odd_cubic_root(27, 64) == 3\"]}"
} | {
"split": "train",
"index": 5339,
"acecode_id": "evol_30945",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Implement a function that computes the Greatest Common Divisor (GCD) of two integers a and b using an efficient algorithm. The function should adhere to the following constraints: 1 <= a, b <= 10^9. Please implement the function 'gcd' which takes two integers as input and retur... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert gcd(48, 18) == 6\", \"assert gcd(101, 103) == 1\", \"assert gcd(56, 48) == 8\", \"assert gcd(72, 27) == 9\", \"assert gcd(22, 11) == 11\", \"assert gcd(100, 25) == 25\", \"assert gcd(15, 5) == 5\", \"assert gcd(17, 19) == 1\", \"assert gcd(0, 5) == 5\", \"as... | {
"split": "train",
"index": 5340,
"acecode_id": "evol_3693",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a recursive function `print_thank_you(n)` that outputs 'Thank you' for the first 'n' even numbers. The function should handle input validation to ensure that the input is a positive integer. If the input is not valid, the function should return an empty list. If the input... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_thank_you(1) == None\", \"assert print_thank_you(2) == None\", \"assert print_thank_you(3) == None\", \"assert print_thank_you(4) == None\", \"assert print_thank_you(5) == None\", \"assert print_thank_you(10) == None\", \"assert print_thank_you(0) == [... | {
"split": "train",
"index": 5341,
"acecode_id": "evol_4530",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that returns a new list containing only the unique elements from the original list, preserving their original order. The output list should not contain any duplicates. For example, given the input list [1, 2, 2, 3, 4, 3, 5], the functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 2, 3, 4, 3, 5]) == [1, 2, 3, 4, 5]\", \"assert unique_elements([1, 1, 1, 1, 1]) == [1]\", \"assert unique_elements([]) == []\", \"assert unique_elements([5, 4, 3, 2, 1]) == [5, 4, 3, 2, 1]\", \"assert unique_elements([1, 2, 3, 2, 1]) =... | {
"split": "train",
"index": 5342,
"acecode_id": "bigcode_python_fns_34452",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function to validate URLs using a regular expression. Your function should take a URL as input and return `True` if the URL is valid according to a predefined regular expression, and `False` otherwise. The regular expression checks for the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_url('https://www.example.com') == True\", \"assert validate_url('http://example.com') == True\", \"assert validate_url('http://192.168.1.1') == True\", \"assert validate_url('https://example.com/path/to/resource') == True\", \"assert validate_url('h... | {
"split": "train",
"index": 5343,
"acecode_id": "oss_22589",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of utterance IDs and a corresponding list of labels. Each label is associated with an utterance ID in the format 'utt_id label'. Your task is to create a function that takes in these two lists and returns a dictionary that maps each unique utterance ID to a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert map_labels_to_utt_ids(['utt1', 'utt2', 'utt3'], ['utt1 1', 'utt1 2', 'utt2 3']) == {'utt1': [1, 2], 'utt2': [3]}\", \"assert map_labels_to_utt_ids(['utt1'], ['utt1 5', 'utt1 6', 'utt1 7']) == {'utt1': [5, 6, 7]}\", \"assert map_labels_to_utt_ids(['utt1'], []... | {
"split": "train",
"index": 5344,
"acecode_id": "bigcode_python_fns_13051",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes in a list of integers and returns a list of integers that are the squares of the input integers. The function should maintain the order of the input list. Implement a function called `square_numbers` that accepts a list of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert square_numbers([1, 2, 3]) == [1, 4, 9]\", \"assert square_numbers([-1, -2, -3]) == [1, 4, 9]\", \"assert square_numbers([0]) == [0]\", \"assert square_numbers([-1, 0, 1]) == [1, 0, 1]\", \"assert square_numbers([]) == []\", \"assert square_numbers([5, -5]) =... | {
"split": "train",
"index": 5345,
"acecode_id": "oss_2273",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing an API key ID. Your task is to implement a function that checks if the API key can be deleted based on certain conditions. The API key can be deleted if: 1) It does not start with 'SC_' or 'INTERCHAIN', and 2) It is not equal to a predefined ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert can_delete_api_key('SC_123456') == False\", \"assert can_delete_api_key('INTERCHAIN_abc') == False\", \"assert can_delete_api_key('ROOT_KEY_ID') == False\", \"assert can_delete_api_key('USER_KEY_1') == True\", \"assert can_delete_api_key('API_KEY_42') == Tru... | {
"split": "train",
"index": 5346,
"acecode_id": "bigcode_python_fns_5994",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `merge_sort(arr)` that takes a list of integers `arr` and returns a new list that is sorted in ascending order using the merge sort algorithm. The input list `arr` may contain duplicate values and can be of any length, including an empty list. Your implemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_sort([]) == []\", \"assert merge_sort([3]) == [3]\", \"assert merge_sort([3, 1]) == [1, 3]\", \"assert merge_sort([4, 2, 5, 1, 3]) == [1, 2, 3, 4, 5]\", \"assert merge_sort([1, 1, 1, 1]) == [1, 1, 1, 1]\", \"assert merge_sort([6, 5, 4, 3, 2, 1]) == [1,... | {
"split": "train",
"index": 5347,
"acecode_id": "evol_27967",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that performs data reconstruction based on a specific algorithm. The function should take a list of integers as input and return a new list where each integer is repeated a number of times equal to its value. For example, if the input... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reconstruct_data_vector([3, 1, 2]) == [3, 3, 3, 1, 2, 2]\", \"assert reconstruct_data_vector([0, 1, 2]) == [1, 2, 2]\", \"assert reconstruct_data_vector([1, 0, 3]) == [1, 3, 3, 3]\", \"assert reconstruct_data_vector([2, 2, 2]) == [2, 2, 2, 2, 2, 2]\", \"asse... | {
"split": "train",
"index": 5348,
"acecode_id": "oss_20750",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a month (as an integer from 1 to 12), a weekday (0 for Sunday, 1 for Monday, ..., 6 for Saturday), and an hour (as an integer from 0 to 23), write a function to determine the pricing tier for electricity usage based on Time-of-Use (TOU) pricing. The pricing tiers are defi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pricing_tier(5, 0, 12) == 'OFFPEAK'\", \"assert pricing_tier(6, 1, 11) == 'ONPEAK'\", \"assert pricing_tier(7, 2, 15) == 'ONPEAK'\", \"assert pricing_tier(8, 3, 9) == 'MIDPEAK'\", \"assert pricing_tier(9, 4, 17) == 'MIDPEAK'\", \"assert pricing_tier(10, 5, 2... | {
"split": "train",
"index": 5349,
"acecode_id": "bigcode_python_fns_27627",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that takes a string as input and returns a modified version of the string. The function should replace all occurrences of the placeholder `<EMAIL>` with a valid email address from a given list. If the input string contains multiple... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert replace_email_placeholder('Contact us at <EMAIL>.', ['user@example.com']) == 'Contact us at user@example.com.'\", \"assert replace_email_placeholder('Hello <EMAIL> and <EMAIL>.', ['alice@example.com', 'bob@example.com']) == 'Hello alice@example.com and bob@e... | {
"split": "train",
"index": 5350,
"acecode_id": "oss_5656",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `find_max_difference(arr)` that returns the maximum difference between any two elements in the list such that the larger element appears after the smaller element. If no such pair exists, return -1. The function should handle empty lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_max_difference([1, 2, 3, 4]) == 3\", \"assert find_max_difference([4, 3, 2, 1]) == -1\", \"assert find_max_difference([1, 5, 2, 10]) == 9\", \"assert find_max_difference([5, 1, 3, 6]) == 5\", \"assert find_max_difference([1, 2, 3, 3, 2]) == 2\", \"asser... | {
"split": "train",
"index": 5351,
"acecode_id": "bigcode_python_fns_37502",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of tuples, where each tuple contains a numerical value and a string. Your task is to implement a function `retrieveData(data: List[Tuple[float, str]], chkShowErrorBars: bool) -> Tuple[Optional[float], Optional[float], bool]` that retrieves specific informat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert retrieveData([(1.0, 'a'), (2.0, 'b'), (3.0, 'c')], True) == (3.0, 1.0, True)\", \"assert retrieveData([(10.5, 'x'), (20.5, 'y')], False) == (20.5, 10.5, False)\", \"assert retrieveData([(5.5, 'p')], True) == (5.5, 5.5, True)\", \"assert retrieveData([], Fals... | {
"split": "train",
"index": 5352,
"acecode_id": "oss_21884",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `html_content` that represents an HTML document. Your task is to implement a function `minify_html(html_content: str) -> str` that minifies the HTML by removing comments, extra whitespace, and reducing boolean attributes. The minified HTML should retain t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert minify_html('<!DOCTYPE html>\\\\n<html>\\\\n <head>\\\\n <title>Test</title>\\\\n </head>\\\\n <body>\\\\n <!-- Comment -->\\\\n <div class=\\\"test\\\" id=\\\"main\\\"> </div>\\\\n </body>\\\\n</html>') == '<!DOCTYPE html><html><head><title>T... | {
"split": "train",
"index": 5353,
"acecode_id": "bigcode_python_fns_12728",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the generation of a temporary directory for storing environment information related to a meta-recipe. The function should create a directory with a given name, check if it is writable and readable, and generate paths for a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_tmp_meta_recipe_env_file('test_dir') == ('test_dir', 'GGD_METARECIPE_ENVIRONMENT_VARIABLES.json', 'GGD_METARECIPE_FINAL_COMMANDS.sh')\", \"assert create_tmp_meta_recipe_env_file('example_dir') == ('example_dir', 'GGD_METARECIPE_ENVIRONMENT_VARIABLES.j... | {
"split": "train",
"index": 5354,
"acecode_id": "bigcode_python_fns_46343",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the daily stock prices of a company. Your task is to write a function to calculate the maximum profit that can be obtained by buying and selling the stock at most once. If it is not possible to make any profit, the function should r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_profit([7, 1, 5, 3, 6, 4]) == 5\", \"assert max_profit([7, 6, 4, 3, 1]) == 0\", \"assert max_profit([1, 2]) == 1\", \"assert max_profit([2, 1]) == 0\", \"assert max_profit([3, 2, 6, 5, 0, 3]) == 4\", \"assert max_profit([1, 4, 3, 2, 5]) == 4\", \"assert ... | {
"split": "train",
"index": 5355,
"acecode_id": "oss_11570",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that takes a list of integers as input and returns a new list containing only the even integers from the original list, preserving their order. Write a function `filter_even_numbers(nums: List[int]) -> List[int]` that fulfills this... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25]) == [10, 20]\", \"assert filter_even_numbers([0, 1, 2, 3, 4]) == [0, 2, 4]\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([1, 3, 5, 7])... | {
"split": "train",
"index": 5356,
"acecode_id": "oss_31105",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `is_uppercase(char: str) -> bool` that takes a single character as input and returns True if the character is an uppercase letter (A-Z), and False otherwise. The input will always be a single character string.\nPlease reason step by step, then write a self-cont... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_uppercase('A') == True\", \"assert is_uppercase('Z') == True\", \"assert is_uppercase('a') == False\", \"assert is_uppercase('z') == False\", \"assert is_uppercase('1') == False\", \"assert is_uppercase('!') == False\", \"assert is_uppercase('@') == False... | {
"split": "train",
"index": 5357,
"acecode_id": "evol_23786",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Create a function `print_list_elements(elements: List[int])` that takes a list of integers and prints each element on a new line. The function should not return any value. Implement the function using object-oriented principles, encapsulating the functionality within a class. Y... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_list_elements([1, 2, 3, 4]) is None\", \"assert print_list_elements([10, 20, 30]) is None\", \"assert print_list_elements([]) is None\", \"assert print_list_elements([5]) is None\", \"assert print_list_elements([100, 200, 300, 400, 500]) is None\", \"a... | {
"split": "train",
"index": 5358,
"acecode_id": "evol_25582",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a utility function to filter a dictionary payload. The function should remove any key-value pairs where the value is None. Implement the function `filter_payload(payload: dict) -> dict` that takes a dictionary as input and returns a new dictiona... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_payload({'username': 'john_doe', 'age': None, 'email': 'john@example.com'}) == {'username': 'john_doe', 'email': 'john@example.com'}\", \"assert filter_payload({'name': None, 'city': 'New York', 'age': 25}) == {'city': 'New York', 'age': 25}\", \"asse... | {
"split": "train",
"index": 5359,
"acecode_id": "oss_14398",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a dictionary of keyword arguments, write a function `check_fill_arg` that checks if the key 'fill' is present in the dictionary. If the key 'fill' is not present, raise an AssertionError with the message 'Need to have fill in kwargs.' If the key is present, return True. T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_fill_arg({'fill': 5}) == True\", \"assert check_fill_arg({'fill': 'test'}) == True\", \"assert check_fill_arg({'fill': None}) == True\", \"assert check_fill_arg({'other_key': 1, 'fill': 3.14}) == True\", \"assert check_fill_arg({'fill': [1, 2, 3]}) == ... | {
"split": "train",
"index": 5360,
"acecode_id": "bigcode_python_fns_29366",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function that checks whether a given string is a valid hexadecimal color code. A valid hexadecimal color code should start with a '#' followed by either six or eight hexadecimal digits (0-9, A-F, a-f). Return True if the string is a valid hexadecimal color code, oth... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert valid_hex_color('#FFFFFF') == True\", \"assert valid_hex_color('#000000') == True\", \"assert valid_hex_color('#ABCDEF') == True\", \"assert valid_hex_color('#12345678') == True\", \"assert valid_hex_color('#A1B2C3D4') == True\", \"assert valid_hex_color('#1... | {
"split": "train",
"index": 5361,
"acecode_id": "evol_7589",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries, each representing a dataset with its properties. Your task is to write a function that takes in this list and returns a new list containing only the names of the datasets where the 'is_active' property is set to True. Each dictionary has th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_active_datasets([{'name': 'dataset1', 'is_active': True}, {'name': 'dataset2', 'is_active': False}]) == ['dataset1']\", \"assert filter_active_datasets([{'name': 'dataset3', 'is_active': True}, {'name': 'dataset4', 'is_active': True}]) == ['dataset3',... | {
"split": "train",
"index": 5362,
"acecode_id": "bigcode_python_fns_17850",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that determines whether a given string is a valid palindrome or not. A palindrome is a word, phrase, number, or other sequences of characters that reads the same forward and backward, ignoring spaces, punctuation, and capitalization. Imple... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('racecar') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('Hello, World!') == False\", \"assert is_palindrome('') == True\", \"assert... | {
"split": "train",
"index": 5363,
"acecode_id": "bigcode_python_fns_10867",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the coordinates of two rectangles in a 2D plane defined by their bottom-left and top-right corners, determine whether the two rectangles intersect. Each rectangle is defined by four integers: (x1, y1) for the bottom-left corner and (x2, y2) for the top-right corner of the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert intersect(0, 1, 0, 1, 1, 2, 1, 2) == False\", \"assert intersect(0, 5, 0, 5, 5, 6, 5, 6) == False\", \"assert intersect(0, 2, 0, 2, 2, 3, 2, 3) == False\", \"assert intersect(1, 2, 1, 2, 2, 3, 2, 3) == False\", \"assert intersect(0, 1, 0, 1, 0, 1, 0, 1) == T... | {
"split": "train",
"index": 5364,
"acecode_id": "bigcode_python_fns_35495",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with evaluating candidates based on their name. Create a function `has_valid_name(candidate: dict) -> bool` that checks if a candidate's name is not empty. The input will be a dictionary representing a candidate, which contains a key 'name' (a string). Your funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert has_valid_name({'name': 'Alice'}) == True\", \"assert has_valid_name({'name': 'Bob'}) == True\", \"assert has_valid_name({'name': ''}) == False\", \"assert has_valid_name({'name': ' '}) == False\", \"assert has_valid_name({'name': 'Charlie'}) == True\", \"... | {
"split": "train",
"index": 5365,
"acecode_id": "oss_22408",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `rand5()` that generates a uniform random integer in the range `[1, 5]` using the provided function `rand3()`, which generates a uniform random integer in the range `[1, 3]`. You can only call `rand3()` and should not use any other random number generation ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert len(set(rand5() for _ in range(1))) == 1\", \"assert all(1 <= rand5() <= 5 for _ in range(10))\", \"assert len(set(rand5() for _ in range(2))) == 2\", \"assert all(1 <= rand5() <= 5 for _ in range(5))\", \"assert isinstance(rand5(), int)\", \"assert 1 <= ran... | {
"split": "train",
"index": 5366,
"acecode_id": "evol_18799",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that constructs an instance of a class `SomeClass` from a provided dictionary `msg`. The dictionary has the following structure: it contains a key 'pose_stamped' which is a list of dictionaries, each representing a `PoseStamped` objec... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert SomeClass.from_msg({'pose_stamped': [{'x': 1.0, 'y': 2.0, 'z': 3.0}], 'fk_link_names': ['link1'], 'error_code': {'code': 0, 'value': 'success'}}).pose_stamped[0].x == 1.0\", \"assert SomeClass.from_msg({'pose_stamped': [{'x': 0.0, 'y': 0.0, 'z': 0.0}], 'fk_l... | {
"split": "train",
"index": 5367,
"acecode_id": "oss_36136",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of floating-point numbers representing x-coordinates, implement a function that generates an array of the same length where each element is set to zero, representing a flat surface at y=0. The function should take a single parameter, an array of x-values, and ret... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert flat_surface([1.0, 2.0, 3.0]) == [0.0, 0.0, 0.0]\", \"assert flat_surface([-1.0, 0.0, 1.0]) == [0.0, 0.0, 0.0]\", \"assert flat_surface([0.0]) == [0.0]\", \"assert flat_surface([3.5, -3.5]) == [0.0, 0.0]\", \"assert flat_surface([100.0, 200.0, 300.0, 400.0])... | {
"split": "train",
"index": 5368,
"acecode_id": "bigcode_python_fns_14588",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Django migration for a new model called `Equipment`. The model should have three fields: `id` as an auto-incrementing primary key, `name` as a CharField with a maximum length of 100 characters, and `quantity` as a PositiveIntegerField. Write a fun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_equipment_migration() == {'initial': True, 'dependencies': [('account', '0003_confirmstring')], 'operations': [{'model': 'Equipment', 'fields': [('id', 'AutoField'), ('name', 'CharField', {'max_length': 100}), ('quantity', 'PositiveIntegerField')]}]}\... | {
"split": "train",
"index": 5369,
"acecode_id": "oss_25817",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string that may contain leading whitespace on each line. Your task is to create a function `dedent_string(text: str) -> str` that removes the common leading whitespace from each line of the string. The leading whitespace that needs to be removed is defined as th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert dedent_string(' Hello\\\\n World') == 'Hello\\\\nWorld'\", \"assert dedent_string(' Line 1\\\\n Line 2\\\\n Line 3') == 'Line 1\\\\nLine 2\\\\nLine 3'\", \"assert dedent_string('No leading spaces here.') == 'No leading spaces here.'\", \"assert ded... | {
"split": "train",
"index": 5370,
"acecode_id": "bigcode_python_fns_39289",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are given a list of clusters, where each cluster is represented as a list of dictionaries containing item details. Each dictionary has an 'award_amount' key that holds a numeric value representing the award amount for that item. Write a function `calculate_cluster_costs(clu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_cluster_costs([[{'award_amount': 10}, {'award_amount': 20}], [{'award_amount': 5}], []]) == [30, 5, 0]\", \"assert calculate_cluster_costs([[], [], []]) == [0, 0, 0]\", \"assert calculate_cluster_costs([[{'award_amount': 100}, {'award_amount': 200}... | {
"split": "train",
"index": 5371,
"acecode_id": "oss_21059",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the scores of multiple players in a game. Your task is to write a Python function `calculate_average_score(scores)` that takes in the list of scores and returns the average score of the players. If the list is empty, the function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_score([10, 20, 30]) == 20.0\", \"assert calculate_average_score([5]) == 5.0\", \"assert calculate_average_score([0, 0, 0]) == 0.0\", \"assert calculate_average_score([-10, -20, -30]) == -20.0\", \"assert calculate_average_score([100, 200, 3... | {
"split": "train",
"index": 5372,
"acecode_id": "oss_11951",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that extracts information from a package string. The function should take a string representing a package in the format `package_name-version` and return a tuple containing the package name and the version number. For example, if the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_from_pypi_package('numpy-1.21.0') == ('numpy', '1.21.0')\", \"assert extract_from_pypi_package('pandas-1.2.3') == ('pandas', '1.2.3')\", \"assert extract_from_pypi_package('requests-2.25.1') == ('requests', '2.25.1')\", \"assert extract_from_pypi_pac... | {
"split": "train",
"index": 5373,
"acecode_id": "oss_30418",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of dictionaries, where each dictionary contains key-value pairs, write a function that reformats this input into a list of dictionaries with the same key-value pairs. Each dictionary should remain unchanged in structure, and the output should be the same as the inp... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reformat_dicts([{'a': 1, 'b': 2}, {'c': 3, 'd': 4}]) == [{'a': 1, 'b': 2}, {'c': 3, 'd': 4}]\", \"assert reformat_dicts([{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]) == [{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]\", \"assert refo... | {
"split": "train",
"index": 5374,
"acecode_id": "bigcode_python_fns_12072",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `total_match(lst1, lst2)` that takes two lists of alphanumeric strings and returns the list with a total character count (ignoring white spaces and non-alphanumeric characters) that is less than or equal to the other list's count, while preserving the origi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert total_match([], []) == []\", \"assert total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) == ['hi', 'admin']\", \"assert total_match(['4'], ['1', '2', '3', '4', '5']) == ['4']\", \"assert total_match(['apple', 'banana'], ['banana', 'apple']) == ['... | {
"split": "train",
"index": 5375,
"acecode_id": "evol_16115",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a configuration dictionary `cfg`, an integer `bin_count`, and a boolean `pointing`. Your task is to implement a function `create_prep_kwargs(cfg: dict, bin_count: int, pointing: bool) -> dict` that generates a dictionary of preparation parameters based on the prov... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_prep_kwargs({'source': {'enter_frac': 0.5, 'exit_frac': 2.0, 'ATNF_DM': 20, 'ATNF_P': 0.2, 'my_DM': None, 'my_P': None}}, 300, False) == {'-o': 'prep_300_False', '-n': 300, '-start': 0.5, '-end': 2.0, '-runavg': '', '-noxwin': '', '-noclip': '', '-nsu... | {
"split": "train",
"index": 5376,
"acecode_id": "bigcode_python_fns_44275",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a feedback validation function. This function should take a dictionary that represents user feedback data with the following keys: 'name', 'email', 'password', 'confirm_password', and 'feedback'. The function should validate the data according to th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_feedback({'name': 'John Doe', 'email': 'john.doe@example.com', 'password': 'password123', 'confirm_password': 'password123', 'feedback': 'Great service!'}) == 'Feedback submitted successfully!'\", \"assert validate_feedback({'name': '', 'email': 'jo... | {
"split": "train",
"index": 5377,
"acecode_id": "oss_32953",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings, implement a function that detects and removes any duplicate entries while preserving the order of their first appearance. The function should return a new list containing only the unique strings. For example, with the input: [\"apple\", \"banana\", \"ap... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_duplicates([\\\"apple\\\", \\\"banana\\\", \\\"apple\\\", \\\"pear\\\", \\\"banana\\\"]) == [\\\"apple\\\", \\\"banana\\\", \\\"pear\\\"]\", \"assert remove_duplicates([\\\"dog\\\", \\\"cat\\\", \\\"dog\\\", \\\"fish\\\", \\\"cat\\\"]) == [\\\"dog\\\"... | {
"split": "train",
"index": 5378,
"acecode_id": "evol_35463",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that computes the cumulative sum of all integer values found within a nested data structure, which may include dictionaries, lists, and integers. The function should be able to navigate through these nested constructs and return the total sum of all inte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cumulative_sum({'a': 1, 'b': 2}) == 3\", \"assert cumulative_sum({'a': {'b': 3}, 'c': 4}) == 7\", \"assert cumulative_sum([1, 2, [3, 4]]) == 10\", \"assert cumulative_sum({'a': 1, 'b': [2, 3, {'c': 4}]}) == 10\", \"assert cumulative_sum(0) == 0\", \"assert c... | {
"split": "train",
"index": 5379,
"acecode_id": "evol_26520",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a function that simulates a simple environment where an agent can take actions represented as integers. The environment starts with a certain state, and each action performed by the agent can change the state in a defined way. Your task is to implement a function ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_environment([1, 2, 3]) == 6\", \"assert simulate_environment([-1, -2, -3]) == -6\", \"assert simulate_environment([0, 0, 0]) == 0\", \"assert simulate_environment([5, -3, 2]) == 4\", \"assert simulate_environment([-5, 5]) == 0\", \"assert simulate_e... | {
"split": "train",
"index": 5380,
"acecode_id": "bigcode_python_fns_8671",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates sending an HTTP GET request to a specified URL and returns a response status code. The function should take the following parameters: a string `url` representing the endpoint, a dictionary `headers` containing HTTP head... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_http_request('http://localhost:4242', {'Content-Type': 'application/json'}, 'GET') == 200\", \"assert simulate_http_request('http://example.com', {'Authorization': 'Bearer token'}, 'GET') == 200\", \"assert simulate_http_request('http://localhost/er... | {
"split": "train",
"index": 5381,
"acecode_id": "oss_15522",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of email messages represented as strings. Each message can either be marked as 'read' or 'unread'. Your task is to implement a function that counts the number of 'unread' messages in the list. Write a function `count_unread_messages(messages: List[str]) -> ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unread_messages(['read', 'unread', 'read', 'unread', 'unread']) == 3\", \"assert count_unread_messages(['read', 'read', 'read']) == 0\", \"assert count_unread_messages(['unread', 'unread', 'unread']) == 3\", \"assert count_unread_messages([]) == 0\", \... | {
"split": "train",
"index": 5382,
"acecode_id": "bigcode_python_fns_6896",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of equal length: `heating_load` and `radiation_rate`. The `heating_load` list represents the heating load for a floor heating system measured in MJ/h, and the `radiation_rate` list represents the radiation rate of the floor heating system. Your task is t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calc_heat_loss([10.0, 20.0, 30.0], [0.5, 0.5, 0.5]) == [5.0, 10.0, 15.0]\", \"assert calc_heat_loss([100.0, 200.0], [1.0, 0.0]) == [100.0, 0.0]\", \"assert calc_heat_loss([0.0, 0.0, 0.0], [1.0, 2.0, 3.0]) == [0.0, 0.0, 0.0]\", \"assert calc_heat_loss([5.0, 1... | {
"split": "train",
"index": 5383,
"acecode_id": "bigcode_python_fns_29498",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a non-negative integer n, implement a function `sum_recursive(n)` that returns the sum of all integers from 1 to n using a recursive approach. If n is 0, the function should return 0.\nPlease reason step by step, then write a self-contained Python solution. Give your fina... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_recursive(0) == 0\", \"assert sum_recursive(1) == 1\", \"assert sum_recursive(2) == 3\", \"assert sum_recursive(3) == 6\", \"assert sum_recursive(4) == 10\", \"assert sum_recursive(5) == 15\", \"assert sum_recursive(6) == 21\", \"assert sum_recursive(7) ... | {
"split": "train",
"index": 5384,
"acecode_id": "evol_4466",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of load balancer IPs and a port number, implement a function that randomly selects one load balancer IP from the given list and appends the specified port number to it. The function should return the full address in the format 'IP:PORT'. Write a function `get_rando... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_random_lb(['192.168.1.1', '10.0.0.1', '172.16.0.1'], 8080) in ['192.168.1.1:8080', '10.0.0.1:8080', '172.16.0.1:8080']\", \"assert get_random_lb(['192.168.1.10', '10.0.0.10'], 3000) in ['192.168.1.10:3000', '10.0.0.10:3000']\", \"assert get_random_lb(['1... | {
"split": "train",
"index": 5385,
"acecode_id": "bigcode_python_fns_33397",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a list of dictionaries representing results from a survey. Each dictionary contains 'value' and 'count' keys, representing the value of a survey response and the number of times it was selected, respectively. You... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert second_most_frequent_value([{'value': 'yes', 'count': 5}, {'value': 'no', 'count': 5}, {'value': 'maybe', 'count': 5}]) == None\", \"assert second_most_frequent_value([{'value': 'apple', 'count': 10}, {'value': 'banana', 'count': 7}, {'value': 'orange', 'cou... | {
"split": "train",
"index": 5386,
"acecode_id": "oss_10523",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks if a given string is a valid email address. A valid email address must satisfy the following criteria: it must contain exactly one '@' symbol, there must be at least one character before the '@', and there must be at least one... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_email('test@example.com') == True\", \"assert is_valid_email('user.name@domain.co') == True\", \"assert is_valid_email('user@sub.domain.com') == True\", \"assert is_valid_email('user@domain') == False\", \"assert is_valid_email('@domain.com') == Fal... | {
"split": "train",
"index": 5387,
"acecode_id": "oss_15090",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a stage retrieval process from a hypothetical API. Write a function `get_stages` that takes a variable number of keyword arguments representing filter criteria (such as `status`, `priority`, `type`, etc.) and returns a list... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_stages(type='development') == ['stage1']\", \"assert get_stages(status='inactive') == []\", \"assert get_stages(priority='low') == []\", \"assert get_stages(type='testing') == []\", \"assert get_stages(type='development', status='inactive') == ['stage1']... | {
"split": "train",
"index": 5388,
"acecode_id": "bigcode_python_fns_45321",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that manipulates a given string based on a set of rules. The function should take a string as input and perform the following operations: 1. Convert all characters to uppercase. 2. Replace all occurrences of the letter 'A' with '4'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manipulate_string('VariAble') == 'V4R14BL3'\", \"assert manipulate_string('Hello, World!') == 'H3LL0, W0RLD!'\", \"assert manipulate_string('Python Programming!') == 'PYTH0N PR0GR4MM1NG!'\", \"assert manipulate_string('OpenAI is great!') == '0P3N41 1S GR34T!... | {
"split": "train",
"index": 5389,
"acecode_id": "oss_8219",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Define an abstract base class in Python with the name 'Animal'. This class should have instance attributes such as 'age' and 'name', and must contain an abstract method called 'communicate'. Create three different classes, 'Cat', 'Dog', and 'Bird' derived from the 'Animal' clas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Cat('Mittens', 3).communicate() == 'Mittens is meowing.'\", \"assert Dog('Rusty', 4).communicate() == 'Rusty is barking.'\", \"assert Bird('Chirpy', 2).communicate() == 'Chirpy is chirping.'\", \"assert Cat('Whiskers', 1).feed() == 'Whiskers is eating.'\", \... | {
"split": "train",
"index": 5390,
"acecode_id": "evol_20939",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given three points on a Cartesian plane, determine if they can form a right triangle with one vertex at the origin (0,0). If they do form a right triangle, calculate the length of the hypotenuse and the area of the triangle. If they do not form a right triangle, return an appro... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_hypotenuse_and_area([(0, 0), (3, 0), (0, 4)]) == (5.0, 6.0)\", \"assert calculate_hypotenuse_and_area([(0, 0), (2, 2), (2, 0)]) == (2.8284271247461903, 2.0)\", \"assert calculate_hypotenuse_and_area([(0, 0), (1, 1), (1, 0)]) == (1.4142135623730951,... | {
"split": "train",
"index": 5391,
"acecode_id": "evol_23902",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given an angle in degrees, implement a function `rotation_matrix(theta: float) -> List[List[float]]` that computes the corresponding 3x3 rotation matrix for a counterclockwise rotation about the x-axis. The rotation matrix is defined as follows: \n\nRx = [[1, 0, 0],\n ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rotation_matrix(0) == [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]\", \"assert rotation_matrix(90) == [[1.0, 0.0, 0.0], [0.0, 0.0, -1.0], [0.0, 1.0, 0.0]]\", \"assert rotation_matrix(180) == [[1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]]\", \"a... | {
"split": "train",
"index": 5392,
"acecode_id": "bigcode_python_fns_49319",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that generates a URL for a specific Slack channel based on the provided channel name. Write a function `generate_slack_channel_url` that takes a `channel_name` as input and returns the URL for the corresponding Slack channel. For t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_slack_channel_url('general') == 'https://slack.example.com/channels/general'\", \"assert generate_slack_channel_url('random') == 'https://slack.example.com/channels/random'\", \"assert generate_slack_channel_url('development') == 'https://slack.exam... | {
"split": "train",
"index": 5393,
"acecode_id": "oss_24561",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the sum of the digits of a non-negative integer. Additionally, the function should be able to handle a second optional argument. If this argument is provided, the function should return the sum of the digits raised to the power of the second arg... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_digits(123) == 6\", \"assert sum_of_digits(0) == 0\", \"assert sum_of_digits(999) == 27\", \"assert sum_of_digits(456) == 15\", \"assert sum_of_digits(1001) == 2\", \"assert sum_of_digits(10) == 1\", \"assert sum_of_digits(9876543210) == 45\", \"asser... | {
"split": "train",
"index": 5394,
"acecode_id": "evol_4579",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to find the router with the slowest delivery speed in a network. The network consists of routers, and each router has a unique ID and a specific delivery speed. You are given a list of tuples, where each tuple contains the router's ID... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_slowest_router([('A', 10), ('B', 15), ('C', 8), ('D', 12)]) == 'C'\", \"assert find_slowest_router([('A', 20), ('B', 25), ('C', 30)]) == 'A'\", \"assert find_slowest_router([('Router1', 5), ('Router2', 5), ('Router3', 10)]) == 'Router1'\", \"assert find... | {
"split": "train",
"index": 5395,
"acecode_id": "oss_27934",
"num_tests": 16
} |
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 that calculates the average score of the class and the percentage of students who scored above the average. The function should return both values as a tuple. I... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_and_percentage([70, 80, 90]) == (80.0, 33.33333333333333)\", \"assert calculate_average_and_percentage([100, 90, 80, 70, 60]) == (80.0, 40.0)\", \"assert calculate_average_and_percentage([50, 50, 50]) == (50.0, 0.0)\", \"assert calculate_av... | {
"split": "train",
"index": 5396,
"acecode_id": "bigcode_python_fns_37704",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of buildings in a row. Your task is to determine how many buildings can be seen from the left side. A building can be seen if it is taller than all the buildings to its left. Implement a function `count_visible_buildings... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_visible_buildings([3, 1, 4, 2, 5]) == 3\", \"assert count_visible_buildings([1, 2, 3, 4, 5]) == 5\", \"assert count_visible_buildings([5, 4, 3, 2, 1]) == 1\", \"assert count_visible_buildings([2, 2, 2, 2, 2]) == 1\", \"assert count_visible_buildings([1... | {
"split": "train",
"index": 5397,
"acecode_id": "bigcode_python_fns_27384",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages versioning information for a software project based on semantic versioning rules. Your task is to implement a function called `compare_versions` that takes in two version numbers as strings in the format 'major.minor.patch' a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_versions('1.2.3', '1.2.3') == 'equal'\", \"assert compare_versions('2.0.0', '1.9.9') == 'greater'\", \"assert compare_versions('1.0.0', '1.0.1') == 'less'\", \"assert compare_versions('1.1.1', '1.1.0') == 'greater'\", \"assert compare_versions('1.1.0... | {
"split": "train",
"index": 5398,
"acecode_id": "oss_7823",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that rearranges a given full name from the format 'last_name, first_name' to 'first_name last_name'. If the input format is incorrect, the function should return 'Invalid format'. Implement a function called `rearrange_name(full_na... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rearrange_name('Lovelace, Ada') == 'Ada Lovelace'\", \"assert rearrange_name('Doe, John') == 'John Doe'\", \"assert rearrange_name('Smith, Jane') == 'Jane Smith'\", \"assert rearrange_name('Brown, Charlie') == 'Charlie Brown'\", \"assert rearrange_name('Gate... | {
"split": "train",
"index": 5399,
"acecode_id": "oss_29305",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.