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

# 100の位
for i in range(10):
    # Sのn-2番目までにiがあるか
    now_i = -1
    for a in range(n-2):
        if s[a] == str(i):
            now_i = a
            break
    # 作れない場合以降の探索は打ち切り
    if now_i == -1:
        continue
    # 10の位
    for j in range(10):
        now_j = -1
        for b in range(now_i+1,n-1):
            if s[b] == str(j):
                now_j = b
                break
        if now_j == -1:
            continue
        # 1の位
        for k in range(10):
            for c in range(now_j+1,n):
                # 暗証番号がそろった
                if s[c] == str(k):
                    point += 1
                    break

print(point)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

n = int(input())
s = input()
point = 0

# 100の位
for i in range(10):
    # Sのn-2番目までにiがあるか
    now_i = -1
    for a in range(n-2):
        if s[a] == str(i):
            now_i = a
            break
    # 作れない場合以降の探索は打ち切り
    if now_i == -1:
        continue
    # 10の位
    for j in range(10):
        now_j = -1
        for b in range(now_i+1,n-1):
            if s[b] == str(j):
                now_j = b
                break
        if now_j == -1:
            continue
        # 1の位
        for k in range(10):
            for c in range(now_j+1,n):
                # 暗証番号がそろった
                if s[c] == str(k):
                    point += 1
                    break

print(point)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

n = int(input())
s = input()
point = 0

# 暗証番号を全探索する
@lru_cache(maxsize=None)
def count(i):
    t = str(i).zfill(3)
    now = 0
    # sで暗証番号が作れるかを検証
    for j in s:
        if j == t[now]:
            now += 1
        if now == 3:
            break
    if now == 3:
        return 1
    else:
        return 0

for i in range(1000):
    point += count(i)

print(point)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

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

# ラッキーナンバーを全探索する
for i in range(1000):
    t = str(i).zfill(3)
    now = 0
    # sでラッキーナンバーが作れるかを検証
    for j in s:
        if j == t[now]:
            now += 1
        if now == 3:
            point += 1
            break

print(point)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
point = 0
for i in range(1000):
    bango = str(i).zfill(3)
    count = 0
    for j in range(n):
        if s[j] == bango[count]:
            count += 1
        if count == 3:
            point += 1
            break
print(point)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from math import factorial
from itertools import combinations

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
s = [int(i) for i in s]

lin = list(combinations(s, 3))

lin = list(set(lin))

print(len(lin))

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

def count(poi):
    point = 0
    for i in range(poi):
        bango = str(i).zfill(3)
        count = 0
        for j in range(n):
            if s[j] == bango[count]:
                count += 1
            if count == 3:
                point += 1
                break
    return point

print(count(1000))