Buggy python submission (verdict: Time Limit Exceeded):
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])

Fixed submission:
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
a = list(input())

b = list(input())

aa = len(a)

bb = len(b)

dp = [[]*(m+1) for i in range(n+1)]

for i in range(n):
	for j in range(m):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[n-1] == b[m-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[a-1][b]:
		aa -= 1
	else:
		bb -= 1
print(ans[::-1])

Fixed submission:
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())

k = max(len(a),len(b))

dp = [[0]*(len(b)+1) for i in range(len(a)+1)]

for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

ans = ''
def rec(m,n):
	if m == 0 or n == 0:
		return ans
	if a[m-1] == b[n-1]:
		global ans
		ans += a[m-1]
		rec(m-1,n-1)
	elif dp[m-1][n] > dp[m][n-1]:
		rec(m-1,n)
	else:
		rec(m,n-1) 

rec(len(a),len(b))
print(ans[::-1])

Fixed submission:
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())

k = max(len(a),len(b))

dp = [[0]*(len(b)+1) for i in range(len(a)+1)]

for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

ans = ""

def rec(m,n):
	if m == 0 and n == 0:
		return ans
	if a[m-1] == b[n-1]:
		global ans
		ans += a[m-1]
		rec(m-1,n-1)
	elif dp[m-1][n] > dp[m][n-1]:
		rec(m-1,n)
	else:
		rec(m,n-1) 

rec(len(a),len(b))
print(ans[::-1])

Fixed submission:
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
a = list(map(input()))
b = list(map(input()))

k = max(len(a),len(b))

dp = [['']*(len(b)+1) for i in range(len(a))]

for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

global ans = ""

def rec(m,n):
	if m == 0 and n == 0:
		return ans
	if a[m-1] == b[n-1]:
		ans += a[m]
		rec(m-1.n-1)
	elif dp[m-1][n] > dp[m][n-1]:
		rec(m-1,n)
	else:
		rec(m,n-1) 

rec(len(a),len(b))
print(ans)

Fixed submission:
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])