Prompt:
from typing import Any

def min_Swaps(str1: str, str2: str) -> Any:
    """
	Write a python function to count minimum number of swaps required to convert one binary number represented as a string to another.
	"""

def check(candidate):
    assert candidate('1101', '1110') == 1
    assert candidate('111', '000') == 'Not Possible'
    assert candidate('111', '110') == 'Not Possible'

def test_check():
    check(min_Swaps)

test_check()


Prompt:
def hexagonal_num(n: int) -> int:
    """
	Write a function to find the nth hexagonal number.
	"""

def check(candidate):
    assert candidate(10) == 190
    assert candidate(5) == 45
    assert candidate(7) == 91

def test_check():
    check(hexagonal_num)

test_check()


Prompt:
def remove_all_spaces(text: str) -> str:
    """
	Write a function to remove all whitespaces from a string.
	"""

def check(candidate):
    assert candidate('python  program') == 'pythonprogram'
    assert candidate('python   programming    language') == 'pythonprogramminglanguage'
    assert candidate('python                     program') == 'pythonprogram'
    assert candidate('   python                     program') == 'pythonprogram'

def test_check():
    check(remove_all_spaces)

test_check()

assert remove_all_spaces('python  program') == 'pythonprogram'


Prompt:
def multiply_int(x: int, y: int) -> int:
    """
	Write a function to multiply two integers.
	"""

def check(candidate):
    assert candidate(10, 20) == 200
    assert candidate(5, 10) == 50
    assert candidate(4, 8) == 32

def test_check():
    check(multiply_int)

test_check()


Prompt:
def number_ctr(str: str) -> int:
    """
	Write a python function to count number of digits in a given string.
	"""

def check(candidate):
    assert candidate('program2bedone') == 1
    assert candidate('3wonders') == 1
    assert candidate('123') == 3
    assert candidate('3wond-1ers2') == 3

def test_check():
    check(number_ctr)

test_check()

assert number_ctr('program2bedone') == 1


Prompt:
from typing import List

def get_pairs_count(arr: List[int], sum: int) -> int:
    """
	Write a python function to count the number of pairs whose sum is equal to ‘sum’. The funtion gets as input a list of numbers and the sum,
	"""

def check(candidate):
    assert candidate([1, 1, 1, 1], 2) == 6
    assert candidate([1, 5, 7, -1, 5], 6) == 3
    assert candidate([1, -2, 3], 1) == 1
    assert candidate([-1, -2, 3], -3) == 1

def test_check():
    check(get_pairs_count)

test_check()

assert get_pairs_count([1, 1, 1, 1], 2) == 6


Prompt:
def decimal_to_binary(n: int) -> str:
    """
	Write a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros.
	"""

def check(candidate):
    assert candidate(8) == '1000'
    assert candidate(18) == '10010'
    assert candidate(7) == '111'

def test_check():
    check(decimal_to_binary)

test_check()


Prompt:
from typing import List

def search(arr: List[int]) -> int:
    """
	Write a python function to find the element that appears only once in a sorted array.
	"""

def check(candidate):
    assert candidate([1, 1, 2, 2, 3]) == 3
    assert candidate([1, 1, 3, 3, 4, 4, 5, 5, 7, 7, 8]) == 8
    assert candidate([1, 2, 2, 3, 3, 4, 4]) == 1

def test_check():
    check(search)

test_check()


Prompt:
def is_undulating(n: int) -> bool:
    """
	Write a function to check whether the given number is undulating or not.
	"""

def check(candidate):
    assert candidate(1212121) == True
    assert candidate(1991) == False
    assert candidate(121) == True

def test_check():
    check(is_undulating)

test_check()


Prompt:
from typing import List

def count(lst: List[bool]) -> int:
    """
	Write a python function to count true booleans in the given list.
	"""

def check(candidate):
    assert candidate([True, False, True]) == 2
    assert candidate([False, False]) == 0
    assert candidate([True, True, True]) == 3

def test_check():
    check(count)

test_check()


Prompt:
from typing import List, Tuple

def pair_wise(l1: List[int]) -> List[Tuple[int, int]]:
    """
	Write a function to return a list of all pairs of consecutive items in a given list.
	"""


Prompt:
from typing import Dict

def check_value(dict: Dict[str, int], n: int) -> bool:
    """
	Write a function to check if all values are same in a dictionary.
	"""

