Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

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

print(len(set(combinations(s, 3))))

Fixed submission:
n = int(input())
s = list(map(int, input().rstrip()))

ans = 0
for i in range(10):
    if i in s[:n - 2]:
        x = s.index(i)

        for j in range(10):
            if j in s[x + 1:n - 1]:
                y = x + s[x + 1:n - 1].index(j) + 1

                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1

print(ans)

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

ans = 0
for i in range(1000):
    if i < 10:
        x, y, z = 0, 0, i
    elif i < 100:
        x, y, z = 0, i // 10, i % 10
    else:
        x = i // 100
        y = (i - x * 100) // 10
        z = i % 10
    flg = 0
    for a in range(len(s) - 2):
        if flg == 1:
            break
        elif x != s[a]:
            continue
        else:
            for b in range(a + 1, len(s) - 1):
                if flg == 1:
                    break
                elif y != s[b]:
                    continue
                else:
                    for c in range(b + 1, len(s)):
                        if z != s[c]:
                            continue
                        else:
                            ans += 1
                            flg = 1
                            break

print(ans)

Fixed submission:
n = int(input())
s = list(map(int, input().rstrip()))

ans = 0
for i in range(10):
    if i in s[:n - 2]:
        x = s.index(i)

        for j in range(10):
            if j in s[x + 1:n - 1]:
                y = x + s[x + 1:n - 1].index(j) + 1

                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1

print(ans)

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

ans = 0
for i in range(1000):
    if i < 10:
        x, y, z = 0, 0, i
    elif i < 100:
        x, y, z = 0, i // 10, i % 10
    else:
        x = i // 100
        y = (i - x * 100) // 10
        z = i % 10
    flg = 0
    for a in range(len(s) - 2):
        if flg == 1:
            break
        elif x != s[a]:
            continue
        else:
            for b in range(a + 1, len(s) - 1):
                if flg == 1:
                    break
                elif y != s[b]:
                    continue
                else:
                    for c in range(b + 1, len(s)):
                        if z != s[c]:
                            continue
                        else:
                            ans += 1
                            flg = 1
                            break

print(ans)

Fixed submission:
n = int(input())
s = list(map(int, input().rstrip()))

ans = 0
for i in range(10):
    if i in s[:n - 2]:
        x = s.index(i)

        for j in range(10):
            if j in s[x + 1:n - 1]:
                y = x + s[x + 1:n - 1].index(j) + 1

                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int, input().rstrip()))
ans = [0] * 1000

for i in range(1000):
    if i < 10:
        x, y, z = 0, 0, i
    elif i < 100:
        x, y, z = 0, i // 10, i % 10
    else:
        x = i // 100
        y = (i - x * 100) // 10
        z = i % 10
    flg = 0
    for a in range(len(s) - 2):
        if flg == 1:
            break
        elif x != s[a]:
            continue
        else:
            for b in range(a + 1, len(s) - 1):
                if flg == 1:
                    break
                elif y != s[b]:
                    continue
                else:
                    for c in range(b + 1, len(s)):
                        if z != s[c]:
                            continue
                        else:
                            ans[x * 100 + y * 10 + z] = 1
                            flg = 1
                            break

print(sum(ans))

Fixed submission:
n = int(input())
s = list(map(int, input().rstrip()))

ans = 0
for i in range(10):
    if i in s[:n - 2]:
        x = s.index(i)

        for j in range(10):
            if j in s[x + 1:n - 1]:
                y = x + s[x + 1:n - 1].index(j) + 1

                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int, input().rstrip()))
ans = [0] * 1000

for i in range(1000):
    if i < 10:
        x, y, z = 0, 0, i
    elif i < 100:
        x, y, z = 0, i // 10, i % 10
    else:
        x = i // 100
        y = (i - x * 100) // 10
        z = i % 10
    for a in range(len(s) - 2):
        if x != s[a]:
            continue
        else:
            for b in range(a + 1, len(s) - 1):
                if y != s[b]:
                    continue
                else:
                    for c in range(b + 1, len(s)):
                        if z != s[c]:
                            continue
                        else:
                            ans[x * 100 + y * 10 + z] = 1

print(sum(ans))

Fixed submission:
n = int(input())
s = list(map(int, input().rstrip()))

ans = 0
for i in range(10):
    if i in s[:n - 2]:
        x = s.index(i)

        for j in range(10):
            if j in s[x + 1:n - 1]:
                y = x + s[x + 1:n - 1].index(j) + 1

                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1

print(ans)