Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = [int(c) for c in input()]
table = list(range(10))

count = 0
for p in itertools.product(table, repeat=3): # 重複を許して1~9の数値を３つならべる
    target = list(p)

    flag = False
    for i_1 in range(N-2):
        if S[i_1] == target[0]: # 1つ目の数字があったら次へ
            for i_2 in range(i_1+1, N-1):
                if S[i_2] == target[1]:
                    for i_3 in range(i_2+1, N):
                        if S[i_3] == target[2]:
                            count += 1
                            flag = True
                            break
                    
                    if flag:
                        break
            if flag:
                break

print(count)

Fixed submission:
def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = [int(c) for c in input()]
table = list(range(10))

count = 0
for p in itertools.product(table, repeat=3): # 重複を許して1~9の数値を３つならべる
    target = list(p)

    flag = False
    for i_1 in range(N-2):
        if S[i_1] == target[0]: # 1つ目の数字があったら次へ
            for i_2 in range(i_1+1, N-1):
                if S[i_2] == target[1]:
                    for i_3 in range(i_2+1, N):
                        if S[i_3] == target[2]:
                            count += 1
                            flag = True
                            break
                    
                    if flag:
                        break
            if flag:
                break

print(count)

Fixed submission:
def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [int(c) for c in input()]

answer_set = set()
for i_1 in range(N-2):
    for i_2 in range(i_1+1, N-1):
        for i_3 in range(i_2+1, N):
            password = (S[i_1], S[i_2], S[i_3])
            answer_set.add(password)
            
answer = len(answer_set)
print(answer)

Fixed submission:
def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [int(c) for c in input()]

answer_set = set()
for i_1 in range(N-2):
    for i_2 in range(i_1+1, N-1):
        for i_3 in range(i_2+1, N):
            password = (S[i_1], S[i_2], S[i_3])
            answer_set.add(password)
            
answer = len(answer_set)
print(answer)

Fixed submission:
def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = input()
delete_length = N - 3
pass_dict = {}

count = 0
for c in itertools.combinations(range(N), delete_length):
    pass_word = ''
    for i in range(N):
        if i not in c:
            pass_word = pass_word + S[i]
    
    if pass_word not in pass_dict:
        pass_dict[pass_word] = 1
        count += 1

print(count)

Fixed submission:
def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = input()
delete_length = N - 3
pass_dict = {}

for c in itertools.combinations(range(N), delete_length):
    pass_word = ''
    for i in range(N):
        if i not in c:
            pass_word = pass_word + S[i]
    
    if pass_word not in pass_dict:
        pass_dict[pass_word] = 1
        
print(len(pass_dict))

Fixed submission:
def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)