Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())  # len:N

S = sorted(S)  #  アルファベット順に並べ替え
U = [0] * 26  #  ユニーク数数え上げ
tmp = "0"
count = 0
u_count = 0
for i in range(N):
    if i > 0:
        if tmp == S[i]:
            U[count] += 1
        else:
            tmp = S[i]
            count += 1
            U[count] += 1
    else:
        tmp = S[i]
        U[count] += 1


for u in range(26):
    if U[u] != 0:
        u_count += 1


for i in range(len(U)):
    if U[0] == 0:
        U.pop(0)

U = list(map(lambda x:x+1, U))
print(np.array(U).prod()-1)

Fixed submission:
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

N = int(input())
S = list(input())  # len:N

S = sorted(S)  #  アルファベット順に並べ替え
U = [0] * 26  #  ユニーク数数え上げ
tmp = "0"
count = 0
u_count = 0
for i in range(N):
    if i > 0:
        if tmp == S[i]:
            U[count] += 1
        else:
            tmp = S[i]
            count += 1
            U[count] += 1
    else:
        tmp = S[i]
        U[count] += 1


for u in range(26):
    if U[u] != 0:
        u_count += 1

U = sorted(U)

for i in range(len(U)):
    if U[0] == 0:
        U.pop(0)

count = 0

for i in range(1, u_count+1):
    count += np.sum(np.array(list(itertools.combinations(U, i))).prod(axis=1))

a = 10 ** 9 + 7
print(count % a)

Fixed submission:
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

N = int(input())
S = list(input())  # len:N

S = sorted(S)  #  アルファベット順に並べ替え
U = [0] * 26  #  ユニーク数数え上げ
tmp = "0"
count = 0
u_count = 0
for i in range(N):
    if i > 0:
        if tmp == S[i]:
            U[count] += 1
        else:
            tmp = S[i]
            count += 1
            U[count] += 1
    else:
        tmp = S[i]
        U[count] += 1


for u in range(26):
    if U[u] != 0:
        u_count += 1

U = sorted(U)

for i in range(len(U)):
    if U[0] == 0:
        U.pop(0)

count = 0

for i in range(1, u_count+1):
    count += np.sum(np.array(list(map(prod, list(itertools.combinations(U, i))))))

a = 10 ** 9 + 7
print(count % a)


Fixed submission:
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)

Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

N = int(input())
S = list(input())  # len:N

S = sorted(S)  #  アルファベット順に並べ替え
U = [0] * 26  #  ユニーク数数え上げ
tmp = "0"
count = 0
u_count = 0
for i in range(N):
    if i > 0:
        if tmp == S[i]:
            U[count] += 1
        else:
            tmp = S[i]
            count += 1
            U[count] += 1
    else:
        tmp = S[i]
        U[count] += 1


for u in range(26):
    if U[u] != 0:
        u_count += 1

U = sorted(U)

for i in range(len(U)):
    if U[0] == 0:
        U.pop(0)

count = 0

for i in range(1, u_count+1):
    count += np.sum(np.array((map(prod, list(itertools.combinations(U, i))))))

a = 10 ** 9 + 7
print(count % a)

Fixed submission:
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

N = int(input())
S = list(input())  

S = sorted(S)  
U = [0] * 26 
tmp = "0"
count = 0
u_count = 0
for i in range(N):
    if i > 0:
        if tmp == S[i]:
            U[count] += 1
        else:
            tmp = S[i]
            count += 1
            U[count] += 1
    else:
        tmp = S[i]
        U[count] += 1

for u in range(26):
    if U[u] != 0:
        u_count += 1

U = sorted(U)

for i in range(len(U)):
    if U[0] == 0:
        U.pop(0)

count = 0

for i in range(1, u_count+1):
    count += sum(list(map(prod, list(itertools.combinations(U, i)))))

a = 10 ** 9 + 7
print(count % a)

Fixed submission:
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)

Buggy python submission (verdict: Time Limit Exceeded):
def main31():
    import itertools
    import functools
    import operator
    prod = functools.partial(functools.reduce, operator.mul)

    N = int(input())
    S = list(input())  # len:N

    S = sorted(S)  #  アルファベット順に並べ替え
    U = [0] * 26  #  ユニーク数数え上げ
    tmp = "0"
    count = 0
    u_count = 0
    for i in range(N):
        if i > 0:
            if tmp == S[i]:
                U[count] += 1
            else:
                tmp = S[i]
                count += 1
                U[count] += 1
        else:
            tmp = S[i]
            U[count] += 1

    for u in range(26):
        if U[u] != 0:
            u_count += 1

    U = sorted(U)

    for i in range(len(U)):
        if U[0] == 0:
            U.pop(0)

    count = 0

    for i in range(1, u_count+1):
        answer_list = list(itertools.combinations(U, i))
        count += sum(list(map(prod, answer_list)))

    a = 10 **9 + 7
    print(count % a)
main31()

Fixed submission:
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)