Buggy python submission (verdict: Time Limit Exceeded):
#coding: UTF-8
#@document_it
def document_it(func):
  def new_function(*args,**kwargs):
    print('Running function:', func.__name__)
    print('Positional arguments:', args)
    print('Kewword arguments:', kwargs)
    result = func(*args,**kwargs)
    print('Result:', result)
    return result
  return new_function

#@document_it
def binsearch(v,list,length=None,offset=0):
    if list == []:
        return -1
    if length == None:
        length = len(list)
    w = length//2
    if v == list[w]:
        return w + offset
    elif v < list[w]:
        return binsearch(v,list[0:w],offset=offset)
    else:
        return binsearch(v,list[w+1:],offset=w+1+offset)

n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))
ans = 0

for t in T:
  if binsearch(t,S,n) != -1:
    ans += 1

print(ans)
    
    
  


Fixed submission:
#coding: UTF-8
#@document_it

def document_it(func):
  def new_function(*args,**kwargs):
    print('Running function:', func.__name__)
    print('Positional arguments:', args)
    print('Kewword arguments:', kwargs)
    result = func(*args,**kwargs)
    print('Result:', result)
    return result
  return new_function

#@document_it
def bsearch(v,list,l=None):
  if l == 0 or list == []:
    return False
  if l==None:
    l = len(list)
  
  import math
  T = math.ceil(math.log2(l))
  t = 0
  wid = l
  offset = 0
  while t <= T:
    if wid == 0:
        return False
    pos = wid//2 + offset
    w = list[pos]
    if wid == 1:
        if v == w:
            return True
        else:
            return False
    else:
        if v == w:
            return True
        elif v < w:
            wid = wid//2
        else:
            wid = wid//2 - 1 + wid%2
            offset = pos + 1
    t+=1



def exe():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = map(int,input().split())
    ans = 0

    for t in T:
        if bsearch(t,S,n):
            ans += 1

    print(ans)

if __name__ == '__main__':
    exe()

Buggy python submission (verdict: Runtime Error):
#coding: UTF-8
#@document_it
import numpy as np

def document_it(func):
  def new_function(*args,**kwargs):
    print('Running function:', func.__name__)
    print('Positional arguments:', args)
    print('Kewword arguments:', kwargs)
    result = func(*args,**kwargs)
    print('Result:', result)
    return result
  return new_function

#@document_it
def bsearch(v,list,l=None):
  if l == 0 or list == []:
    return False
  if l==None:
    l = len(list)
  
  import math
  T = math.ceil(math.log2(l))
  t = 0
  wid = l
  offset = 0
  while t <= T:
    if wid == 0:
        return False
    pos = wid//2 + offset
    w = list[pos]
    if wid == 1:
        if v == w:
            return True
        else:
            return False
    else:
        if v == w:
            return True
        elif v < w:
            wid = wid//2
        else:
            wid = wid//2 - 1 + wid%2
            offset = pos + 1
    t+=1



def exe():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = map(int,input().split())
    ans = 0

    for t in T:
        if bsearch(t,S,n):
            ans += 1

    print(ans)

if __name__ == '__main__':
    exe()
    
  


Fixed submission:
#coding: UTF-8
#@document_it

def document_it(func):
  def new_function(*args,**kwargs):
    print('Running function:', func.__name__)
    print('Positional arguments:', args)
    print('Kewword arguments:', kwargs)
    result = func(*args,**kwargs)
    print('Result:', result)
    return result
  return new_function

#@document_it
def bsearch(v,list,l=None):
  if l == 0 or list == []:
    return False
  if l==None:
    l = len(list)
  
  import math
  T = math.ceil(math.log2(l))
  t = 0
  wid = l
  offset = 0
  while t <= T:
    if wid == 0:
        return False
    pos = wid//2 + offset
    w = list[pos]
    if wid == 1:
        if v == w:
            return True
        else:
            return False
    else:
        if v == w:
            return True
        elif v < w:
            wid = wid//2
        else:
            wid = wid//2 - 1 + wid%2
            offset = pos + 1
    t+=1



def exe():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = map(int,input().split())
    ans = 0

    for t in T:
        if bsearch(t,S,n):
            ans += 1

    print(ans)

if __name__ == '__main__':
    exe()