I have a task to find number of expressions containing n parentheses which are correctly matched. So, I decided to use Catalan number. Here is a python code.
from decimal import Decimal
n = int(input())
res = Decimal(1)
k = n//2
for i in range(1, k+1):
res = Decimal(res*(n-k+i)/i)
res = int(res)
print(int(res//(k+1)))
After testing it in testing system, I have only 2 correct answers of 100. When: n = 2
(answer: 1) ans n = 4
(answer: 2). I can't look at other testing examples. Can you, please, help me? Where am I wrong?