Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
S=[input() for _ in range(n)]

cnt=Counter(S)
maxcnt=cnt.most_common()[0][1]
ans=[]
for i in range(len(cnt)):
  if cnt.most_common()[i][1]==maxcnt:
    ans.append(cnt.most_common()[i][0])
  else:
    break
ans.sort()
print(*ans,sep='\n')


Fixed submission:
from collections import Counter
n=int(input())
S=[input() for _ in range(n)]

cnt=Counter(S)
cnt=cnt.most_common()
maxcnt=cnt[0][1]
ans=[]
for i in range(len(cnt)):
  if cnt[i][1]==maxcnt:
    ans.append(cnt[i][0])
  else:
    break
ans.sort()
print(*ans,sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
P=list(map(int,input().split()))

dp=[0]*n
for i in range(n):
  dp[i]=((1/2)*P[i]*(P[i]+1)) / P[i]
ans=0
for i in range(n-k+1):
  ans=max(ans,sum(dp[i:i+k]))
print(ans)

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

dp=[0]*n
ans,total=0,0
for i in range(n):
  dp[i]=((1/2)*P[i]*(P[i]+1)) / P[i]
  if i>=k:
    ans=max(ans,total)
    total-=dp[i-k]
  total+=dp[i]
ans=max(ans,total)
print(ans)

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

ans=0
for i in range(n-k+1):
  tmp=0
  for j in range(k):
    tmp+=((1/2)*P[i+j]*(P[i+j]+1)) / P[i+j]
  ans=max(ans,tmp)
print(ans)

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

dp=[0]*n
ans,total=0,0
for i in range(n):
  dp[i]=((1/2)*P[i]*(P[i]+1)) / P[i]
  if i>=k:
    ans=max(ans,total)
    total-=dp[i-k]
  total+=dp[i]
ans=max(ans,total)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h,n=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for a,b in AB:
  for i in range(h):
    if i+a>=h:
      dp[h]=min(dp[h],dp[i]+b)
    else:
      dp[i+a]=min(dp[i+a],dp[i]+b)
print(dp[h])

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

dp=[float('inf')]*(h+1)
dp[0]=0
for a,b in AB:
  for i in range(h):
    if i+a>=h:
      dp[h]=min(dp[h],dp[i]+b)
    else:
      dp[i+a]=min(dp[i+a],dp[i]+b)
print(dp[h])
Buggy python submission (verdict: Runtime Error):
n,k,s=map(int,input().split())

A=[s]*k
for i in range(len(A),n):
  if s+1!+10**9:
    A.append(s+1)
  else:
    A.append(s-1)
print(*A)
  

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

A=[s]*k
for i in range(len(A),n):
  if s!=10**9:
    A.append(s+1)
  else:
    A.append(1)
print(*A)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
from queue import Queue
h,w=map(int,input().split())
S=[input() for _ in range(h)]

def bfs(q,memo):
  x,y,cnt=q.get()
  if x<0 or x>=w or y<0 or y>=h:
    return
  elif S[y][x]=='#':
    return
  elif memo[y][x]<0:
    memo[y][x]=cnt
    q.put([x-1,y,cnt+1])
    q.put([x+1,y,cnt+1])
    q.put([x,y-1,cnt+1])
    q.put([x,y+1,cnt+1])
    
ans=0
out=[]
def bbfs(x,y,ans):
  q=Queue()
  q.put([x,y,0])

  memo=[[-1]*w for _ in range(h)]
  while not q.empty():
    bfs(q,memo)
  if max(max(memo))>=ans:
    ans=max(max(memo))
    bbfs(x-1,y,ans)
    bbfs(x+1,y,ans)
    bbfs(x,y-1,ans)
    bbfs(x,y+1,ans)
    if ans!=None: out.append(ans)
    
bbfs(0,0,ans)
print(max(out))

Fixed submission:
from collections import deque
h,w=map(int,input().split())
S=[input() for _ in range(h)]

ans=0
dxy=[(0,1),(1,0),(0,-1),(-1,0)]
for y in range(h):
  for x in range(w):
    if S[y][x]=='#': continue
    q=deque([(x,y)])
    dist=[[0]*w for _ in range(h)]
    visited=[[0]*w for _ in range(h)]
    visited[y][x]=1
    while q:
      x,y=q.popleft()
      for dx,dy in dxy:
        nx,ny=x+dx,y+dy
        if not 0<=nx<w: continue
        if not 0<=ny<h: continue
        if visited[ny][nx]: continue
        if S[ny][nx]=='#': continue
        visited[ny][nx]=1
        dist[ny][nx]=dist[y][x]+1
        q.append((nx,ny))
    ans = max(ans, max(max(row) for row in dist))
print(ans)
Buggy python submission (verdict: Runtime Error):
x=input()

if int(x[-2:])%5==0:
  if int(x[:-2])-int(x[-2:])//5>=0:
    print(1)
  else:
    print(0)
elif int(x[-2:])%4==0:
  if int(x[:-2])-int(x[-2:])//4>=0:
    print(1)
  else:
    print(0)
elif int(x[-2:])%3==0:
  if int(x[:-2])-int(x[-2:])//3>=0:
    print(1)
  else:
    print(0)
elif int(x[-2:])%2==0:
  if int(x[:-2])-int(x[-2:])//2>=0:
    print(1)
  else:
    print(0)
elif int(x[-2:])%1==0:
  if int(x[:-2])-int(x[-2:])//1>=0:
    print(1)
  else:
    print(0)
else:
  print(0)
  

Fixed submission:
x=input()

if len(x)>=3:
  if int(x[-2:])%5==0:
    if int(x[:-2])-int(x[-2:])//5>=0:
      print(1)
    else:
      print(0)
  elif int(x[-2:])%4==0:
    if int(x[:-2])-int(x[-2:])//4>=0:
      print(1)
    else:
      print(0)
  elif int(x[-2:])%3==0:
    if int(x[:-2])-int(x[-2:])//3>=0:
      print(1)
    else:
      print(0)
  elif int(x[-2:])%2==0:
    if int(x[:-2])-int(x[-2:])//2>=0:
      print(1)
    else:
      print(0)
  elif int(x[-2:])%1==0:
    if int(x[:-2])-int(x[-2:])//1>=0:
      print(1)
    else:
      print(0)
  else:
    print(0)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))

