Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
s_len = len(s)
t_len = len(t)

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [['' for j in range(t_len + 1)] for i in range(s_len + 1)]
for si in range(1, s_len + 1):
    for ti in range(1, t_len + 1):
        dp_len = len(dp[si][ti])
        if s[si - 1] == t[ti - 1]:
            if dp_len < len(dp[si - 1][ti - 1] + s[si - 1]):
                dp[si][ti] = dp[si - 1][ti - 1] + s[si - 1]
                dp_len = len(dp[si][ti])
        if dp_len < len(dp[si - 1][ti]):
            dp[si][ti] = dp[si - 1][ti]
            dp_len = len(dp[si][ti])
        if dp_len < len(dp[si][ti - 1]):
            dp[si][ti] = dp[si][ti - 1]
print(dp[s_len][t_len])


Fixed submission:
def dump(dp, i1_max, i2_max):
    for i1 in range(0, i1_max + 1):
        for i2 in range(0, i2_max + 1):
            print('%4d' % dp[i1][i2], end='')
        print()


s = input()
t = input()
s_len = len(s)
t_len = len(t)
inf = 1 << 60

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [[-inf for j in range(t_len + 1)] for i in range(s_len + 1)]
dp[0][0] = 0
for si in range(0, s_len + 1):
    for ti in range(0, t_len + 1):
        if si >= 1 and ti >= 1:
            if s[si - 1] == t[ti - 1]:
                dp[si][ti] = max(dp[si][ti], dp[si - 1][ti - 1] + 1)
        if si >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si - 1][ti])
        if ti >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si][ti - 1])

ans = ''
si = s_len
ti = t_len
#dump(dp, si, ti)
while si != 0 and ti != 0:
    if si >= 1 and ti >= 1:
        if (dp[si - 1][ti - 1] == dp[si][ti] - 1) and s[si - 1] == t[ti - 1]:
            ans = s[si - 1] + ans
            si -= 1
            ti -= 1
            continue
        if dp[si - 1][ti - 1] == dp[si][ti]:
            si -= 1
            ti -= 1
            continue
    if si >= 1:
        if dp[si - 1][ti] == dp[si][ti]:
            si -= 1
            continue
    if ti >= 1:
        if dp[si][ti - 1] == dp[si][ti]:
            ti -= 1
            continue

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
s_len = len(s)
t_len = len(t)

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [['' for j in range(t_len + 1)] for i in range(s_len + 1)]
for si in range(1, s_len + 1):
    for ti in range(1, t_len + 1):
        if s[si - 1] == t[ti - 1]:
            if len(dp[si][ti]) < len(dp[si - 1][ti - 1] + s[si - 1]):
                dp[si][ti] = dp[si - 1][ti - 1] + s[si - 1]
        if len(dp[si][ti]) < len(dp[si - 1][ti]):
            dp[si][ti] = dp[si - 1][ti]
        if len(dp[si][ti]) < len(dp[si][ti - 1]):
            dp[si][ti] = dp[si][ti - 1]
print(dp[s_len][t_len])


Fixed submission:
def dump(dp, i1_max, i2_max):
    for i1 in range(0, i1_max + 1):
        for i2 in range(0, i2_max + 1):
            print('%4d' % dp[i1][i2], end='')
        print()


s = input()
t = input()
s_len = len(s)
t_len = len(t)
inf = 1 << 60

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [[-inf for j in range(t_len + 1)] for i in range(s_len + 1)]
dp[0][0] = 0
for si in range(0, s_len + 1):
    for ti in range(0, t_len + 1):
        if si >= 1 and ti >= 1:
            if s[si - 1] == t[ti - 1]:
                dp[si][ti] = max(dp[si][ti], dp[si - 1][ti - 1] + 1)
        if si >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si - 1][ti])
        if ti >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si][ti - 1])

ans = ''
si = s_len
ti = t_len
#dump(dp, si, ti)
while si != 0 and ti != 0:
    if si >= 1 and ti >= 1:
        if (dp[si - 1][ti - 1] == dp[si][ti] - 1) and s[si - 1] == t[ti - 1]:
            ans = s[si - 1] + ans
            si -= 1
            ti -= 1
            continue
        if dp[si - 1][ti - 1] == dp[si][ti]:
            si -= 1
            ti -= 1
            continue
    if si >= 1:
        if dp[si - 1][ti] == dp[si][ti]:
            si -= 1
            continue
    if ti >= 1:
        if dp[si][ti - 1] == dp[si][ti]:
            ti -= 1
            continue

print(ans)