Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for i in range(10):
    for x in range(n):
        if (i==int(s[x])):
            for j in range(10):
                for y in range(x+1,n):
                    if (j==int(s[y])):
                        for k in range(10):
                            for z in range(y+1,n):
                                if (k==int(s[z])):
                                    ans += 1
                                    break
                        break
            break
        

print(ans)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    for x in range(n):
        if (i==int(s[x])):
            for j in range(10):
                for y in range(x+1,n):
                    if (j==int(s[y])):
                        for k in range(10):
                            for z in range(y+1,n):
                                if (k==int(s[z])):
                                    ans += 1
                                    break
                        break
            break
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            search = i
            c = 0
            for l in range(n):
                if (search==int(s[l])):
                    if (c==0):
                        search = j
                        c = 1
                        
                    elif (c==1):
                        search = k
                        c = 2
                        
                    else:
                        #print(i,j,k)
                        ans += 1
                        break
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    for x in range(n):
        if (i==int(s[x])):
            for j in range(10):
                for y in range(x+1,n):
                    if (j==int(s[y])):
                        for k in range(10):
                            for z in range(y+1,n):
                                if (k==int(s[z])):
                                    ans += 1
                                    break
                        break
            break
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            search = i
            c = 0
            for l in range(n):
                if (search==int(s[l])):
                    if (c==0):
                        search = j
                        c = 1
                        
                    elif (c==1):
                        search = k
                        c = 2
                        
                    else:
                        #print(i,j,k)
                        ans += 1
                        break
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(10):
    for x in range(n):
        if (i==int(s[x])):
            for j in range(10):
                for y in range(x+1,n):
                    if (j==int(s[y])):
                        for k in range(10):
                            for z in range(y+1,n):
                                if (k==int(s[z])):
                                    ans += 1
                                    break
                        break
            break
        

print(ans)