from math import comb


def combination(n: int, r: int) -> int:
    y = 1
    x = 1
    for i in range(r):
        y *= n - i
        x *= i + 1
    return y // x


def permutation(n: int, r: int) -> int:
    x = 1
    for i in range(r):
        x *= n - i
    return x

print(combination(2, 1))
print(combination(8, 5))
print(permutation(7, 2))
print(permutation(10, 3))