def check(candidate):
    assert candidate({ 'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12 }, 10) == False
    assert candidate({ 'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12 }, 12) == True
    assert candidate({ 'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12 }, 5) == False

def test_check():
    check(check_value)

test_check()

assert check_value({ 'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12 }, 10) == False


Prompt:
from typing import List

def largest_neg(list1: List[int]) -> int:
    """
	Write a python function to find the largest negative number from the given list.
	"""

def check(candidate):
    assert candidate([1, 2, 3, -4, -6]) == -6
    assert candidate([1, 2, 3, -8, -9]) == -9
    assert candidate([1, 2, 3, 4, -1]) == -1

def test_check():
    check(largest_neg)

test_check()


Prompt:
from typing import Optional

def first_repeated_char(str1: str) -> Optional[str]:
    """
	Write a python function to find the first repeated character in a given string.
	"""

def check(candidate):
    assert candidate('abcabc') == 'a'
    assert candidate('abc') == None
    assert candidate('123123') == '1'

def test_check():
    check(first_repeated_char)

test_check()

assert first_repeated_char('abcabc') == 'a'


Prompt:
def odd_num_sum(n: int) -> int:
    """
	Write a python function to find the sum of fourth power of first n odd natural numbers.
	"""

def check(candidate):
    assert candidate(2) == 82
    assert candidate(3) == 707
    assert candidate(4) == 3108

def test_check():
    check(odd_num_sum)

test_check()


Prompt:
from typing import Tuple, List

def extract_rear(test_tuple: Tuple[str, str, str]) -> List[str]:
    """
	Write a function to extract only the rear index element of each string in the given tuple.
	"""

def check(candidate):
    assert candidate(('Mers', 'for', 'Vers')) == ['s', 'r', 's']
    assert candidate(('Avenge', 'for', 'People')) == ['e', 'r', 'e']
    assert candidate(('Gotta', 'get', 'go')) == ['a', 't', 'o']

def test_check():
    check(extract_rear)

test_check()

assert extract_rear(('Mers', 'for', 'Vers')) == ['s', 'r', 's']


Prompt:
from typing import List

def sum_negativenum(nums: List[int]) -> int:
    """
	Write a function to calculate the sum of the negative numbers of a given list of numbers.
	"""


Prompt:
from typing import List

def unique_Element(arr: List[int]) -> bool:
    """
	Write a python function to check whether a list of numbers contains only one distinct element or not.
	"""

def check(candidate):
    assert candidate([1, 1, 1]) == True
    assert candidate([1, 2, 1, 2]) == False
    assert candidate([1, 2, 3, 4, 5]) == False

def test_check():
    check(unique_Element)

test_check()

assert unique_Element([1, 1, 1]) == True


Prompt:
from typing import List

def all_unique(test_list: List[int]) -> bool:
    """
	Write a python function to check if the elements of a given list are unique or not.
	"""

def check(candidate):
    assert candidate([1, 2, 3]) == True
    assert candidate([1, 2, 1, 2]) == False
    assert candidate([1, 2, 3, 4, 5]) == True

def test_check():
    check(all_unique)

test_check()


Prompt:
def find_Parity(x: int) -> bool:
    """
	Write a python function to find whether the parity of a given number is odd.
	"""

def check(candidate):
    assert candidate(12) == False
    assert candidate(7) == True
    assert candidate(10) == False

def test_check():
    check(find_Parity)

test_check()


Prompt:
from typing import List

def Find_Max_Length(lst: List[List[int]]) -> int:
    """
	Write a python function to find the length of the longest sublists.
	"""


Prompt:
from typing import Dict

def merge_dictionaries_three(dict1: Dict[str, str], dict2: Dict[str, str], dict3: Dict[str, str]) -> Dict[str, str]:
    """
	Write a function to merge three dictionaries into a single dictionary.
	"""

def check(candidate):
    assert candidate({ 'R': 'Red', 'B': 'Black', 'P': 'Pink' }, { 'G': 'Green', 'W': 'White' }, { 'O': 'Orange', 'W': 'White', 'B': 'Black' }) == { 'B': 'Black', 'R': 'Red', 'P': 'Pink', 'G': 'Green', 'W': 'White', 'O': 'Orange' }
    assert candidate({ 'R': 'Red', 'B': 'Black', 'P': 'Pink' }, { 'G': 'Green', 'W': 'White' }, { 'L': 'lavender', 'B': 'Blue' }) == { 'W': 'White', 'P': 'Pink', 'B': 'Black', 'R': 'Red', 'G': 'Green', 'L': 'lavender' }
    assert candidate({ 'R': 'Red', 'B': 'Black', 'P': 'Pink' }, { 'L': 'lavender', 'B': 'Blue' }, { 'G': 'Green', 'W': 'White' }) == { 'B': 'Black', 'P': 'Pink', 'R': 'Red', 'G': 'Green', 'L': 'lavender', 'W': 'White' }

def test_check():
    check(merge_dictionaries_three)

test_check()

assert merge_dictionaries_three({ 'R': 'Red', 'B': 'Black', 'P': 'Pink' }, { 'G': 'Green', 'W': 'White' }, { 'O': 'Orange', 'W': 'White', 'B': 'Black' }) == { 'B': 'Black', 'R': 'Red', 'P': 'Pink', 'G': 'Green', 'W': 'White', 'O': 'Orange' }


Prompt:
def remove_Occ(s: str, ch: str) -> str:
    """
	Write a python function to remove first and last occurrence of a given character from the string.
	"""

def check(candidate):
    assert candidate('hello', 'l') == 'heo'
    assert candidate('abcda', 'a') == 'bcd'
    assert candidate('PHP', 'P') == 'H'

def test_check():
    check(remove_Occ)

test_check()

assert remove_Occ('hello', 'l') == 'heo'


Prompt:
from typing import List

def check_min_heap(arr: List[int]) -> bool:
    """
	Write a function to check if the given array represents min heap or not. https://www.geeksforgeeks.org/how-to-check-if-a-given-array-represents-a-binary-heap/
	"""

def check(candidate):
    assert candidate([1, 2, 3, 4, 5, 6]) == True
    assert candidate([2, 3, 4, 5, 10, 15]) == True
    assert candidate([2, 10, 4, 5, 3, 15]) == False

def test_check():
    check(check_min_heap)

test_check()

assert check_min_heap([1, 2, 3, 4, 5, 6]) == True


Prompt:
from typing import List, Union

def min_val(listval: List[Union[str, int]]) -> int:
    """
	Write a function to find the minimum value in a given heterogeneous list.
	"""

def check(candidate):
    assert candidate(['Python', 3, 2, 4, 5, 'version']) == 2
    assert candidate(['Python', 15, 20, 25]) == 15
    assert candidate(['Python', 30, 20, 40, 50, 'version']) == 20

def test_check():
    check(min_val)

test_check()

assert min_val(['Python', 3, 2, 4, 5, 'version']) == 2


Prompt:
from typing import List

def interleave_lists(list1: List[int], list2: List[int], list3: List[int]) -> List[int]:
    """
	Write a function to interleave 3 lists of the same length into a single flat list.
	"""


Prompt:
from typing import List

def len_log(list1: List[str]) -> int:
    """
	Write a python function to find the length of the longest word.
	"""

def check(candidate):
    assert candidate(['python', 'PHP', 'bigdata']) == 7
    assert candidate(['a', 'ab', 'abc']) == 3
    assert candidate(['small', 'big', 'tall']) == 5

def test_check():
    check(len_log)

test_check()

assert len_log(['python', 'PHP', 'bigdata']) == 7


Prompt:
def loss_amount(actual_cost: int, sale_amount: int) -> int:
    """
	Write a function that gives loss amount on a sale if the given amount has loss else return 0.
	"""

def check(candidate):
    assert candidate(1500, 1200) == 0
    assert candidate(100, 200) == 100
    assert candidate(2000, 5000) == 3000

def test_check():
    check(loss_amount)

test_check()


Prompt:
from typing import List

def _sum(arr: List[int]) -> int:
    """
	Write a python function to find the sum of an array.
	"""

def check(candidate):
    assert candidate([1, 2, 3]) == 6
    assert candidate([15, 12, 13, 10]) == 50
    assert candidate([0, 1, 2]) == 3

def test_check():
    check(_sum)

test_check()


Prompt:
from typing import List, Tuple

def max_length_list(input_list: List[List[int]]) -> Tuple[int, List[int]]:
    """
	Write a function to find the list with maximum length.
	"""


Prompt:
from typing import List, Tuple

def rear_extract(test_list: List[Tuple[int, str, int]]) -> List[int]:
    """
	Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple.
	"""


Prompt:
from typing import List

def count_Pairs(arr: List[int], n: int) -> int:
    """
	Write a python function which takes a list of integers and counts the number of possible unordered pairs where both elements are unequal.
	"""

def check(candidate):
    assert candidate([1, 2, 1], 3) == 2
    assert candidate([1, 1, 1, 1], 4) == 0
    assert candidate([1, 2, 3, 4, 5], 5) == 10

def test_check():
    check(count_Pairs)

test_check()


Prompt:
from typing import List, Tuple

def count_bidirectional(test_list: List[Tuple[int, int]]) -> int:
    """
	Write a function to count bidirectional tuple pairs.
	"""


Prompt:
from typing import List

def remove_parenthesis(items: List[str]) -> str:
    """
	Write a function to remove the parenthesis and what is inbetween them from a string.
	"""

def check(candidate):
    assert candidate(['python (chrome)']) == 'python'
    assert candidate(['string(.abc)']) == 'string'
    assert candidate(['alpha(num)']) == 'alpha'

def test_check():
    check(remove_parenthesis)

test_check()

assert remove_parenthesis(['python (chrome)']) == 'python'


Prompt:
def dif_Square(n: int) -> bool:
    """
	Write a python function to check whether the given number can be represented as the difference of two squares or not.
	"""

def check(candidate):
    assert candidate(5) == True
    assert candidate(10) == False
    assert candidate(15) == True

def test_check():
    check(dif_Square)

test_check()


Prompt:
def cal_sum(n: int) -> int:
    """
	Write a function to calculate the sum of perrin numbers.
	"""

def check(candidate):
    assert candidate(9) == 49
    assert candidate(10) == 66
    assert candidate(11) == 88

def test_check():
    check(cal_sum)

test_check()


Prompt:
def divisor(n: int) -> int:
    """
	Write a python function to find the number of divisors of a given integer.
	"""

def check(candidate):
    assert candidate(15) == 4
    assert candidate(12) == 6
    assert candidate(9) == 3

def test_check():
    check(divisor)

test_check()


Prompt:
from typing import List

def get_Inv_Count(arr: List[int]) -> int:
    """
	Write a python function to count inversions in an array.
	"""

def check(candidate):
    assert candidate([1, 20, 6, 4, 5]) == 5
    assert candidate([1, 2, 1]) == 1
    assert candidate([1, 2, 5, 6, 1]) == 3

def test_check():
    check(get_Inv_Count)

test_check()


Prompt:
from typing import List

def find_Max_Num(arr: List[int]) -> int:
    """
	Write a python function to find the largest number that can be formed with the given list of digits.
	"""

def check(candidate):
    assert candidate([1, 2, 3]) == 321
    assert candidate([4, 5, 6, 1]) == 6541
    assert candidate([1, 2, 3, 9]) == 9321

def test_check():
    check(find_Max_Num)

test_check()


Prompt:
from typing import List

def cummulative_sum(test_list: List[List[int]]) -> int:
    """
	Write a function to find the cumulative sum of all the values that are present in the given list of lists.
	"""

def check(candidate):
    assert candidate([[1, 3], [5, 6, 7], [2, 6]]) == 30
    assert candidate([[2, 4], [6, 7, 8], [3, 7]]) == 37
    assert candidate([[3, 5], [7, 8, 9], [4, 8]]) == 44

def test_check():
    check(cummulative_sum)

test_check()


Prompt:
from typing import List

def nth_nums(nums: List[int], n: int) -> List[int]:
    """
	Write a function to compute the n-th power of each number in a list.
	"""


Prompt:
def left_rotate(n: int, d: int) -> int:
    """
	Write a function to that rotate left bits by d bits a given number. We assume that the number is 32 bit.
	"""

def check(candidate):
    assert candidate(16, 2) == 64
    assert candidate(10, 2) == 40
    assert candidate(99, 3) == 792
    assert candidate(99, 3) == 792
    assert candidate(1, 3) == 8
    assert candidate(5, 3) == 40
    assert candidate(29, 3) == 232

def test_check():
    check(left_rotate)

test_check()


Prompt:
def lps(str: str) -> int:
    """
	Write a function to find the length of the longest palindromic subsequence in the given string.
	"""

def check(candidate):
    assert candidate('TENS FOR TENS') == 5
    assert candidate('CARDIO FOR CARDS') == 7
    assert candidate('PART OF THE JOURNEY IS PART') == 9

def test_check():
    check(lps)

test_check()


Prompt:
def toggle_middle_bits(n: int) -> int:
    """
	Write a python function to toggle bits of the number except the first and the last bit. https://www.geeksforgeeks.org/toggle-bits-number-expect-first-last-bits/
	"""

def check(candidate):
    assert candidate(9) == 15
    assert candidate(10) == 12
    assert candidate(11) == 13
    assert candidate(65) == 127
    assert candidate(77) == 115

def test_check():
    check(toggle_middle_bits)

test_check()


Prompt:
from typing import List

def tup_string(tup1: List[str]) -> str:
    """
	Write a function to convert a list to a string.
	"""

def check(candidate):
    assert candidate(['e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's']) == 'exercises'
    assert candidate(['p', 'y', 't', 'h', 'o', 'n']) == 'python'
    assert candidate(['p', 'r', 'o', 'g', 'r', 'a', 'm']) == 'program'

def test_check():
    check(tup_string)

test_check()


Prompt:
from typing import List

def Extract(lst: List[List[int]]) -> List[int]:
    """
	Write a python function to get the first element of each sublist.
	"""


Prompt:
def radian_degree(degree: int) -> float:
    """
	Write a function to convert degrees to radians.
	"""

def check(candidate):
    assert candidate(90) == 1.5707963267948966
    assert candidate(60) == 1.0471975511965976
    assert candidate(120) == 2.0943951023931953

def test_check():
    check(radian_degree)

test_check()


Prompt:
def next_power_of_2(n: int) -> int:
    """
	Write a python function to find the smallest power of 2 greater than or equal to n.
	"""

def check(candidate):
    assert candidate(0) == 1
    assert candidate(5) == 8
    assert candidate(17) == 32

def test_check():
    check(next_power_of_2)

test_check()


Prompt:
def text_match_zero_one(text: str) -> bool:
    """
	Write a function that matches a string that has an 'a' followed by one or more 'b's. https://www.w3resource.com/python-exercises/re/python-re-exercise-3.php
	"""

def check(candidate):
    assert candidate('ac') == False
    assert candidate('dc') == False
    assert candidate('abbbba') == True
    assert candidate('dsabbbba') == True
    assert candidate('asbbbba') == False
    assert candidate('abaaa') == True

def test_check():
    check(text_match_zero_one)

test_check()

assert text_match_zero_one('ac') == False


Prompt:
from typing import List

def pair_xor_Sum(arr: List[int], n: int) -> int:
    """
	Write a python function to find the sum of xor of all pairs of numbers in the given list.
	"""

def check(candidate):
    assert candidate([5, 9, 7, 6], 4) == 47
    assert candidate([7, 3, 5], 3) == 12
    assert candidate([7, 3], 2) == 4

def test_check():
    check(pair_xor_Sum)

test_check()


Prompt:
def rectangle_area(l: int, b: int) -> int:
    """
	Write a function to find the area of a rectangle.
	"""

def check(candidate):
    assert candidate(10, 20) == 200
    assert candidate(10, 5) == 50
    assert candidate(4, 2) == 8

def test_check():
    check(rectangle_area)

test_check()


Prompt:
def geometric_sum(n: int) -> float:
    """
	Write a function to calculate the geometric sum of n-1. https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-recursion-exercise-9.php
	"""

def check(candidate):
    assert candidate(7) == 1.9921875
    assert candidate(4) == 1.9375
    assert candidate(8) == 1.99609375

def test_check():
    check(geometric_sum)

test_check()


Prompt:
from typing import List

def filter_oddnumbers(nums: List[int]) -> List[int]:
    """
	Write a function to filter odd numbers.
	"""


Prompt:
def remove_odd(str1: str) -> str:
    """
	Write a function to remove odd characters in a string.
	"""

def check(candidate):
    assert candidate('python') == 'yhn'
    assert candidate('program') == 'rga'
    assert candidate('language') == 'agae'

def test_check():
    check(remove_odd)

test_check()


Prompt:
def min_of_three(a: int, b: int, c: int) -> int:
    """
	Write a function to find minimum of three numbers.
	"""

def check(candidate):
    assert candidate(10, 20, 0) == 0
    assert candidate(19, 15, 18) == 15
    assert candidate(-10, -20, -30) == -30

def test_check():
    check(min_of_three)

test_check()


Prompt:
def count_occurance(s: str) -> int:
    """
	Write a function to count the number of occurence of the string 'std' in a given string.
	"""

def check(candidate):
    assert candidate('letstdlenstdporstd') == 3
    assert candidate('truststdsolensporsd') == 1
    assert candidate('makestdsostdworthit') == 2
    assert candidate('stds') == 1
    assert candidate('') == 0

def test_check():
    check(count_occurance)

test_check()

assert count_occurance('letstdlenstdporstd') == 3


Prompt:
def text_match_one(text: str) -> bool:
    """
	Write a function that matches a string that has an a followed by one or more b's.
	"""

def check(candidate):
    assert candidate('ac') == False
    assert candidate('dc') == False
    assert candidate('abba') == True

def test_check():
    check(text_match_one)

test_check()


Prompt:
def count_no_of_ways(n: int, k: int) -> int:
    """
	Write a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors.
	"""

def check(candidate):
    assert candidate(2, 4) == 16
    assert candidate(3, 2) == 6
    assert candidate(4, 4) == 228

def test_check():
    check(count_no_of_ways)

test_check()


Prompt:
from typing import List

def find_remainder(arr: List[int], n: int) -> int:
    """
	Write a python function to find the product of the array multiplication modulo n.
	"""

def check(candidate):
    assert candidate([100, 10, 5, 25, 35, 14], 11) == 9
    assert candidate([1, 1, 1], 1) == 0
    assert candidate([1, 2, 1], 2) == 0

def test_check():
    check(find_remainder)

test_check()


Prompt:
from typing import List

def check_K(test_tup: List[int], K: int) -> bool:
    """
	Write a function to check if the given tuples contain the k or not.
	"""

def check(candidate):
    assert candidate([10, 4, 5, 6, 8], 6) == True
    assert candidate([1, 2, 3, 4, 5, 6], 7) == False
    assert candidate([7, 8, 9, 44, 11, 12], 11) == True

def test_check():
    check(check_K)

test_check()


Prompt:
from typing import List

def is_Monotonic(A: List[int]) -> bool:
    """
	Write a python function to check whether the given array is monotonic or not.
	"""

def check(candidate):
    assert candidate([6, 5, 4, 4]) == True
    assert candidate([1, 2, 2, 3]) == True
    assert candidate([1, 3, 2]) == False

def test_check():
    check(is_Monotonic)

test_check()

assert is_Monotonic([6, 5, 4, 4]) == True


Prompt:
def parabola_directrix(a: int, b: int, c: int) -> int:
    """
	Write a function to find the directrix of a parabola.
	"""

def check(candidate):
    assert candidate(5, 3, 2) == -198
    assert candidate(9, 8, 4) == -2336
    assert candidate(2, 4, 6) == -130

def test_check():
    check(parabola_directrix)

test_check()

assert parabola_directrix(5, 3, 2) == -198


Prompt:
from typing import List

def div_list(nums1: List[int], nums2: List[int]) -> List[float]:
    """
	Write a function to divide two lists element wise.
	"""


Prompt:
from typing import Tuple

def concatenate_tuple(test_tup: Tuple[str, str, int, str]) -> str:
    """
	Write a function to concatenate each element of tuple by the delimiter.
	"""

def check(candidate):
    assert candidate(('ID', 'is', 4, 'UTS')) == 'ID-is-4-UTS'
    assert candidate(('QWE', 'is', 4, 'RTY')) == 'QWE-is-4-RTY'
    assert candidate(('ZEN', 'is', 4, 'OP')) == 'ZEN-is-4-OP'

def test_check():
    check(concatenate_tuple)

test_check()

assert concatenate_tuple(('ID', 'is', 4, 'UTS')) == 'ID-is-4-UTS'


Prompt:
from typing import List, Tuple

def add_tuple(test_list: List[int], test_tup: Tuple[int, int]) -> List[int]:
    """
	Write a function to add the given tuple to the given list.
	"""


Prompt:
from typing import List

def find_Element(arr: List[int], ranges: List[List[int]], rotations: int, index: int) -> int:
    """
	Write a python function to find element at a given index after number of rotations.
	"""


Prompt:
from typing import Tuple, Dict

def tuple_to_dict(test_tup: Tuple[int, int, int, int, int, int]) -> Dict[int, int]:
    """
	Write a function to convert the given tuple to a key-value dictionary using adjacent elements. https://www.geeksforgeeks.org/python-convert-tuple-to-adjacent-pair-dictionary/
	"""


Prompt:
from typing import List

def find_First_Missing(array: List[int]) -> int:
    """
	Write a python function to find the smallest missing number from a sorted list of natural numbers.
	"""

def check(candidate):
    assert candidate([0, 1, 2, 3]) == 4
    assert candidate([0, 1, 2, 6, 9]) == 3
    assert candidate([2, 3, 5, 8, 9]) == 0

def test_check():
    check(find_First_Missing)

test_check()

assert find_First_Missing([0, 1, 2, 3]) == 4


Prompt:
from typing import List, Union

def max_val(listval: List[Union[str, int]]) -> int:
    """
	Write a function to find the maximum value in a given heterogeneous list.
	"""

def check(candidate):
    assert candidate(['Python', 3, 2, 4, 5, 'version']) == 5
    assert candidate(['Python', 15, 20, 25]) == 25
    assert candidate(['Python', 30, 20, 40, 50, 'version']) == 50

def test_check():
    check(max_val)

test_check()

assert max_val(['Python', 3, 2, 4, 5, 'version']) == 5


Prompt:
def count_char_position(str1: str) -> int:
    """
	Write a function to count the number of characters in a string that occur at the same position in the string as in the English alphabet (case insensitive).
	"""

def check(candidate):
    assert candidate('xbcefg') == 2
    assert candidate('ABcED') == 3
    assert candidate('AbgdeF') == 5

def test_check():
    check(count_char_position)

test_check()

assert count_char_position('xbcefg') == 2


Prompt:
from typing import List

def perfect_squares(a: int, b: int) -> List[int]:
    """
	Write a function to find perfect squares between two given numbers.
	"""

def check(candidate):
    assert candidate(1, 30) == [1, 4, 9, 16, 25]
    assert candidate(50, 100) == [64, 81, 100]
    assert candidate(100, 200) == [100, 121, 144, 169, 196]

def test_check():
    check(perfect_squares)

test_check()


Prompt:
from typing import Any

def check_none(test_tup: Any) -> bool:
    """
	Write a function to check if the given tuple has any none value or not.
	"""

def check(candidate):
    assert candidate((10, 4, 5, 6, None)) == True
    assert candidate((7, 8, 9, 11, 14)) == False
    assert candidate((1, 2, 3, 4, None)) == True

def test_check():
    check(check_none)

test_check()

assert check_none((10, 4, 5, 6, None)) == True


Prompt:
from typing import List, Any

def multiply_elements(test_tup: List[int]) -> List[Any]:
    """
	Write a function that takes as input a list of numbers (t_1,...,t_{N+1}) and returns a list of length N where the i-th element of the tuple is equal to t_i * t_{i+1}.
	"""

def check(candidate):
    assert candidate([1, 5, 7, 8, 10]) == [5, 35, 56, 80]
    assert candidate([2, 4, 5, 6, 7]) == [8, 20, 30, 42]
    assert candidate([12, 13, 14, 9, 15]) == [156, 182, 126, 135]
    assert candidate([12]) == []

def test_check():
    check(multiply_elements)

test_check()


Prompt:
from typing import List

def left_insertion(a: List[int], x: int) -> int:
    """
	Write a function to locate the left insertion point for a specified value in sorted order. https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-data-structure-exercise-24.php
	"""

def check(candidate):
    assert candidate([1, 2, 4, 5], 6) == 4
    assert candidate([1, 2, 4, 5], 3) == 2
    assert candidate([1, 2, 4, 5], 7) == 4

def test_check():
    check(left_insertion)

test_check()

assert left_insertion([1, 2, 4, 5], 6) == 4


Prompt:
from typing import List, Tuple

def max_difference(test_list: List[Tuple[int, int]]) -> int:
    """
	Write a function to find the maximum difference between available pairs in the given tuple list.
	"""


Prompt:
def dog_age(h_age: int) -> int:
    """
	Write a function to calculate a dog's age in dog's years.
	"""

def check(candidate):
    assert candidate(12) == 61
    assert candidate(15) == 73
    assert candidate(24) == 109

def test_check():
    check(dog_age)

test_check()


Prompt:
from typing import Tuple

def substract_elements(test_tup1: Tuple[int, int, int], test_tup2: Tuple[int, int, int]) -> Tuple[int, int, int]:
    """
	Write a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index.
	"""


Prompt:
def get_Char(strr: str) -> str:
    """
	Write a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.
	"""

def check(candidate):
    assert candidate('abc') == 'f'
    assert candidate('gfg') == 't'
    assert candidate('ab') == 'c'

def test_check():
    check(get_Char)

test_check()


Prompt:
from typing import List

def find_substring(str1: List[str], sub_str: str) -> bool:
    """
	Write a function to check if a string is present as a substring in a given list of string values.
	"""

def check(candidate):
    assert candidate(['red', 'black', 'white', 'green', 'orange'], 'ack') == True
    assert candidate(['red', 'black', 'white', 'green', 'orange'], 'abc') == False
    assert candidate(['red', 'black', 'white', 'green', 'orange'], 'ange') == True

def test_check():
    check(find_substring)

test_check()

assert find_substring(['red', 'black', 'white', 'green', 'orange'], 'ack') == True


Prompt:
def next_smallest_palindrome(num: int) -> int:
    """
	Write a function to find the next smallest palindrome of a specified integer, returned as an integer.
	"""

def check(candidate):
    assert candidate(99) == 101
    assert candidate(1221) == 1331
    assert candidate(120) == 121

def test_check():
    check(next_smallest_palindrome)

test_check()

assert next_smallest_palindrome(99) == 101


Prompt:
from typing import List

def sub_list(nums1: List[int], nums2: List[int]) -> List[int]:
    """
	Write a function to subtract two lists element-wise.
	"""

def check(candidate):
    assert candidate([1, 2, 3], [4, 5, 6]) == [-3, -3, -3]
    assert candidate([1, 2], [3, 4]) == [-2, -2]
    assert candidate([90, 120], [50, 70]) == [40, 50]

def test_check():
    check(sub_list)

test_check()


Prompt:
from typing import List

def even_position(nums: List[int]) -> bool:
    """
	Write a python function to check whether every even index contains even numbers of a given list.
	"""

def check(candidate):
    assert candidate([3, 2, 1]) == False
    assert candidate([1, 2, 3]) == False
    assert candidate([2, 1, 4]) == True

def test_check():
    check(even_position)

test_check()

assert even_position([3, 2, 1]) == False


Prompt:
def snake_to_camel(word: str) -> str:
    """
	Write a function to convert the given snake case string to camel case string.
	"""

def check(candidate):
    assert candidate('android_tv') == 'AndroidTv'
    assert candidate('google_pixel') == 'GooglePixel'
    assert candidate('apple_watch') == 'AppleWatch'

def test_check():
    check(snake_to_camel)

test_check()

assert snake_to_camel('android_tv') == 'AndroidTv'


Prompt:
from typing import List, Any

def extract_index_list(l1: List[int], l2: List[int], l3: List[int]) -> List[Any]:
    """
	We say that an element is common for lists l1, l2, l3 if it appears in all three lists under the same index. Write a function to find common elements from three lists. The function should return a list.
	"""


Prompt:
def checks(n: int) -> bool:
    """
	Write a python function to check if a given number is one less than twice its reverse.
	"""

def check(candidate):
    assert candidate(70) == False
    assert candidate(23) == False
    assert candidate(73) == True

def test_check():
    check(checks)

test_check()


Prompt:
def power_base_sum(base: int, power: int) -> int:
    """
	Write a function that takes base and power as arguments and calculate the sum of all digits of the base to the specified power.
	"""

def check(candidate):
    assert candidate(2, 100) == 115
    assert candidate(8, 10) == 37
    assert candidate(8, 15) == 62
    assert candidate(3, 3) == 9

def test_check():
    check(power_base_sum)

test_check()


Prompt:
def find_star_num(n: int) -> int:
    """
	Write a function to find the n'th star number.
	"""

def check(candidate):
    assert candidate(3) == 37
    assert candidate(4) == 73
    assert candidate(5) == 121

def test_check():
    check(find_star_num)

test_check()


Prompt:
from typing import List

def insert_element(list: List[str], element: str) -> List[str]:
    """
	Write a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list.
	"""

def check(candidate):
    assert candidate(['Red', 'Green', 'Black'], 'c') == ['c', 'Red', 'c', 'Green', 'c', 'Black']
    assert candidate(['python', 'java'], 'program') == ['program', 'python', 'program', 'java']
    assert candidate(['happy', 'sad'], 'laugh') == ['laugh', 'happy', 'laugh', 'sad']

def test_check():
    check(insert_element)

test_check()

assert insert_element(['Red', 'Green', 'Black'], 'c') == ['c', 'Red', 'c', 'Green', 'c', 'Black']


Prompt:
from typing import List

def shell_sort(my_list: List[int]) -> List[int]:
    """
	Write a function to sort the given array by using shell sort.
	"""


Prompt:
from typing import List

def big_sum(nums: List[int]) -> int:
    """
	Write a python function to find the sum of the largest and smallest value in a given array.
	"""

def check(candidate):
    assert candidate([1, 2, 3]) == 4
    assert candidate([-1, 2, 3, 4]) == 3
    assert candidate([2, 3, 6]) == 8

def test_check():
    check(big_sum)

test_check()


Prompt:
from typing import Dict, Optional

def drop_empty(dict1: Dict[str, Optional[str]]) -> Dict[str, str]:
    """
	Write a function to drop empty items from a given dictionary.
	"""

def check(candidate):
    assert candidate({ 'c1': 'Red', 'c2': 'Green', 'c3': None }) == { 'c1': 'Red', 'c2': 'Green' }
    assert candidate({ 'c1': 'Red', 'c2': None, 'c3': None }) == { 'c1': 'Red' }
    assert candidate({ 'c1': None, 'c2': 'Green', 'c3': None }) == { 'c2': 'Green' }

def test_check():
    check(drop_empty)

test_check()

assert drop_empty({ 'c1': 'Red', 'c2': 'Green', 'c3': None }) == { 'c1': 'Red', 'c2': 'Green' }


Prompt:
def text_match_wordz(text: str) -> bool:
    """
	Write a function that matches a word containing 'z'.
	"""

def check(candidate):
    assert candidate('pythonz.') == True
    assert candidate('xyz.') == True
    assert candidate('  lang  .') == False

def test_check():
    check(text_match_wordz)

test_check()

assert text_match_wordz('pythonz.') == True


Prompt:
def prime_num(num: int) -> bool:
    """
	Write a function to check if the given integer is a prime number.
	"""

def check(candidate):
    assert candidate(13) == True
    assert candidate(7) == True
    assert candidate(-1010) == False

def test_check():
    check(prime_num)

test_check()


Prompt:
from typing import List

def merge_sorted_list(num1: List[int], num2: List[int], num3: List[int]) -> List[int]:
    """
	Write a function to merge three lists into a single sorted list.
	"""


Prompt:
from typing import List

def sample_nam(sample_names: List[str]) -> int:
    """
	Write a function to sum the length of the names of a given list of names after removing the names that start with a lowercase letter.
	"""

def check(candidate):
    assert candidate(['sally', 'Dylan', 'rebecca', 'Diana', 'Joanne', 'keith']) == 16
    assert candidate(['php', 'res', 'Python', 'abcd', 'Java', 'aaa']) == 10
    assert candidate(['abcd', 'Python', 'abba', 'aba']) == 6

def test_check():
    check(sample_nam)

test_check()

assert sample_nam(['sally', 'Dylan', 'rebecca', 'Diana', 'Joanne', 'keith']) == 16


Prompt:
from typing import List, Tuple

def min_product_tuple(list1: List[Tuple[int, int]]) -> int:
    """
	Write a function to find the minimum product from the pairs of tuples within a given list.
	"""


Prompt:
from typing import Any, Tuple

def remove_nested(test_tup: Any) -> Tuple[int, int, int, int]:
    """
	Write a function to remove tuples from the given tuple.
	"""


Prompt:
from typing import List

def swap_List(newList: List[int]) -> List[int]:
    """
	Write a python function to interchange the first and last elements in a list.
	"""

def check(candidate):
    assert candidate([12, 35, 9, 56, 24]) == [24, 35, 9, 56, 12]
    assert candidate([1, 2, 3]) == [3, 2, 1]
    assert candidate([4, 5, 6]) == [6, 5, 4]

def test_check():
    check(swap_List)

test_check()


Prompt:
from typing import List, Union

def round_and_sum(list1: List[Union[float, int]]) -> int:
    """
	Write a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.
	"""


Prompt:
def sequence(n: int) -> int:
    """
	Write a function to find the nth number in the newman conway sequence.
	"""

def check(candidate):
    assert candidate(10) == 6
    assert candidate(2) == 1
    assert candidate(3) == 2

def test_check():
    check(sequence)

test_check()


Prompt:
def newman_prime(n: int) -> int:
    """
	Write a function to find the nth newman–shanks–williams prime number.
	"""

def check(candidate):
    assert candidate(3) == 7
    assert candidate(4) == 17
    assert candidate(5) == 41

def test_check():
    check(newman_prime)

test_check()


Prompt:
from typing import List, Any

def Find_Max(lst: List[List[Any]]) -> List[Any]:
    """
	Write a python function to find the element of a list having maximum length.
	"""


Prompt:
from typing import List

def split(word: str) -> List[str]:
    """
	Write a python function to split a string into characters.
	"""

def check(candidate):
    assert candidate('python') == ['p', 'y', 't', 'h', 'o', 'n']
    assert candidate('Name') == ['N', 'a', 'm', 'e']
    assert candidate('program') == ['p', 'r', 'o', 'g', 'r', 'a', 'm']

def test_check():
    check(split)

test_check()


Prompt:
from typing import List, Any

def pack_consecutive_duplicates(list1: List[Any]) -> List[List[Any]]:
    """
	Write a function to pack consecutive duplicates of a given list elements into sublists.
	"""


Prompt:
from typing import List, Tuple

def min_k(test_list: List[Tuple[str, int]], K: int) -> List[Tuple[str, int]]:
    """
	Write a function to find minimum k records from tuple list. https://www.geeksforgeeks.org/python-find-minimum-k-records-from-tuple-list/ - in this case a verbatim copy of test cases
	"""

def check(candidate):
    assert candidate([('Manjeet', 10), ('Akshat', 4), ('Akash', 2), ('Nikhil', 8)], 2) == [('Akash', 2), ('Akshat', 4)]
    assert candidate([('Sanjeev', 11), ('Angat', 5), ('Akash', 3), ('Nepin', 9)], 3) == [('Akash', 3), ('Angat', 5), ('Nepin', 9)]
    assert candidate([('tanmay', 14), ('Amer', 11), ('Ayesha', 9), ('SKD', 16)], 1) == [('Ayesha', 9)]

def test_check():
    check(min_k)

test_check()


Prompt:
def check_integer(text: str) -> bool:
    """
	Write a function to check if a string represents an integer or not.
	"""

def check(candidate):
    assert candidate('python') == False
    assert candidate('1') == True
    assert candidate('12345') == True

def test_check():
    check(check_integer)

test_check()


Prompt:
from typing import List

def rotate_right(list: List[int], m: int) -> List[int]:
    """
	Write a function to rotate a given list by specified number of items to the right direction. https://www.geeksforgeeks.org/python-program-right-rotate-list-n/
	"""


Prompt:
def armstrong_number(number: int) -> bool:
    """
	Write a function to check whether the given number is armstrong or not.
	"""

def check(candidate):
    assert candidate(153) == True
    assert candidate(259) == False
    assert candidate(4458) == False

def test_check():
    check(armstrong_number)

test_check()


Prompt:
from typing import List, Any

def sum_of_digits(nums: List[Any]) -> int:
    """
	Write a function to compute the sum of digits of each number of a given list.
	"""

def check(candidate):
    assert candidate([10, 2, 56]) == 14
    assert candidate([[10, 20, 4, 5, 'b', 70, 'a']]) == 19
    assert candidate([10, 20, -4, 5, -70]) == 19

def test_check():
    check(sum_of_digits)

test_check()


Prompt:
from typing import List

def re_arrange_array(arr: List[int], n: int) -> List[int]:
    """
	Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved.
	"""


Prompt:
def wind_chill(v: int, t: int) -> int:
    """
	Write a function to calculate the wind chill index rounded to the next integer given the wind velocity in km/h and a temperature in celsius.
	"""

def check(candidate):
    assert candidate(120, 35) == 40
    assert candidate(40, 20) == 19
    assert candidate(10, 8) == 6

def test_check():
    check(wind_chill)

test_check()


Prompt:
def bell_Number(n: int) -> int:
    """
	Write a python function to find nth bell number.
	"""

def check(candidate):
    assert candidate(2) == 2
    assert candidate(3) == 5
    assert candidate(4) == 15

def test_check():
    check(bell_Number)

test_check()


Prompt:
def sum_div(number: int) -> int:
    """
	Write a function to return the sum of all divisors of a number.
	"""

def check(candidate):
    assert candidate(8) == 7
    assert candidate(12) == 16
    assert candidate(7) == 1

def test_check():
    check(sum_div)

test_check()


Prompt:
from typing import Tuple, List

def get_coordinates(test_tup: Tuple[int, int]) -> List[List[int]]:
    """
	Write a function to extract all the adjacent coordinates of the given coordinate tuple.
	"""


Prompt:
from typing import Tuple

def find_dissimilar(test_tup1: Tuple[int, int, int, int], test_tup2: Tuple[int, int, int, int]) -> Tuple[int, int, int, int]:
    """
	Write a function to find the dissimilar elements in the given two tuples.
	"""


Prompt:
def find_length(string: str) -> int:
    """
	Write a function to find the maximum difference between the number of 0s and number of 1s in any sub-string of the given binary string.
	"""

def check(candidate):
    assert candidate('11000010001') == 6
    assert candidate('10111') == 1
    assert candidate('11011101100101') == 2

def test_check():
    check(find_length)

test_check()


Prompt:
from typing import List, Any

def split_two_parts(list1: List[Any], L: int) -> Any:
    """
	Write a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple.
	"""


Prompt:
def check_expression(exp: str) -> bool:
    """
	Write a function to check if the given expression is balanced or not. https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/
	"""

def check(candidate):
    assert candidate('{()}[{}]') == True
    assert candidate('{()}[{]') == False
    assert candidate('{()}[{}][]({})') == True

def test_check():
    check(check_expression)

test_check()

assert check_expression('{()}[{}]') == True


Prompt:
def test_three_equal(x: int, y: int, z: int) -> int:
    """
	Write a python function to count the number of equal numbers from three given integers.
	"""

def check(candidate):
    assert candidate(1, 1, 1) == 3
    assert candidate(-1, -2, -3) == 0
    assert candidate(1, 2, 2) == 2

def test_check():
    check(test_three_equal)

test_check()


Prompt:
def find_lucas(n: int) -> int:
    """
	Write a function to find the n'th lucas number.
	"""

def check(candidate):
    assert candidate(9) == 76
    assert candidate(4) == 7
    assert candidate(3) == 4

def test_check():
    check(find_lucas)

test_check()


Prompt:
def snake_to_camel(word: str) -> str:
    """
	Write a function to convert a snake case string to camel case string.
	"""

def check(candidate):
    assert candidate('python_program') == 'PythonProgram'
    assert candidate('python_language') == 'PythonLanguage'
    assert candidate('programming_language') == 'ProgrammingLanguage'

def test_check():
    check(snake_to_camel)

test_check()

assert snake_to_camel('python_program') == 'PythonProgram'


Prompt:
def reverse_words(s: str) -> str:
    """
	Write a function to reverse words seperated by spaces in a given string.
	"""

def check(candidate):
    assert candidate('python program') == 'program python'
    assert candidate('java language') == 'language java'
    assert candidate('indian man') == 'man indian'

def test_check():
    check(reverse_words)

test_check()

assert reverse_words('python program') == 'program python'


Prompt:
def is_upper(string: str) -> str:
    """
	Write a python function to convert a given string to uppercase.
	"""

def check(candidate):
    assert candidate('person') == 'PERSON'
    assert candidate('final') == 'FINAL'
    assert candidate('Valid') == 'VALID'

def test_check():
    check(is_upper)

test_check()


Prompt:
def digit_distance_nums(n1: int, n2: int) -> int:
    """
	Write a python function to find the sum of the per-digit difference between two integers.
	"""

def check(candidate):
    assert candidate(1, 2) == 1
    assert candidate(23, 56) == 6
    assert candidate(123, 256) == 7

def test_check():
    check(digit_distance_nums)

test_check()


Prompt:
from typing import List, Any

def find_lists(Input: List[Any]) -> int:
    """
	Write a function to find number of lists present in the given list.
	"""

def check(candidate):
    assert candidate([[1, 2, 3, 4], [5, 6, 7, 8]]) == 2
    assert candidate([[1, 2], [3, 4], [5, 6]]) == 3
    assert candidate([9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1

def test_check():
    check(find_lists)

test_check()


Prompt:
from typing import List

def average_tuple(nums: List[List[int]]) -> List[float]:
    """
	Write a function which takes a lists of lists and returns the average value for each sublist as a list.
	"""


Prompt:
from typing import List

def find_even_pair(A: List[int]) -> int:
    """
	Write a function that counts the number of pairs of integers in a list that xor to an even number.
	"""

def check(candidate):
    assert candidate([5, 4, 7, 2, 1]) == 4
    assert candidate([7, 2, 8, 1, 0, 5, 11]) == 9
    assert candidate([1, 2, 3]) == 1

def test_check():
    check(find_even_pair)

test_check()

assert find_even_pair([5, 4, 7, 2, 1]) == 4


Prompt:
def opposite_Signs(x: int, y: int) -> bool:
    """
	Write a python function to check whether the given two integers have opposite sign or not.
	"""

def check(candidate):
    assert candidate(1, -2) == True
    assert candidate(3, 2) == False
    assert candidate(-10, -10) == False
    assert candidate(-2, 2) == True

def test_check():
    check(opposite_Signs)

test_check()


Prompt:
from typing import List

def sort_sublists(list1: List[List[str]]) -> List[List[str]]:
    """
	Write a function to sort each sublist of strings in a given list of lists.
	"""

def check(candidate):
    assert candidate([['green', 'orange'], ['black', 'white'], ['white', 'black', 'orange']]) == [['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]
    assert candidate([['green', 'orange'], ['black'], ['green', 'orange'], ['white']]) == [['green', 'orange'], ['black'], ['green', 'orange'], ['white']]
    assert candidate([['a', 'b'], ['d', 'c'], ['g', 'h'], ['f', 'e']]) == [['a', 'b'], ['c', 'd'], ['g', 'h'], ['e', 'f']]

def test_check():
    check(sort_sublists)

test_check()

assert sort_sublists([['green', 'orange'], ['black', 'white'], ['white', 'black', 'orange']]) == [['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]


Prompt:
from typing import List

def combinations_colors(l: List[str], n: int) -> List[List[str]]:
    """
	Write a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a list for each combination.
	"""

def check(candidate):
    assert candidate(['Red', 'Green', 'Blue'], 1) == [['Red'], ['Green'], ['Blue']]
    assert candidate(['Red', 'Green', 'Blue'], 2) == [['Red', 'Red'], ['Red', 'Green'], ['Red', 'Blue'], ['Green', 'Green'], ['Green', 'Blue'], ['Blue', 'Blue']]
    assert candidate(['Red', 'Green', 'Blue'], 3) == [['Red', 'Red', 'Red'], ['Red', 'Red', 'Green'], ['Red', 'Red', 'Blue'], ['Red', 'Green', 'Green'], ['Red', 'Green', 'Blue'], ['Red', 'Blue', 'Blue'], ['Green', 'Green', 'Green'], ['Green', 'Green', 'Blue'], ['Green', 'Blue', 'Blue'], ['Blue', 'Blue', 'Blue']]

def test_check():
    check(combinations_colors)

test_check()

assert combinations_colors(['Red', 'Green', 'Blue'], 1) == [['Red'], ['Green'], ['Blue']]


Prompt:
def move_num(test_str: str) -> str:
    """
	Write a function to move all the numbers to the end of the given string.
	"""

def check(candidate):
    assert candidate('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'
    assert candidate('Avengers124Assemble') == 'AvengersAssemble124'
    assert candidate('Its11our12path13to14see15things16do17things') == 'Itsourpathtoseethingsdothings11121314151617'

def test_check():
    check(move_num)

test_check()

assert move_num('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'


Prompt:
from typing import List

def intersection_array(array_nums1: List[int], array_nums2: List[int]) -> List[int]:
    """
	Write a function to find the intersection of two arrays.
	"""


Prompt:
from typing import List

def count_X(tup: List[int], x: int) -> int:
    """
	Write a python function that takes in a tuple and an element and counts the occcurences of the element in the list.
	"""


Prompt:
from typing import List

def get_median(arr1: List[int], arr2: List[int], n: int) -> float:
    """
	Write a function to find the median of two sorted lists of same size.
	"""


Prompt:
def tetrahedral_number(n: int) -> int:
    """
	Write a function to find the nth tetrahedral number.
	"""

def check(candidate):
    assert candidate(5) == 35
    assert candidate(6) == 56
    assert candidate(7) == 84

def test_check():
    check(tetrahedral_number)

test_check()


Prompt:
from typing import List, Tuple

def find_combinations(test_list: List[Tuple[int, int]]) -> List[Tuple[int, int]]:
    """
	Write a function to find the combinations of sums with tuples in the given tuple list. https://www.geeksforgeeks.org/python-combinations-of-sum-with-tuples-in-tuple-list/
	"""


Prompt:
from typing import List

def find_first_occurrence(A: List[int], x: int) -> int:
    """
	Write a function to find the index of the first occurrence of a given number in a sorted array.
	"""

def check(candidate):
    assert candidate([2, 5, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 1
    assert candidate([2, 3, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 2
    assert candidate([2, 4, 1, 5, 6, 6, 8, 9, 9, 9], 6) == 4

def test_check():
    check(find_first_occurrence)

test_check()


Prompt:
def differ_At_One_Bit_Pos(a: int, b: int) -> bool:
    """
	Write a python function to check whether the two numbers differ at one bit position only or not.
	"""

def check(candidate):
    assert candidate(13, 9) == True
    assert candidate(15, 8) == False
    assert candidate(2, 4) == False
    assert candidate(2, 3) == True
    assert candidate(5, 1) == True
    assert candidate(1, 5) == True

def test_check():
    check(differ_At_One_Bit_Pos)

test_check()

assert differ_At_One_Bit_Pos(13, 9) == True


Prompt:
def check_monthnumber_number(monthnum3: int) -> bool:
    """
	Write a function to check whether the given month number contains 30 days or not. Months are given as number from 1 to 12.
	"""

def check(candidate):
    assert candidate(6) == True
    assert candidate(2) == False
    assert candidate(12) == False

def test_check():
    check(check_monthnumber_number)

test_check()

assert check_monthnumber_number(6) == True


Prompt:
from typing import List

def swap_List(newList: List[int]) -> List[int]:
    """
	Write a python function to interchange the first and last element in a given list.
	"""

def check(candidate):
    assert candidate([1, 2, 3]) == [3, 2, 1]
    assert candidate([1, 2, 3, 4, 4]) == [4, 2, 3, 4, 1]
    assert candidate([4, 5, 6]) == [6, 5, 4]

def test_check():
    check(swap_List)

test_check()


Prompt:
from typing import Any

def rearrange_bigger(n: int) -> Any:
    """
	Write a function to create the next bigger number by rearranging the digits of a given number.
	"""

def check(candidate):
    assert candidate(12) == 21
    assert candidate(10) == False
    assert candidate(102) == 120

def test_check():
    check(rearrange_bigger)

test_check()


Prompt:
def get_max_sum(n: int) -> int:
    """
	Write a function to find the maximum sum possible by using the given equation f(n) = max( (f(n/2) + f(n/3) + f(n/4) + f(n/5)), n).
	"""

def check(candidate):
    assert candidate(60) == 106
    assert candidate(10) == 12
    assert candidate(2) == 2

def test_check():
    check(get_max_sum)

test_check()


Prompt:
from typing import List

def mul_even_odd(list1: List[int]) -> int:
    """
	Write a function to find the product of first even and odd number of a given list.
	"""

def check(candidate):
    assert candidate([1, 3, 5, 7, 4, 1, 6, 8]) == 4
    assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2
    assert candidate([1, 5, 7, 9, 10]) == 10

def test_check():
    check(mul_even_odd)

test_check()


Prompt:
def odd_Equivalent(s: str, n: int) -> int:
    """
	Write a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.
	"""

def check(candidate):
    assert candidate('011001', 6) == 3
    assert candidate('11011', 5) == 4
    assert candidate('1010', 4) == 2

def test_check():
    check(odd_Equivalent)

test_check()


Prompt:
from typing import List

def Find_Min_Length(lst: List[List[int]]) -> int:
    """
	Write a python function to find the length of the smallest list in a list of lists.
	"""

def check(candidate):
    assert candidate([[1], [1, 2]]) == 1
    assert candidate([[1, 2], [1, 2, 3], [1, 2, 3, 4]]) == 2
    assert candidate([[3, 3, 3], [4, 4, 4, 4]]) == 3

def test_check():
    check(Find_Min_Length)

test_check()

assert Find_Min_Length([[1], [1, 2]]) == 1


Prompt:
from typing import Tuple

def bitwise_xor(test_tup1: Tuple[int, int, int, int], test_tup2: Tuple[int, int, int, int]) -> Tuple[int, int, int, int]:
    """
	Write a function to perform the mathematical bitwise xor operation across the given tuples.
	"""


Prompt:
def is_nonagonal(n: int) -> int:
    """
	Write a function to find the nth nonagonal number.
	"""

def check(candidate):
    assert candidate(10) == 325
    assert candidate(15) == 750
    assert candidate(18) == 1089

def test_check():
    check(is_nonagonal)

test_check()


Prompt:
def is_octagonal(n: int) -> int:
    """
	Write a function to find the nth octagonal number.
	"""

def check(candidate):
    assert candidate(5) == 65
    assert candidate(10) == 280
    assert candidate(15) == 645

def test_check():
    check(is_octagonal)

test_check()