Buggy python submission (verdict: Runtime Error):
from sys import stdin
from itertools import combinations
from math import factorial

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = [0]*n

for i in range(len(lin)):
    if li[i][0] == "M":
        lin[0] += 1
    elif li[i][0] == "A":
        lin[1] += 1
    elif li[i][0] == "R":
        lin[2] += 1
    elif li[i][0] == "C":
        lin[3] += 1
    elif li[i][0] == "H":
        lin[4] += 1

from itertools import combinations
lis = list(combinations(lin, 3))


point = 0
for i in lis:
    point += i[0]*i[1]*i[2]

print(point)

Fixed submission:
from sys import stdin
from itertools import combinations
from math import factorial

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = [0]*5

for i in range(len(li)):
    if li[i][0] == "M":
        lin[0] += 1
    elif li[i][0] == "A":
        lin[1] += 1
    elif li[i][0] == "R":
        lin[2] += 1
    elif li[i][0] == "C":
        lin[3] += 1
    elif li[i][0] == "H":
        lin[4] += 1
        
lis = list(combinations(lin, 3))

point = 0
for i in lis:
    point += i[0]*i[1]*i[2]

print(point)

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

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = []

for i in range(n):
    if li[i][0] in "MARCH":
        lin.append(li[i][0])

liv = list(combinations(lin, 3))
point = 0
for i in liv:
    if i[0] != i[1] and i[0] != i[2] and i[2] != i[1]:
        point += 1
print(point)

Fixed submission:
from sys import stdin
from itertools import combinations
from math import factorial

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = [0]*5

for i in range(len(li)):
    if li[i][0] == "M":
        lin[0] += 1
    elif li[i][0] == "A":
        lin[1] += 1
    elif li[i][0] == "R":
        lin[2] += 1
    elif li[i][0] == "C":
        lin[3] += 1
    elif li[i][0] == "H":
        lin[4] += 1
        
lis = list(combinations(lin, 3))

point = 0
for i in lis:
    point += i[0]*i[1]*i[2]

print(point)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import numpy as np
import math
from math import factorial
from itertools import combinations

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = []

for i in range(n):
    if li[i][0] in "MARCH":
        lin.append(li[i][0])

liv = list(combinations(lin, 3))
point = 0
for i in liv:
    if i[0] != i[1] and i[0] != i[2] and i[2] != i[1]:
        point += 1
print(point)

Fixed submission:
from sys import stdin
from itertools import combinations
from math import factorial

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = [0]*5

for i in range(len(li)):
    if li[i][0] == "M":
        lin[0] += 1
    elif li[i][0] == "A":
        lin[1] += 1
    elif li[i][0] == "R":
        lin[2] += 1
    elif li[i][0] == "C":
        lin[3] += 1
    elif li[i][0] == "H":
        lin[4] += 1
        
lis = list(combinations(lin, 3))

point = 0
for i in lis:
    point += i[0]*i[1]*i[2]

print(point)

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

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = []

for i in range(n):
    if li[i][0] in "MARCH":
        lin.append(li[i][0])

liv = list(combinations(lin, 3))
point = 0
for i in liv:
    if i[0] != i[1] and i[0] != i[2] and i[2] != i[1]:
        point += 1
print(point)

Fixed submission:
from sys import stdin
from itertools import combinations
from math import factorial

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = [0]*5

for i in range(len(li)):
    if li[i][0] == "M":
        lin[0] += 1
    elif li[i][0] == "A":
        lin[1] += 1
    elif li[i][0] == "R":
        lin[2] += 1
    elif li[i][0] == "C":
        lin[3] += 1
    elif li[i][0] == "H":
        lin[4] += 1
        
lis = list(combinations(lin, 3))

point = 0
for i in lis:
    point += i[0]*i[1]*i[2]

print(point)