Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if (W == x and H == Y):
    res1 = W * H / 2
    res2 = 0
else:
    tate1 = (W - x) * H
    tate2 = x * H 
    tate = min(tate1, tate2)

    yoko1 = W * (H - y)
    yoko2 = W * y
    yoko = min(yoko1, yoko2)

    res1 = max(yoko, tate)
    res2 = int(yoko == tate)

print(res1, res2)

Fixed submission:
W, H, x, y = map(int, input().split())
     
res1 = W * H / 2
res2 = int((2*x == W) and (2*y == H))
     
print(res1, res2)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
   
s = [0 if n-i in a else -1 for i in range(n+1)] 
s[0] = s[1] = 1

for i in range(2, n+1):
    if s[i] == 0:
        continue
    s[i] = (s[i-1] + s[i-2]) % 1000000007

if s[n] < 0:
    print(0)
else:
    print(s[n])

Fixed submission:
p, q, r = map(int, input().split())

a = p + q
b = q + r
c = r + p
print(min(a, b, c))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
for _ in range(m):
    a.append(int(input()))
    
s = [0 if n-i in a else -1 for i in range(n+1)] 
s[0] = s[1] = 1

for i in range(2, n+1):
    if s[i] == 0:
        continue
    s[i] = (s[i-1] + s[i-2]) % 1000000007

print(s[n])

Fixed submission:
p, q, r = map(int, input().split())

a = p + q
b = q + r
c = r + p
print(min(a, b, c))

Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include <bits/stdc++.h> 
using namespace std; 
  
int countValues(int n) 
{ 
    int unset_bits=0; 
    while (n) 
    { 
        if ((n & 1) == 0) 
            unset_bits++; 
        n=n>>1; 
    } 
  
    return 1 << unset_bits; 
} 
  
int main() 
{ 
    int n;
  	cin >> n;
    cout << countValues(n) << endl; 
    return 0; 
} 


Fixed submission:
p, q, r = map(int, input().split())

a = p + q
b = q + r
c = r + p
print(min(a, b, c))

Buggy python submission (verdict: Runtime Error):
#include<iostream>
using namespace std; 
  
int countValues(int n) 
{ 
    int unset_bits=0; 
    while (n) 
    { 
        if ((n & 1) == 0) 
            unset_bits++; 
        n=n>>1; 
    } 
  
    return 1 << unset_bits; 
} 
  
int main() 
{ 
    int n;
  cin >> n;
    cout << countValues(n) << endl; 
    return 0; 
} 


Fixed submission:
p, q, r = map(int, input().split())

a = p + q
b = q + r
c = r + p
print(min(a, b, c))
Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]
    a = set(a)

    s[0] = 1
    s[1] = 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i in a:
            continue
        s[i] = (s[i-1] + s[i-2]) % 1000000007

    print(s[n])

main()

Fixed submission:
def main():
    n, m = map(int, input().split())
    if m != 0:
        a = [int(input()) for _ in range(m)]
        a = set(a)
    else:
        a = set()
    
    s = [0] * (n+1)
    s[0] = 1
    s[1] = 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i in a:
            continue
        s[i] = (s[i-1] + s[i-2]) % 1000000007

    print(s[n])

main()

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
a = set(a)

s[0] = 1
s[1] = 1 if 1 not in a else 0

for i in range(2, n+1):
    if i in a:
        continue
    s[i] = (s[i-1] + s[i-2]) % 1000000007

print(s[n])

Fixed submission:
def main():
    n, m = map(int, input().split())
    if m != 0:
        a = [int(input()) for _ in range(m)]
        a = set(a)
    else:
        a = set()
    
    s = [0] * (n+1)
    s[0] = 1
    s[1] = 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i in a:
            continue
        s[i] = (s[i-1] + s[i-2]) % 1000000007

    print(s[n])

main()

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
a = set(a)

s[0] = 1
s[1] = 1 if n-1 not in a else 0

for i in range(2, n+1):
    if i in a:
        continue
    s[i] = (s[i-1] + s[i-2]) % 1000000007


print(s[n])

Fixed submission:
def main():
    n, m = map(int, input().split())
    if m != 0:
        a = [int(input()) for _ in range(m)]
        a = set(a)
    else:
        a = set()
    
    s = [0] * (n+1)
    s[0] = 1
    s[1] = 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i in a:
            continue
        s[i] = (s[i-1] + s[i-2]) % 1000000007

    print(s[n])

main()
Buggy python submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
S = input()
S += '#'

