Problem:
Set: Delete For a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique .  insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.  find($x$): Report the number of $x$ in $S$ (0 or 1).  delete($x$): Delete $x$ from $S$.  Input The input is given in the following format. $q$
$query_1$
$query_2$
:
$query_q$ Each query $query_i$ is given by 0 $x$ or 1 $x$ or 2 $x$ where the first digits 0 , 1 and 2 represent insert, find and delete operations respectively. Output For each insert operation, print the number of elements in $S$. For each find operation, print the number of specified elements in $S$. Constraints  $1 \leq q \leq 200,000$  $0 \leq x \leq 1,000,000,000$  Sample Input 1 8
0 1
0 2
0 3
2 2
1 1
1 2
1 3
0 2 Sample Output 1 1
2
3
1
0
1
3

Solution (Python):
numset = set([])
q = int(input())
for i in range(q):
    query, x = list(map(int, input().split(' ')))
    if query == 0:
        numset.add(x)
        print(len(numset))
    elif query == 1:
        if set([x]).issubset(numset):
            print(1)
        else:
            print(0)
    else:
        if set([x]).issubset(numset):
            numset.remove(x)

Solution (Python):



tbl = set()
q = int(input())
for i in range(q):
	a = input().split()
	x = int(a[1])
	if a[0] == '0':
		tbl.add(x)
		print(len(tbl))
	elif a[0] == '1': print(1 if x in tbl else 0)
	else:
		if x in tbl: tbl.remove(x)

Solution (Python):


Q = int(input())

S = set()

for i in range(Q):
    qtype, number = map(int, input().split())
    if qtype == 0:
        S.add(number)
        print(len(S))
    elif qtype == 1:
        if number in S:
            print(1)
        else:
            print(0)
    elif qtype == 2:
        try:
            S.remove(number)
        except KeyError:
            pass

Solution (Python):

import math


class LinearProbingIntSet:
    def __init__(self):
        self.count = 0
        self.size = 1
        self.keys = [None] * self.size

    def add(self, key):
        i = self._hash(key)
        for j in range(self.size):
            k = (i + j) % self.size
            if self.keys[k] is None:
                self.keys[k] = key
                self.count += 1
                break
            elif self.keys[k] == key:
                break
        else:
            raise RuntimeError('set is full')

        if self.count > self.size // 2:
            size = int(2 ** (math.log2(self.size+1)+1)) - 1
            self._resize(size)

    def delete(self, key):
        i = self._hash(key)
        while self.keys[i] is not None and self.keys[i] != key:
            i = (i + 1) % self.size

        if self.keys[i] != key:
            return
        self.keys[i] = None
        self.count -= 1

        i = (i + 1) % self.size
        while self.keys[i] is not None:
            key = self.keys[i]
            if i != self._hash(key):
                self.keys[i] = None
                self.count -= 1
                self.add(key)
            i = (i + 1) % self.size

        if self.count <= self.size // 4:
            size = max(1, int(2 ** (math.log2(self.size+1)-1)) - 1)
            self._resize(size)

    def __contains__(self, key):
        i = self._hash(key)
        for j in range(self.size):
            k = (i + j) % self.size
            if self.keys[k] is None:
                return False
            elif self.keys[k] == key:
                return True
        raise RuntimeError('set is full')

    def _hash(self, key):
        return (key * 13) % self.size

    def _resize(self, size):
        old_keys = self.keys
        self.count = 0
        self.size = size
        self.keys = [None] * self.size

        for key in old_keys:
            if key is None:
                continue
            self.add(key)


def run():
    q = int(input())
    s = LinearProbingIntSet()

    for _ in range(q):
        command, value = [int(x) for x in input().split()]
        if command == 0:
            s.add(value)
            print(s.count)
        elif command == 1:
            if value in s:
                print(1)
            else:
                print(0)
        elif command == 2:
            s.delete(value)
        else:
            raise ValueError('invalid command')


if __name__ == '__main__':
    run()

Solution (Python):
n=int(input())
s=set()
for i in range(n):
    a,b=map(int,input().split())
    if a==0:
        s.add(b)
        print(len(s))
    elif a==1:
        if b in s:
            print(1)
        else:
            print(0)
    else:
        if b in s:
            s.remove(b)

