Help me in solving SUNDAY problem

My issue

My code

# cook your dish here
T = int(input())

for i in range(T):
    N = int(input())
for j in range(N):
    A = list(input().split(" "))
    B = [6,13,20,27,7,14,21,28]
    
    if A in B:
        C = A+B
        D = list(set(C))
        print(len(D))
    else:
        
        print(len(A)+len(B))
       

Problem Link: SUNDAY Problem - CodeChef

The solution from my side is

t = int(input())

for i in range(t):
    n = int(input())
    fest = list(map(int,input().split()))
    holidays = [6,7,13,14,20,21,27,28]
    for i in range(len(fest)):
        holidays.append(fest[i])
    holidays = set(holidays)
    print(len(holidays))

Explanation for the code.

The logic is quite simple here. Since we have been given a month, we can store all the days when the holiday occurs. In the given question, these dates are 6,7,13,14,20,21,27,28 exacte as you have done). You can store it in a set or array.

After that, it’s said we have N holidays which may/may not occur on Saturday or Sunday. So from this statement, you have to be on the lookout for days not in your holiday set/array.

In the end, you just have to report the size of the set or array.

Your answer seems okay to me in the first half, but I lost you at

C = A + B

Also, I am not a Python kinda guy, but your indentation seems wrong in the code you have posted here.