My issue
Please help me to solve this question.
My program is successfully executed but some test cases are failing.
Please anyone help me to resolve this problem…!
My code
def replace(a):
if a == 1: return 0
else: return 1
n,x = map(int,input().split())
tweets = []
for j in range(1,n+1):
tweets.append(0)
for i in range(1,x+1):
s = input()
if s == 'CLOSEALL' or s == 'closeall':
for j in range(len(tweets)):
tweets[j] = 0
else:
if int(s[6]) in range(1,n+1):
tweets[int(s[6])-1] = replace(tweets[int(s[6])-1])
print(tweets.count(1))
Problem Link: TWTCLOSE Problem - CodeChef