Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [( 0 , -1 )]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = len(s) , len(t)
while True:
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])

Fixed submission:
import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(sys.getrecursionlimit())
def trace(i,j):
    global ans
    if i == 0 or j == 0:
        return
    if dp[i][j][1] == 0:
        trace(i,j-1)
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        trace(i-1,j-1)
    elif dp[i][j][1] == 2:
        trace(i-1,j)
    else:
        return

s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [( 0 , -1 )]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
trace(len(s),len(t))
print(ans[::-1])

Fixed submission:
import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(sys.getrecursionlimit())
def trace(i,j):
    global ans
    if dp[i][j][1] == 0:
        trace(i,j-1)
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        trace(i-1,j-1)
    elif dp[i][j][1] == 2:
        trace(i-1,j)
    else:
        return

s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [( 0 , -1 )]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
trace(len(s),len(t))
print(ans[::-1])

Fixed submission:
import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
def trace(i,j):
    global ans
    if dp[i][j][1] == 0:
        trace(i,j-1)
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        trace(i-1,j-1)
    elif dp[i][j][1] == 2:
        trace(i-1,j)
    else:
        return

s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [( 0 , -1 )]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
trace(len(s),len(t))
print(ans[::-1])

Fixed submission:
import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [""]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        incStr = s[i-1] if s[i-1]==t[j-1] else ""
        comp = [ dp[i][j-1],dp[i-1][j-1]+incStr,dp[i-1][j]]
        dp[i][j] = comp[comp.index(max(comp,key=lambda x: len(x)))]


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

Fixed submission:
import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])