mod=10**9+7
ans=1
cs=[0]*3
for a in A:
  c=cs.count(a)
  ans=(ans*c)%mod
  i=cs.index(a)
  cs[i]+=1
print(ans)

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

mod=10**9+7
ans=1
cs=[0]*3
for a in A:
  c=cs.count(a)
  if c==0:
    print(0)
    exit()
  ans=(ans*c)%mod
  i=cs.index(a)
  cs[i]+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]

path=[[] for _ in range(n)]
for i,(a,b) in enumerate(AB):
  a,b=a-1,b-1
  path[a].append((b,i))
  path[b].append((a,i))
  
visited=[0]*n
ans=[None]*(n-1)
  
def dfs(v,c=-1):
  nc=1
  for to,i in path[v]:
    if visited[to]: continue
    visited[v]=1
    if nc==c: nc+=1
    ans[i]=nc
    dfs(to,nc)
    nc+=1
dfs(0)
print(max(ans))
print(*ans,sep='\n')

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]

path=[[] for _ in range(n)]
for i,(a,b) in enumerate(AB):
  a,b=a-1,b-1
  path[a].append((b,i))
  path[b].append((a,i))
  
visited=[0]*n
ans=[None]*(n-1)
  
def dfs(v,c=-1):
  nc=1
  for to,i in path[v]:
    if visited[to]: continue
    visited[v]=1
    if nc==c: nc+=1
    ans[i]=nc
    dfs(to,nc)
    nc+=1
dfs(0)
print(max(ans))
print(*ans,sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))


sa=float('inf')
for i in range(n):
  sa=min(sa,abs(sum(A[:i])-sum(A[i:])))
print(sa)


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

l=0
r=sum(A)
ans=float('inf')
for i in range(n):
  l+=A[i]
  r-=A[i]
  ans=min(ans,abs(l-r))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
D=list(map(int,input().split()))

mod=998244353
if D[0]!=0:
  print(0)
else:
  ans=1
  for i in range(2,n):
    ans*=D.count(i-1)**D.count(i)
    if ans==0:
      print(ans)
      exit()
  print(ans%mod)

