Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
xys = []
for i in range(N):
  x, y = map(int, input().split())
  xys.append((x, y))
xs = sorted(map(lambda xy: xy[0], xys))
ys = sorted(map(lambda xy: xy[1], xys))
rs = []
for i in range(N):
  for j in range(i+1, N):
    x1 = xs[i]
    x2 = xs[j]
    for k in range(N):
      for l in range(k+1, N):
        y1 = ys[k]
        y2 = ys[l]
        n = len([(x, y) for x, y in xys if x1 <= x <= x2 and y1 <= y <= y2])
        #xys2 = filter(lambda xy: x1 <= xy[0] <= x2 and y1 <= xy[1] <= y2, xys)
        if n >= K:
          r = (x2-x1)*(y2-y1)
          rs.append(r)
r = min(rs)
print(r)


Fixed submission:
N, K = map(int, input().split())
xys = []
for i in range(N):
  x, y = map(int, input().split())
  xys.append((x, y))
xs = sorted(map(lambda xy: xy[0], xys))
ys = sorted(map(lambda xy: xy[1], xys))
rs = []
for i in range(N):
  for j in range(i+1, N):
    x1 = xs[i]
    x2 = xs[j]
    for k in range(N):
      for l in range(k+1, N):
        y1 = ys[k]
        y2 = ys[l]
        n = len([(x, y) for x, y in xys if x1 <= x <= x2 and y1 <= y <= y2])
        #xys2 = filter(lambda xy: x1 <= xy[0] <= x2 and y1 <= xy[1] <= y2, xys)
        if n >= K:
          r = (x2-x1)*(y2-y1)
          rs.append(r)
r = min(rs)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
  As = list(map(int, input().split()))
  A.append(As)
r = 0
for i in range(N):
  for j in range(i+1, N):
    ok = False
    for k in range(N):
      if A[i][j] > A[i][k]+A[k][j]:
        print(-1)
        exit()
      if A[i][j] == A[i][k]+A[k][j] and k != i and k != j:
        ok = True
    if not(ok):
      r += A[i][j]
print(r)


Fixed submission:
N = int(input())
A = []
for i in range(N):
  As = list(map(int, input().split()))
  A.append(As)
r = 0
for i in range(N):
  for j in range(i+1, N):
    ok = False
    for k in range(N):
      if A[i][j] > A[i][k]+A[k][j]:
        print(-1)
        exit()
      if A[i][j] == A[i][k]+A[k][j] and k != i and k != j:
        ok = True
    if not(ok):
      r += A[i][j]
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
r = 0
for i in range(N):
  As = list(map(int, input().split()))
  A.append(As)
  r += sum(As)
#print(r)
G = [[-1]*N for i in range(N)]
for i in range(N):
  for j in range(N):
    ok = False
    for k in range(N):
      if A[i][j] > A[i][k]+A[k][j]:
        print(-1)
        exit()
      if A[i][j] == A[i][k]+A[k][j] and k != i and k != j:
        ok = True
    if ok:
      r -= A[i][j]
r = r//2
print(r)


Fixed submission:
N = int(input())
A = []
for i in range(N):
  As = list(map(int, input().split()))
  A.append(As)
r = 0
for i in range(N):
  for j in range(i+1, N):
    ok = False
    for k in range(N):
      if A[i][j] > A[i][k]+A[k][j]:
        print(-1)
        exit()
      if A[i][j] == A[i][k]+A[k][j] and k != i and k != j:
        ok = True
    if not(ok):
      r += A[i][j]
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
N, M, R = map(int, input().split())
rs = list(map(int, input().split()))
D = [[100000*200]*N for i in range(N)]
for i in range(N):
  D[i][i] = 0
for i in range(M):
  A, B, C = map(int, input().split())
  A, B = A-1, B-1
  D[A][B] = C
  D[B][A] = C
