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

ls,lt = len(s),len(t)
dp = [[(0,"")]*(lt+1) for _ in [0]*(ls+1)]
for i in range(1,ls+1):
    for j in range(1,lt+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = [dp[i-1][j][0]+1,dp[i-1][j][1]+s[i-1]]
        elif dp[i-1][j][0] >= dp[i][j-1][0]:
            dp[i][j] = dp[i-1][j][:]
        else:
            dp[i][j] = dp[i][j-1][:]
print(dp[-1][-1][1])

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

ls,lt = len(s),len(t)
dp = [[0]*(lt+1) for _ in [0]*(ls+1)]

for i,cs in enumerate(s,1):
    for j,ct in enumerate(t,1):
        if cs==ct:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i = ls
j = lt
ans = ""
while i>0 and j>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -=1
        else:
            j -=1
print(ans[::-1])

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

ls,lt = len(s),len(t)
dp = [[(0,"")]*(lt+1) for _ in [0]*(ls+1)]
for i in range(1,ls+1):
    for j in range(1,lt+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = [dp[i-1][j][0]+1,dp[i-1][j][1]+s[i-1]]
        elif dp[i-1][j][0] >= dp[i][j-1][0]:
            dp[i][j] = dp[i-1][j][:]
        else:
            dp[i][j] = dp[i][j-1][:]
print(dp[-1][-1][1])

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

ls,lt = len(s),len(t)
dp = [[0]*(lt+1) for _ in [0]*(ls+1)]

for i,cs in enumerate(s,1):
    for j,ct in enumerate(t,1):
        if cs==ct:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i = ls
j = lt
ans = ""
while i>0 and j>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -=1
        else:
            j -=1
print(ans[::-1])

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

ls,lt = len(s),len(t)
if ls > lt:
    #短い方をsに固定
    s,t = t,s
    ls,lt = lt,ls
dp=[("",0,0)]
common_str_set = set([""])
max_len = 0
i_ans = 0
for i,c in enumerate(s):
    for common_str,j,l_dp in dp[:]:
        if max_len >= l_dp + min((ls - i,lt-j)):
            continue
        for k,ct in enumerate(t[j:],j):
            if c == ct and (common_str+c) not in common_str_set:
                dp.append((common_str+c,k+1,l_dp+1))
                common_str_set.add(common_str+c)
                if l_dp+1 > max_len:
                    max_len = l_dp+1
                    i_ans = len(dp)-1
                break
print(dp[i_ans][0])

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

ls,lt = len(s),len(t)
dp = [[0]*(lt+1) for _ in [0]*(ls+1)]

for i,cs in enumerate(s,1):
    for j,ct in enumerate(t,1):
        if cs==ct:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i = ls
j = lt
ans = ""
while i>0 and j>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -=1
        else:
            j -=1
print(ans[::-1])

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

ls,lt = len(s),len(t)
if ls > lt:
    #短い方をsに固定
    s,t = t,s
    ls,lt = lt,ls
dp=[("",0,0)]
common_str_set = set([""])
max_len = 0
i_ans = 0
for i,c in enumerate(s):
    for common_str,j,l_dp in dp[:]:
        for k,ct in enumerate(t[j:],j):
            if c == ct and (common_str+c) not in common_str_set:
                dp.append((common_str+c,k+1,l_dp+1))
                common_str_set.add(common_str+c)
                if l_dp+1 > max_len:
                    max_len = l_dp+1
                    i_ans = len(dp)-1
print(dp[i_ans][0])

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

ls,lt = len(s),len(t)
dp = [[0]*(lt+1) for _ in [0]*(ls+1)]

for i,cs in enumerate(s,1):
    for j,ct in enumerate(t,1):
        if cs==ct:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i = ls
j = lt
ans = ""
while i>0 and j>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -=1
        else:
            j -=1
print(ans[::-1])

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

ls,lt = len(s),len(t)
if ls > lt:
    #短い方をsに固定
    s,t = t,s
    ls,lt = lt,ls
dp=[("",0,0)]
common_str_set = set([""])
max_len = 0
i_ans = 0
for i,c in enumerate(s):
    for common_str,j,l_dp in dp.copy():
        for k,ct in enumerate(t[j:],j):
            if c == ct and (common_str+c) not in common_str_set:
                dp.append((common_str+c,k+1,l_dp+1))
                common_str_set.add(common_str+c)
                if l_dp+1 > max_len:
                    max_len = l_dp+1
                    i_ans = len(dp)-1
print(dp[i_ans][0])

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

ls,lt = len(s),len(t)
dp = [[0]*(lt+1) for _ in [0]*(ls+1)]

for i,cs in enumerate(s,1):
    for j,ct in enumerate(t,1):
        if cs==ct:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i = ls
j = lt
ans = ""
while i>0 and j>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -=1
        else:
            j -=1
print(ans[::-1])

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

ls,lt = len(s),len(t)
if ls > lt:
    #短い方をsに固定
    s,t = t,s
    ls,lt = lt,ls
dp=[("",0,0)]
common_str_set = set([""])
max_len = 0
i_ans = 0
for i,c in enumerate(s):
    for common_str,j,l_dp in dp.copy():
        for k,ct in enumerate(t[j:],j):
            if c == ct and (common_str+c) not in common_str_set:
                dp.append((common_str+c,k+1,l_dp+1))
                common_str_set.add(common_str+c)
                if l_dp+1 > max_len:
                    max_len = l_dp+1
                    i_ans = len(dp)-1
print(dp[i_ans][0])

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

ls,lt = len(s),len(t)
dp = [[0]*(lt+1) for _ in [0]*(ls+1)]

for i,cs in enumerate(s,1):
    for j,ct in enumerate(t,1):
        if cs==ct:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i = ls
j = lt
ans = ""
while i>0 and j>0:
    if s[i-1] == t[j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
    else:
        if dp[i-1][j] > dp[i][j-1]:
            i -=1
        else:
            j -=1
print(ans[::-1])