
    Design an algorithm that analyzes student response patterns in adaptive assessments by determining how many possible ways a student can achieve equal performance scores between the first and second half of the test. Given a test with 2n questions where each question is marked as correct (1) or incorrect (0), count all possible response patterns where the number of correct answers in the first n questions equals the number of correct answers in the last n questions.
    

    
def count_binary_seq(n):
    """
    Design an algorithm that analyzes student response patterns in adaptive assessments by determining how many possible ways a student can achieve equal performance scores between the first and second half of the test. Given a test with 2n questions where each question is marked as correct (1) or incorrect (0), count all possible response patterns where the number of correct answers in the first n questions equals the number of correct answers in the last n questions.
    

    """
def count_binary_seq(n):
    """
    Design an algorithm that analyzes student response patterns in adaptive assessments by determining how many possible ways a student can achieve equal performance scores between the first and second half of the test. Given a test with 2n questions where each question is marked as correct (1) or incorrect (0), count all possible response patterns where the number of correct answers in the first n questions equals the number of correct answers in the last n questions.
    

    """
    nCr = 1
    res = 1
    for r in range(1, n + 1):
        nCr = nCr * (n + 1 - r) / r
        res += nCr * nCr
    return res