Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
 
cnt = []
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            s = S[i] + S[j] + S[k]
            cnt.append(s)

print(len(set(cnt)))

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
 
cnt = []
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            S = ''.join([s[i], s[j], s[k]])
            cnt.append(S)

print(len(set(cnt)))

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
 
cnt = [0] * 1000
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            S = ''.join([s[i], s[j], s[k]])
            cnt[int(S)] += 1
 
ans = 0
for i in range(len(cnt)):
    if cnt[i] > 0:
        ans += 1
print(ans)

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))

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

cnt = 0
for i in range(1000):
    c = [str(int(i/100)), str(int((i/10)%10)), str(int(i%10))]
    f = 0
    for j in range(n):
        if s[j] == c[f]:
            f += 1
        if f == 3:
            break
    if f == 3:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
s = [int(s[i]) for i in range(n)]

cnt = 0
for i in range(1000):
    c = [int(i/100), int((i/10)%10), int(i%10)]
    f = 0
    for j in range(n):
        if s[j] == c[f]:
            f += 1
        if f == 3:
            break
    if f == 3:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))

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

cnt = [0] * 1000
l = len(s)
for i in range(l-2):
    for j in range(i+1, l-1):
        for k in range(j+1, l):
            S = ''.join([s[i], s[j], s[k]])
            cnt[int(S)] += 1

ans = 0
for i in range(len(cnt)):
    if cnt[i] > 0:
        ans += 1
print(ans)

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))

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

cnt = [0] * 1000
for i in range(len(s)-2):
    for j in range(i+1, len(s)-1):
        for k in range(j+1, len(s)):
            S = ''.join([s[i], s[j], s[k]])
            cnt[int(S)] += 1

ans = 0
for i in range(len(cnt)):
    if cnt[i] > 0:
        ans += 1
print(ans)

Fixed submission:
N = int(input())
S = list(input())
PIN = []
b1 = []
for i in range(N-2):
    b2 = []
    if S[i] in b1:
        continue
    else:
        b1.append(S[i])
    for j in range(i+1, N-1):
        b3 = []
        if S[j] in b2:
            continue
        else:
            b2.append(S[j])
        for k in range(j+1, N):
            if S[k] in b3:
                continue
            else:
                b3.append(S[k])
            cand = S[i] + S[j] + S[k]
            PIN.append(cand)

print(len(set(PIN)))