Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys

n = int(input())
a = map(int, sys.stdin.read().split("\n"))
# a = map(int, [input() for i in range(n)])

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values()))

Fixed submission:
import sys

n = int(input())
# a = map(int, sys.stdin.read().split("\n"))
a = map(int, [input() for i in range(n)])

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values()))

Buggy python submission (verdict: Runtime Error):
import sys

n = int(input())
a = map(int, sys.stdin.read().split("\n"))

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values))

Fixed submission:
import sys

n = int(input())
# a = map(int, sys.stdin.read().split("\n"))
a = map(int, [input() for i in range(n)])

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = map(int, input().split(" "))

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] += 1
d = sum([[d_i[0] for i in range(d_i[1]//2)] for d_i in d.items()], [])

if len(d) < 2:
	print(0)
else:
	max_1 = max(d)
	d.remove(max_1)
	max_2 = max(d)
	print(max_1 * max_2)

Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))

a.sort()
maxs = []
for i in range(2):
	max_1 = a.pop()
	while True:
		max_2 = a.pop()
		if max_1 == max_2:
			maxs.append(max_1)	
			break
		max_1 = max_2
		if len(a) == 0:
			print(0)
			exit()
print(maxs[0]*maxs[1])

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

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] += 1
d = sum([[d_i[0] for i in range(d_i[1]//2)] for d_i in d.items()], [])

d.sort(reverse=True)
print(d[0] * d[1])

Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))

a.sort()
maxs = []
for i in range(2):
	max_1 = a.pop()
	while True:
		max_2 = a.pop()
		if max_1 == max_2:
			maxs.append(max_1)	
			break
		max_1 = max_2
		if len(a) == 0:
			print(0)
			exit()
print(maxs[0]*maxs[1])

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

for a_i in set(a):
	a.remove(a_i)
max_2 = sorted(a, reverse=True)[:2]
print(max_2[0]*max_2[1])

Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))

a.sort()
maxs = []
for i in range(2):
	max_1 = a.pop()
	while True:
		max_2 = a.pop()
		if max_1 == max_2:
			maxs.append(max_1)	
			break
		max_1 = max_2
		if len(a) == 0:
			print(0)
			exit()
print(maxs[0]*maxs[1])
Buggy python submission (verdict: Runtime Error):
import fraction

def lcm(a, b):
	return a * b // fraction.gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

def lcm(a, b):
	return a * b // math.gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

def lcm(a, b):
	return a * b // math.gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

t += [1, 1]
a = t.pop()
while t:
	b = t.pop()
	a = lcm(a, b)
print(a)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

def lcm(a, b):
	return a * b // math.gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

t += [1, 1]
a = t.pop()
while t:
	b = t.pop()
	a = lcm(a, b)
print(a)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

def lcm(a, b):
	return a * b // math.gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

t += [1]
a = t.pop()
while t:
	b = t.pop()
	a = lcm(a, b)
print(a)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

n = int(input())
t = [int(input()) for i in range(n)]

ans = t[0]
for t_i in t[1:]:
	ans = lcm(ans, t_i)

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input())
ab = [tuple(map(int, input().split(" "))) for i in range(m)]

from_one, to_n = set(), set()
for ab_i in ab:
	if ab_i[0] == 1:
		from_one.add(ab_i[1])
	elif ab_i[0] == n:
		from_one.add(ab_i[1])
	
print("POSSIBLE" if from_one | to_n else "IMPOSSIBLE")

Fixed submission:
n, m = map(int, input().split(" "))
ab = [tuple(map(int, input().split(" "))) for i in range(m)]

from_one, to_n = set(), set()
for ab_i in ab:
	if ab_i[0] == 1:
		from_one.add(ab_i[1])
	elif ab_i[1] == n:
		to_n.add(ab_i[0])
	
print("POSSIBLE" if from_one & to_n else "IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
print(" ".join((a[1::2][::-1] + a[::2])[::1 if len(a)%2==0 else -1]))


Fixed submission:
n = int(input())
a = input().split(" ")

print(" ".join((a[1::2][::-1] + a[::2])[::1 if len(a)%2==0 else -1]))
Buggy python submission (verdict: Runtime Error):
nums = [1, 1]
def step_div(n):
	i = len(nums)
	while i <= n:
		nums.append(nums[i-1] * i)
		i += 1
	return nums[n]

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((step_div(n) * step_div(m) * 2) % (10**9+7))
else:
	print(0)


Fixed submission:
x, a, b = map(int, input().split(" "))

if 0 <= a - b:
    print("delicious")
elif b - a <= x:
    print("safe")
else:
    print("dangerous")
Buggy python submission (verdict: Runtime Error):
import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7)))
else:
	print(0)


