Buggy python submission (verdict: Runtime Error):
q = input()

X = map(int, raw_input().split))
Y = map(int, raw_input().split))

def edit_distance(s, t)
   dp = {}
   
   for i in range(0. len(s)):
      dp[i] = {0: i}
   for j in range(0, len(t)):
      dp[0][j] = j
   
   for i in range(1, len(s)):
      for j in range(1, len(t)):
          d = 0 if s[i-1] == j[i-1] else 1
          dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]+1, dp[i-1][j-1]+d)

   print dp[len(s)][len(t)]

edit_distance(X, Y)

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
q = input()
 
X = map(int, raw_input().split))
Y = map(int, raw_input().split))
 
def edit_distance(s, t)
   dp = {}
    
   for i in range(0. len(s)):
      dp[i] = {0: i}
   for j in range(0, len(t)):
      dp[0][j] = j
    
   for i in range(1, len(s)):
      for j in range(1, len(t)):
          d = 0 if s[i-1] == j[i-1] else 1
          dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]+1, dp[i-1][j-1]+d)
 
   print dp[len(s)][len(t)]

for k in range(0, q-1):
   edit_distance(X, Y)

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
q = input()
  
def edit_distance()
   X = raw_input()
   Y = raw_input()
     
   for i in range(0. len(X)):
      s[i] = i
     
   for i in range(1, len(X)):
      t = s + []
      for j in range(1, len(Y)):
         if s[i-1] == j[i-1]:
            s[j+1] = t[j] + 1
         elif [j+1] < s[j]:
            s[j+1] = t[j]
  
   return s[-1]
 
for k in range(0, q-1):
   edit_distance()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
q = input()
   
def common()
   X = raw_input()
   Y = raw_input()
      
   for i in range(0. len(X)):
      s[i] = 0
      
   for i in range(1, len(X)):
      t = s + []
      for j in range(1, len(Y)):
         if s[i-1] == j[i-1]:
            s[j+1] = t[j] + 1
         elif [j+1] < s[j]:
            s[j+1] = t[j]
   
   return s[-1]
  
for k in range(0, q-1):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
q = input()
    
def common()
   X = raw_input()
   Y = raw_input()
       
   for i in range(0. len(X)+1):
      s[i] = 0
       
   for i in range(1, len(X)):
      t = s + []
      for j in range(1, len(Y)):
         if s[i-1] == j[i-1]:
            s[j+1] = t[j] + 1
         elif s[j+1] < s[j]:
            s[j+1] = s[j]
    
   return s[-1]
   
for k in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
q = input()
     
def common()
   X = raw_input()
   Y = raw_input()
        
   for i in range(0. len(X)+1):
      s[i] = 0
        
   for i in range(0, len(X)):
      t = s + []
      for j in range(1, len(Y)):
         if s[i] == j[i]:
            s[j+1] = t[j] + 1
         elif s[j+1] < s[j]:
            s[j+1] = s[j]
     
   return s[-1]
    
for k in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
   X = raw_input()
   Y = raw_input()
         
   for i in range(0. len(X)+1):
      s[i] = 0
         
   for i in range(0, len(X)):
      t = s + []
      for j in range(1, len(Y)):
         if s[i] == j[i]:
            s[j+1] = t[j] + 1
         elif s[j+1] < s[j]:
            s[j+1] = s[j]
      
   return s[-1]

q = input()     
for k in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
   X = raw_input()
   Y = raw_input()
          
   for i in range(0. len(X)+1):
      s[i] = 0
          
   for i in range(0, len(X)):
      t = s + []
      for j in range(0, len(Y)):
         if s[i] == j[i]:
            s[j+1] = t[j] + 1
         elif s[j+1] < s[j]:
            s[j+1] = s[j]
       
   return s[-1]
 
q = input()     
for k in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
   X = raw_input()
   Y = raw_input()
           
   for i in range(0. len(X)+1):
      s[i] = 0
           
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if s[j] == j[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
        
   return s[-1]
  
q = input()     
for l in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
   X = raw_input()
   Y = raw_input()
            
   for i in range(0. len(Y)+1):
      s[i] = 0
            
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if s[j] == j[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
         
   return s[-1]
   
q = input()     
for l in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
   X = raw_input()
   Y = raw_input()
             
   for i in range(0, len(Y)+1):
      s[i] = 0
             
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if s[j] == j[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
          
   return s[-1]
    
q = input()     
for l in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
??????X = raw_input()
??????Y = raw_input()
????????????????????????????
??????for i in range(0, len(Y)+1):
????????????s[i] = 0
????????????????????????????
??????for j in range(0, len(X)):
????????????t = s + []
????????????for k in range(0, len(Y)):
??????????????????if X[j] == Y[k]:
????????????????????????s[k+1] = t[k] + 1
??????????????????elif s[k+1] < s[k]:
????????????????????????s[k+1] = s[k]
??????????????????????
??????return s[-1]
??????????
q = input()???????? 
for l in range(0, q):
??????common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()

Buggy python submission (verdict: Runtime Error):
def common():
   X = raw_input()
   Y = raw_input()

   for i in range(0, len(Y)+1):
      s[i] = 0

   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]

   return s[-1]
??????????
q = input()???????? 
for l in range(0, q):
   common()

Fixed submission:
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   print s[-1]
 
q = input()
for l in range(0, q):
   common()