Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from functools import reduce

n,k = map(int, input().split())
a = list(map(int, input().split()))
acc = [0] + list(accumulate(a))
be = set()
# print(acc)
for i in range(n):
    for j in range(i+1,n+1):
        if acc[j] - acc[i] not in be:
            be.add(acc[j] - acc[i])
# print(be)
be = list(be)
mx = max(be)
# print(bin(mx))
bin_dic = {i:[] for i in range(len(str(bin(mx)))-2)}
# print(binary)
for b in be:
    for i,c in enumerate(str(bin(b))[-1:1:-1]):
        if c == '1':
            bin_dic[i].append(b)
mx_bin = 0
for i in bin_dic.keys():
    if k <= len(bin_dic[i]) and mx_bin < i:
        mx_bin = i
cands = set(bin_dic[mx_bin])
for i in range(mx_bin)[::-1]:
    tmp = set(bin_dic[i]) & cands
    if len(tmp) == k:
        cands = tmp
        break
    elif len(tmp) > k:
        cands = tmp
print(reduce(lambda x,y:x&y, cands))
      

Fixed submission:
from itertools import accumulate
from functools import reduce

n,k = map(int, input().split())
a = list(map(int, input().split()))
acc = [0] + list(accumulate(a))
be = set()
# print(acc)
for i in range(n):
    for j in range(i+1,n+1):
        if acc[j] - acc[i] not in be:
            be.add(acc[j] - acc[i])
# print(be)
be = list(be)
mx = max(be)
# print(bin(mx))
bin_dic = {i:[] for i in range(len(str(bin(mx)))-2)}
# print(binary)
for b in be:
    for i,c in enumerate(str(bin(b))[-1:1:-1]):
        if c == '1':
            bin_dic[i].append(b)
mx_bin = 0
for i in bin_dic.keys():
    if k <= len(bin_dic[i]) and mx_bin < i:
        mx_bin = i
cands = set(bin_dic[mx_bin])
for i in range(mx_bin)[::-1]:
    tmp = set(bin_dic[i]) & cands
    if len(tmp) == k:
        cands = tmp
        break
    elif len(tmp) > k:
        cands = tmp
print(reduce(lambda x,y:x&y, cands))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
pre = {}
city = []
for i in range(m):
    p,y = map(int, input().split())
    if p not in pre:
        pre[p] = []
    pre[p].append(y)
    city.append((p,y))

for k in pre.keys():
    pre[k].sort()

for p,y in city:
    print(str(p).zfill(6) + str(pre[p].index(y)+1).zfill(6))
    

Fixed submission:
from heapq import heappush, heappop
N,M = map(int, input().split())
A = {}
prefs = []
years = []
for i in range(M):
    p,y = input().split()
    prefs.append(p)
    years.append(y)
    if p not in A:
        A[p] = [int(y)]
    else:
        heappush(A[p], int(y))
res = {}
for k,v in A.items():
    for i in range(len(v)):
        res[k+str(heappop(v))] = str(i+1)
for p,y in zip(prefs, years):
    print(p.zfill(6) + res[p+y].zfill(6))

Buggy python submission (verdict: Runtime Error):
from heapq import heappush
N,M = map(int, input().split())
A = {}
prefs = []
years = []
for i in range(M):
    p,y = input().split()
    prefs.append(p)
    years.append(y)
    if p not in A:
        A[p] = [y]
    else:
        heappush(A[p], y)
res = {}
for k,v in A.items():
    for i in range(len(v)):
        res[k+v[i]] = str(i+1)
for p,y in zip(prefs, years):
    print(p.zfill(6) + res[k+y].zfill(6))


Fixed submission:
from heapq import heappush, heappop
N,M = map(int, input().split())
A = {}
prefs = []
years = []
for i in range(M):
    p,y = input().split()
    prefs.append(p)
    years.append(y)
    if p not in A:
        A[p] = [int(y)]
    else:
        heappush(A[p], int(y))
res = {}
for k,v in A.items():
    for i in range(len(v)):
        res[k+str(heappop(v))] = str(i+1)
for p,y in zip(prefs, years):
    print(p.zfill(6) + res[p+y].zfill(6))
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
mn = 1000
for i in range(N):
  c,t = map(int, input().split())
  if t <= T:
	mn = min(c,mn)
print(mn)