Fixed submission:
import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)

Buggy python submission (verdict: Runtime Error):
import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print(math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)


Fixed submission:
import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)

Buggy python submission (verdict: Time Limit Exceeded):
nums = [1, 1]
def step_div(n):
	i = len(nums)
	while i <= n:
		nums.append(nums[i-1] * i)
		i += 1
	return nums[n]

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((step_div(n) * step_div(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)

Fixed submission:
import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)

Buggy python submission (verdict: Time Limit Exceeded):
nums = [1, 1]
def step_div(n):
	i = len(nums)
	while i <= n:
		nums.append(nums[i-1] * i)
		i += 1
	return nums[n]

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((step_div(n % (10**9+7)) * step_div(m % (10**9+7)) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)

Fixed submission:
import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split(" "))

color_types = [False]*8
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = True
	else:
		pro_count += 1
print(max(1,　sum(color_types)), min(8, sum(color_types)+pro_count))

Fixed submission:
n = int(input())
a = map(int, input().split(" "))

color_types = [False]*8
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = 1
	else:
		pro_count += 1
print(max(1, sum(color_types)), sum(color_types)+pro_count)

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

color_types = [False]*8
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = True
	else:
		pro_count += 1
print(color_types)
print(sum(max(1,　color_types)), min(8, sum(color_types)+pro_count))

Fixed submission:
n = int(input())
a = map(int, input().split(" "))

color_types = [False]*8
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = 1
	else:
		pro_count += 1
print(max(1, sum(color_types)), sum(color_types)+pro_count)

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

color_types = [False]*7
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = True
	else:
		pro_count += 1
print(sum(color_types), min(8, sum(color_types)+pro_count))

Fixed submission:
n = int(input())
a = map(int, input().split(" "))

color_types = [False]*8
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = 1
	else:
		pro_count += 1
print(max(1, sum(color_types)), sum(color_types)+pro_count)

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

color_types = [False]*7
pro_count = 0
if a < 3200:
	color_types[a//400] = True
else:
	pro_count += 1
print(min(8, sum(color_types)+pro_count))

Fixed submission:
n = int(input())
a = map(int, input().split(" "))

color_types = [False]*8
pro_count = 0
for a_i in a:
	if a_i < 3200:
		color_types[a_i//400] = 1
	else:
		pro_count += 1
print(max(1, sum(color_types)), sum(color_types)+pro_count)
Buggy python submission (verdict: Runtime Error):
x=input();z=eval(x[0]+"+"x[2]);print(z//10*"error"or z)

Fixed submission:
z=eval(input().replace(" ","+"));print(z//10*"error"or z)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]

sum_a = sum(a)

if sum_a % 10 == 0:
	can_nums = filter(lambda x: x%10 != 0, set(a))
	if len(list(can_nums)) == 0:
		print(0)
	else:
		print(sum_a - min(can_nums))
else:
	print(sum_a)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

sum_a = sum(a)

if sum_a % 10 == 0:
	can_nums = filter(lambda x: x%10 != 0, set(a))
	if len(list(can_nums)) == 0:
		print(0)
	else:
		print(sum_a - min(can_nums))
else:
	print(sum_a)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split(" "))
ab = [tuple(map(int, input().split(" "))) for i in range(n)]

d = dict()
for ab_i in ab:
	a, b = ab_i
	if a not in d:
		d[a] = 0
	d[a] += b

print(sum([[d_a] * d_b for d_a, d_b in sorted(d.items())], [])[k-1])

Fixed submission:
n, k = map(int, input().split(" "))
ab = [tuple(map(int, input().split(" "))) for i in range(n)]

count = 0
for ab_num, ab_count in sorted(ab):
	count += ab_count
	if k <= count:
		print(ab_num)
		exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int, input().split(" ")))

m = 0
c = 0
for i in range(N):
	if i%2 == 0:
		m += A[i]
		while m <= 0:
			m += 1
			c += 1
	else:
		m += A[i]
		while m >= 0:
			m -= 1
			c += 1

o = 0
d = 0
for i in range(N):
	if i%2 == 1:
		o += A[i]
		while o <= 0:
			o += 1
			d += 1
	else:
		o += A[i]
		while o >= 0:
			o -= 1
			d += 1

print(min(c, d))

Fixed submission:
N = int(input())
A = tuple(map(int, input().split(" ")))

m = 0
c = 0
for i in range(N):
	m += A[i]
	# print(m)
	if i%2 == 0:
		if m <= 0:
			c += abs(m)+1
			m += abs(m)+1
	else:
		if m >= 0:
			c += m+1
			m -= m+1
	# print(m, c)
# print(c)

m = 0
d = 0
for i in range(N):
	m += A[i]
	# print(m)
	if i%2 == 1:
		if m <= 0:
			d += abs(m)+1
			m += abs(m)+1
	else:
		if m >= 0:
			d += m+1
			m -= m+1
	# print(m, d)

print(min(c, d))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import groupby

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

b = [A[i+1]-A[i] for i in range(N-1)]

for i in range(b.count(0)):
    b.remove(0)

b = [0<b_i for b_i in b]

b = [len(list(v)) for k, v in groupby(b)]

# print(b)
if len(b) <= 1:
    print(1)
    exit()

c = 2
can_remove = True
for b_i in b[1:-1]:
    if b_i == 1 and can_remove:
        can_remove = False
    else:
        c += 1
        can_remove = True

print(c)

Fixed submission:
# 傾きの正負の変化を調べるのに、
# AとB(傾き)をかけてその符号を見るという方法があると気づいた
N = int(input())
A = list(map(int, input().split(" ")))

c = 1
e = 0
for i in range(N-1):
    d = A[i+1]-A[i]
    # print(d, e, e*d < 0)
    # 一方が負の数、もう一方が正の数なら
    if e*d < 0:
        c += 1
        e = 0
    elif d != 0: # この条件忘れた
        e = d

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
def f(a, b):
    return max(len(str(int(x))) for x in (a, b)) 

n = int(input())

min_num = len(str(n))
for a in range(1, n//2):
    b = (n/a)
    if b % 1 == 0:
        min_num = min(min_num, f(a, b))
print(min_num)

Fixed submission:
n = int(input())

center = int(n**(1/2))

for i in range(center+1):
    if n % (center - i) == 0:
        print(len(str(n // (center - i))))
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

power = 1
for n_i in range(1, n+1):
    power *= n_i
print(power%1000000007)

Fixed submission:
import math

n = int(input())

print(math.factorial(n)%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

power = 1
for n_i in range(1, n+1):
    power *= n_i
print(power%1000000007)

Fixed submission:
import math

n = int(input())

print(math.factorial(n)%1000000007)
Buggy python submission (verdict: Runtime Error):
print(f"A{RB[input()<"1200"]}C")

Fixed submission:
x = int(input())

print("ABC" if x < 1200 else "ARC")
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split(" "))

count = 0
for x in range(0, k+1):
	for y in range(0, k+1):
		for z in range(0, k+1):
			if x+y+z == s:
				count += 1

print(count)

Fixed submission:
k, s = map(int, input().split(" "))

count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split(" "))

count = 0
for x in range(k+1):
    for y in range(min(k, s-x)+1):
        for z in range(min(k, s-x-y)+1):
            if x+y+z == s:
                count += 1

print(count)

Fixed submission:
k, s = map(int, input().split(" "))

count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split(" "))

count = 0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l == s:
                count += 1
print(count)

Fixed submission:
k, s = map(int, input().split(" "))

count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = tuple(map(int, input().split(" ")))
# n = 10000
# a = tuple(sum([[i, i] for i in range(1, n+1, 2)], [])[:n])

nums_sample = sum([[i, i] for i in range(n-1, 0-1, -2)], [])[:n]

if sorted(a, reverse=True) == nums_sample:
    print(2**(n//2) % (10**9+7))
else:
    print(0)

Fixed submission:
from collections import Counter

n = int(input())
a = tuple(map(int, input().split(" ")))
# n = 10000
# a = tuple(sum([[i, i] for i in range(1, n+1, 2)], [])[:n])

a_counter = Counter(a)
a_counter[int(n%2==0)] = 2

if set(a_counter.values()) == {2}:
    print((2 ** (n//2)) % (10**9+7))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
w, h, n = map(int, input().split(" "))
x_y_a = [tuple(map(int, input().split(" "))) for i in range(n)]

min_x, max_x, min_y, max_y = 0, w, 0, h
for x_y_a_i in x_y_a:
    x, y, a = x_y_a_i
    if a == 1:
        min_x = x
    elif a == 2:
        max_x = x
    elif a == 3:
        min_y = y
    elif a == 4:
        max_y = y

print(min(0, max_x-min_x) * min(0, max_y-min_y)))

Fixed submission:
W,H,N=map(int,input().split())
x=y=0
for i in range(N):
  xi,yi,a=map(int,input().split())
  if a==1:
    x=max(x,xi)
  elif a==2:
    W=min(W,xi)
  elif a==3:
    y=max(y,yi)
  elif a==4:
    H=min(H,yi)
    
print(0 if x>=W or y>=H else (W-x)*(H-y))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
TA = [list(map(int, input().split(" "))) for _ in range(N)]

n_t, n_a = 1, 1
for t, a in TA:
    s, b = 0, 0
    while not (n_t <= s and n_a <= b):
        s += t
        b += a
    n_t, n_a = s, b

print(n_t+n_a)

Fixed submission:
N = int(input())
TA = [list(map(int, input().split(" "))) for _ in range(N)]

n_t, n_a = 1, 1
for t, a in TA:
    # print(n_t/t, n_a/a)
    v = max(-(-n_t//t), -(-n_a//a))
    n_t, n_a = t*v, a*v

print(n_t+n_a)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
TA = [list(map(int, input().split(" "))) for _ in range(N)]

# print("-")

s_t, s_a = 1, 1 
for t, a in TA:
    v_t, v_a = 0, 0
    while v_t < s_t or v_a < s_a:
        v_t += t
        v_a += a
    s_t, s_a = v_t, v_a
    # print(s_t, s_a)

print(s_t+s_a)


Fixed submission:
N = int(input())
TA = [list(map(int, input().split(" "))) for _ in range(N)]

n_t, n_a = 1, 1
for t, a in TA:
    # print(n_t/t, n_a/a)
    v = max(-(-n_t//t), -(-n_a//a))
    n_t, n_a = t*v, a*v

print(n_t+n_a)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t_a = [tuple(map(int, input().split(" "))) for _ in range(n)]

now_t, now_a = 1, 1
for t_i, a_i in t_a:
	count = 1
	while t_i*count < now_t or a_i*count < now_a:
		count += 1
	now_t = t_i*count
	now_a = a_i*count

print(now_t + now_a)

Fixed submission:
N = int(input())
TA = [list(map(int, input().split(" "))) for _ in range(N)]

n_t, n_a = 1, 1
for t, a in TA:
    # print(n_t/t, n_a/a)
    v = max(-(-n_t//t), -(-n_a//a))
    n_t, n_a = t*v, a*v

print(n_t+n_a)
Buggy python submission (verdict: Time Limit Exceeded):
X = input()

flag = True
while flag:
    flag = False
    i = 0
    while i < len(X):
        if X[i:i+2] == "ST":
            X = X[:i]+X[i+2:]
            flag = True
        else:
            i += 1

print(len(X))

Fixed submission:
X = input()

s, t = 0, 0
for x in X:
    if x == "S":
        s += 1
    else:
        if s == 0:
            t += 1
        else:
            s -= 1

print(s+t)
Buggy python submission (verdict: Runtime Error):
s_abc = [input().split for i in range(3)]

player = 0
while True:
	next_player = "abc".find(s_abc[player][0])
	s_abc[player] = s_abc[player][1:]
	if 0 <= s_abc.index(""):
		print("ABC"[s_abc.index("")])
		break
	player = next_player

Fixed submission:
s_abc = [input() for c in "abc"]

player = 0
while len(s_abc[player]) != 0:
	next_player = "abc".find(s_abc[player][0])
	s_abc[player] = s_abc[player][1:]
	player = next_player
print("ABC"[player])
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from statistics import mean

n, a = map(int, input().split(" "))
x = tuple(map(int, input().split(" ")))

count = 0
for m in range(1, n+1):
	for nums in combinations(x, m):
		if mean(nums) == a:
			count += 1

print(count)

Fixed submission:
from collections import Counter

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

X = [x-A for x in X]

c = Counter([0])
for x in X:
    d = Counter()
    for k, v in c.items():
        d[k+x] += v
    c += d

print(c[0]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n, a = map(int, input().split(" "))
x = tuple(map(int, input().split(" ")))

x = [x_i-a for x_i in x]

count = 0
for i in range(1, 2**n):
	bin_str = bin(i)[2:].zfill(n)
	sum_num = 0
	for j, bin_c in enumerate(bin_str):
		if bin_c == "1":
			sum_num += x[j]
	if sum_num == 0:
		count += 1

print(count)

Fixed submission:
from collections import Counter

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

X = [x-A for x in X]

c = Counter([0])
for x in X:
    d = Counter()
    for k, v in c.items():
        d[k+x] += v
    c += d

print(c[0]-1)
Buggy python submission (verdict: Runtime Error):
s=set;print("YNeos"[s(input())in map(s,"NS","EW","NSEW")::2])

Fixed submission:
S = input()

S = set(S)
if 1 not in [len(S&set(t)) for t in ["NS", "WE"]]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
abc = list(map(int, input()))

print("Yes" if sorted(abc) == [5, 5, 7] else "No")

Fixed submission:
abc = list(map(int, input().split(" ")))

print("YES" if sorted(abc) == [5, 5, 7] else "NO")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split(" "))
d = input().split(" ")

for i in range(len(str(n))+1):
	if str(n)[~i] not in d:
		continue
	while str(n)[~i] in d:
		n += 10**i
print(n)

Fixed submission:
n, k = map(int, input().split(" "))
d = input().split(" ")

while set(str(n)) & set(d):
	n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split(" "))
d = input().split(" ")

for i in range(len(str(n))+1):
	if str(n)[~i] not in d:
		break
	while str(n)[~i] in d:
		n += 10**i
print(n)

Fixed submission:
n, k = map(int, input().split(" "))
d = input().split(" ")

while set(str(n)) & set(d):
	n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split(" "))
d = input().split(" ")

for i in range(len(str(n))+1):
	while str(n)[~i] in d:
		n += 10**i
print(n)

Fixed submission:
n, k = map(int, input().split(" "))
d = input().split(" ")

while set(str(n)) & set(d):
	n += 1
print(n)
Buggy python submission (verdict: Runtime Error):
a,b = map(int , input().split())

if a,b > 9:
  print(a*b)
  else:
    print(-1)

Fixed submission:
a,b = map(int , input().split())

if a > 9 or a < 1:
	print(-1)
elif b > 9 or b < 1:
	print(-1)
else:
	print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def sieve():
  n = 10**6+1
  primes = [True]*(n+1)
  primes[0],primes[1] = False,False

  for i in range(2,int(math.sqrt(n)+1)):
    if primes[i] == True:
      j = 2
      while i*j <= n:
        primes[i*j] = False
        j += 1

  return primes

def prime_factors(n):
  i = 2
  factors = set()
  while i * i <= n:
    if n % i:
      i += 1
    else:
      n //= i
      factors.add(i)

  if n > 1:
    factors.add(n)
  return factors

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

dic = {}
flg = True
for a in A:
  if primes[a]:
    facs = [a]
  else:
    facs = prime_factors(a)

  for p in facs:
    if p in dic:
      flg = False
      break
    else:
      dic[p] = 1

if flg:
  print("pairwise coprime")
else:
  g = A[0]
  for i in range(1, N):
    g = math.gcd(g, A[i])
  if g == 1:
    print("setwise coprime")
  else:
    print("not coprime")



Fixed submission:
import math

N = int(input())
A = list(map(int,input().split()))
MAX_INT = 10**6
f1 = [0] * (MAX_INT+1)
for a in A:
  f1[a] += 1

flg = True
for i in range(2, MAX_INT+1):
  cnt = 0
  for j in range(i, MAX_INT+1, i):
    cnt += f1[j]
  if cnt > 1:
    flg = False
    break

if flg:
  print("pairwise coprime")
  exit()

g = A[0]
for i in range(1, N):
  g = math.gcd(g, A[i])

if g == 1:
  print("setwise coprime")
else:
  print("not coprime")