Buggy python submission (verdict: Time Limit Exceeded):
n = input()
S = input().split()
q = input()
T = input().split()
cnt = 0

for i in range(len(T)):
    if T[i] in S:
        cnt += 1

print(cnt)

Fixed submission:
n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = input()
S = input().split()
q = input()
T = input().split()

print(len(S&T)

Fixed submission:
n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = input()
S = input().split()
q = input()
T = input().split()

print(len(S&T))

Fixed submission:
n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = input()
S = input().split()
q = input()
T = input().split()

print(len(S&T))

Fixed submission:
n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = input()
S = set(input().split())
q = input()
T = set(input().split())

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(T):
    left = 0
    right = n-1
    while left < right:
        mid = (left+right) // 2
        if S[mid] == i:
            cnt += 1
            break
        elif S[mid] < i:
            left = mid+1
        else:
            right = mid-1
print(cnt)

Fixed submission:
n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = input()
S = (input().split())
q = input()
T = (input().split())

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(T):
    left = 0
    right = n-1
    while left < right:
        mid = (left+right) // 2
        if S[mid] == i:
            cnt += 1
            break
        elif S[mid] < i:
            left = mid+1
        else:
            right = mid-1
print(cnt)

Fixed submission:
n = int(input())
S = input().split()
q = int(input())
T = input().split()

#print(len(S&T))
#set:???????????????????????????

cnt = 0

for i in range(len(T)):
    left = 0
    right = n
    while left < right:
        mid = (left+right) // 2
        if int(S[mid]) == int(T[i]):
            cnt += 1
            break
        elif int(S[mid]) < int(T[i]):
            left = mid+1
        else:
            right = mid
print(cnt)