Solution (Python):
import sys
input = sys.stdin.buffer.readline
from random import randrange


q = int(input())
queries = [list(map(int, input().split())) for i in range(q)]

set_ = set()

for category, x in queries:
    if category == 0:
        set_.add(x)
        print(len(set_))
    elif category == 1:
        print(int(x in set_))
    else:
        if x in set_:
            set_.remove(x)

Solution (Python):









import os
import sys




def main():
    q = int(input())
    S = set()
    for _ in range(q):
        command = input().split()
        if command[0] == '0':
            S.add(int(command[1]))
            print(len(S))
        elif command[0] == '1':
            if int(command[1]) in S:
                print(1)
            else:
                print(0)
        else:
            S.discard(int(command[1]))


if __name__ == "__main__":
    main()

Solution (Python):
readline = open(0).readline
writeline = open(1, 'w').writelines

s = set()


def insert(x):
    s.add(x)
    ans.append("%d\n" % len(s))


def find(x):
    ans.append("%d\n" % (x in s))


C = [insert, find, s.discard].__getitem__
Q = int(readline())
ans = []

for _ in range(Q):
    t, x = map(int, readline().split())
    C(t)(x)

writeline(ans)

Solution (Python):
def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input())
    ans = set()
    for _ in range(n):
        q, x = [int(i) for i in input().split()]
        if q == 0:
            ans.add(x)
            print(len(ans))
        elif q == 1:
            if x in ans:
                print(1)
            else:
                print(0)
        else:
            if x in ans:
                ans.remove(x)


resolve()

Solution (Python):
S = set()
q = int(input())
for i in range(q):
    c, x = map(int, input().split())
    if c == 0:
        S.add(x)
        print(len(S))
    elif c == 1:
        print(int(x in S))
    else:
        S.discard(x)

Solution (Python):

s = set()
for _ in range(int(input())):
    a,b = map(int,input().split())
    try:
        
        if a == 0:
            s.add(b)
            print(len(s))
            
        
        elif a == 1:print(1 if b in s else 0)
        
        
        elif a == 2:s.remove(b)
    except KeyError:
        pass

Solution (Python):
S = set()

for i in range(int(input())):
    order,value = map(int,input().split())

    if order == 0:
        S.add(value)
        print(len(S))
    elif order == 1:
        print(1 if value in S else 0)
    else:
        S.discard(value)

Solution (Python):
q = int(input())
se = set()
while q:
    q -= 1
    op, x = map(int, input().split())
    if op == 1:
        print(+(x in se))
    elif op == 0:
        se.add(x)
        print(len(se))
    else:
        se.discard(x)

Solution (Python):
S = set()
q = int(input())
for i in range(q):
    a = input().split()
    if a[0] == "0":
        S.add(int(a[1]))
        print(len(S))
    elif a[0] == "1":
        print(1 if int(a[1]) in S else 0)
    else:
        if int(a[1]) in S:
            S.remove(int(a[1]))

Solution (Python):
q = int(input())
s = set()
for i in range(q):
    x, y = map(int, input().split())
    if x == 0:
        s.add(y)
        print(len(s))
    elif x == 1:
        print(1) if y in s else print(0)
    else:
        s.discard(y)

Solution (Python):
def main():
    m = int(input())
    s = set()
    for _ in range(m):
        a,b = map(int,input().split())
        if a == 0:
            s.add(b)
            print (len(s))
        elif a == 1:
            if b in s:print (1)
            else     :print (0)
        elif b in s:s.remove(b)


if __name__ == '__main__':
    main()

Solution (Python):
q = int(input())
S = set([])

for i in range(q):
    query, x = list(map(int, input().split()))

    
    if query == 0:
        S.add(x)
        print(len(S))

    
    elif query == 1:
        if x in S:
            print(1)
        else:
            print(0)

    
    else:
        if x in S:
            S.remove(x)

Solution (Python):
s = set()
for _ in range(int(input())):
	q,x = map(int, input().split())
	if q==0:
		s.add(x)
		print(len(s))
	elif q==2:
		s.discard(x)
	else:
		print("1" if x in s else "0")

