Closing the Tweets - TWTCLOSE (PYTHON)

Can someone please help me understand as to why I’m getting Wrong Answer for the following solution?

n, k = map(int, input().split())
com = []
k1 = k
while(k1):
    k1 -= 1
    com.append(input())
tweets = []
for i in range(0, n):
    tweets.append(False)
#print(tweets)
for i in range(0, k):
    if(com[i] == "CLOSEALL"):
        for j in range(0, n):
            tweets[j] = False
    else:
        temp = com[i]
        tweets[int(temp[-1])-1] = not tweets[int(temp[-1])-1]
    #print(tweets)
    count = 0
    for i in range(0, n):
        if(tweets[i]):
            count += 1
        #print(tweets[i])
    print(count)