Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
import itertools

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()


N = i_i()
S = i_s()

p = itertools.combinations(S, 3)
print(len(set(list(p))))


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    t1 = S.find(t[0])
    if t1 == -1:
        continue
    t2 = S.find(t[1], t1+1)
    if t2 == -1:
        continue
    t3 = S.find(t[2], t2+1)
    if t3 == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    ti = 0
    for j in range(N):
        if S[j] == t[ti]:
            ti += 1
        if ti == 3:
            break
    if ti == 3:
        ans += 1

print(ans)


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    t1 = S.find(t[0])
    if t1 == -1:
        continue
    t2 = S.find(t[1], t1+1)
    if t2 == -1:
        continue
    t3 = S.find(t[2], t2+1)
    if t3 == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

s = set()

a = set()
b = set()
c = set()

for i in range(0, N-2):
    if i in a:
        continue
    a.add(i)
    for j in range(i+1, N-1):
        # if j in b:
        #     continue
        # b.add(j)
        for k in range(j+1, N):
            # if k in c:
            #     continue
            # c.add(k)
            s.add(S[i]+S[j]+S[k])

print(len(s))


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    t1 = S.find(t[0])
    if t1 == -1:
        continue
    t2 = S.find(t[1], t1+1)
    if t2 == -1:
        continue
    t3 = S.find(t[2], t2+1)
    if t3 == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

s = set()


for i in range(0, N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            s.add(S[i]+S[j]+S[k])

print(len(s))


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    t1 = S.find(t[0])
    if t1 == -1:
        continue
    t2 = S.find(t[1], t1+1)
    if t2 == -1:
        continue
    t3 = S.find(t[2], t2+1)
    if t3 == -1:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

s = set()
l = list(itertools.combinations(S, 3))

for x in l:
    s.add(x[0]+x[1]+x[2])

print(len(s))


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    t1 = S.find(t[0])
    if t1 == -1:
        continue
    t2 = S.find(t[1], t1+1)
    if t2 == -1:
        continue
    t3 = S.find(t[2], t2+1)
    if t3 == -1:
        continue
    ans += 1

print(ans)