Solution (Python):
def main():
    q = int(input())
    s = set()

    for _ in range(q):
        op, x = map(int, input().split())

        if op == 0:
            s.add(x)
            print(len(s))
        elif op == 1:
            if x in s:
                print("1")
            else:
                print("0")
        elif op == 2:
            s.discard(x)
main()

Solution (Python):
S=set()

q=int(input())

for _ in range(q):
    query=[int(i) for i in input().split(" ")]
    if query[0]==0:
        S.add(query[1])
        print(len(S))
    elif query[0]==1:
        if query[1] in S:
            print(1)
        else:
            print(0)
    else:
        if query[1] in S:
            S.remove(query[1])

Solution (Python):
import sys

s = set()
input()

for q in sys.stdin:
    q = q.split()
    if q[0] == '0':
        s.add(q[1])
        print(len(s))
    elif q[0] == '1':
        print(int(q[1] in s))
    else:
        s.discard(q[1])

Solution (Python):
S=set()
n=int(input())
for i in range(n):
    q,x=map(int,input().split())
    if q==0:
        if x in S:
            print(len(S))
        else:
            S.add(x)
            print(len(S))
    elif q==1:
        x={x}
        if S>=x:
            print(1)
        else:
            print(0)
    else:
            S.discard(x)

Solution (Python):
n = int(input())

s = set()
for _ in range(n):
    c, k = [int(x) for x in input().split()]
    if c == 0:
        s.add(k)
        print(len(s))
        continue
    if c == 1:
        if k in s:
            print(1)
        else:
            print(0)
        continue
    if c==2:
        s.discard(k)

Solution (Python):
q = int(input( ))
st = set()
for i in range(q):
    cmmd,tx = map(int, input().split( ))
    if cmmd == 0:
        st.add(tx) 
        print(len(st)) 
    elif cmmd == 1 :
        if tx in st:
            print(1)
        else:
            print(0)
    else:
        if tx in st:
            st.remove(tx)

Solution (Python):
from typing import Set


if __name__ == "__main__":
    int_set: Set[int] = set()
    num_query = int(input())

    for _ in range(num_query):
        op, v = map(lambda x: int(x), input().split())
        if (0 == op):
            int_set.add(v)
            print(len(int_set))
        elif (1 == op):
            if (v in int_set):
                print(1)
            else:
                print(0)
        else:
            if (v in int_set):
                int_set.remove(v)

Solution (Python):
tbl = set()
q = int(input())
for i in range(q):
	a = input().split()
	x = int(a[1])
	if a[0] == '0':
		tbl.add(x)
		print(len(tbl))
	elif a[0] == '1': print(1 if x in tbl else 0)
	else:
		if x in tbl: tbl.remove(x)

Solution (Python):

"""
Set - Set: Delete
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_7_B&lang=jp

"""
s = set()
for _ in range(int(input())):
    q, x = input().split()
    if q == '0':
        s.add(x)
        print(len(s))
    elif q == '1':
        print(int(x in s))
    else:
        s.discard(x)

Solution (Python):
readline = open(0).readline
writelines = open(1, 'w').writelines
s = set()
def insert(x):
    s.add(x)
    ans.append("%d\n" % len(s))
def find(x):
    ans.append("%d\n" % (x in s))
 
C = [insert, find, s.discard].__getitem__
Q = int(readline())
ans = []
for _ in range(Q):
    t, x = map(int, readline().split())
    C(t)(x)
writelines(ans)

Solution (Python):
if __name__ == '__main__':

	n = int(input())
	S = set()

	for _ in range(n):
		x,y = map(int,input().split())
		if x == 0:
			S.add(y)
			print(len(S))
		elif x == 1:
			if y in S:
				print("1")
			else:
				print("0")
		else:
			S.discard(y)

Solution (Python):
S = set()

q = int(input())


for _ in range(q):
    
    command, *list_num = input().split()
    x = int(list_num[0])

    if   command == "0":
        
        S.add(x)
        print(len(S))
    elif command == "1":
        
        if x in S:
            print(1)
        else:
            print(0)
    elif command == "2":
        if x in S:
            S.remove(x)
    else:
        raise

