Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
li = deque()
n = int(input())

for i in range(n):
	command = input().split()
	if command[0] == 'insert':
		li.append(command[1])
	if command[0] == 'find':
		if command[1] in li:
			print('yes')
		else:
			print('no')

Fixed submission:
from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []

for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        l.append(cmd[1])
    if cmd[0] == 'find':
        sl = set(l)
        if len( sl & {cmd[1]} ) == 1:
            print('yes')
        else:
            print('no')

Fixed submission:
from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
l = deque()

for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        l.append(cmd[1])
    if cmd[0] == 'find':
        sl = set(l)
        if len( sl & {cmd[1]} ) == 1:
            print('yes')
        else:
            print('no')

Fixed submission:
from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
l = deque()

for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        l.append(cmd[1])
    if cmd[0] == 'find':
        if l.count(cmd[1]) == 0:
         print('no')
        else:
         print('yes')

Fixed submission:
from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
l = deque()

for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        l.append(cmd[1])
    if cmd[0] == 'find':
        if cmd[1] in set(l):
        	print('yes')
        else:
        	print('no')

Fixed submission:
from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')

Buggy python submission (verdict: Runtime Error):
13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T

Fixed submission:
from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')