CSES - Balanced parenthesis

Your task is to count how many balanced parenthesis sequences of length nn have at most kk nested pairs of parenthesis.

You may assume that 2n162 \le n \le 16 and that 1kn/21 \le k \le n/2. The algorithm should be efficient in all these cases.

In a file brackets.py, implement a function count that returns the desired count.

def count(n, k):
    # TODO

if __name__ == "__main__":
    print(count(6, 1)) # 1
    print(count(6, 2)) # 4
    print(count(6, 3)) # 5
    print(count(9, 1)) # 0
    print(count(16, 4)) # 1094