diff --git "a/test.jsonl" "b/test.jsonl" new file mode 100644--- /dev/null +++ "b/test.jsonl" @@ -0,0 +1,151 @@ +{"imports":"from typing import List","function1_signature":"def has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\"Check if in given list of numbers, are any two numbers closer to each other than\n given threshold.\n >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n False\n >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n True\n \"\"\"","function1_human":"def has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\"Check if in given list of numbers, are any two numbers closer to each other than\n given threshold.\n >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n False\n >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n True\n \"\"\"\n for (idx, elem) in enumerate(numbers):\n for (idx2, elem2) in enumerate(numbers):\n if idx != idx2:\n distance = abs(elem - elem2)\n if distance < threshold:\n return True\n return False","function1_name":"has_close_elements","function2_signature":"def has_close_elements_in_array(array: List[List[float]], threshold: float) -> bool:\n \"\"\"Check if in given array, are any two numbers closer to each other than given threshold.\n >>> has_close_elements_in_array([[1.0, 2.0, 3.0], [1.0, 2.0, 3.0]], 0.5)\n True\n >>> has_close_elements_in_array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], 0.3)\n False\n \"\"\"","function2_human":"def has_close_elements_in_array(array: List[List[float]], threshold: float) -> bool:\n \"\"\"Check if in given array, are any two numbers closer to each other than given threshold.\n >>> has_close_elements_in_array([[1.0, 2.0, 3.0], [1.0, 2.0, 3.0]], 0.5)\n True\n >>> has_close_elements_in_array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], 0.3)\n False\n \"\"\"\n return has_close_elements([item for sublist in array for item in sublist], threshold)","function2_name":"has_close_elements_in_array","tests":"def check(candidate):\n assert candidate([[2.0, 3.0, 1.0], [100.0, 101.0, 17.8]], 2.2) is True\n assert candidate([[31.0, 22.7, 38.8], [34.8, 14.8, 22.5]], 0.5) is True\n assert candidate([[1.0, 2.1, 1.6], [2.4, 2.7, 1.3]], 0.2) is False\n\ndef test_check():\n check(has_close_elements_in_array)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Any, List","function1_signature":"def separate_paren_groups(paren_string: str) -> List[str]:\n \"\"\"Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\n separate those group into separate strings and return the list of those.\n Separate groups are balanced (each open brace is properly closed) and not nested within each other\n Ignore any spaces in the input string.\n >>> separate_paren_groups('( ) (( )) (( )( ))')\n ['()', '(())', '(()())']\n \"\"\"","function1_human":"def separate_paren_groups(paren_string: str) -> List[str]:\n \"\"\"Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\n separate those group into separate strings and return the list of those.\n Separate groups are balanced (each open brace is properly closed) and not nested within each other\n Ignore any spaces in the input string.\n >>> separate_paren_groups('( ) (( )) (( )( ))')\n ['()', '(())', '(()())']\n \"\"\"\n result = []\n current_string = []\n current_depth = 0\n for c in paren_string:\n if c == '(':\n current_depth += 1\n current_string.append(c)\n elif c == ')':\n current_depth -= 1\n current_string.append(c)\n if current_depth == 0:\n result.append(''.join(current_string))\n current_string.clear()\n return result","function1_name":"separate_paren_groups","function2_signature":"def nested_separate_paren_groups(paren_string: str) -> Any:\n \"\"\"Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\n separate those group into separate strings and return the list of those.\n Different from separate_paren_groups, you have to recursively separate a group into subgroups if it is nested.\n Separate groups are balanced (each open brace is properly closed) and nested within each other\n Ignore any spaces in the input string.\n >>> nested_separate_paren_groups('( ) (( )) (( )( ))')\n ['()', ['()'], ['()', '()']]\n \"\"\"","function2_human":"def nested_separate_paren_groups(paren_string: str) -> Any:\n \"\"\"Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\n separate those group into separate strings and return the list of those.\n Different from separate_paren_groups, you have to recursively separate a group into subgroups if it is nested.\n Separate groups are balanced (each open brace is properly closed) and nested within each other\n Ignore any spaces in the input string.\n >>> nested_separate_paren_groups('( ) (( )) (( )( ))')\n ['()', ['()'], ['()', '()']]\n \"\"\"\n print(paren_string)\n groups = separate_paren_groups(paren_string)\n for idx in range(len(groups)):\n if groups[idx] == '()':\n continue\n else:\n groups[idx] = nested_separate_paren_groups(groups[idx][1:-1])\n return groups","function2_name":"nested_separate_paren_groups","tests":"def check(candidate):\n assert candidate('(()(()))()()') == [['()', ['()']], '()', '()']\n assert candidate('((((()))))') == [[[[['()']]]]]\n assert candidate('()((()())())()(())') == ['()', [['()', '()'], '()'], '()', ['()']]\n\ndef test_check():\n check(nested_separate_paren_groups)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def truncate_number(number: float) -> float:\n \"\"\"Given a positive floating point number, it can be decomposed into\n and integer part (largest integer smaller than given number) and decimals\n (leftover part always smaller than 1).\n\n Return the decimal part of the number.\n >>> truncate_number(3.5)\n 0.5\n \"\"\"","function1_human":"def truncate_number(number: float) -> float:\n \"\"\"Given a positive floating point number, it can be decomposed into\n and integer part (largest integer smaller than given number) and decimals\n (leftover part always smaller than 1).\n\n Return the decimal part of the number.\n >>> truncate_number(3.5)\n 0.5\n \"\"\"\n return number % 1.0","function1_name":"truncate_number","function2_signature":"def is_number_rounded_up(number: float) -> bool:\n \"\"\"Given a positive floating point number, return True if the number is\n rounded up, False otherwise.\n >>> is_number_rounded_up(3.5)\n True\n >>> is_number_rounded_up(3.4)\n False\n \"\"\"","function2_human":"def is_number_rounded_up(number: float) -> bool:\n \"\"\"Given a positive floating point number, return True if the number is\n rounded up, False otherwise.\n >>> is_number_rounded_up(3.5)\n True\n >>> is_number_rounded_up(3.4)\n False\n \"\"\"\n return truncate_number(number) >= 0.5","function2_name":"is_number_rounded_up","tests":"def check(candidate):\n assert candidate(4.2) is False\n assert candidate(3.141592) is False\n assert candidate(19.865) is True\n assert candidate(1.501) is True\n\ndef test_check():\n check(is_number_rounded_up)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def below_zero(operations: List[int]) -> bool:\n \"\"\"You're given a list of deposit and withdrawal operations on a bank account that starts with\n zero balance. Your task is to detect if at any point the balance of account fallls below zero, and\n at that point function should return True. Otherwise it should return False.\n >>> below_zero([1, 2, 3])\n False\n >>> below_zero([1, 2, -4, 5])\n True\n \"\"\"","function1_human":"def below_zero(operations: List[int]) -> bool:\n \"\"\"You're given a list of deposit and withdrawal operations on a bank account that starts with\n zero balance. Your task is to detect if at any point the balance of account fallls below zero, and\n at that point function should return True. Otherwise it should return False.\n >>> below_zero([1, 2, 3])\n False\n >>> below_zero([1, 2, -4, 5])\n True\n \"\"\"\n balance = 0\n for op in operations:\n balance += op\n if balance < 0:\n return True\n return False","function1_name":"below_zero","function2_signature":"def below_zero_with_initial_value(operations: List[int], initial: int) -> bool:\n \"\"\"You're given a list of deposit and withdrawal operations on a bank account that starts with\n non-negative initial balance. Your task is to detect if at any point the balance of account fallls\n below zero, and at that point function should return True. Otherwise it should return False.\n >>> below_zero_with_initial_value([1, 2, 3], 0)\n False\n >>> below_zero_with_initial_value([1, 2, -4, 5], 3)\n False\n \"\"\"","function2_human":"def below_zero_with_initial_value(operations: List[int], initial: int) -> bool:\n \"\"\"You're given a list of deposit and withdrawal operations on a bank account that starts with\n non-negative initial balance. Your task is to detect if at any point the balance of account fallls\n below zero, and at that point function should return True. Otherwise it should return False.\n >>> below_zero_with_initial_value([1, 2, 3], 0)\n False\n >>> below_zero_with_initial_value([1, 2, -4, 5], 3)\n False\n \"\"\"\n return below_zero([initial] + operations)","function2_name":"below_zero_with_initial_value","tests":"def check(candidate):\n assert candidate([3, -15, 4, 2, 1], 14) is False\n assert candidate([-2, -3, -4, -5], 14) is False\n assert candidate([2, -4, 3], 1) is True\n assert candidate([1, 2, -4, 5], 0) is True\n\ndef test_check():\n check(below_zero_with_initial_value)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def mean_absolute_deviation(numbers: List[float]) -> float:\n \"\"\"For a given list of input numbers, calculate Mean Absolute Deviation\n around the mean of this dataset.\n Mean Absolute Deviation is the average absolute difference between each\n element and a centerpoint (mean in this case):\n MAD = average | x - x_mean |\n >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\n 1.0\n \"\"\"","function1_human":"def mean_absolute_deviation(numbers: List[float]) -> float:\n \"\"\"For a given list of input numbers, calculate Mean Absolute Deviation\n around the mean of this dataset.\n Mean Absolute Deviation is the average absolute difference between each\n element and a centerpoint (mean in this case):\n MAD = average | x - x_mean |\n >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\n 1.0\n \"\"\"\n mean = sum(numbers) \/ len(numbers)\n return sum((abs(x - mean) for x in numbers)) \/ len(numbers)","function1_name":"mean_absolute_deviation","function2_signature":"def find_outlier(numbers: List[float]) -> List[float]:\n \"\"\"For a given list of input numbers, find the outlier.\n Outliers are defined as data whose distance from the mean is greater than\n the mean absolute deviation.\n The order of the outliers in the output list should be the same as in the input list.\n >>> find_outlier([1.0, 2.0, 3.0, 4.0])\n [1.0, 4.0]\n \"\"\"","function2_human":"def find_outlier(numbers: List[float]) -> List[float]:\n \"\"\"For a given list of input numbers, find the outlier.\n Outliers are defined as data whose distance from the mean is greater than\n the mean absolute deviation.\n The order of the outliers in the output list should be the same as in the input list.\n >>> find_outlier([1.0, 2.0, 3.0, 4.0])\n [1.0, 4.0]\n \"\"\"\n mean = sum(numbers) \/ len(numbers)\n mae = mean_absolute_deviation(numbers)\n return [number for number in numbers if abs(number - mean) > mae]","function2_name":"find_outlier","tests":"def check(candidate):\n assert candidate([3.0, 2.0, 1.0, 4.0]) == [1.0, 4.0]\n assert candidate([1.0, 5.0]) == []\n assert candidate([-5.0, 1.0, 0.0, 1.0]) == [-5.0]\n assert candidate([1, 2, -4, 5]) == [-4, 5]\n\ndef test_check():\n check(find_outlier)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def intersperse(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\"Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\n >>> intersperse([], 4)\n []\n >>> intersperse([1, 2, 3], 4)\n [1, 4, 2, 4, 3]\n \"\"\"","function1_human":"def intersperse(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\"Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\n >>> intersperse([], 4)\n []\n >>> intersperse([1, 2, 3], 4)\n [1, 4, 2, 4, 3]\n \"\"\"\n if not numbers:\n return []\n result = []\n for n in numbers[:-1]:\n result.append(n)\n result.append(delimeter)\n result.append(numbers[-1])\n return result","function1_name":"intersperse","function2_signature":"def intersperse_with_start_end(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\"Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\n and also add 'delimeter' at the beginning and end of the list.\n >>> intersperse_with_start_end([], 4)\n [4, 4]\n >>> intersperse_with_start_end([1, 2, 3], 4)\n [4, 1, 4, 2, 4, 3, 4]\n \"\"\"","function2_human":"def intersperse_with_start_end(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\"Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\n and also add 'delimeter' at the beginning and end of the list.\n >>> intersperse_with_start_end([], 4)\n [4, 4]\n >>> intersperse_with_start_end([1, 2, 3], 4)\n [4, 1, 4, 2, 4, 3, 4]\n \"\"\"\n return [delimeter] + intersperse(numbers, delimeter) + [delimeter]","function2_name":"intersperse_with_start_end","tests":"def check(candidate):\n assert candidate([], 100) == [100, 100]\n assert candidate([7, 7, 7], 1) == [1, 7, 1, 7, 1, 7, 1]\n assert candidate([3, 6, 9, 12, 15], 6) == [6, 3, 6, 6, 6, 9, 6, 12, 6, 15, 6]\n assert candidate([7, 5, 3, 2], 1) == [1, 7, 1, 5, 1, 3, 1, 2, 1]\n assert candidate([101, 100, 98, 95], 100) == [100, 101, 100, 100, 100, 98, 100, 95, 100]\n\ndef test_check():\n check(intersperse_with_start_end)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def parse_nested_parens(paren_string: str) -> List[int]:\n \"\"\"Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\n For each of the group, output the deepest level of nesting of parentheses.\n E.g. (()()) has maximum two levels of nesting while ((())) has three.\n\n >>> parse_nested_parens('(()()) ((())) () ((())()())')\n [2, 3, 1, 3]\n \"\"\"","function1_human":"def parse_nested_parens(paren_string: str) -> List[int]:\n \"\"\"Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\n For each of the group, output the deepest level of nesting of parentheses.\n E.g. (()()) has maximum two levels of nesting while ((())) has three.\n\n >>> parse_nested_parens('(()()) ((())) () ((())()())')\n [2, 3, 1, 3]\n \"\"\"\n\n def parse_paren_group(s):\n depth = 0\n max_depth = 0\n for c in s:\n if c == '(':\n depth += 1\n max_depth = max(depth, max_depth)\n else:\n depth -= 1\n return max_depth\n return [parse_paren_group(x) for x in paren_string.split(' ') if x]","function1_name":"parse_nested_parens","function2_signature":"def remove_nested_parens(paren_string: str) -> str:\n \"\"\"Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\n Filter out the group whose deepest level of nesting of parentheses is greater than 2.\n E.g. (()()) has maximum two levels of nesting while ((())) has three.\n\n >>> remove_nested_parens('(()()) ((())) () ((())()())')\n '(()()) ()'\n \"\"\"","function2_human":"def remove_nested_parens(paren_string: str) -> str:\n \"\"\"Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\n Filter out the group whose deepest level of nesting of parentheses is greater than 2.\n E.g. (()()) has maximum two levels of nesting while ((())) has three.\n\n >>> remove_nested_parens('(()()) ((())) () ((())()())')\n '(()()) ()'\n \"\"\"\n depths = parse_nested_parens(paren_string)\n return ' '.join((group for (group, depth) in zip(paren_string.split(), depths) if depth <= 2))","function2_name":"remove_nested_parens","tests":"def check(candidate):\n assert candidate('(()) () ()') == '(()) () ()'\n assert candidate('((())) ((()))') == ''\n assert candidate('() (()()) () ((())())') == '() (()()) ()'\n assert candidate('(()) (()) (())') == '(()) (()) (())'\n assert candidate('(()()()()) (()()()) (()()) (())') == '(()()()()) (()()()) (()()) (())'\n\ndef test_check():\n check(remove_nested_parens)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def filter_by_substring(strings: List[str], substring: str) -> List[str]:\n \"\"\"Filter an input list of strings only for ones that contain given substring\n >>> filter_by_substring([], 'a')\n []\n >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')\n ['abc', 'bacd', 'array']\n \"\"\"","function1_human":"def filter_by_substring(strings: List[str], substring: str) -> List[str]:\n \"\"\"Filter an input list of strings only for ones that contain given substring\n >>> filter_by_substring([], 'a')\n []\n >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')\n ['abc', 'bacd', 'array']\n \"\"\"\n return [x for x in strings if substring in x]","function1_name":"filter_by_substring","function2_signature":"def filter_by_substrings(strings: List[str], substrings: List[str]) -> List[str]:\n \"\"\"Filter an input list of strings only for ones that contain all of given substrings\n >>> filter_by_substrings([], ['a', 'b'])\n []\n >>> filter_by_substrings(['abc', 'bacd', 'cde', 'array'], ['a', 'b'])\n ['abc', 'bacd']\n \"\"\"","function2_human":"def filter_by_substrings(strings: List[str], substrings: List[str]) -> List[str]:\n \"\"\"Filter an input list of strings only for ones that contain all of given substrings\n >>> filter_by_substrings([], ['a', 'b'])\n []\n >>> filter_by_substrings(['abc', 'bacd', 'cde', 'array'], ['a', 'b'])\n ['abc', 'bacd']\n \"\"\"\n for substring in substrings:\n strings = filter_by_substring(strings, substring)\n return strings","function2_name":"filter_by_substrings","tests":"def check(candidate):\n assert candidate(['prefix', 'suffix', 'infix'], ['fix', 'pre']) == ['prefix']\n assert candidate(['prefix', 'suffix', 'infix'], ['fix', 'pre', 'in']) == []\n assert candidate(['hot', 'cold', 'warm'], ['o']) == ['hot', 'cold']\n assert candidate(['abcdef', 'aboekxdeji', 'abekfj'], ['ab', 'de']) == ['abcdef', 'aboekxdeji']\n\ndef test_check():\n check(filter_by_substrings)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Tuple","function1_signature":"def sum_product(numbers: List[int]) -> Tuple[int, int]:\n \"\"\"For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.\n Empty sum should be equal to 0 and empty product should be equal to 1.\n >>> sum_product([])\n (0, 1)\n >>> sum_product([1, 2, 3, 4])\n (10, 24)\n \"\"\"","function1_human":"def sum_product(numbers: List[int]) -> Tuple[int, int]:\n \"\"\"For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.\n Empty sum should be equal to 0 and empty product should be equal to 1.\n >>> sum_product([])\n (0, 1)\n >>> sum_product([1, 2, 3, 4])\n (10, 24)\n \"\"\"\n sum_value = 0\n prod_value = 1\n for n in numbers:\n sum_value += n\n prod_value *= n\n return (sum_value, prod_value)","function1_name":"sum_product","function2_signature":"def product_sum(numbers: List[int]) -> Tuple[int, int]:\n \"\"\"For a given list of integers, return a tuple consisting of a product and a sum of all the integers in a list.\n Empty sum should be equal to 0 and empty product should be equal to 1.\n >>> product_sum([])\n (1, 0)\n >>> product_sum([1, 2, 3, 4])\n (24, 10)\n \"\"\"","function2_human":"def product_sum(numbers: List[int]) -> Tuple[int, int]:\n \"\"\"For a given list of integers, return a tuple consisting of a product and a sum of all the integers in a list.\n Empty sum should be equal to 0 and empty product should be equal to 1.\n >>> product_sum([])\n (1, 0)\n >>> product_sum([1, 2, 3, 4])\n (24, 10)\n \"\"\"\n (s, p) = sum_product(numbers)\n return (p, s)","function2_name":"product_sum","tests":"def check(candidate):\n assert candidate([]) == (1, 0)\n assert candidate([4, 3, 0, 8]) == (0, 15)\n assert candidate([9, 2]) == (18, 11)\n assert candidate([100, 101, 102]) == (1030200, 303)\n\ndef test_check():\n check(product_sum)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def rolling_max(numbers: List[int]) -> List[int]:\n \"\"\"From a given list of integers, generate a list of rolling maximum element found until given moment\n in the sequence.\n >>> rolling_max([1, 2, 3, 2, 3, 4, 2])\n [1, 2, 3, 3, 3, 4, 4]\n \"\"\"","function1_human":"def rolling_max(numbers: List[int]) -> List[int]:\n \"\"\"From a given list of integers, generate a list of rolling maximum element found until given moment\n in the sequence.\n >>> rolling_max([1, 2, 3, 2, 3, 4, 2])\n [1, 2, 3, 3, 3, 4, 4]\n \"\"\"\n running_max = None\n result = []\n for n in numbers:\n if running_max is None:\n running_max = n\n else:\n running_max = max(running_max, n)\n result.append(running_max)\n return result","function1_name":"rolling_max","function2_signature":"def rolling_max_with_initial_value(numbers: List[int], initial: int) -> List[int]:\n \"\"\"From a given list of integers, generate a list of rolling maximum element found until given moment\n in the sequence. Additionally, the maximum value starts with `initial`.\n >>> rolling_max_with_initial_value([1, 2, 3, 2, 3, 4, 2], 3)\n [3, 3, 3, 3, 3, 4, 4]\n \"\"\"","function2_human":"def rolling_max_with_initial_value(numbers: List[int], initial: int) -> List[int]:\n \"\"\"From a given list of integers, generate a list of rolling maximum element found until given moment\n in the sequence. Additionally, the maximum value starts with `initial`.\n >>> rolling_max_with_initial_value([1, 2, 3, 2, 3, 4, 2], 3)\n [3, 3, 3, 3, 3, 4, 4]\n \"\"\"\n return rolling_max([initial] + numbers)[1:]","function2_name":"rolling_max_with_initial_value","tests":"def check(candidate):\n assert candidate([2, 4, 3, 2, 3, 2, 5, 4, 6], 3) == [3, 4, 4, 4, 4, 4, 5, 5, 6]\n assert candidate([8, 3, 5, 9, 9, 11, 6, 4], 13) == [13, 13, 13, 13, 13, 13, 13, 13]\n assert candidate([2, 2, 3, 7], 1) == [2, 2, 3, 7]\n assert candidate([72, 74, 75, 76], 74) == [74, 74, 75, 76]\n\ndef test_check():\n check(rolling_max_with_initial_value)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def make_palindrome(string: str) -> str:\n \"\"\"Find the shortest palindrome that begins with a supplied string.\n Algorithm idea is simple:\n - Find the longest postfix of supplied string that is a palindrome.\n - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.\n >>> make_palindrome('')\n ''\n >>> make_palindrome('cat')\n 'catac'\n >>> make_palindrome('cata')\n 'catac'\n \"\"\"","function1_human":"def make_palindrome(string: str) -> str:\n \"\"\"Find the shortest palindrome that begins with a supplied string.\n Algorithm idea is simple:\n - Find the longest postfix of supplied string that is a palindrome.\n - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.\n >>> make_palindrome('')\n ''\n >>> make_palindrome('cat')\n 'catac'\n >>> make_palindrome('cata')\n 'catac'\n \"\"\"\n\n def is_palindrome(string: str) -> bool:\n return string == string[::-1]\n if not string:\n return ''\n beginning_of_suffix = 0\n while not is_palindrome(string[beginning_of_suffix:]):\n beginning_of_suffix += 1\n return string + string[:beginning_of_suffix][::-1]","function1_name":"make_palindrome","function2_signature":"def find_shortest_palindrome_prefix(string: str) -> str:\n \"\"\"Find the shortest prefix that generates the same shortest palindrome that\n begins with the supplied string.\n >>> find_shortest_palindrome_prefix('')\n ''\n >>> find_shortest_palindrome_prefix('cat')\n 'cat'\n >>> find_shortest_palindrome_prefix('cata')\n 'cat'\n \"\"\"","function2_human":"def find_shortest_palindrome_prefix(string: str) -> str:\n \"\"\"Find the shortest prefix that generates the same shortest palindrome that\n begins with the supplied string.\n >>> find_shortest_palindrome_prefix('')\n ''\n >>> find_shortest_palindrome_prefix('cat')\n 'cat'\n >>> find_shortest_palindrome_prefix('cata')\n 'cat'\n \"\"\"\n if len(string) == 0 or len(string) == 1:\n return string\n p = make_palindrome(string)\n for idx in range(len(string) - 1, 0, -1):\n if p != make_palindrome(string[:idx]):\n return string[:idx + 1]","function2_name":"find_shortest_palindrome_prefix","tests":"def check(candidate):\n assert candidate('owienfh') == 'owienfh'\n assert candidate('abcdedcb') == 'abcde'\n assert candidate('abababa') == 'ababab'\n\ndef test_check():\n check(find_shortest_palindrome_prefix)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def string_xor(a: str, b: str) -> str:\n \"\"\"Input are two strings a and b consisting only of 1s and 0s.\n Perform binary XOR on these inputs and return result also as a string.\n >>> string_xor('010', '110')\n '100'\n \"\"\"","function1_human":"def string_xor(a: str, b: str) -> str:\n \"\"\"Input are two strings a and b consisting only of 1s and 0s.\n Perform binary XOR on these inputs and return result also as a string.\n >>> string_xor('010', '110')\n '100'\n \"\"\"\n\n def xor(i, j):\n if i == j:\n return '0'\n else:\n return '1'\n return ''.join((xor(x, y) for (x, y) in zip(a, b)))","function1_name":"string_xor","function2_signature":"def string_xor_three(a: str, b: str, c: str) -> str:\n \"\"\"Input are three strings a, b, and c consisting only of 1s and 0s.\n Perform binary XOR on these inputs and return result also as a string.\n >>> string_xor('010', '110', '001')\n '101'\n \"\"\"","function2_human":"def string_xor_three(a: str, b: str, c: str) -> str:\n \"\"\"Input are three strings a, b, and c consisting only of 1s and 0s.\n Perform binary XOR on these inputs and return result also as a string.\n >>> string_xor('010', '110', '001')\n '101'\n \"\"\"\n return string_xor(string_xor(a, b), c)","function2_name":"string_xor_three","tests":"def check(candidate):\n assert candidate('000', '101', '110') == '011'\n assert candidate('1100', '1011', '1111') == '1000'\n assert candidate('010', '110', '100') == '000'\n\ndef test_check():\n check(string_xor_three)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Optional","function1_signature":"def longest(strings: List[str]) -> Optional[str]:\n \"\"\"Out of list of strings, return the longest one. Return the first one in case of multiple\n strings of the same length. Return None in case the input list is empty.\n >>> longest([])\n\n >>> longest(['a', 'b', 'c'])\n 'a'\n >>> longest(['a', 'bb', 'ccc'])\n 'ccc'\n \"\"\"","function1_human":"def longest(strings: List[str]) -> Optional[str]:\n \"\"\"Out of list of strings, return the longest one. Return the first one in case of multiple\n strings of the same length. Return None in case the input list is empty.\n >>> longest([])\n\n >>> longest(['a', 'b', 'c'])\n 'a'\n >>> longest(['a', 'bb', 'ccc'])\n 'ccc'\n \"\"\"\n if not strings:\n return None\n maxlen = max((len(x) for x in strings))\n for s in strings:\n if len(s) == maxlen:\n return s","function1_name":"longest","function2_signature":"def second_longest(strings: List[str]) -> Optional[str]:\n \"\"\"Out of list of strings, return the second longest one. Return the first one in case of multiple\n strings of the same length. Return None in case the input list doesn't have the second longest elements.\n >>> second_longest([])\n None\n >>> second_longest(['a', 'b', 'c'])\n None\n >>> second_longest(['a', 'bb', 'ccc'])\n 'bb'\n \"\"\"","function2_human":"def second_longest(strings: List[str]) -> Optional[str]:\n \"\"\"Out of list of strings, return the second longest one. Return the first one in case of multiple\n strings of the same length. Return None in case the input list doesn't have the second longest elements.\n >>> second_longest([])\n None\n >>> second_longest(['a', 'b', 'c'])\n None\n >>> second_longest(['a', 'bb', 'ccc'])\n 'bb'\n \"\"\"\n longest_string = longest(strings)\n if longest_string is None:\n return None\n strings = [string for string in strings if len(string) < len(longest_string)]\n return longest(strings)","function2_name":"second_longest","tests":"def check(candidate):\n assert candidate([]) is None\n assert candidate(['albha', 'iehwknsj', 'lwi', 'wihml']) == 'albha'\n assert candidate(['apple', 'banana', 'kiwiiiiiii', 'xxxxxx', 'appledish']) == 'appledish'\n assert candidate(['what', 'is', 'this']) == 'is'\n\ndef test_check():\n check(second_longest)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Tuple","function1_signature":"def greatest_common_divisor(a: int, b: int) -> int:\n \"\"\"Return a greatest common divisor of two integers a and b\n >>> greatest_common_divisor(3, 5)\n 1\n >>> greatest_common_divisor(25, 15)\n 5\n \"\"\"","function1_human":"def greatest_common_divisor(a: int, b: int) -> int:\n \"\"\"Return a greatest common divisor of two integers a and b\n >>> greatest_common_divisor(3, 5)\n 1\n >>> greatest_common_divisor(25, 15)\n 5\n \"\"\"\n while b:\n (a, b) = (b, a % b)\n return a","function1_name":"greatest_common_divisor","function2_signature":"def reduce_fraction(nominator: int, denominator: int) -> Tuple[int, int]:\n \"\"\"Given nominator and denominator, reduce them to the simplest form.\n Reducing fractions means simplifying a fraction, wherein we divide the numerator and denominator by a common divisor until the common factor becomes 1.\n >>> reduce_fraction(3, 5)\n (3, 5)\n >>> reduce_fraction(25, 15)\n (5, 3)\n \"\"\"","function2_human":"def reduce_fraction(nominator: int, denominator: int) -> Tuple[int, int]:\n \"\"\"Given nominator and denominator, reduce them to the simplest form.\n Reducing fractions means simplifying a fraction, wherein we divide the numerator and denominator by a common divisor until the common factor becomes 1.\n >>> reduce_fraction(3, 5)\n (3, 5)\n >>> reduce_fraction(25, 15)\n (5, 3)\n \"\"\"\n gcd = greatest_common_divisor(nominator, denominator)\n return (nominator \/\/ gcd, denominator \/\/ gcd)","function2_name":"reduce_fraction","tests":"def check(candidate):\n assert candidate(51, 34) == (3, 2)\n assert candidate(81, 9) == (9, 1)\n assert candidate(39, 52) == (3, 4)\n\ndef test_check():\n check(reduce_fraction)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def all_prefixes(string: str) -> List[str]:\n \"\"\"Return list of all prefixes from shortest to longest of the input string\n >>> all_prefixes('abc')\n ['a', 'ab', 'abc']\n \"\"\"","function1_human":"def all_prefixes(string: str) -> List[str]:\n \"\"\"Return list of all prefixes from shortest to longest of the input string\n >>> all_prefixes('abc')\n ['a', 'ab', 'abc']\n \"\"\"\n result = []\n for i in range(len(string)):\n result.append(string[:i + 1])\n return result","function1_name":"all_prefixes","function2_signature":"def all_suffixes_prefixes(string: str) -> List[str]:\n \"\"\"Return list of suffixes which are also a prefix from shortest to\n longest of the input string\n >>> all_suffixes('abc')\n ['abc']\n \"\"\"","function2_human":"def all_suffixes_prefixes(string: str) -> List[str]:\n \"\"\"Return list of suffixes which are also a prefix from shortest to\n longest of the input string\n >>> all_suffixes('abc')\n ['abc']\n \"\"\"\n prefixes = all_prefixes(string)\n suffixes = [x[::-1] for x in all_prefixes(string[::-1])]\n return [x for x in suffixes if x in prefixes]","function2_name":"all_suffixes_prefixes","tests":"def check(candidate):\n assert candidate('abcabc') == ['abc', 'abcabc']\n assert candidate('ababab') == ['ab', 'abab', 'ababab']\n assert candidate('dxewfoird') == ['d', 'dxewfoird']\n\ndef test_check():\n check(all_suffixes_prefixes)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def string_sequence(n: int) -> str:\n \"\"\"Return a string containing space-delimited numbers starting from 0 upto n inclusive.\n >>> string_sequence(0)\n '0'\n >>> string_sequence(5)\n '0 1 2 3 4 5'\n \"\"\"","function1_human":"def string_sequence(n: int) -> str:\n \"\"\"Return a string containing space-delimited numbers starting from 0 upto n inclusive.\n >>> string_sequence(0)\n '0'\n >>> string_sequence(5)\n '0 1 2 3 4 5'\n \"\"\"\n return ' '.join([str(x) for x in range(n + 1)])","function1_name":"string_sequence","function2_signature":"def digit_sum(n: int) -> str:\n \"\"\"Return the sum of all digits from 0 upto n inclusive.\n >>> digit_sum(0)\n 0\n >>> digit_sum(5)\n 15\n \"\"\"","function2_human":"def digit_sum(n: int) -> str:\n \"\"\"Return the sum of all digits from 0 upto n inclusive.\n >>> digit_sum(0)\n 0\n >>> digit_sum(5)\n 15\n \"\"\"\n sequence = string_sequence(n)\n return sum((int(x) for x in sequence if x != ' '))","function2_name":"digit_sum","tests":"def check(candidate):\n assert candidate(14) == 60\n assert candidate(21) == 105\n assert candidate(104) == 915\n\ndef test_check():\n check(digit_sum)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def count_distinct_characters(string: str) -> int:\n \"\"\"Given a string, find out how many distinct characters (regardless of case) does it consist of\n >>> count_distinct_characters('xyzXYZ')\n 3\n >>> count_distinct_characters('Jerry')\n 4\n \"\"\"","function1_human":"def count_distinct_characters(string: str) -> int:\n \"\"\"Given a string, find out how many distinct characters (regardless of case) does it consist of\n >>> count_distinct_characters('xyzXYZ')\n 3\n >>> count_distinct_characters('Jerry')\n 4\n \"\"\"\n return len(set(string.lower()))","function1_name":"count_distinct_characters","function2_signature":"def count_words_with_distinct_characters(strings: List[str]) -> int:\n \"\"\"Given a list of strings, count the number of words made up of all different letters (regardless of case)\n >>> count_words_with_distinct_characters(['xyz', 'Jerry'])\n 1\n >>> count_words_with_distinct_characters(['apple', 'bear', 'Take'])\n 2\n \"\"\"","function2_human":"def count_words_with_distinct_characters(strings: List[str]) -> int:\n \"\"\"Given a list of strings, count the number of words made up of all different letters (regardless of case)\n >>> count_words_with_distinct_characters(['xyz', 'Jerry'])\n 1\n >>> count_words_with_distinct_characters(['apple', 'bear', 'Take'])\n 2\n \"\"\"\n return len([string for string in strings if count_distinct_characters(string) == len(string)])","function2_name":"count_words_with_distinct_characters","tests":"def check(candidate):\n assert candidate(['valid', 'heart', 'orientation', 'class']) == 2\n assert candidate(['hunter', 'frog']) == 2\n assert candidate(['scratch']) == 0\n\ndef test_check():\n check(count_words_with_distinct_characters)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def parse_music(music_string: str) -> List[int]:\n \"\"\"Input to this function is a string representing musical notes in a special ASCII format.\n Your task is to parse this string and return list of integers corresponding to how many beats does each\n not last.\n\n Here is a legend:\n 'o' - whole note, lasts four beats\n 'o|' - half note, lasts two beats\n '.|' - quater note, lasts one beat\n\n >>> parse_music('o o| .| o| o| .| .| .| .| o o')\n [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]\n \"\"\"","function1_human":"def parse_music(music_string: str) -> List[int]:\n \"\"\"Input to this function is a string representing musical notes in a special ASCII format.\n Your task is to parse this string and return list of integers corresponding to how many beats does each\n not last.\n\n Here is a legend:\n 'o' - whole note, lasts four beats\n 'o|' - half note, lasts two beats\n '.|' - quater note, lasts one beat\n\n >>> parse_music('o o| .| o| o| .| .| .| .| o o')\n [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]\n \"\"\"\n note_map = {'o': 4, 'o|': 2, '.|': 1}\n return [note_map[x] for x in music_string.split(' ') if x]","function1_name":"parse_music","function2_signature":"def count_beats(music_string: str) -> int:\n \"\"\"Input to this function is a string representing musical notes in a special ASCII format.\n Your task is to parse this string and return the total number of beats in the song.\n\n Here is a legend:\n 'o' - whole note, lasts four beats\n 'o|' - half note, lasts two beats\n '.|' - quater note, lasts one beat\n\n >>> count_beats('o o| .| o| o| .| .| .| .| o o')\n 24\n \"\"\"","function2_human":"def count_beats(music_string: str) -> int:\n \"\"\"Input to this function is a string representing musical notes in a special ASCII format.\n Your task is to parse this string and return the total number of beats in the song.\n\n Here is a legend:\n 'o' - whole note, lasts four beats\n 'o|' - half note, lasts two beats\n '.|' - quater note, lasts one beat\n\n >>> count_beats('o o| .| o| o| .| .| .| .| o o')\n 24\n \"\"\"\n return sum(parse_music(music_string))","function2_name":"count_beats","tests":"def check(candidate):\n assert candidate('o o| .|') == 7\n assert candidate('o| o| o|') == 6\n assert candidate('o .| o| o o| .| o|') == 16\n\ndef test_check():\n check(count_beats)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def how_many_times(string: str, substring: str) -> int:\n \"\"\"Find how many times a given substring can be found in the original string. Count overlaping cases.\n >>> how_many_times('', 'a')\n 0\n >>> how_many_times('aaa', 'a')\n 3\n >>> how_many_times('aaaa', 'aa')\n 3\n \"\"\"","function1_human":"def how_many_times(string: str, substring: str) -> int:\n \"\"\"Find how many times a given substring can be found in the original string. Count overlaping cases.\n >>> how_many_times('', 'a')\n 0\n >>> how_many_times('aaa', 'a')\n 3\n >>> how_many_times('aaaa', 'aa')\n 3\n \"\"\"\n times = 0\n for i in range(len(string) - len(substring) + 1):\n if string[i:i + len(substring)] == substring:\n times += 1\n return times","function1_name":"how_many_times","function2_signature":"def match_cancer_pattern(dna: str, cancer_pattern: str) -> int:\n \"\"\"Find how many times a given cancer pattern can be found in the given DNA. Count overlaping cases.\n >>> match_cancer_pattern('ATGCGATACGCTTGA', 'CG')\n 3\n >>> match_cancer_pattern('ATGCGATACGCTTGA', 'CGC')\n 1\n \"\"\"","function2_human":"def match_cancer_pattern(dna: str, cancer_pattern: str) -> int:\n \"\"\"Find how many times a given cancer pattern can be found in the given DNA. Count overlaping cases.\n >>> match_cancer_pattern('ATGCGATACGCTTGA', 'CG')\n 3\n >>> match_cancer_pattern('ATGCGATACGCTTGA', 'CGC')\n 1\n \"\"\"\n return how_many_times(dna, cancer_pattern)","function2_name":"match_cancer_pattern","tests":"def check(candidate):\n assert candidate('ATATATAT', 'ATA') == 3\n assert candidate('ATGCATGCATGCATGC', 'ATGCATGC') == 3\n assert candidate('AGCTCTGATCGAT', 'GAT') == 2\n\ndef test_check():\n check(match_cancer_pattern)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def sort_numbers(numbers: str) -> str:\n \"\"\"Input is a space-delimited string of numberals from 'zero' to 'nine'.\n Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.\n Return the string with numbers sorted from smallest to largest\n >>> sort_numbers('three one five')\n 'one three five'\n \"\"\"","function1_human":"def sort_numbers(numbers: str) -> str:\n \"\"\"Input is a space-delimited string of numberals from 'zero' to 'nine'.\n Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.\n Return the string with numbers sorted from smallest to largest\n >>> sort_numbers('three one five')\n 'one three five'\n \"\"\"\n value_map = {'zero': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9}\n return ' '.join(sorted([x for x in numbers.split(' ') if x], key=lambda x: value_map[x]))","function1_name":"sort_numbers","function2_signature":"def sort_numbers_descending(numbers: str) -> str:\n \"\"\"Input is a space-delimited string of numberals from 'zero' to 'nine'.\n Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.\n Return the string with numbers sorted from largest to smallest\n >>> sort_numbers_descending('three one five')\n 'five three one'\n \"\"\"","function2_human":"def sort_numbers_descending(numbers: str) -> str:\n \"\"\"Input is a space-delimited string of numberals from 'zero' to 'nine'.\n Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.\n Return the string with numbers sorted from largest to smallest\n >>> sort_numbers_descending('three one five')\n 'five three one'\n \"\"\"\n return ' '.join((x for x in reversed(sort_numbers(numbers).split(' '))))","function2_name":"sort_numbers_descending","tests":"def check(candidate):\n assert candidate('two three four') == 'four three two'\n assert candidate('nine zero six seven') == 'nine seven six zero'\n assert candidate('five one three eight') == 'eight five three one'\n\ndef test_check():\n check(sort_numbers_descending)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Tuple","function1_signature":"def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n \"\"\"From a supplied list of numbers (of length at least two) select and return two that are the closest to each\n other and return them in order (smaller number, larger number).\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n (2.0, 2.2)\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n (2.0, 2.0)\n \"\"\"","function1_human":"def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n \"\"\"From a supplied list of numbers (of length at least two) select and return two that are the closest to each\n other and return them in order (smaller number, larger number).\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n (2.0, 2.2)\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n (2.0, 2.0)\n \"\"\"\n closest_pair = None\n distance = None\n for (idx, elem) in enumerate(numbers):\n for (idx2, elem2) in enumerate(numbers):\n if idx != idx2:\n if distance is None:\n distance = abs(elem - elem2)\n closest_pair = tuple(sorted([elem, elem2]))\n else:\n new_distance = abs(elem - elem2)\n if new_distance < distance:\n distance = new_distance\n closest_pair = tuple(sorted([elem, elem2]))\n return closest_pair","function1_name":"find_closest_elements","function2_signature":"def find_closest_distance(numbers: List[float]) -> float:\n \"\"\"From a supplied list of numbers (of length at least two) select and return the distance between two that are\n the closest to each other.\n >>> find_closest_distance([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n 0.2\n >>> find_closest_distance([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n 0.0\n \"\"\"","function2_human":"def find_closest_distance(numbers: List[float]) -> float:\n \"\"\"From a supplied list of numbers (of length at least two) select and return the distance between two that are\n the closest to each other.\n >>> find_closest_distance([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n 0.2\n >>> find_closest_distance([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n 0.0\n \"\"\"\n (x, y) = find_closest_elements(numbers)\n return y - x","function2_name":"find_closest_distance","tests":"def check(candidate):\n assert round(candidate([1.7, 0.5, 3.1, 1.2, 2.1]), 2) == 0.4\n assert round(candidate([3.0, 4.0, 5.0, 4.0, 3.9]), 2) == 0.0\n assert round(candidate([1.0, 2.0, 3.0, 10.0]), 2) == 1.0\n\ndef test_check():\n check(find_closest_distance)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def rescale_to_unit(numbers: List[float]) -> List[float]:\n \"\"\"Given list of numbers (of at least two elements), apply a linear transform to that list,\n such that the smallest number will become 0 and the largest will become 1\n >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])\n [0.0, 0.25, 0.5, 0.75, 1.0]\n \"\"\"","function1_human":"def rescale_to_unit(numbers: List[float]) -> List[float]:\n \"\"\"Given list of numbers (of at least two elements), apply a linear transform to that list,\n such that the smallest number will become 0 and the largest will become 1\n >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])\n [0.0, 0.25, 0.5, 0.75, 1.0]\n \"\"\"\n min_number = min(numbers)\n max_number = max(numbers)\n return [(x - min_number) \/ (max_number - min_number) for x in numbers]","function1_name":"rescale_to_unit","function2_signature":"def rescale_to_percentile(numbers: List[float]) -> List[float]:\n \"\"\"Given list of numbers (of at least two elements), apply a linear transform to that list,\n such that the smallest number will become 0 and the largest will become 100\n >>> rescale_to_percentile([1.0, 2.0, 3.0, 4.0, 5.0])\n [0.0, 25.0, 50.0, 75.0, 100.0]\n \"\"\"","function2_human":"def rescale_to_percentile(numbers: List[float]) -> List[float]:\n \"\"\"Given list of numbers (of at least two elements), apply a linear transform to that list,\n such that the smallest number will become 0 and the largest will become 100\n >>> rescale_to_percentile([1.0, 2.0, 3.0, 4.0, 5.0])\n [0.0, 25.0, 50.0, 75.0, 100.0]\n \"\"\"\n return [x * 100 for x in rescale_to_unit(numbers)]","function2_name":"rescale_to_percentile","tests":"def check(candidate):\n assert list(map(lambda x: round(x, 2), candidate([38.7, 91.9, 3.4, 94.7, 33.2, 19.1]))) == [38.66, 96.93, 0.0, 100.0, 32.64, 17.2]\n assert list(map(lambda x: round(x, 2), candidate([3.0, 4.0, 5.0, 4.0, 3.9]))) == [0.0, 50.0, 100.0, 50.0, 45.0]\n assert list(map(lambda x: round(x, 2), candidate([1.0, 2.0, 3.0, 10.0]))) == [0.0, 11.11, 22.22, 100.0]\n\ndef test_check():\n check(rescale_to_percentile)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Any, List","function1_signature":"def filter_integers(values: List[Any]) -> List[int]:\n \"\"\"Filter given list of any python values only for integers\n >>> filter_integers(['a', 3.14, 5])\n [5]\n >>> filter_integers([1, 2, 3, 'abc', { }, []])\n [1, 2, 3]\n \"\"\"","function1_human":"def filter_integers(values: List[Any]) -> List[int]:\n \"\"\"Filter given list of any python values only for integers\n >>> filter_integers(['a', 3.14, 5])\n [5]\n >>> filter_integers([1, 2, 3, 'abc', { }, []])\n [1, 2, 3]\n \"\"\"\n return [x for x in values if isinstance(x, int)]","function1_name":"filter_integers","function2_signature":"def get_second_integer(values: List[Any]) -> List[int]:\n \"\"\"Return the second integer element in the list\n If there is no second integer element, return None\n >>> get_second_observed_integer(['a', 3.14, 5])\n None\n >>> get_second_observed_integer([1, 2, 3, 'abc', {}, []])\n 2\n \"\"\"","function2_human":"def get_second_integer(values: List[Any]) -> List[int]:\n \"\"\"Return the second integer element in the list\n If there is no second integer element, return None\n >>> get_second_observed_integer(['a', 3.14, 5])\n None\n >>> get_second_observed_integer([1, 2, 3, 'abc', {}, []])\n 2\n \"\"\"\n integers = filter_integers(values)\n if len(integers) < 2:\n return None\n return filter_integers(values)[1]","function2_name":"get_second_integer","tests":"def check(candidate):\n assert candidate([75, '75', 'scv', 7.3]) is None\n assert candidate(['wwkdjf', 'three', 97, 'wild', 3]) == 3\n assert candidate([85, 92, 77, 94, 77]) == 92\n\ndef test_check():\n check(get_second_integer)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def strlen(string: str) -> int:\n \"\"\"Return length of given string\n >>> strlen('')\n 0\n >>> strlen('abc')\n 3\n \"\"\"","function1_human":"def strlen(string: str) -> int:\n \"\"\"Return length of given string\n >>> strlen('')\n 0\n >>> strlen('abc')\n 3\n \"\"\"\n return len(string)","function1_name":"strlen","function2_signature":"def is_string_length_odd(string: str) -> str:\n \"\"\"Return 'odd' if length of given string is odd, otherwise 'even'\n >>> is_string_length_odd('')\n 'even'\n >>> is_string_length_odd('abc')\n 'odd'\n \"\"\"","function2_human":"def is_string_length_odd(string: str) -> str:\n \"\"\"Return 'odd' if length of given string is odd, otherwise 'even'\n >>> is_string_length_odd('')\n 'even'\n >>> is_string_length_odd('abc')\n 'odd'\n \"\"\"\n return 'odd' if strlen(string) % 2 else 'even'","function2_name":"is_string_length_odd","tests":"def check(candidate):\n assert candidate('apple') == 'odd'\n assert candidate('working') == 'odd'\n assert candidate('book') == 'even'\n\ndef test_check():\n check(is_string_length_odd)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def largest_divisor(n: int) -> int:\n \"\"\"For a given number n, find the largest number that divides n evenly, smaller than n\n >>> largest_divisor(15)\n 5\n \"\"\"","function1_human":"def largest_divisor(n: int) -> int:\n \"\"\"For a given number n, find the largest number that divides n evenly, smaller than n\n >>> largest_divisor(15)\n 5\n \"\"\"\n for i in reversed(range(n)):\n if n % i == 0:\n return i","function1_name":"largest_divisor","function2_signature":"def get_smallest_chunk_num(n: int) -> bool:\n \"\"\"Given n, find the smallest k such that a number n can be made from k chunks of the same size.\n Chunk size must be smaller than n.\n >>> get_smallest_chunk_num(15)\n 3\n \"\"\"","function2_human":"def get_smallest_chunk_num(n: int) -> bool:\n \"\"\"Given n, find the smallest k such that a number n can be made from k chunks of the same size.\n Chunk size must be smaller than n.\n >>> get_smallest_chunk_num(15)\n 3\n \"\"\"\n return n \/\/ largest_divisor(n)","function2_name":"get_smallest_chunk_num","tests":"def check(candidate):\n assert candidate(370) == 2\n assert candidate(23) == 23\n assert candidate(77) == 7\n\ndef test_check():\n check(get_smallest_chunk_num)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def factorize(n: int) -> List[int]:\n \"\"\"Return list of prime factors of given integer in the order from smallest to largest.\n Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.\n Input number should be equal to the product of all factors\n >>> factorize(8)\n [2, 2, 2]\n >>> factorize(25)\n [5, 5]\n >>> factorize(70)\n [2, 5, 7]\n \"\"\"","function1_human":"def factorize(n: int) -> List[int]:\n \"\"\"Return list of prime factors of given integer in the order from smallest to largest.\n Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.\n Input number should be equal to the product of all factors\n >>> factorize(8)\n [2, 2, 2]\n >>> factorize(25)\n [5, 5]\n >>> factorize(70)\n [2, 5, 7]\n \"\"\"\n import math\n fact = []\n i = 2\n while i <= int(math.sqrt(n) + 1):\n if n % i == 0:\n fact.append(i)\n n \/\/= i\n else:\n i += 1\n if n > 1:\n fact.append(n)\n return fact","function1_name":"factorize","function2_signature":"def count_unique_prime_factors(n: int) -> int:\n \"\"\"Return the number of unique prime factors of given integer\n >>> count_unique_prime_factors(8)\n 1\n >>> count_unique_prime_factors(25)\n 1\n >>> count_unique_prime_factors(70)\n 3\n \"\"\"","function2_human":"def count_unique_prime_factors(n: int) -> int:\n \"\"\"Return the number of unique prime factors of given integer\n >>> count_unique_prime_factors(8)\n 1\n >>> count_unique_prime_factors(25)\n 1\n >>> count_unique_prime_factors(70)\n 3\n \"\"\"\n return len(set(factorize(n)))","function2_name":"count_unique_prime_factors","tests":"def check(candidate):\n assert candidate(910) == 4\n assert candidate(256) == 1\n assert candidate(936) == 3\n\ndef test_check():\n check(count_unique_prime_factors)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def remove_duplicates(numbers: List[int]) -> List[int]:\n \"\"\"From a list of integers, remove all elements that occur more than once.\n Keep order of elements left the same as in the input.\n >>> remove_duplicates([1, 2, 3, 2, 4])\n [1, 3, 4]\n \"\"\"","function1_human":"def remove_duplicates(numbers: List[int]) -> List[int]:\n \"\"\"From a list of integers, remove all elements that occur more than once.\n Keep order of elements left the same as in the input.\n >>> remove_duplicates([1, 2, 3, 2, 4])\n [1, 3, 4]\n \"\"\"\n import collections\n c = collections.Counter(numbers)\n return [n for n in numbers if c[n] <= 1]","function1_name":"remove_duplicates","function2_signature":"def count_duplicates(numbers: List[int]) -> int:\n \"\"\"From a list of integers, count how many elements occur more than once.\n >>> count_duplicates([1, 2, 3, 2, 4])\n 2\n >>> count_duplicates([2, 2, 3, 2, 3])\n 5\n \"\"\"","function2_human":"def count_duplicates(numbers: List[int]) -> int:\n \"\"\"From a list of integers, count how many elements occur more than once.\n >>> count_duplicates([1, 2, 3, 2, 4])\n 2\n >>> count_duplicates([2, 2, 3, 2, 3])\n 5\n \"\"\"\n return len(numbers) - len(remove_duplicates(numbers))","function2_name":"count_duplicates","tests":"def check(candidate):\n assert candidate([9, 4, 3, 3, 3]) == 3\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 6, 4, 2]) == 6\n assert candidate([96, 33, 27, 96, 2, 11]) == 2\n\ndef test_check():\n check(count_duplicates)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def flip_case(string: str) -> str:\n \"\"\"For a given string, flip lowercase characters to uppercase and uppercase to lowercase.\n >>> flip_case('Hello')\n 'hELLO'\n \"\"\"","function1_human":"def flip_case(string: str) -> str:\n \"\"\"For a given string, flip lowercase characters to uppercase and uppercase to lowercase.\n >>> flip_case('Hello')\n 'hELLO'\n \"\"\"\n return string.swapcase()","function1_name":"flip_case","function2_signature":"def get_more_uppercase_word(string: str) -> str:\n \"\"\"Return string if string has more or equal number of uppercase characters than\n the number of lowercase characters. Otherwise, return string whose characters\n are flipped by their case.\n >>> flip_alternative_words('Hello')\n 'hELLO'\n >>> flip_alternative_words('SotA')\n 'SotA'\n \"\"\"","function2_human":"def get_more_uppercase_word(string: str) -> str:\n \"\"\"Return string if string has more or equal number of uppercase characters than\n the number of lowercase characters. Otherwise, return string whose characters\n are flipped by their case.\n >>> flip_alternative_words('Hello')\n 'hELLO'\n >>> flip_alternative_words('SotA')\n 'SotA'\n \"\"\"\n if sum((1 for c in string if c.isupper())) >= sum((1 for c in string if c.islower())):\n return string\n else:\n return flip_case(string)","function2_name":"get_more_uppercase_word","tests":"def check(candidate):\n assert candidate('What') == 'wHAT'\n assert candidate('APpLe') == 'APpLe'\n assert candidate('noTeBooK') == 'NOtEbOOk'\n\ndef test_check():\n check(get_more_uppercase_word)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def concatenate(strings: List[str]) -> str:\n \"\"\"Concatenate list of strings into a single string\n >>> concatenate([])\n ''\n >>> concatenate(['a', 'b', 'c'])\n 'abc'\n \"\"\"","function1_human":"def concatenate(strings: List[str]) -> str:\n \"\"\"Concatenate list of strings into a single string\n >>> concatenate([])\n ''\n >>> concatenate(['a', 'b', 'c'])\n 'abc'\n \"\"\"\n return ''.join(strings)","function1_name":"concatenate","function2_signature":"def create_multiline_string(strings: List[str]) -> str:\n \"\"\"Create a multiline string from a list of strings. Note that last line should also end with a newline. If string is empty, return empty string.\n >>> create_multiline_string([])\n ''\n >>> create_multiline_string(['a', 'b', 'c'])\n 'a\\\\nb\\\\nc\n'\n \"\"\"","function2_human":"def create_multiline_string(strings: List[str]) -> str:\n \"\"\"Create a multiline string from a list of strings. Note that last line should also end with a newline. If string is empty, return empty string.\n >>> create_multiline_string([])\n ''\n >>> create_multiline_string(['a', 'b', 'c'])\n 'a\\\\nb\\\\nc\n'\n \"\"\"\n return concatenate([s + '\\n' for s in strings])","function2_name":"create_multiline_string","tests":"def check(candidate):\n assert candidate(['return scroll', 'might be', ' .']) == 'return scroll\\nmight be\\n .\\n'\n assert candidate([\"I don't know\"]) == \"I don't know\\n\"\n assert candidate([]) == ''\n\ndef test_check():\n check(create_multiline_string)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n \"\"\"Filter an input list of strings only for ones that start with a given prefix.\n >>> filter_by_prefix([], 'a')\n []\n >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')\n ['abc', 'array']\n \"\"\"","function1_human":"def filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n \"\"\"Filter an input list of strings only for ones that start with a given prefix.\n >>> filter_by_prefix([], 'a')\n []\n >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')\n ['abc', 'array']\n \"\"\"\n return [x for x in strings if x.startswith(prefix)]","function1_name":"filter_by_prefix","function2_signature":"def create_autocomplete_options(input: str, options: List[str]) -> List[str]:\n \"\"\"Create autocomplete options for a given input string from a list of options.\n Options should be sorted alphabetically.\n >>> create_autocomplete_options('a', [])\n []\n >>> create_autocomplete_options('a', ['abc', 'bcd', 'cde', 'array'])\n ['abc', 'array']\n \"\"\"","function2_human":"def create_autocomplete_options(input: str, options: List[str]) -> List[str]:\n \"\"\"Create autocomplete options for a given input string from a list of options.\n Options should be sorted alphabetically.\n >>> create_autocomplete_options('a', [])\n []\n >>> create_autocomplete_options('a', ['abc', 'bcd', 'cde', 'array'])\n ['abc', 'array']\n \"\"\"\n return sorted(filter_by_prefix(options, input))","function2_name":"create_autocomplete_options","tests":"def check(candidate):\n assert candidate('mac', ['machanic', 'machine', 'mad', 'sort']) == ['machanic', 'machine']\n assert candidate('le', ['learning', 'lora', 'lecun', 'lemon']) == ['learning', 'lecun', 'lemon']\n assert candidate('program', ['array', 'bolt', 'programming', 'program']) == ['program', 'programming']\n\ndef test_check():\n check(create_autocomplete_options)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def get_positive(l: List[int]) -> List[int]:\n \"\"\"Return only positive numbers in the list.\n >>> get_positive([-1, 2, -4, 5, 6])\n [2, 5, 6]\n >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n [5, 3, 2, 3, 9, 123, 1]\n \"\"\"","function1_human":"def get_positive(l: List[int]) -> List[int]:\n \"\"\"Return only positive numbers in the list.\n >>> get_positive([-1, 2, -4, 5, 6])\n [2, 5, 6]\n >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n [5, 3, 2, 3, 9, 123, 1]\n \"\"\"\n return [e for e in l if e > 0]","function1_name":"get_positive","function2_signature":"def sum_positive(l: list) -> int:\n \"\"\"Return the sum of all positive numbers in the list.\n >>> sum_positive([-1, 2, -4, 5, 6])\n 13\n >>> sum_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n 146\n \"\"\"","function2_human":"def sum_positive(l: list) -> int:\n \"\"\"Return the sum of all positive numbers in the list.\n >>> sum_positive([-1, 2, -4, 5, 6])\n 13\n >>> sum_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n 146\n \"\"\"\n return sum(get_positive(l))","function2_name":"sum_positive","tests":"def check(candidate):\n assert candidate([40, 0, 4]) == 44\n assert candidate([-1, -2, -3, -4]) == 0\n assert candidate([7, -6, 10, -22, -1, 0]) == 17\n\ndef test_check():\n check(sum_positive)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def is_prime(n: int) -> bool:\n \"\"\"Return true if a given number is prime, and false otherwise.\n >>> is_prime(6)\n False\n >>> is_prime(101)\n True\n >>> is_prime(11)\n True\n >>> is_prime(13441)\n True\n >>> is_prime(61)\n True\n >>> is_prime(4)\n False\n >>> is_prime(1)\n False\n \"\"\"","function1_human":"def is_prime(n: int) -> bool:\n \"\"\"Return true if a given number is prime, and false otherwise.\n >>> is_prime(6)\n False\n >>> is_prime(101)\n True\n >>> is_prime(11)\n True\n >>> is_prime(13441)\n True\n >>> is_prime(61)\n True\n >>> is_prime(4)\n False\n >>> is_prime(1)\n False\n \"\"\"\n if n < 2:\n return False\n for k in range(2, n - 1):\n if n % k == 0:\n return False\n return True","function1_name":"is_prime","function2_signature":"def get_prime_times_prime(n: int) -> bool:\n \"\"\"Returns a sorted list of numbers less than n that are\n the product of two distinct primes.\n >>> get_number(6)\n []\n >>> get_number(20)\n [6, 10, 14, 15]\n \"\"\"","function2_human":"def get_prime_times_prime(n: int) -> bool:\n \"\"\"Returns a sorted list of numbers less than n that are\n the product of two distinct primes.\n >>> get_number(6)\n []\n >>> get_number(20)\n [6, 10, 14, 15]\n \"\"\"\n primes = [i for i in range(2, n) if is_prime(i)]\n results = []\n for i in range(len(primes)):\n for j in range(i + 1, len(primes)):\n if primes[i] * primes[j] < n:\n results.append(primes[i] * primes[j])\n return sorted(results)","function2_name":"get_prime_times_prime","tests":"def check(candidate):\n assert candidate(35) == [6, 10, 14, 15, 21, 22, 26, 33, 34]\n assert candidate(49) == [6, 10, 14, 15, 21, 22, 26, 33, 34, 35, 38, 39, 46]\n assert candidate(100) == [6, 10, 14, 15, 21, 22, 26, 33, 34, 35, 38, 39, 46, 51, 55, 57, 58, 62, 65, 69, 74, 77, 82, 85, 86, 87, 91, 93, 94, 95]\n\ndef test_check():\n check(get_prime_times_prime)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def sort_third(l: List[int]) -> List[int]:\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal\n to the values of the corresponding indicies of l, but sorted.\n >>> sort_third([1, 2, 3])\n [1, 2, 3]\n >>> sort_third([5, 6, 3, 4, 8, 9, 2])\n [2, 6, 3, 4, 8, 9, 5]\n \"\"\"","function1_human":"def sort_third(l: List[int]) -> List[int]:\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal\n to the values of the corresponding indicies of l, but sorted.\n >>> sort_third([1, 2, 3])\n [1, 2, 3]\n >>> sort_third([5, 6, 3, 4, 8, 9, 2])\n [2, 6, 3, 4, 8, 9, 5]\n \"\"\"\n l = list(l)\n l[::3] = sorted(l[::3])\n return l","function1_name":"sort_third","function2_signature":"def sort_first_column(l: List[List[int]]):\n \"\"\"This function takes an array of n by 3.\n It returns an array of N x 3 such that the elements in the first column are sorted.\n >>> sort_last_column([[1, 2, 3], [9, 6, 4], [5, 3, 2]])\n [[1, 2, 3], [5, 6, 4], [9, 3, 2]]\n >>> sort_last_column([[8, 9, 8], [6, 6, 6], [2, 9, 1]])\n [[2, 9, 8], [6, 6, 6], [8, 9, 1]]\n \"\"\"","function2_human":"def sort_first_column(l: List[List[int]]):\n \"\"\"This function takes an array of n by 3.\n It returns an array of N x 3 such that the elements in the first column are sorted.\n >>> sort_last_column([[1, 2, 3], [9, 6, 4], [5, 3, 2]])\n [[1, 2, 3], [5, 6, 4], [9, 3, 2]]\n >>> sort_last_column([[8, 9, 8], [6, 6, 6], [2, 9, 1]])\n [[2, 9, 8], [6, 6, 6], [8, 9, 1]]\n \"\"\"\n l = [y for x in l for y in x]\n l = sort_third(l)\n return [[l[3 * i], l[3 * i + 1], l[3 * i + 2]] for i in range(len(l) \/\/ 3)]","function2_name":"sort_first_column","tests":"def check(candidate):\n assert candidate([[5, 9, 2], [4, 3, 11], [2, 67, 4]]) == [[2, 9, 2], [4, 3, 11], [5, 67, 4]]\n assert candidate([[32, 5, 7], [25, 4, 32]]) == [[25, 5, 7], [32, 4, 32]]\n assert candidate([[4, 8, 3], [9, 5, 2], [1, 5, 2], [5, 5, 8]]) == [[1, 8, 3], [4, 5, 2], [5, 5, 2], [9, 5, 8]]\n\ndef test_check():\n check(sort_first_column)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def max_element(l: List[int]) -> int:\n \"\"\"Return maximum element in the list.\n >>> max_element([1, 2, 3])\n 3\n >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n 123\n \"\"\"","function1_human":"def max_element(l: List[int]) -> int:\n \"\"\"Return maximum element in the list.\n >>> max_element([1, 2, 3])\n 3\n >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n 123\n \"\"\"\n m = l[0]\n for e in l:\n if e > m:\n m = e\n return m","function1_name":"max_element","function2_signature":"def max_element_nested_list(l: list):\n \"\"\"Return maximum element in a nested list.\n l could be nested by any depth.\n >>> max_element_nested_list([1, 2, 3])\n 3\n >>> max_element_nested_list([[5, 3], [[-5], [2, -3, 3], [[9, 0], [123]], 1], -10])\n 123\n \"\"\"","function2_human":"def max_element_nested_list(l: list):\n \"\"\"Return maximum element in a nested list.\n l could be nested by any depth.\n >>> max_element_nested_list([1, 2, 3])\n 3\n >>> max_element_nested_list([[5, 3], [[-5], [2, -3, 3], [[9, 0], [123]], 1], -10])\n 123\n \"\"\"\n return max_element([max_element_nested_list(e) if isinstance(e, list) else e for e in l])","function2_name":"max_element_nested_list","tests":"def check(candidate):\n assert candidate([[1, 2], [3], [[4], [5, 6]]]) == 6\n assert candidate([[[[6]], [5, 4, 3, 2], [1]], 0]) == 6\n assert candidate([53, [23, [34, 23], [22, 15, 52]]]) == 53\n\ndef test_check():\n check(max_element_nested_list)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def fizz_buzz(n: int) -> int:\n \"\"\"Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.\n >>> fizz_buzz(50)\n 0\n >>> fizz_buzz(78)\n 2\n >>> fizz_buzz(79)\n 3\n \"\"\"","function1_human":"def fizz_buzz(n: int) -> int:\n \"\"\"Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.\n >>> fizz_buzz(50)\n 0\n >>> fizz_buzz(78)\n 2\n >>> fizz_buzz(79)\n 3\n \"\"\"\n ns = []\n for i in range(n):\n if i % 11 == 0 or i % 13 == 0:\n ns.append(i)\n s = ''.join(list(map(str, ns)))\n ans = 0\n for c in s:\n ans += c == '7'\n return ans","function1_name":"fizz_buzz","function2_signature":"def lucky_number(k: int) -> int:\n \"\"\"Return the smallest non-negative number n that the digit 7 appears at\n least k times in integers less than n which are divisible by 11 or 13.\n >>> lucky_number(3)\n 79\n >>> lucky_number(0)\n 0\n \"\"\"","function2_human":"def lucky_number(k: int) -> int:\n \"\"\"Return the smallest non-negative number n that the digit 7 appears at\n least k times in integers less than n which are divisible by 11 or 13.\n >>> lucky_number(3)\n 79\n >>> lucky_number(0)\n 0\n \"\"\"\n n = 0\n while fizz_buzz(n) < k:\n n += 1\n return n","function2_name":"lucky_number","tests":"def check(candidate):\n assert candidate(1) == 78\n assert candidate(2) == 78\n assert candidate(4) == 118\n\ndef test_check():\n check(lucky_number)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def sort_even(l: list[int]) -> list[int]:\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the odd indicies, while its values at the\n even indicies are equal to the values of the even indicies of l,\n but sorted.\n >>> sort_even([1, 2, 3])\n [1, 2, 3]\n >>> sort_even([5, 6, 3, 4])\n [3, 6, 5, 4]\n \"\"\"","function1_human":"def sort_even(l: list[int]) -> list[int]:\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the odd indicies, while its values at the\n even indicies are equal to the values of the even indicies of l,\n but sorted.\n >>> sort_even([1, 2, 3])\n [1, 2, 3]\n >>> sort_even([5, 6, 3, 4])\n [3, 6, 5, 4]\n \"\"\"\n evens = l[::2]\n odds = l[1::2]\n evens.sort()\n ans = []\n for (e, o) in zip(evens, odds):\n ans.extend([e, o])\n if len(evens) > len(odds):\n ans.append(evens[-1])\n return ans","function1_name":"sort_even","function2_signature":"def paired_sort(l: list[int]) -> list[int]:\n \"\"\"This function takes a list l and returns a list l' such that\n l' is sorted to l in the odd indicies, also its values at the\n even indicies are equal to the values of the even indicies of l,\n but sorted.\n >>> sort_even([1, 2, 3])\n [1, 2, 3]\n >>> sort_even([5, 6, 3, 4])\n [3, 4, 5, 6]\n \"\"\"","function2_human":"def paired_sort(l: list[int]) -> list[int]:\n \"\"\"This function takes a list l and returns a list l' such that\n l' is sorted to l in the odd indicies, also its values at the\n even indicies are equal to the values of the even indicies of l,\n but sorted.\n >>> sort_even([1, 2, 3])\n [1, 2, 3]\n >>> sort_even([5, 6, 3, 4])\n [3, 4, 5, 6]\n \"\"\"\n l = [l[0]] + sort_even(l[1:])\n l = sort_even(l)\n return l","function2_name":"paired_sort","tests":"def check(candidate):\n assert candidate([5, 2, 4, 3]) == [4, 2, 5, 3]\n assert candidate([5, 4, 8, 6, 4, 2]) == [4, 2, 5, 4, 8, 6]\n assert candidate([1, 7, 8, 9, 4, 3, 8]) == [1, 3, 4, 7, 8, 9, 8]\n\ndef test_check():\n check(paired_sort)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def prime_fib(n: int) -> int:\n \"\"\"\n prime_fib returns n-th number that is a Fibonacci number and it's also prime.\n >>> prime_fib(1)\n 2\n >>> prime_fib(2)\n 3\n >>> prime_fib(3)\n 5\n >>> prime_fib(4)\n 13\n >>> prime_fib(5)\n 89\n \"\"\"","function1_human":"def prime_fib(n: int) -> int:\n \"\"\"\n prime_fib returns n-th number that is a Fibonacci number and it's also prime.\n >>> prime_fib(1)\n 2\n >>> prime_fib(2)\n 3\n >>> prime_fib(3)\n 5\n >>> prime_fib(4)\n 13\n >>> prime_fib(5)\n 89\n \"\"\"\n import math\n\n def is_prime(p):\n if p < 2:\n return False\n for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):\n if p % k == 0:\n return False\n return True\n f = [0, 1]\n while True:\n f.append(f[-1] + f[-2])\n if is_prime(f[-1]):\n n -= 1\n if n == 0:\n return f[-1]","function1_name":"prime_fib","function2_signature":"def prime_fib_diff(n: int):\n \"\"\"Return the difference between the n-th number that is a Fibonacci number and\n it's also prime and the (n+1)-th number that is a Fibonacci number and it's also prime.\n >>> prime_fib_dif(1)\n 1\n >>> prime_fib_dif(2)\n 2\n >>> prime_fib_dif(3)\n 8\n >>> prime_fib_dif(4)\n 76\n \"\"\"","function2_human":"def prime_fib_diff(n: int):\n \"\"\"Return the difference between the n-th number that is a Fibonacci number and\n it's also prime and the (n+1)-th number that is a Fibonacci number and it's also prime.\n >>> prime_fib_dif(1)\n 1\n >>> prime_fib_dif(2)\n 2\n >>> prime_fib_dif(3)\n 8\n >>> prime_fib_dif(4)\n 76\n \"\"\"\n return prime_fib(n + 1) - prime_fib(n)","function2_name":"prime_fib_diff","tests":"def check(candidate):\n assert candidate(8) == 485572\n assert candidate(3) == 8\n assert candidate(10) == 2537720636\n\ndef test_check():\n check(prime_fib_diff)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def triples_sum_to_zero(l: list[int]) -> bool:\n \"\"\"\n triples_sum_to_zero takes a list of integers as an input.\n it returns True if there are three distinct elements in the list that\n sum to zero, and False otherwise.\n\n >>> triples_sum_to_zero([1, 3, 5, 0])\n False\n >>> triples_sum_to_zero([1, 3, -2, 1])\n True\n >>> triples_sum_to_zero([1, 2, 3, 7])\n False\n >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])\n True\n >>> triples_sum_to_zero([1])\n False\n \"\"\"","function1_human":"def triples_sum_to_zero(l: list[int]) -> bool:\n \"\"\"\n triples_sum_to_zero takes a list of integers as an input.\n it returns True if there are three distinct elements in the list that\n sum to zero, and False otherwise.\n\n >>> triples_sum_to_zero([1, 3, 5, 0])\n False\n >>> triples_sum_to_zero([1, 3, -2, 1])\n True\n >>> triples_sum_to_zero([1, 2, 3, 7])\n False\n >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])\n True\n >>> triples_sum_to_zero([1])\n False\n \"\"\"\n for i in range(len(l)):\n for j in range(i + 1, len(l)):\n for k in range(j + 1, len(l)):\n if l[i] + l[j] + l[k] == 0:\n return True\n return False","function1_name":"triples_sum_to_zero","function2_signature":"def get_shortest_prefix_triples_sum_to_zero(l: list) -> list:\n \"\"\"\n get_shortest_prefix_triples_sum_to_zero takes a list of integers as an input.\n it returns the shortest prefix of the list such that there are three distinct elements in the prefix that\n sum to zero, and an empty list if no such prefix exists.\n\n >>> get_shortest_prefix_triples_sum_to_zero([1, 3, 5, 0])\n []\n >>> get_shortest_prefix_triples_sum_to_zero([1, 3, -2, 1])\n [1, 3, -2]\n >>> get_shortest_prefix_triples_sum_to_zero([1, 2, 3, 7])\n []\n >>> get_shortest_prefix_triples_sum_to_zero([2, 4, -5, 3, 9, 7])\n [2, 4, -5, 3]\n >>> get_shortest_prefix_triples_sum_to_zero([1])\n []\n \"\"\"","function2_human":"def get_shortest_prefix_triples_sum_to_zero(l: list) -> list:\n \"\"\"\n get_shortest_prefix_triples_sum_to_zero takes a list of integers as an input.\n it returns the shortest prefix of the list such that there are three distinct elements in the prefix that\n sum to zero, and an empty list if no such prefix exists.\n\n >>> get_shortest_prefix_triples_sum_to_zero([1, 3, 5, 0])\n []\n >>> get_shortest_prefix_triples_sum_to_zero([1, 3, -2, 1])\n [1, 3, -2]\n >>> get_shortest_prefix_triples_sum_to_zero([1, 2, 3, 7])\n []\n >>> get_shortest_prefix_triples_sum_to_zero([2, 4, -5, 3, 9, 7])\n [2, 4, -5, 3]\n >>> get_shortest_prefix_triples_sum_to_zero([1])\n []\n \"\"\"\n for i in range(1, len(l) + 1):\n if triples_sum_to_zero(l[:i]):\n return l[:i]\n return []","function2_name":"get_shortest_prefix_triples_sum_to_zero","tests":"def check(candidate):\n assert candidate([4, 8, 8, -16, 3]) == [4, 8, 8, -16]\n assert candidate([-5, 2, 2, 1, 0]) == []\n assert candidate([3, 2, -9, -8, 6, 7]) == [3, 2, -9, -8, 6]\n\ndef test_check():\n check(get_shortest_prefix_triples_sum_to_zero)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def car_race_collision(n: int) -> int:\n \"\"\"\n Imagine a road that's a perfectly straight infinitely long line.\n n cars are driving left to right; simultaneously, a different set of n cars\n are driving right to left. The two sets of cars start out being very far from\n each other. All cars move in the same speed. Two cars are said to collide\n when a car that's moving left to right hits a car that's moving right to left.\n However, the cars are infinitely sturdy and strong; as a result, they continue moving\n in their trajectory as if they did not collide.\n\n This function outputs the number of such collisions.\n \"\"\"","function1_human":"def car_race_collision(n: int) -> int:\n \"\"\"\n Imagine a road that's a perfectly straight infinitely long line.\n n cars are driving left to right; simultaneously, a different set of n cars\n are driving right to left. The two sets of cars start out being very far from\n each other. All cars move in the same speed. Two cars are said to collide\n when a car that's moving left to right hits a car that's moving right to left.\n However, the cars are infinitely sturdy and strong; as a result, they continue moving\n in their trajectory as if they did not collide.\n\n This function outputs the number of such collisions.\n \"\"\"\n return n ** 2","function1_name":"car_race_collision","function2_signature":"def ball_collision(n: int):\n \"\"\"Imagine a road that's a perfectly straight infinitely long line.\n n balls are rolling left to right; simultaneously, a different set of n balls\n are rolling right to left. The two sets of balls start out being very far from\n each other. All balls move in the same speed. Two balls are said to collide\n when a ball that's moving left to right hits a ball that's moving right to left.\n However, the balls are infinitely sturdy and strong; as a result, they continue moving\n in their trajectory as if they did not collide.\n\n This function outputs the number of such collisions.\n \"\"\"","function2_human":"def ball_collision(n: int):\n \"\"\"Imagine a road that's a perfectly straight infinitely long line.\n n balls are rolling left to right; simultaneously, a different set of n balls\n are rolling right to left. The two sets of balls start out being very far from\n each other. All balls move in the same speed. Two balls are said to collide\n when a ball that's moving left to right hits a ball that's moving right to left.\n However, the balls are infinitely sturdy and strong; as a result, they continue moving\n in their trajectory as if they did not collide.\n\n This function outputs the number of such collisions.\n \"\"\"\n return car_race_collision(n)","function2_name":"ball_collision","tests":"def check(candidate):\n assert candidate(15) == 225\n assert candidate(4) == 16\n assert candidate(9) == 81\n\ndef test_check():\n check(ball_collision)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def incr_list(l: list[int]) -> list[int]:\n \"\"\"Return list with elements incremented by 1.\n >>> incr_list([1, 2, 3])\n [2, 3, 4]\n >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [6, 4, 6, 3, 4, 4, 10, 1, 124]\n \"\"\"","function1_human":"def incr_list(l: list[int]) -> list[int]:\n \"\"\"Return list with elements incremented by 1.\n >>> incr_list([1, 2, 3])\n [2, 3, 4]\n >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [6, 4, 6, 3, 4, 4, 10, 1, 124]\n \"\"\"\n return [e + 1 for e in l]","function1_name":"incr_list","function2_signature":"def incr_sublist(l: list, start: int, end: int):\n \"\"\"Return list that the element in the sublist from\n `start` (inclusive) to `end` (exclusive) incremented by 1.\n >>> incr_until_10([1, 2, 3], 0, 2)\n [2, 3, 3]\n >>> incr_until_10([5, 3, 5, 2, 3, 3, 9, 0, 123], 3, 7)\n [5, 3, 5, 3, 4, 4, 10, 0, 123]\n \"\"\"","function2_human":"def incr_sublist(l: list, start: int, end: int):\n \"\"\"Return list that the element in the sublist from\n `start` (inclusive) to `end` (exclusive) incremented by 1.\n >>> incr_until_10([1, 2, 3], 0, 2)\n [2, 3, 3]\n >>> incr_until_10([5, 3, 5, 2, 3, 3, 9, 0, 123], 3, 7)\n [5, 3, 5, 3, 4, 4, 10, 0, 123]\n \"\"\"\n return l[:start] + incr_list(l[start:end]) + l[end:]","function2_name":"incr_sublist","tests":"def check(candidate):\n assert candidate([3, 6, 32, 6, 8, 8], 2, 6) == [3, 6, 33, 7, 9, 9]\n assert candidate([8, 1, 5, 2, 7, 89, 9, 5, 4], 4, 8) == [8, 1, 5, 2, 8, 90, 10, 6, 4]\n assert candidate([1, 56, 5, 24, 9, 45, 6, 34], 3, 4) == [1, 56, 5, 25, 9, 45, 6, 34]\n\ndef test_check():\n check(incr_sublist)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def pairs_sum_to_zero(l: List[int]) -> bool:\n \"\"\"\n pairs_sum_to_zero takes a list of integers as an input.\n it returns True if there are two distinct elements in the list that\n sum to zero, and False otherwise.\n >>> pairs_sum_to_zero([1, 3, 5, 0])\n False\n >>> pairs_sum_to_zero([1, 3, -2, 1])\n False\n >>> pairs_sum_to_zero([1, 2, 3, 7])\n False\n >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])\n True\n >>> pairs_sum_to_zero([1])\n False\n \"\"\"","function1_human":"def pairs_sum_to_zero(l: List[int]) -> bool:\n \"\"\"\n pairs_sum_to_zero takes a list of integers as an input.\n it returns True if there are two distinct elements in the list that\n sum to zero, and False otherwise.\n >>> pairs_sum_to_zero([1, 3, 5, 0])\n False\n >>> pairs_sum_to_zero([1, 3, -2, 1])\n False\n >>> pairs_sum_to_zero([1, 2, 3, 7])\n False\n >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])\n True\n >>> pairs_sum_to_zero([1])\n False\n \"\"\"\n for (i, l1) in enumerate(l):\n for j in range(i + 1, len(l)):\n if l1 + l[j] == 0:\n return True\n return False","function1_name":"pairs_sum_to_zero","function2_signature":"def triple_sum_to_zero_with_zero(l):\n \"\"\"triple_sum_to_zero_with_zero takes a list of integers as an input.\n it returns True if there are three distinct elements in the list that\n sum to zero and one of elements must be zero, and False otherwise.\n >>> triple_sum_to_zero_with_zero([1, 3, -1, 0])\n True\n >>> triple_sum_to_zero_with_zero([1, 3, -2, 1])\n False\n >>> triple_sum_to_zero_with_zero([1, 2, 3, 7])\n False\n >>> triple_sum_to_zero_with_zero([2, 4, -5, 0, 3, 5, 7])\n True\n >>> triple_sum_to_zero_with_zero([1])\n False\n \"\"\"","function2_human":"def triple_sum_to_zero_with_zero(l):\n \"\"\"triple_sum_to_zero_with_zero takes a list of integers as an input.\n it returns True if there are three distinct elements in the list that\n sum to zero and one of elements must be zero, and False otherwise.\n >>> triple_sum_to_zero_with_zero([1, 3, -1, 0])\n True\n >>> triple_sum_to_zero_with_zero([1, 3, -2, 1])\n False\n >>> triple_sum_to_zero_with_zero([1, 2, 3, 7])\n False\n >>> triple_sum_to_zero_with_zero([2, 4, -5, 0, 3, 5, 7])\n True\n >>> triple_sum_to_zero_with_zero([1])\n False\n \"\"\"\n if 0 not in l:\n return False\n else:\n l.remove(0)\n return pairs_sum_to_zero(l)","function2_name":"triple_sum_to_zero_with_zero","tests":"def check(candidate):\n assert candidate([3, 6, 32, 6, 8, 8]) == False\n assert candidate([-8, 1, 0, -5, 2, 7, -89, 9, 5, -4]) == True\n assert candidate([1, 0, 56, -5, -24, 9, -45, 6, 34]) == False\n\ndef test_check():\n check(triple_sum_to_zero_with_zero)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def change_base(x: int, base: int) -> str:\n \"\"\"Change numerical base of input number x to base.\n return string representation after the conversion.\n base numbers are less than 10.\n >>> change_base(8, 3)\n '22'\n >>> change_base(8, 2)\n '1000'\n >>> change_base(7, 2)\n '111'\n \"\"\"","function1_human":"def change_base(x: int, base: int) -> str:\n \"\"\"Change numerical base of input number x to base.\n return string representation after the conversion.\n base numbers are less than 10.\n >>> change_base(8, 3)\n '22'\n >>> change_base(8, 2)\n '1000'\n >>> change_base(7, 2)\n '111'\n \"\"\"\n ret = ''\n while x > 0:\n ret = str(x % base) + ret\n x \/\/= base\n return ret","function1_name":"change_base","function2_signature":"def change_base_extension(n: str, base_from: int, base_to: int) -> str:\n \"\"\"Change numerical base of input number n represented as string from base_from to base_to.\n return string representation after the conversion.\n base numbers are less than 10.\n >>> change_base_extension('22', 3, 2)\n '1000'\n >>> change_base_extension('1000', 2, 3)\n '22'\n >>> change_base_extension('111', 2, 10)\n '7'\n \"\"\"","function2_human":"def change_base_extension(n: str, base_from: int, base_to: int) -> str:\n \"\"\"Change numerical base of input number n represented as string from base_from to base_to.\n return string representation after the conversion.\n base numbers are less than 10.\n >>> change_base_extension('22', 3, 2)\n '1000'\n >>> change_base_extension('1000', 2, 3)\n '22'\n >>> change_base_extension('111', 2, 10)\n '7'\n \"\"\"\n return change_base(int(n, base_from), base_to)","function2_name":"change_base_extension","tests":"def check(candidate):\n assert candidate('43', 7, 2) == '11111'\n assert candidate('101101', 2, 4) == '231'\n assert candidate('3128', 10, 5) == '100003'\n\ndef test_check():\n check(change_base_extension)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"import math","function1_signature":"def triangle_area(a: int, h: int) -> float:\n \"\"\"Given length of a side and high return area for a triangle.\n >>> triangle_area(5, 3)\n 7.5\n \"\"\"","function1_human":"def triangle_area(a: int, h: int) -> float:\n \"\"\"Given length of a side and high return area for a triangle.\n >>> triangle_area(5, 3)\n 7.5\n \"\"\"\n return a * h \/ 2.0","function1_name":"triangle_area","function2_signature":"def equilaternal_triangle_area(a):\n \"\"\"Given length of a side return area for an equilaternal triangle.\n >>> round(equilaternal_triangle_area(5), 2)\n 10.83\n \"\"\"","function2_human":"def equilaternal_triangle_area(a):\n \"\"\"Given length of a side return area for an equilaternal triangle.\n >>> round(equilaternal_triangle_area(5), 2)\n 10.83\n \"\"\"\n return triangle_area(a, a * math.sqrt(3) \/ 2.0)","function2_name":"equilaternal_triangle_area","tests":"def check(candidate):\n assert round(candidate(3.5), 2) == 5.3\n assert round(candidate(10), 2) == 43.3\n assert round(candidate(7.8), 2) == 26.34\n\ndef test_check():\n check(equilaternal_triangle_area)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def fib4(n: int) -> int:\n \"\"\"The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n fib4(0) -> 0\n fib4(1) -> 0\n fib4(2) -> 2\n fib4(3) -> 0\n fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).\n Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.\n >>> fib4(5)\n 4\n >>> fib4(6)\n 8\n >>> fib4(7)\n 14\n \"\"\"","function1_human":"def fib4(n: int) -> int:\n \"\"\"The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n fib4(0) -> 0\n fib4(1) -> 0\n fib4(2) -> 2\n fib4(3) -> 0\n fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).\n Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.\n >>> fib4(5)\n 4\n >>> fib4(6)\n 8\n >>> fib4(7)\n 14\n \"\"\"\n results = [0, 0, 2, 0]\n if n < 4:\n return results[n]\n for _ in range(4, n + 1):\n results.append(results[-1] + results[-2] + results[-3] + results[-4])\n results.pop(0)\n return results[-1]","function1_name":"fib4","function2_signature":"def fib2_to_4(n: int):\n \"\"\"Return the n-th value of sequence defined by the following recurrence relation.\n fib2_to_4(0) -> 0\n fib2_to_4(1) -> 1\n fib2_to_4(n) -> fib4(n) if n is even\n fib2_to_4(n) -> fib2_to_4(n-1) + fib2_to_4(n-2) if n is odd\n >>> fib2_to_4(5)\n 8\n >>> fib2_to_4(0)\n 0\n >>> get_smallest_fib4_number(10)\n 14\n \"\"\"","function2_human":"def fib2_to_4(n: int):\n \"\"\"Return the n-th value of sequence defined by the following recurrence relation.\n fib2_to_4(0) -> 0\n fib2_to_4(1) -> 1\n fib2_to_4(n) -> fib4(n) if n is even\n fib2_to_4(n) -> fib2_to_4(n-1) + fib2_to_4(n-2) if n is odd\n >>> fib2_to_4(5)\n 8\n >>> fib2_to_4(0)\n 0\n >>> get_smallest_fib4_number(10)\n 14\n \"\"\"\n if n < 2:\n return n\n if n % 2 == 0:\n return fib4(n)\n else:\n return fib2_to_4(n - 1) + fib2_to_4(n - 2)","function2_name":"fib2_to_4","tests":"def check(candidate):\n assert candidate(4) == 2\n assert candidate(8) == 28\n assert candidate(11) == 145\n\ndef test_check():\n check(fib2_to_4)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def median(l: List[int]) -> float:\n \"\"\"Return median of elements in the list l.\n >>> median([3, 1, 2, 4, 5])\n 3\n >>> median([-10, 4, 6, 1000, 10, 20])\n 15.0\n \"\"\"","function1_human":"def median(l: List[int]) -> float:\n \"\"\"Return median of elements in the list l.\n >>> median([3, 1, 2, 4, 5])\n 3\n >>> median([-10, 4, 6, 1000, 10, 20])\n 15.0\n \"\"\"\n l = sorted(l)\n if len(l) % 2 == 1:\n return l[len(l) \/\/ 2]\n else:\n return (l[len(l) \/\/ 2 - 1] + l[len(l) \/\/ 2]) \/ 2.0","function1_name":"median","function2_signature":"def is_skewed(l: list):\n \"\"\"Return \"positive\" if the list l is positive skewed, \"negative\" if the list l is negative skewed.\n Otherwise, return \"neutral\".\n A distribution with negative skew can have its mean greater than the median.\n A distribution with positive skew can have its mean less than the median.\n >>> is_skewed([1, 2, 3, 4, 5])\n \"neutral\"\n >>> is_skewed([-10, 4, 6, 1000, 10, 20])\n \"positive\"\n \"\"\"","function2_human":"def is_skewed(l: list):\n \"\"\"Return \"positive\" if the list l is positive skewed, \"negative\" if the list l is negative skewed.\n Otherwise, return \"neutral\".\n A distribution with negative skew can have its mean greater than the median.\n A distribution with positive skew can have its mean less than the median.\n >>> is_skewed([1, 2, 3, 4, 5])\n \"neutral\"\n >>> is_skewed([-10, 4, 6, 1000, 10, 20])\n \"positive\"\n \"\"\"\n median_val = median(l)\n mean_val = sum(l) \/ len(l)\n if mean_val > median_val:\n return 'positive'\n elif mean_val < median_val:\n return 'negative'\n else:\n return 'neutral'","function2_name":"is_skewed","tests":"def check(candidate):\n assert candidate([1, 1, 1, 1, 1]) == 'neutral'\n assert candidate([3, 4, 8, 9, 10]) == 'negative'\n assert candidate([8, 3, 6, 2, 3, 4, 5, 7]) == 'positive'\n\ndef test_check():\n check(is_skewed)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def is_palindrome(text: str) -> bool:\n \"\"\"\n Checks if given string is a palindrome\n >>> is_palindrome('')\n True\n >>> is_palindrome('aba')\n True\n >>> is_palindrome('aaaaa')\n True\n >>> is_palindrome('zbcd')\n False\n \"\"\"","function1_human":"def is_palindrome(text: str) -> bool:\n \"\"\"\n Checks if given string is a palindrome\n >>> is_palindrome('')\n True\n >>> is_palindrome('aba')\n True\n >>> is_palindrome('aaaaa')\n True\n >>> is_palindrome('zbcd')\n False\n \"\"\"\n for i in range(len(text)):\n if text[i] != text[len(text) - 1 - i]:\n return False\n return True","function1_name":"is_palindrome","function2_signature":"def is_even_palidrome(s: str) -> bool:\n \"\"\"\n Checks if the chacters located in the even indices in the\n given string is a palindrome.\n >>> is_palindrome('')\n True\n >>> is_palindrome('aba')\n True\n >>> is_palindrome('acaaa')\n True\n >>> is_palindrome('zbcd')\n False\n \"\"\"","function2_human":"def is_even_palidrome(s: str) -> bool:\n \"\"\"\n Checks if the chacters located in the even indices in the\n given string is a palindrome.\n >>> is_palindrome('')\n True\n >>> is_palindrome('aba')\n True\n >>> is_palindrome('acaaa')\n True\n >>> is_palindrome('zbcd')\n False\n \"\"\"\n return is_palindrome(s[::2])","function2_name":"is_even_palidrome","tests":"def check(candidate):\n assert candidate('afbwccdhcebwa') == True\n assert candidate('dabbrctdscfbeaa') == False\n assert candidate('aabbcccybua') == True\n\ndef test_check():\n check(is_even_palidrome)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def modp(n: int, p: int) -> int:\n \"\"\"Return 2^n modulo p (be aware of numerics).\n >>> modp(3, 5)\n 3\n >>> modp(1101, 101)\n 2\n >>> modp(0, 101)\n 1\n >>> modp(3, 11)\n 8\n >>> modp(100, 101)\n 1\n \"\"\"","function1_human":"def modp(n: int, p: int) -> int:\n \"\"\"Return 2^n modulo p (be aware of numerics).\n >>> modp(3, 5)\n 3\n >>> modp(1101, 101)\n 2\n >>> modp(0, 101)\n 1\n >>> modp(3, 11)\n 8\n >>> modp(100, 101)\n 1\n \"\"\"\n ret = 1\n for i in range(n):\n ret = 2 * ret % p\n return ret","function1_name":"modp","function2_signature":"def modp4(n: int, p: int) -> int:\n \"\"\"Return 4^n modulo p (be aware of numerics).\n >>> modp4(3, 5)\n 4\n >>> modp4(1101, 101)\n \"\"\"","function2_human":"def modp4(n: int, p: int) -> int:\n \"\"\"Return 4^n modulo p (be aware of numerics).\n >>> modp4(3, 5)\n 4\n >>> modp4(1101, 101)\n \"\"\"\n return modp(2 * n, p)","function2_name":"modp4","tests":"def check(candidate):\n assert candidate(403, 22) == 20\n assert candidate(441, 2) == 0\n assert candidate(9, 9) == 1\n\ndef test_check():\n check(modp4)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def remove_vowels(text: str) -> str:\n \"\"\"\n remove_vowels is a function that takes string and returns string without vowels.\n >>> remove_vowels('')\n ''\n >>> remove_vowels('abcdef')\n 'bcdf'\n >>> remove_vowels('aaaaa')\n ''\n >>> remove_vowels('aaBAA')\n 'B'\n >>> remove_vowels('zbcd')\n 'zbcd'\n \"\"\"","function1_human":"def remove_vowels(text: str) -> str:\n \"\"\"\n remove_vowels is a function that takes string and returns string without vowels.\n >>> remove_vowels('')\n ''\n >>> remove_vowels('abcdef')\n 'bcdf'\n >>> remove_vowels('aaaaa')\n ''\n >>> remove_vowels('aaBAA')\n 'B'\n >>> remove_vowels('zbcd')\n 'zbcd'\n \"\"\"\n return ''.join([s for s in text if s.lower() not in ['a', 'e', 'i', 'o', 'u']])","function1_name":"remove_vowels","function2_signature":"def equal(text1: str, text2: str) -> bool:\n \"\"\"\n check if the non-vowel characters in text1 and the non-vowel characters in texts is equal or not.\n >>> count_vowels('apple', 'pple')\n True\n >>> count_vowels(\"pear\", \"par\")\n True\n >>> count_vowels(\"test\", \"text\")\n False\n \"\"\"","function2_human":"def equal(text1: str, text2: str) -> bool:\n \"\"\"\n check if the non-vowel characters in text1 and the non-vowel characters in texts is equal or not.\n >>> count_vowels('apple', 'pple')\n True\n >>> count_vowels(\"pear\", \"par\")\n True\n >>> count_vowels(\"test\", \"text\")\n False\n \"\"\"\n return remove_vowels(text1) == remove_vowels(text2)","function2_name":"equal","tests":"def check(candidate):\n assert candidate('coke', 'cake') == True\n assert candidate('desk', 'dust') == False\n assert candidate('pandas', 'aeponeedosi') == True\n\ndef test_check():\n check(equal)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def below_threshold(l: List[int], t: int) -> bool:\n \"\"\"Return True if all numbers in the list l are below threshold t.\n >>> below_threshold([1, 2, 4, 10], 100)\n True\n >>> below_threshold([1, 20, 4, 10], 5)\n False\n \"\"\"","function1_human":"def below_threshold(l: List[int], t: int) -> bool:\n \"\"\"Return True if all numbers in the list l are below threshold t.\n >>> below_threshold([1, 2, 4, 10], 100)\n True\n >>> below_threshold([1, 20, 4, 10], 5)\n False\n \"\"\"\n for e in l:\n if e >= t:\n return False\n return True","function1_name":"below_threshold","function2_signature":"def detect_high_blood_sugar(blood_sugar_graph: list) -> bool:\n \"\"\"Return True if the symptom of high blood sugar is detected in the blood sugar graph.\n High blood sugar rate means that the blood sugar level is above 100.\n High blood sugar is detected even if only one high blood sugar level is present.\n >>> blood_sugar_graph([65, 66, 70, 84, 81])\n False\n >>> blood_sugar_graph([65, 76, 81, 95, 101])\n True\n \"\"\"","function2_human":"def detect_high_blood_sugar(blood_sugar_graph: list) -> bool:\n \"\"\"Return True if the symptom of high blood sugar is detected in the blood sugar graph.\n High blood sugar rate means that the blood sugar level is above 100.\n High blood sugar is detected even if only one high blood sugar level is present.\n >>> blood_sugar_graph([65, 66, 70, 84, 81])\n False\n >>> blood_sugar_graph([65, 76, 81, 95, 101])\n True\n \"\"\"\n return not below_threshold(blood_sugar_graph, 100)","function2_name":"detect_high_blood_sugar","tests":"def check(candidate):\n assert round(candidate([77, 79, 75, 81, 82, 81, 84])) == False\n assert round(candidate([101, 102, 99, 95, 93, 90])) == True\n assert round(candidate([91, 95, 98, 101, 99])) == True\n\ndef test_check():\n check(detect_high_blood_sugar)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def fib(n: int) -> int:\n \"\"\"Return n-th Fibonacci number.\n >>> fib(10)\n 55\n >>> fib(1)\n 1\n >>> fib(8)\n 21\n \"\"\"","function1_human":"def fib(n: int) -> int:\n \"\"\"Return n-th Fibonacci number.\n >>> fib(10)\n 55\n >>> fib(1)\n 1\n >>> fib(8)\n 21\n \"\"\"\n if n == 0:\n return 0\n if n == 1:\n return 1\n return fib(n - 1) + fib(n - 2)","function1_name":"fib","function2_signature":"def sum_fib(n: int):\n \"\"\"Return sum of first n Fibonacci numbers.\n You can use this property: sum_{i=1}^{n} F_i = F_{n+2} - 1\n >>> sum_fib(8)\n 54\n >>> sum_fib(1)\n 1\n >>> sum_fib(6)\n 20\n \"\"\"","function2_human":"def sum_fib(n: int):\n \"\"\"Return sum of first n Fibonacci numbers.\n You can use this property: sum_{i=1}^{n} F_i = F_{n+2} - 1\n >>> sum_fib(8)\n 54\n >>> sum_fib(1)\n 1\n >>> sum_fib(6)\n 20\n \"\"\"\n return fib(n + 2) - 1","function2_name":"sum_fib","tests":"def check(candidate):\n assert candidate(3) == 4\n assert candidate(10) == 143\n assert candidate(7) == 33\n\ndef test_check():\n check(sum_fib)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def correct_bracketing(brackets: str) -> bool:\n \"\"\"brackets is a string of \"<\" and \">\".\n return True if every opening bracket has a corresponding closing bracket.\n\n >>> correct_bracketing('<')\n False\n >>> correct_bracketing('<>')\n True\n >>> correct_bracketing('<<><>>')\n True\n >>> correct_bracketing('><<>')\n False\n \"\"\"","function1_human":"def correct_bracketing(brackets: str) -> bool:\n \"\"\"brackets is a string of \"<\" and \">\".\n return True if every opening bracket has a corresponding closing bracket.\n\n >>> correct_bracketing('<')\n False\n >>> correct_bracketing('<>')\n True\n >>> correct_bracketing('<<><>>')\n True\n >>> correct_bracketing('><<>')\n False\n \"\"\"\n depth = 0\n for b in brackets:\n if b == '<':\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0","function1_name":"correct_bracketing","function2_signature":"def extended_correct_bracketing(brackets: str) -> bool:\n \"\"\"brackets is a string of \"<\", \"(\", \">\" and \")\".\n There is opening bracket \"<\" and \"(\" and closing bracket \">\", \")\".\n return True if every opening bracket has a corresponding closing bracket.\n Note that it is ok not to match the shape between opening bracket and closing bracket.\n For example, \"<)\" is also true.\n >>> extended_correct_bracketing(\"(>\")\n True\n >>> extended_correct_bracketing(\"(<)<<)>)\")\n True\n >>> extended_correct_bracketing(\"><)(<>)\")\n False\n \"\"\"","function2_human":"def extended_correct_bracketing(brackets: str) -> bool:\n \"\"\"brackets is a string of \"<\", \"(\", \">\" and \")\".\n There is opening bracket \"<\" and \"(\" and closing bracket \">\", \")\".\n return True if every opening bracket has a corresponding closing bracket.\n Note that it is ok not to match the shape between opening bracket and closing bracket.\n For example, \"<)\" is also true.\n >>> extended_correct_bracketing(\"(>\")\n True\n >>> extended_correct_bracketing(\"(<)<<)>)\")\n True\n >>> extended_correct_bracketing(\"><)(<>)\")\n False\n \"\"\"\n return correct_bracketing(brackets.replace('(', '<').replace(')', '>'))","function2_name":"extended_correct_bracketing","tests":"def check(candidate):\n assert candidate('(<(>)>') == True\n assert candidate('<<>)<()<>>') == True\n assert candidate('<<(<))<>))<>>') == False\n\ndef test_check():\n check(extended_correct_bracketing)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def monotonic(l: list[int]) -> bool:\n \"\"\"Return True is list elements are monotonically increasing or decreasing.\n >>> monotonic([1, 2, 4, 20])\n True\n >>> monotonic([1, 20, 4, 10])\n False\n >>> monotonic([4, 1, 0, -10])\n True\n \"\"\"","function1_human":"def monotonic(l: list[int]) -> bool:\n \"\"\"Return True is list elements are monotonically increasing or decreasing.\n >>> monotonic([1, 2, 4, 20])\n True\n >>> monotonic([1, 20, 4, 10])\n False\n >>> monotonic([4, 1, 0, -10])\n True\n \"\"\"\n if l == sorted(l) or l == sorted(l, reverse=True):\n return True\n return False","function1_name":"monotonic","function2_signature":"def monotonic_2d(arr: list[list[int]]) -> bool:\n \"\"\"Check if all rows and columns in the given array is monotonimally\n increasing or decreasing.\n Assume that the given array is rectangular.\n >>> monotonic_2d([[0, 1, 2], [3, 4, 5], [6, 7, 8]])\n True\n >>> monotonic_2d([[3, 5, 8], [2, 6, 9], [4, 7, 10]])\n False\n \"\"\"","function2_human":"def monotonic_2d(arr: list[list[int]]) -> bool:\n \"\"\"Check if all rows and columns in the given array is monotonimally\n increasing or decreasing.\n Assume that the given array is rectangular.\n >>> monotonic_2d([[0, 1, 2], [3, 4, 5], [6, 7, 8]])\n True\n >>> monotonic_2d([[3, 5, 8], [2, 6, 9], [4, 7, 10]])\n False\n \"\"\"\n for i in range(len(arr)):\n if not monotonic(arr[i]):\n return False\n for j in range(len(arr[0])):\n if not monotonic([arr[i][j] for i in range(len(arr))]):\n return False\n return True","function2_name":"monotonic_2d","tests":"def check(candidate):\n assert candidate([[4, 9, 13], [24, 19, 15], [25, 26, 27]]) == True\n assert candidate([[100, 0], [0, 100]]) == True\n assert candidate([[8, 6, 4], [8, 6, 4], [7, 8, 5]]) == False\n\ndef test_check():\n check(monotonic_2d)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def largest_prime_factor(n: int) -> int:\n \"\"\"Return the largest prime factor of n. Assume n > 1 and is not a prime.\n >>> largest_prime_factor(13195)\n 29\n >>> largest_prime_factor(2048)\n 2\n \"\"\"","function1_human":"def largest_prime_factor(n: int) -> int:\n \"\"\"Return the largest prime factor of n. Assume n > 1 and is not a prime.\n >>> largest_prime_factor(13195)\n 29\n >>> largest_prime_factor(2048)\n 2\n \"\"\"\n\n def is_prime(k):\n if k < 2:\n return False\n for i in range(2, k - 1):\n if k % i == 0:\n return False\n return True\n largest = 1\n for j in range(2, n + 1):\n if n % j == 0 and is_prime(j):\n largest = max(largest, j)\n return largest","function1_name":"largest_prime_factor","function2_signature":"def get_exponent_of_largest_prime_factor(n: int):\n \"\"\"Return the exponent of largest prime factor after factorizing n. Assume n > 1 and is not a prime.\n >>> get_exponent_of_largest_prime_factor(13195) # 13195 = 5 * 7 * 13 * 29\n 1\n >>> get_exponent_of_largest_prime_factor(2048) # 2048 = 2^11\n 11\n \"\"\"","function2_human":"def get_exponent_of_largest_prime_factor(n: int):\n \"\"\"Return the exponent of largest prime factor after factorizing n. Assume n > 1 and is not a prime.\n >>> get_exponent_of_largest_prime_factor(13195) # 13195 = 5 * 7 * 13 * 29\n 1\n >>> get_exponent_of_largest_prime_factor(2048) # 2048 = 2^11\n 11\n \"\"\"\n largest = largest_prime_factor(n)\n ans = 1\n while largest_prime_factor(n \/\/ largest) == largest:\n ans += 1\n n = n \/\/ largest\n return ans","function2_name":"get_exponent_of_largest_prime_factor","tests":"def check(candidate):\n assert candidate(162) == 4\n assert candidate(506250) == 5\n assert candidate(1071875) == 3\n\ndef test_check():\n check(get_exponent_of_largest_prime_factor)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def derivative(xs: list[int]) -> list[int]:\n \"\"\"xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return derivative of this polynomial in the same form.\n >>> derivative([3, 1, 2, 4, 5])\n [1, 4, 12, 20]\n >>> derivative([1, 2, 3])\n [2, 6]\n \"\"\"","function1_human":"def derivative(xs: list[int]) -> list[int]:\n \"\"\"xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return derivative of this polynomial in the same form.\n >>> derivative([3, 1, 2, 4, 5])\n [1, 4, 12, 20]\n >>> derivative([1, 2, 3])\n [2, 6]\n \"\"\"\n return [i * x for (i, x) in enumerate(xs)][1:]","function1_name":"derivative","function2_signature":"def second_derivative(xs: list[int]) -> list[int]:\n \"\"\"xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return second derivative of this polynomial in the same form.\n >>> derivative([3, 1, 2, 4, 5])\n [4, 24, 60]\n >>> derivative([1, 2, 3])\n [6]\n \"\"\"","function2_human":"def second_derivative(xs: list[int]) -> list[int]:\n \"\"\"xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return second derivative of this polynomial in the same form.\n >>> derivative([3, 1, 2, 4, 5])\n [4, 24, 60]\n >>> derivative([1, 2, 3])\n [6]\n \"\"\"\n return derivative(derivative(xs))","function2_name":"second_derivative","tests":"def check(candidate):\n assert candidate([4, 9, 5, 2]) == [10, 12]\n assert candidate([9, 8, 2, 5, 3]) == [4, 30, 36]\n assert candidate([10, 8, 43, 4, 23, 4]) == [86, 24, 276, 80]\n\ndef test_check():\n check(second_derivative)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def vowels_count(s: str) -> int:\n \"\"\"Write a function vowels_count which takes a string representing\n a word as input and returns the number of vowels in the string.\n Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a\n vowel, but only when it is at the end of the given word.\n\n Example:\n >>> vowels_count('abcde')\n 2\n >>> vowels_count('ACEDY')\n 3\n \"\"\"","function1_human":"def vowels_count(s: str) -> int:\n \"\"\"Write a function vowels_count which takes a string representing\n a word as input and returns the number of vowels in the string.\n Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a\n vowel, but only when it is at the end of the given word.\n\n Example:\n >>> vowels_count('abcde')\n 2\n >>> vowels_count('ACEDY')\n 3\n \"\"\"\n vowels = 'aeiouAEIOU'\n n_vowels = sum((c in vowels for c in s))\n if s[-1] == 'y' or s[-1] == 'Y':\n n_vowels += 1\n return n_vowels","function1_name":"vowels_count","function2_signature":"def is_vowel_enough(s: str) -> bool:\n \"\"\"Check if the given string contains at least 30% of vowels.\n >>> is_vowel_enough(\"abcde\")\n True\n >>> is_vowel_enough(\"abc\")\n False\n \"\"\"","function2_human":"def is_vowel_enough(s: str) -> bool:\n \"\"\"Check if the given string contains at least 30% of vowels.\n >>> is_vowel_enough(\"abcde\")\n True\n >>> is_vowel_enough(\"abc\")\n False\n \"\"\"\n return vowels_count(s) \/ len(s) >= 0.3","function2_name":"is_vowel_enough","tests":"def check(candidate):\n assert candidate('Eulogia') == True\n assert candidate('Drain') == True\n assert candidate('hardship') == False\n\ndef test_check():\n check(is_vowel_enough)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def circular_shift(x: int, shift: int) -> str:\n \"\"\"Circular shift the digits of the integer x, shift the digits right by shift\n and return the result as a string.\n If shift > number of digits, return digits reversed.\n >>> circular_shift(12, 1)\n '21'\n >>> circular_shift(12, 2)\n '12'\n \"\"\"","function1_human":"def circular_shift(x: int, shift: int) -> str:\n \"\"\"Circular shift the digits of the integer x, shift the digits right by shift\n and return the result as a string.\n If shift > number of digits, return digits reversed.\n >>> circular_shift(12, 1)\n '21'\n >>> circular_shift(12, 2)\n '12'\n \"\"\"\n s = str(x)\n if shift > len(s):\n return s[::-1]\n else:\n return s[len(s) - shift:] + s[:len(s) - shift]","function1_name":"circular_shift","function2_signature":"def is_circular_same(x: int, y: int) -> bool:\n \"\"\"Return True if x and y are circularly same, False otherwise.\n Circulary same means that any of circular shift of x is equal\n to any of circular shift of y.\n\n >>> is_circular_same(12, 21)\n True\n >>> is_circular_same(354, 453)\n False\n \"\"\"","function2_human":"def is_circular_same(x: int, y: int) -> bool:\n \"\"\"Return True if x and y are circularly same, False otherwise.\n Circulary same means that any of circular shift of x is equal\n to any of circular shift of y.\n\n >>> is_circular_same(12, 21)\n True\n >>> is_circular_same(354, 453)\n False\n \"\"\"\n xs = set((circular_shift(x, i) for i in range(len(str(x)))))\n ys = set((circular_shift(y, i) for i in range(len(str(y)))))\n return len(xs.intersection(ys)) > 0","function2_name":"is_circular_same","tests":"def check(candidate):\n assert candidate(40273, 73402) is True\n assert candidate(33, 23) is False\n assert candidate(9447, 4794) is True\n\ndef test_check():\n check(is_circular_same)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def digitSum(s: str) -> int:\n \"\"\"Task\n Write a function that takes a string as input and returns the sum of the upper characters only'\n ASCII codes.\n\n Examples:\n >>> digitSum('')\n 0\n >>> digitSum('abAB')\n 131\n >>> digitSum('abcCd')\n 67\n >>> digitSum('helloE')\n 69\n >>> digitSum('woArBld')\n 131\n >>> digitSum('aAaaaXa')\n 153\n \"\"\"","function1_human":"def digitSum(s: str) -> int:\n \"\"\"Task\n Write a function that takes a string as input and returns the sum of the upper characters only'\n ASCII codes.\n\n Examples:\n >>> digitSum('')\n 0\n >>> digitSum('abAB')\n 131\n >>> digitSum('abcCd')\n 67\n >>> digitSum('helloE')\n 69\n >>> digitSum('woArBld')\n 131\n >>> digitSum('aAaaaXa')\n 153\n \"\"\"\n if s == '':\n return 0\n return sum((ord(char) if char.isupper() else 0 for char in s))","function1_name":"digitSum","function2_signature":"def sort_by_sum_upper_character_ascii(s: List[str]) -> List[str]:\n \"\"\"Sort string based on the custom key defined as the sum of the upper\n characters only' ASCII codes. The order of string should be preserved in\n case of a tie.\n\n Examples:\n sort_by_digitsum([\"\", \"abAB\", \"abcCd\", \"helloE\"]) => [\"\", \"abcCd\", \"helloE\", \"abAB\"]\n \"\"\"","function2_human":"def sort_by_sum_upper_character_ascii(s: List[str]) -> List[str]:\n \"\"\"Sort string based on the custom key defined as the sum of the upper\n characters only' ASCII codes. The order of string should be preserved in\n case of a tie.\n\n Examples:\n sort_by_digitsum([\"\", \"abAB\", \"abcCd\", \"helloE\"]) => [\"\", \"abcCd\", \"helloE\", \"abAB\"]\n \"\"\"\n return sorted(s, key=digitSum)","function2_name":"sort_by_sum_upper_character_ascii","tests":"def check(candidate):\n assert candidate(['abAB', 'ABab']) == ['abAB', 'ABab']\n assert candidate(['AAAAAAAA', 'zzzzzzzzz', 'B']) == ['zzzzzzzzz', 'B', 'AAAAAAAA']\n assert candidate(['My', 'Name', 'Is', 'Hulk']) == ['Hulk', 'Is', 'My', 'Name']\n\ndef test_check():\n check(sort_by_sum_upper_character_ascii)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def fruit_distribution(s: str, n: int) -> int:\n \"\"\"\n In this task, you will be given a string that represents a number of apples and oranges\n that are distributed in a basket of fruit this basket contains\n apples, oranges, and mango fruits. Given the string that represents the total number of\n the oranges and apples and an integer that represent the total number of the fruits\n in the basket return the number of the mango fruits in the basket.\n for examble:\n >>> fruit_distribution('5 apples and 6 oranges', 19)\n 8\n >>> fruit_distribution('0 apples and 1 oranges', 3)\n 2\n >>> fruit_distribution('2 apples and 3 oranges', 100)\n 95\n >>> fruit_distribution('100 apples and 1 oranges', 120)\n 19\n \"\"\"","function1_human":"def fruit_distribution(s: str, n: int) -> int:\n \"\"\"\n In this task, you will be given a string that represents a number of apples and oranges\n that are distributed in a basket of fruit this basket contains\n apples, oranges, and mango fruits. Given the string that represents the total number of\n the oranges and apples and an integer that represent the total number of the fruits\n in the basket return the number of the mango fruits in the basket.\n for examble:\n >>> fruit_distribution('5 apples and 6 oranges', 19)\n 8\n >>> fruit_distribution('0 apples and 1 oranges', 3)\n 2\n >>> fruit_distribution('2 apples and 3 oranges', 100)\n 95\n >>> fruit_distribution('100 apples and 1 oranges', 120)\n 19\n \"\"\"\n lis = list()\n for i in s.split(' '):\n if i.isdigit():\n lis.append(int(i))\n return n - sum(lis)","function1_name":"fruit_distribution","function2_signature":"def happy_fruit_distribution(s: str, n: int) -> int:\n \"\"\"\n In this task, you will be given a string that represents a number of apples and oranges\n that are distributed in a basket of fruit this basket contains\n apples, oranges, and mango fruits. Given the string that represents the total number of\n the oranges and apples and an integer that represent the total number of the fruits\n in the basket, your task is to check the fruit distribution is happy or not.\n The fruit distribution is happy when the number of the mango fruits is more than the\n total number of remainders.\n for example:\n >>> happy_fruit_distribution('5 apples and 6 oranges', 19)\n 'not happy'\n >>> fruit_distribution('0 apples and 1 oranges', 3)\n 'happy'\n >>> fruit_distribution('2 apples and 3 oranges', 100)\n 'happy'\n >>> fruit_distribution('100 apples and 1 oranges', 120)\n 'not happy'\n \"\"\"","function2_human":"def happy_fruit_distribution(s: str, n: int) -> int:\n \"\"\"\n In this task, you will be given a string that represents a number of apples and oranges\n that are distributed in a basket of fruit this basket contains\n apples, oranges, and mango fruits. Given the string that represents the total number of\n the oranges and apples and an integer that represent the total number of the fruits\n in the basket, your task is to check the fruit distribution is happy or not.\n The fruit distribution is happy when the number of the mango fruits is more than the\n total number of remainders.\n for example:\n >>> happy_fruit_distribution('5 apples and 6 oranges', 19)\n 'not happy'\n >>> fruit_distribution('0 apples and 1 oranges', 3)\n 'happy'\n >>> fruit_distribution('2 apples and 3 oranges', 100)\n 'happy'\n >>> fruit_distribution('100 apples and 1 oranges', 120)\n 'not happy'\n \"\"\"\n return 'happy' if fruit_distribution(s, n) > n \/\/ 2 else 'not happy'","function2_name":"happy_fruit_distribution","tests":"def check(candidate):\n assert candidate('3 apples and 3 oranges', 9) == 'not happy'\n assert candidate('9 apples and 1 oranges', 21) == 'happy'\n assert candidate('0 apples and 0 oranges', 1) == 'happy'\n\ndef test_check():\n check(happy_fruit_distribution)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def pluck(arr: List[int]) -> List[int]:\n \"\"\"\n \"Given an array representing a branch of a tree that has non-negative integer nodes\n your task is to pluck one of the nodes and return it.\n The plucked node should be the node with the smallest even value.\n If multiple nodes with the same smallest even value are found return the node that has smallest index.\n\n The plucked node should be returned in a list, [ smalest_value, its index ],\n If there are no even values or the given array is empty, return [].\n\n Example 1:\n >>> pluck([4, 2, 3])\n [2, 1]\n Explanation: 2 has the smallest even value, and 2 has the smallest index.\n\n Example 2:\n >>> pluck([1, 2, 3])\n [2, 1]\n Explanation: 2 has the smallest even value, and 2 has the smallest index.\n\n Example 3:\n >>> pluck([])\n []\n\n Example 4:\n >>> pluck([5, 0, 3, 0, 4, 2])\n [0, 1]\n Explanation: 0 is the smallest value, but there are two zeros,\n so we will choose the first zero, which has the smallest index.\n\n Constraints:\n * 1 <= nodes.length <= 10000\n * 0 <= node.value\n \"\"\"","function1_human":"def pluck(arr: List[int]) -> List[int]:\n \"\"\"\n \"Given an array representing a branch of a tree that has non-negative integer nodes\n your task is to pluck one of the nodes and return it.\n The plucked node should be the node with the smallest even value.\n If multiple nodes with the same smallest even value are found return the node that has smallest index.\n\n The plucked node should be returned in a list, [ smalest_value, its index ],\n If there are no even values or the given array is empty, return [].\n\n Example 1:\n >>> pluck([4, 2, 3])\n [2, 1]\n Explanation: 2 has the smallest even value, and 2 has the smallest index.\n\n Example 2:\n >>> pluck([1, 2, 3])\n [2, 1]\n Explanation: 2 has the smallest even value, and 2 has the smallest index.\n\n Example 3:\n >>> pluck([])\n []\n\n Example 4:\n >>> pluck([5, 0, 3, 0, 4, 2])\n [0, 1]\n Explanation: 0 is the smallest value, but there are two zeros,\n so we will choose the first zero, which has the smallest index.\n\n Constraints:\n * 1 <= nodes.length <= 10000\n * 0 <= node.value\n \"\"\"\n if len(arr) == 0:\n return []\n evens = list(filter(lambda x: x % 2 == 0, arr))\n if evens == []:\n return []\n return [min(evens), arr.index(min(evens))]","function1_name":"pluck","function2_signature":"def pluck_and_select_larger_branch(arr: List[int]) -> List[int]:\n \"\"\"\n Given a branch represented as a list of non-negative integers,\n plucking (and then cutting) a node will result in the branch\n being split into two (or fewer) seperate branches.\n\n Among the divided branches,\n return the one with a larger sum of the nodes that compose it.\n\n If the sum of nodes in the divided branches is the same,\n return the branch with the smaller index.\n\n Assuming the sum of nodes in an empty branch is -1,\n return `[]` if there are only empty branches remaining after plucking.\n\n Examples:\n >>> pluck_and_select_larger_branch([1, 3, 2, 4, 5])\n [4, 5]\n >>> pluck_and_select_larger_branch([1, 3, 2, 3, 1])\n [1, 3]\n >>> pluck_and_select_larger_branch([2, 1, 2, 1])\n [1, 2, 1]\n >>> pluck_and_select_larger_branch([2])\n []\n >>> pluck_and_select_larger_branch([1, 3, 5, 7, 9])\n [1, 3, 5, 7, 9]\n \"\"\"","function2_human":"def pluck_and_select_larger_branch(arr: List[int]) -> List[int]:\n \"\"\"\n Given a branch represented as a list of non-negative integers,\n plucking (and then cutting) a node will result in the branch\n being split into two (or fewer) seperate branches.\n\n Among the divided branches,\n return the one with a larger sum of the nodes that compose it.\n\n If the sum of nodes in the divided branches is the same,\n return the branch with the smaller index.\n\n Assuming the sum of nodes in an empty branch is -1,\n return `[]` if there are only empty branches remaining after plucking.\n\n Examples:\n >>> pluck_and_select_larger_branch([1, 3, 2, 4, 5])\n [4, 5]\n >>> pluck_and_select_larger_branch([1, 3, 2, 3, 1])\n [1, 3]\n >>> pluck_and_select_larger_branch([2, 1, 2, 1])\n [1, 2, 1]\n >>> pluck_and_select_larger_branch([2])\n []\n >>> pluck_and_select_larger_branch([1, 3, 5, 7, 9])\n [1, 3, 5, 7, 9]\n \"\"\"\n plucked_node = pluck(arr)\n if plucked_node == []:\n return arr\n (_, index) = plucked_node\n left_branch = arr[:index]\n right_branch = arr[index + 1:]\n left_branch_value = sum(left_branch) if left_branch != [] else -1\n right_branch_value = sum(right_branch) if right_branch != [] else -1\n return left_branch if left_branch_value >= right_branch_value else right_branch","function2_name":"pluck_and_select_larger_branch","tests":"def check(candidate):\n assert candidate([33, 12, 10, 10, 1, 3, 1]) == [33, 12]\n assert candidate([1, 7, 12, 5, 3]) == [1, 7]\n assert candidate([12, 9, 7, 8]) == [12, 9, 7]\n assert candidate([100]) == []\n assert candidate([11, 21, 31, 41, 51]) == [11, 21, 31, 41, 51]\n assert candidate([]) == []\n\ndef test_check():\n check(pluck_and_select_larger_branch)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def search(lst: List[int]) -> int:\n \"\"\"\n You are given a non-empty list of positive integers. Return the greatest integer that is greater than\n zero, and has a frequency greater than or equal to the value of the integer itself.\n The frequency of an integer is the number of times it appears in the list.\n If no such a value exist, return -1.\n Examples:\n >>> search([4, 1, 2, 2, 3, 1])\n 2\n >>> search([1, 2, 2, 3, 3, 3, 4, 4, 4])\n 3\n >>> search([5, 5, 4, 4, 4])\n -1\n \"\"\"","function1_human":"def search(lst: List[int]) -> int:\n \"\"\"\n You are given a non-empty list of positive integers. Return the greatest integer that is greater than\n zero, and has a frequency greater than or equal to the value of the integer itself.\n The frequency of an integer is the number of times it appears in the list.\n If no such a value exist, return -1.\n Examples:\n >>> search([4, 1, 2, 2, 3, 1])\n 2\n >>> search([1, 2, 2, 3, 3, 3, 4, 4, 4])\n 3\n >>> search([5, 5, 4, 4, 4])\n -1\n \"\"\"\n frq = [0] * (max(lst) + 1)\n for i in lst:\n frq[i] += 1\n ans = -1\n for i in range(1, len(frq)):\n if frq[i] >= i:\n ans = i\n return ans","function1_name":"search","function2_signature":"def remove_integers_with_higher_frequency(lst: List[int]) -> List[int]:\n \"\"\"\n Return a list obtained from the given non-empty list of positive integers\n by removing all integers whose frequency is greater than or equal to the integer itself.\n\n Ensure that the order of elements between them is preserverd.\n\n Examples:\n >>> remove_integers_with_higher_frequency([2, 3, 3, 3, 3, 3, 4, 4])\n [2, 4, 4]\n >>> remove_integers_with_higher_frequency([3, 2, 4, 5, 1, 4, 3, 2])\n [3, 4, 5, 4, 3]\n >>> remove_integers_with_higher_frequency([2, 3, 3, 4, 4, 4])\n [2, 3, 3, 4, 4, 4]\n \"\"\"","function2_human":"def remove_integers_with_higher_frequency(lst: List[int]) -> List[int]:\n \"\"\"\n Return a list obtained from the given non-empty list of positive integers\n by removing all integers whose frequency is greater than or equal to the integer itself.\n\n Ensure that the order of elements between them is preserverd.\n\n Examples:\n >>> remove_integers_with_higher_frequency([2, 3, 3, 3, 3, 3, 4, 4])\n [2, 4, 4]\n >>> remove_integers_with_higher_frequency([3, 2, 4, 5, 1, 4, 3, 2])\n [3, 4, 5, 4, 3]\n >>> remove_integers_with_higher_frequency([2, 3, 3, 4, 4, 4])\n [2, 3, 3, 4, 4, 4]\n \"\"\"\n integer = search(lst)\n while integer != -1:\n lst = [i for i in lst if i != integer]\n integer = search(lst)\n return lst","function2_name":"remove_integers_with_higher_frequency","tests":"def check(candidate):\n assert candidate([11, 5, 4, 22, 4, 33, 5, 5, 5, 44, 4, 55, 4, 5]) == [11, 22, 33, 44, 55]\n assert candidate([1, 5, 2, 4, 3, 5, 4, 5, 3, 1, 2, 1, 3, 4, 3, 3, 2, 5]) == [5, 4, 5, 4, 5, 4, 5]\n assert candidate([3, 4, 4, 2, 4, 3]) == [3, 4, 4, 2, 4, 3]\n assert candidate([10, 10, 10, 10, 10, 10, 10, 10, 10]) == [10, 10, 10, 10, 10, 10, 10, 10, 10]\n assert candidate([100]) == [100]\n\ndef test_check():\n check(remove_integers_with_higher_frequency)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def strange_sort_list(lst: list[int]) -> list[int]:\n \"\"\"\n Given list of integers, return list in strange order.\n Strange sorting, is when you start with the minimum value,\n then maximum of the remaining integers, then minimum and so on.\n\n Examples:\n >>> strange_sort_list([1, 2, 3, 4])\n [1, 4, 3, 2]\n >>> strange_sort_list([5, 5, 5, 5])\n [5, 5, 5, 5]\n >>> strange_sort_list([])\n []\n \"\"\"","function1_human":"def strange_sort_list(lst: list[int]) -> list[int]:\n \"\"\"\n Given list of integers, return list in strange order.\n Strange sorting, is when you start with the minimum value,\n then maximum of the remaining integers, then minimum and so on.\n\n Examples:\n >>> strange_sort_list([1, 2, 3, 4])\n [1, 4, 3, 2]\n >>> strange_sort_list([5, 5, 5, 5])\n [5, 5, 5, 5]\n >>> strange_sort_list([])\n []\n \"\"\"\n (res, switch) = ([], True)\n while lst:\n res.append(min(lst) if switch else max(lst))\n lst.remove(res[-1])\n switch = not switch\n return res","function1_name":"strange_sort_list","function2_signature":"def extended_strange_sort_list(lst: list[int]) -> list[int]:\n \"\"\"\n Given list of integers, return list in strange order.\n Extended strange sorting, is when you start with the minimum value,\n then maximum of the remaining integers, then maximum and minimum and so on.\n\n Examples:\n >>> extended_strange_sort_list([1, 2, 3, 4])\n [1, 4, 3, 2]\n >>> extended_strange_sort_list([5, 5, 5, 5])\n [5, 5, 5, 5]\n >>> extended_strange_sort_list([])\n []\n \"\"\"","function2_human":"def extended_strange_sort_list(lst: list[int]) -> list[int]:\n \"\"\"\n Given list of integers, return list in strange order.\n Extended strange sorting, is when you start with the minimum value,\n then maximum of the remaining integers, then maximum and minimum and so on.\n\n Examples:\n >>> extended_strange_sort_list([1, 2, 3, 4])\n [1, 4, 3, 2]\n >>> extended_strange_sort_list([5, 5, 5, 5])\n [5, 5, 5, 5]\n >>> extended_strange_sort_list([])\n []\n \"\"\"\n res = []\n for idx in range(len(lst)):\n res.append(min(lst) if idx % 4 in [0, 3] else max(lst))\n lst.remove(res[-1])\n return res","function2_name":"extended_strange_sort_list","tests":"def check(candidate):\n assert candidate([9, 2, 4, 3, 8, 9]) == [2, 9, 9, 3, 4, 8]\n assert candidate([5, 2, 1, 7, 5, 4, 4, 9]) == [1, 9, 7, 2, 4, 5, 5, 4]\n assert candidate([8, 7, 2, 4, 6, 5, 1, 5]) == [1, 8, 7, 2, 4, 6, 5, 5]\n\ndef test_check():\n check(extended_strange_sort_list)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def triangle_area(a: int, b: int, c: int) -> float:\n \"\"\"\n Given the lengths of the three sides of a triangle. Return the area of\n the triangle rounded to 2 decimal points if the three sides form a valid triangle.\n Otherwise return -1\n Three sides make a valid triangle when the sum of any two sides is greater\n than the third side.\n Example:\n >>> triangle_area(3, 4, 5)\n 6.0\n >>> triangle_area(1, 2, 10)\n -1\n \"\"\"","function1_human":"def triangle_area(a: int, b: int, c: int) -> float:\n \"\"\"\n Given the lengths of the three sides of a triangle. Return the area of\n the triangle rounded to 2 decimal points if the three sides form a valid triangle.\n Otherwise return -1\n Three sides make a valid triangle when the sum of any two sides is greater\n than the third side.\n Example:\n >>> triangle_area(3, 4, 5)\n 6.0\n >>> triangle_area(1, 2, 10)\n -1\n \"\"\"\n if a + b <= c or a + c <= b or b + c <= a:\n return -1\n s = (a + b + c) \/ 2\n area = (s * (s - a) * (s - b) * (s - c)) ** 0.5\n area = round(area, 2)\n return area","function1_name":"triangle_area","function2_signature":"def sum_of_triangle_areas(triangles: List[List[int]]) -> float:\n \"\"\"\n Return the sum of the areas of all given triangles.\n Each triangle is given as a list of the lengths of its three sides.\n If the input includes any invalid triangles, return -1.\n Example:\n >>> sum_of_triangle_areas([[3, 4, 5], [5, 12, 13]])\n 36.0\n >>> sum_of_triangle_areas([[5, 12, 13], [1, 1, 10]])\n -1\n \"\"\"","function2_human":"def sum_of_triangle_areas(triangles: List[List[int]]) -> float:\n \"\"\"\n Return the sum of the areas of all given triangles.\n Each triangle is given as a list of the lengths of its three sides.\n If the input includes any invalid triangles, return -1.\n Example:\n >>> sum_of_triangle_areas([[3, 4, 5], [5, 12, 13]])\n 36.0\n >>> sum_of_triangle_areas([[5, 12, 13], [1, 1, 10]])\n -1\n \"\"\"\n triangle_areas = [triangle_area(a, b, c) for (a, b, c) in triangles]\n if -1 in triangle_areas:\n return -1\n else:\n return sum(triangle_areas)","function2_name":"sum_of_triangle_areas","tests":"def check(candidate):\n assert candidate([[3, 4, 5], [5, 12, 13], [5, 5, 6]]) == 48.0\n assert candidate([[6, 8, 10], [10, 10, 12]]) == 72.0\n assert candidate([[3, 4, 5], [3, 4, 7]]) == -1.0\n\ndef test_check():\n check(sum_of_triangle_areas)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def will_it_fly(q: List[int], w: int) -> bool:\n \"\"\"\n Write a function that returns True if the object q will fly, and False otherwise.\n The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.\n\n Example:\n >>> will_it_fly([1, 2], 5)\n False\n # 1+2 is less than the maximum possible weight, but it's unbalanced.\n\n >>> will_it_fly([3, 2, 3], 1)\n False\n # it's balanced, but 3+2+3 is more than the maximum possible weight.\n\n >>> will_it_fly([3, 2, 3], 9)\n True\n # 3+2+3 is less than the maximum possible weight, and it's balanced.\n\n >>> will_it_fly([3], 5)\n True\n # 3 is less than the maximum possible weight, and it's balanced.\n \"\"\"","function1_human":"def will_it_fly(q: List[int], w: int) -> bool:\n \"\"\"\n Write a function that returns True if the object q will fly, and False otherwise.\n The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.\n\n Example:\n >>> will_it_fly([1, 2], 5)\n False\n # 1+2 is less than the maximum possible weight, but it's unbalanced.\n\n >>> will_it_fly([3, 2, 3], 1)\n False\n # it's balanced, but 3+2+3 is more than the maximum possible weight.\n\n >>> will_it_fly([3, 2, 3], 9)\n True\n # 3+2+3 is less than the maximum possible weight, and it's balanced.\n\n >>> will_it_fly([3], 5)\n True\n # 3 is less than the maximum possible weight, and it's balanced.\n \"\"\"\n if sum(q) > w:\n return False\n (i, j) = (0, len(q) - 1)\n while i < j:\n if q[i] != q[j]:\n return False\n i += 1\n j -= 1\n return True","function1_name":"will_it_fly","function2_signature":"def is_palindrome(q: List[int]) -> bool:\n \"\"\"\n Write a function that determines whether a given list is a palindrome.\n Example:\n >>> is_palindrome([1, 2])\n False\n >>> is_palindrome([1, 2, 1])\n True\n \"\"\"","function2_human":"def is_palindrome(q: List[int]) -> bool:\n \"\"\"\n Write a function that determines whether a given list is a palindrome.\n Example:\n >>> is_palindrome([1, 2])\n False\n >>> is_palindrome([1, 2, 1])\n True\n \"\"\"\n return will_it_fly(q, sum(q))","function2_name":"is_palindrome","tests":"def check(candidate):\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8]) is False\n assert candidate([1, 2, 3, 2, 1]) is True\n assert candidate([1, 1, 1, 1]) is True\n\ndef test_check():\n check(is_palindrome)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def smallest_change(arr: List[int]) -> int:\n \"\"\"\n Given an array arr of integers, find the minimum number of elements that\n need to be changed to make the array palindromic. A palindromic array is an array that\n is read the same backwards and forwards. In one change, you can change one element to any other element.\n\n For example:\n >>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6])\n 4\n >>> smallest_change([1, 2, 3, 4, 3, 2, 2])\n 1\n >>> smallest_change([1, 2, 3, 2, 1])\n 0\n \"\"\"","function1_human":"def smallest_change(arr: List[int]) -> int:\n \"\"\"\n Given an array arr of integers, find the minimum number of elements that\n need to be changed to make the array palindromic. A palindromic array is an array that\n is read the same backwards and forwards. In one change, you can change one element to any other element.\n\n For example:\n >>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6])\n 4\n >>> smallest_change([1, 2, 3, 4, 3, 2, 2])\n 1\n >>> smallest_change([1, 2, 3, 2, 1])\n 0\n \"\"\"\n ans = 0\n for i in range(len(arr) \/\/ 2):\n if arr[i] != arr[len(arr) - i - 1]:\n ans += 1\n return ans","function1_name":"smallest_change","function2_signature":"def is_palindrome(arr: List[int]) -> bool:\n \"\"\"\n Write a function that determines whether a given list is a palindrome.\n Example:\n >>> is_palindrome([1, 2])\n False\n >>> is_palindrome([1, 2, 1])\n True\n \"\"\"","function2_human":"def is_palindrome(arr: List[int]) -> bool:\n \"\"\"\n Write a function that determines whether a given list is a palindrome.\n Example:\n >>> is_palindrome([1, 2])\n False\n >>> is_palindrome([1, 2, 1])\n True\n \"\"\"\n return smallest_change(arr) == 0","function2_name":"is_palindrome","tests":"def check(candidate):\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8]) is False\n assert candidate([1, 2, 3, 2, 1]) is True\n assert candidate([1, 1, 1, 1]) is True\n\ndef test_check():\n check(is_palindrome)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def total_match(lst1: List[str], lst2: List[str]) -> List[str]:\n \"\"\"\n Write a function that accepts two lists of strings and returns the list that has\n total number of chars in the all strings of the list less than the other list.\n\n if the two lists have the same number of chars, return the first list.\n\n Examples\n >>> total_match([], [])\n []\n >>> total_match(['hi', 'admin'], ['hI', 'Hi'])\n ['hI', 'Hi']\n >>> total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'])\n ['hi', 'admin']\n >>> total_match(['hi', 'admin'], ['hI', 'hi', 'hi'])\n ['hI', 'hi', 'hi']\n >>> total_match(['4'], ['1', '2', '3', '4', '5'])\n ['4']\n \"\"\"","function1_human":"def total_match(lst1: List[str], lst2: List[str]) -> List[str]:\n \"\"\"\n Write a function that accepts two lists of strings and returns the list that has\n total number of chars in the all strings of the list less than the other list.\n\n if the two lists have the same number of chars, return the first list.\n\n Examples\n >>> total_match([], [])\n []\n >>> total_match(['hi', 'admin'], ['hI', 'Hi'])\n ['hI', 'Hi']\n >>> total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'])\n ['hi', 'admin']\n >>> total_match(['hi', 'admin'], ['hI', 'hi', 'hi'])\n ['hI', 'hi', 'hi']\n >>> total_match(['4'], ['1', '2', '3', '4', '5'])\n ['4']\n \"\"\"\n l1 = 0\n for st in lst1:\n l1 += len(st)\n l2 = 0\n for st in lst2:\n l2 += len(st)\n if l1 <= l2:\n return lst1\n else:\n return lst2","function1_name":"total_match","function2_signature":"def total_match_three(lst1: List[str], lst2: List[str], lst3: List[str]) -> List[str]:\n \"\"\"\n Return the list of strings with the smallest total number of characters\n among the three string lists.\n If some lists have the same total number of characters,\n return the list that appears ealier.\n Examples:\n >>> total_match_three(['a'], ['a', 'b'], ['a', 'b', 'c'])\n ['a']\n >>> total_match_three(['abcd'], ['a', 'b'])\n ['a', 'b']\n >>> total_match_three(['a'], ['b'], ['c'])\n ['a']\n \"\"\"","function2_human":"def total_match_three(lst1: List[str], lst2: List[str], lst3: List[str]) -> List[str]:\n \"\"\"\n Return the list of strings with the smallest total number of characters\n among the three string lists.\n If some lists have the same total number of characters,\n return the list that appears ealier.\n Examples:\n >>> total_match_three(['a'], ['a', 'b'], ['a', 'b', 'c'])\n ['a']\n >>> total_match_three(['abcd'], ['a', 'b'])\n ['a', 'b']\n >>> total_match_three(['a'], ['b'], ['c'])\n ['a']\n \"\"\"\n return total_match(total_match(lst1, lst2), lst3)","function2_name":"total_match_three","tests":"def check(candidate):\n assert candidate(['total', 'match', 'three'], ['I', 'love', 'you'], ['This', 'is', 'good']) == ['I', 'love', 'you']\n assert candidate(['a', 'aa', 'aaa'], ['aaaaa'], ['aaaaaaa']) == ['aaaaa']\n assert candidate(['a', 'bcd'], ['ab', 'cd'], ['abc', 'd']) == ['a', 'bcd']\n\ndef test_check():\n check(total_match_three)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def is_multiply_prime(a: int) -> bool:\n \"\"\"Write a function that returns true if the given number is the multiplication of 3 prime numbers\n and false otherwise.\n Knowing that (a) is less then 100.\n Example:\n >>> is_multiply_prime(30)\n True\n 30 = 2 * 3 * 5\n \"\"\"","function1_human":"def is_multiply_prime(a: int) -> bool:\n \"\"\"Write a function that returns true if the given number is the multiplication of 3 prime numbers\n and false otherwise.\n Knowing that (a) is less then 100.\n Example:\n >>> is_multiply_prime(30)\n True\n 30 = 2 * 3 * 5\n \"\"\"\n\n def is_prime(n):\n for j in range(2, n):\n if n % j == 0:\n return False\n return True\n for i in range(2, 101):\n if not is_prime(i):\n continue\n for j in range(2, 101):\n if not is_prime(j):\n continue\n for k in range(2, 101):\n if not is_prime(k):\n continue\n if i * j * k == a:\n return True\n return False","function1_name":"is_multiply_prime","function2_signature":"def sum_of_multiply_primes(nums: List[int]) -> int:\n \"\"\"\n Return the sum of numbers among the given numbers\n that can be expressed as the product of three prime numbers.\n Examples:\n >>> sum_of_multiply_prime([30, 42])\n 72\n >>> sum_of_multiply_prime([30, 35, 40, 42])\n 72\n \"\"\"","function2_human":"def sum_of_multiply_primes(nums: List[int]) -> int:\n \"\"\"\n Return the sum of numbers among the given numbers\n that can be expressed as the product of three prime numbers.\n Examples:\n >>> sum_of_multiply_prime([30, 42])\n 72\n >>> sum_of_multiply_prime([30, 35, 40, 42])\n 72\n \"\"\"\n return sum([n for n in nums if is_multiply_prime(n)])","function2_name":"sum_of_multiply_primes","tests":"def check(candidate):\n assert candidate([30, 42, 66, 70, 78]) == 286\n assert candidate([25, 40, 55, 72, 77]) == 0\n assert candidate([25, 30, 40, 42, 55, 66, 70, 72, 77, 78]) == 286\n\ndef test_check():\n check(sum_of_multiply_primes)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def is_simple_power(x: int, n: int) -> bool:\n \"\"\"Your task is to write a function that returns true if a number x is a simple\n power of n and false in other cases.\n x is a simple power of n if n**int=x\n For example:\n >>> is_simple_power(1, 4)\n True\n >>> is_simple_power(2, 2)\n True\n >>> is_simple_power(8, 2)\n True\n >>> is_simple_power(3, 2)\n False\n >>> is_simple_power(3, 1)\n False\n >>> is_simple_power(5, 3)\n False\n \"\"\"","function1_human":"def is_simple_power(x: int, n: int) -> bool:\n \"\"\"Your task is to write a function that returns true if a number x is a simple\n power of n and false in other cases.\n x is a simple power of n if n**int=x\n For example:\n >>> is_simple_power(1, 4)\n True\n >>> is_simple_power(2, 2)\n True\n >>> is_simple_power(8, 2)\n True\n >>> is_simple_power(3, 2)\n False\n >>> is_simple_power(3, 1)\n False\n >>> is_simple_power(5, 3)\n False\n \"\"\"\n if n == 1:\n return x == 1\n power = 1\n while power < x:\n power = power * n\n return power == x","function1_name":"is_simple_power","function2_signature":"def log(n: int, x: int) -> int:\n \"\"\"\n Implement a function that calculates the value log_n(x)\n and returns it if it is an integer, otherwise returns -1.\n Examples:\n >>> log(2, 8)\n 3\n >>> log(2, 3)\n -1\n \"\"\"","function2_human":"def log(n: int, x: int) -> int:\n \"\"\"\n Implement a function that calculates the value log_n(x)\n and returns it if it is an integer, otherwise returns -1.\n Examples:\n >>> log(2, 8)\n 3\n >>> log(2, 3)\n -1\n \"\"\"\n if is_simple_power(x, n):\n value = 0\n while x > 1:\n x \/= n\n value += 1\n return value\n else:\n return -1","function2_name":"log","tests":"def check(candidate):\n assert candidate(2, 1024) == 10\n assert candidate(3, 27) == 3\n assert candidate(3, 8) == -1\n\ndef test_check():\n check(log)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def iscube(a: int) -> bool:\n \"\"\"\n Write a function that takes an integer a and returns True\n if this ingeger is a cube of some integer number.\n Note: you may assume the input is always valid.\n Examples:\n >>> iscube(1)\n True\n >>> iscube(2)\n False\n >>> iscube(-1)\n True\n >>> iscube(64)\n True\n >>> iscube(0)\n True\n >>> iscube(180)\n False\n \"\"\"","function1_human":"def iscube(a: int) -> bool:\n \"\"\"\n Write a function that takes an integer a and returns True\n if this ingeger is a cube of some integer number.\n Note: you may assume the input is always valid.\n Examples:\n >>> iscube(1)\n True\n >>> iscube(2)\n False\n >>> iscube(-1)\n True\n >>> iscube(64)\n True\n >>> iscube(0)\n True\n >>> iscube(180)\n False\n \"\"\"\n a = abs(a)\n return int(round(a ** (1.0 \/ 3))) ** 3 == a","function1_name":"iscube","function2_signature":"def num_cube_pairs(nums1: List[int], nums2: List[int]) -> int:\n \"\"\"\n Find the number of pairs (n1, n2) where n1 + n2 equals to\n a cube of some integer number. (n1 in nums1 and n2 in nums2)\n Examples:\n >>> num_cube_pairs([1, 2, 3], [1, 2, 3])\n 0\n >>> num_cube_pairs([1, 2, 3], [5, 6])\n 2\n \"\"\"","function2_human":"def num_cube_pairs(nums1: List[int], nums2: List[int]) -> int:\n \"\"\"\n Find the number of pairs (n1, n2) where n1 + n2 equals to\n a cube of some integer number. (n1 in nums1 and n2 in nums2)\n Examples:\n >>> num_cube_pairs([1, 2, 3], [1, 2, 3])\n 0\n >>> num_cube_pairs([1, 2, 3], [5, 6])\n 2\n \"\"\"\n return len([1 for n1 in nums1 for n2 in nums2 if iscube(n1 + n2)])","function2_name":"num_cube_pairs","tests":"def check(candidate):\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4]) == 1\n assert candidate([1, 2, 3, 4], [-2, 0, 2, 4]) == 5\n assert candidate([5, 25], [39, 100]) == 2\n\ndef test_check():\n check(num_cube_pairs)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def hex_key(num: str) -> int:\n \"\"\"You have been tasked to write a function that receives\n a hexadecimal number as a string and counts the number of hexadecimal\n digits that are primes (prime number, or a prime, is a natural number\n greater than 1 that is not a product of two smaller natural numbers).\n Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.\n Prime numbers are 2, 3, 5, 7, 11, 13, 17,...\n So you have to determine a number of the following digits: 2, 3, 5, 7,\n B (=decimal 11), D (=decimal 13).\n Note: you may assume the input is always correct or empty string,\n and symbols A,B,C,D,E,F are always uppercase.\n Examples:\n >>> hex_key('AB')\n 1\n >>> hex_key('1077E')\n 2\n >>> hex_key('ABED1A33')\n 4\n >>> hex_key('123456789ABCDEF0')\n 6\n >>> hex_key('2020')\n 2\n \"\"\"","function1_human":"def hex_key(num: str) -> int:\n \"\"\"You have been tasked to write a function that receives\n a hexadecimal number as a string and counts the number of hexadecimal\n digits that are primes (prime number, or a prime, is a natural number\n greater than 1 that is not a product of two smaller natural numbers).\n Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.\n Prime numbers are 2, 3, 5, 7, 11, 13, 17,...\n So you have to determine a number of the following digits: 2, 3, 5, 7,\n B (=decimal 11), D (=decimal 13).\n Note: you may assume the input is always correct or empty string,\n and symbols A,B,C,D,E,F are always uppercase.\n Examples:\n >>> hex_key('AB')\n 1\n >>> hex_key('1077E')\n 2\n >>> hex_key('ABED1A33')\n 4\n >>> hex_key('123456789ABCDEF0')\n 6\n >>> hex_key('2020')\n 2\n \"\"\"\n primes = ('2', '3', '5', '7', 'B', 'D')\n total = 0\n for i in range(0, len(num)):\n if num[i] in primes:\n total += 1\n return total","function1_name":"hex_key","function2_signature":"def num_not_hex_primes(num: str) -> int:\n \"\"\"\n Count the number of hexadecimal digits in the given hexadecimal string\n that are not prime.\n Examples:\n >>> num_not_hex_primes('AB')\n 1\n >>> num_not_hex_primes('1077E')\n 3\n \"\"\"","function2_human":"def num_not_hex_primes(num: str) -> int:\n \"\"\"\n Count the number of hexadecimal digits in the given hexadecimal string\n that are not prime.\n Examples:\n >>> num_not_hex_primes('AB')\n 1\n >>> num_not_hex_primes('1077E')\n 3\n \"\"\"\n return len(num) - hex_key(num)","function2_name":"num_not_hex_primes","tests":"def check(candidate):\n assert candidate('12345678') == 4\n assert candidate('ABCDEF') == 4\n assert candidate('11AA22BB33CC44DD') == 8\n\ndef test_check():\n check(num_not_hex_primes)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def decimal_to_binary(decimal: int) -> str:\n \"\"\"You will be given a number in decimal form and your task is to convert it to\n binary format. The function should return a string, with each character representing a binary\n number. Each character in the string will be '0' or '1'.\n\n There will be an extra couple of characters 'db' at the beginning and at the end of the string.\n The extra characters are there to help with the format.\n\n Examples:\n >>> decimal_to_binary(15)\n 'db1111db'\n >>> decimal_to_binary(32)\n 'db100000db'\n \"\"\"","function1_human":"def decimal_to_binary(decimal: int) -> str:\n \"\"\"You will be given a number in decimal form and your task is to convert it to\n binary format. The function should return a string, with each character representing a binary\n number. Each character in the string will be '0' or '1'.\n\n There will be an extra couple of characters 'db' at the beginning and at the end of the string.\n The extra characters are there to help with the format.\n\n Examples:\n >>> decimal_to_binary(15)\n 'db1111db'\n >>> decimal_to_binary(32)\n 'db100000db'\n \"\"\"\n return 'db' + bin(decimal)[2:] + 'db'","function1_name":"decimal_to_binary","function2_signature":"def num_1s_in_binary(decimal: int) -> int:\n \"\"\"\n Return the count of digit 1 in the binary representation of the given number.\n Examples:\n >>> num_1s_in_binary(15)\n 4\n >>> num_1s_in_binary(32)\n 1\n \"\"\"","function2_human":"def num_1s_in_binary(decimal: int) -> int:\n \"\"\"\n Return the count of digit 1 in the binary representation of the given number.\n Examples:\n >>> num_1s_in_binary(15)\n 4\n >>> num_1s_in_binary(32)\n 1\n \"\"\"\n return decimal_to_binary(decimal).count('1')","function2_name":"num_1s_in_binary","tests":"def check(candidate):\n assert candidate(1000) == 6\n assert candidate(1023) == 10\n assert candidate(1024) == 1\n\ndef test_check():\n check(num_1s_in_binary)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def is_happy(s: str) -> bool:\n \"\"\"You are given a string s.\n Your task is to check if the string is happy or not.\n A string is happy if its length is at least 3 and every 3 consecutive letters are distinct\n For example:\n >>> is_happy('a')\n False\n >>> is_happy('aa')\n False\n >>> is_happy('abcd')\n True\n >>> is_happy('aabb')\n False\n >>> is_happy('adb')\n True\n >>> is_happy('xyy')\n False\n \"\"\"","function1_human":"def is_happy(s: str) -> bool:\n \"\"\"You are given a string s.\n Your task is to check if the string is happy or not.\n A string is happy if its length is at least 3 and every 3 consecutive letters are distinct\n For example:\n >>> is_happy('a')\n False\n >>> is_happy('aa')\n False\n >>> is_happy('abcd')\n True\n >>> is_happy('aabb')\n False\n >>> is_happy('adb')\n True\n >>> is_happy('xyy')\n False\n \"\"\"\n if len(s) < 3:\n return False\n for i in range(len(s) - 2):\n if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i] == s[i + 2]:\n return False\n return True","function1_name":"is_happy","function2_signature":"def num_happy_sentences(d: str) -> int:\n \"\"\"\n Implement a function that, given a document d where sentences are concatenated\n with newlines as separators, returns the count of happy sentences.\n Examples:\n >>> num_happy_sentences('a\naa')\n 0\n >>> num_happy_sentences('abcd\naabb\nadb')\n 2\n \"\"\"","function2_human":"def num_happy_sentences(d: str) -> int:\n \"\"\"\n Implement a function that, given a document d where sentences are concatenated\n with newlines as separators, returns the count of happy sentences.\n Examples:\n >>> num_happy_sentences('a\naa')\n 0\n >>> num_happy_sentences('abcd\naabb\nadb')\n 2\n \"\"\"\n return len([1 for s in d.splitlines() if is_happy(s)])","function2_name":"num_happy_sentences","tests":"def check(candidate):\n assert candidate('aaa\\nababab\\nabcabcabc') == 1\n assert candidate('a\\nab\\nabc\\nabcd') == 2\n assert candidate('numhappysentences\\niloveyou\\nthisisgood') == 1\n\ndef test_check():\n check(num_happy_sentences)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def numerical_letter_grade(grades: List[float]) -> List[str]:\n \"\"\"It is the last week of the semester and the teacher has to give the grades\n to students. The teacher has been making her own algorithm for grading.\n The only problem is, she has lost the code she used for grading.\n She has given you a list of GPAs for some students and you have to write\n a function that can output a list of letter grades using the following table:\n GPA | Letter grade\n 4.0 A+\n > 3.7 A\n > 3.3 A-\n > 3.0 B+\n > 2.7 B\n > 2.3 B-\n > 2.0 C+\n > 1.7 C\n > 1.3 C-\n > 1.0 D+\n > 0.7 D\n > 0.0 D-\n 0.0 E\n\n\n Example:\n >>> grade_equation([4.0, 3, 1.7, 2, 3.5])\n ['A+', 'B', 'C-', 'C', 'A-']\n \"\"\"","function1_human":"def numerical_letter_grade(grades: List[float]) -> List[str]:\n \"\"\"It is the last week of the semester and the teacher has to give the grades\n to students. The teacher has been making her own algorithm for grading.\n The only problem is, she has lost the code she used for grading.\n She has given you a list of GPAs for some students and you have to write\n a function that can output a list of letter grades using the following table:\n GPA | Letter grade\n 4.0 A+\n > 3.7 A\n > 3.3 A-\n > 3.0 B+\n > 2.7 B\n > 2.3 B-\n > 2.0 C+\n > 1.7 C\n > 1.3 C-\n > 1.0 D+\n > 0.7 D\n > 0.0 D-\n 0.0 E\n\n\n Example:\n >>> grade_equation([4.0, 3, 1.7, 2, 3.5])\n ['A+', 'B', 'C-', 'C', 'A-']\n \"\"\"\n letter_grade = []\n for gpa in grades:\n if gpa == 4.0:\n letter_grade.append('A+')\n elif gpa > 3.7:\n letter_grade.append('A')\n elif gpa > 3.3:\n letter_grade.append('A-')\n elif gpa > 3.0:\n letter_grade.append('B+')\n elif gpa > 2.7:\n letter_grade.append('B')\n elif gpa > 2.3:\n letter_grade.append('B-')\n elif gpa > 2.0:\n letter_grade.append('C+')\n elif gpa > 1.7:\n letter_grade.append('C')\n elif gpa > 1.3:\n letter_grade.append('C-')\n elif gpa > 1.0:\n letter_grade.append('D+')\n elif gpa > 0.7:\n letter_grade.append('D')\n elif gpa > 0.0:\n letter_grade.append('D-')\n else:\n letter_grade.append('E')\n return letter_grade","function1_name":"numerical_letter_grade","function2_signature":"def num_students_above_C(grades: List[float]) -> int:\n \"\"\"\n Given a list of students' GPAs, return the number of students\n who will receive a grade of B- or higher.\n Examples:\n >>> num_students_above_C([4.0, 3, 1.7, 2, 3.5])\n 3\n \"\"\"","function2_human":"def num_students_above_C(grades: List[float]) -> int:\n \"\"\"\n Given a list of students' GPAs, return the number of students\n who will receive a grade of B- or higher.\n Examples:\n >>> num_students_above_C([4.0, 3, 1.7, 2, 3.5])\n 3\n \"\"\"\n grades = numerical_letter_grade(grades)\n return len([1 for grade in grades if grade[0] < 'C'])","function2_name":"num_students_above_C","tests":"def check(candidate):\n assert candidate([0.0, 1.0, 2.0, 3.0, 4.0]) == 2\n assert candidate([2.1, 2.2, 2.3, 2.4, 2.5]) == 2\n assert candidate([1.4, 2.8, 2.0, 3.5, 3.0, 2.1, 0.7]) == 3\n\ndef test_check():\n check(num_students_above_C)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def prime_length(string: str) -> bool:\n \"\"\"Write a function that takes a string and returns True if the string\n length is a prime number or False otherwise\n Examples\n >>> prime_length('Hello')\n True\n >>> prime_length('abcdcba')\n True\n >>> prime_length('kittens')\n True\n >>> prime_length('orange')\n False\n \"\"\"","function1_human":"def prime_length(string: str) -> bool:\n \"\"\"Write a function that takes a string and returns True if the string\n length is a prime number or False otherwise\n Examples\n >>> prime_length('Hello')\n True\n >>> prime_length('abcdcba')\n True\n >>> prime_length('kittens')\n True\n >>> prime_length('orange')\n False\n \"\"\"\n l = len(string)\n if l == 0 or l == 1:\n return False\n for i in range(2, l):\n if l % i == 0:\n return False\n return True","function1_name":"prime_length","function2_signature":"def is_concat_length_prime(strings: List[str]) -> bool:\n \"\"\"\n Implement a function that checks whether the length of the string\n obtained by concatenating the given strings is a prime number.\n Examples:\n >>> is_concat_length_prime(['He', 'llo'])\n True\n >>> is_concat_length_prime(['or', 'an', 'ge'])\n False\n \"\"\"","function2_human":"def is_concat_length_prime(strings: List[str]) -> bool:\n \"\"\"\n Implement a function that checks whether the length of the string\n obtained by concatenating the given strings is a prime number.\n Examples:\n >>> is_concat_length_prime(['He', 'llo'])\n True\n >>> is_concat_length_prime(['or', 'an', 'ge'])\n False\n \"\"\"\n return prime_length(''.join(strings))","function2_name":"is_concat_length_prime","tests":"def check(candidate):\n assert candidate(['ab', 'abc', 'abcd', 'ab']) is True\n assert candidate(['aaaaaaaaaa', 'aaaaa']) is False\n assert candidate(['is', 'concat', 'length', 'prime']) is True\n\ndef test_check():\n check(is_concat_length_prime)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def starts_one_ends(n: int) -> int:\n \"\"\"\n Given a positive integer n, return the count of the numbers of n-digit\n positive integers that start or end with 1.\n \"\"\"","function1_human":"def starts_one_ends(n: int) -> int:\n \"\"\"\n Given a positive integer n, return the count of the numbers of n-digit\n positive integers that start or end with 1.\n \"\"\"\n if n == 1:\n return 1\n return 18 * 10 ** (n - 2)","function1_name":"starts_one_ends","function2_signature":"def non_starts_or_ends_with_one_count(n: int) -> int:\n \"\"\"\n Return the count of n-digit positive integers\n that do not start or end with 1.\n Examples:\n >>> non_starts_or_ends_with_one_count(1)\n 8\n >>> non_starts_or_ends_with_one_count(2)\n 72\n \"\"\"","function2_human":"def non_starts_or_ends_with_one_count(n: int) -> int:\n \"\"\"\n Return the count of n-digit positive integers\n that do not start or end with 1.\n Examples:\n >>> non_starts_or_ends_with_one_count(1)\n 8\n >>> non_starts_or_ends_with_one_count(2)\n 72\n \"\"\"\n return len(range(10 ** (n - 1), 10 ** n)) - starts_one_ends(n)","function2_name":"non_starts_or_ends_with_one_count","tests":"def check(candidate):\n assert candidate(3) == 720\n assert candidate(4) == 7200\n assert candidate(5) == 72000\n\ndef test_check():\n check(non_starts_or_ends_with_one_count)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def solve(N: int) -> str:\n \"\"\"Given a positive integer N, return the total sum of its digits in binary.\n\n Example\n >>> solve(1000)\n '1'\n >>> solve(150)\n '110'\n >>> solve(147)\n '1100'\n\n Variables:\n @N integer\n Constraints: 0 \u2264 N \u2264 10000.\n Output:\n a string of binary number\n \"\"\"","function1_human":"def solve(N: int) -> str:\n \"\"\"Given a positive integer N, return the total sum of its digits in binary.\n\n Example\n >>> solve(1000)\n '1'\n >>> solve(150)\n '110'\n >>> solve(147)\n '1100'\n\n Variables:\n @N integer\n Constraints: 0 \u2264 N \u2264 10000.\n Output:\n a string of binary number\n \"\"\"\n return bin(sum((int(i) for i in str(N))))[2:]","function1_name":"solve","function2_signature":"def sum_digits_to_binary(string: str) -> str:\n \"\"\"\n Calculate the sum of numerical characters in the given string\n and return it as a binary representation.\n Examples:\n >>> sum_digits_to_binary('10a00')\n '1'\n >>> sum_digits_to_binary('a1b5c0d')\n '110'\n \"\"\"","function2_human":"def sum_digits_to_binary(string: str) -> str:\n \"\"\"\n Calculate the sum of numerical characters in the given string\n and return it as a binary representation.\n Examples:\n >>> sum_digits_to_binary('10a00')\n '1'\n >>> sum_digits_to_binary('a1b5c0d')\n '110'\n \"\"\"\n digits = ''.join([c for c in string if c.isdecimal()])\n return solve(int(digits))","function2_name":"sum_digits_to_binary","tests":"def check(candidate):\n assert candidate('1234') == '1010'\n assert candidate('a3b2c1d0e') == '110'\n assert candidate('sum2digits9to4binary1') == '10000'\n\ndef test_check():\n check(sum_digits_to_binary)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def add(lst: List[int]) -> int:\n \"\"\"Given a non-empty list of integers lst. add the even elements that are at odd indices..\n\n\n Examples:\n >>> add([4, 2, 6, 7])\n 2\n \"\"\"","function1_human":"def add(lst: List[int]) -> int:\n \"\"\"Given a non-empty list of integers lst. add the even elements that are at odd indices..\n\n\n Examples:\n >>> add([4, 2, 6, 7])\n 2\n \"\"\"\n return sum([lst[i] for i in range(1, len(lst), 2) if lst[i] % 2 == 0])","function1_name":"add","function2_signature":"def sum_even_second_digits(number: int) -> int:\n \"\"\"\n Return the sum of even numbers among every second digit in the given number.\n Examples:\n >>> sum_even_second_digits(4267)\n 2\n \"\"\"","function2_human":"def sum_even_second_digits(number: int) -> int:\n \"\"\"\n Return the sum of even numbers among every second digit in the given number.\n Examples:\n >>> sum_even_second_digits(4267)\n 2\n \"\"\"\n return add([int(c) for c in str(number)])","function2_name":"sum_even_second_digits","tests":"def check(candidate):\n assert candidate(123456) == 12\n assert candidate(234567) == 0\n assert candidate(202307102232) == 4\n\ndef test_check():\n check(sum_even_second_digits)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def anti_shuffle(s: str) -> str:\n \"\"\"\n Write a function that takes a string and returns an ordered version of it.\n Ordered version of string, is a string where all words (separated by space)\n are replaced by a new word where all the characters arranged in\n ascending order based on ascii value.\n Note: You should keep the order of words and blank spaces in the sentence.\n\n For example:\n >>> anti_shuffle('Hi')\n 'Hi'\n >>> anti_shuffle('hello')\n 'ehllo'\n >>> anti_shuffle('Hello World!!!')\n 'Hello !!!Wdlor'\n \"\"\"","function1_human":"def anti_shuffle(s: str) -> str:\n \"\"\"\n Write a function that takes a string and returns an ordered version of it.\n Ordered version of string, is a string where all words (separated by space)\n are replaced by a new word where all the characters arranged in\n ascending order based on ascii value.\n Note: You should keep the order of words and blank spaces in the sentence.\n\n For example:\n >>> anti_shuffle('Hi')\n 'Hi'\n >>> anti_shuffle('hello')\n 'ehllo'\n >>> anti_shuffle('Hello World!!!')\n 'Hello !!!Wdlor'\n \"\"\"\n return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])","function1_name":"anti_shuffle","function2_signature":"def sort_and_concatenate_strings(strings: List[str]) -> str:\n \"\"\"\n Implement a function that takes a list of strings,\n sorts each string in ascending order,\n and then concatenates them using a space as the separator.\n Examples:\n >>> sort_and_concatenate_strings(['hello'])\n 'ehllo'\n >>> sort_and_concatenate_strings(['Hello', 'World!!!'])\n 'Hello !!!Wdlor'\n \"\"\"","function2_human":"def sort_and_concatenate_strings(strings: List[str]) -> str:\n \"\"\"\n Implement a function that takes a list of strings,\n sorts each string in ascending order,\n and then concatenates them using a space as the separator.\n Examples:\n >>> sort_and_concatenate_strings(['hello'])\n 'ehllo'\n >>> sort_and_concatenate_strings(['Hello', 'World!!!'])\n 'Hello !!!Wdlor'\n \"\"\"\n return anti_shuffle(' '.join(strings))","function2_name":"sort_and_concatenate_strings","tests":"def check(candidate):\n assert candidate(['abcd', 'dcba', 'bdac']) == 'abcd abcd abcd'\n assert candidate(['sort', 'and', 'concatenate', 'strings']) == 'orst adn aacceennott ginrsst'\n assert candidate(['heLLo', 'worLd!']) == 'LLeho !Ldorw'\n\ndef test_check():\n check(sort_and_concatenate_strings)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Tuple","function1_signature":"def get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]:\n \"\"\"\n You are given a 2 dimensional data, as a nested lists,\n which is similar to matrix, however, unlike matrices,\n each row may contain a different number of columns.\n Given lst, and integer x, find integers x in the list,\n and return list of tuples, [(x1, y1), (x2, y2) ...] such that\n each tuple is a coordinate - (row, columns), starting with 0.\n Sort coordinates initially by rows in ascending order.\n Also, sort coordinates of the row by columns in descending order.\n\n Examples:\n >>> get_row([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)\n [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]\n >>> get_row([], 1)\n []\n >>> get_row([[], [1], [1, 2, 3]], 3)\n [(2, 2)]\n \"\"\"","function1_human":"def get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]:\n \"\"\"\n You are given a 2 dimensional data, as a nested lists,\n which is similar to matrix, however, unlike matrices,\n each row may contain a different number of columns.\n Given lst, and integer x, find integers x in the list,\n and return list of tuples, [(x1, y1), (x2, y2) ...] such that\n each tuple is a coordinate - (row, columns), starting with 0.\n Sort coordinates initially by rows in ascending order.\n Also, sort coordinates of the row by columns in descending order.\n\n Examples:\n >>> get_row([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)\n [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]\n >>> get_row([], 1)\n []\n >>> get_row([[], [1], [1, 2, 3]], 3)\n [(2, 2)]\n \"\"\"\n coords = [(i, j) for i in range(len(lst)) for j in range(len(lst[i])) if lst[i][j] == x]\n return sorted(sorted(coords, key=lambda x: x[1], reverse=True), key=lambda x: x[0])","function1_name":"get_row","function2_signature":"def count_integer_in_nested_lists(lst: List[List[int]], x: int) -> int:\n \"\"\"\n Implement a function that counts how many times an integer x appears\n in a list of lists of integers.\n Examples:\n >>> count_integer_in_nested_lists([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)\n 5\n >>> count_integer_in_nested_lists([[], [1], [1, 2, 3]], 3)\n 1\n \"\"\"","function2_human":"def count_integer_in_nested_lists(lst: List[List[int]], x: int) -> int:\n \"\"\"\n Implement a function that counts how many times an integer x appears\n in a list of lists of integers.\n Examples:\n >>> count_integer_in_nested_lists([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)\n 5\n >>> count_integer_in_nested_lists([[], [1], [1, 2, 3]], 3)\n 1\n \"\"\"\n return len(get_row(lst, x))","function2_name":"count_integer_in_nested_lists","tests":"def check(candidate):\n assert candidate([[0, 0, 0, 0, 0], [0, 0, 1, 0], [1, 1, 1]], 1) == 4\n assert candidate([[1, 3, 5, 7, 9], [], [3, 4, 5, 6, 7], []], 2) == 0\n assert candidate([[3, 3, 3, 3, 3], [3, 3, 3], [3]], 3) == 9\n\ndef test_check():\n check(count_integer_in_nested_lists)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def sort_array(array: List[int]) -> List[int]:\n \"\"\"\n Given an array of non-negative integers, return a copy of the given array after sorting,\n you will sort the given array in ascending order if the sum( first index value, last index value) is odd,\n or sort it in descending order if the sum( first index value, last index value) is even.\n\n Note:\n * don't change the given array.\n\n Examples:\n >>> sort_array([])\n []\n >>> sort_array([5])\n [5]\n >>> sort_array([2, 4, 3, 0, 1, 5])\n [0, 1, 2, 3, 4, 5]\n >>> sort_array([2, 4, 3, 0, 1, 5, 6])\n [6, 5, 4, 3, 2, 1, 0]\n \"\"\"","function1_human":"def sort_array(array: List[int]) -> List[int]:\n \"\"\"\n Given an array of non-negative integers, return a copy of the given array after sorting,\n you will sort the given array in ascending order if the sum( first index value, last index value) is odd,\n or sort it in descending order if the sum( first index value, last index value) is even.\n\n Note:\n * don't change the given array.\n\n Examples:\n >>> sort_array([])\n []\n >>> sort_array([5])\n [5]\n >>> sort_array([2, 4, 3, 0, 1, 5])\n [0, 1, 2, 3, 4, 5]\n >>> sort_array([2, 4, 3, 0, 1, 5, 6])\n [6, 5, 4, 3, 2, 1, 0]\n \"\"\"\n return [] if len(array) == 0 else sorted(array, reverse=(array[0] + array[-1]) % 2 == 0)","function1_name":"sort_array","function2_signature":"def count_elements_in_original_position(array: List[int]) -> int:\n \"\"\"\n Given an integer array, return the count of elements that remain in their original positions\n when the array is sorted in ascending order if the sum of the first and last elements is odd,\n or in descending order if the sum is even.\n Examples:\n >>> count_elements_in_original_position([2, 4, 3, 0, 1, 5])\n 1\n >>> count_elements_in_original_position([2, 4, 3, 0, 1, 5, 6])\n 0\n \"\"\"","function2_human":"def count_elements_in_original_position(array: List[int]) -> int:\n \"\"\"\n Given an integer array, return the count of elements that remain in their original positions\n when the array is sorted in ascending order if the sum of the first and last elements is odd,\n or in descending order if the sum is even.\n Examples:\n >>> count_elements_in_original_position([2, 4, 3, 0, 1, 5])\n 1\n >>> count_elements_in_original_position([2, 4, 3, 0, 1, 5, 6])\n 0\n \"\"\"\n sorted_array = sort_array(array)\n return len([1 for (a, b) in zip(array, sorted_array) if a == b])","function2_name":"count_elements_in_original_position","tests":"def check(candidate):\n assert candidate([10, 2, 8, 3, 1, 5, 4, 7, 9, 6]) == 4\n assert candidate([6, 8, 3, 1, 5, 7, 4, 2, 9]) == 3\n assert candidate([1, 3, 5, 3, 1, 3, 5]) == 1\n\ndef test_check():\n check(count_elements_in_original_position)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def encrypt(s: str) -> str:\n \"\"\"Create a function encrypt that takes a string as an argument and\n returns a string encrypted with the alphabet being rotated.\n The alphabet should be rotated in a manner such that the letters\n shift down by two multiplied to two places.\n For example:\n >>> encrypt('hi')\n 'lm'\n >>> encrypt('asdfghjkl')\n 'ewhjklnop'\n >>> encrypt('gf')\n 'kj'\n >>> encrypt('et')\n 'ix'\n \"\"\"","function1_human":"def encrypt(s: str) -> str:\n \"\"\"Create a function encrypt that takes a string as an argument and\n returns a string encrypted with the alphabet being rotated.\n The alphabet should be rotated in a manner such that the letters\n shift down by two multiplied to two places.\n For example:\n >>> encrypt('hi')\n 'lm'\n >>> encrypt('asdfghjkl')\n 'ewhjklnop'\n >>> encrypt('gf')\n 'kj'\n >>> encrypt('et')\n 'ix'\n \"\"\"\n d = 'abcdefghijklmnopqrstuvwxyz'\n out = ''\n for c in s:\n if c in d:\n out += d[(d.index(c) + 2 * 2) % 26]\n else:\n out += c\n return out","function1_name":"encrypt","function2_signature":"def is_start_of_end_with_x_after_encryption(string: str) -> bool:\n \"\"\"\n Implement a function that determines whether a given string starts or ends with 'x' after encryption.\n Examples:\n >>> is_start_of_end_with_x_after_encryption('gf')\n False\n >>> is_start_of_end_with_x_after_encryption('et')\n True\n \"\"\"","function2_human":"def is_start_of_end_with_x_after_encryption(string: str) -> bool:\n \"\"\"\n Implement a function that determines whether a given string starts or ends with 'x' after encryption.\n Examples:\n >>> is_start_of_end_with_x_after_encryption('gf')\n False\n >>> is_start_of_end_with_x_after_encryption('et')\n True\n \"\"\"\n string = encrypt(string)\n return string[0] == 'x' or string[-1] == 'x'","function2_name":"is_start_of_end_with_x_after_encryption","tests":"def check(candidate):\n assert candidate('abcdttttefgh') is False\n assert candidate('abcdefght') is True\n assert candidate('tttttttttt') is True\n\ndef test_check():\n check(is_start_of_end_with_x_after_encryption)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Optional","function1_signature":"def next_smallest(lst: List[int]) -> Optional[int]:\n \"\"\"\n You are given a list of integers.\n Write a function next_smallest() that returns the 2nd smallest element of the list.\n Return None if there is no such element.\n >>> next_smallest([1, 2, 3, 4, 5])\n 2\n >>> next_smallest([5, 1, 4, 3, 2])\n 2\n >>> next_smallest([])\n None\n >>> next_smallest([1, 1])\n None\n \"\"\"","function1_human":"def next_smallest(lst: List[int]) -> Optional[int]:\n \"\"\"\n You are given a list of integers.\n Write a function next_smallest() that returns the 2nd smallest element of the list.\n Return None if there is no such element.\n >>> next_smallest([1, 2, 3, 4, 5])\n 2\n >>> next_smallest([5, 1, 4, 3, 2])\n 2\n >>> next_smallest([])\n None\n >>> next_smallest([1, 1])\n None\n \"\"\"\n lst = sorted(set(lst))\n return None if len(lst) < 2 else lst[1]","function1_name":"next_smallest","function2_signature":"def remove_second_smallest(lst: List[int]) -> List[int]:\n \"\"\"\n Return the list obtained by removing the second smallest value(s) from the given integer list.\n If there is no such value, return the original integer list.\n Examples:\n >>> remove_second_smallest([1, 2, 3, 4, 5])\n [1, 3, 4, 5]\n >>> remove_second_smallest([1, 1])\n [1, 1]\n >>> remove_second_smallest([1, 1, 2, 2])\n [1, 1]\n \"\"\"","function2_human":"def remove_second_smallest(lst: List[int]) -> List[int]:\n \"\"\"\n Return the list obtained by removing the second smallest value(s) from the given integer list.\n If there is no such value, return the original integer list.\n Examples:\n >>> remove_second_smallest([1, 2, 3, 4, 5])\n [1, 3, 4, 5]\n >>> remove_second_smallest([1, 1])\n [1, 1]\n >>> remove_second_smallest([1, 1, 2, 2])\n [1, 1]\n \"\"\"\n second_smallest = next_smallest(lst)\n if second_smallest is not None:\n lst = [n for n in lst if n != second_smallest]\n return lst","function2_name":"remove_second_smallest","tests":"def check(candidate):\n assert candidate([5, 7, 1, 10, 2, 8, 9, 3, 4, 6]) == [5, 7, 1, 10, 8, 9, 3, 4, 6]\n assert candidate([1, 2, 2, 3, 3, 3, 3, 2, 1]) == [1, 3, 3, 3, 3, 1]\n assert candidate([2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]\n\ndef test_check():\n check(remove_second_smallest)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def is_bored(S: str) -> int:\n \"\"\"\n You'll be given a string of words, and your task is to count the number\n of boredoms. A boredom is a sentence that starts with the word \"I\".\n Sentences are delimited by '.', '?' or '!'.\n\n For example:\n >>> is_bored('Hello world')\n 0\n >>> is_bored('The sky is blue. The sun is shining. I love this weather')\n 1\n \"\"\"","function1_human":"def is_bored(S: str) -> int:\n \"\"\"\n You'll be given a string of words, and your task is to count the number\n of boredoms. A boredom is a sentence that starts with the word \"I\".\n Sentences are delimited by '.', '?' or '!'.\n\n For example:\n >>> is_bored('Hello world')\n 0\n >>> is_bored('The sky is blue. The sun is shining. I love this weather')\n 1\n \"\"\"\n import re\n sentences = re.split('[.?!]\\\\s*', S)\n return sum((sentence[0:2] == 'I ' for sentence in sentences))","function1_name":"is_bored","function2_signature":"def count_non_boredoms(string: str) -> int:\n \"\"\"\n Return the count of non-boredoms in the given string.\n Here, boredom refers to sentences starting with the word 'I',\n and sentences are separated by '.', '?', or '!'.\n Note that empty sentences are not counted.\n Examples:\n >>> is_bored('Hello world')\n 1\n >>> is_bored('The sky is blue. The sun is shining. I love this weather')\n 2\n >>> is_bored('. ? !')\n 0\n \"\"\"","function2_human":"def count_non_boredoms(string: str) -> int:\n \"\"\"\n Return the count of non-boredoms in the given string.\n Here, boredom refers to sentences starting with the word 'I',\n and sentences are separated by '.', '?', or '!'.\n Note that empty sentences are not counted.\n Examples:\n >>> is_bored('Hello world')\n 1\n >>> is_bored('The sky is blue. The sun is shining. I love this weather')\n 2\n >>> is_bored('. ? !')\n 0\n \"\"\"\n sentences = string.replace('?', '.').replace('!', '.').split('.')\n num_sentences = len([sentence for sentence in sentences if len(sentence.strip()) > 0])\n return num_sentences - is_bored(string)","function2_name":"count_non_boredoms","tests":"def check(candidate):\n assert candidate('aa. bb? cc! dd. ee? ff!') == 6\n assert candidate('You and I... A I!!') == 2\n assert candidate('Count non boredoms. This is good? I love you!') == 2\n\ndef test_check():\n check(count_non_boredoms)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def any_int(x: float, y: float, z: float) -> bool:\n \"\"\"\n Create a function that takes 3 numbers.\n Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.\n Returns false in any other cases.\n\n Examples\n >>> any_int(5, 2, 7)\n True\n\n >>> any_int(3, 2, 2)\n False\n\n >>> any_int(3, -2, 1)\n True\n\n >>> any_int(3.6, -2.2, 2)\n False\n\n\n\n \"\"\"","function1_human":"def any_int(x: float, y: float, z: float) -> bool:\n \"\"\"\n Create a function that takes 3 numbers.\n Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.\n Returns false in any other cases.\n\n Examples\n >>> any_int(5, 2, 7)\n True\n\n >>> any_int(3, 2, 2)\n False\n\n >>> any_int(3, -2, 1)\n True\n\n >>> any_int(3.6, -2.2, 2)\n False\n\n\n\n \"\"\"\n if isinstance(x, int) and isinstance(y, int) and isinstance(z, int):\n if x + y == z or x + z == y or y + z == x:\n return True\n return False\n return False","function1_name":"any_int","function2_signature":"def count_integer_sum_cases(xs: List[float], ys: List[float], zs: List[float]) -> int:\n \"\"\"\n Return the count of cases where,\n by selecting one element from each of the three given lists,\n if all three selected elements are integers\n and one element can be expressed as the sum of the other two elements.\n Examples:\n >>> count_integer_sum_cases([5, 10], [2], [7])\n 1\n >>> count_integer_sum_cases([3], [2, -2], [2, 1])\n 2\n \"\"\"","function2_human":"def count_integer_sum_cases(xs: List[float], ys: List[float], zs: List[float]) -> int:\n \"\"\"\n Return the count of cases where,\n by selecting one element from each of the three given lists,\n if all three selected elements are integers\n and one element can be expressed as the sum of the other two elements.\n Examples:\n >>> count_integer_sum_cases([5, 10], [2], [7])\n 1\n >>> count_integer_sum_cases([3], [2, -2], [2, 1])\n 2\n \"\"\"\n return len([1 for x in xs for y in ys for z in zs if any_int(x, y, z)])","function2_name":"count_integer_sum_cases","tests":"def check(candidate):\n assert candidate([1], [1, 2], [1, 2, 3]) == 3\n assert candidate([1], [1, 2.0], [1, 2, 3]) == 1\n assert candidate([-1, 0, 1], [-10, 0, 10], [-100, 0, 100]) == 1\n\ndef test_check():\n check(count_integer_sum_cases)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def encode(message: str) -> str:\n \"\"\"\n Write a function that takes a message, and encodes in such a\n way that it swaps case of all letters, replaces all vowels in\n the message with the letter that appears 2 places ahead of that\n vowel in the english alphabet.\n Assume only letters.\n\n Examples:\n >>> encode('test')\n 'TGST'\n >>> encode('This is a message')\n 'tHKS KS C MGSSCGG'\n \"\"\"","function1_human":"def encode(message: str) -> str:\n \"\"\"\n Write a function that takes a message, and encodes in such a\n way that it swaps case of all letters, replaces all vowels in\n the message with the letter that appears 2 places ahead of that\n vowel in the english alphabet.\n Assume only letters.\n\n Examples:\n >>> encode('test')\n 'TGST'\n >>> encode('This is a message')\n 'tHKS KS C MGSSCGG'\n \"\"\"\n vowels = 'aeiouAEIOU'\n vowels_replace = dict([(i, chr(ord(i) + 2)) for i in vowels])\n message = message.swapcase()\n return ''.join([vowels_replace[i] if i in vowels else i for i in message])","function1_name":"encode","function2_signature":"def count_changed_alphabet_characters(message: str) -> int:\n \"\"\"\n Return the count of characters in the given string\n that change their alphabet after encoding.\n Examples:\n >>> count_changed_alphabet_characters('test')\n 1\n >>> count_changed_alphabet_characters('This is a message')\n 6\n \"\"\"","function2_human":"def count_changed_alphabet_characters(message: str) -> int:\n \"\"\"\n Return the count of characters in the given string\n that change their alphabet after encoding.\n Examples:\n >>> count_changed_alphabet_characters('test')\n 1\n >>> count_changed_alphabet_characters('This is a message')\n 6\n \"\"\"\n encoded_message = encode(message)\n return len([1 for (a, b) in zip(message.lower(), encoded_message.lower()) if a != b])","function2_name":"count_changed_alphabet_characters","tests":"def check(candidate):\n assert candidate('abebcciddBCDOUBCD') == 5\n assert candidate('a bc def gae') == 4\n assert candidate('Count Changed Alphabet Characters') == 10\n\ndef test_check():\n check(count_changed_alphabet_characters)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def skjkasdkd(lst: List[int]) -> int:\n \"\"\"You are given a list of integers.\n You need to find the largest prime value and return the sum of its digits.\n\n Examples:\n >>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])\n 10\n >>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])\n 25\n >>> skjkasdkd([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])\n 13\n >>> skjkasdkd([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])\n 11\n >>> skjkasdkd([0, 81, 12, 3, 1, 21])\n 3\n >>> skjkasdkd([0, 8, 1, 2, 1, 7])\n 7\n \"\"\"","function1_human":"def skjkasdkd(lst: List[int]) -> int:\n \"\"\"You are given a list of integers.\n You need to find the largest prime value and return the sum of its digits.\n\n Examples:\n >>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])\n 10\n >>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])\n 25\n >>> skjkasdkd([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])\n 13\n >>> skjkasdkd([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])\n 11\n >>> skjkasdkd([0, 81, 12, 3, 1, 21])\n 3\n >>> skjkasdkd([0, 8, 1, 2, 1, 7])\n 7\n \"\"\"\n\n def isPrime(n):\n for i in range(2, int(n ** 0.5) + 1):\n if n % i == 0:\n return False\n return True\n maxx = 0\n i = 0\n while i < len(lst):\n if lst[i] > maxx and isPrime(lst[i]):\n maxx = lst[i]\n i += 1\n result = sum((int(digit) for digit in str(maxx)))\n return result","function1_name":"skjkasdkd","function2_signature":"def sum_of_digits_of_largest_prime_substring(integer: str) -> int:\n \"\"\"\n Given a string representing non-negative integers,\n return the sum of digits of the largest prime number among all the contiguous substrings of length 3.\n Examples:\n >>> sum_of_digits_of_largest_prime_substring('1019')\n 2\n >>> sum_of_digits_of_largest_prime_substring('10199')\n 19\n \"\"\"","function2_human":"def sum_of_digits_of_largest_prime_substring(integer: str) -> int:\n \"\"\"\n Given a string representing non-negative integers,\n return the sum of digits of the largest prime number among all the contiguous substrings of length 3.\n Examples:\n >>> sum_of_digits_of_largest_prime_substring('1019')\n 2\n >>> sum_of_digits_of_largest_prime_substring('10199')\n 19\n \"\"\"\n return skjkasdkd([int(integer[i:i + 3]) for i in range(len(integer) - 2)])","function2_name":"sum_of_digits_of_largest_prime_substring","tests":"def check(candidate):\n assert candidate('1232131') == 5\n assert candidate('99773') == 25\n assert candidate('20230711') == 10\n\ndef test_check():\n check(sum_of_digits_of_largest_prime_substring)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Dict, List","function1_signature":"def check_dict_case(dict: Dict[str, str]) -> bool:\n \"\"\"\n Given a dictionary, return True if all keys are strings in lower\n case or all keys are strings in upper case, else return False.\n The function should return False is the given dictionary is empty.\n Examples:\n >>> check_dict_case({ 'a': 'apple', 'b': 'banana' })\n True\n >>> check_dict_case({ 'a': 'apple', 'A': 'banana', 'B': 'banana' })\n False\n >>> check_dict_case({ 'a': 'apple', 8: 'banana', 'a': 'apple' })\n False\n >>> check_dict_case({ 'Name': 'John', 'Age': '36', 'City': 'Houston' })\n False\n >>> check_dict_case({ 'STATE': 'NC', 'ZIP': '12345' })\n True\n \"\"\"","function1_human":"def check_dict_case(dict: Dict[str, str]) -> bool:\n \"\"\"\n Given a dictionary, return True if all keys are strings in lower\n case or all keys are strings in upper case, else return False.\n The function should return False is the given dictionary is empty.\n Examples:\n >>> check_dict_case({ 'a': 'apple', 'b': 'banana' })\n True\n >>> check_dict_case({ 'a': 'apple', 'A': 'banana', 'B': 'banana' })\n False\n >>> check_dict_case({ 'a': 'apple', 8: 'banana', 'a': 'apple' })\n False\n >>> check_dict_case({ 'Name': 'John', 'Age': '36', 'City': 'Houston' })\n False\n >>> check_dict_case({ 'STATE': 'NC', 'ZIP': '12345' })\n True\n \"\"\"\n if len(dict.keys()) == 0:\n return False\n else:\n state = 'start'\n for key in dict.keys():\n if not isinstance(key, str):\n state = 'mixed'\n break\n if state == 'start':\n if key.isupper():\n state = 'upper'\n elif key.islower():\n state = 'lower'\n else:\n break\n elif state == 'upper' and (not key.isupper()) or (state == 'lower' and (not key.islower())):\n state = 'mixed'\n break\n else:\n break\n return state == 'upper' or state == 'lower'","function1_name":"check_dict_case","function2_signature":"def check_case_consistency(lst: List[str]) -> bool:\n \"\"\"\n Implement a function that returns true if all the strings in the given list\n are either all lowercase or all uppercase, and false otherwise.\n Examples:\n >>> check_case_consistency(['Name', 'Age', 'City'])\n False\n >>> check_case_consistency(['STATE', 'ZIP'])\n True\n \"\"\"","function2_human":"def check_case_consistency(lst: List[str]) -> bool:\n \"\"\"\n Implement a function that returns true if all the strings in the given list\n are either all lowercase or all uppercase, and false otherwise.\n Examples:\n >>> check_case_consistency(['Name', 'Age', 'City'])\n False\n >>> check_case_consistency(['STATE', 'ZIP'])\n True\n \"\"\"\n return check_dict_case({string: None for string in lst})","function2_name":"check_case_consistency","tests":"def check(candidate):\n assert candidate(['aa', 'bb', 'cc', 'abc', 'abcd']) is True\n assert candidate(['AAA', 'ABCD', 'ABCDE']) is True\n assert candidate(['Check', 'case', 'consistency']) is False\n\ndef test_check():\n check(check_case_consistency)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def count_up_to(n: int) -> List[int]:\n \"\"\"Implement a function that takes an non-negative integer and returns an array of the first n\n integers that are prime numbers and less than n.\n for example:\n >>> count_up_to(5)\n [2, 3]\n >>> count_up_to(11)\n [2, 3, 5, 7]\n >>> count_up_to(0)\n []\n >>> count_up_to(20)\n [2, 3, 5, 7, 11, 13, 17, 19]\n >>> count_up_to(1)\n []\n >>> count_up_to(18)\n [2, 3, 5, 7, 11, 13, 17]\n \"\"\"","function1_human":"def count_up_to(n: int) -> List[int]:\n \"\"\"Implement a function that takes an non-negative integer and returns an array of the first n\n integers that are prime numbers and less than n.\n for example:\n >>> count_up_to(5)\n [2, 3]\n >>> count_up_to(11)\n [2, 3, 5, 7]\n >>> count_up_to(0)\n []\n >>> count_up_to(20)\n [2, 3, 5, 7, 11, 13, 17, 19]\n >>> count_up_to(1)\n []\n >>> count_up_to(18)\n [2, 3, 5, 7, 11, 13, 17]\n \"\"\"\n primes = []\n for i in range(2, n):\n is_prime = True\n for j in range(2, i):\n if i % j == 0:\n is_prime = False\n break\n if is_prime:\n primes.append(i)\n return primes","function1_name":"count_up_to","function2_signature":"def sum_of_primes_smaller_than(number: int) -> int:\n \"\"\"\n Calculate the sum of all prime numbers smaller than the given number.\n Examples:\n >>> sum_of_primes_smaller_than(5)\n 5\n >>> sum_of_primes_smaller_than(11)\n 17\n \"\"\"","function2_human":"def sum_of_primes_smaller_than(number: int) -> int:\n \"\"\"\n Calculate the sum of all prime numbers smaller than the given number.\n Examples:\n >>> sum_of_primes_smaller_than(5)\n 5\n >>> sum_of_primes_smaller_than(11)\n 17\n \"\"\"\n return sum(count_up_to(number))","function2_name":"sum_of_primes_smaller_than","tests":"def check(candidate):\n assert candidate(2) == 0\n assert candidate(20) == 77\n assert candidate(100) == 1060\n\ndef test_check():\n check(sum_of_primes_smaller_than)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def multiply(a: int, b: int) -> int:\n \"\"\"Complete the function that takes two integers and returns\n the product of their unit digits.\n Assume the input is always valid.\n Examples:\n >>> multiply(148, 412)\n 16\n >>> multiply(19, 28)\n 72\n >>> multiply(2020, 1851)\n 0\n >>> multiply(14, -15)\n 20\n \"\"\"","function1_human":"def multiply(a: int, b: int) -> int:\n \"\"\"Complete the function that takes two integers and returns\n the product of their unit digits.\n Assume the input is always valid.\n Examples:\n >>> multiply(148, 412)\n 16\n >>> multiply(19, 28)\n 72\n >>> multiply(2020, 1851)\n 0\n >>> multiply(14, -15)\n 20\n \"\"\"\n return abs(a % 10) * abs(b % 10)","function1_name":"multiply","function2_signature":"def calculate_sum_or_difference_based_on_product(a: int, b: int) -> int:\n \"\"\"\n Implement an efficient function that returns the sum of the two numbers\n if their product is even, and the difference of the two numbers if their product is odd.\n Examples:\n >>> calculate_sum_or_difference_based_on_product(3, 4)\n 7\n >>> calculate_sum_or_difference_based_on_product(3, 5)\n -2\n \"\"\"","function2_human":"def calculate_sum_or_difference_based_on_product(a: int, b: int) -> int:\n \"\"\"\n Implement an efficient function that returns the sum of the two numbers\n if their product is even, and the difference of the two numbers if their product is odd.\n Examples:\n >>> calculate_sum_or_difference_based_on_product(3, 4)\n 7\n >>> calculate_sum_or_difference_based_on_product(3, 5)\n -2\n \"\"\"\n return a + b if multiply(a, b) % 2 == 0 else a - b","function2_name":"calculate_sum_or_difference_based_on_product","tests":"def check(candidate):\n assert candidate(11, 33) == -22\n assert candidate(22, 44) == 66\n assert candidate(-111, 333) == -444\n\ndef test_check():\n check(calculate_sum_or_difference_based_on_product)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def count_upper(s: str) -> int:\n \"\"\"\n Given a string s, count the number of uppercase vowels in even indices.\n\n For example:\n >>> count_upper('aBCdEf')\n 1\n >>> count_upper('abcdefg')\n 0\n >>> count_upper('dBBE')\n 0\n \"\"\"","function1_human":"def count_upper(s: str) -> int:\n \"\"\"\n Given a string s, count the number of uppercase vowels in even indices.\n\n For example:\n >>> count_upper('aBCdEf')\n 1\n >>> count_upper('abcdefg')\n 0\n >>> count_upper('dBBE')\n 0\n \"\"\"\n count = 0\n for i in range(0, len(s), 2):\n if s[i] in 'AEIOU':\n count += 1\n return count","function1_name":"count_upper","function2_signature":"def find_string_with_highest_uppercase_vowel_count_at_even_indices(strings: List[str]) -> str:\n \"\"\"\n Return the string from the given list of strings\n that has the highest count of uppercase vowels at even indices.\n In the case of having the same count, return the string that is located at the frontmost position.\n Examples:\n >>> find_string_with_highest_uppercase_vowel_count_at_even_indices(['aBCdEf', 'abcdefg', 'dBBE'])\n 'aBCdEf'\n >>> find_string_with_highest_uppercase_vowel_count_at_even_indices(['b', 'Eb', 'Ab'])\n 'Eb'\n \"\"\"","function2_human":"def find_string_with_highest_uppercase_vowel_count_at_even_indices(strings: List[str]) -> str:\n \"\"\"\n Return the string from the given list of strings\n that has the highest count of uppercase vowels at even indices.\n In the case of having the same count, return the string that is located at the frontmost position.\n Examples:\n >>> find_string_with_highest_uppercase_vowel_count_at_even_indices(['aBCdEf', 'abcdefg', 'dBBE'])\n 'aBCdEf'\n >>> find_string_with_highest_uppercase_vowel_count_at_even_indices(['b', 'Eb', 'Ab'])\n 'Eb'\n \"\"\"\n return max(strings, key=count_upper)","function2_name":"find_string_with_highest_uppercase_vowel_count_at_even_indices","tests":"def check(candidate):\n assert candidate(['ABBBBBBB', 'ABABABAB', 'AAAAAA', 'BBBBBBBBBB']) == 'ABABABAB'\n assert candidate(['BABEBIBOBU', 'acecicocuc', 'bbccAdd']) == 'bbccAdd'\n assert candidate(['ABEC', 'EBIC', 'IBOC', 'OBUC']) == 'ABEC'\n\ndef test_check():\n check(find_string_with_highest_uppercase_vowel_count_at_even_indices)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def closest_integer(value: str) -> int:\n \"\"\"\n Create a function that takes a value (string) representing a number\n and returns the closest integer to it. If the number is equidistant\n from two integers, round it away from zero.\n\n Examples\n >>> closest_integer('10')\n 10\n >>> closest_integer('15.3')\n 15\n\n Note:\n Rounding away from zero means that if the given number is equidistant\n from two integers, the one you should return is the one that is the\n farthest from zero. For example closest_integer(\"14.5\") should\n return 15 and closest_integer(\"-14.5\") should return -15.\n \"\"\"","function1_human":"def closest_integer(value: str) -> int:\n \"\"\"\n Create a function that takes a value (string) representing a number\n and returns the closest integer to it. If the number is equidistant\n from two integers, round it away from zero.\n\n Examples\n >>> closest_integer('10')\n 10\n >>> closest_integer('15.3')\n 15\n\n Note:\n Rounding away from zero means that if the given number is equidistant\n from two integers, the one you should return is the one that is the\n farthest from zero. For example closest_integer(\"14.5\") should\n return 15 and closest_integer(\"-14.5\") should return -15.\n \"\"\"\n from math import ceil, floor\n if value.count('.') == 1:\n while value[-1] == '0':\n value = value[:-1]\n num = float(value)\n if value[-2:] == '.5':\n if num > 0:\n res = ceil(num)\n else:\n res = floor(num)\n elif len(value) > 0:\n res = int(round(num))\n else:\n res = 0\n return res","function1_name":"closest_integer","function2_signature":"def find_largest_rearranged_decimal_number(number: str) -> int:\n \"\"\"\n Given a positive decimal number represented as a string,\n return the rounded value of the largest decimal number that can be obtained\n by rearranging the order of digits, excluding the decimal point (.).\n Examples:\n >>> find_largest_rearranged_decimal_number('13.24')\n 43\n \"\"\"","function2_human":"def find_largest_rearranged_decimal_number(number: str) -> int:\n \"\"\"\n Given a positive decimal number represented as a string,\n return the rounded value of the largest decimal number that can be obtained\n by rearranging the order of digits, excluding the decimal point (.).\n Examples:\n >>> find_largest_rearranged_decimal_number('13.24')\n 43\n \"\"\"\n index = number.index('.')\n digits = number[:index] + number[index + 1:]\n digits = ''.join(sorted(digits, reverse=True))\n number = digits[:index] + '.' + digits[index:]\n return closest_integer(number)","function2_name":"find_largest_rearranged_decimal_number","tests":"def check(candidate):\n assert candidate('1234.5678') == 8765\n assert candidate('567.567') == 777\n assert candidate('2023.0712') == 7322\n\ndef test_check():\n check(find_largest_rearranged_decimal_number)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def make_a_pile(n: int) -> List[int]:\n \"\"\"\n Given a positive integer n, you have to make a pile of n levels of stones.\n The first level has n stones.\n The number of stones in the next level is:\n - the next odd number if n is odd.\n - the next even number if n is even.\n Return the number of stones in each level in a list, where element at index\n i represents the number of stones in the level (i+1).\n\n Examples:\n >>> make_a_pile(3)\n [3, 5, 7]\n \"\"\"","function1_human":"def make_a_pile(n: int) -> List[int]:\n \"\"\"\n Given a positive integer n, you have to make a pile of n levels of stones.\n The first level has n stones.\n The number of stones in the next level is:\n - the next odd number if n is odd.\n - the next even number if n is even.\n Return the number of stones in each level in a list, where element at index\n i represents the number of stones in the level (i+1).\n\n Examples:\n >>> make_a_pile(3)\n [3, 5, 7]\n \"\"\"\n return [n + 2 * i for i in range(n)]","function1_name":"make_a_pile","function2_signature":"def get_last_elements_of_piles(numbers: List[int]) -> List[int]:\n \"\"\"\n Given a list of positive integers,\n return a list of the last elements of the piles corresponding to each integer.\n Examples:\n >>> get_last_elements_of_piles([2, 3])\n [4, 7]\n \"\"\"","function2_human":"def get_last_elements_of_piles(numbers: List[int]) -> List[int]:\n \"\"\"\n Given a list of positive integers,\n return a list of the last elements of the piles corresponding to each integer.\n Examples:\n >>> get_last_elements_of_piles([2, 3])\n [4, 7]\n \"\"\"\n return [make_a_pile(number)[-1] for number in numbers]","function2_name":"get_last_elements_of_piles","tests":"def check(candidate):\n assert candidate([1, 2, 3, 4, 5]) == [1, 4, 7, 10, 13]\n assert candidate([5, 3, 1, 5, 3, 1]) == [13, 7, 1, 13, 7, 1]\n assert candidate([7, 10]) == [19, 28]\n\ndef test_check():\n check(get_last_elements_of_piles)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def words_string(s: str) -> List[str]:\n \"\"\"\n You will be given a string of words separated by commas or spaces. Your task is\n to split the string into words and return an array of the words.\n\n For example:\n >>> words_string('Hi, my name is John')\n ['Hi', 'my', 'name', 'is', 'John']\n >>> words_string('One, two, three, four, five, six')\n ['One', 'two', 'three', 'four', 'five', 'six']\n \"\"\"","function1_human":"def words_string(s: str) -> List[str]:\n \"\"\"\n You will be given a string of words separated by commas or spaces. Your task is\n to split the string into words and return an array of the words.\n\n For example:\n >>> words_string('Hi, my name is John')\n ['Hi', 'my', 'name', 'is', 'John']\n >>> words_string('One, two, three, four, five, six')\n ['One', 'two', 'three', 'four', 'five', 'six']\n \"\"\"\n if not s:\n return []\n s_list = []\n for letter in s:\n if letter == ',':\n s_list.append(' ')\n else:\n s_list.append(letter)\n s_list = ''.join(s_list)\n return s_list.split()","function1_name":"words_string","function2_signature":"def words_string_lower(s: str) -> List[str]:\n \"\"\"\n You will be given a string of words separated by commas or spaces. Your task is\n to split the lowercased version of the string into words and return an array of the words.\n\n For example:\n >>> words_string_lower('Hi, my name is John')\n ['hi', 'my', 'name', 'is', 'john']\n >>> words_string_lower('One, two, three, four, five, six')\n ['one', 'two', 'three', 'four', 'five', 'six']\n \"\"\"","function2_human":"def words_string_lower(s: str) -> List[str]:\n \"\"\"\n You will be given a string of words separated by commas or spaces. Your task is\n to split the lowercased version of the string into words and return an array of the words.\n\n For example:\n >>> words_string_lower('Hi, my name is John')\n ['hi', 'my', 'name', 'is', 'john']\n >>> words_string_lower('One, two, three, four, five, six')\n ['one', 'two', 'three', 'four', 'five', 'six']\n \"\"\"\n return words_string(s.lower())","function2_name":"words_string_lower","tests":"def check(candidate):\n assert candidate('') == []\n assert candidate(' ') == []\n assert candidate('Hi, my name is John') == ['hi', 'my', 'name', 'is', 'john']\n assert candidate('One, two, three, Four, five') == ['one', 'two', 'three', 'four', 'five']\n assert candidate(' , APPLE BANANA,, CANDY') == ['apple', 'banana', 'candy']\n\ndef test_check():\n check(words_string_lower)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def choose_num(x: int, y: int) -> int:\n \"\"\"This function takes two positive numbers x and y and returns the\n biggest even integer number that is in the range [x, y] inclusive. If\n there's no such number, then the function should return -1.\n\n For example:\n >>> choose_num(12, 15)\n 14\n >>> choose_num(13, 12)\n -1\n \"\"\"","function1_human":"def choose_num(x: int, y: int) -> int:\n \"\"\"This function takes two positive numbers x and y and returns the\n biggest even integer number that is in the range [x, y] inclusive. If\n there's no such number, then the function should return -1.\n\n For example:\n >>> choose_num(12, 15)\n 14\n >>> choose_num(13, 12)\n -1\n \"\"\"\n if x > y:\n return -1\n if y % 2 == 0:\n return y\n if x == y:\n return -1\n return y - 1","function1_name":"choose_num","function2_signature":"def choose_num_two_intervals(x: int, y: int, z: int, w: int) -> int:\n \"\"\"This function takes two positive numbers x, y, z, and w and returns the\n biggest even integer number that is in the ranges [x, y] and [z, w] inclusive.\n If there's no such number, then the function should return -1.\n\n For example:\n >>> choose_num_two_intervals(12, 15, 18, 20)\n 20\n >>> choose_num_two_intervals(13, 12, 0, 10)\n -1\n \"\"\"","function2_human":"def choose_num_two_intervals(x: int, y: int, z: int, w: int) -> int:\n \"\"\"This function takes two positive numbers x, y, z, and w and returns the\n biggest even integer number that is in the ranges [x, y] and [z, w] inclusive.\n If there's no such number, then the function should return -1.\n\n For example:\n >>> choose_num_two_intervals(12, 15, 18, 20)\n 20\n >>> choose_num_two_intervals(13, 12, 0, 10)\n -1\n \"\"\"\n a = choose_num(x, y)\n b = choose_num(z, w)\n if a == -1 or b == -1:\n return -1\n else:\n return max(a, b)","function2_name":"choose_num_two_intervals","tests":"def check(candidate):\n assert candidate(12, 15, 18, 20) == 20\n assert candidate(13, 12, 1, 10) == -1\n assert candidate(1, 5, 2, 3) == 4\n assert candidate(10, 20, 13, 10) == -1\n assert candidate(8, 6, 4, 2) == -1\n assert candidate(2, 5, 5, 9) == 8\n\ndef test_check():\n check(choose_num_two_intervals)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Union","function1_signature":"def rounded_avg(n: int, m: int) -> Union[str, int]:\n \"\"\"You are given two positive integers n and m, and your task is to compute the\n average of the integers from n through m (including n and m).\n Round the answer to the nearest integer and convert that to binary.\n If n is greater than m, return -1.\n Example:\n >>> rounded_avg(1, 5)\n '0b11'\n >>> rounded_avg(7, 5)\n -1\n >>> rounded_avg(10, 20)\n '0b1111'\n >>> rounded_avg(20, 33)\n '0b11010'\n \"\"\"","function1_human":"def rounded_avg(n: int, m: int) -> Union[str, int]:\n \"\"\"You are given two positive integers n and m, and your task is to compute the\n average of the integers from n through m (including n and m).\n Round the answer to the nearest integer and convert that to binary.\n If n is greater than m, return -1.\n Example:\n >>> rounded_avg(1, 5)\n '0b11'\n >>> rounded_avg(7, 5)\n -1\n >>> rounded_avg(10, 20)\n '0b1111'\n >>> rounded_avg(20, 33)\n '0b11010'\n \"\"\"\n if m < n:\n return -1\n summation = 0\n for i in range(n, m + 1):\n summation += i\n return bin(round(summation \/ (m - n + 1)))","function1_name":"rounded_avg","function2_signature":"def biggest_multiplier_of_two(n: int, m: int) -> int:\n \"\"\"You are given two positive integers n and m, and your task is to compute the\n the biggest multiplier of 2 among the numbers that are smaller than\n the average of [n, m] rounded to the nearest integer.\n If n is greater than m, return -1.\n Example:\n >>> biggest_multiplier_of_two(1, 5)\n 2\n >>> biggest_multiplier_of_two(7, 5)\n -1\n >>> biggest_multiplier_of_two(10, 20)\n 8\n >>> biggest_multiplier_of_two(20, 33)\n 16\n \"\"\"","function2_human":"def biggest_multiplier_of_two(n: int, m: int) -> int:\n \"\"\"You are given two positive integers n and m, and your task is to compute the\n the biggest multiplier of 2 among the numbers that are smaller than\n the average of [n, m] rounded to the nearest integer.\n If n is greater than m, return -1.\n Example:\n >>> biggest_multiplier_of_two(1, 5)\n 2\n >>> biggest_multiplier_of_two(7, 5)\n -1\n >>> biggest_multiplier_of_two(10, 20)\n 8\n >>> biggest_multiplier_of_two(20, 33)\n 16\n \"\"\"\n if m < n:\n return -1\n return 2 ** (len(rounded_avg(n, m)) - 3)","function2_name":"biggest_multiplier_of_two","tests":"def check(candidate):\n assert candidate(1, 5) == 2\n assert candidate(7, 5) == -1\n assert candidate(10, 20) == 8\n assert candidate(20, 33) == 16\n assert candidate(1, 10) == 4\n assert candidate(16, 64) == 32\n\ndef test_check():\n check(biggest_multiplier_of_two)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def unique_digits(x: List[int]) -> List[int]:\n \"\"\"Given a list of positive integers x. return a sorted list of all\n elements that hasn't any even digit.\n\n Note: Returned list should be sorted in increasing order.\n\n For example:\n >>> unique_digits([15, 33, 1422, 1])\n [1, 15, 33]\n >>> unique_digits([152, 323, 1422, 10])\n []\n \"\"\"","function1_human":"def unique_digits(x: List[int]) -> List[int]:\n \"\"\"Given a list of positive integers x. return a sorted list of all\n elements that hasn't any even digit.\n\n Note: Returned list should be sorted in increasing order.\n\n For example:\n >>> unique_digits([15, 33, 1422, 1])\n [1, 15, 33]\n >>> unique_digits([152, 323, 1422, 10])\n []\n \"\"\"\n odd_digit_elements = []\n for i in x:\n if all((int(c) % 2 == 1 for c in str(i))):\n odd_digit_elements.append(i)\n return sorted(odd_digit_elements)","function1_name":"unique_digits","function2_signature":"def unique_sum_of_digits(x: List[int]) -> List[int]:\n \"\"\"Given a list of positive integers x. Compute a sorted list of all\n elements that hasn't any even digit, and convert each element into the\n sum of digits of the number.\n\n For example:\n >>> unique_sum_of_digits([15, 33, 1422, 1])\n [1, 6, 6]\n >>> unique_sum_of_digits([152, 323, 1422, 10])\n []\n \"\"\"","function2_human":"def unique_sum_of_digits(x: List[int]) -> List[int]:\n \"\"\"Given a list of positive integers x. Compute a sorted list of all\n elements that hasn't any even digit, and convert each element into the\n sum of digits of the number.\n\n For example:\n >>> unique_sum_of_digits([15, 33, 1422, 1])\n [1, 6, 6]\n >>> unique_sum_of_digits([152, 323, 1422, 10])\n []\n \"\"\"\n return [sum((int(digit) for digit in str(elem))) for elem in unique_digits(x)]","function2_name":"unique_sum_of_digits","tests":"def check(candidate):\n assert candidate([15, 33, 1422, 1]) == [1, 6, 6]\n assert candidate([152, 323, 1422, 10]) == []\n assert candidate([1, 2, 3, 4, 5, 6]) == [1, 3, 5]\n assert candidate([12, 34, 56, 78, 90]) == []\n assert candidate([11, 22, 33, 44, 55, 66]) == [2, 6, 10]\n assert candidate([97, 86, 75, 64, 53, 42, 31, 20]) == [4, 8, 12, 16]\n\ndef test_check():\n check(unique_sum_of_digits)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def by_length(arr: List[int]) -> List[str]:\n \"\"\"\n Given an array of integers, sort the integers that are between 1 and 9 inclusive,\n reverse the resulting array, and then replace each digit by its corresponding name from\n \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\".\n\n For example:\n >>> by_length([2, 1, 1, 4, 5, 8, 2, 3])\n ['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']\n\n If the array is empty, return an empty array:\n >>> by_length([])\n []\n\n If the array has any strange number ignore it:\n >>> by_length([1, -1, 55])\n ['One']\n \"\"\"","function1_human":"def by_length(arr: List[int]) -> List[str]:\n \"\"\"\n Given an array of integers, sort the integers that are between 1 and 9 inclusive,\n reverse the resulting array, and then replace each digit by its corresponding name from\n \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\".\n\n For example:\n >>> by_length([2, 1, 1, 4, 5, 8, 2, 3])\n ['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']\n\n If the array is empty, return an empty array:\n >>> by_length([])\n []\n\n If the array has any strange number ignore it:\n >>> by_length([1, -1, 55])\n ['One']\n \"\"\"\n dic = {1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}\n sorted_arr = sorted(arr, reverse=True)\n new_arr = []\n for var in sorted_arr:\n try:\n new_arr.append(dic[var])\n except:\n pass\n return new_arr","function1_name":"by_length","function2_signature":"def by_length_csv(arr: List[int]) -> str:\n \"\"\"\n Given an array of integers, sort the integers that are between 1 and 9 inclusive,\n reverse the resulting array, and then replace each digit by its corresponding name from\n \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\".\n Convert the list of digit names into a comma-separated string.\n\n For example:\n >>> by_length_csv([2, 1, 1, 4, 5, 8, 2, 3])\n 'Eight,Five,Four,Three,Two,Two,One,One'\n\n If the array is empty, return an empty string:\n >>> by_length_csv([])\n ''\n\n If the array has any strange number ignore it:\n >>> by_length_csv([1, -1, 55])\n 'One'\n \"\"\"","function2_human":"def by_length_csv(arr: List[int]) -> str:\n \"\"\"\n Given an array of integers, sort the integers that are between 1 and 9 inclusive,\n reverse the resulting array, and then replace each digit by its corresponding name from\n \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\".\n Convert the list of digit names into a comma-separated string.\n\n For example:\n >>> by_length_csv([2, 1, 1, 4, 5, 8, 2, 3])\n 'Eight,Five,Four,Three,Two,Two,One,One'\n\n If the array is empty, return an empty string:\n >>> by_length_csv([])\n ''\n\n If the array has any strange number ignore it:\n >>> by_length_csv([1, -1, 55])\n 'One'\n \"\"\"\n return ','.join(by_length(arr))","function2_name":"by_length_csv","tests":"def check(candidate):\n assert candidate([2, 1, 1, 4, 5, 8, 2, 3]) == 'Eight,Five,Four,Three,Two,Two,One,One'\n assert candidate([]) == ''\n assert candidate([1, -1, 55]) == 'One'\n assert candidate([1, 3, 5, 7]) == 'Seven,Five,Three,One'\n assert candidate([0, 0, 0, 0]) == ''\n assert candidate([99, 0, 1, 4, 4, 1]) == 'Four,Four,One,One'\n\ndef test_check():\n check(by_length_csv)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def f(n: int) -> List[int]:\n \"\"\"Implement the function f that takes n as a parameter,\n and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even\n or the sum of numbers from 1 to i otherwise.\n i starts from 1.\n the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).\n Example:\n >>> f(5)\n [1, 2, 6, 24, 15]\n \"\"\"","function1_human":"def f(n: int) -> List[int]:\n \"\"\"Implement the function f that takes n as a parameter,\n and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even\n or the sum of numbers from 1 to i otherwise.\n i starts from 1.\n the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).\n Example:\n >>> f(5)\n [1, 2, 6, 24, 15]\n \"\"\"\n ret = []\n for i in range(1, n + 1):\n if i % 2 == 0:\n x = 1\n for j in range(1, i + 1):\n x *= j\n ret += [x]\n else:\n x = 0\n for j in range(1, i + 1):\n x += j\n ret += [x]\n return ret","function1_name":"f","function2_signature":"def sorted_f(n: int) -> List[int]:\n \"\"\"Implement the function f that takes n as a parameter,\n and compute a list of size n, such that the value of the element at index i is the factorial of i if i is even\n or the sum of numbers from 1 to i otherwise.\n i starts from 1.\n Sort the integer values in a descending order.\n the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).\n Example:\n >>> sorted_f(5)\n [24, 15, 6, 2, 1]\n \"\"\"","function2_human":"def sorted_f(n: int) -> List[int]:\n \"\"\"Implement the function f that takes n as a parameter,\n and compute a list of size n, such that the value of the element at index i is the factorial of i if i is even\n or the sum of numbers from 1 to i otherwise.\n i starts from 1.\n Sort the integer values in a descending order.\n the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).\n Example:\n >>> sorted_f(5)\n [24, 15, 6, 2, 1]\n \"\"\"\n return sorted(f(n), reverse=True)","function2_name":"sorted_f","tests":"def check(candidate):\n assert candidate(1) == [1]\n assert candidate(5) == [24, 15, 6, 2, 1]\n assert candidate(10) == [3628800, 40320, 720, 45, 28, 24, 15, 6, 2, 1]\n\ndef test_check():\n check(sorted_f)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Tuple","function1_signature":"def even_odd_palindrome(n: int) -> Tuple[int, int]:\n \"\"\"\n Given a positive integer n, return a tuple that has the number of even and odd\n integer palindromes that fall within the range(1, n), inclusive.\n\n Example 1:\n\n >>> even_odd_palindrome(3)\n (1, 2)\n Explanation:\n Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.\n\n Example 2:\n\n >>> even_odd_palindrome(12)\n (4, 6)\n Explanation:\n Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.\n\n Note:\n 1. 1 <= n <= 10^3\n 2. returned tuple has the number of even and odd integer palindromes respectively.\n \"\"\"","function1_human":"def even_odd_palindrome(n: int) -> Tuple[int, int]:\n \"\"\"\n Given a positive integer n, return a tuple that has the number of even and odd\n integer palindromes that fall within the range(1, n), inclusive.\n\n Example 1:\n\n >>> even_odd_palindrome(3)\n (1, 2)\n Explanation:\n Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.\n\n Example 2:\n\n >>> even_odd_palindrome(12)\n (4, 6)\n Explanation:\n Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.\n\n Note:\n 1. 1 <= n <= 10^3\n 2. returned tuple has the number of even and odd integer palindromes respectively.\n \"\"\"\n\n def is_palindrome(n):\n return str(n) == str(n)[::-1]\n even_palindrome_count = 0\n odd_palindrome_count = 0\n for i in range(1, n + 1):\n if i % 2 == 1 and is_palindrome(i):\n odd_palindrome_count += 1\n elif i % 2 == 0 and is_palindrome(i):\n even_palindrome_count += 1\n return (even_palindrome_count, odd_palindrome_count)","function1_name":"even_odd_palindrome","function2_signature":"def even_odd_palindrome_interval(m: int, n: int) -> Tuple[int, int]:\n \"\"\"\n Given two positive integers m and n, return a tuple that has the number of even and odd\n integer palindromes that fall within the range(m+1, n), inclusive.\n If m is greater than n, return (0, 0).\n\n Example 1:\n\n >>> even_odd_palindrome_interval(3, 12)\n (3, 4)\n Explanation:\n Integer palindrome within the range(3+1, 12) are 4, 5, 6, 7, 8, 9, 11. three of them are even, and four of them are odd.\n\n Note:\n 1. 1 <= m, n <= 10^3\n 2. returned tuple has the number of even and odd integer palindromes respectively.\n \"\"\"","function2_human":"def even_odd_palindrome_interval(m: int, n: int) -> Tuple[int, int]:\n \"\"\"\n Given two positive integers m and n, return a tuple that has the number of even and odd\n integer palindromes that fall within the range(m+1, n), inclusive.\n If m is greater than n, return (0, 0).\n\n Example 1:\n\n >>> even_odd_palindrome_interval(3, 12)\n (3, 4)\n Explanation:\n Integer palindrome within the range(3+1, 12) are 4, 5, 6, 7, 8, 9, 11. three of them are even, and four of them are odd.\n\n Note:\n 1. 1 <= m, n <= 10^3\n 2. returned tuple has the number of even and odd integer palindromes respectively.\n \"\"\"\n if m > n:\n return (0, 0)\n return tuple((en - em for (em, en) in zip(even_odd_palindrome(m), even_odd_palindrome(n))))","function2_name":"even_odd_palindrome_interval","tests":"def check(candidate):\n assert candidate(3, 12) == (3, 4)\n assert candidate(5, 3) == (0, 0)\n assert candidate(4, 4) == (0, 0)\n assert candidate(4, 5) == (0, 1)\n assert candidate(10, 20) == (0, 1)\n assert candidate(11, 21) == (0, 0)\n\ndef test_check():\n check(even_odd_palindrome_interval)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def count_nums(arr: List[int]) -> int:\n \"\"\"\n Write a function count_nums which takes an array of integers and returns\n the number of elements which has a sum of digits > 0.\n If a number is negative, then its first signed digit will be negative:\n e.g. -123 has signed digits -1, 2, and 3.\n >>> count_nums([])\n 0\n >>> count_nums([-1, 11, -11])\n 1\n >>> count_nums([1, 1, 2])\n 3\n \"\"\"","function1_human":"def count_nums(arr: List[int]) -> int:\n \"\"\"\n Write a function count_nums which takes an array of integers and returns\n the number of elements which has a sum of digits > 0.\n If a number is negative, then its first signed digit will be negative:\n e.g. -123 has signed digits -1, 2, and 3.\n >>> count_nums([])\n 0\n >>> count_nums([-1, 11, -11])\n 1\n >>> count_nums([1, 1, 2])\n 3\n \"\"\"\n\n def digits_sum(n):\n neg = 1\n if n < 0:\n (n, neg) = (-1 * n, -1)\n n = [int(i) for i in str(n)]\n n[0] = n[0] * neg\n return sum(n)\n return len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))","function1_name":"count_nums","function2_signature":"def count_nums_union(arr1: List[int], arr2: List[int]) -> int:\n \"\"\"\n Write a function count_nums_union which takes two arrays of integers and returns\n the number of elements which has a sum of digits > 0 from union of the arrays (without repetition of elements).\n If a number is negative, then its first signed digit will be negative:\n e.g. -123 has signed digits -1, 2, and 3.\n >>> count_nums_union([], [])\n 0\n >>> count_nums_union([-1, 11, -11], [1, 1, 2])\n 3\n \"\"\"","function2_human":"def count_nums_union(arr1: List[int], arr2: List[int]) -> int:\n \"\"\"\n Write a function count_nums_union which takes two arrays of integers and returns\n the number of elements which has a sum of digits > 0 from union of the arrays (without repetition of elements).\n If a number is negative, then its first signed digit will be negative:\n e.g. -123 has signed digits -1, 2, and 3.\n >>> count_nums_union([], [])\n 0\n >>> count_nums_union([-1, 11, -11], [1, 1, 2])\n 3\n \"\"\"\n return count_nums(list(set(arr1) | set(arr2)))","function2_name":"count_nums_union","tests":"def check(candidate):\n assert candidate([], []) == 0\n assert candidate([-1, 11, -11], [1, 1, 2]) == 3\n assert candidate([-525, 124, 345], []) == 3\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4]) == 4\n assert candidate([-4, -3, -2, -1], [-2, -1, 0, 1]) == 1\n assert candidate([1, 1, 1, 1], [2, 2, 2, 2]) == 2\n\ndef test_check():\n check(count_nums_union)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def move_one_ball(arr: List[int]) -> bool:\n \"\"\"We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The\n numbers in the array will be randomly ordered. Your task is to determine if\n it is possible to get an array sorted in non-decreasing order by performing\n the following operation on the given array:\n You are allowed to perform right shift operation any number of times.\n\n One right shift operation means shifting all elements of the array by one\n position in the right direction. The last element of the array will be moved to\n the starting position in the array i.e. 0th index.\n\n If it is possible to obtain the sorted array by performing the above operation\n then return True else return False.\n If the given array is empty then return True.\n\n Note: The given list is guaranteed to have unique elements.\n\n For Example:\n\n >>> move_one_ball([3, 4, 5, 1, 2])\n True\n Explanation: By performin 2 right shift operations, non-decreasing order can\n be achieved for the given array.\n >>> move_one_ball([3, 5, 4, 1, 2])\n False\n Explanation:It is not possible to get non-decreasing order for the given\n array by performing any number of right shift operations.\n\n \"\"\"","function1_human":"def move_one_ball(arr: List[int]) -> bool:\n \"\"\"We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The\n numbers in the array will be randomly ordered. Your task is to determine if\n it is possible to get an array sorted in non-decreasing order by performing\n the following operation on the given array:\n You are allowed to perform right shift operation any number of times.\n\n One right shift operation means shifting all elements of the array by one\n position in the right direction. The last element of the array will be moved to\n the starting position in the array i.e. 0th index.\n\n If it is possible to obtain the sorted array by performing the above operation\n then return True else return False.\n If the given array is empty then return True.\n\n Note: The given list is guaranteed to have unique elements.\n\n For Example:\n\n >>> move_one_ball([3, 4, 5, 1, 2])\n True\n Explanation: By performin 2 right shift operations, non-decreasing order can\n be achieved for the given array.\n >>> move_one_ball([3, 5, 4, 1, 2])\n False\n Explanation:It is not possible to get non-decreasing order for the given\n array by performing any number of right shift operations.\n\n \"\"\"\n if len(arr) == 0:\n return True\n sorted_array = sorted(arr)\n my_arr = []\n min_value = min(arr)\n min_index = arr.index(min_value)\n my_arr = arr[min_index:] + arr[0:min_index]\n for i in range(len(arr)):\n if my_arr[i] != sorted_array[i]:\n return False\n return True","function1_name":"move_one_ball","function2_signature":"def move_one_ball_any_order(arr: List[int]) -> bool:\n \"\"\"We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The\n numbers in the array will be randomly ordered. Your task is to determine if\n it is possible to get an array sorted in non-decreasing or non-increasing order\n by performing the following operation on the given array:\n You are allowed to perform right shift operation any number of times.\n\n One right shift operation means shifting all elements of the array by one\n position in the right direction. The last element of the array will be moved to\n the starting position in the array i.e. 0th index.\n\n If it is possible to obtain the sorted array by performing the above operation\n then return True else return False.\n If the given array is empty then return True.\n\n Note: The given list is guaranteed to have unique elements.\n\n For Example:\n\n >>> move_one_ball_any_order([3, 4, 5, 1, 2])\n True\n Explanation: By performing 2 right shift operations, non-decreasing order can\n be achieved for the given array.\n >>> move_one_ball_any_order([2, 1, 5, 4, 3])\n True\n Explanation: By performing 3 right shift operations, non-increasing order can\n be achieved for the given array.\n >>> move_one_ball_any_order([3, 5, 4, 1, 2])\n False\n Explanation:It is not possible to get non-decreasing or non-increasing order\n for the given array by performing any number of right shift operations.\n\n \"\"\"","function2_human":"def move_one_ball_any_order(arr: List[int]) -> bool:\n \"\"\"We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The\n numbers in the array will be randomly ordered. Your task is to determine if\n it is possible to get an array sorted in non-decreasing or non-increasing order\n by performing the following operation on the given array:\n You are allowed to perform right shift operation any number of times.\n\n One right shift operation means shifting all elements of the array by one\n position in the right direction. The last element of the array will be moved to\n the starting position in the array i.e. 0th index.\n\n If it is possible to obtain the sorted array by performing the above operation\n then return True else return False.\n If the given array is empty then return True.\n\n Note: The given list is guaranteed to have unique elements.\n\n For Example:\n\n >>> move_one_ball_any_order([3, 4, 5, 1, 2])\n True\n Explanation: By performing 2 right shift operations, non-decreasing order can\n be achieved for the given array.\n >>> move_one_ball_any_order([2, 1, 5, 4, 3])\n True\n Explanation: By performing 3 right shift operations, non-increasing order can\n be achieved for the given array.\n >>> move_one_ball_any_order([3, 5, 4, 1, 2])\n False\n Explanation:It is not possible to get non-decreasing or non-increasing order\n for the given array by performing any number of right shift operations.\n\n \"\"\"\n return move_one_ball(arr) or move_one_ball([-e for e in arr])","function2_name":"move_one_ball_any_order","tests":"def check(candidate):\n assert candidate([3, 4, 5, 1, 2]) is True\n assert candidate([2, 1, 5, 4, 3]) is True\n assert candidate([3, 5, 4, 1, 2]) is False\n assert candidate([3, 5, 4, 2, 1]) is False\n assert candidate([5, 6, 7, 1, 2, 3, 4]) is True\n assert candidate([3, 2, 1, 7, 6, 5, 4]) is True\n\ndef test_check():\n check(move_one_ball_any_order)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def exchange(lst1: List[int], lst2: List[int]) -> str:\n \"\"\"In this problem, you will implement a function that takes two lists of numbers,\n and determines whether it is possible to perform an exchange of elements\n between them to make lst1 a list of only even numbers.\n There is no limit on the number of exchanged elements between lst1 and lst2.\n If it is possible to exchange elements between the lst1 and lst2 to make\n all the elements of lst1 to be even, return \"YES\".\n Otherwise, return \"NO\".\n For example:\n >>> exchange([1, 2, 3, 4], [1, 2, 3, 4])\n 'YES'\n >>> exchange([1, 2, 3, 4], [1, 5, 3, 4])\n 'NO'\n It is assumed that the input lists will be non-empty.\n \"\"\"","function1_human":"def exchange(lst1: List[int], lst2: List[int]) -> str:\n \"\"\"In this problem, you will implement a function that takes two lists of numbers,\n and determines whether it is possible to perform an exchange of elements\n between them to make lst1 a list of only even numbers.\n There is no limit on the number of exchanged elements between lst1 and lst2.\n If it is possible to exchange elements between the lst1 and lst2 to make\n all the elements of lst1 to be even, return \"YES\".\n Otherwise, return \"NO\".\n For example:\n >>> exchange([1, 2, 3, 4], [1, 2, 3, 4])\n 'YES'\n >>> exchange([1, 2, 3, 4], [1, 5, 3, 4])\n 'NO'\n It is assumed that the input lists will be non-empty.\n \"\"\"\n odd = 0\n even = 0\n for i in lst1:\n if i % 2 == 1:\n odd += 1\n for i in lst2:\n if i % 2 == 0:\n even += 1\n if even >= odd:\n return 'YES'\n return 'NO'","function1_name":"exchange","function2_signature":"def exchange_from_repetition(lst1: List[int], lst2: List[int], n: int) -> List[str]:\n \"\"\"In this problem, you will implement a function that takes two lists of numbers (lst1 and lst2) and a number (n),\n and determines whether it is possible to perform an exchange of elements\n between \"lst1\" and \"k-times repeated lst2\" (k <= n) to make lst1 a list of only even numbers.\n There is no limit on the number of exchanged elements between \"lst1\" and \"k-times repeated lst2\".\n Return the array of length n whose k-th element is \"YES\" if it is possible to exchange elements between the \"lst1\"\n and \"k-times repeated lst2\" to make all the elements of lst1 to be even.\n Otherwise, k-th element is \"NO\".\n For example:\n >>> exchange_from_repetition([1, 2, 3, 4], [1, 5, 3, 4], 1)\n ['NO']\n >>> exchange_from_repetition([1, 2, 3, 4], [1, 5, 3, 4], 3)\n ['NO', 'YES', 'YES']\n It is assumed that the input lists will be non-empty.\n \"\"\"","function2_human":"def exchange_from_repetition(lst1: List[int], lst2: List[int], n: int) -> List[str]:\n \"\"\"In this problem, you will implement a function that takes two lists of numbers (lst1 and lst2) and a number (n),\n and determines whether it is possible to perform an exchange of elements\n between \"lst1\" and \"k-times repeated lst2\" (k <= n) to make lst1 a list of only even numbers.\n There is no limit on the number of exchanged elements between \"lst1\" and \"k-times repeated lst2\".\n Return the array of length n whose k-th element is \"YES\" if it is possible to exchange elements between the \"lst1\"\n and \"k-times repeated lst2\" to make all the elements of lst1 to be even.\n Otherwise, k-th element is \"NO\".\n For example:\n >>> exchange_from_repetition([1, 2, 3, 4], [1, 5, 3, 4], 1)\n ['NO']\n >>> exchange_from_repetition([1, 2, 3, 4], [1, 5, 3, 4], 3)\n ['NO', 'YES', 'YES']\n It is assumed that the input lists will be non-empty.\n \"\"\"\n return [exchange(lst1, lst2 * k) for k in range(1, n + 1)]","function2_name":"exchange_from_repetition","tests":"def check(candidate):\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4], 1) == ['YES']\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4], 2) == ['YES', 'YES']\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4], 3) == ['YES', 'YES', 'YES']\n assert candidate([1, 2, 3, 4], [1, 5, 3, 4], 1) == ['NO']\n assert candidate([1, 2, 3, 4], [1, 5, 3, 4], 2) == ['NO', 'YES']\n assert candidate([1, 2, 3, 4], [1, 5, 3, 4], 3) == ['NO', 'YES', 'YES']\n\ndef test_check():\n check(exchange_from_repetition)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Dict, Tuple","function1_signature":"def histogram(test: str) -> Dict[str, int]:\n \"\"\"Given a string representing a space separated lowercase letters, return a dictionary\n of the letter with the most repetition and containing the corresponding count.\n If several letters have the same occurrence, return all of them.\n\n Example:\n >>> histogram('a b c')\n { 'a': 1, 'b': 1, 'c': 1 }\n >>> histogram('a b b a')\n { 'a': 2, 'b': 2 }\n >>> histogram('a b c a b')\n { 'a': 2, 'b': 2 }\n >>> histogram('b b b b a')\n { 'b': 4 }\n >>> histogram('')\n { }\n\n \"\"\"","function1_human":"def histogram(test: str) -> Dict[str, int]:\n \"\"\"Given a string representing a space separated lowercase letters, return a dictionary\n of the letter with the most repetition and containing the corresponding count.\n If several letters have the same occurrence, return all of them.\n\n Example:\n >>> histogram('a b c')\n { 'a': 1, 'b': 1, 'c': 1 }\n >>> histogram('a b b a')\n { 'a': 2, 'b': 2 }\n >>> histogram('a b c a b')\n { 'a': 2, 'b': 2 }\n >>> histogram('b b b b a')\n { 'b': 4 }\n >>> histogram('')\n { }\n\n \"\"\"\n dict1 = {}\n list1 = test.split(' ')\n t = 0\n for i in list1:\n if list1.count(i) > t and i != '':\n t = list1.count(i)\n if t > 0:\n for i in list1:\n if list1.count(i) == t:\n dict1[i] = t\n return dict1","function1_name":"histogram","function2_signature":"def most_frequent_letter(test: str) -> Tuple[str, int]:\n \"\"\"Given a string representing a space separated lowercase letters, return a tuple\n of the letter with the most repetition and containing the corresponding count.\n If several letters have the same occurrence, return the largest one in an alphabetical order.\n\n Example:\n >>> most_frequent_letter('a b c')\n ('c', 1)\n >>> most_frequent_letter('a b b a')\n ('b', 2)\n >>> most_frequent_letter('a b c a b')\n ('b', 2)\n \"\"\"","function2_human":"def most_frequent_letter(test: str) -> Tuple[str, int]:\n \"\"\"Given a string representing a space separated lowercase letters, return a tuple\n of the letter with the most repetition and containing the corresponding count.\n If several letters have the same occurrence, return the largest one in an alphabetical order.\n\n Example:\n >>> most_frequent_letter('a b c')\n ('c', 1)\n >>> most_frequent_letter('a b b a')\n ('b', 2)\n >>> most_frequent_letter('a b c a b')\n ('b', 2)\n \"\"\"\n return max([e for e in histogram(test).items()], key=lambda x: x[0])","function2_name":"most_frequent_letter","tests":"def check(candidate):\n assert candidate('a b c') == ('c', 1)\n assert candidate('a b b a') == ('b', 2)\n assert candidate('a b c a b') == ('b', 2)\n assert candidate('a b a a b') == ('a', 3)\n assert candidate('b b b b a') == ('b', 4)\n assert candidate('a b c d e e e f f f') == ('f', 3)\n\ndef test_check():\n check(most_frequent_letter)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Tuple","function1_signature":"def reverse_delete(s: str, c: str) -> Tuple[str, bool]:\n \"\"\"Task\n We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c\n then check if the result string is palindrome.\n A string is called palindrome if it reads the same backward as forward.\n You should return a tuple containing the result string and True\/False for the check.\n Example\n >>> reverse_delete('abcde', 'ae')\n ('bcd', False)\n >>> reverse_delete('abcdef', 'b')\n ('acdef', False)\n >>> reverse_delete('abcdedcba', 'ab')\n ('cdedc', True)\n \"\"\"","function1_human":"def reverse_delete(s: str, c: str) -> Tuple[str, bool]:\n \"\"\"Task\n We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c\n then check if the result string is palindrome.\n A string is called palindrome if it reads the same backward as forward.\n You should return a tuple containing the result string and True\/False for the check.\n Example\n >>> reverse_delete('abcde', 'ae')\n ('bcd', False)\n >>> reverse_delete('abcdef', 'b')\n ('acdef', False)\n >>> reverse_delete('abcdedcba', 'ab')\n ('cdedc', True)\n \"\"\"\n s = ''.join([char for char in s if char not in c])\n return (s, s[::-1] == s)","function1_name":"reverse_delete","function2_signature":"def reverse_delete_list(s: str, c: str) -> List[Tuple[str, bool]]:\n \"\"\"Task\n We are given two strings s and c, you have to deleted all the characters in s that are equal to each of the characters in c\n then check if each result string is palindrome.\n A string is called palindrome if it reads the same backward as forward.\n You should return a list of the tuples containing result string and True\/False for the check.\n Example\n >>> reverse_delete_list('abcde', 'ae')\n [('bcde', False), ('abcd', 'False')]\n >>> reverse_delete_list('abcdef', 'b')\n [('acdef', False)]\n >>> reverse_delete_list('abcdedcba', 'ab')\n [('bcdedcb', True), ('acdedca', True)]\n \"\"\"","function2_human":"def reverse_delete_list(s: str, c: str) -> List[Tuple[str, bool]]:\n \"\"\"Task\n We are given two strings s and c, you have to deleted all the characters in s that are equal to each of the characters in c\n then check if each result string is palindrome.\n A string is called palindrome if it reads the same backward as forward.\n You should return a list of the tuples containing result string and True\/False for the check.\n Example\n >>> reverse_delete_list('abcde', 'ae')\n [('bcde', False), ('abcd', 'False')]\n >>> reverse_delete_list('abcdef', 'b')\n [('acdef', False)]\n >>> reverse_delete_list('abcdedcba', 'ab')\n [('bcdedcb', True), ('acdedca', True)]\n \"\"\"\n return [reverse_delete(s, e) for e in c]","function2_name":"reverse_delete_list","tests":"def check(candidate):\n assert candidate('abcde', 'ae') == [('bcde', False), ('abcd', False)]\n assert candidate('abcdef', 'b') == [('acdef', False)]\n assert candidate('aabaa', 'b') == [('aaaa', True)]\n assert candidate('abcdedcba', 'ab') == [('bcdedcb', True), ('acdedca', True)]\n assert candidate('abcdedcba', 'abc') == [('bcdedcb', True), ('acdedca', True), ('abdedba', True)]\n assert candidate('eabcdefdcba', 'ef') == [('abcdfdcba', True), ('eabcdedcba', False)]\n\ndef test_check():\n check(reverse_delete_list)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def odd_count(lst: List[str]) -> List[str]:\n \"\"\"Given a list of strings, where each string consists of only digits, return a list.\n Each element i of the output should be \"the number of odd elements in the\n string i of the input.\" where all the i's should be replaced by the number\n of odd digits in the i'th string of the input.\n\n >>> odd_count(['1234567'])\n ['the number of odd elements 4n the str4ng 4 of the 4nput.']\n >>> odd_count(['3', '11111111'])\n ['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.']\n \"\"\"","function1_human":"def odd_count(lst: List[str]) -> List[str]:\n \"\"\"Given a list of strings, where each string consists of only digits, return a list.\n Each element i of the output should be \"the number of odd elements in the\n string i of the input.\" where all the i's should be replaced by the number\n of odd digits in the i'th string of the input.\n\n >>> odd_count(['1234567'])\n ['the number of odd elements 4n the str4ng 4 of the 4nput.']\n >>> odd_count(['3', '11111111'])\n ['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.']\n \"\"\"\n res = []\n for arr in lst:\n n = sum((int(d) % 2 == 1 for d in arr))\n res.append('the number of odd elements ' + str(n) + 'n the str' + str(n) + 'ng ' + str(n) + ' of the ' + str(n) + 'nput.')\n return res","function1_name":"odd_count","function2_signature":"def split_odd_count(lst: List[str], strsize: int) -> List[str]:\n \"\"\"Given a list of strings, where each string consists of only digits,\n first split each string into shorter ones with the length strsize and return a list.\n Each element i of the output should be \"the number of odd elements in the\n string i of the input.\" where all the i's should be replaced by the number\n of odd digits in the i'th string of the input.\n\n >>> split_odd_count(['1234567'], 7)\n ['the number of odd elements 4n the str4ng 4 of the 4nput.']\n >>> split_odd_count(['3', '11111111'], 4)\n ['the number of odd elements 1n the str1ng 1 of the 1nput.',\n 'the number of odd elements 4n the str4ng 4 of the 4nput.',\n 'the number of odd elements 4n the str4ng 4 of the 4nput.']\n \"\"\"","function2_human":"def split_odd_count(lst: List[str], strsize: int) -> List[str]:\n \"\"\"Given a list of strings, where each string consists of only digits,\n first split each string into shorter ones with the length strsize and return a list.\n Each element i of the output should be \"the number of odd elements in the\n string i of the input.\" where all the i's should be replaced by the number\n of odd digits in the i'th string of the input.\n\n >>> split_odd_count(['1234567'], 7)\n ['the number of odd elements 4n the str4ng 4 of the 4nput.']\n >>> split_odd_count(['3', '11111111'], 4)\n ['the number of odd elements 1n the str1ng 1 of the 1nput.',\n 'the number of odd elements 4n the str4ng 4 of the 4nput.',\n 'the number of odd elements 4n the str4ng 4 of the 4nput.']\n \"\"\"\n split_lst = [s[i:i + strsize] for s in lst for i in range(0, len(s), strsize)]\n return odd_count(split_lst)","function2_name":"split_odd_count","tests":"def check(candidate):\n assert candidate(['1234567'], 7) == ['the number of odd elements 4n the str4ng 4 of the 4nput.']\n assert candidate(['3', '11111111'], 4) == ['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 4n the str4ng 4 of the 4nput.', 'the number of odd elements 4n the str4ng 4 of the 4nput.']\n assert candidate(['1', '2'], 2) == ['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 0n the str0ng 0 of the 0nput.']\n assert candidate(['987234826349'], 6) == ['the number of odd elements 3n the str3ng 3 of the 3nput.', 'the number of odd elements 2n the str2ng 2 of the 2nput.']\n assert candidate(['987234826349'], 8) == ['the number of odd elements 3n the str3ng 3 of the 3nput.', 'the number of odd elements 2n the str2ng 2 of the 2nput.']\n assert candidate(['987234826349'], 10) == ['the number of odd elements 4n the str4ng 4 of the 4nput.', 'the number of odd elements 1n the str1ng 1 of the 1nput.']\n\ndef test_check():\n check(split_odd_count)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def minSubArraySum(nums: List[int]) -> int:\n \"\"\"\n Given an array of integers nums, find the minimum sum of any non-empty sub-array\n of nums.\n Example\n >>> minSubArraySum([2, 3, 4, 1, 2, 4])\n 1\n >>> minSubArraySum([-1, -2, -3])\n -6\n \"\"\"","function1_human":"def minSubArraySum(nums: List[int]) -> int:\n \"\"\"\n Given an array of integers nums, find the minimum sum of any non-empty sub-array\n of nums.\n Example\n >>> minSubArraySum([2, 3, 4, 1, 2, 4])\n 1\n >>> minSubArraySum([-1, -2, -3])\n -6\n \"\"\"\n max_sum = 0\n s = 0\n for num in nums:\n s += -num\n if s < 0:\n s = 0\n max_sum = max(s, max_sum)\n if max_sum == 0:\n max_sum = max((-i for i in nums))\n min_sum = -max_sum\n return min_sum","function1_name":"minSubArraySum","function2_signature":"def minSubArraySumNonNegative(nums: List[int]) -> int:\n \"\"\"\n Given an array of integers nums, find the minimum sum of any non-empty sub-array\n of nums. Consider all negative integers as 0.\n Example\n >>> minSubArraySumNonNegative([2, 3, 4, 1, 2, 4])\n 1\n >>> minSubArraySumNonNegative([-1, -2, -3])\n 0\n \"\"\"","function2_human":"def minSubArraySumNonNegative(nums: List[int]) -> int:\n \"\"\"\n Given an array of integers nums, find the minimum sum of any non-empty sub-array\n of nums. Consider all negative integers as 0.\n Example\n >>> minSubArraySumNonNegative([2, 3, 4, 1, 2, 4])\n 1\n >>> minSubArraySumNonNegative([-1, -2, -3])\n 0\n \"\"\"\n return minSubArraySum([max(e, 0) for e in nums])","function2_name":"minSubArraySumNonNegative","tests":"def check(candidate):\n assert candidate([2, 3, 4, 1, 2, 4]) == 1\n assert candidate([-1, -2, -3]) == 0\n assert candidate([1, 2, 3, 4, 1, 2, 3, 4]) == 1\n assert candidate([1, 2, -1, -3, -4, -5, 6, 1]) == 0\n assert candidate([0, 0, 0]) == 0\n assert candidate([1, 0, -1]) == 0\n\ndef test_check():\n check(minSubArraySumNonNegative)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"import math\nfrom typing import List","function1_signature":"def max_fill(grid: List[List[int]], capacity: int) -> int:\n \"\"\"\n You are given a rectangular grid of wells. Each row represents a single well,\n and each 1 in a row represents a single unit of water.\n Each well has a corresponding bucket that can be used to extract water from it,\n and all buckets have the same capacity.\n Your task is to use the buckets to empty the wells.\n Output the number of times you need to lower the buckets.\n\n Example 1:\n >>> max_fill([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)\n 6\n\n Example 2:\n >>> max_fill([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)\n 5\n\n Example 3:\n >>> max_fill([[0, 0, 0], [0, 0, 0]], 5)\n 0\n\n Constraints:\n * all wells have the same length\n * 1 <= grid.length <= 10^2\n * 1 <= grid[:,1].length <= 10^2\n * grid[i][j] -> 0 | 1\n * 1 <= capacity <= 10\n \"\"\"","function1_human":"def max_fill(grid: List[List[int]], capacity: int) -> int:\n \"\"\"\n You are given a rectangular grid of wells. Each row represents a single well,\n and each 1 in a row represents a single unit of water.\n Each well has a corresponding bucket that can be used to extract water from it,\n and all buckets have the same capacity.\n Your task is to use the buckets to empty the wells.\n Output the number of times you need to lower the buckets.\n\n Example 1:\n >>> max_fill([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)\n 6\n\n Example 2:\n >>> max_fill([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)\n 5\n\n Example 3:\n >>> max_fill([[0, 0, 0], [0, 0, 0]], 5)\n 0\n\n Constraints:\n * all wells have the same length\n * 1 <= grid.length <= 10^2\n * 1 <= grid[:,1].length <= 10^2\n * grid[i][j] -> 0 | 1\n * 1 <= capacity <= 10\n \"\"\"\n return sum([math.ceil(sum(arr) \/ capacity) for arr in grid])","function1_name":"max_fill","function2_signature":"def max_fill_buckets(grid: List[List[int]], capacities: List[int]) -> List[int]:\n \"\"\"\n You are given a rectangular grid of wells. Each row represents a single well,\n and each 1 in a row represents a single unit of water.\n Each well has corresponding buckets that can be used to extract water from it,\n and all buckets have the same capacity.\n Your task is to use the buckets with different capacities to empty the wells.\n Output the list of the number of times you need to lower the buckets for each capacity.\n\n Example 1:\n >>> max_fill_buckets([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], [1, 2])\n [6, 4]\n\n Example 2:\n >>> max_fill_buckets([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], [1, 2])\n [9, 5]\n\n Example 3:\n >>> max_fill_buckets([[0, 0, 0], [0, 0, 0]], [5])\n [0]\n\n Constraints:\n * all wells have the same length\n * 1 <= grid.length <= 10^2\n * 1 <= grid[:,1].length <= 10^2\n * grid[i][j] -> 0 | 1\n * 1 <= capacity <= 10\n \"\"\"","function2_human":"def max_fill_buckets(grid: List[List[int]], capacities: List[int]) -> List[int]:\n \"\"\"\n You are given a rectangular grid of wells. Each row represents a single well,\n and each 1 in a row represents a single unit of water.\n Each well has corresponding buckets that can be used to extract water from it,\n and all buckets have the same capacity.\n Your task is to use the buckets with different capacities to empty the wells.\n Output the list of the number of times you need to lower the buckets for each capacity.\n\n Example 1:\n >>> max_fill_buckets([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], [1, 2])\n [6, 4]\n\n Example 2:\n >>> max_fill_buckets([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], [1, 2])\n [9, 5]\n\n Example 3:\n >>> max_fill_buckets([[0, 0, 0], [0, 0, 0]], [5])\n [0]\n\n Constraints:\n * all wells have the same length\n * 1 <= grid.length <= 10^2\n * 1 <= grid[:,1].length <= 10^2\n * grid[i][j] -> 0 | 1\n * 1 <= capacity <= 10\n \"\"\"\n return [max_fill(grid, capacity) for capacity in capacities]","function2_name":"max_fill_buckets","tests":"def check(candidate):\n assert candidate([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], [1, 2]) == [6, 4]\n assert candidate([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], [3, 4]) == [4, 3]\n assert candidate([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], [1, 2]) == [9, 5]\n assert candidate([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], [3, 4]) == [4, 3]\n assert candidate([[0, 0, 0], [0, 0, 0]], [5]) == [0]\n assert candidate([[0, 0, 0], [0, 0, 0]], [1, 2, 3, 4, 5]) == [0, 0, 0, 0, 0]\n\ndef test_check():\n check(max_fill_buckets)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def sort_array(arr: List[int]) -> List[int]:\n \"\"\"\n In this Kata, you have to sort an array of non-negative integers according to\n number of ones in their binary representation in ascending order.\n For similar number of ones, sort based on decimal value.\n\n It must be implemented like this:\n >>> sort_array([1, 5, 2, 3, 4])\n [1, 2, 4, 3, 5]\n >>> sort_array([-2, -3, -4, -5, -6])\n [-4, -2, -6, -5, -3]\n >>> sort_array([1, 0, 2, 3, 4])\n [0, 1, 2, 4, 3]\n \"\"\"","function1_human":"def sort_array(arr: List[int]) -> List[int]:\n \"\"\"\n In this Kata, you have to sort an array of non-negative integers according to\n number of ones in their binary representation in ascending order.\n For similar number of ones, sort based on decimal value.\n\n It must be implemented like this:\n >>> sort_array([1, 5, 2, 3, 4])\n [1, 2, 4, 3, 5]\n >>> sort_array([-2, -3, -4, -5, -6])\n [-4, -2, -6, -5, -3]\n >>> sort_array([1, 0, 2, 3, 4])\n [0, 1, 2, 4, 3]\n \"\"\"\n return sorted(sorted(arr), key=lambda x: bin(x)[2:].count('1'))","function1_name":"sort_array","function2_signature":"def check_moving_sort_array(arr: List[int]) -> List[bool]:\n \"\"\"\n In this Kata, you have to sort an array of non-negative integers according to\n number of ones in their binary representation in ascending order.\n For similar number of ones, sort based on decimal value.\n Compare the original array and its sorted array, and then return the list of whether each\n element is moved or not from its original position. (True if it is moved, False otherwise.)\n\n It must be implemented like this:\n >>> check_moving_sort_array([1, 5, 2, 3, 4])\n [False, True, True, False, True]\n >>> check_moving_sort_array([-2, -3, -4, -5, -6])\n [True, True, True, False, True]\n >>> check_moving_sort_array([1, 0, 2, 3, 4])\n [True, True, False, True, True]\n \"\"\"","function2_human":"def check_moving_sort_array(arr: List[int]) -> List[bool]:\n \"\"\"\n In this Kata, you have to sort an array of non-negative integers according to\n number of ones in their binary representation in ascending order.\n For similar number of ones, sort based on decimal value.\n Compare the original array and its sorted array, and then return the list of whether each\n element is moved or not from its original position. (True if it is moved, False otherwise.)\n\n It must be implemented like this:\n >>> check_moving_sort_array([1, 5, 2, 3, 4])\n [False, True, True, False, True]\n >>> check_moving_sort_array([-2, -3, -4, -5, -6])\n [True, True, True, False, True]\n >>> check_moving_sort_array([1, 0, 2, 3, 4])\n [True, True, False, True, True]\n \"\"\"\n sorted_arr = sort_array(arr)\n return [True if a != b else False for (a, b) in zip(arr, sorted_arr)]","function2_name":"check_moving_sort_array","tests":"def check(candidate):\n assert candidate([1, 5, 2, 3, 4]) == [False, True, True, False, True]\n assert candidate([-2, -3, -4, -5, -6]) == [True, True, True, False, True]\n assert candidate([1, 0, 2, 3, 4]) == [True, True, False, True, True]\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8]) == [False, False, True, True, True, True, True, True]\n assert candidate([-4, -1, 9, 0, -9, 1, 4]) == [True, True, True, True, True, True, True]\n assert candidate([11, 14]) == [False, False]\n\ndef test_check():\n check(check_moving_sort_array)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def select_words(s: str, n: int) -> List[str]:\n \"\"\"Given a string s and a natural number n, you have been tasked to implement\n a function that returns a list of all words from string s that contain exactly\n n consonants, in order these words appear in the string s.\n If the string s is empty then the function should return an empty list.\n Note: you may assume the input string contains only letters and spaces.\n Examples:\n >>> select_words('Mary had a little lamb', 4)\n ['little']\n >>> select_words('Mary had a little lamb', 3)\n ['Mary', 'lamb']\n >>> select_words('simple white space', 2)\n []\n >>> select_words('Hello world', 4)\n ['world']\n >>> select_words('Uncle sam', 3)\n ['Uncle']\n \"\"\"","function1_human":"def select_words(s: str, n: int) -> List[str]:\n \"\"\"Given a string s and a natural number n, you have been tasked to implement\n a function that returns a list of all words from string s that contain exactly\n n consonants, in order these words appear in the string s.\n If the string s is empty then the function should return an empty list.\n Note: you may assume the input string contains only letters and spaces.\n Examples:\n >>> select_words('Mary had a little lamb', 4)\n ['little']\n >>> select_words('Mary had a little lamb', 3)\n ['Mary', 'lamb']\n >>> select_words('simple white space', 2)\n []\n >>> select_words('Hello world', 4)\n ['world']\n >>> select_words('Uncle sam', 3)\n ['Uncle']\n \"\"\"\n result = []\n for word in s.split():\n n_consonants = 0\n for i in range(0, len(word)):\n if word[i].lower() not in ['a', 'e', 'i', 'o', 'u']:\n n_consonants += 1\n if n_consonants == n:\n result.append(word)\n return result","function1_name":"select_words","function2_signature":"def select_largest_word(s: str, n: int) -> str:\n \"\"\"Given a string s and a natural number n, you have been tasked to implement\n a function that returns the word from string s that contain exactly n consonants.\n If there exist multiple words satisfying the condition, return the largest one in an alphabetical order.\n If the string s is empty then the function should return an empty string.\n Note: you may assume the input string contains only letters and spaces.\n Examples:\n >>> select_largest_word('Mary had a little lamb', 4)\n 'little'\n >>> select_largest_word('Mary had a little lamb', 3)\n 'lamb'\n >>> select_largest_word('simple white space', 2)\n ''\n >>> select_largest_word('Hello world', 4)\n 'world'\n >>> select_largest_word('Uncle sam', 3)\n 'Uncle'\n \"\"\"","function2_human":"def select_largest_word(s: str, n: int) -> str:\n \"\"\"Given a string s and a natural number n, you have been tasked to implement\n a function that returns the word from string s that contain exactly n consonants.\n If there exist multiple words satisfying the condition, return the largest one in an alphabetical order.\n If the string s is empty then the function should return an empty string.\n Note: you may assume the input string contains only letters and spaces.\n Examples:\n >>> select_largest_word('Mary had a little lamb', 4)\n 'little'\n >>> select_largest_word('Mary had a little lamb', 3)\n 'lamb'\n >>> select_largest_word('simple white space', 2)\n ''\n >>> select_largest_word('Hello world', 4)\n 'world'\n >>> select_largest_word('Uncle sam', 3)\n 'Uncle'\n \"\"\"\n return max(select_words(s, n) + [''])","function2_name":"select_largest_word","tests":"def check(candidate):\n assert candidate('Mary had a little lamb', 4) == 'little'\n assert candidate('Mary had a little lamb', 3) == 'lamb'\n assert candidate('simple white space', 2) == ''\n assert candidate('Hello world', 4) == 'world'\n assert candidate('Uncle sam', 3) == 'Uncle'\n assert candidate('baeiou aeiouz', 1) == 'baeiou'\n\ndef test_check():\n check(select_largest_word)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def get_closest_vowel(word: str) -> str:\n \"\"\"You are given a word. Your task is to find the closest vowel that stands between\n two consonants from the right side of the word (case sensitive).\n\n Vowels in the beginning and ending doesn't count. Return empty string if you didn't\n find any vowel met the above condition.\n\n You may assume that the given string contains English letter only.\n\n Example:\n >>> get_closest_vowel('yogurt')\n 'u'\n >>> get_closest_vowel('FULL')\n 'U'\n >>> get_closest_vowel('quick')\n ''\n >>> get_closest_vowel('ab')\n ''\n \"\"\"","function1_human":"def get_closest_vowel(word: str) -> str:\n \"\"\"You are given a word. Your task is to find the closest vowel that stands between\n two consonants from the right side of the word (case sensitive).\n\n Vowels in the beginning and ending doesn't count. Return empty string if you didn't\n find any vowel met the above condition.\n\n You may assume that the given string contains English letter only.\n\n Example:\n >>> get_closest_vowel('yogurt')\n 'u'\n >>> get_closest_vowel('FULL')\n 'U'\n >>> get_closest_vowel('quick')\n ''\n >>> get_closest_vowel('ab')\n ''\n \"\"\"\n if len(word) < 3:\n return ''\n vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'O', 'U', 'I'}\n for i in range(len(word) - 2, 0, -1):\n if word[i] in vowels:\n if word[i + 1] not in vowels and word[i - 1] not in vowels:\n return word[i]\n return ''","function1_name":"get_closest_vowel","function2_signature":"def transform_closest_vowel(s: str) -> str:\n \"\"\"You are given a string containing multiple words. Your task is to make a new string by changing each word\n to its closest vowel that stands between two consonants from the right side of the word (case sensitive).\n You need to concatenate all the closest vowels that are obtained from each word.\n\n Vowels in the beginning and ending doesn't count. Ignore the word if you didn't\n find any vowel met the above condition.\n\n You may assume that the given string contains English letter only.\n\n Example:\n >>> transform_closest_vowel('yogurt FULL')\n 'uU'\n >>> transform_closest_vowel('quick ab')\n ''\n \"\"\"","function2_human":"def transform_closest_vowel(s: str) -> str:\n \"\"\"You are given a string containing multiple words. Your task is to make a new string by changing each word\n to its closest vowel that stands between two consonants from the right side of the word (case sensitive).\n You need to concatenate all the closest vowels that are obtained from each word.\n\n Vowels in the beginning and ending doesn't count. Ignore the word if you didn't\n find any vowel met the above condition.\n\n You may assume that the given string contains English letter only.\n\n Example:\n >>> transform_closest_vowel('yogurt FULL')\n 'uU'\n >>> transform_closest_vowel('quick ab')\n ''\n \"\"\"\n return ''.join([get_closest_vowel(word) for word in s.split()])","function2_name":"transform_closest_vowel","tests":"def check(candidate):\n assert candidate('yogurt FULL') == 'uU'\n assert candidate('quick ab') == ''\n assert candidate('Alice loves Bob') == 'ieo'\n assert candidate('happy sunny day ever') == 'auae'\n assert candidate('aaa bbb ccc ddd') == ''\n assert candidate('fox and dog') == 'oo'\n\ndef test_check():\n check(transform_closest_vowel)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def match_parens(lst: List[str]) -> str:\n \"\"\"\n You are given a list of two strings, both strings consist of open\n parentheses '(' or close parentheses ')' only.\n Your job is to check if it is possible to concatenate the two strings in\n some order, that the resulting string will be good.\n A string S is considered to be good if and only if all parentheses in S\n are balanced. For example: the string '(())()' is good, while the string\n '())' is not.\n Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.\n\n Examples:\n >>> match_parens(['()(', ')'])\n 'Yes'\n >>> match_parens([')', ')'])\n 'No'\n \"\"\"","function1_human":"def match_parens(lst: List[str]) -> str:\n \"\"\"\n You are given a list of two strings, both strings consist of open\n parentheses '(' or close parentheses ')' only.\n Your job is to check if it is possible to concatenate the two strings in\n some order, that the resulting string will be good.\n A string S is considered to be good if and only if all parentheses in S\n are balanced. For example: the string '(())()' is good, while the string\n '())' is not.\n Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.\n\n Examples:\n >>> match_parens(['()(', ')'])\n 'Yes'\n >>> match_parens([')', ')'])\n 'No'\n \"\"\"\n\n def check(s):\n val = 0\n for i in s:\n if i == '(':\n val = val + 1\n else:\n val = val - 1\n if val < 0:\n return False\n return True if val == 0 else False\n S1 = lst[0] + lst[1]\n S2 = lst[1] + lst[0]\n return 'Yes' if check(S1) or check(S2) else 'No'","function1_name":"match_parens","function2_signature":"def match_parens_from_list(str1: str, lst2: List[str]) -> str:\n \"\"\"\n You are given a string (str1) and a list of strings (lst2), where every string consists of open\n parentheses '(' or close parentheses ')' only.\n Your job is to check if it is possible to concatenate a string (selected from the list lst2)\n and the first string str1 in some order, that the resulting string will be good.\n A string S is considered to be good if and only if all parentheses in S\n are balanced. For example: the string '(())()' is good, while the string '())' is not.\n Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.\n\n Examples:\n >>> match_parens_from_list('()(' [')', '(((())(()())))'])\n 'Yes'\n >>> match_parens_from_list(')', [')'])\n 'No'\n \"\"\"","function2_human":"def match_parens_from_list(str1: str, lst2: List[str]) -> str:\n \"\"\"\n You are given a string (str1) and a list of strings (lst2), where every string consists of open\n parentheses '(' or close parentheses ')' only.\n Your job is to check if it is possible to concatenate a string (selected from the list lst2)\n and the first string str1 in some order, that the resulting string will be good.\n A string S is considered to be good if and only if all parentheses in S\n are balanced. For example: the string '(())()' is good, while the string '())' is not.\n Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.\n\n Examples:\n >>> match_parens_from_list('()(' [')', '(((())(()())))'])\n 'Yes'\n >>> match_parens_from_list(')', [')'])\n 'No'\n \"\"\"\n for str2 in lst2:\n if match_parens([str1, str2]) == 'Yes':\n return 'Yes'\n return 'No'","function2_name":"match_parens_from_list","tests":"def check(candidate):\n assert candidate('()(', [')', '(((())(()())))']) == 'Yes'\n assert candidate(')', [')']) == 'No'\n assert candidate('()((', ['))', '((()())']) == 'Yes'\n assert candidate('()((', ['(((()()))', ')']) == 'No'\n assert candidate('()((', ['(((()()))', ')', ')))', '))))']) == 'No'\n assert candidate('()((', ['(((()()))', ')', '))']) == 'Yes'\n\ndef test_check():\n check(match_parens_from_list)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def maximum(arr: List[int], k: int) -> List[int]:\n \"\"\"\n Given an array arr of integers and a positive integer k, return a sorted list\n of length k with the maximum k numbers in arr.\n\n Example 1:\n\n >>> maximum([-3, -4, 5], 3)\n [-4, -3, 5]\n\n Example 2:\n\n >>> maximum([4, -4, 4], 2)\n [4, 4]\n\n Example 3:\n\n >>> maximum([-3, 2, 1, 2, -1, -2, 1], 1)\n [2]\n\n Note:\n 1. The length of the array will be in the range of [1, 1000].\n 2. The elements in the array will be in the range of [-1000, 1000].\n 3. 0 <= k <= len(arr)\n \"\"\"","function1_human":"def maximum(arr: List[int], k: int) -> List[int]:\n \"\"\"\n Given an array arr of integers and a positive integer k, return a sorted list\n of length k with the maximum k numbers in arr.\n\n Example 1:\n\n >>> maximum([-3, -4, 5], 3)\n [-4, -3, 5]\n\n Example 2:\n\n >>> maximum([4, -4, 4], 2)\n [4, 4]\n\n Example 3:\n\n >>> maximum([-3, 2, 1, 2, -1, -2, 1], 1)\n [2]\n\n Note:\n 1. The length of the array will be in the range of [1, 1000].\n 2. The elements in the array will be in the range of [-1000, 1000].\n 3. 0 <= k <= len(arr)\n \"\"\"\n if k == 0:\n return []\n arr.sort()\n ans = arr[-k:]\n return ans","function1_name":"maximum","function2_signature":"def minimum_of_maximum_subarrays(arrays: List[List[int]], k: int) -> int:\n \"\"\"\n Given a list of arrays and a positive integer k, return the minimal integer among the arrays.\n\n Example 1:\n\n >>> minimum_of_maximum_subarrays([[-3, -4, 5], [4, -4, 4], [-3, 2, 1, 2, -1, -2, 1]], 2)\n -3\n\n Example 2:\n\n >>> minimum_of_maximum_subarrays([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1)\n 3\n\n Note:\n 1. Each array in the list will have length in the range of [1, 1000].\n 2. The elements in each array will be in the range of [-1000, 1000].\n 3. 1 <= k <= min([len(arr) for arr in arrays])\n \"\"\"","function2_human":"def minimum_of_maximum_subarrays(arrays: List[List[int]], k: int) -> int:\n \"\"\"\n Given a list of arrays and a positive integer k, return the minimal integer among the arrays.\n\n Example 1:\n\n >>> minimum_of_maximum_subarrays([[-3, -4, 5], [4, -4, 4], [-3, 2, 1, 2, -1, -2, 1]], 2)\n -3\n\n Example 2:\n\n >>> minimum_of_maximum_subarrays([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1)\n 3\n\n Note:\n 1. Each array in the list will have length in the range of [1, 1000].\n 2. The elements in each array will be in the range of [-1000, 1000].\n 3. 1 <= k <= min([len(arr) for arr in arrays])\n \"\"\"\n mins = [maximum(arr, k)[0] for arr in arrays]\n return min(mins)","function2_name":"minimum_of_maximum_subarrays","tests":"def check(candidate):\n assert candidate([[9, 3, 7], [5, 6]], 2) == 5\n assert candidate([[37, 51, 22], [99, 13, 45], [43, 36, 28], [28, 39, 22]], 1) == 39\n assert candidate([[50, 40, 20, 10], [22, 62, 78, 90]], 4) == 10\n\ndef test_check():\n check(minimum_of_maximum_subarrays)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def solution(lst: List[int]) -> int:\n \"\"\"Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.\n\n\n Examples\n >>> solution([5, 8, 7, 1])\n 12\n >>> solution([3, 3, 3, 3, 3])\n 9\n >>> solution([30, 13, 24, 321])\n 0\n \"\"\"","function1_human":"def solution(lst: List[int]) -> int:\n \"\"\"Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.\n\n\n Examples\n >>> solution([5, 8, 7, 1])\n 12\n >>> solution([3, 3, 3, 3, 3])\n 9\n >>> solution([30, 13, 24, 321])\n 0\n \"\"\"\n return sum([x for (idx, x) in enumerate(lst) if idx % 2 == 0 and x % 2 == 1])","function1_name":"solution","function2_signature":"def alternate_sum(arrays: List[List[int]]) -> int:\n \"\"\"Given a list of arrays, return the sum of all of the odd elements that are in even positions\n of all arrays in even positions minus the sum of all of the odd elements that are in odd positions.\n\n\n Examples\n >>> alternate_sum([[5, 8, 7, 1], [3, 3, 3, 3, 3]])\n 3\n >>> alternate_sum([[30, 13, 24, 321], [3, 3, 3, 3, 3]])\n -9\n \"\"\"","function2_human":"def alternate_sum(arrays: List[List[int]]) -> int:\n \"\"\"Given a list of arrays, return the sum of all of the odd elements that are in even positions\n of all arrays in even positions minus the sum of all of the odd elements that are in odd positions.\n\n\n Examples\n >>> alternate_sum([[5, 8, 7, 1], [3, 3, 3, 3, 3]])\n 3\n >>> alternate_sum([[30, 13, 24, 321], [3, 3, 3, 3, 3]])\n -9\n \"\"\"\n return sum([solution(x) for (idx, x) in enumerate(arrays) if idx % 2 == 0]) - sum([solution(x) for (idx, x) in enumerate(arrays) if idx % 2 == 1])","function2_name":"alternate_sum","tests":"def check(candidate):\n assert candidate([[1, 2, 3, 4], [5, 6, 7, 8, 9]]) == -17\n assert candidate([[10, 11], [-4, -5, -6, -7], [1, 3, 5, 7, 9]]) == 15\n assert candidate([[6, 4, 3, -1, -2], [8, 9, 10, 11]]) == 3\n\ndef test_check():\n check(alternate_sum)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def add_elements(arr: List[int], k: int) -> int:\n \"\"\"\n Given a non-empty array of integers arr and an integer k, return\n the sum of the elements with at most two digits from the first k elements of arr.\n\n Example:\n\n >>> add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4)\n 24\n\n Constraints:\n 1. 1 <= len(arr) <= 100\n 2. 1 <= k <= len(arr)\n \"\"\"","function1_human":"def add_elements(arr: List[int], k: int) -> int:\n \"\"\"\n Given a non-empty array of integers arr and an integer k, return\n the sum of the elements with at most two digits from the first k elements of arr.\n\n Example:\n\n >>> add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4)\n 24\n\n Constraints:\n 1. 1 <= len(arr) <= 100\n 2. 1 <= k <= len(arr)\n \"\"\"\n return sum((elem for elem in arr[:k] if len(str(elem)) <= 2))","function1_name":"add_elements","function2_signature":"def max_num_passengers(arr: List[int]) -> int:\n \"\"\"\n Given an array of integers arr where each element represents the weight of\n passengers, return the maximum number of passengers that can be carried on\n a single elevator given that the sum of all the weights must be less than 100.\n\n Examples:\n\n >>> max_num_passengers([111, 21, 3, 4000, 5, 6, 7, 8, 9])\n 7\n >>> max_num_passengers([215, 327, 102])\n 0\n\n Constraints:\n 1. 1 <= len(arr) <= 100\n 2. arr[i] > 0\n \"\"\"","function2_human":"def max_num_passengers(arr: List[int]) -> int:\n \"\"\"\n Given an array of integers arr where each element represents the weight of\n passengers, return the maximum number of passengers that can be carried on\n a single elevator given that the sum of all the weights must be less than 100.\n\n Examples:\n\n >>> max_num_passengers([111, 21, 3, 4000, 5, 6, 7, 8, 9])\n 7\n >>> max_num_passengers([215, 327, 102])\n 0\n\n Constraints:\n 1. 1 <= len(arr) <= 100\n 2. arr[i] > 0\n \"\"\"\n arr.sort()\n for k in range(1, len(arr) + 1):\n if add_elements(arr, k) >= 100:\n return k - 1\n return len(arr)","function2_name":"max_num_passengers","tests":"def check(candidate):\n assert candidate([70, 13, 25, 10, 10, 45]) == 4\n assert candidate([60, 55, 42, 37, 97]) == 2\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9]) == 9\n\ndef test_check():\n check(max_num_passengers)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def get_odd_collatz(n: int) -> List[int]:\n \"\"\"\n Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.\n\n The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined\n as follows: start with any positive integer n. Then each term is obtained from the\n previous term as follows: if the previous term is even, the next term is one half of\n the previous term. If the previous term is odd, the next term is 3 times the previous\n term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.\n\n Note:\n 1. Collatz(1) is [1].\n 2. returned list sorted in increasing order.\n\n For example:\n get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.\n >>> get_odd_collatz(5)\n [1, 5]\n \"\"\"","function1_human":"def get_odd_collatz(n: int) -> List[int]:\n \"\"\"\n Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.\n\n The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined\n as follows: start with any positive integer n. Then each term is obtained from the\n previous term as follows: if the previous term is even, the next term is one half of\n the previous term. If the previous term is odd, the next term is 3 times the previous\n term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.\n\n Note:\n 1. Collatz(1) is [1].\n 2. returned list sorted in increasing order.\n\n For example:\n get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.\n >>> get_odd_collatz(5)\n [1, 5]\n \"\"\"\n if n % 2 == 0:\n odd_collatz = []\n else:\n odd_collatz = [n]\n while n > 1:\n if n % 2 == 0:\n n = n \/ 2\n else:\n n = n * 3 + 1\n if n % 2 == 1:\n odd_collatz.append(int(n))\n return sorted(odd_collatz)","function1_name":"get_odd_collatz","function2_signature":"def sum_odd_collatz(n: int) -> int:\n \"\"\"\n Given a positive integer n, return the sum of odd numbers in collatz sequence.\n\n Examples:\n\n >>> sum_odd_collatz(5)\n 6\n >>> sum_odd_collatz(10)\n 6\n \"\"\"","function2_human":"def sum_odd_collatz(n: int) -> int:\n \"\"\"\n Given a positive integer n, return the sum of odd numbers in collatz sequence.\n\n Examples:\n\n >>> sum_odd_collatz(5)\n 6\n >>> sum_odd_collatz(10)\n 6\n \"\"\"\n return sum(get_odd_collatz(n))","function2_name":"sum_odd_collatz","tests":"def check(candidate):\n assert candidate(11) == 47\n assert candidate(7) == 54\n assert candidate(100) == 19\n\ndef test_check():\n check(sum_odd_collatz)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def valid_date(date: str) -> bool:\n \"\"\"You have to write a function which validates a given date string and\n returns True if the date is valid otherwise False.\n The date is valid if all of the following rules are satisfied:\n 1. The date string is not empty.\n 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.\n 3. The months should not be less than 1 or higher than 12.\n 4. The date should be in the format: mm-dd-yyyy\n\n >>> valid_date('03-11-2000')\n True\n\n >>> valid_date('15-01-2012')\n False\n\n >>> valid_date('04-0-2040')\n False\n\n >>> valid_date('06-04-2020')\n True\n\n >>> valid_date('06\/04\/2020')\n False\n \"\"\"","function1_human":"def valid_date(date: str) -> bool:\n \"\"\"You have to write a function which validates a given date string and\n returns True if the date is valid otherwise False.\n The date is valid if all of the following rules are satisfied:\n 1. The date string is not empty.\n 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.\n 3. The months should not be less than 1 or higher than 12.\n 4. The date should be in the format: mm-dd-yyyy\n\n >>> valid_date('03-11-2000')\n True\n\n >>> valid_date('15-01-2012')\n False\n\n >>> valid_date('04-0-2040')\n False\n\n >>> valid_date('06-04-2020')\n True\n\n >>> valid_date('06\/04\/2020')\n False\n \"\"\"\n try:\n date = date.strip()\n (month, day, year) = date.split('-')\n (month, day, year) = (int(month), int(day), int(year))\n if month < 1 or month > 12:\n return False\n if month in [1, 3, 5, 7, 8, 10, 12] and day < 1 or day > 31:\n return False\n if month in [4, 6, 9, 11] and day < 1 or day > 30:\n return False\n if month == 2 and day < 1 or day > 29:\n return False\n except:\n return False\n return True","function1_name":"valid_date","function2_signature":"def num_valid_birthdays(dates: List[str]) -> int:\n \"\"\"Given a list of birthdays with valid dates, return the number of people\n who can be given some birthday gifts.\n\n >>> num_valid_birthdays(['03-11-2000', '15-01-2012', '04-0-2040', '06-04-2020'])\n 2\n \"\"\"","function2_human":"def num_valid_birthdays(dates: List[str]) -> int:\n \"\"\"Given a list of birthdays with valid dates, return the number of people\n who can be given some birthday gifts.\n\n >>> num_valid_birthdays(['03-11-2000', '15-01-2012', '04-0-2040', '06-04-2020'])\n 2\n \"\"\"\n return sum([valid_date(date) for date in dates])","function2_name":"num_valid_birthdays","tests":"def check(candidate):\n assert candidate(['06\/04\/2020', '12-11-1987', '04-00-1999', '08-15-1992']) == 3\n assert candidate(['00-01-1951', '19-02-1994', '10-24-1992']) == 1\n assert candidate(['12-05-1976', '01-01-2010', '01\/01\/2010']) == 2\n\ndef test_check():\n check(num_valid_birthdays)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Union","function1_signature":"def split_words(txt: str) -> Union[List[str], int]:\n \"\"\"\n Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you\n should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the\n alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25\n Examples\n >>> split_words('Hello world!')\n ['Hello', 'world!']\n >>> split_words('Hello,world!')\n ['Hello', 'world!']\n >>> split_words('abcdef')\n 3\n \"\"\"","function1_human":"def split_words(txt: str) -> Union[List[str], int]:\n \"\"\"\n Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you\n should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the\n alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25\n Examples\n >>> split_words('Hello world!')\n ['Hello', 'world!']\n >>> split_words('Hello,world!')\n ['Hello', 'world!']\n >>> split_words('abcdef')\n 3\n \"\"\"\n if ' ' in txt:\n return txt.split()\n elif ',' in txt:\n return txt.replace(',', ' ').split()\n else:\n return len([i for i in txt if i.islower() and ord(i) % 2 == 0])","function1_name":"split_words","function2_signature":"def num_words(txt: str) -> int:\n \"\"\"\n Given one sentence of words, return the number of words in it.\n >>> num_words('Hello world!')\n 2\n >>> num_words('Hello,world!')\n 2\n >>> num_words('abcdef')\n 1\n \"\"\"","function2_human":"def num_words(txt: str) -> int:\n \"\"\"\n Given one sentence of words, return the number of words in it.\n >>> num_words('Hello world!')\n 2\n >>> num_words('Hello,world!')\n 2\n >>> num_words('abcdef')\n 1\n \"\"\"\n result = split_words(txt)\n if isinstance(result, list):\n return len(result)\n else:\n return 1","function2_name":"num_words","tests":"def check(candidate):\n assert candidate('The fox jumped over the fence.') == 6\n assert candidate('The,fox,jumped,over,the,fence.') == 6\n assert candidate('I, as a human, love to sleep.') == 7\n\ndef test_check():\n check(num_words)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def is_sorted(lst: List[int]) -> bool:\n \"\"\"\n Given a list of numbers, return whether or not they are sorted\n in ascending order. If list has more than 1 duplicate of the same\n number, return False. Assume no negative numbers and only integers.\n\n Examples\n >>> is_sorted([5])\n True\n >>> is_sorted([1, 2, 3, 4, 5])\n True\n >>> is_sorted([1, 3, 2, 4, 5])\n False\n >>> is_sorted([1, 2, 3, 4, 5, 6])\n True\n >>> is_sorted([1, 2, 3, 4, 5, 6, 7])\n True\n >>> is_sorted([1, 3, 2, 4, 5, 6, 7])\n False\n >>> is_sorted([1, 2, 2, 3, 3, 4])\n True\n >>> is_sorted([1, 2, 2, 2, 3, 4])\n False\n \"\"\"","function1_human":"def is_sorted(lst: List[int]) -> bool:\n \"\"\"\n Given a list of numbers, return whether or not they are sorted\n in ascending order. If list has more than 1 duplicate of the same\n number, return False. Assume no negative numbers and only integers.\n\n Examples\n >>> is_sorted([5])\n True\n >>> is_sorted([1, 2, 3, 4, 5])\n True\n >>> is_sorted([1, 3, 2, 4, 5])\n False\n >>> is_sorted([1, 2, 3, 4, 5, 6])\n True\n >>> is_sorted([1, 2, 3, 4, 5, 6, 7])\n True\n >>> is_sorted([1, 3, 2, 4, 5, 6, 7])\n False\n >>> is_sorted([1, 2, 2, 3, 3, 4])\n True\n >>> is_sorted([1, 2, 2, 2, 3, 4])\n False\n \"\"\"\n count_digit = dict([(i, 0) for i in lst])\n for i in lst:\n count_digit[i] += 1\n if any((count_digit[i] > 2 for i in lst)):\n return False\n if all((lst[i - 1] <= lst[i] for i in range(1, len(lst)))):\n return True\n else:\n return False","function1_name":"is_sorted","function2_signature":"def all_sorted(lst: List[List[int]]) -> bool:\n \"\"\"\n Given a non-empty list of lists of integers, return a boolean values indicating\n whether each sublist is sorted in ascending order without more than one duplicate of the same number.\n\n Examples\n >>> all_sorted([[5], [1, 2, 3, 4, 5], [1, 3, 2, 4, 5], [1, 2, 3, 4, 5, 6], [1, 2, 2, 2, 3, 4]])\n False\n >>> all_sorted([1, 2, 3, 4, 5, 6, 7], [1, 2, 2, 3, 3, 4], [3, 5, 7, 8])\n True\n \"\"\"","function2_human":"def all_sorted(lst: List[List[int]]) -> bool:\n \"\"\"\n Given a non-empty list of lists of integers, return a boolean values indicating\n whether each sublist is sorted in ascending order without more than one duplicate of the same number.\n\n Examples\n >>> all_sorted([[5], [1, 2, 3, 4, 5], [1, 3, 2, 4, 5], [1, 2, 3, 4, 5, 6], [1, 2, 2, 2, 3, 4]])\n False\n >>> all_sorted([1, 2, 3, 4, 5, 6, 7], [1, 2, 2, 3, 3, 4], [3, 5, 7, 8])\n True\n \"\"\"\n return all([is_sorted(sublist) for sublist in lst])","function2_name":"all_sorted","tests":"def check(candidate):\n assert candidate([1, 1, 1, 2], [2, 3, 5], [4, 4, 5]) is False\n assert candidate([1, 2, 3, 4, 5], [5, 7, 10, 13]) is True\n assert candidate([3, 3, 4], [1, 2, 3], [7, 6, 7]) is False\n\ndef test_check():\n check(all_sorted)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from itertools import combinations\nfrom typing import List, Tuple","function1_signature":"def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str:\n \"\"\"You are given two intervals,\n where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).\n The given intervals are closed which means that the interval (start, end)\n includes both start and end.\n For each given interval, it is assumed that its start is less or equal its end.\n Your task is to determine whether the length of intersection of these two\n intervals is a prime number.\n Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)\n which its length is 1, which not a prime number.\n If the length of the intersection is a prime number, return \"YES\",\n otherwise, return \"NO\".\n If the two intervals don't intersect, return \"NO\".\n\n\n [input\/output] samples:\n >>> intersection((1, 2), (2, 3))\n 'NO'\n >>> intersection((-1, 1), (0, 4))\n 'NO'\n >>> intersection((-3, -1), (-5, 5))\n 'YES'\n \"\"\"","function1_human":"def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str:\n \"\"\"You are given two intervals,\n where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).\n The given intervals are closed which means that the interval (start, end)\n includes both start and end.\n For each given interval, it is assumed that its start is less or equal its end.\n Your task is to determine whether the length of intersection of these two\n intervals is a prime number.\n Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)\n which its length is 1, which not a prime number.\n If the length of the intersection is a prime number, return \"YES\",\n otherwise, return \"NO\".\n If the two intervals don't intersect, return \"NO\".\n\n\n [input\/output] samples:\n >>> intersection((1, 2), (2, 3))\n 'NO'\n >>> intersection((-1, 1), (0, 4))\n 'NO'\n >>> intersection((-3, -1), (-5, 5))\n 'YES'\n \"\"\"\n\n def is_prime(num):\n if num == 1 or num == 0:\n return False\n if num == 2:\n return True\n for i in range(2, num):\n if num % i == 0:\n return False\n return True\n l = max(interval1[0], interval2[0])\n r = min(interval1[1], interval2[1])\n length = r - l\n if length > 0 and is_prime(length):\n return 'YES'\n return 'NO'","function1_name":"intersection","function2_signature":"def all_prime_intersection(intervals: List[Tuple[int, int]]) -> bool:\n \"\"\"Check if all intersections of given intervals are prime numbers.\n\n [inpt\/output] samples:\n >>> all_prime_intersection([(1, 2), (2, 3), (3, 4)])\n False\n >>> all_prime_intersection([(-3, 4), (-5, 5), (1, 4)])\n True\n \"\"\"","function2_human":"def all_prime_intersection(intervals: List[Tuple[int, int]]) -> bool:\n \"\"\"Check if all intersections of given intervals are prime numbers.\n\n [inpt\/output] samples:\n >>> all_prime_intersection([(1, 2), (2, 3), (3, 4)])\n False\n >>> all_prime_intersection([(-3, 4), (-5, 5), (1, 4)])\n True\n \"\"\"\n comb = combinations(intervals, 2)\n for (interval1, interval2) in comb:\n if intersection(interval1, interval2) == 'NO':\n return False\n return True","function2_name":"all_prime_intersection","tests":"def check(candidate):\n assert candidate([(-3, -1), (-5, 5), (3, 4)]) is False\n assert candidate([(-1, 7), (-5, 4), (1, 4)]) is True\n assert candidate([(1, 8), (3, 8), (-2, 6)]) is True\n\ndef test_check():\n check(all_prime_intersection)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Optional","function1_signature":"def prod_signs(arr: List[int]) -> Optional[int]:\n \"\"\"\n You are given an array arr of integers and you need to return\n sum of magnitudes of integers multiplied by product of all signs\n of each number in the array, represented by 1, -1 or 0.\n Note: return None for empty arr.\n\n Example:\n >>> prod_signs([1, 2, 2, -4])\n 9\n >>> prod_signs([0, 1])\n 0\n >>> prod_signs([])\n None\n \"\"\"","function1_human":"def prod_signs(arr: List[int]) -> Optional[int]:\n \"\"\"\n You are given an array arr of integers and you need to return\n sum of magnitudes of integers multiplied by product of all signs\n of each number in the array, represented by 1, -1 or 0.\n Note: return None for empty arr.\n\n Example:\n >>> prod_signs([1, 2, 2, -4])\n 9\n >>> prod_signs([0, 1])\n 0\n >>> prod_signs([])\n None\n \"\"\"\n if not arr:\n return None\n prod = 0 if 0 in arr else (-1) ** len(list(filter(lambda x: x < 0, arr)))\n return prod * sum([abs(i) for i in arr])","function1_name":"prod_signs","function2_signature":"def prod_signs_within_threshold(arr: List[int], threshold: int) -> Optional[int]:\n \"\"\"\n You are given an array arr of integers and you need to return\n sum of magnitudes of integers within the threshold value,\n multiplied by product of all signs of each number in the array.\n Note: return None for empty arr.\n\n Example:\n >>> prod_signs_within_threshold([1, 2, 2, -4], 3)\n 5\n >>> prod_signs_within_threshold([0, 1], 1)\n 0\n >>> prod_signs_within_threshold([], 1)\n None\n \"\"\"","function2_human":"def prod_signs_within_threshold(arr: List[int], threshold: int) -> Optional[int]:\n \"\"\"\n You are given an array arr of integers and you need to return\n sum of magnitudes of integers within the threshold value,\n multiplied by product of all signs of each number in the array.\n Note: return None for empty arr.\n\n Example:\n >>> prod_signs_within_threshold([1, 2, 2, -4], 3)\n 5\n >>> prod_signs_within_threshold([0, 1], 1)\n 0\n >>> prod_signs_within_threshold([], 1)\n None\n \"\"\"\n return prod_signs(list(filter(lambda x: abs(x) <= threshold, arr)))","function2_name":"prod_signs_within_threshold","tests":"def check(candidate):\n assert candidate([-1, -3, -5, -7, -9], 5) == 4\n assert candidate([-10, -20, 30, -40, 50, -60], 45) == -100\n assert candidate([-3, -2, -1, 0, 1, 2, 3], 2) == 0\n\ndef test_check():\n check(prod_signs_within_threshold)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def tri(n: int) -> list[int]:\n \"\"\"Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in\n the last couple centuries. However, what people don't know is Tribonacci sequence.\n Tribonacci sequence is defined by the recurrence:\n tri(1) = 3\n tri(n) = 1 + n \/ 2, if n is even.\n tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.\n For example:\n tri(2) = 1 + (2 \/ 2) = 2\n tri(4) = 3\n tri(3) = tri(2) + tri(1) + tri(4)\n = 2 + 3 + 3 = 8\n You are given a non-negative integer number n, you have to a return a list of the\n first n + 1 numbers of the Tribonacci sequence.\n Examples:\n >>> tri(3)\n [1, 3, 2, 8]\n \"\"\"","function1_human":"def tri(n: int) -> list[int]:\n \"\"\"Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in\n the last couple centuries. However, what people don't know is Tribonacci sequence.\n Tribonacci sequence is defined by the recurrence:\n tri(1) = 3\n tri(n) = 1 + n \/ 2, if n is even.\n tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.\n For example:\n tri(2) = 1 + (2 \/ 2) = 2\n tri(4) = 3\n tri(3) = tri(2) + tri(1) + tri(4)\n = 2 + 3 + 3 = 8\n You are given a non-negative integer number n, you have to a return a list of the\n first n + 1 numbers of the Tribonacci sequence.\n Examples:\n >>> tri(3)\n [1, 3, 2, 8]\n \"\"\"\n if n == 0:\n return [1]\n my_tri = [1, 3]\n for i in range(2, n + 1):\n if i % 2 == 0:\n my_tri.append(i \/ 2 + 1)\n else:\n my_tri.append(my_tri[i - 1] + my_tri[i - 2] + (i + 3) \/ 2)\n return my_tri","function1_name":"tri","function2_signature":"def beautiful_tri(start: int, end: int) -> list[int]:\n \"\"\"Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in\n the last couple centuries. However, what people don't know is Tribonacci sequence.\n Tribonacci sequence is defined by the recurrence:\n tri(1) = 3\n tri(n) = 1 + n \/ 2, if n is even.\n tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.\n For example:\n tri(2) = 1 + (2 \/ 2) = 2\n tri(4) = 3\n tri(3) = tri(2) + tri(1) + tri(4)\n = 2 + 3 + 3 = 8\n You are given a non-negative integer number n, you have to a return a list of the\n start-th number and end-th number of the Tribonacci sequence that the number is\n a multiple of 3.\n Examples:\n >>> tri(5, 10)\n [3]\n \"\"\"","function2_human":"def beautiful_tri(start: int, end: int) -> list[int]:\n \"\"\"Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in\n the last couple centuries. However, what people don't know is Tribonacci sequence.\n Tribonacci sequence is defined by the recurrence:\n tri(1) = 3\n tri(n) = 1 + n \/ 2, if n is even.\n tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.\n For example:\n tri(2) = 1 + (2 \/ 2) = 2\n tri(4) = 3\n tri(3) = tri(2) + tri(1) + tri(4)\n = 2 + 3 + 3 = 8\n You are given a non-negative integer number n, you have to a return a list of the\n start-th number and end-th number of the Tribonacci sequence that the number is\n a multiple of 3.\n Examples:\n >>> tri(5, 10)\n [3]\n \"\"\"\n return [int(i) for i in tri(end)[start:] if i % 3 == 0]","function2_name":"beautiful_tri","tests":"def check(candidate):\n assert candidate(5, 10) == [15, 24, 6]\n assert candidate(21, 29) == [12, 168, 195, 15, 255]\n assert candidate(33, 49) == [18, 360, 399, 21, 483, 528, 24, 624, 675]\n\ndef test_check():\n check(beautiful_tri)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def digits(n: int) -> int:\n \"\"\"Given a positive integer n, return the product of the odd digits.\n Return 0 if all digits are even.\n For example:\n >>> digits(1)\n 1\n >>> digits(4)\n 0\n >>> digits(235)\n 15\n \"\"\"","function1_human":"def digits(n: int) -> int:\n \"\"\"Given a positive integer n, return the product of the odd digits.\n Return 0 if all digits are even.\n For example:\n >>> digits(1)\n 1\n >>> digits(4)\n 0\n >>> digits(235)\n 15\n \"\"\"\n product = 1\n odd_count = 0\n for digit in str(n):\n int_digit = int(digit)\n if int_digit % 2 == 1:\n product = product * int_digit\n odd_count += 1\n if odd_count == 0:\n return 0\n else:\n return product","function1_name":"digits","function2_signature":"def unique_odd_digits(lst: List[int]) -> int:\n \"\"\"Given a list of positive integers, return the product of unique odd digits.\n For example:\n >>> unique_odd_digits([1, 4, 235])\n 15\n >>> unique_odd_digits([123, 456, 789])\n 945\n >>> unique_odd_digits([2, 4, 6, 8, 99])\n 9\n \"\"\"","function2_human":"def unique_odd_digits(lst: List[int]) -> int:\n \"\"\"Given a list of positive integers, return the product of unique odd digits.\n For example:\n >>> unique_odd_digits([1, 4, 235])\n 15\n >>> unique_odd_digits([123, 456, 789])\n 945\n >>> unique_odd_digits([2, 4, 6, 8, 99])\n 9\n \"\"\"\n concat = ''\n for num in lst:\n concat += str(num)\n unique = set(concat)\n return digits(int(''.join(unique)))","function2_name":"unique_odd_digits","tests":"def check(candidate):\n assert candidate([0, 1, 2, 3, 4, 5]) == 15\n assert candidate([22, 44, 66, 88]) == 0\n assert candidate([1325, 540, 938]) == 135\n\ndef test_check():\n check(unique_odd_digits)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def sum_squares(lst: List[float]) -> int:\n \"\"\"You are given a list of numbers.\n You need to return the sum of squared numbers in the given list,\n round each element in the list to the upper int(Ceiling) first.\n Examples:\n >>> lst([1.0, 2.0, 3.0])\n 14\n >>> lst([1.0, 4.0, 9.0])\n 98\n >>> lst([1.0, 3.0, 5.0, 7.0])\n 84\n >>> lst([1.4, 4.2, 0.0])\n 29\n >>> lst([-2.4, 1.0, 1.0])\n 6\n\n\n \"\"\"","function1_human":"def sum_squares(lst: List[float]) -> int:\n \"\"\"You are given a list of numbers.\n You need to return the sum of squared numbers in the given list,\n round each element in the list to the upper int(Ceiling) first.\n Examples:\n >>> lst([1.0, 2.0, 3.0])\n 14\n >>> lst([1.0, 4.0, 9.0])\n 98\n >>> lst([1.0, 3.0, 5.0, 7.0])\n 84\n >>> lst([1.4, 4.2, 0.0])\n 29\n >>> lst([-2.4, 1.0, 1.0])\n 6\n\n\n \"\"\"\n import math\n squared = 0\n for i in lst:\n squared += math.ceil(i) ** 2\n return squared","function1_name":"sum_squares","function2_signature":"def diff_ceil_floor_sum_squares(lst: List[float]) -> int:\n \"\"\"You are given a list of numbers.\n You need to return the absolute difference between the sum of squared numbers in the given list,\n round each element in the list to the upper int(Ceiling) first,\n and the sum of squared numbers in the given list,\n round each element in the list to the lower int(Floor) first.\n Examples:\n >>> lst([1.0, 2.0, 3.0])\n 0\n >>> lst([1.4, 4.2, 0.0])\n 12\n >>> lst([-2.4, 1.0, 1.0])\n 5\n\n\n \"\"\"","function2_human":"def diff_ceil_floor_sum_squares(lst: List[float]) -> int:\n \"\"\"You are given a list of numbers.\n You need to return the absolute difference between the sum of squared numbers in the given list,\n round each element in the list to the upper int(Ceiling) first,\n and the sum of squared numbers in the given list,\n round each element in the list to the lower int(Floor) first.\n Examples:\n >>> lst([1.0, 2.0, 3.0])\n 0\n >>> lst([1.4, 4.2, 0.0])\n 12\n >>> lst([-2.4, 1.0, 1.0])\n 5\n\n\n \"\"\"\n return abs(sum_squares(lst) - sum_squares([-i for i in lst]))","function2_name":"diff_ceil_floor_sum_squares","tests":"def check(candidate):\n assert candidate([-3.1, 2.5, 7.9]) == 13\n assert candidate([0.5, -0.5, 3.0, -2.0]) == 0\n assert candidate([-3.2, -2.8, -1.6, 0.7, 1.5, 2.8]) == 6\n\ndef test_check():\n check(diff_ceil_floor_sum_squares)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def check_if_last_char_is_a_letter(txt: str) -> bool:\n \"\"\"\n Create a function that returns True if the last character\n of a given string is an alphabetical character and is not\n a part of a word, and False otherwise.\n Note: \"word\" is a group of characters separated by space.\n\n Examples:\n >>> check_if_last_char_is_a_letter('apple pie')\n False\n >>> check_if_last_char_is_a_letter('apple pi e')\n True\n >>> check_if_last_char_is_a_letter('apple pi e ')\n False\n >>> check_if_last_char_is_a_letter('')\n False\n \"\"\"","function1_human":"def check_if_last_char_is_a_letter(txt: str) -> bool:\n \"\"\"\n Create a function that returns True if the last character\n of a given string is an alphabetical character and is not\n a part of a word, and False otherwise.\n Note: \"word\" is a group of characters separated by space.\n\n Examples:\n >>> check_if_last_char_is_a_letter('apple pie')\n False\n >>> check_if_last_char_is_a_letter('apple pi e')\n True\n >>> check_if_last_char_is_a_letter('apple pi e ')\n False\n >>> check_if_last_char_is_a_letter('')\n False\n \"\"\"\n check = txt.split(' ')[-1]\n return True if len(check) == 1 and 97 <= ord(check.lower()) <= 122 else False","function1_name":"check_if_last_char_is_a_letter","function2_signature":"def check_if_first_char_is_a_letter(txt: str) -> bool:\n \"\"\"\n Create a function that returns True if the first character\n of a given string is an alphabetical character and is not\n a part of a word, and False otherwise.\n Note: \"word\" is a group of characters separated by space.\n\n Examples:\n >>> check_if_first_char_is_a_letter('apple pie')\n False\n >>> check_if_first_char_is_a_letter('a pple pie')\n True\n >>> check_if_first_char_is_a_letter(' a pple pie')\n False\n >>> check_if_first_char_is_a_letter('')\n False\n \"\"\"","function2_human":"def check_if_first_char_is_a_letter(txt: str) -> bool:\n \"\"\"\n Create a function that returns True if the first character\n of a given string is an alphabetical character and is not\n a part of a word, and False otherwise.\n Note: \"word\" is a group of characters separated by space.\n\n Examples:\n >>> check_if_first_char_is_a_letter('apple pie')\n False\n >>> check_if_first_char_is_a_letter('a pple pie')\n True\n >>> check_if_first_char_is_a_letter(' a pple pie')\n False\n >>> check_if_first_char_is_a_letter('')\n False\n \"\"\"\n return check_if_last_char_is_a_letter(txt[::-1])","function2_name":"check_if_first_char_is_a_letter","tests":"def check(candidate):\n assert candidate('a boat is on the river') is True\n assert candidate(' over the rainbow') is False\n assert candidate('life is good') is False\n\ndef test_check():\n check(check_if_first_char_is_a_letter)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def can_arrange(arr: List[int]) -> int:\n \"\"\"Create a function which returns the largest index of an element which\n is not greater than or equal to the element immediately preceding it. If\n no such element exists then return -1. The given array will not contain\n duplicate values.\n\n Examples:\n >>> can_arrange([1, 2, 4, 3, 5])\n 3\n >>> can_arrange([1, 2, 3])\n -1\n \"\"\"","function1_human":"def can_arrange(arr: List[int]) -> int:\n \"\"\"Create a function which returns the largest index of an element which\n is not greater than or equal to the element immediately preceding it. If\n no such element exists then return -1. The given array will not contain\n duplicate values.\n\n Examples:\n >>> can_arrange([1, 2, 4, 3, 5])\n 3\n >>> can_arrange([1, 2, 3])\n -1\n \"\"\"\n ind = -1\n i = 1\n while i < len(arr):\n if arr[i] < arr[i - 1]:\n ind = i\n i += 1\n return ind","function1_name":"can_arrange","function2_signature":"def is_ordered(arr: List[int]) -> bool:\n \"\"\"Create a function which returns True if the given array is sorted in\n either ascending or descending order, otherwise return False.\n\n Examples:\n >>> is_ordered([1, 2, 4, 3, 5])\n False\n >>> is_ordered([1, 2, 3])\n True\n >>> is_ordered([3, 2, 1])\n True\n \"\"\"","function2_human":"def is_ordered(arr: List[int]) -> bool:\n \"\"\"Create a function which returns True if the given array is sorted in\n either ascending or descending order, otherwise return False.\n\n Examples:\n >>> is_ordered([1, 2, 4, 3, 5])\n False\n >>> is_ordered([1, 2, 3])\n True\n >>> is_ordered([3, 2, 1])\n True\n \"\"\"\n return can_arrange(arr) == -1 or can_arrange(arr[::-1]) == -1","function2_name":"is_ordered","tests":"def check(candidate):\n assert candidate([6, 5, 4, 3, 2, 1]) is True\n assert candidate([3, 5, 4, 2, 7, 9]) is False\n assert candidate([-1, -2, -3, -5]) is True\n\ndef test_check():\n check(is_ordered)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List, Optional, Tuple","function1_signature":"def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]:\n \"\"\"\n Create a function that returns a tuple (a, b), where 'a' is\n the largest of negative integers, and 'b' is the smallest\n of positive integers in a list.\n If there is no negative or positive integers, return them as None.\n\n Examples:\n >>> largest_smallest_integers([2, 4, 1, 3, 5, 7])\n (None, 1)\n >>> largest_smallest_integers([])\n (None, None)\n >>> largest_smallest_integers([0])\n (None, None)\n \"\"\"","function1_human":"def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]:\n \"\"\"\n Create a function that returns a tuple (a, b), where 'a' is\n the largest of negative integers, and 'b' is the smallest\n of positive integers in a list.\n If there is no negative or positive integers, return them as None.\n\n Examples:\n >>> largest_smallest_integers([2, 4, 1, 3, 5, 7])\n (None, 1)\n >>> largest_smallest_integers([])\n (None, None)\n >>> largest_smallest_integers([0])\n (None, None)\n \"\"\"\n smallest = list(filter(lambda x: x < 0, lst))\n largest = list(filter(lambda x: x > 0, lst))\n return (max(smallest) if smallest else None, min(largest) if largest else None)","function1_name":"largest_smallest_integers","function2_signature":"def smallest_interval_including_zero(lst: List[int]) -> int:\n \"\"\"\n Create a function that returns the length of the smallest interval that includes zero.\n If there is no such interval, return 0.\n\n Examples:\n >>> smallest_interval_including_zero([2, 4, 1, 3, 5, 7])\n 0\n >>> smallest_interval_including_zero([0])\n 0\n >>> smallest_interval_including_zero([-5, -3, 1, 2, 4])\n 4\n \"\"\"","function2_human":"def smallest_interval_including_zero(lst: List[int]) -> int:\n \"\"\"\n Create a function that returns the length of the smallest interval that includes zero.\n If there is no such interval, return 0.\n\n Examples:\n >>> smallest_interval_including_zero([2, 4, 1, 3, 5, 7])\n 0\n >>> smallest_interval_including_zero([0])\n 0\n >>> smallest_interval_including_zero([-5, -3, 1, 2, 4])\n 4\n \"\"\"\n (start, end) = largest_smallest_integers(lst)\n if start is None or end is None:\n return 0\n return end - start","function2_name":"smallest_interval_including_zero","tests":"def check(candidate):\n assert candidate([-2, 0, 1, 2, 3]) == 3\n assert candidate([0, 1, 2, 3]) == 0\n assert candidate([-5, -4, -3, -2, -1]) == 0\n\ndef test_check():\n check(smallest_interval_including_zero)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from itertools import combinations\nfrom typing import List, Union","function1_signature":"def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]:\n \"\"\"\n Create a function that takes integers, floats, or strings representing\n real numbers, and returns the larger variable in its given variable type.\n Return None if the values are equal.\n Note: If a real number is represented as a string, the floating point might be . or ,\n\n >>> compare_one(1, 2.5)\n 2.5\n >>> compare_one(1, '2,3')\n '2,3'\n >>> compare_one('5,1', '6')\n '6'\n >>> compare_one('1', 1)\n None\n \"\"\"","function1_human":"def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]:\n \"\"\"\n Create a function that takes integers, floats, or strings representing\n real numbers, and returns the larger variable in its given variable type.\n Return None if the values are equal.\n Note: If a real number is represented as a string, the floating point might be . or ,\n\n >>> compare_one(1, 2.5)\n 2.5\n >>> compare_one(1, '2,3')\n '2,3'\n >>> compare_one('5,1', '6')\n '6'\n >>> compare_one('1', 1)\n None\n \"\"\"\n (temp_a, temp_b) = (a, b)\n if isinstance(temp_a, str):\n temp_a = temp_a.replace(',', '.')\n if isinstance(temp_b, str):\n temp_b = temp_b.replace(',', '.')\n if float(temp_a) == float(temp_b):\n return None\n return a if float(temp_a) > float(temp_b) else b","function1_name":"compare_one","function2_signature":"def biggest(lst: List[Union[int, float, str]]) -> Union[int, float, str, None]:\n \"\"\"\n Create a function that takes a list of integers, floats, or strings representing\n real numbers, and returns the non-duplicate largest variable in its given variable type.\n Return None if the largest value is duplicated.\n Note: If a real number is represented as a string, the floating point might be . or ,\n\n >>> biggest([1, 2.5, '2,3'])\n 2.5\n >>> biggest(['1', 1])\n None\n >>> biggest(['5,1', '-6'])\n '5,1'\n \"\"\"","function2_human":"def biggest(lst: List[Union[int, float, str]]) -> Union[int, float, str, None]:\n \"\"\"\n Create a function that takes a list of integers, floats, or strings representing\n real numbers, and returns the non-duplicate largest variable in its given variable type.\n Return None if the largest value is duplicated.\n Note: If a real number is represented as a string, the floating point might be . or ,\n\n >>> biggest([1, 2.5, '2,3'])\n 2.5\n >>> biggest(['1', 1])\n None\n >>> biggest(['5,1', '-6'])\n '5,1'\n \"\"\"\n bigger = [compare_one(a, b) for (a, b) in combinations(lst, 2)]\n bigger = [elem for elem in bigger if elem is not None]\n if not bigger:\n return None\n return max(bigger)","function2_name":"biggest","tests":"def check(candidate):\n assert candidate([1, 1, 1, 1, 1]) is None\n assert candidate(['8,4', 8.1, '-8,3', 8.2]) == '8,4'\n assert candidate([10, 10, 8, 9, 6]) == 10\n\ndef test_check():\n check(biggest)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def is_equal_to_sum_even(n: int) -> bool:\n \"\"\"Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers\n Example\n >>> is_equal_to_sum_even(4)\n False\n >>> is_equal_to_sum_even(6)\n False\n >>> is_equal_to_sum_even(8)\n True\n \"\"\"","function1_human":"def is_equal_to_sum_even(n: int) -> bool:\n \"\"\"Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers\n Example\n >>> is_equal_to_sum_even(4)\n False\n >>> is_equal_to_sum_even(6)\n False\n >>> is_equal_to_sum_even(8)\n True\n \"\"\"\n return n % 2 == 0 and n >= 8","function1_name":"is_equal_to_sum_even","function2_signature":"def num_test_subjects(lst: List[int]) -> int:\n \"\"\"In your country, people are obligated to take a inspection test every 2 years\n after they turn 8.\n You are given a list of ages of people in your country. Return the number of\n people who are required to take the test in the next year.\n Example\n >>> num_test_subjects([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])\n 2\n >>> num_test_subjects([30, 42, 27, 21, 8, 1])\n 2\n >>> num_test_subjects([7, 3, 5, 6, 8, 9])\n 2\n \"\"\"","function2_human":"def num_test_subjects(lst: List[int]) -> int:\n \"\"\"In your country, people are obligated to take a inspection test every 2 years\n after they turn 8.\n You are given a list of ages of people in your country. Return the number of\n people who are required to take the test in the next year.\n Example\n >>> num_test_subjects([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])\n 2\n >>> num_test_subjects([30, 42, 27, 21, 8, 1])\n 2\n >>> num_test_subjects([7, 3, 5, 6, 8, 9])\n 2\n \"\"\"\n return sum([is_equal_to_sum_even(x + 1) for x in lst])","function2_name":"num_test_subjects","tests":"def check(candidate):\n assert candidate([27, 28, 29, 30, 31, 32]) == 3\n assert candidate([7, 6, 8, 9, 11, 13, 100]) == 4\n assert candidate([37, 31, 30, 29, 8, 13, 14, 49, 57]) == 6\n\ndef test_check():\n check(num_test_subjects)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def special_factorial(n: int) -> int:\n \"\"\"The Brazilian factorial is defined as:\n brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!\n where n > 0\n\n For example:\n >>> special_factorial(4)\n 288\n\n The function will receive an integer as input and should return the special\n factorial of this integer.\n \"\"\"","function1_human":"def special_factorial(n: int) -> int:\n \"\"\"The Brazilian factorial is defined as:\n brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!\n where n > 0\n\n For example:\n >>> special_factorial(4)\n 288\n\n The function will receive an integer as input and should return the special\n factorial of this integer.\n \"\"\"\n fact_i = 1\n special_fact = 1\n for i in range(1, n + 1):\n fact_i *= i\n special_fact *= fact_i\n return special_fact","function1_name":"special_factorial","function2_signature":"def factorial(n: int) -> int:\n \"\"\"The factorial of a positive integer n, denoted by n!, is the product of all\n positive integers less than or equal to n.\n\n\n For example:\n >>> factorial(4)\n 24\n >>> factorial(1)\n 1\n >>> factorial(5)\n 120\n\n The function will receive an integer as input and should return the factorial\n of this integer.\n \"\"\"","function2_human":"def factorial(n: int) -> int:\n \"\"\"The factorial of a positive integer n, denoted by n!, is the product of all\n positive integers less than or equal to n.\n\n\n For example:\n >>> factorial(4)\n 24\n >>> factorial(1)\n 1\n >>> factorial(5)\n 120\n\n The function will receive an integer as input and should return the factorial\n of this integer.\n \"\"\"\n fact = special_factorial(n)\n for i in range(1, n):\n fact \/\/= special_factorial(i)\n return fact","function2_name":"factorial","tests":"def check(candidate):\n assert candidate(7) == 5040\n assert candidate(6) == 720\n assert candidate(10) == 3628800\n\ndef test_check():\n check(factorial)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def fix_spaces(text: str) -> str:\n \"\"\"\n Given a string text, replace all spaces in it with underscores,\n and if a string has more than 2 consecutive spaces,\n then replace all consecutive spaces with -\n\n >>> fix_spaces('Example')\n 'Example'\n >>> fix_spaces('Example 1')\n 'Example_1'\n >>> fix_spaces(' Example 2')\n '_Example_2'\n >>> fix_spaces(' Example 3')\n '_Example-3'\n \"\"\"","function1_human":"def fix_spaces(text: str) -> str:\n \"\"\"\n Given a string text, replace all spaces in it with underscores,\n and if a string has more than 2 consecutive spaces,\n then replace all consecutive spaces with -\n\n >>> fix_spaces('Example')\n 'Example'\n >>> fix_spaces('Example 1')\n 'Example_1'\n >>> fix_spaces(' Example 2')\n '_Example_2'\n >>> fix_spaces(' Example 3')\n '_Example-3'\n \"\"\"\n new_text = ''\n i = 0\n (start, end) = (0, 0)\n while i < len(text):\n if text[i] == ' ':\n end += 1\n else:\n if end - start > 2:\n new_text += '-' + text[i]\n elif end - start > 0:\n new_text += '_' * (end - start) + text[i]\n else:\n new_text += text[i]\n (start, end) = (i + 1, i + 1)\n i += 1\n if end - start > 2:\n new_text += '-'\n elif end - start > 0:\n new_text += '_'\n return new_text","function1_name":"fix_spaces","function2_signature":"def extended_fix_spaces(text: str) -> str:\n \"\"\"\n Given a string text, replace all spaces and tab in it with underscores.\n Consider a tab as 4 spaces, and if a string has more than 2 consecutive spaces,\n then replace all consecutive spaces with -\n\n >>> extended_fix_spaces('Example')\n 'Example'\n >>> extended_fix_spaces('Example\t1')\n 'Example-1'\n >>> extended_fix_spaces('\tExample 2')\n '-Example_2'\n >>> extended_fix_spaces(' Example 3')\n '_Example-3'\n >>> extended_fix_spaces(' Example\t4_')\n '_Example-4_'\n \"\"\"","function2_human":"def extended_fix_spaces(text: str) -> str:\n \"\"\"\n Given a string text, replace all spaces and tab in it with underscores.\n Consider a tab as 4 spaces, and if a string has more than 2 consecutive spaces,\n then replace all consecutive spaces with -\n\n >>> extended_fix_spaces('Example')\n 'Example'\n >>> extended_fix_spaces('Example\t1')\n 'Example-1'\n >>> extended_fix_spaces('\tExample 2')\n '-Example_2'\n >>> extended_fix_spaces(' Example 3')\n '_Example-3'\n >>> extended_fix_spaces(' Example\t4_')\n '_Example-4_'\n \"\"\"\n return fix_spaces(text.replace('\\t', ' '))","function2_name":"extended_fix_spaces","tests":"def check(candidate):\n assert candidate('\\tcandidate([9, 2, 4, 3, 8, 9])') == '-candidate([9,_2,_4,_3,_8,_9])'\n assert candidate('cool\\tand aweesome function!') == 'cool-and_aweesome_function!'\n assert candidate('\\t\\t\\t\\t') == '-'\n\ndef test_check():\n check(extended_fix_spaces)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def file_name_check(file_name: str) -> str:\n \"\"\"Create a function which takes a string representing a file's name, and returns\n 'Yes' if the the file's name is valid, and returns 'No' otherwise.\n A file's name is considered to be valid if and only if all the following conditions\n are met:\n - There should not be more than three digits ('0'-'9') in the file's name.\n - The file's name contains exactly one dot '.'\n - The substring before the dot should not be empty, and it starts with a letter from\n the latin alphapet ('a'-'z' and 'A'-'Z').\n - The substring after the dot should be one of these: ['txt', 'exe', 'dll']\n Examples:\n >>> file_name_check('example.txt')\n 'Yes'\n >>> file_name_check('1example.dll')\n 'No'\n \"\"\"","function1_human":"def file_name_check(file_name: str) -> str:\n \"\"\"Create a function which takes a string representing a file's name, and returns\n 'Yes' if the the file's name is valid, and returns 'No' otherwise.\n A file's name is considered to be valid if and only if all the following conditions\n are met:\n - There should not be more than three digits ('0'-'9') in the file's name.\n - The file's name contains exactly one dot '.'\n - The substring before the dot should not be empty, and it starts with a letter from\n the latin alphapet ('a'-'z' and 'A'-'Z').\n - The substring after the dot should be one of these: ['txt', 'exe', 'dll']\n Examples:\n >>> file_name_check('example.txt')\n 'Yes'\n >>> file_name_check('1example.dll')\n 'No'\n \"\"\"\n suf = ['txt', 'exe', 'dll']\n lst = file_name.split(sep='.')\n if len(lst) != 2:\n return 'No'\n if not lst[1] in suf:\n return 'No'\n if len(lst[0]) == 0:\n return 'No'\n if not lst[0][0].isalpha():\n return 'No'\n t = len([x for x in lst[0] if x.isdigit()])\n if t > 3:\n return 'No'\n return 'Yes'","function1_name":"file_name_check","function2_signature":"def download_link_check(link: str) -> str:\n \"\"\"Create a function which takes a string representing a link address, and returns\n 'Yes' if the the link is valid, and returns 'No' otherwise.\n A link name is considered to be valid if and only if all the following conditions\n are met:\n - There should not be more than three digits ('0'-'9') in the file's name.\n - The file's name contains exactly one dot '.'\n - The substring before the dot should not be empty, and it starts with a letter from\n the latin alphapet ('a'-'z' and 'A'-'Z').\n - The substring after the dot should be one of these: ['txt', 'exe', 'dll']\n - The link should start with 'https:\/\/'\n Examples:\n >>> download_link_check('https:\/\/example.txt')\n 'Yes'\n >>> file_name_check('https:\/\/1example.dll')\n 'No'\n >>> file_name_check('example.txt')\n 'No'\n \"\"\"","function2_human":"def download_link_check(link: str) -> str:\n \"\"\"Create a function which takes a string representing a link address, and returns\n 'Yes' if the the link is valid, and returns 'No' otherwise.\n A link name is considered to be valid if and only if all the following conditions\n are met:\n - There should not be more than three digits ('0'-'9') in the file's name.\n - The file's name contains exactly one dot '.'\n - The substring before the dot should not be empty, and it starts with a letter from\n the latin alphapet ('a'-'z' and 'A'-'Z').\n - The substring after the dot should be one of these: ['txt', 'exe', 'dll']\n - The link should start with 'https:\/\/'\n Examples:\n >>> download_link_check('https:\/\/example.txt')\n 'Yes'\n >>> file_name_check('https:\/\/1example.dll')\n 'No'\n >>> file_name_check('example.txt')\n 'No'\n \"\"\"\n if not link.startswith('https:\/\/'):\n return 'No'\n return file_name_check(link[8:])","function2_name":"download_link_check","tests":"def check(candidate):\n assert candidate('https:\/\/hello-world.dll') == 'Yes'\n assert candidate('file:\/\/cool010.exe') == 'No'\n assert candidate('https:\/\/0010110.txt') == 'No'\n\ndef test_check():\n check(download_link_check)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def sum_squares(lst: list[int]) -> int:\n \"\"\" \"\n This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a\n multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not\n change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.\n\n Examples:\n >>> sum_squares([1, 2, 3])\n 6\n >>> sum_squares([])\n 0\n >>> sum_squares([-1, -5, 2, -1, -5])\n -126\n \"\"\"","function1_human":"def sum_squares(lst: list[int]) -> int:\n \"\"\" \"\n This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a\n multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not\n change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.\n\n Examples:\n >>> sum_squares([1, 2, 3])\n 6\n >>> sum_squares([])\n 0\n >>> sum_squares([-1, -5, 2, -1, -5])\n -126\n \"\"\"\n result = []\n for i in range(len(lst)):\n if i % 3 == 0:\n result.append(lst[i] ** 2)\n elif i % 4 == 0 and i % 3 != 0:\n result.append(lst[i] ** 3)\n else:\n result.append(lst[i])\n return sum(result)","function1_name":"sum_squares","function2_signature":"def extended_sum_squares(lst: list[int]) -> int:\n \"\"\"\n This function will take a list of integers. For all entries in the list, the\n function shall square the integer entry if its index is a multiple of 3 and\n will cube the integer entry if its index is a multiple of 4 and not a\n multiple of 3 and negate the integer entry if its index is a multiple of 5\n and not a multiple of 3 and 4. The function will not change the entries in\n the list whose indexes are not a multiple of 3 or 4 or 5. The function shall\n then return the sum of all entries.\n\n Examples:\n >>> sum_squares([1, 2, 3])\n 6\n >>> sum_squares([])\n 0\n >>> sum_squares([-1, -5, 2, -1, -5, -6])\n -120\n \"\"\"","function2_human":"def extended_sum_squares(lst: list[int]) -> int:\n \"\"\"\n This function will take a list of integers. For all entries in the list, the\n function shall square the integer entry if its index is a multiple of 3 and\n will cube the integer entry if its index is a multiple of 4 and not a\n multiple of 3 and negate the integer entry if its index is a multiple of 5\n and not a multiple of 3 and 4. The function will not change the entries in\n the list whose indexes are not a multiple of 3 or 4 or 5. The function shall\n then return the sum of all entries.\n\n Examples:\n >>> sum_squares([1, 2, 3])\n 6\n >>> sum_squares([])\n 0\n >>> sum_squares([-1, -5, 2, -1, -5, -6])\n -120\n \"\"\"\n return sum_squares([-x if idx % 5 == 0 and idx % 4 != 0 and (idx % 3 != 0) else x for (idx, x) in enumerate(lst)])","function2_name":"extended_sum_squares","tests":"def check(candidate):\n assert candidate([4, 7, 5, 3, 1, 1, 4, 6, 8, 9, 100]) == 552\n assert candidate([3, 4, 1, 5, 0, 8, 8, 5]) == 100\n assert candidate([2, 3, 5, 7, 11, 13, 17, 19]) == 1687\n\ndef test_check():\n check(extended_sum_squares)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def words_in_sentence(sentence: str) -> str:\n \"\"\"\n You are given a string representing a sentence,\n the sentence contains some words separated by a space,\n and you have to return a string that contains the words from the original sentence,\n whose lengths are prime numbers,\n the order of the words in the new string should be the same as the original one.\n\n Example 1:\n >>> words_in_sentence('This is a test')\n 'is'\n\n Example 2:\n >>> words_in_sentence('lets go for swimming')\n 'go for'\n\n Constraints:\n * 1 <= len(sentence) <= 100\n * sentence contains only letters\n \"\"\"","function1_human":"def words_in_sentence(sentence: str) -> str:\n \"\"\"\n You are given a string representing a sentence,\n the sentence contains some words separated by a space,\n and you have to return a string that contains the words from the original sentence,\n whose lengths are prime numbers,\n the order of the words in the new string should be the same as the original one.\n\n Example 1:\n >>> words_in_sentence('This is a test')\n 'is'\n\n Example 2:\n >>> words_in_sentence('lets go for swimming')\n 'go for'\n\n Constraints:\n * 1 <= len(sentence) <= 100\n * sentence contains only letters\n \"\"\"\n new_lst = []\n for word in sentence.split():\n flg = 0\n if len(word) == 1:\n flg = 1\n for i in range(2, len(word)):\n if len(word) % i == 0:\n flg = 1\n if flg == 0 or len(word) == 2:\n new_lst.append(word)\n return ' '.join(new_lst)","function1_name":"words_in_sentence","function2_signature":"def extended_words_in_sentence(sentence: str, sep: str) -> str:\n \"\"\"\n You are given a string representing a sentence,\n the sentence contains some words separated by `sep`,\n and you have to return a string that contains the words from the original sentence,\n whose lengths are prime numbers,\n the order of the words in the new string should be the same as the original one.\n\n Example 1:\n >>> extended_words_in_sentence('This is a test', ' ')\n 'is'\n\n Example 2:\n >>> extended_words_in_sentence('lets,go,for,swimming', ',')\n 'go,for'\n\n Constraints:\n * 1 <= len(sentence) <= 100\n * sentence contains only letters\n \"\"\"","function2_human":"def extended_words_in_sentence(sentence: str, sep: str) -> str:\n \"\"\"\n You are given a string representing a sentence,\n the sentence contains some words separated by `sep`,\n and you have to return a string that contains the words from the original sentence,\n whose lengths are prime numbers,\n the order of the words in the new string should be the same as the original one.\n\n Example 1:\n >>> extended_words_in_sentence('This is a test', ' ')\n 'is'\n\n Example 2:\n >>> extended_words_in_sentence('lets,go,for,swimming', ',')\n 'go,for'\n\n Constraints:\n * 1 <= len(sentence) <= 100\n * sentence contains only letters\n \"\"\"\n return words_in_sentence(sentence.replace(sep, ' ')).replace(' ', sep)","function2_name":"extended_words_in_sentence","tests":"def check(candidate):\n assert candidate('apple|delta|for|much|quantity', '|') == 'apple|delta|for'\n assert candidate('what-is-your-hobby', '-') == 'is-hobby'\n assert candidate('your,task,is,to,support,your,colleague', ',') == 'is,to,support'\n\ndef test_check():\n check(extended_words_in_sentence)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Optional","function1_signature":"def simplify(x: str, n: str) -> bool:\n \"\"\"Your task is to implement a function that will simplify the expression\n x * n. The function returns True if x * n evaluates to a whole number and False\n otherwise. Both x and n, are string representation of a fraction, and have the following format,\n \/ where both numerator and denominator are positive whole numbers.\n\n You can assume that x, and n are valid fractions, and do not have zero as denominator.\n\n >>> simplify('1\/5', '5\/1')\n True\n >>> simplify('1\/6', '2\/1')\n False\n >>> simplify('7\/10', '10\/2')\n False\n \"\"\"","function1_human":"def simplify(x: str, n: str) -> bool:\n \"\"\"Your task is to implement a function that will simplify the expression\n x * n. The function returns True if x * n evaluates to a whole number and False\n otherwise. Both x and n, are string representation of a fraction, and have the following format,\n \/ where both numerator and denominator are positive whole numbers.\n\n You can assume that x, and n are valid fractions, and do not have zero as denominator.\n\n >>> simplify('1\/5', '5\/1')\n True\n >>> simplify('1\/6', '2\/1')\n False\n >>> simplify('7\/10', '10\/2')\n False\n \"\"\"\n (a, b) = x.split('\/')\n (c, d) = n.split('\/')\n numerator = int(a) * int(c)\n denom = int(b) * int(d)\n if numerator \/ denom == int(numerator \/ denom):\n return True\n return False","function1_name":"simplify","function2_signature":"def get_simplified_pair(l: list[str]) -> Optional[tuple[str, str]]:\n \"\"\"Find a pair (a, b) which can be simplified in the given list of fractions.\n Simplified means that a * b is a whole number. Both a and b are string representation\n of a fraction, and have the following format, \/ where both\n numerator and denominator are positive whole numbers.\n\n If there is no such pair, return None.\n If there is multiple such pair, return the first one.\n\n Example:\n >>> get_simplified_pair(['1\/5', '5\/1', '1\/6', '2\/1', '7\/10', '10\/2'])\n ('1\/5', '5\/1')\n >>> get_simplified_pair(['1\/6', '2\/1', '7\/10', '10\/2'])\n ('2\/1', '10\/2')\n \"\"\"","function2_human":"def get_simplified_pair(l: list[str]) -> Optional[tuple[str, str]]:\n \"\"\"Find a pair (a, b) which can be simplified in the given list of fractions.\n Simplified means that a * b is a whole number. Both a and b are string representation\n of a fraction, and have the following format, \/ where both\n numerator and denominator are positive whole numbers.\n\n If there is no such pair, return None.\n If there is multiple such pair, return the first one.\n\n Example:\n >>> get_simplified_pair(['1\/5', '5\/1', '1\/6', '2\/1', '7\/10', '10\/2'])\n ('1\/5', '5\/1')\n >>> get_simplified_pair(['1\/6', '2\/1', '7\/10', '10\/2'])\n ('2\/1', '10\/2')\n \"\"\"\n for i in range(len(l)):\n for j in range(i + 1, len(l)):\n if simplify(l[i], l[j]):\n return (l[i], l[j])\n return None","function2_name":"get_simplified_pair","tests":"def check(candidate):\n assert candidate(['3\/5', '3\/7', '9\/3', '7\/2']) is None\n assert candidate(['4\/9', '18\/1', '7\/3']) == ('4\/9', '18\/1')\n assert candidate(['11\/13', '7\/3', '18\/14', '4\/6']) == ('7\/3', '18\/14')\n\ndef test_check():\n check(get_simplified_pair)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def order_by_points(nums: list[int]) -> list[int]:\n \"\"\"\n Write a function which sorts the given list of integers\n in ascending order according to the sum of their digits.\n Note: if there are several items with similar sum of their digits,\n order them based on their index in original list.\n\n For example:\n >>> order_by_points([1, 11, -1, -11, -12])\n [-1, -11, 1, -12, 11]\n >>> order_by_points([])\n []\n \"\"\"","function1_human":"def order_by_points(nums: list[int]) -> list[int]:\n \"\"\"\n Write a function which sorts the given list of integers\n in ascending order according to the sum of their digits.\n Note: if there are several items with similar sum of their digits,\n order them based on their index in original list.\n\n For example:\n >>> order_by_points([1, 11, -1, -11, -12])\n [-1, -11, 1, -12, 11]\n >>> order_by_points([])\n []\n \"\"\"\n\n def digits_sum(n):\n neg = 1\n if n < 0:\n (n, neg) = (-1 * n, -1)\n n = [int(i) for i in str(n)]\n n[0] = n[0] * neg\n return sum(n)\n return sorted(nums, key=digits_sum)","function1_name":"order_by_points","function2_signature":"def positive_order_by_points(nums: list[int]) -> list[int]:\n \"\"\"Write a function which sorts the integers in the given list\n that is greater than zero.\n Note: if there are several items with similar sum of their digits,\n order them based on their index in original list.\n\n For example:\n >>> positive_order_by_points([1, 11, -1, -11, -12])\n [1, 11]\n >>> positive_order_by_points([])\n []\n \"\"\"","function2_human":"def positive_order_by_points(nums: list[int]) -> list[int]:\n \"\"\"Write a function which sorts the integers in the given list\n that is greater than zero.\n Note: if there are several items with similar sum of their digits,\n order them based on their index in original list.\n\n For example:\n >>> positive_order_by_points([1, 11, -1, -11, -12])\n [1, 11]\n >>> positive_order_by_points([])\n []\n \"\"\"\n return order_by_points([num for num in nums if num > 0])","function2_name":"positive_order_by_points","tests":"def check(candidate):\n assert candidate([302, 444, 97, 92, 114]) == [302, 114, 92, 444, 97]\n assert candidate([4932, -30585, -392828, 1128]) == [1128, 4932]\n assert candidate([85, -7, 877, 344]) == [344, 85, 877]\n\ndef test_check():\n check(positive_order_by_points)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def specialFilter(nums: list[int]) -> int:\n \"\"\"Write a function that takes an array of numbers as input and returns\n the number of elements in the array that are greater than 10 and both\n first and last digits of a number are odd (1, 3, 5, 7, 9).\n For example:\n >>> specialFilter([15, -73, 14, -15])\n 1\n >>> specialFilter([33, -2, -3, 45, 21, 109])\n 2\n \"\"\"","function1_human":"def specialFilter(nums: list[int]) -> int:\n \"\"\"Write a function that takes an array of numbers as input and returns\n the number of elements in the array that are greater than 10 and both\n first and last digits of a number are odd (1, 3, 5, 7, 9).\n For example:\n >>> specialFilter([15, -73, 14, -15])\n 1\n >>> specialFilter([33, -2, -3, 45, 21, 109])\n 2\n \"\"\"\n count = 0\n for num in nums:\n if num > 10:\n odd_digits = (1, 3, 5, 7, 9)\n number_as_string = str(num)\n if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits:\n count += 1\n return count","function1_name":"specialFilter","function2_signature":"def extended_special_filter(nums: list[int]) -> int:\n \"\"\"Write a function that takes an array of numbers as input and returns\n the number of elements in the array that are greater than 10 and both\n first digits of a number are odd (1, 3, 5, 7, 9) and last digits of a number is even.\n For example:\n >>> specialFilter([15, -73, 14, -15])\n 1\n >>> specialFilter([33, -2, -3, 45, 21, 109])\n 0\n \"\"\"","function2_human":"def extended_special_filter(nums: list[int]) -> int:\n \"\"\"Write a function that takes an array of numbers as input and returns\n the number of elements in the array that are greater than 10 and both\n first digits of a number are odd (1, 3, 5, 7, 9) and last digits of a number is even.\n For example:\n >>> specialFilter([15, -73, 14, -15])\n 1\n >>> specialFilter([33, -2, -3, 45, 21, 109])\n 0\n \"\"\"\n count = 0\n for num in nums:\n if num > 10:\n odd_digits = (1, 3, 5, 7, 9)\n even_digits = (2, 4, 6, 8, 0)\n number_as_string = str(num)\n if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in even_digits:\n count += 1\n return count","function2_name":"extended_special_filter","tests":"def check(candidate):\n assert candidate([302, 444, 97, 92, 114]) == 3\n assert candidate([4932, 30585, 392828, 1128]) == 2\n assert candidate([66485, 9327, 88757, 344]) == 1\n\ndef test_check():\n check(extended_special_filter)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def get_max_triples(n: int) -> int:\n \"\"\"\n You are given a positive integer n. You have to create an integer array a of length n.\n For each i (1 \u2264 i \u2264 n), the value of a[i] = i * i - i + 1.\n Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,\n and a[i] + a[j] + a[k] is a multiple of 3.\n\n Example :\n >>> get_max_triples(5)\n 1\n Explanation:\n a = [1, 3, 7, 13, 21]\n The only valid triple is (1, 7, 13).\n \"\"\"","function1_human":"def get_max_triples(n: int) -> int:\n \"\"\"\n You are given a positive integer n. You have to create an integer array a of length n.\n For each i (1 \u2264 i \u2264 n), the value of a[i] = i * i - i + 1.\n Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,\n and a[i] + a[j] + a[k] is a multiple of 3.\n\n Example :\n >>> get_max_triples(5)\n 1\n Explanation:\n a = [1, 3, 7, 13, 21]\n The only valid triple is (1, 7, 13).\n \"\"\"\n A = [i * i - i + 1 for i in range(1, n + 1)]\n ans = []\n for i in range(n):\n for j in range(i + 1, n):\n for k in range(j + 1, n):\n if (A[i] + A[j] + A[k]) % 3 == 0:\n ans += [(A[i], A[j], A[k])]\n return len(ans)","function1_name":"get_max_triples","function2_signature":"def get_not_max_triple(n: int) -> int:\n \"\"\"\n You are given a positive integer n. You have to create an integer array a of length n.\n For each i (1 \u2264 i \u2264 n), the value of a[i] = i * i - i + 1.\n Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,\n and a[i] + a[j] + a[k] is not a multiple of 3.\n Assume that n >= 3.\n\n Example :\n >>> get_not_max_triples(5)\n 9\n \"\"\"","function2_human":"def get_not_max_triple(n: int) -> int:\n \"\"\"\n You are given a positive integer n. You have to create an integer array a of length n.\n For each i (1 \u2264 i \u2264 n), the value of a[i] = i * i - i + 1.\n Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,\n and a[i] + a[j] + a[k] is not a multiple of 3.\n Assume that n >= 3.\n\n Example :\n >>> get_not_max_triples(5)\n 9\n \"\"\"\n return n * (n - 1) * (n - 2) \/\/ 6 - get_max_triples(n)","function2_name":"get_not_max_triple","tests":"def check(candidate):\n assert candidate(8) == 45\n assert candidate(13) == 198\n assert candidate(16) == 385\n\ndef test_check():\n check(get_not_max_triple)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Tuple","function1_signature":"def bf(planet1: str, planet2: str) -> Tuple[str, ...]:\n \"\"\"\n There are eight planets in our solar system: the closerst to the Sun\n is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,\n Uranus, Neptune.\n Write a function that takes two planet names as strings planet1 and planet2.\n The function should return a tuple containing all planets whose orbits are\n located between the orbit of planet1 and the orbit of planet2, sorted by\n the proximity to the sun.\n The function should return an empty tuple if planet1 or planet2\n are not correct planet names.\n Examples\n >>> bf('Jupiter', 'Neptune')\n ('Saturn', 'Uranus')\n >>> bf('Earth', 'Mercury')\n 'Venus'\n >>> bf('Mercury', 'Uranus')\n ('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')\n \"\"\"","function1_human":"def bf(planet1: str, planet2: str) -> Tuple[str, ...]:\n \"\"\"\n There are eight planets in our solar system: the closerst to the Sun\n is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,\n Uranus, Neptune.\n Write a function that takes two planet names as strings planet1 and planet2.\n The function should return a tuple containing all planets whose orbits are\n located between the orbit of planet1 and the orbit of planet2, sorted by\n the proximity to the sun.\n The function should return an empty tuple if planet1 or planet2\n are not correct planet names.\n Examples\n >>> bf('Jupiter', 'Neptune')\n ('Saturn', 'Uranus')\n >>> bf('Earth', 'Mercury')\n 'Venus'\n >>> bf('Mercury', 'Uranus')\n ('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')\n \"\"\"\n planet_names = ('Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune')\n if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:\n return ()\n planet1_index = planet_names.index(planet1)\n planet2_index = planet_names.index(planet2)\n if planet1_index < planet2_index:\n return planet_names[planet1_index + 1:planet2_index]\n else:\n return planet_names[planet2_index + 1:planet1_index]","function1_name":"bf","function2_signature":"def living_area(planet1: str, planet2: str) -> bool:\n \"\"\"\n There are eight planets in our solar system: the closerst to the Sun\n is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,\n Uranus, Neptune.\n Among this planets, Earth is the only planet that can live human.\n Your task is to check whether there is a planet that can live human\n between planet1 and planet2 exclusively.\n Return true if there is a planet that can live human between planet1 and planet2.\n Examples:\n >>> living_area('Jupiter', 'Neptune')\n False\n >>> living_area('Earth', 'Mercury')\n False\n >>> living_area('Mercury', 'Uranus')\n True\n \"\"\"","function2_human":"def living_area(planet1: str, planet2: str) -> bool:\n \"\"\"\n There are eight planets in our solar system: the closerst to the Sun\n is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,\n Uranus, Neptune.\n Among this planets, Earth is the only planet that can live human.\n Your task is to check whether there is a planet that can live human\n between planet1 and planet2 exclusively.\n Return true if there is a planet that can live human between planet1 and planet2.\n Examples:\n >>> living_area('Jupiter', 'Neptune')\n False\n >>> living_area('Earth', 'Mercury')\n False\n >>> living_area('Mercury', 'Uranus')\n True\n \"\"\"\n return 'Earth' in bf(planet1, planet2)","function2_name":"living_area","tests":"def check(candidate):\n assert candidate('Venus', 'Jupiter') is True\n assert candidate('Uranus', 'Mars') is False\n assert candidate('Mars', 'Mercury') is True\n\ndef test_check():\n check(living_area)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import List","function1_signature":"def sorted_list_sum(lst: List[str]) -> List[str]:\n \"\"\"Write a function that accepts a list of strings as a parameter,\n deletes the strings that have odd lengths from it,\n and returns the resulted list with a sorted order,\n The list is always a list of strings and never an array of numbers,\n and it may contain duplicates.\n The order of the list should be ascending by length of each word, and you\n should return the list sorted by that rule.\n If two words have the same length, sort the list alphabetically.\n The function should return a list of strings in sorted order.\n You may assume that all words will have the same length.\n For example:\n >>> list_sort(['aa', 'a', 'aaa'])\n ['aa']\n >>> list_sort(['ab', 'a', 'aaa', 'cd'])\n ['ab', 'cd']\n \"\"\"","function1_human":"def sorted_list_sum(lst: List[str]) -> List[str]:\n \"\"\"Write a function that accepts a list of strings as a parameter,\n deletes the strings that have odd lengths from it,\n and returns the resulted list with a sorted order,\n The list is always a list of strings and never an array of numbers,\n and it may contain duplicates.\n The order of the list should be ascending by length of each word, and you\n should return the list sorted by that rule.\n If two words have the same length, sort the list alphabetically.\n The function should return a list of strings in sorted order.\n You may assume that all words will have the same length.\n For example:\n >>> list_sort(['aa', 'a', 'aaa'])\n ['aa']\n >>> list_sort(['ab', 'a', 'aaa', 'cd'])\n ['ab', 'cd']\n \"\"\"\n lst.sort()\n new_lst = []\n for i in lst:\n if len(i) % 2 == 0:\n new_lst.append(i)\n return sorted(new_lst, key=len)","function1_name":"sorted_list_sum","function2_signature":"def extract_even_words(text: str) -> str:\n \"\"\"Write a function that accepts a string as a parameter, and a string\n is consisted of words separated by spaces, deletes the words that have\n odd lengths from it, and returns the resulted string with a sorted order,\n The order of the words should be ascending by length of each word, and you\n should return the string sorted by that rule.\n IF two words have the same length, sort the string alphabetically.\n For example:\n >>> extract_odd_words('aa a aaa')\n 'aa'\n >>> extract_odd_words('ab a aaa cd')\n 'ab cd'\n \"\"\"","function2_human":"def extract_even_words(text: str) -> str:\n \"\"\"Write a function that accepts a string as a parameter, and a string\n is consisted of words separated by spaces, deletes the words that have\n odd lengths from it, and returns the resulted string with a sorted order,\n The order of the words should be ascending by length of each word, and you\n should return the string sorted by that rule.\n IF two words have the same length, sort the string alphabetically.\n For example:\n >>> extract_odd_words('aa a aaa')\n 'aa'\n >>> extract_odd_words('ab a aaa cd')\n 'ab cd'\n \"\"\"\n return ' '.join(sorted_list_sum(text.split()))","function2_name":"extract_even_words","tests":"def check(candidate):\n assert candidate('apple sand pear black cheeze') == 'pear sand cheeze'\n assert candidate('answer python analysis task mirror') == 'task answer mirror python analysis'\n assert candidate('hand monitor cream tissue water') == 'hand tissue'\n\ndef test_check():\n check(extract_even_words)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def x_or_y(n: int, x: int, y: int) -> int:\n \"\"\"A simple program which should return the value of x if n is\n a prime number and should return the value of y otherwise.\n\n Examples:\n >>> x_or_y(7, 34, 12)\n 34\n >>> x_or_y(15, 8, 5)\n 5\n\n \"\"\"","function1_human":"def x_or_y(n: int, x: int, y: int) -> int:\n \"\"\"A simple program which should return the value of x if n is\n a prime number and should return the value of y otherwise.\n\n Examples:\n >>> x_or_y(7, 34, 12)\n 34\n >>> x_or_y(15, 8, 5)\n 5\n\n \"\"\"\n if n == 1:\n return y\n for i in range(2, n):\n if n % i == 0:\n return y\n else:\n return x","function1_name":"x_or_y","function2_signature":"def list_x_or_y(ns: list[int], xs: list[int], ys: list[int]) -> list[int]:\n \"\"\"A simple program which should return a list of values of x if the\n corresponding value in ns is a prime number and should return the value of y\n otherwise.\n\n Examples:\n >>> list_x_or_by([7, 15, 21], [34, 8, 3], [12, 5, 7])\n [34, 5, 7]\n >>> list_x_or_by([1, 2, 3], [34, 8, 3], [12, 5, 7])\n [12, 8, 3]\n \"\"\"","function2_human":"def list_x_or_y(ns: list[int], xs: list[int], ys: list[int]) -> list[int]:\n \"\"\"A simple program which should return a list of values of x if the\n corresponding value in ns is a prime number and should return the value of y\n otherwise.\n\n Examples:\n >>> list_x_or_by([7, 15, 21], [34, 8, 3], [12, 5, 7])\n [34, 5, 7]\n >>> list_x_or_by([1, 2, 3], [34, 8, 3], [12, 5, 7])\n [12, 8, 3]\n \"\"\"\n return [x_or_y(n, x, y) for (n, x, y) in zip(ns, xs, ys)]","function2_name":"list_x_or_y","tests":"def check(candidate):\n assert candidate([9, 5, 13, 7, 15, 33], [3, 4, 6, 2, 6, 4], [2, 3, 7, 2, 4, 3]) == [2, 4, 6, 2, 4, 3]\n assert candidate([44, 43, 42, 41, 40], [9, 3, 5, 3, 2], [8, 7, 6, 5, 4]) == [8, 3, 6, 3, 4]\n assert candidate([95, 97, 45, 39], [11, 4, 38, 2], [10, 1, 4, 9]) == [10, 4, 4, 9]\n\ndef test_check():\n check(list_x_or_y)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def double_the_difference(lst: list[float]) -> int:\n \"\"\"\n Given a list of numbers, return the sum of squares of the numbers\n in the list that are odd. Ignore numbers that are negative or not integers.\n\n >>> double_the_difference([1, 3, 2, 0])\n 10\n >>> double_the_difference([-1, -2, 0])\n 0\n >>> double_the_difference([9, -2])\n 81\n >>> double_the_difference([0])\n 0\n\n If the input list is empty, return 0.\n \"\"\"","function1_human":"def double_the_difference(lst: list[float]) -> int:\n \"\"\"\n Given a list of numbers, return the sum of squares of the numbers\n in the list that are odd. Ignore numbers that are negative or not integers.\n\n >>> double_the_difference([1, 3, 2, 0])\n 10\n >>> double_the_difference([-1, -2, 0])\n 0\n >>> double_the_difference([9, -2])\n 81\n >>> double_the_difference([0])\n 0\n\n If the input list is empty, return 0.\n \"\"\"\n return sum([i ** 2 for i in lst if i > 0 and i % 2 != 0 and ('.' not in str(i))])","function1_name":"double_the_difference","function2_signature":"def extended_double_the_difference(lst: list[float]) -> int:\n \"\"\"\n Given a list of numbers, return the sum of squares of the numbers\n in the list that are odd and the cubic of the number in the list that\n are even. Ignore numbers that are negative or not integers.\n\n >>> double_the_difference([1, 3, 2, 0])\n 18\n >>> double_the_difference([-1, -2, 0])\n 0\n >>> double_the_difference([9, -2])\n 81\n >>> double_the_difference([0])\n 0\n\n If the input list is empty, return 0.\n \"\"\"","function2_human":"def extended_double_the_difference(lst: list[float]) -> int:\n \"\"\"\n Given a list of numbers, return the sum of squares of the numbers\n in the list that are odd and the cubic of the number in the list that\n are even. Ignore numbers that are negative or not integers.\n\n >>> double_the_difference([1, 3, 2, 0])\n 18\n >>> double_the_difference([-1, -2, 0])\n 0\n >>> double_the_difference([9, -2])\n 81\n >>> double_the_difference([0])\n 0\n\n If the input list is empty, return 0.\n \"\"\"\n x = double_the_difference(lst)\n x += sum((i ** 3 for i in lst if i > 0 and i % 2 == 0 and ('.' not in str(i))))\n return x","function2_name":"extended_double_the_difference","tests":"def check(candidate):\n assert candidate([-1, 9, -5, 5, 13, 7, 0, 15]) == 549\n assert candidate([-5, -2, 7, 2, 1]) == 58\n assert candidate([3, 4, 5, 6, 7]) == 363\n\ndef test_check():\n check(extended_double_the_difference)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def compare(game: list[int], guess: list[int]) -> list[int]:\n \"\"\"I think we all remember that feeling when the result of some long-awaited\n event is finally known. The feelings and thoughts you have at that moment are\n definitely worth noting down and comparing.\n Your task is to determine if a person correctly guessed the results of a number of matches.\n You are given two arrays of scores and guesses of equal length, where each index shows a match.\n Return an array of the same length denoting how far off each guess was. If they have guessed correctly,\n the value is 0, and if not, the value is the absolute difference between the guess and the score.\n\n\n example:\n\n >>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])\n [0, 0, 0, 0, 3, 3]\n >>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])\n [4, 4, 1, 0, 0, 6]\n \"\"\"","function1_human":"def compare(game: list[int], guess: list[int]) -> list[int]:\n \"\"\"I think we all remember that feeling when the result of some long-awaited\n event is finally known. The feelings and thoughts you have at that moment are\n definitely worth noting down and comparing.\n Your task is to determine if a person correctly guessed the results of a number of matches.\n You are given two arrays of scores and guesses of equal length, where each index shows a match.\n Return an array of the same length denoting how far off each guess was. If they have guessed correctly,\n the value is 0, and if not, the value is the absolute difference between the guess and the score.\n\n\n example:\n\n >>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])\n [0, 0, 0, 0, 3, 3]\n >>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])\n [4, 4, 1, 0, 0, 6]\n \"\"\"\n return [abs(x - y) for (x, y) in zip(game, guess)]","function1_name":"compare","function2_signature":"def who_is_winner(game: list[int], guesses: list[list[int]]) -> int:\n \"\"\"Return the index of guesses that is the most closely guess the game.\n If there is a tie, return the index of the first guess that is the most\n closely guess the game.\n\n Example:\n >>> who_is_winner([1, 2, 3], [[2, 0, 3], [1, 2, 3]])\n 1\n >>> who_is_winner([1, 2, 3], [[2, 0, 3], [4, 5, 6]])\n 0\n \"\"\"","function2_human":"def who_is_winner(game: list[int], guesses: list[list[int]]) -> int:\n \"\"\"Return the index of guesses that is the most closely guess the game.\n If there is a tie, return the index of the first guess that is the most\n closely guess the game.\n\n Example:\n >>> who_is_winner([1, 2, 3], [[2, 0, 3], [1, 2, 3]])\n 1\n >>> who_is_winner([1, 2, 3], [[2, 0, 3], [4, 5, 6]])\n 0\n \"\"\"\n return min(range(len(guesses)), key=lambda i: sum(compare(game, guesses[i])))","function2_name":"who_is_winner","tests":"def check(candidate):\n assert candidate([3, 9], [[1, 2], [3, 0], [0, 9]]) == 2\n assert candidate([3, 3], [[3, 0], [0, 3]]) == 0\n assert candidate([4, 2, 8], [[0, 3, 5], [5, 0, 7], [1, 2, 9]]) == 1\n\ndef test_check():\n check(who_is_winner)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def Strongest_Extension(class_name: str, extensions: list[str]) -> str:\n \"\"\"You will be given the name of a class (a string) and a list of extensions.\n The extensions are to be used to load additional classes to the class. The\n strength of the extension is as follows: Let CAP be the number of the uppercase\n letters in the extension's name, and let SM be the number of lowercase letters\n in the extension's name, the strength is given by the fraction CAP - SM.\n You should find the strongest extension and return a string in this\n format: ClassName.StrongestExtensionName.\n If there are two or more extensions with the same strength, you should\n choose the one that comes first in the list.\n For example, if you are given \"Slices\" as the class and a list of the\n extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should\n return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension\n (its strength is -1).\n Example:\n >>> Strongest_Extension('my_class', ['AA', 'Be', 'CC'])\n 'my_class.AA'\n \"\"\"","function1_human":"def Strongest_Extension(class_name: str, extensions: list[str]) -> str:\n \"\"\"You will be given the name of a class (a string) and a list of extensions.\n The extensions are to be used to load additional classes to the class. The\n strength of the extension is as follows: Let CAP be the number of the uppercase\n letters in the extension's name, and let SM be the number of lowercase letters\n in the extension's name, the strength is given by the fraction CAP - SM.\n You should find the strongest extension and return a string in this\n format: ClassName.StrongestExtensionName.\n If there are two or more extensions with the same strength, you should\n choose the one that comes first in the list.\n For example, if you are given \"Slices\" as the class and a list of the\n extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should\n return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension\n (its strength is -1).\n Example:\n >>> Strongest_Extension('my_class', ['AA', 'Be', 'CC'])\n 'my_class.AA'\n \"\"\"\n strong = extensions[0]\n my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len([x for x in extensions[0] if x.isalpha() and x.islower()])\n for s in extensions:\n val = len([x for x in s if x.isalpha() and x.isupper()]) - len([x for x in s if x.isalpha() and x.islower()])\n if val > my_val:\n strong = s\n my_val = val\n ans = class_name + '.' + strong\n return ans","function1_name":"Strongest_Extension","function2_signature":"def extended_strongest_extension(extensions: list[str]) -> str:\n \"\"\"You will be given a list of extensions. These extensions consist of package name and\n function name such as `package1.function1`.\n The strength of the extension is as follows: Let CAP be the number of the uppercase\n letters in the function's name, and let SM be the number of lowercase letters\n in the function's name, the strength is given by the fraction CAP - SM.\n You should find the strongest functions and return a dictionary which has package name as key\n and the strongest extension as value in this format: `package1.function1`.\n If there are two or more extensions with the same strength in the same package, you should\n choose the one that comes first in the list.\n Example:\n >>> extended_strongest_extension(['my_class.AA', 'my_class.Be', 'my_class2.Be', 'my_class2.CC'])\n {'my_class': 'my_class.AA', 'my_class2': 'my_class2.CC'}\n \"\"\"","function2_human":"def extended_strongest_extension(extensions: list[str]) -> str:\n \"\"\"You will be given a list of extensions. These extensions consist of package name and\n function name such as `package1.function1`.\n The strength of the extension is as follows: Let CAP be the number of the uppercase\n letters in the function's name, and let SM be the number of lowercase letters\n in the function's name, the strength is given by the fraction CAP - SM.\n You should find the strongest functions and return a dictionary which has package name as key\n and the strongest extension as value in this format: `package1.function1`.\n If there are two or more extensions with the same strength in the same package, you should\n choose the one that comes first in the list.\n Example:\n >>> extended_strongest_extension(['my_class.AA', 'my_class.Be', 'my_class2.Be', 'my_class2.CC'])\n {'my_class': 'my_class.AA', 'my_class2': 'my_class2.CC'}\n \"\"\"\n result = {}\n for extension in extensions:\n (package, function) = extension.split('.')\n if package not in result:\n result[package] = [function]\n else:\n result[package].append(function)\n for package in result:\n result[package] = Strongest_Extension(package, result[package])\n return result","function2_name":"extended_strongest_extension","tests":"def check(candidate):\n assert candidate(['pack1.func1', 'pack1.Func1', 'pack1.FunC1']) == {'pack1': 'pack1.FunC1'}\n assert candidate(['math.MIN', 'math.MAX', 'abc.abstractmethod']) == {'math': 'math.MIN', 'abc': 'abc.abstractmethod'}\n assert candidate(['mirror.iSNa', 'category.FUNC', 'mirror.IsnA']) == {'mirror': 'mirror.iSNa', 'category': 'category.FUNC'}\n\ndef test_check():\n check(extended_strongest_extension)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def cycpattern_check(a: str, b: str) -> bool:\n \"\"\"You are given 2 words. You need to return True if the second word or any\n of its rotations is a substring in the first word\n >>> cycpattern_check('abcd', 'abd')\n False\n >>> cycpattern_check('hello', 'ell')\n True\n >>> cycpattern_check('whassup', 'psus')\n False\n >>> cycpattern_check('abab', 'baa')\n True\n >>> cycpattern_check('efef', 'eeff')\n False\n >>> cycpattern_check('himenss', 'simen')\n True\n\n \"\"\"","function1_human":"def cycpattern_check(a: str, b: str) -> bool:\n \"\"\"You are given 2 words. You need to return True if the second word or any\n of its rotations is a substring in the first word\n >>> cycpattern_check('abcd', 'abd')\n False\n >>> cycpattern_check('hello', 'ell')\n True\n >>> cycpattern_check('whassup', 'psus')\n False\n >>> cycpattern_check('abab', 'baa')\n True\n >>> cycpattern_check('efef', 'eeff')\n False\n >>> cycpattern_check('himenss', 'simen')\n True\n\n \"\"\"\n l = len(b)\n pat = b + b\n for i in range(len(a) - l + 1):\n for j in range(l + 1):\n if a[i:i + l] == pat[j:j + l]:\n return True\n return False","function1_name":"cycpattern_check","function2_signature":"def extended_cycpattern_check(a: str, b: str) -> bool:\n \"\"\"You are given 2 words. You need to return True if the second word or any\n of its rotations is a substring in the first word or any of its rotations\n >>> cycpattern_check('abcd', 'abd')\n True\n >>> cycpattern_check('hello', 'ell')\n True\n >>> cycpattern_check('whassup', 'psus')\n False\n >>> cycpattern_check('abab', 'baa')\n True\n >>> cycpattern_check('efeff', 'eeff')\n True\n >>> cycpattern_check('himenss', 'simen')\n True\n \"\"\"","function2_human":"def extended_cycpattern_check(a: str, b: str) -> bool:\n \"\"\"You are given 2 words. You need to return True if the second word or any\n of its rotations is a substring in the first word or any of its rotations\n >>> cycpattern_check('abcd', 'abd')\n True\n >>> cycpattern_check('hello', 'ell')\n True\n >>> cycpattern_check('whassup', 'psus')\n False\n >>> cycpattern_check('abab', 'baa')\n True\n >>> cycpattern_check('efeff', 'eeff')\n True\n >>> cycpattern_check('himenss', 'simen')\n True\n \"\"\"\n return any((cycpattern_check(a[i:] + a[:i], b) for i in range(len(a))))","function2_name":"extended_cycpattern_check","tests":"def check(candidate):\n assert candidate('oossiie', 'iso') is False\n assert candidate('rikkenwhwiejf', 'friwiej') is True\n assert candidate('whatemfho', 'howhat') is True\n\ndef test_check():\n check(extended_cycpattern_check)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Tuple","function1_signature":"def even_odd_count(num: int) -> Tuple[int, int]:\n \"\"\"Given an integer. return a tuple that has the number of even and odd digits respectively.\n\n Example:\n >>> even_odd_count(-12)\n (1, 1)\n >>> even_odd_count(123)\n (1, 2)\n \"\"\"","function1_human":"def even_odd_count(num: int) -> Tuple[int, int]:\n \"\"\"Given an integer. return a tuple that has the number of even and odd digits respectively.\n\n Example:\n >>> even_odd_count(-12)\n (1, 1)\n >>> even_odd_count(123)\n (1, 2)\n \"\"\"\n even_count = 0\n odd_count = 0\n for i in str(abs(num)):\n if int(i) % 2 == 0:\n even_count += 1\n else:\n odd_count += 1\n return (even_count, odd_count)","function1_name":"even_odd_count","function2_signature":"def balanced_number(num: int) -> bool:\n \"\"\"Given an integer. return True if the number of even digits and odd digits\n are the same.\n\n Example:\n >>> balanced_number(1324)\n True\n >>> balanced_number(9119)\n False\n \"\"\"","function2_human":"def balanced_number(num: int) -> bool:\n \"\"\"Given an integer. return True if the number of even digits and odd digits\n are the same.\n\n Example:\n >>> balanced_number(1324)\n True\n >>> balanced_number(9119)\n False\n \"\"\"\n (even_count, odd_count) = even_odd_count(num)\n return even_count == odd_count","function2_name":"balanced_number","tests":"def check(candidate):\n assert candidate(1234) is True\n assert candidate(12345) is False\n assert candidate(10) is True\n\ndef test_check():\n check(balanced_number)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def int_to_mini_roman(number: int) -> str:\n \"\"\"\n Given a positive integer, obtain its roman numeral equivalent as a string,\n and return it in lowercase.\n Restrictions: 1 <= num <= 1000\n\n Examples:\n >>> int_to_mini_roman(19)\n 'xix'\n >>> int_to_mini_roman(152)\n 'clii'\n >>> int_to_mini_roman(426)\n 'cdxxvi'\n \"\"\"","function1_human":"def int_to_mini_roman(number: int) -> str:\n \"\"\"\n Given a positive integer, obtain its roman numeral equivalent as a string,\n and return it in lowercase.\n Restrictions: 1 <= num <= 1000\n\n Examples:\n >>> int_to_mini_roman(19)\n 'xix'\n >>> int_to_mini_roman(152)\n 'clii'\n >>> int_to_mini_roman(426)\n 'cdxxvi'\n \"\"\"\n num = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000]\n sym = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M']\n i = 12\n res = ''\n while number:\n div = number \/\/ num[i]\n number %= num[i]\n while div:\n res += sym[i]\n div -= 1\n i -= 1\n return res.lower()","function1_name":"int_to_mini_roman","function2_signature":"def beautiful_roman_number(number: int) -> bool:\n \"\"\"Check if a given number is a beautiful roman number.\n A roman number is beautiful if it is a palindrome and its length is greater than 1.\n Restrictions: 1 <= a * b <= 1000\n\n Examples:\n >>> beautiful_roman_number(2)\n True\n >>> beautiful_roman_number(4)\n False\n >>> beautiful_roman_number(19)\n True\n \"\"\"","function2_human":"def beautiful_roman_number(number: int) -> bool:\n \"\"\"Check if a given number is a beautiful roman number.\n A roman number is beautiful if it is a palindrome and its length is greater than 1.\n Restrictions: 1 <= a * b <= 1000\n\n Examples:\n >>> beautiful_roman_number(2)\n True\n >>> beautiful_roman_number(4)\n False\n >>> beautiful_roman_number(19)\n True\n \"\"\"\n x = int_to_mini_roman(number)\n return x == x[::-1] and len(x) > 1","function2_name":"beautiful_roman_number","tests":"def check(candidate):\n assert candidate(30) is True\n assert candidate(190) is True\n assert candidate(450) is False\n\ndef test_check():\n check(beautiful_roman_number)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def right_angle_triangle(a: int, b: int, c: int) -> bool:\n \"\"\"\n Given the lengths of the three sides of a triangle. Return True if the three\n sides form a right-angled triangle, False otherwise.\n A right-angled triangle is a triangle in which one angle is right angle or\n 90 degree.\n Example:\n >>> right_angle_triangle(3, 4, 5)\n True\n >>> right_angle_triangle(1, 2, 3)\n False\n \"\"\"","function1_human":"def right_angle_triangle(a: int, b: int, c: int) -> bool:\n \"\"\"\n Given the lengths of the three sides of a triangle. Return True if the three\n sides form a right-angled triangle, False otherwise.\n A right-angled triangle is a triangle in which one angle is right angle or\n 90 degree.\n Example:\n >>> right_angle_triangle(3, 4, 5)\n True\n >>> right_angle_triangle(1, 2, 3)\n False\n \"\"\"\n return a * a == b * b + c * c or b * b == a * a + c * c or c * c == a * a + b * b","function1_name":"right_angle_triangle","function2_signature":"def make_right_angle_triangle(a: int, b: int) -> int:\n \"\"\"\n Given the lengths of two sides of a triangle, return the integer length of\n the third side if the three sides form a right-angled triangle, -1 otherwise.\n All sides of the triangle could not exceed 1000.\n If there is more than one possible value, return the smallest one.\n A right-angled triangle is a triangle in which one angle is right angle or\n 90 degree.\n Example:\n >>> make_right_angle_triangle(3, 4)\n 5\n >>> make_right_angle_triangle(1, 2)\n -1\n \"\"\"","function2_human":"def make_right_angle_triangle(a: int, b: int) -> int:\n \"\"\"\n Given the lengths of two sides of a triangle, return the integer length of\n the third side if the three sides form a right-angled triangle, -1 otherwise.\n All sides of the triangle could not exceed 1000.\n If there is more than one possible value, return the smallest one.\n A right-angled triangle is a triangle in which one angle is right angle or\n 90 degree.\n Example:\n >>> make_right_angle_triangle(3, 4)\n 5\n >>> make_right_angle_triangle(1, 2)\n -1\n \"\"\"\n if 1 <= a <= 1000 and 1 <= b <= 1000:\n for c in range(1, 1000):\n if right_angle_triangle(a, b, c):\n return c\n return -1","function2_name":"make_right_angle_triangle","tests":"def check(candidate):\n assert candidate(6, 10) == 8\n assert candidate(13, 5) == 12\n assert candidate(5, 11) == -1\n\ndef test_check():\n check(make_right_angle_triangle)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def find_max(words: list[str]) -> str:\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characters. If multiple strings have maximum number of unique\n characters, return the one which comes first in lexicographical order.\n\n >>> find_max(['name', 'of', 'string'])\n 'string'\n >>> find_max(['name', 'enam', 'game'])\n 'enam'\n >>> find_max(['aaaaaaa', 'bb', 'cc'])\n 'aaaaaaa'\n \"\"\"","function1_human":"def find_max(words: list[str]) -> str:\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characters. If multiple strings have maximum number of unique\n characters, return the one which comes first in lexicographical order.\n\n >>> find_max(['name', 'of', 'string'])\n 'string'\n >>> find_max(['name', 'enam', 'game'])\n 'enam'\n >>> find_max(['aaaaaaa', 'bb', 'cc'])\n 'aaaaaaa'\n \"\"\"\n return sorted(words, key=lambda x: (-len(set(x)), x))[0]","function1_name":"find_max","function2_signature":"def contain_complicated_words(words: list[str]) -> int:\n \"\"\"Check if the given list of words contains complicated words.\n complicated words means the word contains more than 5 unique characters.\n Return the index of the most complicated word in words and -1 if there\n doesn't exist complicated word.\n If there are multiple the most complicated words, return the index of\n the first complicated word in lexicographical order.\n\n >>> contain_complicated_words(['name', 'of', 'string'])\n 2\n >>> contain_complicated_words(['name', 'enam', 'game'])\n -1\n >>> contain_complicated_words(['aaaaaaa', 'bb', 'cc'])\n -1\n \"\"\"","function2_human":"def contain_complicated_words(words: list[str]) -> int:\n \"\"\"Check if the given list of words contains complicated words.\n complicated words means the word contains more than 5 unique characters.\n Return the index of the most complicated word in words and -1 if there\n doesn't exist complicated word.\n If there are multiple the most complicated words, return the index of\n the first complicated word in lexicographical order.\n\n >>> contain_complicated_words(['name', 'of', 'string'])\n 2\n >>> contain_complicated_words(['name', 'enam', 'game'])\n -1\n >>> contain_complicated_words(['aaaaaaa', 'bb', 'cc'])\n -1\n \"\"\"\n word = find_max(words)\n if len(set(word)) > 5:\n return words.index(word)\n else:\n return -1","function2_name":"contain_complicated_words","tests":"def check(candidate):\n assert candidate(['analysis', 'cheeze', 'accept', 'centered']) == 0\n assert candidate(['pee', 'sat', 'erase']) == -1\n assert candidate(['eeeeeeee', 'wwwwseeeeew', 'wwwwwzxdef']) == 2\n\ndef test_check():\n check(contain_complicated_words)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def eat(number: int, need: int, remaining: int) -> list[int]:\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to complete the day's meals.\n you should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\n if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n\n Example:\n >>> eat(5, 6, 10)\n [11, 4]\n >>> eat(4, 8, 9)\n [12, 1]\n >>> eat(1, 10, 10)\n [11, 0]\n >>> eat(2, 11, 5)\n [7, 0]\n\n Variables:\n @number : integer\n the number of carrots that you have eaten.\n @need : integer\n the number of carrots that you need to eat.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n\n Constrain:\n * 0 <= number <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"","function1_human":"def eat(number: int, need: int, remaining: int) -> list[int]:\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to complete the day's meals.\n you should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\n if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n\n Example:\n >>> eat(5, 6, 10)\n [11, 4]\n >>> eat(4, 8, 9)\n [12, 1]\n >>> eat(1, 10, 10)\n [11, 0]\n >>> eat(2, 11, 5)\n [7, 0]\n\n Variables:\n @number : integer\n the number of carrots that you have eaten.\n @need : integer\n the number of carrots that you need to eat.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n\n Constrain:\n * 0 <= number <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"\n if need <= remaining:\n return [number + need, remaining - need]\n else:\n return [number + remaining, 0]","function1_name":"eat","function2_signature":"def eat_days(numbers: list[int], need: int, remaining: int) -> list[int]:\n \"\"\"\n You're a hungry rabbit, and every you already have eaten a certain number\n of carrots in your friend's house, but now you need to eat more carrots to\n complete the day's meals.\n you should return an array of [\n total number of eaten carrots after a couple of days,\n the number of remaining carrots in a stock after a couple of days ]\n if there are not enough remaining carrots, you will eat all remaining carrots,\n and sleep in a hunger status. (you will not eat more carrots in the next day)\n\n Example:\n >>> eat_week([3, 7, 4, 6, 5, 2, 9], 7, 10)\n [50, 0]\n\n Variables:\n @numbers:\n the number of carrots that you already have eaten in your friend's house during\n a couple of days.\n @need : integer\n the number of carrots that you need to eat during a day.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n\n Constrain:\n * 0 <= the elements in numbers <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"","function2_human":"def eat_days(numbers: list[int], need: int, remaining: int) -> list[int]:\n \"\"\"\n You're a hungry rabbit, and every you already have eaten a certain number\n of carrots in your friend's house, but now you need to eat more carrots to\n complete the day's meals.\n you should return an array of [\n total number of eaten carrots after a couple of days,\n the number of remaining carrots in a stock after a couple of days ]\n if there are not enough remaining carrots, you will eat all remaining carrots,\n and sleep in a hunger status. (you will not eat more carrots in the next day)\n\n Example:\n >>> eat_week([3, 7, 4, 6, 5, 2, 9], 7, 10)\n [50, 0]\n\n Variables:\n @numbers:\n the number of carrots that you already have eaten in your friend's house during\n a couple of days.\n @need : integer\n the number of carrots that you need to eat during a day.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n\n Constrain:\n * 0 <= the elements in numbers <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"\n (ans1, ans2) = (0, remaining)\n for number in numbers:\n (x1, ans2) = eat(number, max(need - number, 0), ans2)\n ans1 += x1\n return [ans1, ans2]","function2_name":"eat_days","tests":"def check(candidate):\n assert candidate([3, 5, 4, 5], 5, 10) == [20, 7]\n assert candidate([1, 2, 1, 2], 4, 5) == [11, 0]\n assert candidate([3, 5], 4, 2) == [9, 1]\n\ndef test_check():\n check(eat_days)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def do_algebra(operator: list[str], operand: list[int]) -> int:\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and\n the second list is a list of integers. Use the two given lists to build the algebric\n expression and return the evaluation of this expression.\n\n The basic algebra operations:\n Addition ( + )\n Subtraction ( - )\n Multiplication ( * )\n Floor division ( \/\/ )\n Exponentiation ( ** )\n\n Example:\n operator['+', '*', '-']\n array = [2, 3, 4, 5]\n result = 2 + 3 * 4 - 5\n => result = 9\n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n\n \"\"\"","function1_human":"def do_algebra(operator: list[str], operand: list[int]) -> int:\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and\n the second list is a list of integers. Use the two given lists to build the algebric\n expression and return the evaluation of this expression.\n\n The basic algebra operations:\n Addition ( + )\n Subtraction ( - )\n Multiplication ( * )\n Floor division ( \/\/ )\n Exponentiation ( ** )\n\n Example:\n operator['+', '*', '-']\n array = [2, 3, 4, 5]\n result = 2 + 3 * 4 - 5\n => result = 9\n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n\n \"\"\"\n expression = str(operand[0])\n for (oprt, oprn) in zip(operator, operand[1:]):\n expression += oprt + str(oprn)\n return eval(expression)","function1_name":"do_algebra","function2_signature":"def do_algebra_sequentially(operator: list, operand: list) -> list[int]:\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and\n the second list is a list of integers. Use the two given lists to build the algebric\n expression and return the evaluation of this expression. Note that the operator is applied\n sequentially from left to right.\n\n The basic algebra operations:\n Addition ( + )\n Subtraction ( - )\n Multiplication ( * )\n Floor division ( \/\/ )\n Exponentiation ( ** )\n\n Example:\n operator['+', '*', '-']\n array = [2, 3, 4, 5]\n result = (((2 + 3) * 4) - 5)\n => result = 15\n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n \"\"\"","function2_human":"def do_algebra_sequentially(operator: list, operand: list) -> list[int]:\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and\n the second list is a list of integers. Use the two given lists to build the algebric\n expression and return the evaluation of this expression. Note that the operator is applied\n sequentially from left to right.\n\n The basic algebra operations:\n Addition ( + )\n Subtraction ( - )\n Multiplication ( * )\n Floor division ( \/\/ )\n Exponentiation ( ** )\n\n Example:\n operator['+', '*', '-']\n array = [2, 3, 4, 5]\n result = (((2 + 3) * 4) - 5)\n => result = 15\n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n \"\"\"\n val = operand[0]\n for (op, val2) in zip(operator, operand[1:]):\n val = do_algebra([op], [val, val2])\n return val","function2_name":"do_algebra_sequentially","tests":"def check(candidate):\n assert candidate(['-', '*', '+'], [3, 1, 4, 5]) == 13\n assert candidate(['-', '-', '\/\/', '+'], [9, 3, 2, 3, 5]) == 6\n assert candidate(['*', '+'], [3, 5, 7]) == 22\n\ndef test_check():\n check(do_algebra_sequentially)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"from typing import Optional","function1_signature":"def string_to_md5(text: str) -> Optional[str]:\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n\n >>> string_to_md5('Hello world')\n '3e25960a79dbc69b674cd4ec67a72c62'\n \"\"\"","function1_human":"def string_to_md5(text: str) -> Optional[str]:\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n\n >>> string_to_md5('Hello world')\n '3e25960a79dbc69b674cd4ec67a72c62'\n \"\"\"\n import hashlib\n return hashlib.md5(text.encode('ascii')).hexdigest() if text else None","function1_name":"string_to_md5","function2_signature":"def match_password(password: str, h: str) -> bool:\n \"\"\"\n Given a string 'password' and its md5 hash equivalent string 'h',\n return True if 'password' is the original string, otherwise return False.\n if 'password' is an empty string, return False.\n\n >>> match_password('Hello world', '3e25960a79dbc69b674cd4ec67a72c62')\n True\n >>> match_password('Hello world', '3e25960a79dbc69b674cd4ec67a73c62')\n False\n \"\"\"","function2_human":"def match_password(password: str, h: str) -> bool:\n \"\"\"\n Given a string 'password' and its md5 hash equivalent string 'h',\n return True if 'password' is the original string, otherwise return False.\n if 'password' is an empty string, return False.\n\n >>> match_password('Hello world', '3e25960a79dbc69b674cd4ec67a72c62')\n True\n >>> match_password('Hello world', '3e25960a79dbc69b674cd4ec67a73c62')\n False\n \"\"\"\n return string_to_md5(password) == h if len(password) > 0 else False","function2_name":"match_password","tests":"def check(candidate):\n assert candidate('this is password', '8910e62fae2505e21f568632df8410a9') is True\n assert candidate('this was password', '8910e62fae2505e21f568632df8410a9') is False\n assert candidate('', '8910e62fae2505e21f568632df8410a9') is False\n\ndef test_check():\n check(match_password)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]} +{"imports":"","function1_signature":"def generate_integers(a: int, b: int) -> list[int]:\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n\n For example:\n >>> generate_integers(2, 8)\n [2, 4, 6, 8]\n >>> generate_integers(8, 2)\n [2, 4, 6, 8]\n >>> generate_integers(10, 14)\n []\n \"\"\"","function1_human":"def generate_integers(a: int, b: int) -> list[int]:\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n\n For example:\n >>> generate_integers(2, 8)\n [2, 4, 6, 8]\n >>> generate_integers(8, 2)\n [2, 4, 6, 8]\n >>> generate_integers(10, 14)\n []\n \"\"\"\n lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n return [i for i in range(lower, upper + 1) if i % 2 == 0]","function1_name":"generate_integers","function2_signature":"def sum_of_even_digits(a: int, b: int) -> int:\n \"\"\"\n Given two positive integers a and b, return the sum of the even digits\n between a and b, inclusive.\n\n For example:\n >>> sum_of_even_digits(2, 8)\n 20\n >>> sum_of_even_digits(8, 2)\n 20\n >>> sum_of_even_digits(10, 14)\n 0\n \"\"\"","function2_human":"def sum_of_even_digits(a: int, b: int) -> int:\n \"\"\"\n Given two positive integers a and b, return the sum of the even digits\n between a and b, inclusive.\n\n For example:\n >>> sum_of_even_digits(2, 8)\n 20\n >>> sum_of_even_digits(8, 2)\n 20\n >>> sum_of_even_digits(10, 14)\n 0\n \"\"\"\n return sum(generate_integers(a, b))","function2_name":"sum_of_even_digits","tests":"def check(candidate):\n assert candidate(7, 3) == 10\n assert candidate(10, 1) == 20\n assert candidate(6, 6) == 6\n\ndef test_check():\n check(sum_of_even_digits)\n\ntest_check()","stop_tokens":["\ndef","\n#","\nif","\nclass"]}