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

passwords =[]

a_log=[]
ab_log=[]

for a in range(n-2):
    
    is_a_kaburi = 0
    
    for i in a_log:
        
        if i == s[a]:
            is_a_kaburi = 1
            
    if is_a_kaburi == 0:
        
        a_log.append(s[a])
        
        for b in range(a+1,n-1):
            
            is_ab_kaburi = 0
            
            for i in ab_log:
                
                if i == s[a]+s[b]:
                    is_ab_kaburi = 1
                    
            if is_ab_kaburi == 0:
                
                ab_log.append(s[a]+s[b])
    
                for c in range(b+1,n):
                    
                    is_abc_kaburi = 0
                    pw = s[a] + s[b] + s[c] 
                    
                    for i in passwords:
                
                        if i == pw:
                            is_abc_kaburi = 1
                            
                    if is_abc_kaburi == 0:
                        passwords.append(pw)
    
                        
                        # print(pw, is_a_kaburi, is_ab_kaburi)

print(len(passwords))

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

score = 0

for p in range(1000):
    
    pw = str(p).zfill(3)
    
    start = 0
    n_match = 0
    
    for j in range(3):
        for i in range(start, len(s)):
            
            if s[i] == pw[j]:
                start = i+1
                n_match = n_match+1
                
                if j == 3-1:
                    # print(pw)
                    score = score+1
                
                break
        if n_match <= j:
            break
            
print(score)

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

passwords =[]

a_log=[]
ab_log=[]

for a in range(n-2):
    
    is_a_kaburi = 0
    
    for i in a_log:
        
        if i == s[a]:
            is_a_kaburi = 1
            
    if is_a_kaburi == 0:
        
        a_log.append(a)
        
        for b in range(a+1,n-1):
            
            is_ab_kaburi = 0
            
            for i in ab_log:
                
                if i == s[a]+s[b]:
                    is_ab_kaburi = 1
                    
            if is_ab_kaburi == 0:
                
                ab_log.append(a+b)
    
                for c in range(b+1,n):
                    
                    is_abc_kaburi = 0
                    pw = s[a] + s[b] + s[c] 
                    
                    for i in passwords:
                
                        if i == pw:
                            is_abc_kaburi = 1
                            
                    if is_abc_kaburi == 0:
                        passwords.append(pw)
    
                        
                        # print(pw, is_a_kaburi, is_ab_kaburi)

print(len(passwords))

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

score = 0

for p in range(1000):
    
    pw = str(p).zfill(3)
    
    start = 0
    n_match = 0
    
    for j in range(3):
        for i in range(start, len(s)):
            
            if s[i] == pw[j]:
                start = i+1
                n_match = n_match+1
                
                if j == 3-1:
                    # print(pw)
                    score = score+1
                
                break
        if n_match <= j:
            break
            
print(score)

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

passwords =[]

a_log=[]
ab_log=[]

for a in range(n-2):
    
    is_a_kaburi = 0
    
    for i in a_log:
        
        if i == s[a]:
            is_a_kaburi = 1
            
    if is_a_kaburi == 0:
        
        a_log.append(a)
        
        for b in range(a+1,n-1):
            
            is_ab_kaburi = 0
            
            for i in ab_log:
                
                if i == s[a]+s[b]:
                    is_ab_kaburi = 1
                    
            if is_ab_kaburi == 0:
                
                ab_log.append(a+b)
    
                for c in range(b+1,n):
                    
                    pw = s[a] + s[b] + s[c] 
                    passwords.append(pw)
                    passwords = list(set(passwords))
                    
                    # print(pw, is_a_kaburi, is_ab_kaburi)

print(len(passwords))

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

score = 0

for p in range(1000):
    
    pw = str(p).zfill(3)
    
    start = 0
    n_match = 0
    
    for j in range(3):
        for i in range(start, len(s)):
            
            if s[i] == pw[j]:
                start = i+1
                n_match = n_match+1
                
                if j == 3-1:
                    # print(pw)
                    score = score+1
                
                break
        if n_match <= j:
            break
            
print(score)

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

passwords =[]

for a in range(n-2):
    for b in range(a+1,n-1):
        for c in range(b+1,n):
            
            pw = s[a] + s[b] + s[c] 
            passwords.append(pw)
            passwords = list(set(passwords))
            
            # print(pw)

print(len(passwords))

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

score = 0

for p in range(1000):
    
    pw = str(p).zfill(3)
    
    start = 0
    n_match = 0
    
    for j in range(3):
        for i in range(start, len(s)):
            
            if s[i] == pw[j]:
                start = i+1
                n_match = n_match+1
                
                if j == 3-1:
                    # print(pw)
                    score = score+1
                
                break
        if n_match <= j:
            break
            
print(score)

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

passwords =[]

for a in range(n-2):
    for b in range(a+1,n-1):
        for c in range(b+1,n):
            
            pw = s[a] + s[b] + s[c] 
            passwords.append(pw)
            
            # print(pw)
passwords = list(set(passwords))
print(len(passwords))

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

score = 0

for p in range(1000):
    
    pw = str(p).zfill(3)
    
    start = 0
    n_match = 0
    
    for j in range(3):
        for i in range(start, len(s)):
            
            if s[i] == pw[j]:
                start = i+1
                n_match = n_match+1
                
                if j == 3-1:
                    # print(pw)
                    score = score+1
                
                break
        if n_match <= j:
            break
            
print(score)