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 list of database entries represented as strings. Write a function `delete_entries(entries: List[str], entry_to_delete: str) -> List[str]` that removes all occurrences of a specified entry from the list of entries. The function should return a new list with the r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert delete_entries(['entry1', 'entry2', 'entry1', 'entry3'], 'entry1') == ['entry2', 'entry3']\", \"assert delete_entries(['entry1', 'entry2', 'entry1', 'entry3'], 'entry2') == ['entry1', 'entry1', 'entry3']\", \"assert delete_entries(['entry1', 'entry2', 'entry...
{ "split": "train", "index": 67900, "acecode_id": "bigcode_python_fns_1986", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array 'arr' consisting of integers and a 'subset' of these integers, determine the smallest number of transformations required to convert 'arr' into a palindromic array, allowing for a maximum of 'limit' distinct element changes, using only elements from the 'subset'. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert smallest_variation_in_subgroup([1, 2, 3, 4, 3, 2, 2], 2, [1, 2]) == 1\", \"assert smallest_variation_in_subgroup([1, 2, 3, 2, 1], 1, [1, 2, 3]) == 0\", \"assert smallest_variation_in_subgroup([5, 6, 7, 6, 5], 2, [5, 6]) == 0\", \"assert smallest_variation_in...
{ "split": "train", "index": 67901, "acecode_id": "evol_33668", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function `create_proxies` that generates a list of Proxy objects based on provided proxy data. Each Proxy object should be initialized with an IP address, a port number, a username, and a password. The function takes a list of dictionaries, where ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_proxies([{'ip': '192.168.1.1', 'port': 8080, 'username': 'user1', 'password': 'pass1'}], True) == [Proxy('192.168.1.1', 8080, 'user1', 'pass1')]\", \"assert create_proxies([{'ip': '192.168.1.1', 'port': 8080, 'username': 'user1', 'password': 'pass1'},...
{ "split": "train", "index": 67902, "acecode_id": "oss_24943", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `char_frequency(s: str) -> Dict[str, int]` that takes an arbitrary string `s` as an argument and returns a dictionary containing the frequency count of every unique character in the string. The keys of the dictionary should be the characters, and the values sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert char_frequency('hello') == {'h': 1, 'e': 1, 'l': 2, 'o': 1}\", \"assert char_frequency('aabbcc') == {'a': 2, 'b': 2, 'c': 2}\", \"assert char_frequency('') == {}\", \"assert char_frequency('abc') == {'a': 1, 'b': 1, 'c': 1}\", \"assert char_frequency('aaa') ...
{ "split": "train", "index": 67903, "acecode_id": "evol_30835", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of keys, each represented as a string. Write a function `get_unique_keys(keys: List[str]) -> List[str]` that returns a list of unique keys from the input list while preserving their original order. The input list may contain duplicate keys. The output list ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_unique_keys(['a', 'b', 'a', 'c', 'b', 'd']) == ['a', 'b', 'c', 'd']\", \"assert get_unique_keys(['x', 'y', 'x', 'x', 'z', 'y', 'z']) == ['x', 'y', 'z']\", \"assert get_unique_keys(['apple', 'banana', 'apple', 'orange']) == ['apple', 'banana', 'orange']\"...
{ "split": "train", "index": 67904, "acecode_id": "bigcode_python_fns_34126", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of students and their corresponding scores in a particular subject. Your task is to find the student with the second-highest score. If there is no student with the second-highest score, your program should output -1. Write a function that takes in the numbe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_second_highest_score(3, 3, [('X', 50), ('Y', 50), ('Z', 50)]) == -1\", \"assert find_second_highest_score(2, 1, [('A', 100), ('B', 100)]) == -1\", \"assert find_second_highest_score(4, 2, [('Tom', 60), ('Jerry', 80), ('Spike', 60), ('Tyke', 70)]) == 'Ty...
{ "split": "train", "index": 67905, "acecode_id": "oss_3188", "num_tests": 14 }
acecode
[ { "role": "user", "content": "Given a non-negative integer n, write a function that removes all even digits from n and returns the remaining odd digits sorted in descending order. If there are no odd digits left, the function should return 0. For example, given n = 753, the function should return 75.\nPleas...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert eliminate_even_sort_desc(2468) == 0\", \"assert eliminate_even_sort_desc(13579) == 97531\", \"assert eliminate_even_sort_desc(0) == 0\", \"assert eliminate_even_sort_desc(8) == 0\", \"assert eliminate_even_sort_desc(1) == 1\", \"assert eliminate_even_sort_de...
{ "split": "train", "index": 67906, "acecode_id": "evol_10850", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that simulates the creation of a simple blockchain structure. The blockchain consists of blocks, each identified by a unique configuration string. Write a function `create_blockchain` that takes a list of configuration strings and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_blockchain(['conf1', 'conf2', 'conf3']) == [{'conf': 'conf1'}, {'conf': 'conf2'}, {'conf': 'conf3'}]\", \"assert create_blockchain(['single_conf']) == [{'conf': 'single_conf'}]\", \"assert create_blockchain([]) == []\", \"assert create_blockchain(['co...
{ "split": "train", "index": 67907, "acecode_id": "oss_22075", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function called `sum_numerical_elements` that takes a two-dimensional array as input and returns the cumulative total of all numerical elements (both integers and floats) within the array. The function should ignore any non-numerical elements, including strings, lis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_numerical_elements([[1, 2, [3, 'non-numeric', 4]], ['ignore-me', 5]]) == 15\", \"assert sum_numerical_elements([[1, 'a', [2.5, None]], [3, 4.5]]) == 11.0\", \"assert sum_numerical_elements([[None, 'string', [2, 3]], [4, 5]]) == 14\", \"assert sum_numeric...
{ "split": "train", "index": 67908, "acecode_id": "evol_5964", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple online quiz. The function should take no parameters. It will display a series of three multiple-choice questions, each with four options (A, B, C, D), and ask the user for their input on each question. After the us...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quiz_function(['B', 'B', 'B']) == 3\", \"assert quiz_function(['A', 'B', 'B']) == 2\", \"assert quiz_function(['B', 'A', 'B']) == 2\", \"assert quiz_function(['C', 'B', 'B']) == 2\", \"assert quiz_function(['B', 'B', 'A']) == 2\", \"assert quiz_function(['D'...
{ "split": "train", "index": 67909, "acecode_id": "oss_12405", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that accepts two strings, `str_1` and `str_2`, and returns a boolean indicating whether `str_1` is a substring of `str_2` at least once. `str_1` and `str_2` are non-empty strings.\nPlease reason step by step, then write a self-contained Python solution. Giv...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert substring_n('hello', 'hello world', 1) == True\", \"assert substring_n('world', 'hello world', 1) == True\", \"assert substring_n('hello', 'hello hello', 1) == True\", \"assert substring_n('bye', 'hello world', 1) == False\", \"assert substring_n('test', 'th...
{ "split": "train", "index": 67910, "acecode_id": "evol_16830", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of integers, return a tuple with three values: the product of the signs of each distinct non-zero integer (represented as 1 for positive and -1 for negative), the sum of the absolute values of each distinct non-zero integer, and the total count of distinct non-ze...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert prod_signs([1, 2, 2, -4]) == (-1, 7, 3)\", \"assert prod_signs([]) == None\", \"assert prod_signs([5, 5, -5, 0]) == (-1, 10, 2)\", \"assert prod_signs([3, -3, 0, 3]) == (-1, 6, 2)\", \"assert prod_signs([1, -1]) == (-1, 2, 2)\", \"assert prod_signs([7]) == (...
{ "split": "train", "index": 67911, "acecode_id": "evol_18967", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple text entry system. The function should accept a list of strings representing the current state of entries, and a string representing a user action. If the user action is 'click', it should return a new list where t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_entries([''], 'click') == ['']\", \"assert update_entries(['entry1', 'entry2'], 'click') == ['', 'entry2']\", \"assert update_entries(['entry1', 'entry2'], 'reset') == ['entry1', 'entry2']\", \"assert update_entries(['first', 'second', 'third'], 'clic...
{ "split": "train", "index": 67912, "acecode_id": "bigcode_python_fns_1179", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Implement a function `find_largest_even_divisor(x: int, y: int, z: int) -> int` that accepts three positive integers x, y, and z. Your task is to find the largest even number within the inclusive range of [x, y] that is divisible by z. If no such number exists, return -1. For e...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_largest_even_divisor(12, 15, 2) == 14\", \"assert find_largest_even_divisor(13, 12, 3) == -1\", \"assert find_largest_even_divisor(10, 20, 4) == 20\", \"assert find_largest_even_divisor(8, 8, 2) == 8\", \"assert find_largest_even_divisor(2, 10, 1) == 10...
{ "split": "train", "index": 67913, "acecode_id": "evol_32466", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a simple communication protocol. The protocol involves a function that resets a specific attribute, `response_attach_head`, to a predefined value. Your task is to implement a function `reset_response_head` that takes no parameters and resets the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert reset_response_head() == 0\", \"assert reset_response_head() == 0\", \"assert reset_response_head() == 0\", \"assert reset_response_head() == 0\", \"assert reset_response_head() == 0\", \"assert reset_response_head() == 0\", \"assert reset_response_head() ==...
{ "split": "train", "index": 67914, "acecode_id": "oss_14412", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `add(a: int) -> Callable[[int], int]` that takes an integer `a` and returns a new function. This returned function should accept another integer `b` and return the sum of `a` and `b`. For example, if `add(3)` is called, it should return a function that, whe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add(3)(4) == 7\", \"assert add(0)(5) == 5\", \"assert add(-1)(1) == 0\", \"assert add(10)(10) == 20\", \"assert add(-5)(-5) == -10\", \"assert add(100)(200) == 300\", \"assert add(50)(-50) == 0\", \"assert add(1)(1) == 2\", \"assert add(1000)(5000) == 6000\"...
{ "split": "train", "index": 67915, "acecode_id": "evol_27908", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `round_to_nearest_multiple_of_5(n: int) -> int` that rounds the given integer `n` to the nearest multiple of 5. If the number is exactly halfway between two multiples of 5, round up to the nearest multiple of 5. For example, 12 should round to 10, while 13 ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert round_to_nearest_multiple_of_5(25) == 25\", \"assert round_to_nearest_multiple_of_5(12) == 10\", \"assert round_to_nearest_multiple_of_5(13) == 15\", \"assert round_to_nearest_multiple_of_5(7) == 5\", \"assert round_to_nearest_multiple_of_5(3) == 5\", \"asse...
{ "split": "train", "index": 67916, "acecode_id": "evol_5516", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a time in 24-hour format (HH:MM), write a function that takes this time and returns the equivalent time in 12-hour format (with AM/PM). The input string will be in the format 'HH:MM', where HH is between '00' and '23', and MM is between '00' and '59'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_time_to_12_hour_format('00:00') == '12:00 AM'\", \"assert convert_time_to_12_hour_format('01:00') == '01:00 AM'\", \"assert convert_time_to_12_hour_format('12:00') == '12:00 PM'\", \"assert convert_time_to_12_hour_format('13:00') == '01:00 PM'\", \"a...
{ "split": "train", "index": 67917, "acecode_id": "bigcode_python_fns_45637", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function called `list_print` that takes a list of items and a boolean flag `do_print`. If `do_print` is set to `True`, the function should return a string representation of the items in the list, joining them with commas. If `do_print` is set ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert list_print(['apple', 'banana', 'cherry'], True) == 'apple, banana, cherry'\", \"assert list_print(['apple', 'banana', 'cherry'], False) == 'Printing disabled.'\", \"assert list_print([], True) == ''\", \"assert list_print([], False) == 'Printing disabled.'\"...
{ "split": "train", "index": 67918, "acecode_id": "oss_15996", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `convert_timezone(time_string: str, from_zone: str, to_zone: str) -> str` that converts a given time from one timezone to another. The input `time_string` is in the format 'YYYY-MM-DD HH:MM:SS'. The `from_zone` and `to_zone` are strings representing the source ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_timezone('2022-12-01 15:00:00', 'Asia/Tokyo', 'Europe/London') == '2022-12-01 06:00:00'\", \"assert convert_timezone('2022-06-30 09:30:00', 'Australia/Sydney', 'America/New_York') == '2022-06-29 19:30:00'\", \"assert convert_timezone('2023-01-01 12:0...
{ "split": "train", "index": 67919, "acecode_id": "evol_2979", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries where each dictionary contains two keys: 'success' (a boolean) and 'PSP' (a string). Your task is to implement a function `calculate_fees(data)` that takes this list as input and returns a new list of dictionaries with an additional key 'fee...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_fees([{'success': True, 'PSP': 'PSP1'}]) == [{'success': True, 'PSP': 'PSP1', 'fees': 1.4}]\", \"assert calculate_fees([{'success': True, 'PSP': 'PSP2'}]) == [{'success': True, 'PSP': 'PSP2', 'fees': 1.5}]\", \"assert calculate_fees([{'success': Tr...
{ "split": "train", "index": 67920, "acecode_id": "evol_14628", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function in Python that takes in a list of positive integers and categorizes them into three distinct lists: one for prime numbers, one for composite numbers, and one for special-case numbers (0 and 1). The function should ensure that duplicates are removed and that all...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_numbers([2, 3, 4, 5, 6, 7, 8, 9]) == ([2, 3, 5, 7], [4, 6, 8, 9], [])\", \"assert categorize_numbers([1, 1, 1, 1, 1]) == ([], [], [1])\", \"assert categorize_numbers([0, 1, 2]) == ([2], [], [0, 1])\", \"assert categorize_numbers([10, 11, 12, 13, 1...
{ "split": "train", "index": 67921, "acecode_id": "evol_2985", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `hash_table_operations(operations: List[Tuple[str, Union[int, Tuple[int, int]]]]) -> List[Union[None, int]]` that simulates a simple hash table with basic operations. The function will take a list of operations where each operation is a tuple. The first ele...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert hash_table_operations([('insert', 1, 100), ('retrieve', 1)]) == [100]\", \"assert hash_table_operations([('insert', 2, 200), ('retrieve', 2)]) == [200]\", \"assert hash_table_operations([('insert', 3, 300), ('retrieve', 3)]) == [300]\", \"assert hash_table_o...
{ "split": "train", "index": 67922, "acecode_id": "evol_21992", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a dictionary representing a query with various parameters, and a configuration dictionary with default values. Your task is to create a function that processes the input query dictionary by merging it with the default values from the configuration. Specifically, y...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_query({'from': 'table1', 'limit': 10}, {'default_limit': 5, 'global_exclude': ['id', 'name']}) == {'from': 'table1', 'limit': 10, 'exclude': ['id', 'name']}\", \"assert process_query({'from': 'table1', 'exclude': 'field1', 'include': 'field2'}, {'def...
{ "split": "train", "index": 67923, "acecode_id": "bigcode_python_fns_12615", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are given a list of points representing the vertices of a polygon in a 2D plane. Your task is to rotate this polygon counterclockwise about the origin (0, 0) by a given angle in degrees. Implement a function `rotate_polygon(polygon_pts: List[Tuple[int, int]], angle: float) ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert rotate_polygon([(0, 0), (4, 0), (4, 4)], 0) == [(0.0, 0.0), (4.0, 0.0), (4.0, 4.0)]\", \"assert rotate_polygon([(1, 0)], 30) == [(0.8660254037844387, 0.49999999999999994)]\", \"assert rotate_polygon([(1, 0), (0, 1)], 45) == [(0.7071067811865476, 0.7071067811...
{ "split": "train", "index": 67924, "acecode_id": "bigcode_python_fns_46657", "num_tests": 5 }
acecode
[ { "role": "user", "content": "Given a dictionary object that may contain nested dictionaries, write a Python function that extracts all unique values from the dictionary. The function should be able to handle both contiguous and non-contiguous data. The output should be a flat list containing all unique val...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_values({'a': 1, 'b': 2, 'c': 3}) == [1, 2, 3]\", \"assert extract_values({'x': {'y': {'z': 10}}}) == [10]\", \"assert extract_values({'key1': 'value1', 'key2': {'key3': 'value3', 'key4': 'value4'}}) == ['value1', 'value3', 'value4']\", \"assert extra...
{ "split": "train", "index": 67925, "acecode_id": "evol_14196", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given an integer `n`, implement a function `tier(n)` that maps integers to a 2-tuple of integers based on the following rules: If `n` is positive, return the tuple `(n // 2, n % 2)`. If `n` is zero, return the tuple `(0, 0)`. If `n` is negative, return the tuple `(n, 1)`. Your ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert tier(4) == (2, 0)\", \"assert tier(5) == (2, 1)\", \"assert tier(0) == (0, 0)\", \"assert tier(-1) == (-1, 1)\", \"assert tier(-10) == (-10, 1)\", \"assert tier(10) == (5, 0)\", \"assert tier(11) == (5, 1)\", \"assert tier(1) == (0, 1)\", \"assert tier(-5) =...
{ "split": "train", "index": 67926, "acecode_id": "bigcode_python_fns_5410", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a positive integer n, write a function `is_prime_sequence(n: int) -> bool` that determines whether the numbers n^2 + 1, n^2 + 3, n^2 + 7, n^2 + 9, n^2 + 13, and n^2 + 27 are all prime numbers. Return True if they are all prime, otherwise return False.\nPlease reason step ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_prime_sequence(10) == True\", \"assert is_prime_sequence(11) == False\", \"assert is_prime_sequence(12) == False\", \"assert is_prime_sequence(13) == False\", \"assert is_prime_sequence(14) == False\", \"assert is_prime_sequence(15) == False\", \"assert i...
{ "split": "train", "index": 67927, "acecode_id": "evol_30225", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that retrieves comments from a predefined list based on a specified criteria. The function, `filter_comments`, should take in two parameters: a list of comments (where each comment is represented as a dictionary containing 'id', 'text...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_comments([{'id': 1, 'text': 'Hello world', 'author': 'Alice'}, {'id': 2, 'text': 'Python is great', 'author': 'Bob'}, {'id': 3, 'text': 'I love coding', 'author': 'Alice'}], 'Alice') == [{'id': 1, 'text': 'Hello world', 'author': 'Alice'}, {'id': 3, '...
{ "split": "train", "index": 67928, "acecode_id": "oss_25075", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of 2D points represented as tuples, write a function that calculates the maximum area of a convex polygon that can be formed using these points. The input is a list of `n` points, where each point is represented as a tuple of two integers (x, y). The function shoul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert max_convex_polygon_area([(0, 0), (2, 0), (1, 1)]) == 1.0\", \"assert max_convex_polygon_area([(0, 0), (10, 0), (5, 5), (0, 10)]) == 50.0\", \"assert max_convex_polygon_area([(1, 1), (3, 3), (3, 1), (1, 3)]) == 4.0\", \"assert max_convex_polygon_area([(0, 0),...
{ "split": "train", "index": 67929, "acecode_id": "bigcode_python_fns_32308", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that computes the modulus of two given integers. The function should take two parameters, `num1` and `num2`, and return the result of `num1 % num2`. It is guaranteed that `num2` will not be zero.\nPlease reason step by step, then write a self-contained Pyth...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_modulus(10, 3) == 1\", \"assert calculate_modulus(10, 5) == 0\", \"assert calculate_modulus(20, 7) == 6\", \"assert calculate_modulus(15, 4) == 3\", \"assert calculate_modulus(0, 1) == 0\", \"assert calculate_modulus(5, 8) == 5\", \"assert calculat...
{ "split": "train", "index": 67930, "acecode_id": "evol_26488", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D grid of size `rows` x `cols`, where each cell contains a non-negative integer value, write a function `maxSumPath(grid)` that finds the maximum sum of a path from the top-left cell to the bottom-right cell. You can only move either right or down at each step. The inp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxSumPath([[0]]) == 0\", \"assert maxSumPath([[5]]) == 5\", \"assert maxSumPath([[1, 2], [1, 1], [1, 1]]) == 5\", \"assert maxSumPath([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 3\", \"assert maxSumPath([[10, 1], [1, 1], [1, 1], [1, 0]]) == 13\", \"assert maxSumP...
{ "split": "train", "index": 67931, "acecode_id": "oss_1080", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a string representing a client ID in the format 'XXXX-YYYY', where 'XXXX' is a prefix, write a function that extracts the prefix from the client ID and forms a URL string to access a hypothetical web API service. The URL should be constructed as 'https://c{prefix}.web.cdd...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_api_url('1234-5678') == 'https://c1234.web.cddbp.net/webapi/xml/1.0/'\", \"assert generate_api_url('abcd-efgh') == 'https://cabcd.web.cddbp.net/webapi/xml/1.0/'\", \"assert generate_api_url('client-1234') == 'https://cclient.web.cddbp.net/webapi/xml...
{ "split": "train", "index": 67932, "acecode_id": "bigcode_python_fns_10196", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function `snake_to_camel(snake_str: str) -> str` that takes a string in snake_case format and converts it to CamelCase format. The function should capitalize the first letter of each word and remove the underscores. For example, the input 'example_string' should return ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert snake_to_camel('example_string') == 'ExampleString'\", \"assert snake_to_camel('hello_world') == 'HelloWorld'\", \"assert snake_to_camel('this_is_a_test') == 'ThisIsATest'\", \"assert snake_to_camel('convert_to_camel_case') == 'ConvertToCamelCase'\", \"asser...
{ "split": "train", "index": 67933, "acecode_id": "evol_133", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `quick_sort(arr)` that takes a list of integers and returns a new list containing the same integers sorted in ascending order using the Quick Sort algorithm. Your implementation should handle empty lists and lists with duplicate integers correctly.\nPlease ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert quick_sort([]) == []\", \"assert quick_sort([3]) == [3]\", \"assert quick_sort([3, 2]) == [2, 3]\", \"assert quick_sort([2, 3]) == [2, 3]\", \"assert quick_sort([3, 1, 2]) == [1, 2, 3]\", \"assert quick_sort([4, 4, 4]) == [4, 4, 4]\", \"assert quick_sort([1,...
{ "split": "train", "index": 67934, "acecode_id": "evol_22710", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a data structure called ChunkTree that allows you to add chunks and find all chunks that overlap with a given time interval. Each chunk is defined by a start time and a completion time. Two chunks are considered to overlap if their time interval...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_chunk_and_find_overlaps([(1, 5), (6, 10)], (0, 1)) == []\", \"assert add_chunk_and_find_overlaps([(1, 3), (4, 6)], (2, 5)) == [(1, 3), (4, 6)]\", \"assert add_chunk_and_find_overlaps([(1, 2), (2, 3), (3, 4)], (1.5, 2.5)) == [(1, 2), (2, 3)]\", \"assert a...
{ "split": "train", "index": 67935, "acecode_id": "oss_22029", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Design a Python function that accepts a list of strings and checks if all the strings in the list have the same length. If the strings are of the same length, return True; otherwise, return False. For example, given the input ['abc', 'def', 'ghi'], the function should return Tr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert verify_same_length(['abc', 'def', 'ghi']) == True\", \"assert verify_same_length(['Hello', 'World']) == True\", \"assert verify_same_length(['a', 'b', 'c']) == True\", \"assert verify_same_length(['one', 'two', 'three']) == False\", \"assert verify_same_leng...
{ "split": "train", "index": 67936, "acecode_id": "evol_14800", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a function that finds all the perfect squares within a given range from `start` to `end`. The function should return a list of these perfect squares. Additionally, each perfect square should be accompanied by a boolean indicating whether the square root of the perfect squ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_perfect_squares_with_primes(0, 0) == [(0, False)]\", \"assert find_perfect_squares_with_primes(1, 1) == [(1, False)]\", \"assert find_perfect_squares_with_primes(70, 100) == [(81, False), (100, False)]\", \"assert find_perfect_squares_with_primes(5, 5) ...
{ "split": "train", "index": 67937, "acecode_id": "evol_6075", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simplified model of a representative democracy with a party system. In this model, the government operates on a monthly basis, implementing income tax and universal basic income (UBI). You need to implement a function that calculates the income ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert simulate_government(5000, 0.1, 2000, 10) == (500.0, 200.0)\", \"assert simulate_government(3000, 0.2, 6000, 15) == (600.0, 400.0)\", \"assert simulate_government(1000, 0.15, 1500, 5) == (150.0, 300.0)\", \"assert simulate_government(2500, 0.05, 1000, 8) == (...
{ "split": "train", "index": 67938, "acecode_id": "oss_30976", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `shannon_entropy(string: str) -> float` that calculates the Shannon entropy of the given string. The Shannon entropy is a measure of the unpredictability or information content. It can be calculated using the formula: H(X) = -Σ(p(x) * log2(p(x))) for each u...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert shannon_entropy('hello') == 1.9219280948873623\", \"assert shannon_entropy('aaaa') == 0.0\", \"assert shannon_entropy('abc') == 1.584962500721156\", \"assert shannon_entropy('') == 0.0\", \"assert shannon_entropy('abcde') == 2.321928094887362\", \"assert sha...
{ "split": "train", "index": 67939, "acecode_id": "evol_16030", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function that takes two timestamps as strings in the format 'yyyy-mm-dd hh:mm:ss' and calculates the total minutes and total seconds between these two timestamps. If the second timestamp is older than the first one, the function should return a suitable error message. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_duration('2020-01-01 12:00:00', '2020-01-01 15:30:30') == ('Minutes : 210.5', 'Seconds : 12630')\", \"assert calculate_duration('2021-06-01 08:00:00', '2021-06-01 09:30:00') == ('Minutes : 90.0', 'Seconds : 5400')\", \"assert calculate_duration('20...
{ "split": "train", "index": 67940, "acecode_id": "evol_20466", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the process of displaying a graphical window for an application. The function should accept two parameters: `is_debug` (a boolean indicating whether to run the application in debug mode) and `parent` (a string represent...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert display_window(True, 'Main Frame') == 'Debug mode enabled. Window displayed with parent: Main Frame'\", \"assert display_window(False, 'Main Frame') == 'Window displayed with parent: Main Frame'\", \"assert display_window(False, '') == 'No window displayed'\...
{ "split": "train", "index": 67941, "acecode_id": "bigcode_python_fns_30785", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `download_file_status(workflow_id: str, file_name: str, access_token: str) -> int` that simulates the download file status from a workflow. The function should return the HTTP status code based on the following rules: \n\n1. If the `a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert download_file_status('1', 'test_download', '') == 401\", \"assert download_file_status('1', 'test_download', 'wrongtoken') == 403\", \"assert download_file_status('1', 'test_download', 'valid_token') == 200\", \"assert download_file_status('2', 'another_file...
{ "split": "train", "index": 67942, "acecode_id": "bigcode_python_fns_34012", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of lists, where each inner list represents a sequence of integers. Your task is to create a function `compress_sequences(sequences: List[List[int]]) -> List[int]` that compresses each inner list by replacing consecutive duplicate integers with a single inst...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compress_sequences([[1, 1, 1], [2, 2, 2, 2, 2]]) == [1, 3, 2, 5]\", \"assert compress_sequences([[5, 5, 5, 5], [3, 3, 1]]) == [5, 4, 3, 2, 1, 1]\", \"assert compress_sequences([[0, 0, 0, 0, 0]]) == [0, 5]\", \"assert compress_sequences([[9, 9, 9, 8, 8, 7, 7,...
{ "split": "train", "index": 67943, "acecode_id": "bigcode_python_fns_12371", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `fibonacci(n: int) -> int` that returns the nth Fibonacci number using a recursive method with memoization. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n >= 2. Your function should handle inputs for n whe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci(0) == 0\", \"assert fibonacci(1) == 1\", \"assert fibonacci(2) == 1\", \"assert fibonacci(3) == 2\", \"assert fibonacci(4) == 3\", \"assert fibonacci(5) == 5\", \"assert fibonacci(6) == 8\", \"assert fibonacci(7) == 13\", \"assert fibonacci(8) == 2...
{ "split": "train", "index": 67944, "acecode_id": "evol_32900", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes event actions in a text-based game. The function should handle various event actions based on the input string and perform the following operations: 1. If the event action is 'move', return 'Player moves to a new loc...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_event_action('move') == 'Player moves to a new location.'\", \"assert process_event_action('attack') == 'Player initiates combat.'\", \"assert process_event_action('use_item') == 'Player uses an item from inventory.'\", \"assert process_event_action(...
{ "split": "train", "index": 67945, "acecode_id": "oss_34493", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `create_class_with_metaclass(name: str) -> type` that creates a new class with the given name using a metaclass. The class should not have any attributes or methods. Return the newly created class.\nPlease reason step by step, then write a self-contained Py...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_class_with_metaclass('TestClass1').__name__ == 'TestClass1'\", \"assert create_class_with_metaclass('SampleClass2').__name__ == 'SampleClass2'\", \"assert create_class_with_metaclass('MyClass3').__name__ == 'MyClass3'\", \"assert create_class_with_met...
{ "split": "train", "index": 67946, "acecode_id": "evol_9118", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a request to retrieve a topic based on a given Topic ID. The function should take a variable number of keyword arguments, with 'to' being a mandatory keyword argument that represents the Topic ID. The function should return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_topic(to=1) == {'topic_id': 1, 'status': 'success'}\", \"assert get_topic(to=42) == {'topic_id': 42, 'status': 'success'}\", \"assert get_topic(to=100) == {'topic_id': 100, 'status': 'success'}\", \"assert get_topic(to=7) == {'topic_id': 7, 'status': 'su...
{ "split": "train", "index": 67947, "acecode_id": "bigcode_python_fns_4354", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that calculates evaluation metrics for a binary classification task. The function takes in two lists of integers representing the predicted labels and the true labels, and it returns a dictionary containing the evaluation metri...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_evaluation_metrics([1, 0, 1], [1, 0, 1]) == {'accuracy': 1.0, 'precision': 1.0, 'recall': 1.0, 'f1_score': 1.0}\", \"assert calculate_evaluation_metrics([0, 0, 0], [0, 0, 0]) == {'accuracy': 1.0, 'precision': 0, 'recall': 0, 'f1_score': 0}\", \"ass...
{ "split": "train", "index": 67948, "acecode_id": "oss_8435", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simple network event loop in a Python program. You are given a list of readable resources, which includes a server socket and multiple client sockets. Your task is to implement a function that processes the event loop. For each resource in the l...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert event_loop([('server', True)]) == None\", \"assert event_loop([('client', True)]) == None\", \"assert event_loop([('client', False)]) == None\", \"assert event_loop([('server', True), ('client', True)]) == None\", \"assert event_loop([('server', True), ('cli...
{ "split": "train", "index": 67949, "acecode_id": "oss_576", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two sets of strings, set A and set B, implement a function that modifies each word in set A by removing any substrings from set B that are 3 or more characters long. The function should return the modified set A with all matched substrings removed. Handle cases where set ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_substrings(['abcdef', 'ghijkl', 'mnopqr'], ['xyz']) == ['abcdef', 'ghijkl', 'mnopqr']\", \"assert remove_substrings([], ['abc']) == []\", \"assert remove_substrings(['abc', 'abc', 'abc'], ['abc']) == ['', '', '']\", \"assert remove_substrings(['a', 'b...
{ "split": "train", "index": 67950, "acecode_id": "evol_5571", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given a string representing an address and a string representing a name, create a valid URI in the format 'corbaname:<address>#<name>'. If the name is an empty string, the URI should be 'corbaname:<address>'. The function should raise a ValueError if the address is an empty str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert addrAndNameToURI('localhost:1234', 'myService') == 'corbaname:localhost:1234#myService'\", \"assert addrAndNameToURI('192.168.1.1:8080', '') == 'corbaname:192.168.1.1:8080'\", \"assert addrAndNameToURI('10.0.0.1:9090', 'serviceName') == 'corbaname:10.0.0.1:9...
{ "split": "train", "index": 67951, "acecode_id": "bigcode_python_fns_4437", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that checks if certain actions are available in a tool's action registry. The function should take a dictionary representing the action registry of a tool and determine if any of the following actions are missing: 'user.change_password', ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert check_actions({'user': {'change_password': True}, 'global': {'members_register': True, 'search_form': True, 'search': True, 'syndication': True}}) == False\", \"assert check_actions({'user': {'change_password': True}, 'global': {'members_register': True, 'se...
{ "split": "train", "index": 67952, "acecode_id": "bigcode_python_fns_24111", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a list of line segments, where each line segment is defined by two points in a 2D plane. Your task is to implement a function that counts the occurrences of each point across all line segments and returns a dictionary where the keys are the points and the values a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_point_occurrences([((1, 2), (3, 2)), ((3, 2), (3, 4)), ((3, 4), (1, 4)), ((1, 4), (1, 2))]) == {(1, 2): 2, (3, 2): 2, (3, 4): 2, (1, 4): 2}\", \"assert get_point_occurrences([((0, 0), (1, 1)), ((1, 1), (2, 2))]) == {(0, 0): 1, (1, 1): 2, (2, 2): 1}\", \"...
{ "split": "train", "index": 67953, "acecode_id": "oss_22361", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a binary matrix `matrix` of dimensions `m x n`. You are allowed to select any number of columns within the matrix and flip every cell within the chosen column(s). Your task is to determine and return the maximum number of rows that can be made identical in value a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxEqualRowsAfterFlips([[0,1],[1,1]]) == 1\", \"assert maxEqualRowsAfterFlips([[0,1],[1,0]]) == 2\", \"assert maxEqualRowsAfterFlips([[0,0,0],[0,0,1],[1,1,0]]) == 2\", \"assert maxEqualRowsAfterFlips([[1,0,1],[1,0,1],[1,0,1]]) == 3\", \"assert maxEqualRowsAf...
{ "split": "train", "index": 67954, "acecode_id": "evol_694", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the downloading of video clips based on a given video ID. The function will take a dictionary containing video information and return a status tuple. The function should only consider the following keys in the input dic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert download_video_clip({'video-id': 'vid123', 'existing-files': {'vid123': 'path/to/existing/file.mp4'}, 'tmp-dir': '/tmp'}) == ('vid123', 'Copied', 'path/to/existing/file.mp4')\", \"assert download_video_clip({'video-id': 'vid789', 'existing-files': {'vid789':...
{ "split": "train", "index": 67955, "acecode_id": "bigcode_python_fns_38736", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates a simple menu system for a user interface. The function will take a boolean parameter `found_exists` and a string parameter `user_input`, which represents the user's choice in the menu. Based on the value of `user_input`, y...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert menu_action(True, '1') == 'update'\", \"assert menu_action(True, '2') == 'show_all'\", \"assert menu_action(True, '3') == 'show_waypoints'\", \"assert menu_action(True, '4') == 'map-menu'\", \"assert menu_action(True, '5') == 'show_one'\", \"assert menu_acti...
{ "split": "train", "index": 67956, "acecode_id": "bigcode_python_fns_23878", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of messages represented as byte strings. Your task is to implement a function that decodes these byte strings into their original string representations. The byte strings are encoded using the pickle module in Python, which serializes and deserializes Pytho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert decode_messages([b'\\\\x80\\\\x03X\\\\x05\\\\x00\\\\x00\\\\x00Hello\\\\x94.']) == ['Hello']\", \"assert decode_messages([b'\\\\x80\\\\x03X\\\\x05\\\\x00\\\\x00\\\\x00World\\\\x94.']) == ['World']\", \"assert decode_messages([b'\\\\x80\\\\x03X\\\\x03\\\\x00\\...
{ "split": "train", "index": 67957, "acecode_id": "bigcode_python_fns_39251", "num_tests": 9 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that processes a list of conditions and their associated elements. The function should take a list of tuples `process_vars` as input, where each tuple consists of a string representing a specific condition and a list of element...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_variables([('name_left_array_binary_item', [1, 2])]) == [1, 2]\", \"assert process_variables([('name_right_array_binary_item', [3, 4])]) == [3]\", \"assert process_variables([('name_right_array_binary_item_var0', [5, 6])]) == [5, 6]\", \"assert proce...
{ "split": "train", "index": 67958, "acecode_id": "oss_9346", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that simulates adding a task with a specific interval. The function `add_task` takes two arguments: `task_name` (a string representing the name of the task) and `interval` (an integer representing the number of seconds between task execut...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_task('test job 1', 10) == 'test job 1 added!'\", \"assert add_task('background job', 5) == 'background job added!'\", \"assert add_task('cleanup task', 15) == 'cleanup task added!'\", \"assert add_task('data processing', 30) == 'data processing added!'\"...
{ "split": "train", "index": 67959, "acecode_id": "bigcode_python_fns_28622", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that manages configuration settings for a fictional application. The configuration settings are stored in a dictionary format where keys are setting names and values are their corresponding values. Your task is to implement a function `ge...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_config_value({}, 'setting1') == ''\", \"assert get_config_value({'setting1': 'value1'}, 'setting1') == 'value1'\", \"assert get_config_value({'setting1': 'value1', 'setting2': 'value2'}, 'setting2') == 'value2'\", \"assert get_config_value({'setting1': '...
{ "split": "train", "index": 67960, "acecode_id": "oss_18288", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `countDistinctPrefixes(words: List[str]) -> int` that takes a list of strings and returns the number of distinct prefixes that can be formed from the given list of words. A prefix is defined as a substring that starts from the beginning of a word. For examp...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert countDistinctPrefixes(['']) == 0\", \"assert countDistinctPrefixes(['x', 'xy', 'xyz', 'xyzz']) == 4\", \"assert countDistinctPrefixes(['aaa', 'aa', 'a']) == 3\", \"assert countDistinctPrefixes(['single']) == 6\", \"assert countDistinctPrefixes(['hello', 'wor...
{ "split": "train", "index": 67961, "acecode_id": "oss_9909", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Given a two-dimensional matrix, implement a function in Python that returns the matrix's elements in a diagonal zig-zag order. The function should gracefully handle edge cases, such as irregularly shaped or empty matrices, by returning the string 'Invalid matrix'. Your function...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_diagonal([]) == 'Invalid matrix'\", \"assert print_diagonal([[1], [2, 3]]) == 'Invalid matrix'\", \"assert print_diagonal([[1, 2], [3]]) == 'Invalid matrix'\", \"assert print_diagonal([[1, 2], []]) == 'Invalid matrix'\", \"assert print_diagonal([[1, 2]...
{ "split": "train", "index": 67962, "acecode_id": "evol_34852", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of integers. Write a function `sum_of_squares(lst: List[int]) -> int` that calculates the sum of the squares of all the integers in the list. The function should return the total sum. If the list is empty, return 0.\nPlease reason step by step, then write a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_of_squares([1, 2, 3]) == 14\", \"assert sum_of_squares([-1, -2, -3]) == 14\", \"assert sum_of_squares([0]) == 0\", \"assert sum_of_squares([]) == 0\", \"assert sum_of_squares([4, 5, 6]) == 77\", \"assert sum_of_squares([-4, 5]) == 41\", \"assert sum_of_s...
{ "split": "train", "index": 67963, "acecode_id": "bigcode_python_fns_11354", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that checks whether a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, ignoring spaces, punctuation, and capitalization. Write a function n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal: Panama') == True\", \"assert is_palindrome('race a car') == False\", \"assert is_palindrome('Was it a car or a cat I saw?') == True\", \"assert is_palindrome(' ') == True\", \"assert is_palindrome('') == True\", \"asser...
{ "split": "train", "index": 67964, "acecode_id": "oss_23795", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of integers and returns the second smallest unique number in the list. If there are fewer than two unique numbers, return None.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_second_smallest([8, 4, 3, 2, 1, 29, 37]) == 2\", \"assert find_second_smallest([1, 2, 3, 4, 5]) == 2\", \"assert find_second_smallest([5, 5, 5, 5]) == None\", \"assert find_second_smallest([10, 20, 10, 30]) == 20\", \"assert find_second_smallest([1, 1, ...
{ "split": "train", "index": 67965, "acecode_id": "evol_1278", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a 2D list of values representing a spreadsheet, write a function `get_header_row(sheet: List[List[Any]]) -> List[str]` that returns a list containing the values of the first row (header row) of the spreadsheet, formatted as strings. Each value should be converted to a str...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_header_row([[' Name ', ' Age ', ' City ']]) == ['Name', 'Age', 'City']\", \"assert get_header_row([['Product', ' Price', ' Quantity'], ['A', 1, 2], ['B', 3, 4]]) == ['Product', 'Price', 'Quantity']\", \"assert get_header_row([[' ID ', ' Description ...
{ "split": "train", "index": 67966, "acecode_id": "bigcode_python_fns_44464", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function `get_language_code(language: str) -> str` that takes a language code as input and returns the corresponding language code string for speech recognition. The function should support the following language inputs: 'kor' for Korean, whic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_language_code('kor') == 'ko-KR'\", \"assert get_language_code('en') == 'en-US'\", \"assert get_language_code('') == 'unknown'\", \"assert get_language_code('123') == 'unknown'\", \"assert get_language_code('kor') == 'ko-KR'\", \"assert get_language_code(...
{ "split": "train", "index": 67967, "acecode_id": "bigcode_python_fns_27199", "num_tests": 8 }
acecode
[ { "role": "user", "content": "You are given a confusion matrix represented as a 2D list and a list of class labels. Your task is to create a function that calculates and returns the following metrics: accuracy, precision, recall, and F1 score based on the provided confusion matrix. The confusion matrix indi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert save_metrics([[30, 10], [5, 55]], ['spam', 'ham']) == {'accuracy': 0.85, 'precision': 0.85, 'recall': 0.85, 'f1_score': 0.85}\", \"assert save_metrics([[20, 0], [0, 20]], ['yes', 'no']) == {'accuracy': 1.0, 'precision': 1.0, 'recall': 1.0, 'f1_score': 1.0}\"...
{ "split": "train", "index": 67968, "acecode_id": "oss_25311", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates selling stocks in a simple stock trading system. The function `sell_stock(symbol: str, quantity: int) -> str` should take a stock symbol and a quantity of shares to sell. The function will check if the stock symbol exis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sell_stock('AAPL', 50) == 'Sold 50 shares of AAPL. Cash balance updated.'\", \"assert sell_stock('GOOGL', 70) == 'You do not have enough shares of GOOGL to sell.'\", \"assert sell_stock('MSFT', 75) == 'Sold 75 shares of MSFT. Cash balance updated.'\", \"asse...
{ "split": "train", "index": 67969, "acecode_id": "oss_18228", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of book records and a title as input, and returns the list of books excluding the book with the specified title. Each book record is represented as a dictionary with keys 'title', 'author', and 'publication_year'. Write ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_book([{'title': 'The Great Gatsby', 'author': 'F. Scott Fitzgerald', 'publication_year': 1925}, {'title': 'To Kill a Mockingbird', 'author': 'Harper Lee', 'publication_year': 1960}], 'The Great Gatsby') == [{'title': 'To Kill a Mockingbird', 'author':...
{ "split": "train", "index": 67970, "acecode_id": "oss_27776", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a program that calculates the average of a list of numbers. Your program should take a list of integers or floats as input and return a string containing the message \"Your average is X.XX\", where X.XX is the calculated average rounded to two decim...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average([10, 20, 30, 40, 50]) == 'Your average is 30.00'\", \"assert calculate_average([1, 2, 3, 4, 5]) == 'Your average is 3.00'\", \"assert calculate_average([-10, -20, -30]) == 'Your average is -20.00'\", \"assert calculate_average([0, 0, 0]) ==...
{ "split": "train", "index": 67971, "acecode_id": "oss_16308", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a DNA sequence represented as a string consisting of the characters 'A', 'T', 'C', and 'G'. Your task is to write a function that counts the occurrences of each of these four bases in the sequence and returns the results as a dictionary where the keys are the base...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_bases('ATCG') == {'A': 1, 'T': 1, 'C': 1, 'G': 1}\", \"assert count_bases('AATTCCGG') == {'A': 2, 'T': 2, 'C': 2, 'G': 2}\", \"assert count_bases('AAAA') == {'A': 4, 'T': 0, 'C': 0, 'G': 0}\", \"assert count_bases('TTTT') == {'A': 0, 'T': 4, 'C': 0, 'G...
{ "split": "train", "index": 67972, "acecode_id": "bigcode_python_fns_37930", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an integer n, implement a function `prime_factors_matrix(n)` that returns a matrix where each row represents the prime factors of the corresponding number starting from 2 up to n. Each row should contain the prime factors of the number in ascending order.\nPlease reason s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert prime_factors_matrix(2) == [[2]]\", \"assert prime_factors_matrix(3) == [[2], [3]]\", \"assert prime_factors_matrix(4) == [[2], [3], [2, 2]]\", \"assert prime_factors_matrix(5) == [[2], [3], [2, 2], [5]]\", \"assert prime_factors_matrix(6) == [[2], [3], [2, ...
{ "split": "train", "index": 67973, "acecode_id": "evol_15196", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple test runner for a set of test cases. Your function should take a list of test case results, which are either 'PASSED', 'SKIPPED', or 'FAILED'. The function should return a dictionary that summarizes the outcome...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert summarize_test_results(['PASSED', 'PASSED', 'SKIPPED', 'FAILED']) == {'passed': 2, 'skipped': 1, 'failed': 1}\", \"assert summarize_test_results(['PASSED', 'PASSED', 'PASSED']) == {'passed': 3, 'skipped': 0, 'failed': 0}\", \"assert summarize_test_results(['...
{ "split": "train", "index": 67974, "acecode_id": "bigcode_python_fns_22823", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given the ratios of boys and girls in a class along with the total number of students, implement a function that calculates the number of boys and girls in the class. The function should take three parameters: male_ratio, female_ratio, and total_students. The output should be a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_student_ratio(5, 5, 30) == (15, 15)\", \"assert calculate_student_ratio(2, 3, 25) == (10, 15)\", \"assert calculate_student_ratio(1, 1, 10) == (5, 5)\", \"assert calculate_student_ratio(4, 3, 28) == (16, 12)\", \"assert calculate_student_ratio(0, 1...
{ "split": "train", "index": 67975, "acecode_id": "evol_19206", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that extracts key information from a software license text formatted as a string. Each line of the license text begins with a '#' symbol followed by a space, and then it contains a key-value pair separated by a colon. The keys are ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_license_info('# SOFTWARE: This software is provided as is.\\\\n# WARRANTY: No warranty provided.') == {'SOFTWARE': 'This software is provided as is.', 'WARRANTY': 'No warranty provided.'}\", \"assert extract_license_info('# AUTHORS: Alice Smith\\\\n#...
{ "split": "train", "index": 67976, "acecode_id": "oss_28419", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `extended_queue_operations` that simulates a simple queue with the following operations: enqueue an item to the queue, dequeue an item from the queue, peek at the front item of the queue, and check if the queue is empty. The queue should follow the First-In...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extended_queue_operations([('enqueue', 1), ('enqueue', 2), ('peek',), ('dequeue',), ('is_empty',)]) == [None, None, 1, 1, False]\", \"assert extended_queue_operations([('enqueue', 3), ('enqueue', 4), ('dequeue',), ('dequeue',), ('is_empty',)]) == [None, None...
{ "split": "train", "index": 67977, "acecode_id": "evol_2976", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Given an integer representing an HTTP status code, implement a function that determines if the status code indicates a response that should be retried. The function should return True if the status code is not in the range of 200 to 499, inclusive. Otherwise, it should return F...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert should_retry_http_code(200) == False\", \"assert should_retry_http_code(299) == False\", \"assert should_retry_http_code(300) == False\", \"assert should_retry_http_code(400) == False\", \"assert should_retry_http_code(499) == False\", \"assert should_retry_...
{ "split": "train", "index": 67978, "acecode_id": "bigcode_python_fns_27640", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the total sales of a specific type of beer for a given month in a specific year. The data about beer sales is represented as a list of records, where each record is a tuple containing the following fields: (id, name, date, beer_style, location, s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_monthly_sales(2023, 1, 'IPA', [(1, 'Beer A', datetime(2023, 1, 5), 'IPA', 'Location 1', 100), (2, 'Beer B', datetime(2023, 1, 10), 'Lager', 'Location 1', 150), (3, 'Beer C', datetime(2023, 1, 15), 'IPA', 'Location 2', 200)]) == 300\", \"assert calc...
{ "split": "train", "index": 67979, "acecode_id": "bigcode_python_fns_33833", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with updating a dictionary that represents the attributes of a LuciTest entity. The dictionary contains three keys: 'disabled_test_variants', 'issue_keys', and 'tags'. Your function should overwrite the 'disabled_test_variants' with a new set provided in the inpu...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_lucitest_attributes({'disabled_test_variants': {'variant1'}, 'issue_keys': [], 'tags': []}, {'disabled_test_variants': {'variant2'}, 'issue_keys': ['D'], 'tags': {'tag1'}}) == {'disabled_test_variants': {'variant2'}, 'issue_keys': ['D'], 'tags': ['tag...
{ "split": "train", "index": 67980, "acecode_id": "bigcode_python_fns_28316", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that takes a property type as input and returns the corresponding icon name for a GUI application. The function should recognize three specific property types: 'Defects Concentrations', 'Charge Carriers Concentrations', and 'Fermi Lev...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_icon_name('Defects Concentrations') == 'defect_conentrations_icon'\", \"assert get_icon_name('Charge Carriers Concentrations') == 'charge_carriers_icon'\", \"assert get_icon_name('Invalid Type') == 'Unknown Property'\", \"assert get_icon_name('Defects Co...
{ "split": "train", "index": 67981, "acecode_id": "oss_4334", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a recursive function in Python that takes an integer parameter `n` and returns a list containing the string 'Hello, Multiverse!' repeated `n` times. If `n` is less than or equal to 0, the function should return an empty list.\nPlease reason step by step, then write a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert hello_multiverse(9) == ['Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!', 'Hello, Multiverse!']\", \"assert hello_multiverse(0) == [...
{ "split": "train", "index": 67982, "acecode_id": "evol_11119", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function called `user_marshaller` that takes a dictionary representing user data and converts it into a specific format for storage or transmission. The input dictionary has the following keys: 'id' (int), 'username' (str), 'email' (str), and 'cre...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert user_marshaller({'id': 1, 'username': 'testuser', 'email': 'test@example.com', 'created_at': '2023-10-01 12:30:45'}) == {'id': 1, 'username': 'testuser', 'email': 'test@example.com', 'created_at': datetime(2023, 10, 1, 12, 30, 45)}\", \"assert user_marshalle...
{ "split": "train", "index": 67983, "acecode_id": "oss_20102", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two strings `s1` and `s2`, implement a function `solve(s1: str, s2: str) -> str` that removes all characters from `s1` that are present in `s2`, and returns the modified `s1`. The order of characters in the result should be the same as they appear in `s1`. \n\n### Example...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert solve('hello', 'l') == 'heo'\", \"assert solve('abcdef', 'xyz') == 'abcdef'\", \"assert solve('python', 'on') == 'pyth'\", \"assert solve('character', 'ch') == 'arater'\", \"assert solve('string', 'g') == 'strin'\", \"assert solve('aaaaa', 'a') == ''\", \"as...
{ "split": "train", "index": 67984, "acecode_id": "bigcode_python_fns_21252", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that validates a given value against a set of predefined validation patterns based on a parameter. You will receive a parameter and a value as input. If the parameter exists in the predefined patterns dictionary, the function should c...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert param_validated('username', 'user123') == True\", \"assert param_validated('username', 'us') == False\", \"assert param_validated('username', 'user!23') == False\", \"assert param_validated('email', 'test@example.com') == True\", \"assert param_validated('em...
{ "split": "train", "index": 67985, "acecode_id": "bigcode_python_fns_45487", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with generating a summary report for a hospital patient based on their medical records. Write a function `generate_report(patient_info: Dict[str, Any]) -> str` that takes in a dictionary containing the patient's details and returns a formatted string report. The ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_report({'name': 'John Doe', 'age': 30, 'gender': 'male', 'hospital_name': 'City Hospital', 'hospital_address': '123 Main St', 'admission_date': '2023-01-01', 'discharge_date': '2023-01-10', 'diagnosis': 'Flu'}) == 'Patient Name: John Doe\\\\nAge: 30...
{ "split": "train", "index": 67986, "acecode_id": "bigcode_python_fns_29539", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You need to write a Python function `count_occurrences` that takes in a list of integers and an integer `target`. The function should return the number of times `target` appears in the list. Your function should handle the case where the list could be empty. Please implement th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_occurrences([1, 2, 3, 4, 2, 5], 2) == 2\", \"assert count_occurrences([1, 2, 2, 2, 2, 3], 2) == 4\", \"assert count_occurrences([1, 1, 1, 1, 1], 1) == 5\", \"assert count_occurrences([3, 1, 4, 1, 5, 9], 1) == 2\", \"assert count_occurrences([], 3) == 0...
{ "split": "train", "index": 67987, "acecode_id": "oss_36309", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that updates the last modified timestamp of an entry in a database. The function should take an entry ID as input and return the current timestamp as a string in the format 'YYYY-MM-DD HH:MM:SS'. If the entry ID is not valid (less than 1)...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert update_last_modified(1) == datetime.now().strftime('%Y-%m-%d %H:%M:%S')\", \"assert update_last_modified(2) == datetime.now().strftime('%Y-%m-%d %H:%M:%S')\", \"assert update_last_modified(10) == datetime.now().strftime('%Y-%m-%d %H:%M:%S')\", \"assert updat...
{ "split": "train", "index": 67988, "acecode_id": "bigcode_python_fns_1362", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a function that takes a variable number of arguments. Your task is to implement a function that calculates the sum of all the non-negative integers from the provided arguments. The arguments may include integers, floats, and strings. You should only consider non-n...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sum_non_negative_integers(1, 2, 3) == 6\", \"assert sum_non_negative_integers(1, -1, 2.5, 'hello') == 1\", \"assert sum_non_negative_integers(-5, -10, 'test', 0) == 0\", \"assert sum_non_negative_integers('1', 'two', 3, 4) == 7\", \"assert sum_non_negative_i...
{ "split": "train", "index": 67989, "acecode_id": "bigcode_python_fns_42812", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a four-dimensional array characterized by its t blocks, p layers, m horizontal lines, and n vertical lines, write a function that calculates and reflects the one-dimensional representation of the given four-dimensional array. The function should take a single parameter, a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert flatten_4D_array([[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], [[[13, 14, 15], [16, 17, 18]], [[19, 20, 21], [22, 23, 24]]]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]\", \"assert flatten_4D_array([[[[...
{ "split": "train", "index": 67990, "acecode_id": "evol_15017", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the number of items in different inventory categories. Your task is to implement a function `calculate_total_items` that calculates and returns the total number of items across all categories. The function should take a list of inte...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_total_items([1, 2, 3, 4]) == 10\", \"assert calculate_total_items([0, 0, 0]) == 0\", \"assert calculate_total_items([5, 10, 15]) == 30\", \"assert calculate_total_items([7]) == 7\", \"assert calculate_total_items([]) == 0\", \"assert calculate_tota...
{ "split": "train", "index": 67991, "acecode_id": "bigcode_python_fns_38908", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given two positive integers n and m, implement a function `ultra_fibonacci(n, m)` that returns a list of all Fibonacci series terms up to the nth term that are divisible by m, have a digit sum that equals a prime number, and are not perfect squares. Additionally, the function s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert ultra_fibonacci(15, 3) == [3, 21]\", \"assert ultra_fibonacci(5, 4) == []\", \"assert ultra_fibonacci(10, 11) == []\", \"assert ultra_fibonacci(25, 11) == []\", \"assert ultra_fibonacci(22, 7) == [21]\"]}" }
{ "split": "train", "index": 67992, "acecode_id": "evol_19769", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of integers `arr` and an integer `target`. Your task is to implement a function that determines if there are two distinct indices `i` and `j` in the list such that `arr[i] + arr[j] == target`. Return `True` if such a pair exists, otherwise return `False`. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert has_pair_with_sum([1, 2, 3, 4, 5], 9) == True\", \"assert has_pair_with_sum([1, 2, 3, 4, 5], 10) == False\", \"assert has_pair_with_sum([-1, 0, 1], 0) == True\", \"assert has_pair_with_sum([1, 2, 3, 4, 5], 6) == True\", \"assert has_pair_with_sum([1, 2, 3], ...
{ "split": "train", "index": 67993, "acecode_id": "bigcode_python_fns_36076", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Create a function that calculates the total number of vowels in a given list of words, after excluding words that start with a consonant or contain non-alphabetic characters. Implement the function `count_vowels(words)` that takes a list of strings `words` and returns the total...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_vowels(['aeiou', 'xyz', '123']) == 5\", \"assert count_vowels(['1234', 'abcd', 'efgh']) == 2\", \"assert count_vowels(['a', 'e', 'i', 'o', 'u']) == 5\", \"assert count_vowels(['a1', 'b2', 'c3']) == 0\", \"assert count_vowels(['a', 'b', 'c', 'd']) == 1\...
{ "split": "train", "index": 67994, "acecode_id": "evol_14129", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are given a list of deposit and withdrawal operations on a bank account that begins with a zero balance. You are also given a list of fees corresponding to each operation. Your task is to identify if, at any point in time, the balance dips below zero after applying the fees...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert account_balance([50, -60], [0.00, 0.00]) == (True, -10.00)\", \"assert account_balance([0, 0, 0], [0.00, 0.00, 0.00]) == (False, 0.00)\", \"assert account_balance([10, 10, -25], [0.00, 0.00, 0.00]) == (True, -5.00)\", \"assert account_balance([1000, 500, -15...
{ "split": "train", "index": 67995, "acecode_id": "evol_9688", "num_tests": 8 }
acecode
[ { "role": "user", "content": "Implement a function `recursive_prime_factors(n: int) -> List[int]` that returns the prime factors of a given integer `n` using a recursive approach. The function should return a list of prime factors in ascending order. If the input number is less than 2, return an empty list....
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert recursive_prime_factors(1) == []\", \"assert recursive_prime_factors(2) == [2]\", \"assert recursive_prime_factors(3) == [3]\", \"assert recursive_prime_factors(4) == [2, 2]\", \"assert recursive_prime_factors(5) == [5]\", \"assert recursive_prime_factors(6)...
{ "split": "train", "index": 67996, "acecode_id": "evol_4545", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, implement a function `alternate_sort` that reorders the elements such that the largest numerical value is followed directly by the smallest value. Continue this pattern: the next largest, the next smallest, and so forth, until the array is completely s...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert alternate_sort([5, 3, 1, 2, 4]) == [5, 1, 4, 2, 3]\", \"assert alternate_sort([10, 9, 8, 7, 6]) == [10, 6, 9, 7, 8]\", \"assert alternate_sort([1, 2, 3]) == [3, 1, 2]\", \"assert alternate_sort([]) == []\", \"assert alternate_sort([7]) == [7]\", \"assert alt...
{ "split": "train", "index": 67997, "acecode_id": "evol_13984", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the average velocity of ocean drifters based on their trajectory data. You need to implement a function that computes the average velocity given a list of trajectory data points and the number of days for which the average velocity needs to be ca...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_velocity([(0, 0), (0, 0), (0, 0)], 1) == 0.0\", \"assert calculate_average_velocity([(0, 0), (3, 4)], 1) == 5.0\", \"assert calculate_average_velocity([(0, 0), (0, 0), (0, 0), (0, 0)], 10) == 0.0\", \"assert calculate_average_velocity([(0, ...
{ "split": "train", "index": 67998, "acecode_id": "oss_11431", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Write a function `factorial(num: int) -> int` that calculates the factorial of a non-negative integer `num`. The factorial of a non-negative integer `n` is defined as the product of all positive integers less than or equal to `n`. For example, the factorial of 5 is 5 * 4 * 3 * ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(...
{ "split": "train", "index": 67999, "acecode_id": "oss_18547", "num_tests": 16 }