for k in range(N):
  for i in range(N):
    for j in range(N):
      D[i][j] = min(D[i][j], D[i][k]+D[k][j])
#print(D)
r = 100000*200
for i in range(R):
  rs[i] -= 1
import itertools
for rs2 in itertools.permutations(rs):
  r2 = 0
  for i in range(1, R):
    r2 += D[rs2[i-1]][rs2[i]]
  r = min(r, r2)
print(r)


Fixed submission:
N, M, R = map(int, input().split())
rs = list(map(int, input().split()))
rs = [r-1 for r in rs]
D = [[100000*2000]*N for i in range(N)]
for i in range(N):
  D[i][i] = 0
for i in range(M):
  A, B, C = map(int, input().split())
  A, B = A-1, B-1
  D[A][B] = C
  D[B][A] = C
for k in range(N):
  for i in range(N):
    for j in range(N):
      D[i][j] = min(D[i][j], D[i][k]+D[k][j])
#print(D)
r = 100000*2000
import itertools
for rs2 in itertools.permutations(rs):
  r2 = 0
  for i in range(1, R):
    r2 += D[rs2[i-1]][rs2[i]]
  r = min(r, r2)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
xys = []
for i in range(N):
  x, y = map(int, input().split())
  xys.append((x, y))
Isx = sorted(range(N), key=lambda i: (xys[i][0], xys[i][1]))
Isy = sorted(range(N), key=lambda i: (xys[i][1], xys[i][0]))
#print(Isx)
#print(Isy)
M = set()
for i in range(N):
  p, q = Isx[i-1], Isx[i]
  a, b = xys[p]
  c, d = xys[q]
  cost = min(abs(a-c), abs(b-d))
  M.add((cost, p, q))
for i in range(N):
  p, q = Isy[i-1], Isy[i]
  a, b = xys[p]
  c, d = xys[q]
  cost = min(abs(a-c), abs(b-d))
  M.add((cost, p, q))
#print(M)
F = [{i} for i in range(N)]
S = list(M)
S.sort(reverse=True)
#print(S)
r = 0
while S:
  cost, p, q = S.pop()
  for i in range(N):
    s = F[i]
    if p in s:
      break
  for j in range(N):
    s = F[j]
    if q in s:
      break
  #print(i, j)
  if i != j:
    r += cost
    s = F[i]|F[j]
    F.pop(max(i, j))
    F.pop(min(i, j))
    F.append(s)
  #print(F)
print(r)


Fixed submission:
N = int(input())
xys = []
for i in range(N):
  x, y = map(int, input().split())
  xys.append((x, y))
Isx = sorted(range(N), key=lambda i: (xys[i][0], xys[i][1]))
Isy = sorted(range(N), key=lambda i: (xys[i][1], xys[i][0]))
#print(Isx)
#print(Isy)
M = set()
for i in range(1, N):
  p, q = Isx[i-1], Isx[i]
  a, b = xys[p]
  c, d = xys[q]
  cost = min(abs(a-c), abs(b-d))
  M.add((cost, p, q))
for i in range(1, N):
  p, q = Isy[i-1], Isy[i]
  a, b = xys[p]
  c, d = xys[q]
  cost = min(abs(a-c), abs(b-d))
  M.add((cost, p, q))
#print(M)
S = list(M)
S.sort(reverse=True)
#print(S)
r = 0
UF = list(range(N))
def par(m):
  if UF[m] == m:
    return m
  ret = par(UF[m])
  UF[m] = ret
  return ret
while S:
  cost, p, q = S.pop()
  i = par(p)
  j = par(q)
  if i != j:
    r += cost
    UF[i] = j
  #print(UF)
print(r)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
for i in range(N+M):
  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")


Fixed submission:
N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
    unite(N+l, i)
#print(UF)
#for i in range(N+M):
#  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = []
S = [[] for i in range(M)]
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
  for l in Ls:
    S[l].append(i)
#print(L)
#print(S)
UF = list(range(N+M))
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")


