Как тестируются задачи

Вам нужно написать программу, которая содержит только требуемую функцию (можно несколько функций, если одна функция будет вызывать другую). Программа не должна содержать никакого кода вне функций.

В тестирующей системе после вашей программы будет добавлен следующий код, после чего решение будет проверено на тестах.

Задание A

print(average(list(map(float, input().split()))))

Задание B

print(median(int(input()), int(input()), int(input())))

Задание C

res = is_point_in_square(float(input()), float(input()))
if type(res) != bool:
    print("Функция должна возвращать значение типа bool")
elif res:
    print("YES")
else:
    print("NO")

Задание D

res = is_point_in_rhombus(float(input()), float(input()))
if type(res) != bool:
    print("Функция должна возвращать значение типа bool")
elif res:
    print("YES")
else:
    print("NO")

Задание E

res = is_point_in_circle(float(input()), float(input()), float(input()), float(input()), float(input()))
if type(res) != bool:
    print("Функция должна возвращать значение типа bool")
elif res:
    print("YES")
else:
    print("NO")

Задание F

res = is_point_in_area(float(input()), float(input()))
if type(res) != bool:
    print("Функция должна возвращать значение типа bool")
elif res:
    print("YES")
else:
    print("NO")

Задание G

res = reverse(int(input()))
if type(res) == int:
    print(res)
else:
    print("Функция должна возвращать значение типа int")

Задание H

res = next_palindrome(int(input()))
if type(res) == int:
    print(res)
else:
    print("Функция должна возвращать значение типа int")

Задание I

for __i in range(2, int(input())):
    d = min_divisor(__i)
    print(__i, d)

Задание J

for __i in range(2, int(input())):
    res = is_prime(__i)
    if type(res) != bool:
        print("Функция is_prime(" + str(__i) + ") вернула значение не типа bool")
    elif res:
        print(__i, "YES")
    else:
        print(__i, "NO")

Задание K

for __i in range(int(input()), int(input()) + 1):
    print(__i, factor(__i))

Задание L

__n = int(input())
res = product_of_digits(__n)
if type(res) != int:
    print("Функция должна возвращать значение типа int")
else:
    print(res)

Задание M

output = ""
for __x in [False, True]:
    for __y in [False, True]:
        res = xor(__x, __y)
        if type(res) != bool:
            print("Функция должна возвращать значение типа bool")
            sys.exit(0)
        output += "x = {0}, y = {1}, res = {2}\n".format(__x, __y, res)
print(output, end="")

Задание N

output = ""
for __x in [False, True]:
    for __y in [False, True]:
        res = imp(__x, __y)
        if type(res) != bool:
            print("Функция должна возвращать значение типа bool")
            sys.exit(0)
        output += "x = {0}, y = {1}, res = {2}\n".format(__x, __y, res)
print(output, end="")

Задание O

output = ""
for __x in [False, True]:
    for __y in [False, True]:
        for __z in [False, True]:
            res = major(__x, __y, __z)
            if type(res) != bool:
                print("Функция должна возвращать значение типа bool")
                sys.exit(0)
            output += "x = {0}, y = {1}, z = {2}, res = {3}\n".format(__x, __y, __z, res)
print(output, end="")

Задание P

__a = list(map(int, input().split()))
res = histogram(__a)
if res is not None:
    print("Функция НЕ должна возвращать значение")

Задание Q

__n = int(input())
res = triangle(__n)
if res is not None:
    print("Функция НЕ должна возвращать значение")

Задание R

__a, __b = map(int, input().split())
res = fir(__a, __b)
if res is not None:
    print("Функция НЕ должна возвращать значение")

Задание S

res = read_even()
if type(res) != list:
    print("Функция должна возвращать список")
    sys.exit(0)
for elem in res:
    if type(elem) != int:
        print("Все элементы списка должны иметь тип int")
        sys.exit(0)
print(res)

Задание T

__x = int(input())
res = read_greater(__x)
if type(res) != list:
    print("Функция должна возвращать список")
    sys.exit(0)
for elem in res:
    if type(elem) != int:
        print("Все элементы списка должны иметь тип int")
        sys.exit(0)
print(res)

Задание U

res = read()
if type(res) != list:
    print("Функция должна возвращать список")
    sys.exit(0)
for elem in res:
    if type(elem) != int:
        print("Все элементы списка должны иметь тип int")
        sys.exit(0)
print(res)
print("Несчитанный остаток входных данных:")
print(sys.stdin.read())

Задание V

res = read()
if type(res) != int:
    print("Функция должна возвращать значение типа int")
    sys.exit(0)
print(res)
print("Несчитанный остаток входных данных:")
print(sys.stdin.read())

Задание W

__k = int(input())
res = read(__k)
if type(res) != list:
    print("Функция должна возвращать список")
    sys.exit(0)
for elem in res:
    if type(elem) != int:
        print("Все элементы списка должны иметь тип int")
        sys.exit(0)
print(res)

Задание X

total_sum = 0
for line in sys.stdin:
    __a = list(map(int, line.split()))
    print(__a)
    res = sum_list(__a)
    if res is not None:
        print("Функция НЕ должна возвращать значение")
        sys.exit(0)
    print(total_sum)

Задание Y

max_digit_value = 0
for line in sys.stdin:
    __n = int(line)
    print(__n)
    res = max_digit(__n)
    if res is not None:
        print("Функция НЕ должна возвращать значение")
        sys.exit(0)
    print(max_digit_value)

Задание Z

__count = int(input())
for i in range(__count):
    res = read()
    if type(res) != bool:
        print("Функция должна возвращать значение типа bool")
        sys.exit(0)
    print(res)
    print(prev)