Fixed submission:
N, T = map(int, input().split())
mn = 1001
for i in range(N):
  c,t = map(int, input().split())
  if t <= T:
    mn = min(c,mn)
print(mn if mn < 1001 else 'TLE')
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []
for i in range(N):
    x,y,h = map(int, input().split())
    A.append([x,y,h])
for i in range(100+1):
    for j in range(100+1):
        lst = {}
        for x,y,h in A:
            if h == 0:
                continue
            tx, ty = abs(x-i), abs(y-j)
            H = h + tx + ty
            if H not in lst:
                lst[H] = 1
            else :
                lst[H] += 1
        if len(lst) == 1 and lst.keys()[0] != 0:
            print(i,j,H)



Fixed submission:
N = int(input())

A = []
for i in range(N):
    x,y,h = map(int, input().split())
    A.append([x,y,h])
H = max([h for x,y,h in A])
while True:
    for i in range(100+1):
        for j in range(100+1):
            for x,y,h in A:
                tx, ty = abs(x-i), abs(y-j)
                if max(H - tx - ty, 0) != h:
                    break
            else:
                print(i,j,H)
                exit()
    H += 1
Buggy python submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
    if M % i == 0:
        if M // i >= N:
            mx = max(mx, i)
    	else:
            mx = max(mx, M//i)
print(mx)

Fixed submission:
N, M = map(int, input().split())
ceil = M // N
for i in range(1,ceil+1)[::-1]:
    tmp = M - i * (N - 1)
    if tmp > 0 and tmp % i == 0:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
    if M % i == 0:
        if M // i >= N:
            mx = max(mx, i)
    	if i >= N:
        	mx = max(mx, M//i)
print(mx)

Fixed submission:
N, M = map(int, input().split())
ceil = M // N
for i in range(1,ceil+1)[::-1]:
    tmp = M - i * (N - 1)
    if tmp > 0 and tmp % i == 0:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ceil = M / N
tmp = 1
mx = 0
while ceil >= tmp:
    if (M - tmp * (N - 1)) % tmp == 0:
        mx = tmp
    tmp += 1

print(mx)


Fixed submission:
N, M = map(int, input().split())
ceil = M // N
for i in range(1,ceil+1)[::-1]:
    tmp = M - i * (N - 1)
    if tmp > 0 and tmp % i == 0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
def resolve():
    s = input()
    k = int(input())
    cnt = -1
    for i in range(len(s)):
        if s[i] != '1':
            break
        cnt = i + 1
    if cnt > k:
        print(1)
    else:
        print(s[cnt] if cnt > -1 else s[0])

if __name__ == '__main__':
    resolve()


Fixed submission:
S = input()
K = int(input())

#go = 5000000000000000
C = '1'
for i in range(len(S)):
    if S[i] != '1' or i+1 == K:
        C = S[i]
        break
print(C)
Buggy python submission (verdict: Runtime Error):
S = input()
flag = True
if S[0] != 'A' or S[2:-2].count('C') != 1 or S[1].lower() != S[1] or S[-1].lower() != S[-1]:
  flag = False
for i in range(2,len(S)-1):
  if s[i] != 'C' and s[i].lower() != s[i]:
    flag = False
print('AC' if flag else 'WA')

Fixed submission:
S = input()
flag = True
if S[0] != 'A' or S[2:-1].count('C') != 1 or S[1].lower() != S[1] or S[-1].lower() != S[-1]:
  flag = False
for i in range(2,len(S)-1):
  if S[i] != 'C' and S[i].lower() != S[i]:
    flag = False
print('AC' if flag else 'WA')

Buggy python submission (verdict: Runtime Error):
S = input()
flag = True
if S[0] != 'A' or S[2:-2].count('C') != 1 or S[1].lower() != S[1] or S[-1].lower() != S[-1]:
  flag = False
for i in range(2,len(S)-1):
  if s != 'C' and s.lower() != s:
    flag = False
print('AC' if flag else 'WA')

Fixed submission:
S = input()
flag = True
if S[0] != 'A' or S[2:-1].count('C') != 1 or S[1].lower() != S[1] or S[-1].lower() != S[-1]:
  flag = False
for i in range(2,len(S)-1):
  if S[i] != 'C' and S[i].lower() != S[i]:
    flag = False
print('AC' if flag else 'WA')
Buggy python submission (verdict: Runtime Error):
s = "11 5 5"
list = list(map(int, input().split()))

a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
if (a < b):
	if (b < c)
		print(a+b)
	else :
		print(a+c)
else :
	if (a < c)
		print(b+a)
	else :
		print(b+c)


Fixed submission:
s = "100 10 25"
list = list(map(int, input().split()))
#list = list(map(int, s.split()))

a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
if (a < b):
	print(b if b>c else c)
else :
	print(a if c<a else c)

Buggy python submission (verdict: Runtime Error):
s = "11 5 5"
list = list(map(int, input().split()))

a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
l = a+b
m = b + c
n = a+c
if (l < m):
	if (l < n)
		print(l)
	else :
		print(n)
else :
	if (m < n)
		print(m)
	else :
		print(n)


Fixed submission:
s = "100 10 25"
list = list(map(int, input().split()))
#list = list(map(int, s.split()))

a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
if (a < b):
	print(b if b>c else c)
else :
	print(a if c<a else c)
Buggy python submission (verdict: Runtime Error):

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

N = int(input())
A = list(map(int, input().split()))
#N = 7
#A = [994, 518, 941, 851, 647, 2, 581]
t = A[0]
for i in range(1,N):
	if (t % A[i] == 0):
		continue
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
for i in range(N):
	sum += t % A[i]
print(int(sum))


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
print(sum(A)-N)

Buggy python submission (verdict: Runtime Error):

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

N = int(input())
A = list(map(int, input().split()))
#N = 7
#A = [994, 518, 941, 851, 647, 2, 581]
t = A[0]
for i in range(1,N):
	if (t % A[i])
		continue
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
for i in range(N):
	sum += t % A[i]
print(int(sum))


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
print(sum(A)-N)

Buggy python submission (verdict: Runtime Error):

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

N = int(input())
A = list(map(int, input().split()))
#N = 7
#A = [994, 518, 941, 851, 647, 2, 581]
t = A[0]
for i in range(1,N):
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
for i in range(N):
	sum += t % A[i]
print(int(sum))


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
print(sum(A)-N)

Buggy python submission (verdict: Runtime Error):

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

N = int(input())
A = list(map(int, input().split()))
#N = 3
#A = [3,4,6]

t = A[0]
for i in range(1,N):
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
#print(t)
for i in range(N):
	sum += t % A[i]
print(sum)


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
print(sum(A)-N)
Buggy python submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
#NM = [5,2]
#A = [[1,4], [2,5]]
b = list(map(int, input().split()))
#b = [[1,4]]
for i in range(NM[1]-1):
	ab = list(map(int, input().split()))
#	ab = A[i]
	flag = 1
	for i in range(len(b)):
		if (b[i][1] >= ab[0] and b[i][0] <= ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] <= ab[1] and b[i][1] >= ab[1]):
			b[i][1] = ab[1] 
			flag = 0
			break
		if (flag):
			b.append(ab)
			flag = 1

#print(b)
print(len(b))

Fixed submission:
N, M = map(int, input().split())
claim = []
for i in range(M):
	claim.append(list(map(int, input().split())))
claim.sort(key=lambda a:a[1])

ans = 0
inter = [-1,-1]
for land in claim:
    if inter[1] <= land[0]:
        inter = land
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
#NM = [5,2]
#A = [[1,4], [2,5]]
b = list(map(int, input().split()))
#b = [[1,4]]
for i in range(NM[1]-1):
	ab = list(map(int, input().split()))
#	ab = A[i]
	flag = 1
	for i in range(len(b)):
		if (b[i][1] >= ab[0] and b[i][0] <= ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] <= ab[1] and b[i][1] >= ab[1]):
			b[i][1] = ab[1] 
			print("he")
			flag = 0
			break
		if (flag):
			print("here")
			b.append(ab)
			flag = 1

