Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_array = list(map(int, input().split()))
ans = 0
check = [0 for _ in range(10 ** 6 + 5)]
A = A_array

for i in range(N):
  for j in range(int((len(check) - 1) / A[i])):
    check[A[i] * (j + 1)] += 1

for i in range(len(check) - 1):
  if i + 1 in A:
    if check[i + 1] == 1:
      ans += 1
    else:
      continue
  else:
    continue

print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_array = list(map(int, input().split()))
ans = 0
check = [0 for _ in range(10 ** 6 + 5)]
A = sorted(A_array)

for i in range(N):
  for j in range(int((len(check) - 1) / A[i])):
    check[A[i] * (j + 1)] += 1

for i in range(len(check) - 1):
  if i + 1 in A:
    if check[i + 1] == 1:
      ans += 1
    else:
      continue
  else:
    continue

print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_array = list(map(int, input().split()))
ans = 0

for i in range(N):
    Ai = A_array[i]
    for j, Aj in enumerate(A_array):
        if j == i:
          if j == N-1:
            ans += 1
          else:
            continue
        else:
            if Ai % Aj == 0:
              break
            elif j == N - 1:
              ans += 1
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = [input() for i in range(2)]

count = 0
out = 0
if a == b:
  print("0")
else:
  c = list(a)
  d = list(b)
  for i in c:
    if i == d[count]:
      pass
    else:
      out = out + 1
    count = count + 1
  print(str(out))

Fixed submission:
a = int(input())

print(str(a + (a ** 2) + (a ** 3)))
Buggy python submission (verdict: Runtime Error):
import sys

input_list = sys.stdin.readlines()

count = 1
get_count = 0
get_value_count = 0
for i in input_list:
  get_values = i.split()
  if count == 1:
    get_value_count = int(get_values[0])
    get_count = int(get_values[1])
  else:
    if get_value_count == 1:
      print(get_values[0])
    else:
      get_values.sort()
      count_value = 1
      p = 0
      for c in get_values:
        if count_value > get_count:
          print(str(p))
        else:
          p = p + int(c)
        count_value = count_value + 1
  count = count + 1

Fixed submission:
input_line = input()

if input_line.isupper() == True:
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
b=[]
for i in range(n):
  b.append(input())
ans=[[0]*m for i in range(n)]
d=[-1,0,1]
for i in range(n):
  for j in range(m):
    if b[i][j]=='#':
      for x in d:
        for y in d:
          X=i+x
          Y=j+y
          if 0 <= X < n and 0 <= Y < m:
            ans[X][Y]+=1
import sys
for i in range(n):
  for j in range(m):
    if b[i][j]=='#':
      sys.stdout.write('#')
    else:
      sys.stdout.write(ans[i][j])
  sys.stdout.write('\n')

Fixed submission:
n,m=map(int,input().split())
b=[]
for i in range(n):
  b.append(input())
ans=[[0]*m for i in range(n)]
d=[-1,0,1]
for i in range(n):
  for j in range(m):
    if b[i][j]=='#':
      for x in d:
        for y in d:
          X=i+x
          Y=j+y
          if 0 <= X < n and 0 <= Y < m:
            ans[X][Y]+=1
import sys
for i in range(n):
  for j in range(m):
    if b[i][j]=='#':
      sys.stdout.write('#')
    else:
      sys.stdout.write(str(ans[i][j]))
  sys.stdout.write('\n')
Buggy python submission (verdict: Runtime Error):
s = input()
if s[0:4] == "YAKI":
 print "Yes"
else:
 print "No"

Fixed submission:
s = raw_input()
if s[0:4] == "YAKI":
 print "Yes"
else:
 print "No"
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print(a-b if a-b>0 else 0)

Fixed submission:
a,b=map(int,input().split())
print(a-b if a-b>0 else 0)

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print a-b if a-b>0 else 0

Fixed submission:
a,b=map(int,input().split())
print(a-b if a-b>0 else 0)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print a-b if a-b>0 else 0

Fixed submission:
a,b=map(int,input().split())
print(a-b if a-b>0 else 0)
Buggy python submission (verdict: Runtime Error):
n,d = map(int,input(),split(" "))
d *= d
c = 0
for i in range(n):
  a,b =map(int,input().split(" "))
  if(a**2 + b**2 == d):
    c += 1
print(c)

Fixed submission:
n,d = map(int,input().split(" "))
d *= d
c = 0
for i in range(n):
  a,b =map(int,input().split(" "))
  if(a**2 + b**2 <= d):
    c += 1
