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

dp = [ [ "" for i in range(3010)] for j in range(3010) ]

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

i = len(s)-1
j = len(t)-1
while (i>0 and j>0):

Fixed submission:
s = list(input())
t = list(input())

dp = [ [ 0 for i in range(3010)] for j in range(3010) ]

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

i = len(s)-1
j = len(t)-1
ans = ""

while (i>=0 and j>=0):
    if dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    elif dp[i+1][j+1] == dp[i][j+1]:
        i -= 1
    else:
        ans = s[i] + ans
        i -= 1
        j -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
t = list(input())

dp = [ [ "" for i in range(3010)] for j in range(3010) ]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            if len(dp[i+1][j+1]) <= len(dp[i][j])+1:
                dp[i+1][j+1] = dp[i][j] + s[i]
        else:
            if len(dp[i+1][j+1]) <= len(dp[i+1][j]):
                dp[i+1][j+1] = dp[i+1][j]
            if len(dp[i+1][j+1]) <= len(dp[i][j+1]):
                dp[i+1][j+1] = dp[i][j+1]

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

Fixed submission:
s = list(input())
t = list(input())

dp = [ [ 0 for i in range(3010)] for j in range(3010) ]

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

i = len(s)-1
j = len(t)-1
ans = ""

while (i>=0 and j>=0):
    if dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    elif dp[i+1][j+1] == dp[i][j+1]:
        i -= 1
    else:
        ans = s[i] + ans
        i -= 1
        j -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
t = list(input())

dp = [ [ "" for i in range(3010)] for j in range(3010) ]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            if len(dp[i+1][j+1]) <= len(dp[i][j])+1:
                dp[i+1][j+1] = dp[i][j] + s[i]
        else:
            if len(dp[i+1][j+1]) <= len(dp[i+1][j]):
                dp[i+1][j+1] = dp[i+1][j]
            if len(dp[i+1][j+1]) <= len(dp[i][j+1]):
                dp[i+1][j+1] = dp[i][j+1]

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

Fixed submission:
s = list(input())
t = list(input())

dp = [ [ 0 for i in range(3010)] for j in range(3010) ]

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

i = len(s)-1
j = len(t)-1
ans = ""

while (i>=0 and j>=0):
    if dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    elif dp[i+1][j+1] == dp[i][j+1]:
        i -= 1
    else:
        ans = s[i] + ans
        i -= 1
        j -= 1

print(ans)