Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())
s_list = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for s in s_list:
        if t == s[j]:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)


Fixed submission:
n = int(input())
s_list = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for s in s_list:
        if t == s:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for j in range(len(s)):
        if t == s[j]:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)


Fixed submission:
n = int(input())
s_list = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for s in s_list:
        if t == s:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    for j in range(len(s)):
        if key[k] == s[j]:
            k += 1
            if k == 3:
                ans += 1
                break
print(ans)


Fixed submission:
n = int(input())
s_list = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for s in s_list:
        if t == s:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    for j in range(len(s)):
        if key[k] == s[j]:
            k += 1
        if k == 3:
            ans += 1
            break
print(ans)


Fixed submission:
n = int(input())
s_list = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for s in s_list:
        if t == s:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = list(input())

l = collections.Counter(s[:1])
r = collections.Counter(s[2:])
key = set()
for i in range(n-2):
    for j in range(10):
        for k in range(10):
            if l[str(j)] > 0 and r[str(k)] > 0:
                key.add('{}{}{}'.format(j,s[i+1],k))
    l[str(s[i+1])] += 1
    r[str(s[i+2])] -= 1
print(len(key))


Fixed submission:
n = int(input())
s_list = list(input())

ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    k = 0
    t = key[k]
    for s in s_list:
        if t == s:
            k += 1
            if k == 3:
                ans += 1
                break
            t = key[k]
print(ans)