print(c)

Buggy python submission (verdict: Runtime Error):
n,d=int(input()),int(input())
c = 0
d *= d
for i in range(n):
  a,b=int(input()),int(input())
  if(a**2+b**2==d):
    c+=1
print(c)

Fixed submission:
n,d = map(int,input().split(" "))
d *= d
c = 0
for i in range(n):
  a,b =map(int,input().split(" "))
  if(a**2 + b**2 <= d):
    c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
s, t = input().split()
if s == t[:-1]:
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
s, t = input().split()
if s == t[:-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
a=7
if k%2==0 or k%5==0:
	print(-1)
else:
	for i in range(k):
		if a%k==0:
			print(i+1)
			break
		a=a*10+7
	else:
		print(-1)

Fixed submission:
k=int(input())
a=7%k
if k%2==0 or k%5==0:
	print(-1)
elif k==1:
	print(1)
else:
	for i in range(k):
		if a==0:
			print(i+1)
			break
		a=(a*10+7)%k
	else:
		print(-1)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
ar=list(map(int,input().split()))
for i in range(k,n):
	if ar[i]>ar[i-k]:
		print("Yes")
	else:
		print("No"

Fixed submission:
n,k=map(int,input().split())
ar=list(map(int,input().split()))
for i in range(k,n):
	if ar[i]>ar[i-k]:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
hr=list(map(int,input().split()))
dp=[-1]*(n+1)
def cost(i):
	if i>=n-1:
		return 0
	if dp[i]!=-1:
		return dp[i]
	if i<n-2:
		a=abs(hr[i]-hr[i+2])+cost(i+2)
	b=abs(hr[i]-hr[i+1])+cost(i+1)
	if i>=n-2:
		a=b
	x=min(a,b)
	dp[i]=x
	return x
print(cost(0))

Fixed submission:
n=int(input())
ab=abs
hr=list(map(int,input().split()))
dp=[-1]*(n+1)
dp[0]=0
dp[1]=ab(hr[1]-hr[0])
for i in range(2,n):
	x=ab(hr[i]-hr[i-2])+dp[i-2]
	y=ab(hr[i]-hr[i-1])+dp[i-1]
	dp[i]=min(x,y)
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5 + 9)
from collections import defaultdict
dp=defaultdict(lambda:0)
n=int(input())
ar,br,cr=[0]*n,[0]*n,[0]*n
for i in range(n):
	ar[i],br[i],cr[i]=map(int,input().split())
def points(i,pv):
	if dp[(i,pv)] != 0:
		return dp[(i,pv)]
	if pv==1:
		x,y=br[i],cr[i]
		a,b=2,3
	elif pv==2:
		x,y=ar[i],cr[i]
		a,b=1,3
	else:
		x,y=ar[i],br[i]
		a,b=1,2
	if i==n-1:
		return max(x,y)
	ax=points(i+1,a)+x
	by=points(i+1,b)+y
	ans=max(by,ax)
	dp[(i,pv)]=ans
	return ans
p=points(1,1)+ar[0]
q=points(1,2)+br[0]
r=points(1,3)+cr[0]
print(max(p,q,r))

	
		



Fixed submission:
import sys
sys.setrecursionlimit(10**5 + 9)
from collections import defaultdict
dp=defaultdict(lambda:0)
n=int(input())
ar,br,cr=[0]*n,[0]*n,[0]*n

for i in range(n):
	ar[i],br[i],cr[i]=map(int,input().split())
if n==1:
	print(max(ar[0],br[0],cr[0]))
	exit()
def points(i,pv):
	if dp[(i,pv)] != 0:
		return dp[(i,pv)]
	if pv==1:
		x,y=br[i],cr[i]
		a,b=2,3
	elif pv==2:
		x,y=ar[i],cr[i]
		a,b=1,3
	else:
		x,y=ar[i],br[i]
		a,b=1,2
	if i==n-1:
		return max(x,y)
	ax=points(i+1,a)+x
	by=points(i+1,b)+y
	ans=max(by,ax)
	dp[(i,pv)]=ans
	return ans
p=points(1,1)+ar[0]
q=points(1,2)+br[0]
r=points(1,3)+cr[0]
print(max(p,q,r))
Buggy python submission (verdict: Runtime Error):
[n,k] = map(int, input().split())
SET = set()
for i in range(k):
	d = int(input())
    tmp = set(map(int, input().split()))
    SET = (SET|tmp)

print(n-int(len(SET)))

Fixed submission:
[n,k] = map(int, input().split())
SET = set()
for i in range(k):
  d = int(input())
  tmp = set(map(int, input().split()))
  SET = (SET|tmp)
print(n-int(len(SET)))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print("Hello World")
else:
    print(a+b)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


lst = list(map(int, input().split()))
if lst[0] == 1:
    print("Hello World")
else:
    print(lst[1] + lst[2])

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
if((a*b)%2 == 0):
    print("Even")
else:
    print("Odd")

Fixed submission:
a, b = map(int, input().split())
if((a*b)%2 == 0):
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math
b, c, tanshin, choshin = [int(x) for x in stdin.readline().rstrip().split()]
 


choshin12 = choshin * (360 / 60)
if choshin == 0 :
	choshin12 = 360/60
 
tanshin12 = (tanshin * 60 + choshin) * 360 / (12 * 60)
 
rad =  abs( choshin12 - tanshin12 )
 
# 線対称で書いちゃったよ。。。点対称じゃんね
if rad >= 180 :
	rad = 360-rad
 
# 余弦定理とか生まれて初めてです・・・
a = (b ** 2) + (c ** 2) - (2 * b * c * math.cos(math.radians(rad)))
 
# print (math.cos(math.radians(rad)))
 
a = math.sqrt(a)

# print(tanshin)
# print(choshin)
 
# print(tanshin12)
# print(choshin12)
 
# print(rad)
print (a)

Fixed submission:
b = int(input())
a = b % 10

if a == 2 or a == 4 or a == 5 or a == 7 or a == 9 :
  print("hon")
elif a == 0 or a == 1 or a == 6 or a == 8 :
  print("pon")
elif a == 3 :
  print("bon")

Buggy python submission (verdict: Runtime Error):
cnt = int(input())

input_line = input()


if len(input_line) > cnt :
	print(input_line[:cnt] + "...")

else :
	print(input_line)

Fixed submission:
b = int(input())
a = b % 10

if a == 2 or a == 4 or a == 5 or a == 7 or a == 9 :
  print("hon")
elif a == 0 or a == 1 or a == 6 or a == 8 :
  print("pon")
elif a == 3 :
  print("bon")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

need = 1
tap = a


while tap < b:
	if a == 0 or a == 1 or b < a or b == 0:
		need = 0
		break
	tap += (a - 1)
	need += 1
print (need)

Fixed submission:
# 整数の入力
s = input()
t = input()

cnt = 0
if s[0] == t[0] :
	cnt += 1

if s[1] == t[1] :
	cnt += 1

if s[2] == t[2] :
	cnt += 1

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

a = int(input())

cnt = 0

for i in range(1,10):
	cnt += 1
	if i == a :
		print (cnt)
		sys.exit()
if a < 100 :
	print (cnt)
	sys.exit()
for j in range(100,1000):
	cnt += 1
	if j == a :
		print (cnt)
		sys.exit()
        
if a < 10000 :
	print (cnt)
	sys.exit()
for k in range(10000,100000):
	cnt += 1
	if k == a :
		print (cnt)
		sys.exit()
if a == 100000 :
	print (cnt)
	sys.exit()


Fixed submission:
nums = input().split()

a = int (nums[0])
b = int (nums[1])
c = int (nums[2])

nokori = a - b

s = c-nokori


if s < 0 :
	s = 0

print (s)

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

cnt = 0

for i in range(1,10):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

for j in range(100,1000):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

for k in range(10000,100000):
	cnt += 1
	if i < a :
		print (cnt)
		exit()



Fixed submission:
nums = input().split()

a = int (nums[0])
b = int (nums[1])
c = int (nums[2])

nokori = a - b

s = c-nokori


if s < 0 :
	s = 0

print (s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")


Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if D2-D1 == 1:
  print(0)
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")



Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if D2-D1 == 1:
  print(0)
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")


Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if D2-D1 == 1:
  print(0)
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
n = input()
a = n / 1.08
if float(n%1.08):
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")

Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if D2-D1 == 1:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
n =input()
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")


Fixed submission:
n=int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
n = input()
a = n / 1.08
if float(n%1.08) ==0:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
print(x,v,n)
if v == n:
  print(x)
else:
  print(":(")


Fixed submission:
n=int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
n = input()
a = n / 1.08
if float(n%1.08) ==0:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
print(x,v,n)
if v == n:
  print(x)
else:
  print(":(")


Fixed submission:
n=int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
n = input()
a = n / 1.08
if float(n%1.08):
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")

Fixed submission:
n=int(input())
a = n / 1.08
if a-int(a) == 0.00:
      x = int(a)
else:
      x = int(a) + 1
v = int(x * 1.08)
if v == n:
  print(x)
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
A = list(map(int,input().split()))
A.sort()
B = copy.copy(A)
cnt = 0
for i in range(N):
    if A.count(A[i])> 1:
        continue
    for j in range(len(B)):
        if 2 * B[j] > A[i]:
            cnt += 1
            break
        if A[i] % B[j] == 0:
            break
        if j
print(cnt)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    MAX = A[-1]
    dp = [1] * (MAX + 5)
    ANS = 0
    for i in range(N):
        if dp[A[i]] == 0:
            continue
        for j in range(MAX+1):
            if A[i]*j > MAX:
                break
            dp[A[i]*j] = 0
        dp[A[i]] = 0
        if i < N-1 and A[i] == A[i+1]:
            continue
        ANS += 1
    print(ANS)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
A = list(map(int,input().split()))
A.sort()
B = copy.copy(A)
cnt = 0
for i in range(N):
    if A.count(A[i])> 1:
        continue
    for j in range(len(B)):
        if 2 * B[j] > A[i]:
            cnt += 1
            break
        if A[i] % B[j] == 0:
            B.remove(A[i])
            break
        if j
print(cnt)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    MAX = A[-1]
    dp = [1] * (MAX + 5)
    ANS = 0
    for i in range(N):
        if dp[A[i]] == 0:
            continue
        for j in range(MAX+1):
            if A[i]*j > MAX:
                break
            dp[A[i]*j] = 0
        dp[A[i]] = 0
        if i < N-1 and A[i] == A[i+1]:
            continue
        ANS += 1
    print(ANS)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = str(input())

import functools


def popcount(bits: str):
    return len([elm for elm in bits if elm == '1'])


@functools.lru_cache(maxsize=200000)
def f(num):
    if num == 0:
        return 0
    else:
        pc = popcount('{:b}'.format(num))
        return 1 + f(num % pc)


def reverse_bit(bits: str, digit):
    def toggle(a):
        if a == '1':
            return '0'
        else:
            return '1'

    ret = list(bits)
    ret[digit-1] = toggle(bits[digit-1])
    return ''.join(ret)

def convert(x: str):
    ans = 0
    i = 0
    for elm in list(x)[::-1]:
        if elm == '1':
            ans += 2 ** i
        i += 1
    return ans


for i in range(1, N+1):
    bits = reverse_bit(X, i)
    pc = popcount(bits)
    # print(f'# {bits} {convert(bits)} {pc}')
    print(f(convert(bits)))

Fixed submission:
L, R, d = [int(x) for x in input().split()]

lst = list(range(d, 101, d))

ret = list(filter(lambda x: L <= x <= R, lst))

# print(ret)
print(len(ret))
Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())

C = []
for _ in range(H):
    C.append(input())

from pprint import pprint
# pprint(C)
import sys
from collections import Counter
from itertools import product, combinations

counter = Counter()
for row in C:
    counter.update(row)
n_blacks = counter['#']

if n_blacks < K:
    print(0)
    sys.exit()
# elif n_blacks == K:
#     # 黒がいない行、列があると破綻するからこの elif は NG
#     print(1)
#     sys.exit()


board = ''
for row in C:
    board += row

pprint(board)

def get_calc_board_index_row(board, n_rows, n_cols):
    b = board
    _n_rows = n_rows
    _n_cols = n_cols
    def fun(n_row):
        # row number
        return list(range(_n_rows * n_row, _n_rows * n_row + _n_cols))
    return fun

calc_board_index_row = get_calc_board_index_row(board=board, n_rows=H, n_cols=W)

def get_calc_board_index_col(board, n_rows, n_cols):
    b = board
    _n_rows = n_rows
    _n_cols = n_cols
    def fun(n_col):
        # row number
        return list(range(
            n_col,
            n_col + _n_rows * _n_cols,
            _n_cols))
    return fun

calc_board_index_col = get_calc_board_index_col(board=board, n_rows=H, n_cols=W)

def get_print_board(board, n_rows, n_cols):
    b = board
    _n_rows = n_rows
    _n_cols = n_cols
    def fun():
        # row number
        for r in _n_rows:
            print(b[r*_n_cols, r*_n_cols+_n_cols])
    return fun

print_board = get_print_board(board, H, W)

# sys.exit()

# 消し込む行と列の数 (n_row, n_col) について、すべてのパターンで繰り返す
# i = 0
ans = 0
for n_row, n_col in product(range(H), range(K)):
    # n_row 個の行を消し込む場合の、行番号の組み合わせ
    choosed_rows = list(combinations(range(H), n_row))
    # n_col 個の列を消し込む場合の、列番号の組み合わせ
    choosed_cols = list(combinations(range(W), n_col))

    # 消し込みするマスを計算
    board_idx = set()
    # for removing_row_numbers in choosed_rows:
    #     for r in removing_row_numbers:
    #         board_idx.update(calc_board_index_row(r))
    # for removing_col_numbers in choosed_cols:        
    #     for c in removing_col_numbers:
    #         board_idx.update(calc_board_index_col(c))
    for i_r, i_c in product(range(len(choosed_rows)), range(len(choosed_cols))):
        for _ in choosed_rows[i_r]:
            board_idx.update(calc_board_index_row(_))
        for _ in choosed_cols[i_c]:
            board_idx.update(calc_board_index_col(_))

        rest_blacks = 0
        for ix in range(len(board)):
            if ix in board_idx: continue
            if board[ix] == '#': rest_blacks += 1

        if rest_blacks == K:
            # print(removing_row_numbers, removing_col_numbers)
            ans += 1
    # print({
    #     'n_row': n_row,
    #     'n_col': n_col,
    #     'choosed_rows': choosed_rows,
    #     'choosed_cols' : choosed_cols,
    #     'board_idx': board_idx,
    #     'rest_blacks': rest_blacks
    # })
    # print()

print(ans)

Fixed submission:
from collections import Counter

N = int(input())
S = []
for i in range(N):
    s_in = input()
    # if s_in == '' or s_in is None: break
    S.append(s_in)

counter = Counter(S)
for ans in ['AC', 'WA', 'TLE', 'RE']:
    print(f'{ans} x {counter[ans]}')
Buggy python submission (verdict: Runtime Error):
X, N = [int(i) for i in input().split()]
if N == 0:
    print(X)
else:
    Ps = set([int(i) for i in input().split()])
    # coords = set(range(min(Ps), max(Ps)+1))
    # for p in Ps:
    #     coords.remove(p)
    # if X in coords:
    #     print(X)
    # else:
    #     ret = [ (v, abs(X-v)) for v in coords ]
    #     minval = min(ret, key=lambda elm: elm[1])[0]
    #     print(
    #         min([ elm[0] for elm in ret if minval == elm[0] ])
    #     )
    coords = list(range(1, 101))
    if not X in Ps:
        print(X)
    i = X - 1
    diff = 0
    while True:
        if not coords[i - diff] in Ps:
            print(coords[i - diff])
            break
        if not coords[i + diff] in Ps:
            print(coords[i + diff])
            break
        diff += 1

Fixed submission:
X, N = [int(i) for i in input().split()]
if N == 0:
# if False:
    print(X)
else:
    Ps = set([int(i) for i in input().split()])
    # if not X in Ps:
    #     print(X)

    # print(f'{X} {sorted(Ps)}')
    diff = 0
    while True:
        a = X - diff
        if a not in Ps:
            print(a)
            break
        a = X + diff
        if a not in Ps:
            print(a)
            break
        diff += 1

Buggy python submission (verdict: Runtime Error):
X, N = [int(i) for i in input().split()]
if N == 0:
    print(X)
else:
    Ps = [int(i) for i in input().split()]
    coords = set(range(min(Ps), max(Ps)+1))
    for p in Ps:
        coords.remove(p)
    if X in coords:
        print(X)
    else:
        ret = [ (v, abs(X-v)) for v in coords ]
        minval = min(ret, key=lambda elm: elm[1])[0]
        print(
            min([ elm[0] for elm in ret if minval == elm[0] ])
        )

Fixed submission:
X, N = [int(i) for i in input().split()]
if N == 0:
# if False:
    print(X)
else:
    Ps = set([int(i) for i in input().split()])
    # if not X in Ps:
    #     print(X)

    # print(f'{X} {sorted(Ps)}')
    diff = 0
    while True:
        a = X - diff
        if a not in Ps:
            print(a)
            break
        a = X + diff
        if a not in Ps:
            print(a)
            break
        diff += 1