Buggy python submission (verdict: Runtime Error):
def solveZ(X, Y, Z, x, y):
	if x < len(X) and y < len(Y):
		ans = [solveZ(X, Y, Z, x, y+1)]
		Z.append(Y[y])
		for j in range(x, len(X)):
			if Y[y] == X[j]:
				ans.append(solveZ(X, Y, Z, j+1, y+1))
		return max(ans)
	else:
		return len(Z)

q = int(input())
for i in range(q):
	X = input()
	Y = input()
	ans[i] = solveZ(X, Y, [], 0, 0)

for i in range(q):
	print(ans[i])

Fixed submission:
def solve_L():
    X = input()
    Y = input()
  
    a = len(X)
    b = len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
  
n = int(input())
ans = [[] for i in range(n)]
for i in range(n):
    ans[i] = solve_L()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
def solveZ(X, Y, Z, x, y):
	if x < len(X) and y < len(Y):
		ans = [solveZ(X, Y, Z, x, y+1)]
		for j in range(x, len(X)):
			if Y[y] == X[j]:
                                Z2 = Z + str(Y[y])
				ans.append(solveZ(X, Y, Z2, j+1, y+1))
                                break
                return max(ans)
	else:
                print(Z)
		return len(Z)

q = int(input())
ans = [[] for i in range(q)]
for i in range(q):
	X = str(input())
	Y = str(input())
	ans[i] = solveZ(X, Y, "", 0, 0)

for i in range(q):
	print(ans[i])

Fixed submission:
def solve_L():
    X = input()
    Y = input()
  
    a = len(X)
    b = len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
  
n = int(input())
ans = [[] for i in range(n)]
for i in range(n):
    ans[i] = solve_L()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
def solveZ(X, Y, Z, x, y):
	if x < len(X) and y < len(Y):
		ans = [solveZ(X, Y, Z, x, y+1)]
		for j in range(x, len(X)):
			if Y[y] == X[j]:
                                Z2 = Z + str(Y[y])
				ans.append(solveZ(X, Y, Z2, j+1, y+1))
                                break
                return max(ans)
	else:
                print(Z)
		return len(Z)

q = int(input())
ans = [[] for i in range(q)]
for i in range(q):
	X = str(raw_input())
	Y = str(raw_input())
	ans[i] = solveZ(X, Y, "", 0, 0)

for i in range(q):
	print(ans[i])

Fixed submission:
def solve_L():
    X = input()
    Y = input()
  
    a = len(X)
    b = len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
  
n = int(input())
ans = [[] for i in range(n)]
for i in range(n):
    ans[i] = solve_L()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
def solveZ(X, Y, Z, x, y):
	if x < len(X) and y < len(Y):
		ans = [solveZ(X, Y, Z, x, y+1)]
		for j in range(x, len(X)):
			if Y[y] == X[j]:
                                Z2 = Z + str(Y[y])
				ans.append(solveZ(X, Y, Z2, j+1, y+1))
                                break
                return max(ans)
	else:
                print(Z)
		return len(Z)

q = int(input())
ans = [[] for i in range(q)]
for i in range(q):
	X = raw_input()
	Y = raw_input()
	ans[i] = solveZ(str(X), str(Y), "", 0, 0)

for i in range(q):
	print(ans[i])

Fixed submission:
def solve_L():
    X = input()
    Y = input()
  
    a = len(X)
    b = len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
  
n = int(input())
ans = [[] for i in range(n)]
for i in range(n):
    ans[i] = solve_L()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
def solveZ(X, Y, Z, x, y):
  if x < len(X) and y < len(Y):
    ans = [solveZ(X, Y, Z, x, y+1)]
    for j in range(x, len(X)):
      if Y[y] == X[j]:
        Z2 = Z + str(Y[y])
        ans.append(solveZ(X, Y, Z2, j+1, y+1))
        break
    return max(ans)
  else:
    print(Z)
    return len(Z)

q = int(input())
ans = [[] for i in range(q)]
for i in range(q):
  X = str(input())
  Y = str(input())
  ans[i] = solveZ(X, Y, "", 0, 0)

for i in range(q):
  print(ans[i])

Fixed submission:
def solve_L():
    X = input()
    Y = input()
  
    a = len(X)
    b = len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
  
n = int(input())
ans = [[] for i in range(n)]
for i in range(n):
    ans[i] = solve_L()
for i in range(n):
  print(ans[i])