Fixed submission:
N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
    unite(N+l, i)
#print(UF)
#for i in range(N+M):
#  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  if (n-s)%p == 0:
    b = (n-s)//p+1
    bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)


Fixed submission:
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s > n:
  print(-1)
  exit()
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  if (n-s)%p == 0:
    b = (n-s)//p+1
    bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  b = (n-s)//p+1
  bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)


Fixed submission:
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s > n:
  print(-1)
  exit()
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  if (n-s)%p == 0:
    b = (n-s)//p+1
    bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
N = input()

N = N % 10

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

Fixed submission:
N = int(input())

N = N % 10

if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
  print("hon")
  
elif N == 0 or N == 1 or N == 6 or N == 8:
  print("pon")
  
else:
  print("bon")
Buggy python submission (verdict: Runtime Error):
money = input()

oturi = 1000 - money % 1000

print(oturi)

Fixed submission:
money = int(input())

rem = money % 1000

oturi = 0
if rem != 0:
  oturi = 1000 - rem

print(oturi)
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input()).split()
if a+b+c <= 21:
	print("win")
else:
	print("bust")

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c <= 21:
	print("win")
else:
	print("bust")

Buggy python submission (verdict: Runtime Error):
a,b,c =split(int(input()))
if a+b+c <= 21:
	print("win")
else:
	print("bust")

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c <= 21:
	print("win")
else:
	print("bust")
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
Ans = [int(input()) for i in range(q)]
if k > q:
	for i in range(n):
		print("Yes")
else:	
	C = ["No"]*n
	for j in Ans:
		if Ans.count(j) > q - k:
			C[j-1] = "Yes"
		else:
			pass
	for l in range(n):
		print(C[l])

Fixed submission:
n,k,q = map(int,input().split())
points = []
for i in range(n):
	points.append(k-q)
for i in range(q):
	points[int(input())-1]+=1
for i in range(n):
	if points[i]>0:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
Ans = [int(input()) for i in range(q)]
for j in range(n):
	if k - q + Ans.count(j+1) > 0:
		print("Yes")
	else:
		print("No")

Fixed submission:
n,k,q = map(int,input().split())
points = []
for i in range(n):
	points.append(k-q)
for i in range(q):
	points[int(input())-1]+=1
for i in range(n):
	if points[i]>0:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
Ans = []
for i in range(q):
	Ans.append(int(input()))
for j in range(n):
	if k - q + Ans.count(j+1) > 0:
		print("Yes")
	else:
		print("No")

Fixed submission:
n,k,q = map(int,input().split())
points = []
for i in range(n):
	points.append(k-q)
for i in range(q):
	points[int(input())-1]+=1
for i in range(n):
	if points[i]>0:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=list(range(l,r+1))
modlist=[]
for i in lst:
	q,mod = divmod(i,2019)
	modlist.append(mod)
sor = sorted(modlist)
print(sor[0]*sor[1])

Fixed submission:
l,r=map(int,input().split())
if r-l+1<=2019:
	modlist=[]
	lst=list(range(l,r+1))
	for i in range(len(lst)):
		for j in range(i+1,len(lst)):
			q,mod = divmod(lst[i]*lst[j],2019)
			modlist.append(mod)
	print(min(modlist))
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
n = B//C
m = (A-1)//C
p = B//D
q = (A-1)//D

x = B//(C*D// math.gcd(C,D))
y = (A-1)//(C*D// math.gcd(C,D))
L = (B-A+1)-((n-m)+(p-q)-(x-y))
print(L)

Fixed submission:
a,b,c,d = map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
e = gcd(c,d)
f = c * d // e

b_c = b // c
s_c = (a-1) // c
C = b_c - s_c

b_d = b // d
s_d = (a-1) // d
D = b_d - s_d

b_cd = b // f
s_cd = (a-1) // f
CD = b_cd - s_cd

