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": "Given a doubly linked list, implement a function `detect_loop(head)` that detects if there is a loop in the list and returns the value of the node where the loop starts. If there is no loop, return None. A loop is defined as a situation where a node's next pointer points to one... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert detect_loop(node1) == 2\", \"assert detect_loop(node2) == 2\", \"assert detect_loop(None) == None\", \"assert detect_loop(node1) == 2\", \"assert detect_loop(node2) == 2\", \"assert detect_loop(node1) == 2\", \"assert detect_loop(node1) == 2\", \"assert dete... | {
"split": "train",
"index": 73900,
"acecode_id": "evol_14168",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Develop a function that generates a list of all unique permutations of a given list of words, converts each permutation into reverse order, and changes all letters to upper case. The function should only consider permutations where the order of the words is different. If the in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert word_permutations(['apple', 'banana']) == [['BANANA', 'APPLE'], ['APPLE', 'BANANA']]\", \"assert word_permutations(['a', 'b', 'c']) == [['C', 'B', 'A'], ['B', 'C', 'A'], ['C', 'A', 'B'], ['A', 'C', 'B'], ['B', 'A', 'C'], ['A', 'B', 'C']]\", \"assert word_per... | {
"split": "train",
"index": 73901,
"acecode_id": "evol_3848",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are given three integers n, m, and p that represent the number of iterations for three nested loops. Your task is to write a function `count_iterations(n: int, m: int, p: int) -> int` that calculates the total number of iterations of these nested loops. The loops are define... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_iterations(1, 1, 1) == 1\", \"assert count_iterations(1, 1, 2) == 2\", \"assert count_iterations(1, 2, 1) == 2\", \"assert count_iterations(1, 2, 2) == 4\", \"assert count_iterations(2, 1, 1) == 2\", \"assert count_iterations(2, 1, 2) == 4\", \"assert ... | {
"split": "train",
"index": 73902,
"acecode_id": "evol_11927",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing a playlist of song positions and two integers: 'songpos' and 'to'. Your task is to move the song located at index 'songpos' one position to the right and place it at index 'to' in the playlist. If 'to' is greater than the length of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert move_song_position([10, 20, 30, 40], 1, 2) == [10, 30, 20, 40]\", \"assert move_song_position([1, 2, 3], 1, 0) == [2, 1, 3]\", \"assert move_song_position([100, 200, 300], 3, 1) == [100, 200, 300]\", \"assert move_song_position([], 0, 0) == []\", \"assert mo... | {
"split": "train",
"index": 73903,
"acecode_id": "bigcode_python_fns_18447",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates a given JSON schema against Draft 7. The function should take a string representing the name of the schema (without the file extension) and return a boolean indicating whether the schema is valid according to Draft 7 specif... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_schema('example') == True\", \"assert validate_schema('non_existent') == False\", \"assert validate_schema('example') == True\", \"assert validate_schema('example') == True\", \"assert validate_schema('non_existent') == False\", \"assert validate_sc... | {
"split": "train",
"index": 73904,
"acecode_id": "bigcode_python_fns_15049",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given a list of stock prices where each element represents the price of a stock on a particular day, write a function `maxProfit(prices: List[int]) -> Tuple[int, int, int]` that calculates the maximum profit you can achieve from buying and selling the stock multiple times, whil... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert maxProfit([1, 2, 3, 4, 5]) == (4, 0, 4)\", \"assert maxProfit([5, 4, 3, 2, 1]) == (0, -1, -1)\", \"assert maxProfit([3, 2, 6, 5, 0, 3]) == (4, 1, 2)\", \"assert maxProfit([1]) == (0, -1, -1)\", \"assert maxProfit([2, 1]) == (0, -1, -1)\", \"assert maxProfit(... | {
"split": "train",
"index": 73905,
"acecode_id": "evol_26198",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a list of VBD UUIDs and a function called `unplug_vbds` that simulates the unplugging of these VBDs. Your task is to implement this function such that it takes a list of VBD UUIDs as input and returns a dictionary indicating the success of the unplug operation for... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unplug_vbds(['uuid1', 'uuid2', 'uuid3']) == {'uuid1': True, 'uuid2': True, 'uuid3': True}\", \"assert unplug_vbds(['uuid4', 'uuid5']) == {'uuid4': False, 'uuid5': False}\", \"assert unplug_vbds(['uuid1', 'uuid4']) == {'uuid1': True, 'uuid4': False}\", \"asse... | {
"split": "train",
"index": 73906,
"acecode_id": "bigcode_python_fns_29718",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a list of numbers and a comparison function, implement a function `median(l: List[int], cmp_func: Callable[[int, int], int]) -> Union[int, float, None]` that calculates the median of the list. The median is defined as the middle value of the sorted list. If the list has a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert median([1, 3, 2], lambda x, y: x - y) == 2\", \"assert median([1, 2, 3, 4], lambda x, y: x - y) == 2.5\", \"assert median([2, 1], lambda x, y: x - y) == 1.5\", \"assert median([], lambda x, y: x - y) == None\", \"assert median([1], lambda x, y: x - y) == 1\"... | {
"split": "train",
"index": 73907,
"acecode_id": "evol_12072",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of file names and a target directory and returns a list of file paths where each file would be stored if they were uploaded to that directory. Each file name should be appended to the target directory, and the result... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_file_paths(['file1.txt', 'file2.txt'], '/uploads') == ['/uploads/file1.txt', '/uploads/file2.txt']\", \"assert generate_file_paths(['image.png', 'document.pdf'], '/documents') == ['/documents/image.png', '/documents/document.pdf']\", \"assert genera... | {
"split": "train",
"index": 73908,
"acecode_id": "oss_1018",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that finds the longest valid strings in a list of strings and their respective indices. A valid string contains only alphabetic characters (including international characters), and no special characters or numbers. In case of multiple longest valid strings of t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_string(['abc', 'def', 'ghi']) == [(0, 'abc'), (1, 'def'), (2, 'ghi')]\", \"assert longest_string(['longest', 'string', 'test']) == [(0, 'longest')]\", \"assert longest_string(['hello', 'world!', 'test1']) == [(0, 'hello')]\", \"assert longest_string(... | {
"split": "train",
"index": 73909,
"acecode_id": "evol_18523",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Construct a function that converts a positive integer ranging from 1 to 1,000,000 (inclusive) to its corresponding lowercase Roman numeral and vice versa. The function should take a second parameter `conversion_type` which indicates the direction of conversion: 'int_to_roman' f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert advanced_roman_numeral_conversion(1, 'int_to_roman', True) == 'i'\", \"assert advanced_roman_numeral_conversion(4, 'int_to_roman', True) == 'iv'\", \"assert advanced_roman_numeral_conversion(5, 'int_to_roman', True) == 'v'\", \"assert advanced_roman_numeral_... | {
"split": "train",
"index": 73910,
"acecode_id": "evol_201",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are designing a simple interpreter for a custom scripting language that allows basic arithmetic operations and string concatenation. Your task is to implement a function that takes a script as a string input and returns the output produced by the script. The script can use ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_script('result = utils.add(2, 3); result_str = \\\"The sum is: \\\" + str(result); result_str', utils) == 'The sum is: 5'\", \"assert run_script('result = utils.subtract(10, 4); result_str = \\\"Difference: \\\" + str(result); result_str', utils) == 'Dif... | {
"split": "train",
"index": 73911,
"acecode_id": "oss_34235",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function get_reminder(month: str, day: int, year: int) that takes in a month (as a string), a day (as an integer), and a year (as an integer). The function should check if the given date falls on a weekend or a holiday (defined as '01-01' for New Year's Day and '12-... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_reminder('January', 1, 2023) == 'Happy Holiday!'\", \"assert get_reminder('December', 25, 2023) == 'Happy Holiday!'\", \"assert get_reminder('February', 28, 2023) == 'Reminder set for your scheduled event.'\", \"assert get_reminder('February', 29, 2024) ... | {
"split": "train",
"index": 73912,
"acecode_id": "evol_9896",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating an in-memory representation of a CSV file. Implement a function `generate_temp_csvfile(headers: List[str], data: List[List[str]]) -> str` that takes in two parameters: a list of headers (strings) and a list of data rows (each row is a list of string... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_temp_csvfile(['Name', 'Age'], [['Alice', '30'], ['Bob', '25']]) == 'Name,Age\\\\nAlice,30\\\\nBob,25'\", \"assert generate_temp_csvfile(['Product', 'Price'], [['Widget', '20'], ['Gadget', '15']]) == 'Product,Price\\\\nWidget,20\\\\nGadget,15'\", \"a... | {
"split": "train",
"index": 73913,
"acecode_id": "bigcode_python_fns_37683",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of integers and returns the maximum value in the list. If the list is empty, the function should return 'Error: The list should not be empty'. If the list contains non-integer elements, the function should return 'Error: All elements in th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_in_list([1, 2, 3, 4, 5]) == 5\", \"assert max_in_list([-1, -2, -3, -4, -5]) == -1\", \"assert max_in_list([0, 0, 0, 0]) == 0\", \"assert max_in_list([10, 20, 30, 40, 50]) == 50\", \"assert max_in_list([5]) == 5\", \"assert max_in_list([-10, 0, 10]) == 10... | {
"split": "train",
"index": 73914,
"acecode_id": "evol_12316",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Define a function `can_arrange(arr, bracket)` that finds the index of the first element in a specified subarray (defined by the range in `bracket`) that is greater than the subsequent element. The function should return a dictionary with the index of this element and the index ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert can_arrange([1, 3, 2, 4, 5], (0, 4)) == {'index': 1, 'swap_with': 2}\", \"assert can_arrange([5, 4, 3, 2, 1], (0, 4)) == {'index': 0, 'swap_with': 1}\", \"assert can_arrange([1, 2, 3, 4, 5], (0, 4)) == {'index': -1, 'swap_with': -1}\", \"assert can_arrange([... | {
"split": "train",
"index": 73915,
"acecode_id": "evol_9052",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that validates and updates the publication state of a deposit based on its previous state and a new state received from a submission. The function should take in two parameters: `previous_state` (a string representing the previous sta... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_publication_state('draft', 'submitted') == 'published'\", \"assert update_publication_state('draft', 'published') == 'published'\", \"assert update_publication_state('submitted', 'published') == 'published'\", \"assert update_publication_state('draft'... | {
"split": "train",
"index": 73916,
"acecode_id": "bigcode_python_fns_30170",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a custom exception handling mechanism for a data validation library. The library is designed to enforce type constraints on attributes of Python classes. Your goal is to create a custom exception class named `MinosMalformedAttributeException`, w... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert MinosMalformedAttributeException('age', 'int', 'twenty').message == 'The int expected type for age does not match with the given data type: twenty'\", \"assert MinosMalformedAttributeException('name', 'str', 123).message == 'The str expected type for name do... | {
"split": "train",
"index": 73917,
"acecode_id": "oss_14939",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the null counts for specified columns in a dataset represented as a list of dictionaries. Each dictionary represents a row in the dataset, and the keys of the dictionary represent the column names. Your function should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_null_counts([{'a': 1, 'b': None}, {'a': None, 'b': 2}], ['a', 'b']) == [1, 1]\", \"assert get_null_counts([{'a': 1, 'b': None}, {'a': None, 'b': 2}], ['a']) == [1]\", \"assert get_null_counts([{'a': 1, 'b': None}, {'a': None, 'b': 2}], ['b']) == [1]\", \... | {
"split": "train",
"index": 73918,
"acecode_id": "oss_37731",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that updates a numeric resource by applying a series of transformations defined in a dictionary. The function receives three parameters: an integer 'id' representing the resource ID, a string 'user' representing the user perfor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_resource(1, 'user1', {'add': 20, 'subtract': 5}) == 115\", \"assert update_resource(2, 'user2', {'multiply': 2, 'divide': 2}) == 100\", \"assert update_resource(3, 'user3', {'add': 50, 'divide': 0}) == 'undefined'\", \"assert update_resource(4, 'user4... | {
"split": "train",
"index": 73919,
"acecode_id": "oss_20631",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are building a migration script for a Django web application. The application has a model called `conference`, and you need to add a new field called `source` to this model. The `source` field should be a character field with a maximum length of 32 characters, and its defau... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_migration_script() == \\\"from django.db import migrations, models\\\\n\\\\nclass Migration(migrations.Migration):\\\\n\\\\n dependencies = [\\\\n ('yourappname', '0003_auto_20190313_1858'), # Replace 'yourappname' with the actual app nam... | {
"split": "train",
"index": 73920,
"acecode_id": "oss_14643",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating a series of Disturbance Storm Time (Dst) values based on solar wind input parameters using a simplified method. Implement a function `calculate_dst(time: List[float], btot: List[float], bx: List[float], by: List[float], bz: List[float], speed: Li... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_dst([1.0, 2.0, 3.0, 4.0, 5.0], [1.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [400.0, 400.0, 400.0, 400.0, 400.0], [300.0, 300.0, 300.0, 300.0, 300.0], [5.0, 5.0, 5.0, 5.0, 5.0]) == [-15,... | {
"split": "train",
"index": 73921,
"acecode_id": "bigcode_python_fns_27267",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Implement a function `quaternion_operations(q1: Tuple[float, float, float, float], q2: Tuple[float, float, float, float]) -> Dict[str, Tuple[float, float, float, float]]` that takes two quaternion numbers represented as tuples (w, x, y, z) and returns a dictionary containing th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quaternion_operations((1, 2, 3, 4), (5, 6, 7, 8)) == {'addition': (6, 8, 10, 12), 'subtraction': (-4, -4, -4, -4), 'multiplication': (-60, 12, 30, 24), 'conjugate': (1, -2, -3, -4)}\", \"assert quaternion_operations((0, 0, 0, 0), (1, 1, 1, 1)) == {'addition'... | {
"split": "train",
"index": 73922,
"acecode_id": "evol_33375",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Write a function `is_valid_ipv6(ip: str) -> bool` that checks if a given string is a valid IPv6 address. The function should return True if the input string is a valid IPv6 address according to the standard format, and False otherwise. A valid IPv6 address consists of eight gro... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_ipv6('2001:0db8:85a3:0000:0000:8a2e:0370:7334') == True\", \"assert is_valid_ipv6('2001:db8:85a3:0:0:8a2e:370:7334') == True\", \"assert is_valid_ipv6('::1') == True\", \"assert is_valid_ipv6('::') == True\", \"assert is_valid_ipv6('2001:0db8::2:1')... | {
"split": "train",
"index": 73923,
"acecode_id": "evol_25365",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a matrix of integers, find the length of the longest increasing path in the matrix. An increasing path is defined as a path where each adjacent cell has a value greater than the previous cell in the path. You can move in four directions: up, down, left, or right. Return t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longestIncreasingPath([[1]]) == 1\", \"assert longestIncreasingPath([[9, 9, 4], [6, 6, 8], [2, 1, 1]]) == 4\", \"assert longestIncreasingPath([[3, 4, 5], [3, 2, 6], [2, 2, 1]]) == 4\", \"assert longestIncreasingPath([[1, 2, 3], [6, 5, 4], [7, 8, 9]]) == 9\",... | {
"split": "train",
"index": 73924,
"acecode_id": "evol_49",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple calculator that can perform basic arithmetic operations on two numbers: addition, subtraction, multiplication, and division. Implement a function `calculate(operation: str, a: float, b: float) -> float` where `operation` is a string that ca... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate('add', 3, 5) == 8\", \"assert calculate('add', -3, 5) == 2\", \"assert calculate('subtract', 8, 5) == 3\", \"assert calculate('subtract', 3, 5) == -2\", \"assert calculate('multiply', 3, 5) == 15\", \"assert calculate('multiply', -3, 5) == -15\", \... | {
"split": "train",
"index": 73925,
"acecode_id": "oss_2289",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `max_product_subarray(arr: List[int]) -> int` that returns the maximum product of a contiguous subarray within the given list. The function should handle both positive and negative integers. If the input list is empty, return 0. You ma... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_product_subarray([2, 3, -2, 4]) == 6\", \"assert max_product_subarray([-2, 0, -1]) == 0\", \"assert max_product_subarray([-2, 3, 0, -2, 4]) == 4\", \"assert max_product_subarray([0, 2]) == 2\", \"assert max_product_subarray([-1, -3, -10, 0, 60]) == 60\",... | {
"split": "train",
"index": 73926,
"acecode_id": "bigcode_python_fns_43377",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with encoding messages into Protocol Data Units (PDUs) using a specific encoding scheme. Implement a function `encode_message(initial_state: str, message: str) -> str` that takes an initial encoding state (a string) and a message (also a string) as input, encodes... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert encode_message('initial', 'test') == 'initial-test'\", \"assert encode_message('state1', 'message1') == 'state1-message1'\", \"assert encode_message('state2', 'message2') == 'state2-message2'\", \"assert encode_message('data', 'hello') == 'data-hello'\", \"a... | {
"split": "train",
"index": 73927,
"acecode_id": "oss_13298",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string s, reverse the string while maintaining the position of each non-alphanumeric character (including spaces and punctuation). Implement a function that takes in a single string and returns the modified string.\nPlease reason step by step, then write a self-containe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_string('a-bC-dEf-ghIj') == 'j-Ih-gfE-dCba'\", \"assert reverse_string('!@#$%^&*()') == '!@#$%^&*()'\", \"assert reverse_string('12345') == '54321'\", \"assert reverse_string('') == ''\", \"assert reverse_string(' ') == ' '\", \"as... | {
"split": "train",
"index": 73928,
"acecode_id": "evol_19623",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a string of numerical words separated by commas (e.g., 'one, two, three') and an integer n, write a function that converts the words into their corresponding integer values, and then swaps the positions of two random integers in the resulting list n times. After performin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert solve_problem('one, one, one, two', 3) == 'Error: Such arrangement is not possible.'\", \"assert solve_problem('two, three, two, three', 4) in [[2, 3, 2, 3], [3, 2, 3, 2]]\", \"assert solve_problem('five, six, seven', 10) in [[5, 6, 7], [6, 5, 7], [7, 5, 6]]... | {
"split": "train",
"index": 73929,
"acecode_id": "evol_7832",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are given a string that may contain HTML entities. Your task is to implement a function `decode_html_entities(txt: str) -> str` that decodes the following HTML entities: '>' to '>', '<' to '<', and '&' to '&'. The function should return the decoded string. For exa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert decode_html_entities('Hello > World < & Everyone!') == 'Hello > World < & Everyone!'\", \"assert decode_html_entities('<div>Content</div>') == '<div>Content</div>'\", \"assert decode_html_entities('No entities here!') == 'No entities he... | {
"split": "train",
"index": 73930,
"acecode_id": "bigcode_python_fns_6297",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Create a function `check_key(dictionary, key)` that checks if a given key exists in a dictionary. If the key exists, return the value associated with that key. If the key does not exist, raise a KeyError exception with the message 'Key not present in the dictionary'.\nPlease re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_key({'a': 1, 'b': 2, 'c': 3}, 'b') == 2\", \"assert check_key({'x': 10, 'y': 20, 'z': 30}, 'x') == 10\", \"assert check_key({'name': 'Alice', 'age': 30}, 'age') == 30\", \"assert check_key({'key1': 'value1'}, 'key1') == 'value1'\", \"assert check_key({... | {
"split": "train",
"index": 73931,
"acecode_id": "evol_19447",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string template containing placeholders in the form of '{key}' that need to be replaced with corresponding values from a dictionary. Write a function `replace_placeholders(template: str, values: Dict[str, str]) -> str` that takes a string `template` and a dictio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert replace_placeholders('Hello, {name}!', {'name': 'Alice'}) == 'Hello, Alice!'\", \"assert replace_placeholders('The color is {color}.', {'color': 'red'}) == 'The color is red.'\", \"assert replace_placeholders('You have {count} new messages.', {'count': '5'})... | {
"split": "train",
"index": 73932,
"acecode_id": "bigcode_python_fns_45267",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a duration in seconds, implement a function `format_time(seconds: int) -> str` that formats the duration into a string in the format `hh:mm:ss`. If the input is negative, return an empty string. The output should always have two digits for hours, minutes, and seconds. For... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_time(3661) == '01:01:01'\", \"assert format_time(0) == '00:00:00'\", \"assert format_time(59) == '00:00:59'\", \"assert format_time(60) == '00:01:00'\", \"assert format_time(3600) == '01:00:00'\", \"assert format_time(86399) == '23:59:59'\", \"assert ... | {
"split": "train",
"index": 73933,
"acecode_id": "bigcode_python_fns_45494",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates an SVG image with a simple ellipse and a square. The ellipse will represent a pear, and the square will represent a leaf. The function should accept parameters for the ellipse's center coordinates, its radii, and the square... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_svg((50, 50), (30, 20), (100, 50), 50, 'test1.svg') == 'SVG created successfully.'\", \"assert create_svg((0, 0), (10, 5), (10, 10), 20, 'test2.svg') == 'SVG created successfully.'\", \"assert create_svg((25, 25), (15, 10), (75, 75), 40, 'test3.svg') ... | {
"split": "train",
"index": 73934,
"acecode_id": "evol_19419",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function to calculate the factorial of a given non-negative integer. Additionally, the function should take an integer limit as an argument to restrict the maximum number of recursive calls. If the number of recursive calls exceeds this limit, the function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert factorial(0, 100) == 1\", \"assert factorial(1, 100) == 1\", \"assert factorial(2, 100) == 2\", \"assert factorial(3, 100) == 6\", \"assert factorial(4, 100) == 24\", \"assert factorial(5, 100) == 120\", \"assert factorial(6, 100) == 720\", \"assert factoria... | {
"split": "train",
"index": 73935,
"acecode_id": "evol_36095",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of columns in a histogram. Your task is to implement a function that calculates the area of the largest rectangle that can be formed within the bounds of the histogram. The function should take a list of integers as inpu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert largest_rectangle_area([2, 1, 5, 6, 2, 3]) == 10\", \"assert largest_rectangle_area([1, 1, 1, 1]) == 4\", \"assert largest_rectangle_area([4, 2, 0, 3, 2, 5]) == 6\", \"assert largest_rectangle_area([1, 2, 3, 4, 5]) == 9\", \"assert largest_rectangle_area([5,... | {
"split": "train",
"index": 73936,
"acecode_id": "bigcode_python_fns_34075",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that returns a list containing only the unique integers from the input list, maintaining the original order of their first appearance. The input list may contain negative numbers and duplicates. Your function should handle the case whe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_integers([1, 2, 3, 1, 2, 3]) == [1, 2, 3]\", \"assert unique_integers([5, 5, 5, 5]) == [5]\", \"assert unique_integers([-1, -1, 0, 1]) == [-1, 0, 1]\", \"assert unique_integers([]) == []\", \"assert unique_integers([10, 20, 30, 20, 10]) == [10, 20, 30... | {
"split": "train",
"index": 73937,
"acecode_id": "bigcode_python_fns_13842",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if a given string is a palindrome. A palindrome is a string that reads the same backward as forward, ignoring spaces, punctuation, and capitalization. Your function should return True if the string is a palindrome and Fals... | 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('') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('Hello') == False\", \"assert is_pali... | {
"split": "train",
"index": 73938,
"acecode_id": "oss_1998",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a `m x n` matrix `grid` which is sorted in non-increasing order both row-wise and column-wise, implement a function that returns the number of negative numbers in `grid` and the index of the row that contains the maximum number of negative numbers. If there are multiple r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert countNegatives([[4,3,2,-1],[3,2,1,-1],[1,1,-1,-2],[-1,-1,-2,-3]]) == (8, 3)\", \"assert countNegatives([[3,2],[1,0]]) == (0, -1)\", \"assert countNegatives([[1,-1],[-1,-1]]) == (3, 1)\", \"assert countNegatives([[-1]]) == (1, 0)\", \"assert countNegatives([[... | {
"split": "train",
"index": 73939,
"acecode_id": "evol_32111",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a comma-separated list of file paths. Your task is to implement a function that takes this string as input and returns a list of file paths, each trimmed of any leading or trailing whitespace. Additionally, if the input string is empty, the f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_file_paths('path/to/file1, path/to/file2, path/to/file3') == ['path/to/file1', 'path/to/file2', 'path/to/file3']\", \"assert process_file_paths(' path/to/file1 , path/to/file2 ') == ['path/to/file1', 'path/to/file2']\", \"assert process_file_pat... | {
"split": "train",
"index": 73940,
"acecode_id": "bigcode_python_fns_22662",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating a sequence of encrypted messages based on a provided template and a list of keys. Write a function `generate_encrypted_messages` that takes in a short topic, a template string, a plaintext key, a list of encryption keys, and an initialization vect... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_encrypted_messages('topic1', 'template', 'plaintext_key', ['key1', 'key2'], 'iv') == ['key1template topic1', 'key2template topic1']\", \"assert generate_encrypted_messages('topic2', 'data', 'secret_key', ['keyA', 'keyB', 'keyC'], 'iv123') == ['keyAd... | {
"split": "train",
"index": 73941,
"acecode_id": "bigcode_python_fns_31125",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing scores obtained from a targeting system. Your task is to implement a function that assigns a targeting score based on predefined criteria. The initial score is 1000. Based on the following conditions, update the score: \n1. If the s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert assign_targeting_score([1000]) == [1000]\", \"assert assign_targeting_score([850]) == [900]\", \"assert assign_targeting_score([400]) == [300]\", \"assert assign_targeting_score([650]) == [550]\", \"assert assign_targeting_score([600]) == [500]\", \"assert a... | {
"split": "train",
"index": 73942,
"acecode_id": "bigcode_python_fns_12366",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a list of boolean values representing the presence of sheep in a field, where 'True' indicates a sheep is present and 'False' indicates a sheep is missing. Write a function `count_sheeps(sheep: List[bool]) -> int` that counts and returns the total number of sheep ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_sheeps([False, False, False, False]) == 0\", \"assert count_sheeps([True, True, True, True]) == 4\", \"assert count_sheeps([False, True, False, True, False]) == 2\", \"assert count_sheeps([]) == 0\", \"assert count_sheeps([True]) == 1\", \"assert count... | {
"split": "train",
"index": 73943,
"acecode_id": "evol_34051",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a function called `multiply_nested_list_values` that calculates the multiplication of all numerical entities (both integers and floats) within a nested list. The list can contain other lists as elements, which may also contain lists, and so on. The function should ignor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert multiply_nested_list_values([1, 2, 3]) == 6\", \"assert multiply_nested_list_values([[1, 2], [3, 4]]) == 24\", \"assert multiply_nested_list_values([1, [2, [3, 4]], 5]) == 120\", \"assert multiply_nested_list_values([1, 'a', 2.5]) == 2.5\", \"assert multiply... | {
"split": "train",
"index": 73944,
"acecode_id": "evol_21718",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `f(x: List[Union[int, List[int]]], reverse: bool = False) -> List[int]` that takes a nested list `x` containing integers and/or other nested lists of integers, and a boolean parameter `reverse`. The function should flatten the nested list and return the int... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert f([1, 5, 0, -9, 3]) == [-9, 0, 1, 3, 5]\", \"assert f([1, [5, 0, -9], 3]) == [-9, 0, 1, 3, 5]\", \"assert f([1, 5, 0, -9, 3], True) == [5, 3, 1, 0, -9]\", \"assert f([[2, 3], [1, 4]]) == [1, 2, 3, 4]\", \"assert f([[2, 3], [1, 4]], True) == [4, 3, 2, 1]\", \... | {
"split": "train",
"index": 73945,
"acecode_id": "evol_24343",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of schema names, write a function `check_schema_existence(schemas: List[str], schema_name: str) -> bool` that checks if a specific schema name exists in the list of schemas. The function should return `True` if the schema name exists in the list, and `False` otherw... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_schema_existence(['public', 'sales', 'inventory'], 'inventory') == True\", \"assert check_schema_existence(['public', 'sales', 'inventory'], 'finance') == False\", \"assert check_schema_existence(['test', 'production', 'development'], 'development') ==... | {
"split": "train",
"index": 73946,
"acecode_id": "bigcode_python_fns_27474",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of lens usage data where each entry consists of a lens model and its brand. Your task is to implement a function `count_shots_per_lens(lens_data: List[Tuple[str, str]]) -> Dict[str, Dict[str, int]]`, which returns a dictionary that counts the number of shot... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_shots_per_lens([('24mm', 'Canon'), ('24mm', 'Canon'), ('24mm', 'Nikon')]) == {'24mm': {'Canon': 2, 'Nikon': 1}}\", \"assert count_shots_per_lens([('85mm', 'Sony'), ('85mm', 'Sony'), ('35mm', 'Canon')]) == {'85mm': {'Sony': 2}, '35mm': {'Canon': 1}}\", ... | {
"split": "train",
"index": 73947,
"acecode_id": "bigcode_python_fns_34197",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simple function that processes a list of integers. The function should take a list of integers as input and return a new list that contains only the even integers from the original list, preserving their order. If there are no even integers, t... | 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([1, 3, 5]) == []\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([2, 4, 6]) == [2, 4, 6]\",... | {
"split": "train",
"index": 73948,
"acecode_id": "oss_27665",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary `settings` that contains a list of channel IDs and channel names associated with a chat application. Write a function `is_not_in_shiptoast_chat(message: Dict[str, Union[int, str]], settings: Dict[str, List[Union[int, str]]]) -> bool` that checks wheth... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_not_in_shiptoast_chat({'channel_id': 1, 'channel_name': 'general'}, {'shiptoast': [2, 'random', 3]}) == True\", \"assert is_not_in_shiptoast_chat({'channel_id': 2, 'channel_name': 'random'}, {'shiptoast': [2, 'random', 3]}) == False\", \"assert is_not_in_... | {
"split": "train",
"index": 73949,
"acecode_id": "bigcode_python_fns_42233",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of boolean values representing the status of validators, where 'True' indicates an active validator and 'False' indicates an inactive validator, write a function `get_active_validator_indices(validators: List[bool]) -> List[int]` that returns a list of indices of a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_active_validator_indices([True, False, True]) == [0, 2]\", \"assert get_active_validator_indices([False, False, False]) == []\", \"assert get_active_validator_indices([True, True, True]) == [0, 1, 2]\", \"assert get_active_validator_indices([False, True,... | {
"split": "train",
"index": 73950,
"acecode_id": "bigcode_python_fns_13716",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given an array `arr` containing integer values. Your task is to write a function `calculateEnvironmentalImpact` that calculates the environmental impact based on the given array. The environmental impact is calculated by multiplying the total amount of oxygen and carbon... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculateEnvironmentalImpact([0]) == 0\", \"assert calculateEnvironmentalImpact([1]) == 1\", \"assert calculateEnvironmentalImpact([1, 1]) == 4\", \"assert calculateEnvironmentalImpact([1, 0, -1]) == 0\", \"assert calculateEnvironmentalImpact([0, 0, 0]) == 0... | {
"split": "train",
"index": 73951,
"acecode_id": "oss_21769",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Write a function that checks if two given phrases are equivalent permutations of distinct words. The function should ignore case and punctuation when comparing the phrases. Implement the function as follows: \ndef compare_word_permutations(phrase1: str, phrase2: str) -> bool: \... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_word_permutations('Cat Dog Mouse', 'dog mouse cat') == True\", \"assert compare_word_permutations('Hello World', 'world hello!') == True\", \"assert compare_word_permutations('Data Processing', 'Processing data') == True\", \"assert compare_word_perm... | {
"split": "train",
"index": 73952,
"acecode_id": "evol_27495",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `validate_zip(zip_code: str) -> bool` that checks whether a given string represents a valid United States postal zip code. A valid zip code is defined as either a 5-digit number (e.g., '90210') or a 5-digit number followed by a hyphen or space and then 4 ad... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_zip('90210-1234') == True\", \"assert validate_zip('90210 1234') == True\", \"assert validate_zip('12345-6789') == True\", \"assert validate_zip('12345 6789') == True\", \"assert validate_zip('123456') == False\", \"assert validate_zip('1234') == Fa... | {
"split": "train",
"index": 73953,
"acecode_id": "evol_25066",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `make_move(board: List[str], square: int, letter: str) -> bool` that simulates making a move in a Tic-Tac-Toe game. The board is represented as a list of 9 strings, where each string can be 'X', 'O', or ' ' (indicating an empty square). The function should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_move([' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], 0, 'X') == True\", \"assert make_move(['X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], 1, 'O') == True\", \"assert make_move(['X', 'O', ' ', ' ', ' ', ' ', ' ', ' ', ' '], 2, 'X') == True\", \"assert mak... | {
"split": "train",
"index": 73954,
"acecode_id": "evol_33223",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You have been given a list of integers representing time in seconds, and a float representing a crash cutoff time. Your task is to implement a function `process_labels(times: List[int], crash_cutoff: float) -> Tuple[int, List[int]]`, which will return the following: \n\n1. An i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_labels([1, 2, 3, 4, 5], 3.0) == (1, [0, 0, 1, 1, 1])\", \"assert process_labels([10, 20, 30], 25.0) == (1, [0, 0, 1])\", \"assert process_labels([0, 0, 0], 1.0) == (0, [0, 0, 0])\", \"assert process_labels([1, 2, 3, 4], 5.0) == (0, [0, 0, 0, 0])\", \... | {
"split": "train",
"index": 73955,
"acecode_id": "bigcode_python_fns_7532",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of dictionaries representing products, each containing a 'details' key with 'price' and 'rating', write a function that computes the weighted median of the 'rating' values with 'price' as the weight. The result should be rounded to two decimal places. If the list i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert weighted_median([]) is None\", \"assert weighted_median([{'product': 'laptop', 'details': {'price': 1000, 'rating': 4.6}}]) == 4.6\", \"assert weighted_median([{'product': 'mobile', 'details': {'price': 500, 'rating': 4.3}}, {'product': 'laptop', 'details': ... | {
"split": "train",
"index": 73956,
"acecode_id": "evol_9750",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a string of words, implement a function that returns the count of each word in the string. The function should exclude special characters and punctuation marks from the count and should also be case-insensitive. Additionally, handle exceptions for null or empty input stri... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert word_count('This, Is a Sentence; of Words!') == {'this': 1, 'is': 1, 'a': 1, 'sentence': 1, 'of': 1, 'words': 1}\", \"assert word_count('Hello World! Hello!') == {'hello': 2, 'world': 1}\", \"assert word_count('Python is great; Python is fun!') == {'python':... | {
"split": "train",
"index": 73957,
"acecode_id": "evol_10965",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a binary mask represented as a 2D list of integers, where each integer is either 0 or 1. Your task is to implement a function that flips the binary mask both horizontally and vertically based on two boolean parameters: `x_flip` and `y_flip`. If `x_flip` is True, t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert flip_mask([[0, 1], [1, 0]], True, False) == [[1, 0], [0, 1]]\", \"assert flip_mask([[0, 1], [1, 0]], False, True) == [[1, 0], [0, 1]]\", \"assert flip_mask([[0, 1], [1, 0]], True, True) == [[0, 1], [1, 0]]\", \"assert flip_mask([[1, 1], [1, 1]], True, False)... | {
"split": "train",
"index": 73958,
"acecode_id": "bigcode_python_fns_5957",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function that takes an array of integers as input and returns a list of integers in the same order. Do not use any loops in your implementation.\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 recursive_function([7, 4, 10, 3]) == [7, 4, 10, 3]\", \"assert recursive_function([1]) == [1]\", \"assert recursive_function([]) == []\", \"assert recursive_function([5, 6, 7]) == [5, 6, 7]\", \"assert recursive_function([-1, -2, -3]) == [-1, -2, -3]\", \"as... | {
"split": "train",
"index": 73959,
"acecode_id": "evol_4220",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two matrices of integers, write a function `matrix_addition(matrix1, matrix2)` that adds the two matrices element-wise. The matrices are guaranteed to be of the same dimensions. The function should return a new matrix that contains the sum of the corresponding elements fr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert matrix_addition([[1, 2], [3, 4]], [[5, 6], [7, 8]]) == [[6, 8], [10, 12]]\", \"assert matrix_addition([[0]], [[0]] ) == [[0]]\", \"assert matrix_addition([[1]], [[2]]) == [[3]]\", \"assert matrix_addition([[1, 2]], [[3, 4]]) == [[4, 6]]\", \"assert matrix_ad... | {
"split": "train",
"index": 73960,
"acecode_id": "bigcode_python_fns_21093",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the head of a linked list, an integer val, and another integer replaceVal, remove all the nodes of the linked list that have Node.val equal to val, and replace them with a new node with Node.val equal to replaceVal. Return the new head of the modified linked list.\nPlease... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert removeAndReplace(ListNode(1, ListNode(2, ListNode(6, ListNode(3, ListNode(4, ListNode(5, ListNode(6))))))), 6, 7).val == 1\", \"assert removeAndReplace(ListNode(1, ListNode(2, ListNode(3))), 4, 7).val == 1\", \"assert removeAndReplace(ListNode(7, ListNode(7,... | {
"split": "train",
"index": 73961,
"acecode_id": "evol_27802",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a simple training loop for a reinforcement learning agent. The function should take in the number of training steps, maximum episodes, and an initial score. Based on these inputs, it will return whether the agent has so... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert train_agent(0, 100, 0) == False\", \"assert train_agent(10, 500, 0) == False\", \"assert train_agent(0, 200, 0) == False\", \"assert train_agent(0, 200, 450) == False\", \"assert train_agent(0, 500, 100) == False\", \"assert train_agent(100, 50, 0) == False\... | {
"split": "train",
"index": 73962,
"acecode_id": "bigcode_python_fns_48159",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to create minibatches of data from a given list of sequences. The function `create_minibatches` takes two parameters: \n1. `data`: A list of tuples, where each tuple contains a sequence of words (a string) and its corresponding label... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_minibatches([('word1', 1), ('word2', 2), ('word3', 3), ('word4', 4)], 2) == ([['word1', 'word2'], ['word3', 'word4']], [[1, 2], [3, 4]])\", \"assert create_minibatches([('word1', 1), ('word2', 2), ('word3', 3)], 2) == ([['word1', 'word2'], ['word3']],... | {
"split": "train",
"index": 73963,
"acecode_id": "oss_4453",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a function that accepts an array of integers as input and eliminates all duplicate values from it. The function should modify the input array directly and return the number of unique elements remaining in the array. The input array may contain both positive and negative... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert eliminate_duplicates([1, 2, 3, 2, 4, 3]) == 4\", \"assert eliminate_duplicates([1, 1, 1, 1]) == 1\", \"assert eliminate_duplicates([1, 2, 3]) == 3\", \"assert eliminate_duplicates([]) == 0\", \"assert eliminate_duplicates([-1, -2, -1, -3]) == 3\", \"assert e... | {
"split": "train",
"index": 73964,
"acecode_id": "evol_778",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of strings as input and returns a single string that concatenates all the strings in the list. Your function should also include a parameter that specifies a delimiter, which will be used to separate the concatenated str... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert concatenate_strings(['Hello', 'World'], ' ') == 'Hello World'\", \"assert concatenate_strings(['a', 'b', 'c'], ',') == 'a,b,c'\", \"assert concatenate_strings(['Python', 'is', 'fun'], '') == 'Pythonisfun'\", \"assert concatenate_strings([], '-') == ''\", \"a... | {
"split": "train",
"index": 73965,
"acecode_id": "oss_15482",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of change operations, each represented as a dictionary containing a 'record' and an 'operation', assign a priority integer to each change operation based on the following rules:\n\n1. If the operation is 'CREATE' or 'UPSERT' and the record has an 'alias_dns_name', ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert assign_change_priority([{'record': {'alias_dns_name': 'alias1', 'name': 'record1'}, 'operation': 'CREATE'}, {'record': {'alias_dns_name': 'alias1', 'name': 'record1'}, 'operation': 'UPSERT'}, {'record': {'alias_dns_name': 'alias2', 'name': 'record2'}, 'opera... | {
"split": "train",
"index": 73966,
"acecode_id": "bigcode_python_fns_15203",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Write a Python function called `is_perfect` that checks if a given number is perfect or not. A number is considered perfect if the sum of its positive divisors (excluding itself) equals the number. Your function should handle positive integers, negative integers, and floating-p... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_perfect(6) == 'Positive perfect number'\", \"assert is_perfect(28) == 'Positive perfect number'\", \"assert is_perfect(496) == 'Positive perfect number'\", \"assert is_perfect(0) == False\", \"assert is_perfect(1) == False\", \"assert is_perfect(12) == Fa... | {
"split": "train",
"index": 73967,
"acecode_id": "evol_6024",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a list of names represented as strings. Your task is to implement a function that takes a name as input and processes it according to the following rules:\n\n1. If the name contains a space, it is considered a full name. Split the name into two parts: first name a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_name('John Doe') == 'John, Doe'\", \"assert process_name('Alice') == 'Alice'\", \"assert process_name('Mary Jane') == 'Mary, Jane'\", \"assert process_name('Bob') == 'Bob'\", \"assert process_name('George Smith') == 'George, Smith'\", \"assert proces... | {
"split": "train",
"index": 73968,
"acecode_id": "bigcode_python_fns_49601",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that extracts and returns the shape of a 2D matrix. The function should take a list of lists (representing the matrix) as input and return a tuple representing its shape in the format (number of rows, number of columns). If the inp... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_matrix_shape([[1, 2, 3], [4, 5, 6]]) == (2, 3)\", \"assert get_matrix_shape([[1], [2], [3]]) == (3, 1)\", \"assert get_matrix_shape([[1, 2], [3, 4], [5, 6]]) == (3, 2)\", \"assert get_matrix_shape([[1, 2, 3, 4]]) == (1, 4)\", \"assert get_matrix_shape([]... | {
"split": "train",
"index": 73969,
"acecode_id": "oss_30535",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates fetching weather data based on a given location. The function should be named `get_weather_data(location: str) -> dict`. The function will take a string parameter `location` which can be any city name. It should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_weather_data('Amsterdam') == {'temperature': 15, 'humidity': 80, 'condition': 'Rainy'}\", \"assert get_weather_data('Rotterdam') == {'temperature': 17, 'humidity': 75, 'condition': 'Cloudy'}\", \"assert get_weather_data('Utrecht') == {'temperature': 16, ... | {
"split": "train",
"index": 73970,
"acecode_id": "oss_14536",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a sponsor's name and a sponsorship amount as input, and returns a confirmation message that includes the provided sponsor details. The function should handle potential input errors such as non-numeric values for the sponsorship... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_confirmation_message('John Doe', 1000) == 'Thank you for sponsoring John Doe with a sponsorship amount of $1000.00.'\", \"assert create_confirmation_message('Acme Corp', 2500.5) == 'Thank you for sponsoring Acme Corp with a sponsorship amount of $2500... | {
"split": "train",
"index": 73971,
"acecode_id": "oss_28682",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `concat` that takes in a list of parameters and a separator `sep`, and returns a string that concatenates all the parameters with the separator in between each pair of parameters. The function `concat` should take two parameters: `par... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert concat([1, 2, 3, 4], '-') == '1-2-3-4'\", \"assert concat(['a', 'b', 'c'], ', ') == 'a, b, c'\", \"assert concat([], '-') == ''\", \"assert concat([True, False], ' OR ') == 'True OR False'\", \"assert concat(['apple'], ', ') == 'apple'\", \"assert concat([No... | {
"split": "train",
"index": 73972,
"acecode_id": "oss_13596",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that creates a Transaction object for a hospital's point-of-sale system. The function should take the following parameters: patient_name (str), services (str), cost (float), payment_method (str), status (str), and user_id (int). The function should return a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Transaction('John Doe', 'Consultation', 150.0, 'Credit Card', 'Completed', 1).patient_name == 'John Doe'\", \"assert Transaction('Jane Smith', 'X-Ray', 200.0, 'Cash', 'Pending', 2).services == 'X-Ray'\", \"assert Transaction('Alice Johnson', 'Blood Test', 50... | {
"split": "train",
"index": 73973,
"acecode_id": "evol_3138",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple function that takes a resource identifier and a filename as input, and returns a collection that contains the name of the resource and the filename. The collection should be represented as a dictionary with 'resource' and 'filename' as keys... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_collection('books', 'library.txt') == {'resource': 'books', 'filename': 'library.txt'}\", \"assert create_collection('music', 'playlist.m3u') == {'resource': 'music', 'filename': 'playlist.m3u'}\", \"assert create_collection('images', 'photo.jpg') == ... | {
"split": "train",
"index": 73974,
"acecode_id": "bigcode_python_fns_49358",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers or floating-point numbers, determine if it is possible to interchange elements between the two lists in such a way that all elements in the first list become even numbers, while ensuring that the total sum of both lists remains unchanged. The functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert exchange_with_floats([1.1, 2.3, 3.7, 4.6], [1.8, 2.2, 5.4, 4.5]) == 'NO'\", \"assert exchange_with_floats([1.5], [2.5]) == 'NO'\", \"assert exchange_with_floats([2.0], [3.0]) == 'NO'\", \"assert exchange_with_floats([1.0, 2.0], [3.0, 4.0]) == 'YES'\", \"asse... | {
"split": "train",
"index": 73975,
"acecode_id": "evol_20655",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to calculate the total cost of items in a shopping cart after applying a discount. The function should take an array of item prices as input and return the total cost after applying a discount of 10% if the total before discount excee... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert checkout([15, 7, 10]) == 32\", \"assert checkout([100, 150]) == 225.0\", \"assert checkout([0, 0, 0]) == 0\", \"assert checkout([200]) == 180.0\", \"assert checkout([10, 20, 30, 40]) == 100\", \"assert checkout([90]) == 90.0\", \"assert checkout([30, 30, 30,... | {
"split": "train",
"index": 73976,
"acecode_id": "oss_26771",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a given number according to a specific set of rules. The function should take an integer `numero` as input and perform the following operations: If `numero` is greater than 1000, the function should return 'Numero in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_number(123) == 12\", \"assert process_number(1001) == 'Numero invalido'\", \"assert process_number(5) == 0\", \"assert process_number(1000) == 100\", \"assert process_number(999) == 99\", \"assert process_number(1500) == 'Numero invalido'\", \"assert... | {
"split": "train",
"index": 73977,
"acecode_id": "oss_27406",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating the movement of a robot on a grid. The robot can move forward in the direction it is currently facing. The grid is represented by a coordinate system, with the robot's initial position being (0, 0) and facing the positive y-axis. The robot's movem... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_robot(['enc_tgt(1, 1, 72)', 'fwd()']) == (0, 1)\", \"assert simulate_robot(['fwd()', 'enc_tgt(2, 2, 0)', 'fwd()']) == (1, 1)\", \"assert simulate_robot(['enc_tgt(0, 0, 0)', 'fwd()']) == (1, 0)\", \"assert simulate_robot(['enc_tgt(0, 0, 90)', 'fwd()'... | {
"split": "train",
"index": 73978,
"acecode_id": "oss_21503",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of latitude and longitude coordinates representing geographical points. Your task is to find the minimum and maximum latitude and longitude values from the list. Return these values as a dictionary with keys 'min_lat', 'max_lat', 'min_lon', and 'max_lon'. T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_bounds([(34.0, -118.0), (36.0, -120.0), (40.0, -110.0)]) == {'min_lat': 34.0, 'max_lat': 40.0, 'min_lon': -120.0, 'max_lon': -110.0}\", \"assert find_bounds([(10.0, 20.0), (15.0, 25.0), (5.0, 30.0)]) == {'min_lat': 5.0, 'max_lat': 15.0, 'min_lon': 20.0,... | {
"split": "train",
"index": 73979,
"acecode_id": "bigcode_python_fns_46479",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of questions and their corresponding answers. Each question is a string, and each answer is also a string. Your function should take two parameters: a list of questions and a list of answers. The function should retu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_qa(['What is your name?', 'How old are you?'], ['Alice', '30']) == {'What is your name?': 'Alice', 'How old are you?': '30'}\", \"assert process_qa(['What is your favorite color?', 'What is your hobby?'], ['Blue', 'Reading']) == {'What is your favori... | {
"split": "train",
"index": 73980,
"acecode_id": "oss_12147",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating the motion of an underwater vehicle. Given the initial parameters for speed, depth, pitch, altitude, heading, and current conditions, write a function that calculates the updated values of these parameters after a specified time interval. The inpu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_motion({'speed': 0, 'depth': 0, 'pitch': 0, 'altitude': 0, 'heading': 0, 'north_current': 0, 'east_current': 0}, 1) == {'speed': 5, 'depth': 2, 'pitch': 0, 'altitude': 0, 'heading': 0}\", \"assert simulate_motion({'speed': 0, 'depth': 0, 'pitch': 0,... | {
"split": "train",
"index": 73981,
"acecode_id": "bigcode_python_fns_10927",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers and a desired shape represented as a tuple. Your task is to implement a function that reshapes the list into the specified shape. If the size of the list does not match the total size of the desired shape, you should repeat the elements of the l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reshape_list([1, 2, 3], (3,)) == [1, 2, 3]\", \"assert reshape_list([1, 2, 3], (2, 2)) == [1, 2, 3, 1]\", \"assert reshape_list([1, 2, 3], (2, 3)) == [1, 2, 3, 1, 2, 3]\", \"assert reshape_list([], (2, 2)) == [0, 0, 0, 0]\", \"assert reshape_list([5], (1, 1)... | {
"split": "train",
"index": 73982,
"acecode_id": "bigcode_python_fns_28225",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D array of shape (2, n) representing time and GMR (Generalized Magnetic Resistance) readings. The first row of the array contains time readings, and the second row contains the corresponding GMR readings. Your task is to apply a simple noise filtering process t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert apply_noise_filtering([[0.0, 1.0, 2.0], [1.7, 2.2, 3.5]]) == [[0.0, 1.0, 2.0], [2, 2, 4]]\", \"assert apply_noise_filtering([[0.0], [1.4]]) == [[0.0], [1]]\", \"assert apply_noise_filtering([[0.0, 1.0], [1.9, 2.1]]) == [[0.0, 1.0], [2, 2]]\", \"assert apply_... | {
"split": "train",
"index": 73983,
"acecode_id": "bigcode_python_fns_43717",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a unique class name based on a given model name and mutation type. The function should take in a model dictionary that contains a 'name' key and a 'path' key, and a mutation type string which can be 'create', 'delete', or '... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_class_name({'name': 'user', 'path': 'some.path'}, 'create') == 'UserCreate'\", \"assert generate_class_name({'name': 'product', 'path': 'some.path'}, 'delete') == 'ProductDelete'\", \"assert generate_class_name({'name': 'order', 'path': 'some.path'}... | {
"split": "train",
"index": 73984,
"acecode_id": "bigcode_python_fns_47360",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `register_user(first_name: str, last_name: str, email: str, password: str) -> dict` that takes in a user's first name, last name, email, and password. The function should return a dictionary containing the user's registration information, with keys 'firstNa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert register_user('Alice', 'Smith', 'ALICE.SMITH@EXAMPLE.COM', 'mypassword') == {'firstName': 'Alice', 'lastName': 'Smith', 'email': 'alice.smith@example.com', 'password': 'mypassword'}\", \"assert register_user('Bob', 'Jones', 'BOB.JONES@EMAIL.COM', 'securepass... | {
"split": "train",
"index": 73985,
"acecode_id": "evol_20361",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a given hotkey string to create a layout configuration. The hotkey string consists of a sequence of mode-button pairs, where each mode is followed by a button. The function should validate the hotkey and create a layout... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert hotkey_layout('') == None\", \"assert hotkey_layout('alt') == None\", \"assert hotkey_layout('a_b_c') == None\", \"assert hotkey_layout('mode1_btn1_mode2_btn2') == [('mode1', 'btn1'), ('mode2', 'btn2')]\", \"assert hotkey_layout('ctrl_shift_v') == None\", \"... | {
"split": "train",
"index": 73986,
"acecode_id": "oss_294",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a properly formatted XML string representing students and their courses, write a function `parse_student_courses(xml_string)` that extracts the names and roll numbers of students along with the names and grades of the courses they are enrolled in. The function should retu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_student_courses('<student name=\\\"Jane\\\" roll_no=\\\"456\\\"> <course name=\\\"Mathematics\\\" grade=\\\"A\\\" /> </student>') == [{'name': 'Jane', 'roll_no': '456', 'course_name': 'Mathematics', 'grade': 'A'}]\", \"assert parse_student_courses('<st... | {
"split": "train",
"index": 73987,
"acecode_id": "evol_32270",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `create_thread(username: str, content: str) -> str` that simulates posting a new thread in a social networking platform. The function should take a username and a content string as parameters. If the content is longer than 300 characters, return an error me... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_thread('john_doe', 'This is my first thread!') == 'Thread created by john_doe: This is my first thread!'\", \"assert create_thread('jane_smith', 'Hello world!') == 'Thread created by jane_smith: Hello world!'\", \"assert create_thread('', 'This should... | {
"split": "train",
"index": 73988,
"acecode_id": "evol_5763",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a dataset of mental health indicators for different states in the USA. Your function should take a dictionary as input where the keys are state names and the values are their respective mental health improvement scor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sorted_states({'California': 25, 'Texas': 30, 'New York': 20}) == ['Texas', 'California', 'New York']\", \"assert sorted_states({'Florida': 15, 'Georgia': 15, 'Alabama': 10}) == ['Florida', 'Georgia', 'Alabama']\", \"assert sorted_states({'Maine': 5, 'Vermon... | {
"split": "train",
"index": 73989,
"acecode_id": "oss_1417",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that determines if a given positive integer is a prime number. A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. Your function should take an integer input and retur... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_prime(2) == True\", \"assert is_prime(3) == True\", \"assert is_prime(4) == False\", \"assert is_prime(5) == True\", \"assert is_prime(6) == False\", \"assert is_prime(29) == True\", \"assert is_prime(30) == False\", \"assert is_prime(31) == True\", \"ass... | {
"split": "train",
"index": 73990,
"acecode_id": "oss_3371",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a compact CSV data string and sorts the data by a specified column while shifting another specified column to the first position in the output. If the specified sorting column does not exist, the function should raise a ValueError. If the specifi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_and_shift('name,age,city;Alice,30,London;Bob,25,Paris;Charlie,35,Madrid', 'age', 'city') == 'city\\tname\\tage\\\\nParis\\tBob\\t25\\\\nLondon\\tAlice\\t30\\\\nMadrid\\tCharlie\\t35'\", \"assert sort_and_shift('name,age,city;Eve,22,Tokyo;Frank,29,Osaka;... | {
"split": "train",
"index": 73991,
"acecode_id": "evol_21232",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that serializes a membership object into a JSON format. The membership object has the following attributes: `id`, `user_id`, `start_date`, `end_date`, and `membership_type`. The `membership_type` is an object representing the t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert serialize_membership(Membership('123', '456', '2022-01-01', '2022-12-31', MembershipType('Gold', '1 year'))) == '{\\\"id\\\": \\\"123\\\", \\\"user_id\\\": \\\"456\\\", \\\"start_date\\\": \\\"2022-01-01\\\", \\\"end_date\\\": \\\"2022-12-31\\\", \\\"members... | {
"split": "train",
"index": 73992,
"acecode_id": "oss_32958",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with determining the optimal number of worker processes for a web server based on the available CPU cores and the type of worker class being used. Write a Python function called `calculate_optimal_workers` that takes two parameters:\n1. `worker_class` (string) - ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_optimal_workers('gevent', 4) == 9\", \"assert calculate_optimal_workers('threaded', 8) == 8\", \"assert calculate_optimal_workers('gevent', 1) == 3\", \"assert calculate_optimal_workers('threaded', 1) == 1\", \"assert calculate_optimal_workers('gev... | {
"split": "train",
"index": 73993,
"acecode_id": "oss_28942",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a positive integer n, return a list of the first n hexagonal numbers. A hexagonal number is defined by the formula H(n) = n(2n - 1). The first few hexagonal numbers are: 0, 1, 6, 15, 28, 45, 66, 91, 120, 153, etc. Your function should raise a ValueError if the input is no... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert hexagonal_numbers(10) == [0, 1, 6, 15, 28, 45, 66, 91, 120, 153]\", \"assert hexagonal_numbers(5) == [0, 1, 6, 15, 28]\", \"assert hexagonal_numbers(1) == [0]\", \"assert hexagonal_numbers(2) == [0, 1]\", \"assert hexagonal_numbers(3) == [0, 1, 6]\", \"asser... | {
"split": "train",
"index": 73994,
"acecode_id": "bigcode_python_fns_8820",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a custom exception class in Python for a specific application. The exception class should have default attributes for detail and error code, but it should also allow for custom detail and code to be passed during instantiation. Your task is to c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert str(CustomException()) == 'Error: bad_request, Detail: Validation failed'\", \"assert str(CustomException('Custom error message')) == 'Error: bad_request, Detail: Custom error message'\", \"assert str(CustomException(code='custom_code')) == 'Error: custom_co... | {
"split": "train",
"index": 73995,
"acecode_id": "oss_4972",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `preorder_traversal(root)` that takes the root of a binary tree as input and returns a list of values representing the preorder traversal of the tree. Preorder traversal visits nodes in the order: root, left, right.\nPlease reason step by step, then write a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert preorder_traversal(Node(1)) == [1]\", \"assert preorder_traversal(Node(1, Node(2), Node(3))) == [1, 2, 3]\", \"assert preorder_traversal(Node(1, Node(2, Node(4)), Node(3))) == [1, 2, 4, 3]\", \"assert preorder_traversal(Node(1, Node(2), Node(3, Node(5)))) ==... | {
"split": "train",
"index": 73996,
"acecode_id": "evol_24677",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that verifies whether the provided input values are valid for a numerical sampling process. The function should check two conditions: (1) the start value (x0) must not be greater than the end value (xf), and (2) the number of sample point... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_input(0.0, 1.0, 10) == True\", \"assert is_valid_input(0.0, 1.0, -1) == False\", \"assert is_valid_input(1.0, 0.0, 10) == False\", \"assert is_valid_input(0.0, 0.0, 0) == True\", \"assert is_valid_input(1.0, 2.0, 5) == True\", \"assert is_valid_inpu... | {
"split": "train",
"index": 73997,
"acecode_id": "bigcode_python_fns_10996",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with filtering a list of proposals based on their type and acceptance status. Each proposal is represented by a dictionary with the following keys: 'id', 'speakers', 'status', and 'title'. Your goal is to implement a function that takes a list of proposals and tw... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_proposals([], 'talk', 'accepted') == []\", \"assert filter_proposals([{'id': 1, 'speakers': [], 'status': 'rejected', 'title': 'Talk 1'}], 'talk', 'accepted') == []\", \"assert filter_proposals([{'id': 1, 'speakers': [], 'status': 'accepted', 'title':... | {
"split": "train",
"index": 73998,
"acecode_id": "bigcode_python_fns_47174",
"num_tests": 8
} |
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. The order of the even numbers in the new list should be the same as their order in the original list. Implement the function... | 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, -2, -4, 3, 5]) == [0, -2, -4]\", \"assert filter_even_numbers([1, 7, 9]) == []\", \"assert filter_even_numbers([]... | {
"split": "train",
"index": 73999,
"acecode_id": "oss_4037",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.