Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uf = UnionFind(N)

for m in range(M):
  a, b = map(int, input().split())
  uf.union(a, b)
  
print(len(uf.roots()) - 1)

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

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uf = UnionFind(N+1)

for m in range(M):
  a, b = map(int, input().split())
  uf.union(a, b)
  
print(len(uf.roots()) - 1 - 1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

lst = [[0, 0] for _ in range(N)]
d = 0
for i in range(N):
  x, y = map(int, input().split())
  lst[i][0] = x
  lst[i][1] = y
  
  for j in range(i):
    #print(lst[j], [x, y])
    d = max(d, abs(lst[j][0] - x)+abs(lst[j][1] - y))
  
print(d)

Fixed submission:
N = int(input())

lst = [[0, 0, 0, 0] for _ in range(N)]
p = [0] * N
m = [0] * N

for i in range(N):
  x, y = map(int, input().split())
  lst[i][0] = x
  lst[i][1] = y
  p[i] = x+y
  m[i] = x-y
  
d = max( max(p) - min(p), max(m) - min(m) )
print(d)
Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
MOD = 998244353

CONV = [1]
ans = 0

for i in range(1, N):
  CONV.append(CONV[-1] * (N-i) // i)

for k in range(K+1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (CONV[k] * pow(M-1, N-1-k, MOD)) % MOD
  
print(ans * M % MOD)

Fixed submission:
N, M, K = map(int, input().split())
MOD = 998244353

ans = 0

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % MOD
        self.ifact[n] = pow(self.fact[n], MOD-2, MOD)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % MOD
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %MOD
        return comb
comb = combination(N)

  
for k in range(K+1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (comb.comb(N-1, k) * pow(M-1, N-1-k, MOD)) % MOD
  
print(ans * M % MOD)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
MOD = 998244353

CONV = 1
KAIJ = (M - 1) ** (N - 1)
ans = 0

for k in range(K + 1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (M * CONV * KAIJ) % MOD
  CONV = CONV * (N - 1 - k) // (k + 1)
  KAIJ = KAIJ // (M - 1)
  
print(ans % MOD)

Fixed submission:
N, M, K = map(int, input().split())
MOD = 998244353

ans = 0

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % MOD
        self.ifact[n] = pow(self.fact[n], MOD-2, MOD)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % MOD
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %MOD
        return comb
comb = combination(N)

  
for k in range(K+1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (comb.comb(N-1, k) * pow(M-1, N-1-k, MOD)) % MOD
  
print(ans * M % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
MOD = 998244353

dp = [[0] * (N + 1) for _ in range(N)] 
dp[0][0] = M

for i in range(N - 1):
  for j in range(N):
    dp[i+1][j] += dp[i][j] * (M-1)
    dp[i+1][j+1] = dp[i][j] * 1
print(sum(dp[-1][:K+1]) % MOD)

Fixed submission:
N, M, K = map(int, input().split())
MOD = 998244353

ans = 0

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % MOD
        self.ifact[n] = pow(self.fact[n], MOD-2, MOD)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % MOD
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %MOD
        return comb
comb = combination(N)

  
for k in range(K+1):
  # M x (N-1)Ck x (M-1) ^ (N - 1 - k)
  ans += (comb.comb(N-1, k) * pow(M-1, N-1-k, MOD)) % MOD
  
print(ans * M % MOD)
Buggy python submission (verdict: Runtime Error):
from collections import deque, Counter

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]
cnt_A = Counter(A)

ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  #c = d.count(-a - 2 * i)
  c = cnt_A[-a - 2 * i]
  ans += c
print(ans)

Fixed submission:
X = int(input())

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
      #else:
      #  divisors.append([i, i])
  return divisors


def solve(a, b, c):
  D = (b**2 - 4*a*c) ** (1/2)
  x_1 = (-b + D) / (2 * a)
  x_2 = (-b - D) / (2 * a)
  return x_1, x_2

for pattern in make_divisors(X):
  diff = pattern
  A = 5
  B = 5 * (diff ** 2)
  C = diff ** 4 - X//diff
  sekiss = solve(A, B, C)
  for sekis in sekiss:
    if sekis == int(sekis):
      #print(int(sekis), diff)
      kouhos = solve(1, -diff, -int(sekis))
      if kouhos[0].imag == 0.0:
        print(int(kouhos[0]), int(kouhos[0] - diff))
      break
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]


ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  c = d.count(-a - 2 * i)
  ans += c
print(ans)

Fixed submission:
from collections import deque, Counter

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]
cnt_A = Counter(A)

ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  #c = d.count(-a - 2 * i)
  c = cnt_A[-a - 2 * i]
  ans += c
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

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

for i in range(N):
  A[i] -= i


ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  c = d.count(-a - 2 * i)
  ans += c
print(ans)

Fixed submission:
from collections import deque, Counter

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]
cnt_A = Counter(A)

ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  #c = d.count(-a - 2 * i)
  c = cnt_A[-a - 2 * i]
  ans += c
print(ans)

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

for i in range(N):
  A[i] -= i

ans = sum(list(
  A[i+1:].count(-A[i] - 2 * i) for i in range(N)
))
  
print(ans)

Fixed submission:
from collections import deque, Counter

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]
cnt_A = Counter(A)

ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  #c = d.count(-a - 2 * i)
  c = cnt_A[-a - 2 * i]
  ans += c
print(ans)

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

for i in range(N):
  A[i] -= i


ans = 0
for i in range(N):
  a = A[i]
  c = A[i+1:].count(-a - 2 * i)
  ans += c
  
print(ans)

Fixed submission:
from collections import deque, Counter

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]
cnt_A = Counter(A)

ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  #c = d.count(-a - 2 * i)
  c = cnt_A[-a - 2 * i]
  ans += c
print(ans)
Buggy python submission (verdict: Runtime Error):
S = [ input() for _ in range(N) ]
print(len(set(S)))

Fixed submission:
N = int(input())
S = [ input() for _ in range(N) ]
print(len(set(S)))
Buggy python submission (verdict: Runtime Error):
N = str(input())

ans = 0
for i in range(1, N+1):
  if i % 3 != 0 and i % 5 != 0:
    ans += i
print(ans)

Fixed submission:
N = int(input())
 
ans = 0
for i in range(1, N+1):
  if i % 3 != 0 and i % 5 != 0:
    ans += i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math

K = int(input())

ans = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    for k in range(1, K+1):
      ans += math.gcd(math.gcd(i, j), k)
    
print(ans)

Fixed submission:
import math
 
K = int(input())
 
ans = 0
for i in range(1, K+1):
  for j in range(i+1, K+1):
    for k in range(j+1, K+1):
        ans += math.gcd(i, math.gcd(j, k)) * 6

for i in range(1, K+1):
    for j in range(i+1, K+1):
        ans += math.gcd(i, j) * 6

for i in range(1, K+1):
    ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
MOD = 10**9 + 7

import numpy as np
 
def prepare(n, MOD):
    nrt = int(n ** 0.5) + 1
    nsq = nrt * nrt
    facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
    facts[0, 0] = 1
    for i in range(1, nrt):
        facts[:, i] = facts[:, i] * facts[:, i - 1] % MOD
    for i in range(1, nrt):
        facts[i] = facts[i] * facts[i - 1, -1] % MOD
    facts = facts.ravel().tolist()
 
    invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
    invs[-1, -1] = pow(facts[-1], MOD - 2, MOD)
    for i in range(nrt - 2, -1, -1):
        invs[:, i] = invs[:, i] * invs[:, i + 1] % MOD
    for i in range(nrt - 2, -1, -1):
        invs[i] = invs[i] * invs[i + 1, 0] % MOD
    invs = invs.ravel().tolist()
 
    return facts, invs
s, _ = prepare(N, MOD)
print((2**N - s[N]//(s[A]*s[N-A]) - s[N]//(s[B] * s[N-B]) - 1) % MOD)

Fixed submission:
N, A, B = map(int, input().split())
MOD = 10**9 + 7

def pow(x, y):
  if y == 0:
    return 1
  K = 1
  while y > 1:
    if y % 2 == 0:
      y = y // 2
      x = (x * x) % MOD
    else:
      K = (K * x) % MOD
      y -= 1
  return (K * (x ** y)) % MOD

def comb_mod(p, q):
  bunsi = 1
  bunbo = 1
  for i in range(q):
    bunsi = (bunsi * (p-i)) % MOD
    bunbo = (bunbo * (i+1)) % MOD
  return ((bunsi * pow(bunbo, MOD - 2)) % MOD)

print((pow(2,N) - 1 - comb_mod(N, A) - comb_mod(N, B)) % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
n , k = map(int, input().split())
a = list(int(i) for i in input().split())
 

max_ = 0
for i in range(n-k+1):
  max_ = max(max_, sum(a[i:i+k]))
    
print((max_+k)/2)

Fixed submission:
n , k = map(int, input().split())
a = list(int(i) for i in input().split())
 
temp = sum(a[0:k])
max_  = temp
for i in range(n-k):
  f = a[i]
  s = a[i+k]
  temp -= f
  temp += s
  max_ = max(max_, temp)
    
print((max_+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
def kitai(l):
  return (l+1)/2

n , k = map(int, input().split())
a = list(kitai(int(i)) for i in input().split())


max_ = 0
for i in range(n-k+1):
  max_ = max(max_, sum(a[i:i+k]))
    
print(max_)

Fixed submission:
n , k = map(int, input().split())
a = list(int(i) for i in input().split())
 
temp = sum(a[0:k])
max_  = temp
for i in range(n-k):
  f = a[i]
  s = a[i+k]
  temp -= f
  temp += s
  max_ = max(max_, temp)
    
print((max_+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n , k = map(int, input().split())
a = list(map(int, input().split()))

def kitai(l):
  return (l+1)/2

max_ = 0
for i in range(n-k+1):
  max_ = max(max_, sum(kitai(j) for j in  a[i:i + k]))
  

print(max_)

Fixed submission:
n , k = map(int, input().split())
a = list(int(i) for i in input().split())
 
temp = sum(a[0:k])
max_  = temp
for i in range(n-k):
  f = a[i]
  s = a[i+k]
  temp -= f
  temp += s
  max_ = max(max_, temp)
    
print((max_+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
ab = list(list(map(int, input().split())) for _ in range(n) )

dp = [0] * (h + max(list( node[0] for node in ab )))

for i in range(1, len(dp)):
  d = 10 ** 9
  for a, b in ab:
    d = min(dp[i-a] + b, d)
  dp[i] = d
print(dp[h])

Fixed submission:
h, n = map(int, input().split())
ab = list(list(map(int, input().split())) for _ in range(n) )

dp = [0] * (h + max(list( node[0] for node in ab )))

for i in range(1, len(dp)):
  dp[i] = min(list(dp[i - a] + b for a, b in ab))
print(dp[h])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())

a_list = list(map(int, input().split()))

cnt = 0
for i in range(N):
  if min(a_list[:i+1]) >= a_list[i]:
    cnt += 1
    
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline

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

cnt = 0
min_a  = 10 ** 9
for i in range(N):
  min_a  =  min(min_a,a_list[i])
  if min_a >= a_list[i]:
    cnt += 1
    
print(cnt)

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

a_list = list(map(int, input().split()))

cnt = 0
for i in range(N):
  if min(a_list[:i+1]) >= a_list[i]:
    cnt += 1
    
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline

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

cnt = 0
min_a  = 10 ** 9
for i in range(N):
  min_a  =  min(min_a,a_list[i])
  if min_a >= a_list[i]:
    cnt += 1
    
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy > lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  ans = max(x for x in lst if x < 10**9)
  return ans
  
  
print(max(bfs(i) for i in range((H+2)*(W+2)) if grid[i] != '#'))

Fixed submission:
from collections import deque
import sys

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy >= lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  return max(x for x in lst if x < 10**9)
  
  
print(max(bfs(i) for i in range((H+2)*(W+2)) if grid[i] != '#'))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy > lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  ans = max(x for x in lst if x < 10**9)
  return ans
  
cnt = 0
for i in range((H+2)*(W+2)):
  if grid[i] != '#':
    cnt =  max(cnt,bfs(i))
print(cnt)

Fixed submission:
from collections import deque
import sys

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy >= lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  return max(x for x in lst if x < 10**9)
  
  
print(max(bfs(i) for i in range((H+2)*(W+2)) if grid[i] != '#'))
Buggy python submission (verdict: Runtime Error):
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

all_pattern = list(itertools.permutations([i for i in range(1,N+1)]))
#print(all_pattern)

for i, node in enumerate(all_pattern):
  if node == P:
    p = i
  elif node  ==  Q:
    q = i
    
    
print(abs(p-q))

Fixed submission:
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

all_pattern = list(itertools.permutations([i for i in range(1,N+1)]))
#print(all_pattern)

for i, node in enumerate(all_pattern):
  if node == P:
    p = i
  if node ==  Q:
    q = i
    
    
print(abs(p-q))
Buggy python submission (verdict: Runtime Error):
from functools import reduce
import fractions

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

def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N, M = map(int, input().split())
a_list = list(map(int, input().split()))

lcm = lcm_list(a_list)

print(int(-(-(M//(lcm/2)) // 2)))

Fixed submission:
from functools import reduce
import fractions

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

def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N, M = map(int, input().split())
a_list = list(set(list(map(int, input().split()))))

lcm = 1

for a in a_list:
  lcm = lcm_base(lcm, a)

for a in a_list:
  if (lcm // a) % 2 == 0:
    lcm = 0
    break
if lcm == 0:
  print(0)
elif M == 1 and lcm == 2:
  print(1)
else:
  print(int(-(-M//(lcm//2))/2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
 
l = ''
for i in range(n):
  l += '{} '.format(a.index(i+1)+1)
print(l)

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

s = sorted(range(n), key=lambda x:l[x])

for i in range(n):
  s[i]+= 1
  
print(*s)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
 
for i in range(n):
  print(a.index(i+1)+1 , end=" ")

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

s = sorted(range(n), key=lambda x:l[x])

for i in range(n):
  s[i]+= 1
  
print(*s)

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

for i in range(n):
  print(a.index(i+1)+1 , end=" ")

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

s = sorted(range(n), key=lambda x:l[x])

for i in range(n):
  s[i]+= 1
  
print(*s)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import collections

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k - q] * n

t_cnt = collections.Counter(t)
for i, j in t_cnt.items():
  ans[i] += j
    
for i in ans:
  if i > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import sys
input = sys.stdin.readline
import collections

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k - q] * n

t_cnt = collections.Counter(t)
for i, j in t_cnt.items():
  ans[i-1] += j

for i in ans:
  if i > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k] * n
 
for i in range(max(t)):
    score = i + 1
    ans[i] += t.count(score)
    
for i in ans:
  if i  - q > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import sys
input = sys.stdin.readline
import collections

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k - q] * n

t_cnt = collections.Counter(t)
for i, j in t_cnt.items():
  ans[i-1] += j

for i in ans:
  if i > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k] * n
 
for i in range(max(t)):
    score = i + 1
    ans[i] += t.count(score)
    
for i in ans:
  if i  - q > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import sys
input = sys.stdin.readline
import collections

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k - q] * n

t_cnt = collections.Counter(t)
for i, j in t_cnt.items():
  ans[i-1] += j

for i in ans:
  if i > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 

ans = [k for i in range(n)]

for i in range(max(t)):
    score = i + 1
    ans[i] += t.count(score)
    
res_list = [i - q for i in ans]


for i in res_list:
    if i > 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
import sys
input = sys.stdin.readline
import collections

n, k, q = map(int, input().split(' '))
t = [int(input()) for i in range(q)] 
 
ans = [k - q] * n

t_cnt = collections.Counter(t)
for i, j in t_cnt.items():
  ans[i-1] += j

for i in ans:
  if i > 0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n,m = map(int, input().split(' '))
a_list = list(map(int, input().split(' ')))
 
for i in range(m):
    p = max(a_list)
    a_list.remove(p)
    a_list.append(p // 2)
    
print(sum(a_list))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline

n,m = map(int, input().split(' '))
a_list = [-1 * int(i) for i in input().split() ]
heapq.heapify(a_list)
 
for _ in range(m):
    p = heapq.heappop(a_list)
    q = (-1*p //2) * (-1)
    heapq.heappush(a_list, q)    
    
print(-sum(a_list))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split(' '))
a_list = list(map(int, input().split(' ')))

for i in range(m):
    p = max(a_list)
    a_list.remove(p)
    a_list.append(p // 2)
    
print(sum(a_list))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline

n,m = map(int, input().split(' '))
a_list = [-1 * int(i) for i in input().split() ]
heapq.heapify(a_list)
 
for _ in range(m):
    p = heapq.heappop(a_list)
    q = (-1*p //2) * (-1)
    heapq.heappush(a_list, q)    
    
print(-sum(a_list))