ํ์ด
๋ฉ๋ชจ๋ฆฌ์ ํ์ด ๊ฑธ๋ ค์๋ ๋ฌธ์ ๋ผ ๋นํธ๋ง์คํน์ด๋ผ๋ ์๋ก์ด ๊ฐ๋ ์ ๋ฐฐ์ ์ ์ฉํ๋ค.
Pypy3 ๋ก ์ ์ถํ์ ๊ฒฝ์ฐ ๋ฉ๋ชจ๋ฆฌ์ด๊ณผ๊ฐ ๋ ์ Python3 ๋ก ์ ์ถํ๋๋ ๋ฌด๋ฆฌ์์ด ํต๊ณผํ๋ค.
์์ค์ฝ๋
import sys
input = sys.stdin.readline
M = int(input())
S = 0
for _ in range(M):
inp = input()
command = inp.split()[0]
if command == "add":
S |= (1 << int(inp.split()[1]))
elif command == "remove":
S &= ~(1 << int(inp.split()[1]))
elif command == "remove":
S &= ~(1 << int(inp.split()[1]))
elif command == "check":
if S & (1 << int(inp.split()[1])):
print(1)
else:
print(0)
elif command == "toggle":
S ^= (1 << int(inp.split()[1]))
elif command == "all":
S = (1 << 21) - 1
elif command == "empty":
S = 0