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

dp = [[0]*10 for _ in range(10)]

count = 0
result = []
for i in range(n-2):
    if dp[int(s[i])] != [1]*10:
        for j in range(i+1,n-1):
            if dp[int(s[i])][int(s[j])]==0:
                count += 1
                tem = "".join(set(s[j+1:]))
                for k in range(len(tem)):
                    result.append(s[i]+s[j]+tem[k])
                dp[int(s[i])][int(s[j])]=1

ans = set(result)
print(len(ans))

Fixed submission:
n = int(input())
s = input()

dp = [[0]*10 for _ in range(10)]

count = [0]*10

result = []

for i in range(n-2):
    if count[int(s[i])]==0:
        for j in range(i+1,n-1):
            if dp[int(s[i])][int(s[j])]==0:
                tem = "".join(set(s[j+1:]))
                for k in range(len(tem)):
                    result.append(s[i]+s[j]+tem[k])
                dp[int(s[i])][int(s[j])]=1
        count[int(s[i])]=1

ans = set(result)
print(len(ans))

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

dp = [[0]*10 for _ in range(10)]

result = []
for i in range(n-2):
    for j in range(i+1,n-1):
        if dp[int(s[i])][int(s[j])]==0:
            tem = "".join(set(s[j+1:]))
            for k in range(len(tem)):
                result.append(s[i]+s[j]+tem[k])
            dp[int(s[i])][int(s[j])]=1

ans = set(result)
print(len(ans))

Fixed submission:
n = int(input())
s = input()

dp = [[0]*10 for _ in range(10)]

count = [0]*10

result = []

for i in range(n-2):
    if count[int(s[i])]==0:
        for j in range(i+1,n-1):
            if dp[int(s[i])][int(s[j])]==0:
                tem = "".join(set(s[j+1:]))
                for k in range(len(tem)):
                    result.append(s[i]+s[j]+tem[k])
                dp[int(s[i])][int(s[j])]=1
        count[int(s[i])]=1

ans = set(result)
print(len(ans))

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

result = []
for i in range(n-2):
    for j in range(i+1,n-1):
        tem = "".join(set(s[j+1:]))
        for k in range(len(tem)):
            result.append(s[i]+s[j]+tem[k])

ans = set(result)
print(len(ans))

Fixed submission:
n = int(input())
s = input()

dp = [[0]*10 for _ in range(10)]

count = [0]*10

result = []

for i in range(n-2):
    if count[int(s[i])]==0:
        for j in range(i+1,n-1):
            if dp[int(s[i])][int(s[j])]==0:
                tem = "".join(set(s[j+1:]))
                for k in range(len(tem)):
                    result.append(s[i]+s[j]+tem[k])
                dp[int(s[i])][int(s[j])]=1
        count[int(s[i])]=1

ans = set(result)
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
n = int(input())
s = input()

explo = list(combinations(range(n),3))

tem = []
for per in explo:
    tem.append(s[per[0]]+s[per[1]]+s[per[2]])

ans = set(tem)


print(len(ans))





Fixed submission:
n = int(input())
s = input()

dp = [[0]*10 for _ in range(10)]

count = [0]*10

result = []

for i in range(n-2):
    if count[int(s[i])]==0:
        for j in range(i+1,n-1):
            if dp[int(s[i])][int(s[j])]==0:
                tem = "".join(set(s[j+1:]))
                for k in range(len(tem)):
                    result.append(s[i]+s[j]+tem[k])
                dp[int(s[i])][int(s[j])]=1
        count[int(s[i])]=1

ans = set(result)
print(len(ans))