Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans) 


Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
 
 
def solve(c, idx, N, S, ans):
    if len(c)==3:
        ans.append(c)
        return
    if idx >= len(S):
        return
    solve(c+S[idx], idx+1, N, S, ans)
    solve(c, idx+1, N, S, ans)
 
if __name__ == "__main__":
    N = int(input())
    S = input()
    ans = []
    solve("", 0, N, S, ans)
    print(len(set(ans)))

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)


def solve(c, idx, N, S, ans):
    if len(c)==3:
        ans.add(c)
        return
    if idx >= len(S):
        return
    solve(c+S[idx], idx+1, N, S, ans)
    solve(c, idx+1, N, S, ans)

if __name__ == "__main__":
    N = int(input())
    S = input()
    ans = set()
    solve("", 0, N, S, ans)
    print(len(ans))

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)


def solve(c, idx, N, S, ans):
    if len(c)==3:
        ans.add(c)
        return
    if idx >= len(S):
        return
    solve(c+S[idx], idx+1, N, S, ans)
    solve(c, idx+1, N, S, ans)

if __name__ == "__main__":
    N = int(input())
    S = input()
    ans = set()
    solve("", 0, N, S, ans)
    print(len(ans))

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
N = int(input())
S = input()

ans = set()

def solve(c, idx):
    if len(c)==3:
        ans.add(c)
        return
    if idx >= len(S):
        return
    solve(c+S[idx], idx+1)
    solve(c, idx+1)

if __name__ == "__main__":
    solve("", 0)
    print(len(ans))

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
N = int(input())
S = input()

ans = set()

def solve(c, idx):
    if len(c)==3:
        ans.add(c)
    if idx >= len(S):
        return
    solve(c+S[idx], idx+1)
    solve(c, idx+1)

if __name__ == "__main__":
    solve("", 0)
    print(len(ans))

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
N = int(input())
S = input()

ans = set()

def solve(c, idx):
    if len(c)==3:
        ans.add(c)
    if idx >= len(S):
        return
    solve(c+S[idx], idx+1)
    solve(c, idx+1)

if __name__ == "__main__":
    solve("", 0)
    print(len(ans))

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    cnt = 0
    n = str(i).zfill(3)
    for c in S:
        if c == n[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)