#print(b)
print(len(b))

Fixed submission:
N, M = map(int, input().split())
claim = []
for i in range(M):
	claim.append(list(map(int, input().split())))
claim.sort(key=lambda a:a[1])

ans = 0
inter = [-1,-1]
for land in claim:
    if inter[1] <= land[0]:
        inter = land
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
b = []
for i in range(NM[1]):
	ab = list(map(int, input().split()))
	flag = 1
	for i in range(b):
		if (b[i][1] < ab[0] and b[i][0] < ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] > ab[1] and b[i][1] > ab[1]):
			b[i][1] = ab[1] 
			flag = 0
			break
		if (flag):
			b.append(ab)
			flag = 1

print(len(b))

Fixed submission:
N, M = map(int, input().split())
claim = []
for i in range(M):
	claim.append(list(map(int, input().split())))
claim.sort(key=lambda a:a[1])

ans = 0
inter = [-1,-1]
for land in claim:
    if inter[1] <= land[0]:
        inter = land
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
9
1 2 3 4 5 6 7 8 9

Fixed submission:
from math import floor, ceil
N = int(input())
A = []
for i,a in enumerate(input().split()):
  A.append(int(a)-(i+1))
A.sort()
if N % 2 :
    print(-1*sum(A[:N//2]) + sum(A[N//2+1:]))
else:
    print(-1*sum(A[:N//2]) + sum(A[N//2:]))
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
print(max(A+B,A−B,A*B))

Fixed submission:
A,B = map(int, input().split())
print(max(A+B,A-B,A*B))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print('Yes' if abs(a-c) <= d or (abs(a-b)<=d and abs(b-c)<=d else 'No')

Fixed submission:
a,b,c,d = map(int,input().split())
print('Yes' if abs(a-c) <= d or (abs(a-b)<=d and abs(b-c)<=d) else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]


n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n+1)]

for i in range(m):
    a,b = map(int, input().split())
    aa = get_par(par, a)
    bb = get_par(par, b)
    if aa == bb:
        continue
    # unite
    unite(par, a, b)

ans = 0
for i in range(n):
    a = p[i]
    if get_par(par, a) == get_par(par, i+1):
        ans += 1
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]


n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n+1)]
cnt = [1 for _ in range(n+1)]

for i in range(m):
    a,b = map(int, input().split())
    aa = get_par(par, a)
    bb = get_par(par, b)
    if aa == bb:
        continue
    # unite
    if cnt[aa] > cnt[bb]:
        par[bb] = aa
        cnt[aa] += cnt[bb]
    else:
        par[aa] = bb
        cnt[bb] += cnt[aa]

ans = 0
for i in range(n):
    a = p[i]
    if get_par(par, a) == get_par(par, i+1):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]


n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n+1)]