a = np.zeros(N+1)
b = np.zeros(N+1)
a[A-1] = 1
b[B-1] = 1

for i in range(N-1):
    if a[i] == 1:
        if S[i+1] == '.':
            a[i+1] = 1
        if S[i+2] == '.':
            a[i+2] = 1
    if b[i] == 1:
        if S[i+1] == '.':
            b[i+1] = 1
        if S[i+2] == '.':
            b[i+2] = 1
if C < D:
    # B
    print('Yes' if a[C-1] and b[D-1] else 'No')
else:
    print('Yes' if a[C-1] and b[D-1] and '...' in S else 'No')

Fixed submission:
N, A, B, C, D = map(int, input().split())
S = input()

if '##' in S[A-1:max(C, D)]:
    print('No')
elif C < D:
    print('Yes')
else:
    print('Yes' if '...' in S[B-2:D+1] else 'No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
for i in range(N):
    s, p = input().split()
    p = -int(p)
    a.append(s, p , i + 1)
    
a.sort()

print('\n'.join(str(ai[2]) for ai in a))

Fixed submission:
a, p = map(int, input().split())
print(int((3*a+p)/2))

Buggy python submission (verdict: Runtime Error):
a, p = map(int(), input().split())
print(int((3*a+p)/2))

Fixed submission:
a, p = map(int, input().split())
print(int((3*a+p)/2))

Buggy python submission (verdict: Runtime Error):
a, p = map(int(), input().split())

print(int((a * 3 + p) / 2))

Fixed submission:
a, p = map(int, input().split())
print(int((3*a+p)/2))

Buggy python submission (verdict: Runtime Error):
a, p = map(int(), input())

print((a*3 + p) // 2)

Fixed submission:
a, p = map(int, input().split())
print(int((3*a+p)/2))

Buggy python submission (verdict: Runtime Error):
a, p = map(int(), input().split())

ans = (a * 3 + p) // 2

print("{}".format(ans))

Fixed submission:
a, p = map(int, input().split())
print(int((3*a+p)/2))
Buggy python submission (verdict: Time Limit Exceeded):
def two_input():
    return map(int, input().split())

N, M = two_input()
LR = [list(two_input()) for i in range(M)]

cnt = 0
for i in range(1, N+1):
    cnt += 1
    for j in range(M):
        if LR[j][0] > i or LR[j][1] < i:
            cnt -= 1
            break

print(cnt)

Fixed submission:
def two_input():
    return map(int, input().split())

N, M = two_input()
L, R = [], []
for i in range(M):
    l, r = two_input()
    L.append(l)
    R.append(r)
    
maxl = max(L)
minr = min(R)

ans = 0
for i in range(N):
    if maxl <= i+1 <= minr:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0

for g in range(N//G+1):
    for b in range(N//B+1):
        s = N-g*G-b*B
        if s>=0 and s%R == 0:
            ans += 1

print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0

for g in range(N//G+1):
    for b in range(N//B+1):
        s = N-g*G-b*B
        if s < 0:
            break
        if s%R == 0:
            ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R+1):
    if i * R > N:
        break
    for j in range(N//G+1):
        if i * R + j * G > N:
            break
        for k in range(N//B+1):
            if i * R + j * G + B * k > N:
                break
            if i * R + j * G + B * k == N:
                ans += 1
                
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0

for g in range(N//G+1):
    for b in range(N//B+1):
        s = N-g*G-b*B
        if s < 0:
            break
        if s%R == 0:
            ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N+1):
    if i * R > N:
        break
    for j in range(N+1):
        if i * R + j * G > N:
            break
        for k in range(N+1):
            if i * R + j * G + B * k > N:
                break
            if i * R + j * G + B * k == N:
                ans += 1
                
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0

for g in range(N//G+1):
    for b in range(N//B+1):
        s = N-g*G-b*B
        if s < 0:
            break
        if s%R == 0:
            ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N+1):
    for j in range(N+1):
        for k in range(N+1):
            if i * R + j * G + B * k == N:
                ans += 1
                
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0

for g in range(N//G+1):
    for b in range(N//B+1):
        s = N-g*G-b*B
        if s < 0:
            break
        if s%R == 0:
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
def solve():
    N = input()
    a = ['']
    for i in input().split():
        a.inser(int(i)-1, i)
    return *a[-1]and[-1]or a

print(solve())

Fixed submission:
from queue import Queue

def solve():
    N = int(input())
    b = list(map(int, input().split()))
    idx = [i+1 for i in reversed(range(N))]
    
    l = []
    for i in range(N):
        for bi, j in zip(reversed(b), idx):
            if j == bi:
                l.append(str(j))
                break
        del idx[0], b[j-1]
    
    return '\n'.join(reversed(l)) if len(l) == N else -1

print(solve())

Buggy python submission (verdict: Runtime Error):
def solve()
    N = input()
    a = ['']
    for i in input().split():
        a.inser(int(i)-1, i)
    return *a[-1]and[-1]or a

print(solve())

Fixed submission:
from queue import Queue

def solve():
    N = int(input())
    b = list(map(int, input().split()))
    idx = [i+1 for i in reversed(range(N))]
    
    l = []
    for i in range(N):
        for bi, j in zip(reversed(b), idx):
            if j == bi:
                l.append(str(j))
                break
        del idx[0], b[j-1]
    
    return '\n'.join(reversed(l)) if len(l) == N else -1

print(solve())
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

def II(): return int(input())
def LII(): return list(map(int, input().split()))

N = II()
A = LII()
A = np.array(A)

if sum(A % 2) == 0:
    print(min(A))
else:
    a = min(A)
    AA = np.array(A)

    while True:
        AA = AA % a
        if len(AA[AA > 0]) > 0:
            a = min(AA[AA > 0])
        else:
            break
    A %= a
    print(min(A[A>0]))

Fixed submission:
import numpy as np
import fractions
import sys
readline = sys.stdin.readline
read = sys.stdin.read

def II(): return int(input())
def LII(): return list(map(int, input().split()))

N = II()
A = LII()

b = min(A)
for a in A:
    b = fractions.gcd(a, b)
print(b)
Buggy python submission (verdict: Runtime Error):
if M <= N:
    print(0)
else:
    X.sort()
    L = []
    for i in range(M-1):
        L.append(X[i+1] - X[i])
    L.sort(reverse=True)
    print(X[-1]-X[0]-sum(L[:N-1]))

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))

if M <= N:
    print(0)
else:
    X.sort()
    L = []
    for i in range(M-1):
        L.append(X[i+1] - X[i])
    L.sort(reverse=True)
    print(X[-1]-X[0]-sum(L[:N-1]))
Buggy python submission (verdict: Runtime Error):
def solve():
    N, P = map(int, input().split())
    
    ans = 1
    if n==1:
        return P
    else:
        for i in range(2, int(P**(1/N)+1)):
            while P % (i**N) == 0:
                ans *= i
                P //= (i**N)
        return ans
print(solve())

Fixed submission:
def solve():
    N, P = map(int, input().split())
    
    ans = 1
    if N==1:
        return P
    else:
        for i in range(2, int(P**(1/N)+1)):
            while P % (i**N) == 0:
                ans *= i
                P //= (i**N)
        return ans
print(solve())
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

cnt = 0
while 'BW' in S:
    S = S.replace('BW', 'WB', 1)
    cnt += 1

print(cnt)

Fixed submission:
S = input()
b = 0
ans = 0

for s in S:
    if s == 'B':
        b += 1
    else:
        ans += b

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 1
mn = np.inf
for i, h in enumerate(H):
    if mn > abs(A - (T - h * 0.006)):
        ans = i+1
        mn = abs(A - (T - h * 0.006))
print(ans)

Fixed submission:
import numpy as np

N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 1
mn = np.inf
for i, h in enumerate(H):
    if mn > abs(A - (T - h * 0.006)):
        ans = i+1
        mn = abs(A - (T - h * 0.006))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()

    lcmn = lcm(N, M)
    l = ['' for i in range(lcmn+1)]
    for i in range(0, N):
        l[(lcmn//N)*i+1] = S[i]

    for i in range(0, M):
        if l[(lcmn//M)*i+1] != '' and l[(lcmn//M)*i+1] != T[i]:
            return -1

    return lcmn

print(main())

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()

    L = lcm(N, M)
    ln = L//N
    lm = L//M
    n = {1+i*ln: s for i, s in enumerate(S)}
    m = {1+i*lm: t for i, t in enumerate(T)}
    
    for k in set(n.keys()).intersection(set(m.keys())):
        if n[k] != m[k]:
            return -1

    return L

print(main())
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n//2)
else:
    c1 = Counter(v[0::2])
    c2 = Counter(v[1::2])
    
    c1m = c1.most_common(1)[0]
    c2m = c2.most_common(1)[0]
    
    ans1 = n//2-c2m[1]
    if c1m[0] != c2m[0]:
        ans1 += n//2-c1m[1]
    else:
        ans1 += n//2-c1.most_common(2)[1][1]
    
    ans2 += n//2-c1m[1]
    if c1m[0] != c2m[0]:
        ans2 += n//2-c2m[1]
    else:
        ans2 += n//2-c2.most_common(2)[1][1]
    print(min(ans1, ans2))

Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n//2)
else:
    c1 = Counter(v[0::2])
    c2 = Counter(v[1::2])
    
    c1m = c1.most_common(2)
    c2m = c2.most_common(2)
    
    if c1m[0][0] != c2m[0][0]:
        print(n-c1m[0][1]-c2m[0][1])
    else:
        mn = n
        if len(set(c1)) > 1:
            mn = min(mn, n-c1m[1][1]-c2m[0][1])
        if len(set(c2)) > 1:
            mn = min(mn, n-c1m[0][1]-c2m[1][1])
            
        print(mn)

Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n//2)
else:
    c1 = Counter(v[0::2])
    c2 = Counter(v[1::2])
    
    c1m = c1.most_common(1)[0]
    c2m = c2.most_common(1)[0]
    
    ans1 = n//2-c2m[1]
    if c1m[0] != c2m[0]:
      ans1 += n//2-c1m[1]
      else:
        ans1 += n//2-c1.most_common(2)[1][1]
    
    ans2 += n//2-c1m[1]
    if c1m[0] != c2m[0]:
      ans2 += n//2-c2m[1]
      else:
        ans2 += n//2-c2.most_common(2)[1][1]
    print(min(ans1, ans2))

Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n//2)
else:
    c1 = Counter(v[0::2])
    c2 = Counter(v[1::2])
    
    c1m = c1.most_common(2)
    c2m = c2.most_common(2)
    
    if c1m[0][0] != c2m[0][0]:
        print(n-c1m[0][1]-c2m[0][1])
    else:
        mn = n
        if len(set(c1)) > 1:
            mn = min(mn, n-c1m[1][1]-c2m[0][1])
        if len(set(c2)) > 1:
            mn = min(mn, n-c1m[0][1]-c2m[1][1])
            
        print(mn)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from functools import reduce

def gcd(*numbers):
    return reduce(np.gcd, numbers)

N, X = map(int, input().split())
x = np.array(list(map(int, input().split())))
if N == 1:
    print(np.abs(x[0] - X))
else:
    x = np.abs(x - X)
    print(min(gcd(x)))

Fixed submission:
import numpy as np
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

N, X = map(int, input().split())
x = np.array(list(map(int, input().split())))
if N == 1:
    print(np.abs(x[0] - X))
else:
    x = np.abs(x - X)
    print(gcd(x))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X = map(int, input().split())
x = np.array(list(map(int, input().split())))
if N == 1:
    print(np.abs(x[0] - X))
else:
    x = np.abs(x - X)
    print(min(gcd(x)))

Fixed submission:
import numpy as np
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

N, X = map(int, input().split())
x = np.array(list(map(int, input().split())))
if N == 1:
    print(np.abs(x[0] - X))
else:
    x = np.abs(x - X)
    print(gcd(x))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

if A.index(1) + N - A.index(1) - 1 < K:
    print(1)
else:
    print(int(np.ceil(A.index(1)/(K-1))+np.ceil((N - A.index(1) - 1)/(K-1))))

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
print((N-2)//(K-1)+1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
for ai in A:
    if ai % 2 == 0:
        while ai != 1:
            ai /= 2
            ans += 1
print(ans)

Fixed submission:
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

m = defaultdict(int)

ans = 0
for ai in A:
    if ai % 2 == 0:
        while ai % 2 == 0:
            ai //= 2
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
X = int(input())

e = [0 for _ in range(X+1)]
e[1] = 1
for i in range(2, X):
    v = i*i
    while v <= X:
        e[v] = 1
        v *= b
        
for i in range(X, 0, -1):
    if e[i] == 1:
        print(i)
        break

Fixed submission:
X = int(input())

e = [0 for _ in range(X+1)]
e[1] = 1
for i in range(2, X):
    v = i*i
    while v <= X:
        e[v] = 1
        v *= i
        
for i in range(X, 0, -1):
    if e[i] == 1:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter

N = int(input())
X = list(map(int, input().split()))
Xs = sorted(X)
c1 = np.median(Xs[1:]).astype(int)
c2 = np.median(Xs[:-1]).astype(int)

for i in range(N):
    if Xs.index(X[i]) < N // 2:
        print(c1)
    else:
        print(c2)

Fixed submission:
import numpy as np

N = int(input())
X = list(map(int, input().split()))
Xs = sorted(X)
c1 = np.median(Xs[1:]).astype(int)
c2 = np.median(Xs[:-1]).astype(int)

for i in range(N):
    if X[i] < c1:
        print(c1)
    else:
        print(c2)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter

N = int(input())
X = list(map(int, input().split()))

for i in range(N):
    print(np.median(X[:i] + X[i+1:]).astype(int))

Fixed submission:
import numpy as np

N = int(input())
X = list(map(int, input().split()))
Xs = sorted(X)
c1 = np.median(Xs[1:]).astype(int)
c2 = np.median(Xs[:-1]).astype(int)

for i in range(N):
    if X[i] < c1:
        print(c1)
    else:
        print(c2)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for i in range(A, B+1):
    if (A <= i and i <= A+K-1) or (B-K+1<= i and i <= B):
        print(i)

Fixed submission:
A, B, K = map(int, input().split())

# for i in range(A, B+1):
#     if (A <= i and i <= A+K-1) or (B-K+1<= i and i <= B):
#         print(i)

S=set()

for i in range(A, min(B+1, A+K)):
    S.add(i)
for i in range(max(A, B-K+1), B+1):
    S.add(i)
for k in sorted(S):
    print(k)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

if A == B:
    print(A)
else:
    for i in range(A, B+1):
        if A <= i <= A+K-1 or B-K+1<= i <= B:
            print(i)

Fixed submission:
A, B, K = map(int, input().split())

# for i in range(A, B+1):
#     if (A <= i and i <= A+K-1) or (B-K+1<= i and i <= B):
#         print(i)

S=set()

for i in range(A, min(B+1, A+K)):
    S.add(i)
for i in range(max(A, B-K+1), B+1):
    S.add(i)
for k in sorted(S):
    print(k)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for i in range(A, B+1):
    if A <= i <= A+K-1 or B-K+1<= i <= B:
        print(i)

Fixed submission:
A, B, K = map(int, input().split())

# for i in range(A, B+1):
#     if (A <= i and i <= A+K-1) or (B-K+1<= i and i <= B):
#         print(i)

S=set()

for i in range(A, min(B+1, A+K)):
    S.add(i)
for i in range(max(A, B-K+1), B+1):
    S.add(i)
for k in sorted(S):
    print(k)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools
from functools import reduce
from collections import defaultdict

N = int(input())
d = defaultdict(int)
for i in range(N):
    c = input()
    if c[0] in ('M', 'A', 'R', 'C', 'H'):
        d[c[0]] += 1

l = len(d)
if l < 3:
    print(0)
else:
    ans = 0
    for l in list(itertools.combinations(d.values(), 3)):
        ans += reduce(np.multiply, l)
    print(ans)

Fixed submission:
import numpy as np
from itertools import combinations
from functools import reduce
from collections import defaultdict

N = int(input())
d = defaultdict(int)
for i in range(N):
    c = input()
    if c[0] in ('M', 'A', 'R', 'C', 'H'):
        d[c[0]] += 1

l = len(d)
if l < 3:
    print(0)
else:
    ans = 0
    for l in list(combinations(d.values(), 3)):
        ans += reduce(np.multiply, l)
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
l = len(N)

s = '9'*(l-1)
if N[i::] == s:
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Fixed submission:
N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Buggy python submission (verdict: Runtime Error):
N = input()
l = len(N)

if N[i::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Fixed submission:
N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Buggy python submission (verdict: Runtime Error):
N = input()
l = len(N)

if N[i::] == "9"*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Fixed submission:
N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Buggy python submission (verdict: Runtime Error):
N = input()

l = len(N)

if N[i::] == "9"*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Fixed submission:
N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Buggy python submission (verdict: Runtime Error):
N = input()
l = len(N)

if n[i::] == "9"*(l-1):
    print(int(n[0])+9*(l-1))
else:
    print(int(n[0])-1+9*(l-1))

Fixed submission:
N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

Buggy python submission (verdict: Runtime Error):
N = input()

l = len(N)
j = "9"*(l-1)

if n[i::] == j:
    print(int(n[0])+9*(n-1))
else:
    print(int(n[0])-1+9*(k-1))

Fixed submission:
N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))