Solution (Python):
n = int(input())
s = set()
for _ in range(n):
    a, b = map(int,input().split())
    if a == 0:
        s.add(b)
        print(len(s))
    elif a == 1:
        if b in s:
            print(1)
        else:
            print(0)
    else:
        if b in s:
            s.remove(b)

Solution (Python):
t = set()
q = int(input())

for i in range(q):
    a = input().split()
    x = int(a[1])
    if a[0] == '0':
        t.add(x)
        print(len(t))
    elif a[0] == '1': print(1 if x in t else 0)
    else:
        if x in t: t.remove(x)

Solution (Python):
import bisect

S=[]

def insert(S,count,x):
    y=bisect.bisect_left(S,x)
    if y>=count or S[y]!=x:
        S.insert(y,x)
        count+=1
    print(count)
    return S,count

def find(S,x):
    y=bisect.bisect_left(S,x)
    if y<count and S[y]==x:
        judge=1
    else:
        judge=0
    return judge,y

q=int(input())
count=0
for i in range(q):
    query=list(map(int,input().split()))
    
    if query[0]==0:
        S,count=insert(S,count,query[1])
    elif query[0]==1:
        print(find(S,query[1])[0])
    else:
        if find(S,query[1])[0]==1:
            S.pop(find(S,query[1])[1])
            count-=1

Solution (Python):




import sys
input = sys.stdin.readline
import collections

def main():
    tl = {}
    for i in range(int(input())):
        l = list(map(int,input().split()))

        
        cmd = l[0]
        if cmd == 0:
            tl[l[1]] = 1
            print (len(tl))
        
        elif cmd == 1:
            c = 1 if l[1] in tl else 0
            print (c)
        
        elif cmd == 2:
            d = l[1]
            try:
                tl.pop(d)
            except KeyError:
                None
if __name__ == '__main__':
    main()

Solution (Python):
import sys
nq = int(input())
lines = sys.stdin.readlines()
ans = [None] * nq
s = {}
for i in range(nq):
    q, x = lines[i].split()
    if q == '0':    
        s[x] = ''
        ans[i] = str(len(s))
    elif q == '1':   
        ans[i] = str(int(x in s))
    else:           
        if x in s:
            del s[x]

[print(x) for x in ans if x]

Solution (Python):
q = int(input())

num = set()
for _ in range(q):
    query, x = map(int, input().split())
    if query == 0:
        num.add(x)
        print(len(num))
    elif query == 1:
        if x in num:
            print(1)
        else:
            print(0)
    else:
        if x in num:
            num.remove(x)

Solution (Python):
readline = open(0).readline
writelines = open(1, 'w').writelines
s = set()
def insert(x):
    s.add(x)
    ans.append("%d\n" % len(s))
def find(x):
    ans.append("%d\n" % (x in s))

C = [insert, find, s.discard].__getitem__
Q = int(readline())
ans = []
for _ in range(Q):
    t, x = map(int, readline().split())
    C(t)(x)
writelines(ans)

Solution (Python):
S = set()
for _ in [0]*int(input()):
    q, x = input().split()
    if q == "0": S.add(x); print(len(S))
    elif q == "1": print(1 if x in S else 0)
    elif x in S: S.remove(x)

Solution (Python):
n = int(input())
S = set()
for i in range(n):
    query, x = map(int, input().split())
    if query == 0:
        S.add(x)
        print(len(S))
    elif query == 1:
        print(1 if x in S else 0)
    else:
        S.discard(x)

Solution (Python):
s=set()
for i in range(int(input())):
    a,b=map(int,input().split(" "))
    if a==1:
        print(1*(b in s))
    elif a==0:
        s.add(b)
        print(len(s))
    elif a==2:
        s.discard(b)

Solution (Python):
n = int(input())
s = set()
for i in range(n):
  q = list(map(int, input().split()))
  if q[0]==0:
    s.add(q[1])
    print(len(s))
  elif q[0]==1:
    if q[1] in s:
      print(1)
    else:
      print(0)
  else:
    if q[1] in s:
      s.remove(q[1])