for i in range(m):
    a,b = map(int, input().split())
    aa = get_par(par, a)
    bb = get_par(par, b)
    if aa == bb:
        continue
    # unite
    unite(par, a, b)

ans = 0
for i in range(n):
    a = p[i]
    if get_par(par, a) == get_par(par, i+1):
        ans += 1
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]


n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n+1)]
cnt = [1 for _ in range(n+1)]

for i in range(m):
    a,b = map(int, input().split())
    aa = get_par(par, a)
    bb = get_par(par, b)
    if aa == bb:
        continue
    # unite
    if cnt[aa] > cnt[bb]:
        par[bb] = aa
        cnt[aa] += cnt[bb]
    else:
        par[aa] = bb
        cnt[bb] += cnt[aa]

ans = 0
for i in range(n):
    a = p[i]
    if get_par(par, a) == get_par(par, i+1):
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
pritn('Yes' if 'a' in S and 'b' in S and 'c' in S else 'No')

Fixed submission:
S = input()
print('Yes' if 'a' in S and 'b' in S and 'c' in S else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int, input().split())
if A - B > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  #print('---')
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int, input().split())
if A - B > 2 * K:
  [print(i) for i in range(A,A+K) if i - K < A]
  [print(i) for i in range(B+1-K,B+1) if i + K > B]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int, input().split())
if A - B > 200:
  [print(i) for i in range(A,A+K) if i - K < A]
  [print(i) for i in range(B+1-K,B+1) if i + K > B]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int, input().split())
if A - B > 100:
  [print(i) for i in range(A,A+K) if i - K < A]
  [print(i) for i in range(B+1-K,B+1) if i + K > B]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int, input().split())
[print(i) for i in range(A,B+1) if i - K < A or i + K > B]

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

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

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

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]

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

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

Fixed submission:
A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]
Buggy python submission (verdict: Runtime Error):
from collections import Counter as cnt

N = int(input())
blue = []
for i in range(N):
  blue.append(int(input()))
