Buggy python submission (verdict: Time Limit Exceeded):
s=input()
t=input()
res=[]
for i in range(0,len(s)+1):
    r=[]
    for j in range(0,len(t)+1):
        r.append(0)
    res.append(r)
    
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            res[i][j]=res[i-1][j-1]+1
        else:
            res[i][j]=max(res[i-1][j-1], res[i-1][j], res[i][j-1])
            
#print(res)
LCS=[]
S_LCS=''
for i in range(0,min(len(s),len(t))+1):
    LCS.append('')
i = len(s)
j = len(t)
index=min(len(s),len(t))+1
while i > 0 and j > 0: 
    if s[i-1] == t[j-1]:
        LCS[index-1] = s[i-1]  
        i-=1
        j-=1 
        index-=1       

    elif res[i-1][j] > res[i][j-1]: 
        i-=1 
    else:
        j-=1 
        
for i in range(0,len(LCS)):
    S_LCS+=LCS[i]

print(S_LCS)

Fixed submission:
def main():
    s1, s2 = input(), input()
    n, m = len(s1), len(s2)

    dp, previous = [], []
    for i in range(n + 1):
        dp.append([0] * (m + 1))
        previous.append([0] * (m + 1))

    for row in range(1, n + 1):
        for column in range(1, m + 1):
            if s1[row - 1] == s2[column - 1]:
                dp[row][column] = 1 + dp[row - 1][column - 1]
                previous[row][column] = (row - 1, column - 1)
            else:
                dpUp = dp[row - 1][column]
                dpLeft = dp[row][column - 1]

                if dpUp > dpLeft:
                    dp[row][column] = dpUp
                    previous[row][column] = (row - 1, column)
                else:
                    dp[row][column] = dpLeft
                    previous[row][column] = (row, column - 1)

    lcs = ''
    curr = (n, m)

    while True:
        row, column = curr
        if previous[row][column] == 0: break

        if s1[row - 1] == s2[column - 1]:
            lcs = f'{s1[row - 1]}{lcs}'

        curr = previous[row][column]

    print(lcs)

main()

Buggy python submission (verdict: Runtime Error):
# Exercício 15.4-3 - Cormen 3 ed.

s = input()
t = input()
n = len(s) + 1
m = len(t) + 1
c = [[-1] * (m) for x in [-1] * (n)]

def lcsLengthMemoized(s, t, i, j):
    global c
    if c[i][j] != -1:
        return c[i][j]
    if i == 0 or j == 0:
        c[i][j] = 0
        return c[i][j]
    if s[i - 1] == t[j - 1]:
        c[i][j] = lcsLengthMemoized(s, t, i - 1, j - 1) + 1
        return c[i][j]
    c[i][j] = max([lcsLengthMemoized(s, t, i - 1, j), lcsLengthMemoized(s, t, i, j - 1)])
    return c[i][j]
    
def getLCS(c, s, t, i, j, lcs=""):
    if c[i][j] == 0:
        return lcs
    if s[i - 1] == t[j - 1]: # volta uma linha e uma coluna
        lcs += getLCS(c, s, t, i - 1, j - 1, lcs)
        lcs += s[i - 1]
        return lcs
    elif c[i - 1][j] > c[i][j - 1]: # volta uma linha na mesma coluna
        lcs += getLCS(c, s, t, i - 1, j, lcs)
    else: # volta uma coluna na mesma linha
        lcs += getLCS(c, s, t, i, j - 1, lcs)
    return lcs

r = lcsLengthMemoized(s, t, n - 1, m - 1)
print(getLCS(c, s, t, n - 1, m - 1))

Fixed submission:
def main():
    s1, s2 = input(), input()
    n, m = len(s1), len(s2)

    dp, previous = [], []
    for i in range(n + 1):
        dp.append([0] * (m + 1))
        previous.append([0] * (m + 1))

    for row in range(1, n + 1):
        for column in range(1, m + 1):
            if s1[row - 1] == s2[column - 1]:
                dp[row][column] = 1 + dp[row - 1][column - 1]
                previous[row][column] = (row - 1, column - 1)
            else:
                dpUp = dp[row - 1][column]
                dpLeft = dp[row][column - 1]

                if dpUp > dpLeft:
                    dp[row][column] = dpUp
                    previous[row][column] = (row - 1, column)
                else:
                    dp[row][column] = dpLeft
                    previous[row][column] = (row, column - 1)

    lcs = ''
    curr = (n, m)

    while True:
        row, column = curr
        if previous[row][column] == 0: break

        if s1[row - 1] == s2[column - 1]:
            lcs = f'{s1[row - 1]}{lcs}'

        curr = previous[row][column]

    print(lcs)

main()