Fixed submission:
import collections
n=int(input())
D=list(map(int,input().split()))

mod=998244353
c=collections.Counter(D)

if D[0]!=0 or c[0]!=1:
  print(0)
else:
  ans=c[0]
  node=c[0]
  for i in range(1,n):
    ans*=(c[i-1]**c[i])%mod
    node+=c[i]
    if node==n:
      break
  print(ans%mod)

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

mod=998244353
if D[0]!=0:
  print(0)
else:
  ans=1
  cnt=[0]*n
  for i in range(1,n):
    cnt[i]=D.count(i)
  for i in range(2,n):
    if cnt[i]>0:
      ans*=cnt[i-1]**cnt[i]
      
  print(ans%mod)

Fixed submission:
import collections
n=int(input())
D=list(map(int,input().split()))

mod=998244353
c=collections.Counter(D)

if D[0]!=0 or c[0]!=1:
  print(0)
else:
  ans=c[0]
  node=c[0]
  for i in range(1,n):
    ans*=(c[i-1]**c[i])%mod
    node+=c[i]
    if node==n:
      break
  print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=int(input())
L=list(map(int,input().split()))

L.sort()
c=(list(itertools.combinations(L,3)))
ans=0
for a,b,c in c:
  if b-a<c and c<a+b:
    ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)

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

L.sort()
c=(list(itertools.combinations(L,3)))
ans=0
for a,b,c in c:
  if b-a<c and c<a+b:
    ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)

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

L.sort()
c=[]
for i in range(2**n):
  tmp=[]
  for j in range(n):
    if i>>j&1:
      tmp.append(L[j])
  if len(tmp)==3 and tmp not in c:
    c.append(tmp)
ans=0
for a,b,c in c:
  if b-a<c and c<a+b:
    ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)

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

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    cnt=0
    for k in range(j+1,n):
      if L[i]+L[j]<=L[k]:
        ans+=cnt
        break
      cnt+=1
    else:
      ans+=cnt
print(ans)

Fixed submission:
import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)

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

L.sort()
ans=0
for i in range(n-1):
  for j in range(i+1,n-1):
    tmp=sorted(L[j+1:],reverse=True)
    for k in range(len(tmp)):
      if L[i]+L[j]>tmp[k]:
        ans+=len(tmp)-k
        break
print(ans)

Fixed submission:
import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)

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

ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if L[i]<L[j]+L[k] and L[j]<L[k]+L[i] and L[k]<L[i]+L[j]:
        ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
k=int(input())

cnt,ans=0,0
T=S+S
for i in range(1,len(T)):
  if T[i-1]==T[i]:
    cnt+=1
  else:
    ans+=(cnt+1)//2
    cnt=0
  if i==len(S)-1:
    ans+=(cnt+1)//2
    tmp=ans

