Buggy python submission (verdict: Runtime Error):
import re
import bisect
s = input()
len_s = len(s)
t = input()

ind_dict = {i : [] for i in t}
for i, _s in enumerate(s):
    if _s in t:
        ind_dict[_s] += [i]
ind_ls = [[j.start(0) for j in re.finditer(i,s)] for i in t]

def get_least(last, s, dic):
    ls = dic[s]
    ind = bisect.bisect_right(ls, last)
    if ind >= len(ls):
        return ls[0]
    else:
        return ls[ind]

if -1 in [s.find(_t) for _t in t]:
    print(-1)
else:
    cnt = 0
    last = get_least(0, t[0], ind_dict)
    for _t in t[1:]:
        _next = get_least(last, _t, ind_dict)
        if _next < last:
            cnt += 1
        last = _next
    print(cnt * len(s) + _next + 1)

Fixed submission:
import bisect
s = input()
len_s = len(s)
t = input()

ind_dict = {i : [] for i in t}
for i, _s in enumerate(s):
    if _s in t:
        ind_dict[_s] += [i]

def get_least(last, s, dic):
    ls = dic[s]
    ind = bisect.bisect_right(ls, last)
    if ind >= len(ls):
        return ls[0]
    else:
        return ls[ind]

if -1 in [s.find(_t) for _t in t]:
    print(-1)
else:
    cnt = 0
    last = get_least(-1, t[0], ind_dict)
    _next = last
    for _t in t[1:]:
        _next = get_least(last, _t, ind_dict)
        if _next <= last:
            cnt += 1
        last = _next
    print(cnt * len(s) + _next + 1)

Buggy python submission (verdict: Runtime Error):
import re
import bisect
s = input()
len_s = len(s)
t = input()

ind_ls = [[j.start(0) for j in re.finditer(i,s)] for i in t]

def get_least(s_ind, ls):
    ind = bisect.bisect_right(ls, s_ind)
    if ind >= len(ls):
        return ls[0]
    else:
        return ls[ind]

if -1 in [s.find(_t) for _t in t]:
    print(-1)
else:
    cnt = 0
    last = get_least(0, ind_ls[0])
    for ind in ind_ls[1:]:
        _next = get_least(last, ind)
        if _next < last:
            cnt += 1
        last = _next
    print(cnt * len(s) + _next + 1)

Fixed submission:
import bisect
s = input()
len_s = len(s)
t = input()

ind_dict = {i : [] for i in t}
for i, _s in enumerate(s):
    if _s in t:
        ind_dict[_s] += [i]

def get_least(last, s, dic):
    ls = dic[s]
    ind = bisect.bisect_right(ls, last)
    if ind >= len(ls):
        return ls[0]
    else:
        return ls[ind]

if -1 in [s.find(_t) for _t in t]:
    print(-1)
else:
    cnt = 0
    last = get_least(-1, t[0], ind_dict)
    _next = last
    for _t in t[1:]:
        _next = get_least(last, _t, ind_dict)
        if _next <= last:
            cnt += 1
        last = _next
    print(cnt * len(s) + _next + 1)

Buggy python submission (verdict: Runtime Error):
import re
import bisect
s = input()
len_s = len(s)
t = input()

ind_ls = [[j.start(0) for j in re.finditer(i,s)] for i in t]

def get_least(s_ind, ls):
    ind = bisect.bisect_right(ls, s_ind)
    if ind >= len(ls):
        return ls[0]
    else:
        return ls[ind]

if -1 in [s.find(_t) for _t in t]:
    print(-1)
else:
    cnt = 0
    last = get_least(0, ind_ls[0])
    for ind in ind_ls[1:]:
        _next = get_least(last, ind)
        if _next < last:
            cnt += 1
        last = _next
    print(cnt * len(s) + _next + 1)

Fixed submission:
import bisect
s = input()
len_s = len(s)
t = input()

ind_dict = {i : [] for i in t}
for i, _s in enumerate(s):
    if _s in t:
        ind_dict[_s] += [i]

def get_least(last, s, dic):
    ls = dic[s]
    ind = bisect.bisect_right(ls, last)
    if ind >= len(ls):
        return ls[0]
    else:
        return ls[ind]

if -1 in [s.find(_t) for _t in t]:
    print(-1)
else:
    cnt = 0
    last = get_least(-1, t[0], ind_dict)
    _next = last
    for _t in t[1:]:
        _next = get_least(last, _t, ind_dict)
        if _next <= last:
            cnt += 1
        last = _next
    print(cnt * len(s) + _next + 1)