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

table = [['' for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + si
        else:
            x = table_cur[j]
            y = table_pre[j + 1]
            table_cur[j + 1] = x if len(x) > len(y) else y
print(table[-1][-1])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)

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

table = ['' for j in range(len(t) + 1)]
table_pre = ['' for j in range(len(t) + 1)]

for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            table[j + 1] = table_pre[j] + si
        else:
            x = table[j]
            y = table_pre[j + 1]
            table[j + 1] = x if len(x) > len(y) else y
    table, table_pre = table_pre, table
print(table_pre[-1])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def union_set(x, y):
    return x if len(x) > len(y) else y

s = input()
t = input()

table = ['' for j in range(len(t) + 1)]
table_pre = ['' for j in range(len(t) + 1)]

for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            table[j + 1] = table_pre[j] + si
        else:
            table[j + 1] = union_set(table[j], table_pre[j + 1])
    table, table_pre = table_pre, table
print(table_pre[-1])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def union_set(x, y):
    lx, x_set = x
    ly, y_set = y
    l = max(lx, ly)
    if lx == ly:
        z_set = x_set.union(y_set)
    else:
        z_set = x_set if lx > ly else y_set
    return [l, z_set]

def update_set(x, t):
    l, s = x
    return [l + len(t), {si + t for si in list(s)}]

s = input()
t = input()
if len(s) < len(t):
    s, t = t, s

table = [[0, {''}] for j in range(len(t) + 1)]
table_pre = [[0, {''}] for j in range(len(t) + 1)]

for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            table[j + 1] = update_set(table_pre[j], si)
        else:
            table[j + 1] = union_set(table[j], table_pre[j + 1])
    table, table_pre = table_pre, table
print(list(table_pre[-1][1])[0])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def union_set(x, y):
    lx, x_set = x
    ly, y_set = y
    l = max(lx, ly)
    if lx == ly:
        z_set = x_set.union(y_set)
    else:
        z_set = x_set if lx > ly else y_set
    return [l, z_set]

def update_set(x, t):
    l, s = x
    return [l + len(t), {si + t for si in list(s)}]

s = input()
t = input()

table = [[0, {''}] for j in range(len(t) + 1)]
table_pre = [[0, {''}] for j in range(len(t) + 1)]

for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            table[j + 1] = update_set(table_pre[j], si)
        else:
            table[j + 1] = union_set(table[j], table_pre[j + 1])
    table, table_pre = table_pre, table
print(list(table_pre[-1][1])[0])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def union_set(x, y):
    lx, x_set = x
    ly, y_set = y
    l = max(lx, ly)
    if lx == ly:
        z_set = x_set.union(y_set)
    else:
        z_set = x_set if lx > ly else y_set
    return [l, z_set]

def update_set(x, t):
    l, s = x
    return [l + len(t), {si + t for si in list(s)}]

s = input()
t = input()

table = [[[0, {''}] for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            table[i + 1][j + 1] = update_set(table[i][j], si)
        else:
            table[i + 1][j + 1] = union_set(table[i + 1][j], table[i][j + 1])
print(list(table[-1][-1][1])[0])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def union_set(x, y):
    lx, x_set = x
    ly, y_set = y
    l = max(lx, ly)
    if lx == ly:
        z_set = x_set.union(y_set)
    else:
        z_set = x_set if lx > ly else y_set
    return [l, z_set]

def update_set(x, t):
    l, s = x
    return [l + len(t), {si + t for si in list(s)}]

s = input()
t = input()

table = [[[0, {''}] for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    for j, tj in enumerate(t):
        if si == tj:
            table[i + 1][j + 1] = update_set(table[i][j], si)
        else:
            table[i + 1][j + 1] = union_set(table[i + 1][j], table[i][j + 1])
print(list(table[-1][-1][1])[0])


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

table = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]

for i, si in enumerate(s):
    table_pre = table[i]
    table_cur = table[i + 1]
    for j, tj in enumerate(t):
        if si == tj:
            table_cur[j + 1] = table_pre[j] + 1
        else:
            table_cur[j + 1] = max(table_cur[j], table_pre[j + 1])

ls, lt = len(s), len(t)
ans = ''
while ls and lt:
    if table[ls][lt] == table[ls][lt - 1]:
        lt -= 1
    elif table[ls][lt] == table[ls - 1][lt]:
        ls -= 1
    else:
        ans = s[ls - 1] + ans
        ls -= 1
        lt -= 1
print(ans)