Buggy python submission (verdict: Time Limit Exceeded):

s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ ("",0) for i in range(ls+1) ] for j in range(lt+1) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i][j][1] + 1 
            b = dp_list[i+1][j][1]
            c = dp_list[i][j+1][1]
            p = [a,b,c].index(max(a,b,c))
            if p == 0:
                dp_list[i+1][j+1] = ( dp_list[i][j][0] + s[j] , a) 
            elif p == 1:
                dp_list[i+1][j+1] = dp_list[i+1][j]
            elif p == 2:
                dp_list[i+1][j+1] = dp_list[i][j+1]
        else:
            a = dp_list[i][j][1] 
            b = dp_list[i+1][j][1]
            c = dp_list[i][j+1][1]
            p = [a,b,c].index(max(a,b,c))
            if p == 0:
                dp_list[i+1][j+1] = dp_list[i][j]
            elif p == 1:
                dp_list[i+1][j+1] = dp_list[i+1][j]
            elif p == 2:
                dp_list[i+1][j+1] = dp_list[i][j+1]            
print(dp_list[-1][-1][0])


Fixed submission:
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ 0 for i in range(ls+1) ] for j in range(lt+1) ]
index_list = [ [ None for i in range(ls) ] for j in range(lt) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            c = dp_list[i][j] + 1 
            p = [a,b,c].index(max(a,b,c))
            dp_list[i+1][j+1] = [a,b,c][p]
            index_list[i][j] = (1,p)

        else:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            p = [a,b].index(max(a,b))
            dp_list[i+1][j+1] = [a,b][p]
            index_list[i][j] = (0,p)

q = dp_list[-1][-1]
r = t   

a = 10**5

ans = ""
y, x = lt-1, ls-1
while y != -1 and x != -1:
    if index_list[y][x][1] == 2:
        x -= 1
        y -= 1
        ans += s[x+1]
    elif index_list[y][x][1] == 1:
        y -= 1
    elif index_list[y][x][1] == 0:
        x -= 1

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ "" for i in range(ls+1) ] for j in range(lt+1) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = "".join([dp_list[i][j], t[i]])
            b = dp_list[i+1][j]
            c = dp_list[i][j+1]
            p = list(map(len,[a,b,c])).index(max(map(len,[a,b,c])))
            
            dp_list[i+1][j+1] = [a,b,c][p]
        else:
            a = dp_list[i][j]
            b = dp_list[i+1][j]
            c = dp_list[i][j+1]
            p = list(map(len,[a,b,c])).index(max(map(len,[a,b,c])))
            
            dp_list[i+1][j+1] = [a,b,c][p]

print(dp_list[-1][-1])

Fixed submission:
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ 0 for i in range(ls+1) ] for j in range(lt+1) ]
index_list = [ [ None for i in range(ls) ] for j in range(lt) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            c = dp_list[i][j] + 1 
            p = [a,b,c].index(max(a,b,c))
            dp_list[i+1][j+1] = [a,b,c][p]
            index_list[i][j] = (1,p)

        else:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            p = [a,b].index(max(a,b))
            dp_list[i+1][j+1] = [a,b][p]
            index_list[i][j] = (0,p)

q = dp_list[-1][-1]
r = t   

a = 10**5

ans = ""
y, x = lt-1, ls-1
while y != -1 and x != -1:
    if index_list[y][x][1] == 2:
        x -= 1
        y -= 1
        ans += s[x+1]
    elif index_list[y][x][1] == 1:
        y -= 1
    elif index_list[y][x][1] == 0:
        x -= 1

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ "" for i in range(ls+1) ] for j in range(lt+1) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i][j] + t[i]
            b = dp_list[i+1][j]
            c = dp_list[i][j+1]
            p = list(map(len,[a,b,c])).index(max(map(len,[a,b,c])))
            
            dp_list[i+1][j+1] = [a,b,c][p]
        else:
            a = dp_list[i][j]
            b = dp_list[i+1][j]
            c = dp_list[i][j+1]
            p = list(map(len,[a,b,c])).index(max(map(len,[a,b,c])))
            
            dp_list[i+1][j+1] = [a,b,c][p]

print(dp_list[-1][-1])


