# Assuming that all the elements of set are different
def fact(n):
result = 1
for i in range(1, n + 1):
result *= i
return result
def perm(n, r):
result = 1
for i in range(r):
result *= n
n -= 1
return result
def comb(n, r):
return perm(n, r) // fact(r)
set_width = int(input("Type set width: "))
subset_width = int(input("Type subset width: "))
if set_width < subset_width:
print(f"Subset width cannot be greater than set width!")
else:
operation = input("Type C for Combination or P for Permutation: ")
if operation.lower() == "c":
print(comb(set_width, subset_width))
elif operation.lower() == "p":
print(perm(set_width, subset_width))