if len(S)==1:
  print(k//2)
  exit()
if len(S)==2:
  if S[0]==S[1]:
    print(k)
  else:
    print(0)
  exit()
  
if len(set(T))==1:
  if len(S)%2==0:
    print(len(S)//2*k)
  else:
    out=0
    for i in range(k):
      if i%2==0:
        out+=len(S)//2
      else:
        out+=len(S)//2+1
    print(out)
  exit()
      
print(tmp+(ans-tmp)*(k-1))

Fixed submission:
S=list(input())
k=int(input())

cnt,ans=0,0
T=S+S
for i in range(1,len(T)):
  if T[i-1]==T[i]:
    cnt+=1
  else:
    ans+=(cnt+1)//2
    cnt=0
  if i==len(S)-1:
    ans+=(cnt+1)//2
    tmp=ans

if len(S)==1:
  print(k//2)
  exit()
if len(S)==2:
  if S[0]==S[1]:
    print(k)
  else:
    print(0)
  exit()
  
if len(set(T))==1:
  if len(S)%2==0:
    print(len(S)//2*k)
  else:
    out=(len(S)//2)*(k-(k//2))+(len(S)//2+1)*(k//2)
    print(out)
  exit()
      
print(tmp+(ans-tmp)*(k-1))

Buggy python submission (verdict: Runtime Error):
S=list(input())
k=int(input())

cnt,ans=0,0
for i in range(1,len(S)):
  if S[i-1]==S[i]:
    cnt+=1
  else:
    cnt+=1
    ans+=cnt//2
    cnt=0
ans+=cnt//2
if S[0]==S[-1] and S[-1]!=S[-2]:
  print(ans*k+k-1)
else:
  print(ans*k)

Fixed submission:
S=list(input())
k=int(input())

cnt,ans=0,0
T=S+S
for i in range(1,len(T)):
  if T[i-1]==T[i]:
    cnt+=1
  else:
    ans+=(cnt+1)//2
    cnt=0
  if i==len(S)-1:
    ans+=(cnt+1)//2
    tmp=ans

if len(S)==1:
  print(k//2)
  exit()
if len(S)==2:
  if S[0]==S[1]:
    print(k)
  else:
    print(0)
  exit()
  
if len(set(T))==1:
  if len(S)%2==0:
    print(len(S)//2*k)
  else:
    out=(len(S)//2)*(k-(k//2))+(len(S)//2+1)*(k//2)
    print(out)
  exit()
      
print(tmp+(ans-tmp)*(k-1))

Buggy python submission (verdict: Runtime Error):
S=list(input())
k=int(input())

cnt,ans=0,0
for i in range(1,len(S)):
  if S[i-1]==S[i]:
    cnt+=1
  else:
    cnt+=1
    ans+=cnt//2
    cnt=0
ans+=cnt//2
if S[0]==S[-1] and S[-1]==S[-2]:
  print(ans*k+k)
else:
  print(ans*k)

Fixed submission:
S=list(input())
k=int(input())

cnt,ans=0,0
T=S+S
for i in range(1,len(T)):
  if T[i-1]==T[i]:
    cnt+=1
  else:
    ans+=(cnt+1)//2
    cnt=0
  if i==len(S)-1:
    ans+=(cnt+1)//2
    tmp=ans

if len(S)==1:
  print(k//2)
  exit()
if len(S)==2:
  if S[0]==S[1]:
    print(k)
  else:
    print(0)
  exit()
  
if len(set(T))==1:
  if len(S)%2==0:
    print(len(S)//2*k)
  else:
    out=(len(S)//2)*(k-(k//2))+(len(S)//2+1)*(k//2)
    print(out)
  exit()
      
print(tmp+(ans-tmp)*(k-1))
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))

ans=[]
for i,a in enumerate(A):
  ans.append([i+1,a])
ans.sort(key=lambda x:x[a])
for a in ans:
  print(a[0],end=' ')

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

ans=[]
for i,a in enumerate(A):
  ans.append([i+1,a])
ans.sort(key=lambda x:x[1])
for a in ans:
  print(a[0],end=' ')

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

ans=[]
for i in range(1,n+1):
  for j in range(n):
    if A[j]==i:
      ans.append(j+1)
print(*ans)

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

ans=[]
for i,a in enumerate(A):
  ans.append([i+1,a])
ans.sort(key=lambda x:x[1])
for a in ans:
  print(a[0],end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import functools
a,b=map(int,input().split())

def cf(x1,x2):
  cf=[1]
  for i in range(2,min(x1,x2)+1):
      if x1 % i == 0 and x2 % i == 0:
        cf.append(i)
  return cf

def is_prime(q):
  q = abs(q)
  if q == 2: return True
  if q < 2 or q&1 == 0: return False
  return pow(2, q-1, q) == 1

frac=cf(a,b)
n=len(frac)
ans=0
for i in range(n):
  if is_prime(frac[i]):
    ans+=1
print(ans+1)

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

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)
  return divisors

import random

def is_prime(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
  
div=list(set(make_divisors(a))&set(make_divisors(b)))
n=len(div)
ans=0
for i in range(n):
  if is_prime(div[i]):
    ans+=1
print(ans+1)
Buggy python submission (verdict: Runtime Error):
S=input()

if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  ptint('Rainy')
elif S=='Rainy':
  print('Sunny')

Fixed submission:
S=input()

if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
elif S=='Rainy':
  print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,k,q=map(int,input().split())
A=[int(input()) for _ in range(q)]

minus=[]
for i in range(1,n+1):
  minus.append(A.count(i))
for i in range(n):
  if k-(q-minus[i])<=0:
    print('No')
  else:
    print('Yes')

Fixed submission:
import sys
import itertools
input = sys.stdin.readline
n,k,q=map(int,input().split())
A=[int(input()) for _ in range(q)]

ans=[k]*n
for i in range(q):
  ans[A[i]-1]+=1
for i in range(n):
  if ans[i]-q>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())
A=[int(input()) for _ in range(q)]

minus=[]
for i in range(1,n+1):
  minus.append(A.count(i))
for i in range(n):
  if k-(q-minus[i])<=0:
    print('No')
  else:
    print('Yes')

Fixed submission:
import sys
import itertools
input = sys.stdin.readline
n,k,q=map(int,input().split())
A=[int(input()) for _ in range(q)]

ans=[k]*n
for i in range(q):
  ans[A[i]-1]+=1
for i in range(n):
  if ans[i]-q>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())
A=[int(input()) for _ in range(q)]

for i in range(1,n+1):
  if k-(q-A.count(i))<=0:
    print('No')
  else:
    print('Yes')


Fixed submission:
import sys
import itertools
input = sys.stdin.readline
n,k,q=map(int,input().split())
A=[int(input()) for _ in range(q)]

ans=[k]*n
for i in range(q):
  ans[A[i]-1]+=1
for i in range(n):
  if ans[i]-q>0:
    print('Yes')
  else:
    print('No')

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

for i in range(1,n+1):
  if k-(q-A.count(i))<=0:
    print('No')
  else:
    print('Yes')


Fixed submission:
import sys
import itertools
input = sys.stdin.readline
n,k,q=map(int,input().split())
A=[int(input()) for _ in range(q)]

ans=[k]*n
for i in range(q):
  ans[A[i]-1]+=1
for i in range(n):
  if ans[i]-q>0:
    print('Yes')
  else:
    print('No')

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

points=[k]*n
for a in A:
  for i in range(n):
    if a-1==i:
      pass
    else:
      points[i]-=1
for p in points:
  if p<=0:
    print('No')
  else:
    print('Yes')

Fixed submission:
import sys
import itertools
input = sys.stdin.readline
n,k,q=map(int,input().split())
A=[int(input()) for _ in range(q)]

ans=[k]*n
for i in range(q):
  ans[A[i]-1]+=1
for i in range(n):
  if ans[i]-q>0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
A=list(map(int,input().split()))

for _ in range(m):
  A.sort(reverse=True)
  A[0]=A[0]//2
print(sum(A))

Fixed submission:
import heapq
n,m=map(int,input().split())
A=list(map(int,input().split()))

q=[]
for a in A:
  heapq.heappush(q,-a)
  
for _ in range(m):
  p=-heapq.heappop(q)//2
  heapq.heappush(q,-p)
print(-sum(q))

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

while m>0:
  A.sort(reverse=True)
  A[0]=A[0]//2
  m-=1
print(sum(A))

Fixed submission:
import heapq
n,m=map(int,input().split())
A=list(map(int,input().split()))

q=[]
for a in A:
  heapq.heappush(q,-a)
  
for _ in range(m):
  p=-heapq.heappop(q)//2
  heapq.heappush(q,-p)
print(-sum(q))

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

while m>0:
  A.sort(reverse=True)
  A[0]=A[0]//2
  m-=1
  print(A,m)
print(sum(A))

Fixed submission:
import heapq
n,m=map(int,input().split())
A=list(map(int,input().split()))

q=[]
for a in A:
  heapq.heappush(q,-a)
  
for _ in range(m):
  p=-heapq.heappop(q)//2
  heapq.heappush(q,-p)
print(-sum(q))

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

while m>0:
  for i in range(n):
    if A[i]==max(A):
      A[i]=A[i]//2
      m-=1
      break
print(sum(A))

Fixed submission:
import heapq
n,m=map(int,input().split())
A=list(map(int,input().split()))

q=[]
for a in A:
  heapq.heappush(q,-a)
  
for _ in range(m):
  p=-heapq.heappop(q)//2
  heapq.heappush(q,-p)
print(-sum(q))
Buggy python submission (verdict: Runtime Error):
n=int(input())

print(int((n-1)*n//2))

Fixed submission:
S=input()
T=input()

ans=0
for i in range(3):
  if S[i]==T[i]:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
H=list(map(int,input().split()))

ans=-1
for i in range(n):
  tmp=0
  for j in range(i+1,n):
    if H[j-1]>=H[j]:
      tmp+=1
    else:
      break
  ans=max(ans,tmp)
  if ans>=len(H[i:]):
    break
print(ans)


Fixed submission:
import itertools
n=int(input())
H=list(map(int,input().split()))

ans=[]
for i in range(1,n):
  if H[i-1]>=H[i]:
    ans.append(1)
  else:
    ans.append(0)

out=0
tmp=0
for a in ans:
  if a==1:
    tmp+=1
  else:
    out=max(out,tmp)
    tmp=0
print(max(out,tmp))

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

ans=-1
for i in range(n):
  tmp=0
  for j in range(i+1,n):
    if H[j-1]>=H[j]:
      tmp+=1
    else:
      break
  ans=max(ans,tmp)
print(ans)


Fixed submission:
import itertools
n=int(input())
H=list(map(int,input().split()))

ans=[]
for i in range(1,n):
  if H[i-1]>=H[i]:
    ans.append(1)
  else:
    ans.append(0)

out=0
tmp=0
for a in ans:
  if a==1:
    tmp+=1
  else:
    out=max(out,tmp)
    tmp=0
print(max(out,tmp))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ss=[input() for _ in range(n)]

ans=0
for i in range(0,n):
  for j in range(i+1,n):
    flag=True
    for k in range(10):
      if ss[i].count(ss[i][k])!=ss[j].count(ss[i][k]):
        flag=False
    if flag:
      ans+=1
print(ans)

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

samedic={}
for s in ss:
  sort_s=''.join(sorted(list(s)))
  if sort_s in samedic:
    samedic[sort_s]+=1
  else:
    samedic[sort_s]=1

ans=0
for v in samedic.values():
  ans+=((v-1)*1)*(v/2)
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = [int(i) for i in input().split()][0]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
B.append(0)

cnt=0
for i in range(N+1):
  while B[i]!=0 and A[i]!=0:
    A[i]-=1
    B[i]-=1
    cnt+=1
  if i!=N and B[i]>0:
    B[i+1]=B[i+1]+B[i]
    
print(cnt)

Fixed submission:
n=int(input())
As=list(map(int,input().split()))
Bs=list(map(int,input().split()))
Bs.append(0)

ans=0
for i in range(n):
  c=As[i]+As[i+1]
  if c>Bs[i]:
    ans+=Bs[i]
    if Bs[i]>As[i]:
      As[i+1]-=Bs[i]-As[i]
  else:
    ans+=c
    As[i+1]=0
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))

ans=[]
balls=[0]*n
for i in range(n-1,-1,-1):
  if A[i]!=0:
    total=0
    for j in range(n-1,i,A[i]):
      total+=A[j]
    if total%2!=A[i]:
      if totaL+1!=A[i]:
        print(-1)
        exit()
      balls[i]+=1
      ans.append(i+1)
print(sum(balls))
print(*ans,sep=' ')


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

ans=set()
for i in range(n-1,-1,-1):
  for j in range(i+1,n+1,i+1):
    if j in ans:
      A[i]+=1
  if A[i]%2:
    ans.add(i+1)
print(len(ans))
print(*ans)
Buggy python submission (verdict: Runtime Error):
N = [int(i) for i in input().split()][0]
P = [i for i in input().split()]

count=0
for i in range(0,N-2):
  tmp = [P[i],P[i+1],P[i+2]]
  tmp.sort()
  if P[i+1]==tmp[1]:
    count+=1
  if tmp[0]==tmp[1] or tmp[1]=tmp[2] or tmp[0]==tmp[2]:
    count+=1

print(count)

Fixed submission:
N = [int(i) for i in input().split()][0]
P = [int(i) for i in input().split()]

count=0
for i in range(0,N-2):
  tmp = [P[i],P[i+1],P[i+2]]
  tmp.sort()
  if P[i+1]==tmp[1]:
    count+=1
  elif tmp[0]==tmp[1] or tmp[0]==tmp[2]:
    count+=1

print(count)