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

cnt = 0
for i in range(10):
    find = 0
    for j in range(n-2):
        if find == 1:
            break
        if s[j] == str(0):
            for k in range(j+1,n-1):
                if find == 1:
                    break
                if s[k] == str(0):
                    for l in range(k+1,n):
                        if s[l] == str(i):
                            find = 1
                            break
    if find == 1:
        cnt += 1

for i in range(10,100):
    find = 0
    for j in range(n-2):
        if find == 1:
            break
        if s[j] == str(0):
            for k in range(j+1,n-1):
                if find == 1:
                    break
                if s[k] == str(i)[0]:
                    for l in range(k+1,n):
                        if s[l] == str(i)[1]:
                            find = 1
                            break
    if find == 1:
        cnt+=1

for i in range(100,1000):
    find = 0
    for j in range(n-2):
        if find == 1:
            break
        if s[j] == str(i)[0]:
            for k in range(j+1,n-1):
                if find==1:
                    break
                if s[k] == str(i)[1]:
                    for l in range(k+1,n):
                        if s[l] == str(i)[2]:
                            find = 1
                            break
    if find == 1:
        cnt += 1

print(cnt)

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

cnt = 0
for i in range(10):
    s_ = s
    if str(0) in s_:
        s_ = s_[s_.index(str(0))+1:]
        if str(0) in s_:
            s_ = s_[s_.index(str(0))+1:]
            if str(i) in s_:
                cnt += 1

for i in range(10,100):
    s_ = s
    if str(0) in s_:
        s_ = s_[s_.index(str(0))+1:]
        if str(i)[0] in s_:
            s_ = s_[s_.index(str(i)[0])+1:]
            if str(i)[1] in s_:
                cnt += 1

for i in range(100,1000):
    s_ = s
    if str(i)[0] in s_:
        s_ = s_[s_.index(str(i)[0])+1:]
        if str(i)[1] in s_:
            s_ = s_[s_.index(str(i)[1])+1:]
            if str(i)[2] in s_:
                cnt += 1  

print(cnt)

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

password = {}
cnt = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            p = s[i] + s[j] + s[k]
            if not p in password.keys():
                password[p] = 0
                cnt += 1
print(cnt)

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

cnt = 0
for i in range(10):
    s_ = s
    if str(0) in s_:
        s_ = s_[s_.index(str(0))+1:]
        if str(0) in s_:
            s_ = s_[s_.index(str(0))+1:]
            if str(i) in s_:
                cnt += 1

for i in range(10,100):
    s_ = s
    if str(0) in s_:
        s_ = s_[s_.index(str(0))+1:]
        if str(i)[0] in s_:
            s_ = s_[s_.index(str(i)[0])+1:]
            if str(i)[1] in s_:
                cnt += 1

for i in range(100,1000):
    s_ = s
    if str(i)[0] in s_:
        s_ = s_[s_.index(str(i)[0])+1:]
        if str(i)[1] in s_:
            s_ = s_[s_.index(str(i)[1])+1:]
            if str(i)[2] in s_:
                cnt += 1  

print(cnt)

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

password = []
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            p = s[i] + s[j] + s[k]
            if not p in password:
                password.append(p)
print(len(password))

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

cnt = 0
for i in range(10):
    s_ = s
    if str(0) in s_:
        s_ = s_[s_.index(str(0))+1:]
        if str(0) in s_:
            s_ = s_[s_.index(str(0))+1:]
            if str(i) in s_:
                cnt += 1

for i in range(10,100):
    s_ = s
    if str(0) in s_:
        s_ = s_[s_.index(str(0))+1:]
        if str(i)[0] in s_:
            s_ = s_[s_.index(str(i)[0])+1:]
            if str(i)[1] in s_:
                cnt += 1

for i in range(100,1000):
    s_ = s
    if str(i)[0] in s_:
        s_ = s_[s_.index(str(i)[0])+1:]
        if str(i)[1] in s_:
            s_ = s_[s_.index(str(i)[1])+1:]
            if str(i)[2] in s_:
                cnt += 1  

print(cnt)