Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in s:
            t*=tt
        cnt+=t
print(cnt%((10**9)+7))

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in [x for x in s if x > 1]:
            t*=tt
        cnt+=t
print(cnt%((10**9)+7))

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in [x for x in s if x > 1]:
            t*=tt
        cnt+=t
print(cnt%((10**9)+7))

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy python submission (verdict: Runtime Error):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in [x for x in s if x > 1]:
            t*=tt
        cnt+=t
print(cnt%((10**9)+7)

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

def isUnique(a):
    return len(a) == len(set(a))

master = []
for i in range(N):
    for j in itertools.combinations(S,i+1):
        if isUnique(j):
            master.append(j)
        else:
            continue

print(len(master)%((10**9)+7))


Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

def isUnique(a):
    return len(a) == len(set(a))

master = []
for i in range(N):
    for j in itertools.combinations(S,i+1):
        if isUnique(j):
            master.append(j)
        else:
            continue

print(len(master)%((10**9)+7))

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

master = []
for i in range(N):
    existed = False
    for j in itertools.combinations(S,i+1):
        for a in j:
            if j.count(a) > 1:
                existed=True
                break
        if existed:
            existed = False
            continue
        master.append(j)
print(len(master)%((10**9)+7))

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))