Buggy python submission (verdict: Time Limit Exceeded):
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0

    # loop
    ss = s

    for t_ in t:
        find_plus_one = ss.find(t_) + 1
        ss = ss[find_plus_one:]
        if len(ss) < s_len:
            ss += s
        ans += find_plus_one
    print(ans)
else:
    print(-1)


Fixed submission:
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0
    ss = s + s
    found_index_old = -1

    for t_ in t:
        found_index = ss.find(t_, found_index_old + 1)
        # print(ss, found_index_old + 1, found_index, found_index + 1 - (found_index_old + 1))
        ans += found_index - found_index_old # found_index + 1 - (found_index_old + 1)
        found_index_old = found_index % s_len
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
s = input() # これを繰り返しまくる
t = input() # これを探す

s_set = set(s)
ss = s * len(t)

if all((t_ in s_set) for t_ in t):
    current_index = 0

    for t_ in t:
        current_index = ss.find(t_, current_index) + 1
    print(current_index)
else:
    print(-1)


Fixed submission:
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0
    ss = s + s
    found_index_old = -1

    for t_ in t:
        found_index = ss.find(t_, found_index_old + 1)
        # print(ss, found_index_old + 1, found_index, found_index + 1 - (found_index_old + 1))
        ans += found_index - found_index_old # found_index + 1 - (found_index_old + 1)
        found_index_old = found_index % s_len
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0

    # loop
    ss = s

    for t_ in t:
        find_plus_one = ss.find(t_) + 1
        ss = ss[find_plus_one:]
        if len(ss) < s_len:
            ss += s
        ans += find_plus_one
    print(ans)
else:
    print(-1)


Fixed submission:
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0
    ss = s + s
    found_index_old = -1

    for t_ in t:
        found_index = ss.find(t_, found_index_old + 1)
        # print(ss, found_index_old + 1, found_index, found_index + 1 - (found_index_old + 1))
        ans += found_index - found_index_old # found_index + 1 - (found_index_old + 1)
        found_index_old = found_index % s_len
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0

    # loop
    ss = s

    for t_ in t:
        find_plus_one = ss.find(t_) + 1
        ss = ss[find_plus_one:]
        if len(ss) < s_len:
            ss += s
        ans += find_plus_one
    print(ans)
else:
    print(-1)


Fixed submission:
s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0
    ss = s + s
    found_index_old = -1

    for t_ in t:
        found_index = ss.find(t_, found_index_old + 1)
        # print(ss, found_index_old + 1, found_index, found_index + 1 - (found_index_old + 1))
        ans += found_index - found_index_old # found_index + 1 - (found_index_old + 1)
        found_index_old = found_index % s_len
    print(ans)
else:
    print(-1)