Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [input()]
 
for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1
    l = 0
 
    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = min(l+1,len(L)-1)
        else:
            imax = max(l-1,0)
    
    if(imax==imin)       
    	if (a>L[imin]):
        	L.insert(imin+1,a)
    	elif (a<L[imin]):
        	L.insert(imin,a)
            
print(len(L))
N = int(input())
L = [input()]

for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1
    l = 0

    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = min(l+1,len(L)-1)
        else:
            imax = max(l-1,0)
    
    if(imax==imin):     
    	if (a>L[imin]):
        	L.insert(imin+1,a)
    	elif (a<L[imin]):
        	L.insert(imin,a)
            
print(len(L))

Fixed submission:
N = int(input())
L = set([input() for _ in range(N)])
print(len(L))

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [input()]

for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1
    l = 0

    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = min(l+1,len(L)-1)
        else:
            imax = max(l-1,0)
    
    if(imax==imin)       
    	if (a>L[imin]):
        	L.insert(imin+1,a)
    	elif (a<L[imin]):
        	L.insert(imin,a)
            
print(len(L))

Fixed submission:
N = int(input())
L = set([input() for _ in range(N)])
print(len(L))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [input()]

for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1
    l = 0

    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = min(l+1,len(L)-1)
        else:
            imax = max(l-1,0)    
    l = (imin+imax)//2       
    if (a>L[l]):
        L.insert(l+1,a)
    elif (a<L[l]):
        L.insert(l,a)
            
print(len(L))

Fixed submission:
N = int(input())
L = set([input() for _ in range(N)])
print(len(L))

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [input()]

for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1
    l = 0

    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = min(l+1,len(L)-1)
        else:
            imax = max(l-1,0)
        print(imin,imax,L)
    
    l = (imin+imax)//2       
    if (a>L[l]):
        L.insert(l+1,a)
    elif (a<L[l]):
        L.insert(l,a)
            
print(len(L))


Fixed submission:
N = int(input())
L = set([input() for _ in range(N)])
print(len(L))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [input()]

for _ in range(N-1):
    a = input()
    imin = 0
    imax = len(L)-1

    while (imin<imax):
        l = (imin+imax)//2
        if (a==L[l]):
            break
        elif (a>L[l]):
            imin = l
        else:
            imax = l
    
    if (a>L[imin]):
        L.insert(imin+1,a)
    elif (a<L[imin]):
        L.insert(imin,a)
            
print(len(L))

Fixed submission:
N = int(input())
L = set([input() for _ in range(N)])
print(len(L))