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

#dp[i+1][j+1]:Sのi文字目までとTのj文字目まででのLCSの長さ

dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]

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][j]+1, dp[i+1][j], dp[i][j+1])
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

res = ""
i = len(s)
j = len(t)

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:
        res = s[i-1] + res
        i -= 1
        j -= 1

print(res)

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

#dp[i+1][j+1]:Sのi文字目までとTのj文字目まででのLCSの長さ

dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]

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][j]+1, dp[i+1][j], dp[i][j+1])
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])


#復元
res = ""
i = len(s)
j = len(t)

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:
        res = s[i-1] + res
        i -= 1
        j -= 1

print(res)

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

#dp[i+1][j+1]:Sのi文字目までとTのj文字目まででのLCSの長さ

dp = [["" for j in range(len(t)+1)] for i in range(len(s)+1)]

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][j]+s[i], dp[i+1][j], dp[i][j+1], key=len)
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1], key=len)

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

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

#dp[i+1][j+1]:Sのi文字目までとTのj文字目まででのLCSの長さ

dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]

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][j]+1, dp[i+1][j], dp[i][j+1])
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])


#復元
res = ""
i = len(s)
j = len(t)

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:
        res = s[i-1] + res
        i -= 1
        j -= 1

print(res)

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

#dp[i+1][j+1]:Sのi文字目までとTのj文字目まででのLCSの長さ

dp = [["" for j in range(len(t)+1)] for i in range(len(s)+1)]

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][j]+s[i], dp[i+1][j], dp[i][j+1], key=len)
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1], key=len)

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

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

#dp[i+1][j+1]:Sのi文字目までとTのj文字目まででのLCSの長さ

dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]

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][j]+1, dp[i+1][j], dp[i][j+1])
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])


#復元
res = ""
i = len(s)
j = len(t)

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:
        res = s[i-1] + res
        i -= 1
        j -= 1

print(res)