blue = cnt(blue)
N = int(input())
red = []
for i in range(N):
  red.append(int(input()))
red = cnt(red)

p = blue - red
print(p.most_common()[0][1])


Fixed submission:
from collections import Counter as cnt

N = int(input())
counter = {}
for i in range(N):
  s = input()
  if s not in counter:
    counter[s] = [1,0]
  else:
    counter[s][0] += 1
N = int(input())
for i in range(N):
  s = input()
  if s not in counter:
    counter[s] = [0,1]
  else:
    counter[s][1] += 1
counter[0] = [0,0]

print(max([b-r for b,r in counter.values()]))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [input() for i in range(N)]
S = [s[0] for s in S if s[0] in 'MARCH']
counter = Counter(S)
if len(counter) < 3:
  print(0)
else:
  cnt = 0
  mar = 'MARCH'
  for a in range(0,3):
    if mar[a] not in counter:
      continue
    for b in range(a+1, min(a+1+3, N-1)):
      if mar[b] not in counter:
        continue
      for c in range(b+1, min(b+1+3, N)):
        if mar[c] not in counter:
          continue
        # print(mar[a], mar[b], mar[c])
        cnt += counter[mar[a]] * counter[mar[b]] * counter[mar[c]]
  print(cnt)

Fixed submission:
from collections import Counter
N = int(input())
S = [input() for i in range(N)]
S = [s[0] for s in S if s[0] in 'MARCH']
counter = Counter(S)
if len(counter) < 3:
  print(0)
else:
  cnt = 0
  mar = 'MARCH'
  for a in range(0,3):
    if mar[a] not in counter:
      continue
    for b in range(a+1, min(a+1+3, 5-1)):
      if mar[b] not in counter:
        continue
      for c in range(b+1, min(b+1+3, 5)):
        if mar[c] not in counter:
          continue
        # print(mar[a], mar[b], mar[c])
        cnt += counter[mar[a]] * counter[mar[b]] * counter[mar[c]]
  print(cnt)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [input() for i in range(N)]
S = [s[0] for s in S if s[0] in 'MARCH']
counter = Counter(S)
if len(counter) < 3:
  print(0)
else:
  cnt = 0
  mar = 'MARCH'
  for a in range(0,3):
    if mar[a] not in counter:
      continue
    for b in range(a+1, min(a+1+3, N)):
      if mar[b] not in counter:
        continue
      for c in range(b+1, min(b+1+3, N)):
        if mar[c] not in counter:
          continue
        cnt += counter[mar[a]] * counter[mar[b]] * counter[mar[c]]
  print(cnt)

Fixed submission:
from collections import Counter
N = int(input())
S = [input() for i in range(N)]
S = [s[0] for s in S if s[0] in 'MARCH']
counter = Counter(S)
if len(counter) < 3:
  print(0)
else:
  cnt = 0
  mar = 'MARCH'
  for a in range(0,3):
    if mar[a] not in counter:
      continue
    for b in range(a+1, min(a+1+3, 5-1)):
      if mar[b] not in counter:
        continue
      for c in range(b+1, min(b+1+3, 5)):
        if mar[c] not in counter:
          continue
        # print(mar[a], mar[b], mar[c])
        cnt += counter[mar[a]] * counter[mar[b]] * counter[mar[c]]
  print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if len(A) & 1:
  A.append(0)
A.sort()
print(sum([A[i+1]-A[i] for i in range(0, A, 2)]))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if len(A) & 1:
  A.append(0)
A.sort()
print(sum([A[i+1]-A[i] for i in range(0, len(A), 2)]))
Buggy python submission (verdict: Runtime Error):
a = int(input().replace(" ", ""))
for i in range(101):
  if i == (a / i):
    print("Yes")
    break
else:
  print("No")


Fixed submission:
s = int(input().replace(' ', ''))
for i in range(s):
  if i * i > s:
    print('No')
    break
  elif i**2 == s:
    print('Yes')
    break
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = [int(input()) for i in range(N)]
cnt = 0
lst = []
X.sort()
for i in range(N-1):
  if X[i] < X[i+1] :
    cnt += 1
  else:
    lst.append(cnt)
    cnt = 0
print(min(lst))
    

Fixed submission:
N = int(input())

lst = []
for i in range(N):
  lst.append(int(input()))
print(len(set(lst)))