ans = b - a + 1 - (C + D - CD)
print(ans)

Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
import math

n = B//C
m = (A-1)//C
p = B//D
q = (A-1)//D
x = B//(C*D// math.gcd(C,D))
y = (A-1)//(C*D// math.gcd(C,D))
L = (B-A+1)-((n-m)+(p-q)-(x-y))
print(L)

Fixed submission:
a,b,c,d = map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
e = gcd(c,d)
f = c * d // e

b_c = b // c
s_c = (a-1) // c
C = b_c - s_c

b_d = b // d
s_d = (a-1) // d
D = b_d - s_d

b_cd = b // f
s_cd = (a-1) // f
CD = b_cd - s_cd

ans = b - a + 1 - (C + D - CD)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=a-b
if k != 1:
	print(c)
else:
	print(0)

Fixed submission:
a,b=map(int,input().split())
c=a-b
if b!= 1:
	print(c)
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
n = input()
x = (n-2)*180
print(x)

Fixed submission:
n = int(input())
x = (n-2)*180
print(x)
Buggy python submission (verdict: Runtime Error):
lst=[]
for i in 5:
	lst.append(int(input()))
k = int(input())
sor = sorted(lst)
if sor[4] - sor[0] > k:
	print(":(")
else:
	print("Yay!")


Fixed submission:
lst=[]
for i in range(5):
	lst.append(int(input()))
k = int(input())
sor = sorted(lst)
if sor[4] - sor[0] > k:
	print(":(")
else:
	print("Yay!")
Buggy python submission (verdict: Runtime Error):

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = my_function.chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])

Fixed submission:

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])

Buggy python submission (verdict: Runtime Error):
from my_func import my_function

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = my_function.chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])

Fixed submission:

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
if b == "+":
	print(int(a)+int(b))
else:
	print(int(a)-int(b))

Fixed submission:
a,b,c = input().split()
if b == "+":
	print(int(a)+int(c))
else:
	print(int(a)-int(c))
Buggy python submission (verdict: Runtime Error):
c = input()
lst = [a,e,i,o,u]
if c in lst:
	print("vowel")
else:
	print("consonant")

Fixed submission:
c = input()
lst = ["a","e","i","o","u"]
if c in lst:
	print("vowel")
else:
	print("consonant")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a,b,c == 5,5,7 
	print("YES")
else:
	print("NO")

Fixed submission:
s=list(map(int,input().split()))
if s == [5,5,7] or s == [7,5,5] or s == [5,7,5]: 
	print("YES")
else:
	print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a,b,c == 5,5,7 or a,b,c == 7,5,5 or a,b,c == 5,7,5:
	print("YES")
else:
	print("NO")

Fixed submission:
s=list(map(int,input().split()))
if s == [5,5,7] or s == [7,5,5] or s == [5,7,5]: 
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n % 7 == 0 or n % 4 == 0:
   print("Yes")
elif (n % 28) % 4 == 0 or (n % 28) % 7 == 0:
   print("Yes")
else:
   print("No")

Fixed submission:
n,k = map(int, input().split())
if n%k == 0:
    print("0")
else: 
       print("1")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
 
dp = [1] * (N + 1)
ans = 1
for i in range(2, N + 1):
    for j in range(i, N + 1, i):
        dp[j] += 1
    ans += i * dp[i]
    
print(ans)

Fixed submission:
N = int(input())

