Buggy python submission (verdict: Time Limit Exceeded):
import string, random
def randomname(n):
    return ''.join(random.choices(string.ascii_letters + string.digits, k=n))

#sList, tList = list(randomname(3000)), list(randomname(3000))
sList, tList = list(input()), list(input())

dp = [[[0, ""] for _ in range(len(tList) + 1)] for _ in range(2)]
index = 0
for i, s in enumerate(sList, start=1):
    index = i % 2
    sameLen = 0
    sameStr = ""
    for j, t in enumerate(tList, start=1):
        aboveLen = dp[index-1][j][0]
        aboveStr = dp[index-1][j][1]
        if s == t:
            sameLen = dp[index-1][j-1][0] + 1
            sameStr = dp[index-1][j-1][1] + s
        if sameLen > aboveLen:
            dp[index][j][0] = sameLen
            dp[index][j][1] = sameStr
        else:
            dp[index][j][0] = aboveLen
            dp[index][j][1] = aboveStr

print(dp[index][-1][1])



Fixed submission:
sList, tList = list(input()), list(input())

dp = [[0] * (len(tList) + 1) for _ in range(len(sList) + 1)]
for i, s in enumerate(sList, start=1):
    sameNum = 0
    for j, t in enumerate(tList, start=1):
        num = dp[i-1][j]
        if s == t:
            sameNum = max(num, dp[i-1][j-1] + 1)
        dp[i][j] = max(num, sameNum)

ans = ""

while(i > 0, j > 0):
    num = dp[i][j]
    if num == 0:
        break
    if sList[i-1] == tList[j-1]:
        ans = sList[i-1] + ans
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sList, tList = list(input()), list(input())

dp = [[""] * (len(tList) + 1) for _ in range(2)]
index = 0
for i, s in enumerate(sList, start=1):
    index = i % 2
    sameStr = ""
    for j, t in enumerate(tList, start=1):
        aboveStr = dp[index-1][j]
        if s == t:
            sameStr = dp[index-1][j-1] + s
        dp[index][j] = sameStr if len(sameStr) > len(aboveStr) else aboveStr

print(dp[index][-1])


Fixed submission:
sList, tList = list(input()), list(input())

dp = [[0] * (len(tList) + 1) for _ in range(len(sList) + 1)]
for i, s in enumerate(sList, start=1):
    sameNum = 0
    for j, t in enumerate(tList, start=1):
        num = dp[i-1][j]
        if s == t:
            sameNum = max(num, dp[i-1][j-1] + 1)
        dp[i][j] = max(num, sameNum)

ans = ""

while(i > 0, j > 0):
    num = dp[i][j]
    if num == 0:
        break
    if sList[i-1] == tList[j-1]:
        ans = sList[i-1] + ans
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sList, tList = list(input()), list(input())

dp = [[""] * (len(tList) + 1) for _ in range(2)]
index = 0
for i, s in enumerate(sList, start=1):
    index = i % 2
    sameStr = ""
    for j, t in enumerate(tList, start=1):
        aboveStr = dp[index-1][j]
        if s == t:
            sameStr = dp[index-1][j-1] + s
        dp[index][j] = sameStr if len(sameStr) > len(aboveStr) else aboveStr

print(dp[index][-1])


Fixed submission:
sList, tList = list(input()), list(input())

dp = [[0] * (len(tList) + 1) for _ in range(len(sList) + 1)]
for i, s in enumerate(sList, start=1):
    sameNum = 0
    for j, t in enumerate(tList, start=1):
        num = dp[i-1][j]
        if s == t:
            sameNum = max(num, dp[i-1][j-1] + 1)
        dp[i][j] = max(num, sameNum)

ans = ""

while(i > 0, j > 0):
    num = dp[i][j]
    if num == 0:
        break
    if sList[i-1] == tList[j-1]:
        ans = sList[i-1] + ans
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
sList, tList = map(list, sorted([input(), input()], key=lambda x: len(x)))

dp = [[""] * (len(tList) + 1) for _ in range(2)]
index = 0
for i, s in enumerate(sList, start=1):
    index = i % 2
    sameStr = ""
    for j, t in enumerate(tList, start=1):
        aboveStr = dp[index-1][j]
        if s == t:
            sameStr = dp[index-1][j-1] + s
        dp[index][j] = sameStr if len(sameStr) > len(aboveStr) else aboveStr

print(dp[index][-1])



Fixed submission:
sList, tList = list(input()), list(input())

dp = [[0] * (len(tList) + 1) for _ in range(len(sList) + 1)]
for i, s in enumerate(sList, start=1):
    sameNum = 0
    for j, t in enumerate(tList, start=1):
        num = dp[i-1][j]
        if s == t:
            sameNum = max(num, dp[i-1][j-1] + 1)
        dp[i][j] = max(num, sameNum)

ans = ""

while(i > 0, j > 0):
    num = dp[i][j]
    if num == 0:
        break
    if sList[i-1] == tList[j-1]:
        ans = sList[i-1] + ans
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s, t = sorted([input(), input()], key=lambda x: len(x))
len_s, len_t = len(s), len(t)

dp = [[""] * len_t for _ in range(2)]
index = 0
for i in range(len_s):
    index = i % 2
    sameStr = ""
    for j in range(len_t):
        aboveStr = dp[index-1][j]
        if s[i] == t[j]:
            sameStr = aboveStr + s[i]
        dp[index][j] = sameStr if len(sameStr) >= len(aboveStr) else aboveStr

print(dp[index][-1])

Fixed submission:
sList, tList = list(input()), list(input())

dp = [[0] * (len(tList) + 1) for _ in range(len(sList) + 1)]
for i, s in enumerate(sList, start=1):
    sameNum = 0
    for j, t in enumerate(tList, start=1):
        num = dp[i-1][j]
        if s == t:
            sameNum = max(num, dp[i-1][j-1] + 1)
        dp[i][j] = max(num, sameNum)

ans = ""

while(i > 0, j > 0):
    num = dp[i][j]
    if num == 0:
        break
    if sList[i-1] == tList[j-1]:
        ans = sList[i-1] + ans
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(ans)