Buggy python submission (verdict: Time Limit Exceeded):
import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

s_len = len(s) - 1
t_len = len(t) - 1
dp = [[[0, ''] for x in range(t_len)] for y in range(s_len)]

for i in range(t_len):
    if s[0] == t[i]:
        dp[0][i][1] = s[0]
        dp[0][i][0] = 1
    else:
        dp[0][i][1] = dp[0][i-1][1] if i != 0 else ''
        dp[0][i][0] = dp[0][i-1][0] if i != 0 else 0


for i in range(s_len):
    if s[i] == t[0]:
        dp[i][0][1] = t[0]
        dp[i][0][0] = 1
    else:
        dp[i][0][1] = dp[i-1][0][1] if i != 0 else ''
        dp[i][0][0] = dp[i-1][0][0] if i != 0 else 0

for i in range(1, s_len):
    for j in range(1, t_len):
        if t[j] == s[i]:
            dp[i][j][1] = dp[i-1][j-1][1] + t[j]
            dp[i][j][0] = dp[i-1][j-1][0] + 1
        else:
            dp[i][j][1] = dp[i-1][j][1] if dp[i-1][j][0] > dp[i][j-1][0] else dp[i][j-1][1]
            dp[i][j][0] = dp[i-1][j][0] if dp[i-1][j][0] > dp[i][j-1][0] else dp[i][j-1][0]

print(dp[s_len-1][t_len-1][1])


Fixed submission:
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

s_len = len(s)
t_len = len(t)
dp = [[0 for x in range(t_len + 1)] for y in range(s_len + 1)]


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

ans = ''
i = s_len
j = t_len

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

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

s_len = len(s)
t_len = len(t)
dp = [[[0, ''] for x in range(t_len)] for y in range(s_len)]

for i in range(t_len):
    if s[0] == t[i]:
        dp[0][i][1] = s[0]
        dp[0][i][0] = 1
    else:
        dp[0][i][1] = dp[0][i-1][1] if i != 0 else ''
        dp[0][i][0] = dp[0][i-1][0] if i != 0 else 0


for i in range(s_len):
    if s[i] == t[0]:
        dp[i][0][1] = t[0]
        dp[i][0][0] = 1
    else:
        dp[i][0][1] = dp[i-1][0][1] if i != 0 else ''
        dp[i][0][0] = dp[i-1][0][0] if i != 0 else 0

for i in range(1, s_len):
    for j in range(1, t_len):
        if t[j] == s[i]:
            dp[i][j][1] = dp[i-1][j-1][1] + t[j]
            dp[i][j][0] = dp[i-1][j-1][0] + 1
        else:
            dp[i][j][1] = dp[i-1][j][1] if dp[i-1][j][0] > dp[i][j-1][0] else dp[i][j-1][1]
            dp[i][j][0] = dp[i-1][j][0] if dp[i-1][j][0] > dp[i][j-1][0] else dp[i][j-1][0]

print(dp[s_len-1][t_len-1][1])


Fixed submission:
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

s_len = len(s)
t_len = len(t)
dp = [[0 for x in range(t_len + 1)] for y in range(s_len + 1)]


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

ans = ''
i = s_len
j = t_len

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

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

s_len = len(s)
t_len = len(t)
dp = [['' for x in range(t_len)] for y in range(s_len)]

for i in range(t_len):
    if s[0] == t[i]:
        dp[0][i] = s[0]
    else:
        dp[0][i] = dp[0][i-1] if i != 0 else ''


for i in range(s_len):
    if s[i] == t[0]:
        dp[i][0] = t[0]
    else:
        dp[i][0] = dp[i-1][0] if i != 0 else ''

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

print(dp[s_len-1][t_len-1])


Fixed submission:
import sys

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

s_len = len(s)
t_len = len(t)
dp = [[0 for x in range(t_len + 1)] for y in range(s_len + 1)]


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

ans = ''
i = s_len
j = t_len

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

print(ans[::-1])