Fixed submission:
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ 0 for i in range(ls+1) ] for j in range(lt+1) ]
index_list = [ [ None for i in range(ls) ] for j in range(lt) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            c = dp_list[i][j] + 1 
            p = [a,b,c].index(max(a,b,c))
            dp_list[i+1][j+1] = [a,b,c][p]
            index_list[i][j] = (1,p)

        else:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            p = [a,b].index(max(a,b))
            dp_list[i+1][j+1] = [a,b][p]
            index_list[i][j] = (0,p)

q = dp_list[-1][-1]
r = t   

a = 10**5

ans = ""
y, x = lt-1, ls-1
while y != -1 and x != -1:
    if index_list[y][x][1] == 2:
        x -= 1
        y -= 1
        ans += s[x+1]
    elif index_list[y][x][1] == 1:
        y -= 1
    elif index_list[y][x][1] == 0:
        x -= 1

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):

s, t = input(), input()
ls, lt = map(len,[s,t])

cls_list = [ [ 0 for j in range(lt+1) ] for i in range(ls+1) ]

    

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            cls_list[i+1][j+1] = max(cls_list[i+1][j], cls_list[i][j+1], cls_list[i][j] + 1)
        else:
            cls_list[i+1][j+1] = max(cls_list[i+1][j], cls_list[i][j+1])


ans = []
k = ls - cls_list[-1][-1]

for i in range(lt):
    if cls_list[k][i] != cls_list[k+1][i+1]:
        k += 1
        ans.append(t[i])


print("".join(ans))

Fixed submission:
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ 0 for i in range(ls+1) ] for j in range(lt+1) ]
index_list = [ [ None for i in range(ls) ] for j in range(lt) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            c = dp_list[i][j] + 1 
            p = [a,b,c].index(max(a,b,c))
            dp_list[i+1][j+1] = [a,b,c][p]
            index_list[i][j] = (1,p)

        else:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            p = [a,b].index(max(a,b))
            dp_list[i+1][j+1] = [a,b][p]
            index_list[i][j] = (0,p)

q = dp_list[-1][-1]
r = t   

a = 10**5

ans = ""
y, x = lt-1, ls-1
while y != -1 and x != -1:
    if index_list[y][x][1] == 2:
        x -= 1
        y -= 1
        ans += s[x+1]
    elif index_list[y][x][1] == 1:
        y -= 1
    elif index_list[y][x][1] == 0:
        x -= 1

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):

s, t = input(), input()
ls, lt = map(len,[s,t])

cls_list = [ [ [] for j in range(lt+1) ] for i in range(ls+1) ]

def lenmax(*args):
    args_list = list(args)
    length_list = list(map(len, args_list))
    longest_length = max(length_list)
    longest_index = length_list.index(longest_length)
    return args_list[longest_index]
    

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            cls_list[i+1][j+1] = lenmax(cls_list[i+1][j], cls_list[i][j+1], cls_list[i][j] + [s[i]])
        else:
            cls_list[i+1][j+1] = lenmax(cls_list[i+1][j], cls_list[i][j+1])

print("".join(cls_list[-1][-1]))

Fixed submission:
s = input()
t = input()
ls, lt = len(s), len(t)

dp_list = [ [ 0 for i in range(ls+1) ] for j in range(lt+1) ]
index_list = [ [ None for i in range(ls) ] for j in range(lt) ]

for i in range(lt):
    for j in range(ls):
        if t[i] == s[j]:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            c = dp_list[i][j] + 1 
            p = [a,b,c].index(max(a,b,c))
            dp_list[i+1][j+1] = [a,b,c][p]
            index_list[i][j] = (1,p)

        else:
            a = dp_list[i+1][j]
            b = dp_list[i][j+1]
            p = [a,b].index(max(a,b))
            dp_list[i+1][j+1] = [a,b][p]
            index_list[i][j] = (0,p)

q = dp_list[-1][-1]
r = t   

a = 10**5

ans = ""
y, x = lt-1, ls-1
while y != -1 and x != -1:
    if index_list[y][x][1] == 2:
        x -= 1
        y -= 1
        ans += s[x+1]
    elif index_list[y][x][1] == 1:
        y -= 1
    elif index_list[y][x][1] == 0:
        x -= 1

print(ans[::-1])