ans = 0
for i in range(1, N + 1):
    j = N // i
    ans += i * (j * (j + 1) // 2)

print(ans)

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

dp = [1] * (N + 1)
ans = 1
for i in range(2, N + 1):
    for j in range(i, N + 1, i):
        dp[j] += 1
    ans += i * dp[i]
    
print(ans)

Fixed submission:
N = int(input())

ans = 0
for i in range(1, N + 1):
    j = N // i
    ans += i * (j * (j + 1) // 2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i, val in enumerate(A):
    curr_set = set(A[:i] + A[i+1:])
    if val in curr_set:
        continue
    for j in range(1, int(sqrt(val)) + 1):
        if (val % j == 0 and j in curr_set) or val / j in curr_set:
            break
    else:
        ans += 1
print(ans)

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

A.sort()
max_A = A[-1]
arr = [0] * (max_A + 1)

for val in A:
    arr[val] += 1
    if arr[val] == 1:
        for j in range(2*val, max_A + 1, val):
            arr[j] += 2

print(arr.count(1))

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

ans = 0
for i, A_i in enumerate(A):
    for A_j in (A[:i] + A[i+1:]):
        if (A_i / A_j) % 1 == 0:
            break
    else:
        ans += 1
print(ans)

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

A.sort()
max_A = A[-1]
arr = [0] * (max_A + 1)

for val in A:
    arr[val] += 1
    if arr[val] == 1:
        for j in range(2*val, max_A + 1, val):
            arr[j] += 2

print(arr.count(1))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

def expect_val(x):
    return (1 / x) * ((x * (x + 1)) / 2)


ans = []
curr_max = 0
for i in range(N - 1, K - 2, -1):
    curr_vals = p[i - K + 1:i + 1]
    if sum(curr_vals) >= curr_max:
        curr_max = sum(curr_vals)
        ans = curr_vals

print("{}".format(sum(list(map((lambda x: expect_val(x)), ans)))))

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

E = [(1 + p) / 2 for p in p]
curr_sum = sum(E[:K])
curr_max = curr_sum

for i in range(N - K):
    curr_sum += (E[i + K] - E[i])
    curr_max = max(curr_max, curr_sum)

print(curr_max)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if min(P[:i + 1]) >= P[i]:
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
curr_min = 0
for i in range(N):
    if not curr_min:
        curr_min = P[i]
        cnt += 1
    else:
        if P[i] <= curr_min:
            curr_min = P[i]
            cnt += 1

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

A, B = map(int, input().split())

def lcm(A, B):
    return (A * B) // math.gcd(A, B)


print(lcm(A, B))

Fixed submission:
import fractions

A, B = map(int, input().split())

def lcm(A, B):
    return (A * B) // fractions.gcd(A, B)


print(lcm(A, B))
Buggy python submission (verdict: Runtime Error):
from heapq import heapify, heappush, heappop
N = int(input())
heap = []
heapify(heap)
for i in range(1, int(N**(0.5))):
    if N % i == 0:
        heappush(heap, i - 1 + N // i - 1)
print(heappop(heap))

Fixed submission:
from heapq import heapify, heappush, heappop
N = int(input())
heap = []
heapify(heap)
for i in range(1, int(N**(0.5)) + 1):
    if N % i == 0:
        heappush(heap, i - 1 + N // i - 1)
print(heappop(heap))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

if K > Q: 
    for _ in range(N):
        print("Yes")
else:
    for i in range(1, N + 1):
        if i in A:
            print("{}".format("Yes" if (K + A.count(i) - Q) > 0 else "No"))
        else:
            print("No")

Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
pnts = [0] * N

for i in A:
    pnts[i - 1] += 1

for i in pnts:
    if K - Q + i > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
pnts = np.array([K] * N) - np.ones(N, int) * Q

for i in range(1, N + 1):
    if (pnts[i - 1] + A.count(i)) > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
pnts = [0] * N

for i in A:
    pnts[i - 1] += 1

for i in pnts:
    if K - Q + i > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
pnts = np.array([K] * N)
reduc = np.ones(N, int)

# main
for i in A:
    pnts -= reduc
    pnts[i - 1] += 1
    
# output
for i in pnts:
    print("{}".format("Yes" if i > 0 else "No"))

Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
pnts = [0] * N

for i in A:
    pnts[i - 1] += 1

for i in pnts:
    if K - Q + i > 0:
        print("Yes")
    else:
        print("No")