CSES - Efficiency of a formula

The number of balanced parenthesis sequences can also be counted with the formula

1n/2+1(nn/2).\frac{1}{n/2+1}{n \choose n/2}.

Here (ab){a \choose b} is a binomial coefficient that can be computed with the formula

a!b!(ab)!.\frac{a!}{b!(a-b)!}.

Based on these formulas, implement a function count_sequences and verify that the function returns the correct answer for n=100n=100. In addition, compare the efficiency of this function and the dynamic programming function in the course material for different values of nn.

In this task, you get a point automatically when you fill in your implementation of the function and the results of the comparison, and press the submit button.

Function implementation:

Efficiency comparison: