Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

if __name__ == '__main__':
    solve()

Fixed submission:
def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = int(input())
count = 0
for i in range(0,1000):
    num = [i//100, (i//10)%10, i%10]
    digit = 0
    for j in range(N):
        if S[j] == num[digit]:
            digit += 1
        if digit == 3:
            break
    else:
        continue
    count += 1

print(count)

Fixed submission:
def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
for i in range(0,1000):
    num = str(i).zfill(3)
    digit = 0
    for j in range(N):
        if S[j] == num[digit]:
            digit += 1
        if digit == 3:
            break
    else:
        continue
    count += 1

print(count)

Fixed submission:
def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
for i in range(0,1000):
    num = str(i).zfill(3)
    for j in range(N):
        for k in range(j+1, N):
            for l in range(k+1, N):
                if num == S[j]+ S[k]+S[l]:
                    count += 1
                    break
            else:
                continue
            break
        else:
            continue
        break
print(count)

Fixed submission:
def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
for i in range(0,1000):
    num = str(i).zfill(3)
    for j in range(N):
        for k in range(j+1, N):
            for l in range(k+1, N):
                if num == S[j]+ S[k]+S[l]:
                    count += 1
                    break
            else:
                continue
            break
        else:
            continue
        break
print(count)

Fixed submission:
def solve():
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        num = str(i).zfill(3)
        digit = 0
        for j in range(N):
            if S[j] == num[digit]:
                digit += 1
            if digit == 3:
                break
        if digit ==3:
            count += 1

    print(count)

if __name__ == '__main__':
    solve()