Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  A = int(input())
  for j in range(A):
    x ,  y= map(int,input().split())
    L.append([i+1,x,y])

from itertools import permutations, combinations,combinations_with_replacement,product
LL = list(product(range(2), repeat=N))
cnt = 0
for i in LL:
  for j in L:
    #jの情報は、(hatsugen=i,hito=x,flg=1,0)
    #iの情報は、(flg(i),...,)
    if i[j[0]-1]==1:
      k = j[2]
    else:
      k = 1- j[2]
    flg = 1
    if i[j[1]-1]!=k:
      flg = 0
      break
  cnt = max(cnt,sum(i)*flg)
print(cnt)

Fixed submission:
N = int(input())
L = []
for i in range(N):
  A = int(input())
  LA = []
  for j in range(A):
    LA.append(list(map(int,input().split())))
  L.append(LA)
from itertools import product
LL = list(product(range(2), repeat=N))
cnt = 0
for i in LL:
  flg = True
  for j in range(len(L)):
    #jの情報は、(hito=x, singi = y=1,0)
    #iの情報は、(singi = (1/0,...,1/0))
    for x,y in L[j]:
      #jさんの情報      
      #i[j] :sinngi　正解
      #y:sinngi　を変換
      if i[j]==1:
        if i[x-1]!=y:
          flg = False
          break
  if flg:
    cnt = max(cnt,sum(i))
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  A = int(input())
  for j in range(A):
    x ,  y= map(int,input().split())
    L.append([i+1,x,y])

from itertools import permutations, combinations,combinations_with_replacement,product
LL = list(product(range(2), repeat=N))

cnt = 0
for i in LL:
  ii = list(i)
  Ans =[]
  for j in L:
    if j[2]==1 and ii[j[0]-1]==1:
      k = 1
    elif j[2]==1 and ii[j[0]-1]==0:
      k = 0
    elif j[2]==0 and ii[j[0]-1]==1:
      k = 0
    elif j[2]==0 and ii[j[0]-1]==0:
      k = 1
    Ans.append([j[1],k])
  Ans.sort()
  for l in range(len(Ans)):
    if i[Ans[l][0]-1] != Ans[l][1]:
      flg = 0
      break
    else:
      flg = 1
#  print(i,flg,Ans)
  cnt = max(cnt,sum(i)*flg)
print(cnt)

Fixed submission:
N = int(input())
L = []
for i in range(N):
  A = int(input())
  LA = []
  for j in range(A):
    LA.append(list(map(int,input().split())))
  L.append(LA)
from itertools import product
LL = list(product(range(2), repeat=N))
cnt = 0
for i in LL:
  flg = True
  for j in range(len(L)):
    #jの情報は、(hito=x, singi = y=1,0)
    #iの情報は、(singi = (1/0,...,1/0))
    for x,y in L[j]:
      #jさんの情報      
      #i[j] :sinngi　正解
      #y:sinngi　を変換
      if i[j]==1:
        if i[x-1]!=y:
          flg = False
          break
  if flg:
    cnt = max(cnt,sum(i))
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60):
  Po=0
  for j in A:
    if j>>i & 1:
      Po+=1
  Ans += Po*(N-Po)*(2**i)
  Ans = Ans % mod
print(Ans)

Fixed submission:
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60):
  Po=sum([1 for j in A if j>>i & 1])
  Ans += Po*(N-Po)*(2**i)
  Ans = Ans % mod
print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60):
  Po=0
  Ne=0
  for j in A:
    if j>>i & 1:
      Po+=1
    else:
      Ne+=1
  Ans += Po*Ne*(2**i)
  Ans = Ans % mod
print(Ans)

Fixed submission:
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60):
  Po=sum([1 for j in A if j>>i & 1])
  Ans += Po*(N-Po)*(2**i)
  Ans = Ans % mod
print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60+1):
  Po=0
  Ne=0
  for j in A:
    if j>>i & 1:
      Po+=1
    else:
      Ne+=1
  Ans += Po*Ne*(2**i)
  Ans = Ans % mod
print(Ans)

Fixed submission:
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60):
  Po=sum([1 for j in A if j>>i & 1])
  Ans += Po*(N-Po)*(2**i)
  Ans = Ans % mod
print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int, input().split()))
from itertools import permutations, combinations,combinations_with_replacement,product
L = combinations(range(n), 2)   #nCr
cnt = 0
for i in L:
  cnt += (A[i[0]]^A[i[1]])%(10**9+7)
  cnt = cnt%(10**9+7)
print(cnt)

Fixed submission:
N=int(input())
A = list(map(int,input().split()))
mod = 10**9+7
Ans = 0
for i in range(60):
  Po=sum([1 for j in A if j>>i & 1])
  Ans += Po*(N-Po)*(2**i)
  Ans = Ans % mod
print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

from itertools import permutations, combinations,combinations_with_replacement,product
L = list(combinations(range(N), 3))   #nCr
A=[]
Cnt = 0
for i in L:
  X = S[i[0]]+S[i[1]]+S[i[2]]
  if X not in A:
    A.append(X)
    Cnt +=1
  if Cnt == 1000:
    break
print(Cnt)

Fixed submission:
N = int(input())
S = input()
Pin = ['{0:03d}'.format(a) for a in range(0,1000)]
cnt = 0
for i in Pin:
  S1 = S
  A1 = S1.find(i[0])
  if A1!=-1:
    S2 = S1[(A1+1):]
    A2 = S2.find(i[1])
    if A2!=-1:
      S3 = S2[(A2+1):]
      A3 = S3.find(i[2])
      if A3!=-1:
        cnt +=1
print(cnt)

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

from itertools import permutations, combinations,combinations_with_replacement,product
L = list(combinations(range(N), 3))   #nCr
A=[]
for i in L:
  X = S[i[0]]+S[i[1]]+S[i[2]]
  if X not in A:
    A.append(X)
print(len(A))

Fixed submission:
N = int(input())
S = input()
Pin = ['{0:03d}'.format(a) for a in range(0,1000)]
cnt = 0
for i in Pin:
  S1 = S
  A1 = S1.find(i[0])
  if A1!=-1:
    S2 = S1[(A1+1):]
    A2 = S2.find(i[1])
    if A2!=-1:
      S3 = S2[(A2+1):]
      A3 = S3.find(i[2])
      if A3!=-1:
        cnt +=1
print(cnt)

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

from itertools import permutations, combinations,combinations_with_replacement,product
L = list(combinations(range(N), 3))   #nCr
A=[]
for i in L:
  A.append(S[i[0]]+S[i[1]]+S[i[2]])
print(len(set(A)))

Fixed submission:
N = int(input())
S = input()
Pin = ['{0:03d}'.format(a) for a in range(0,1000)]
cnt = 0
for i in Pin:
  S1 = S
  A1 = S1.find(i[0])
  if A1!=-1:
    S2 = S1[(A1+1):]
    A2 = S2.find(i[1])
    if A2!=-1:
      S3 = S2[(A2+1):]
      A3 = S3.find(i[2])
      if A3!=-1:
        cnt +=1
print(cnt)

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

from itertools import permutations, combinations,combinations_with_replacement,product
L = list(combinations(range(N), 3))   #nCr
A=[]
for i in L:
  A.append(S[i[0]]+S[i[1]]+S[i[2]])
print(len(set(A)))

Fixed submission:
N = int(input())
S = input()
Pin = ['{0:03d}'.format(a) for a in range(0,1000)]
cnt = 0
for i in Pin:
  S1 = S
  A1 = S1.find(i[0])
  if A1!=-1:
    S2 = S1[(A1+1):]
    A2 = S2.find(i[1])
    if A2!=-1:
      S3 = S2[(A2+1):]
      A3 = S3.find(i[2])
      if A3!=-1:
        cnt +=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
H,W,K = map(int, input().split())
cnt = 0
rep = 1
flg = 0
for i in range(H):
    Lin = input()
    Lin = (Lin.replace("#","1")).replace(".","0")
    if Lin == "0"*W and (i < (H-1)) and flg == 0:
        rep += 1
        pv = str(cnt+1)
    elif Lin == "0"*W :
        print(Str)
    else:
        for j in range(W):
            cnt += int(Lin[j])
            if j == 0:
                Str = pv
            elif Lin[j-1] == "0":
                Str += pv
            elif Lin[j-1] == "1":
                pv = str(int(pv)+1)
                Str += pv
            if j != (W-1):
                Str += " "
        for k in range(rep):
            print(Str)
        rep = 1
        flg = 1

Fixed submission:
H,W,K = map(int, input().split())

def cv(S,cn,pr):
  SS=S
  ans = []
  for i in range(cn):
    ans += [pr+i+1]*(SS.find("#")+1)
    if SS.find("#")<len(SS):
      SS = SS[SS.find("#")+1:]
    else:
      SS = ""
  ans += [pr+cn]*len(SS)
  return ans
    
cnt_pre = 0 #最初のall #no
cnt = 0 # "#"の個数
for i in range(H):
  Lin = input()
  tmp = Lin.count("#")
  if tmp == 0 and cnt == 0:
    cnt_pre +=1
  elif tmp == 0:
    print(*pS)
  else:
    pS = cv(Lin,tmp,cnt)
    for i in range(0,cnt_pre+1):
      print(*pS)
    cnt_pre = 0
  cnt += tmp
Buggy python submission (verdict: Runtime Error):
N = input()
A = input()
AA = A[0:int(N/2)]
if A == (AA+AA):
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
A = input()
AA = A[0:int(N/2)]
if A == (AA+AA):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
X ,Y = map(int, input().split())
n = 2 * Y - X
m = 2 * X - Y
r = 1
if n % 3 != 0:
    r = 0
elif m % 3 != 0:
    r = 0
elif m < 0:
    r = 0
elif n < 0:
    r = 0
else:
    nn = min(n,m) // 3
    mm = max(n,m) // 3
    for i in range(nn):
        r = r * (mm + i + 1) // (i+1)
print(r % (10**9+7))

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 10**6     #出力の制限
mod = 10**9+7 
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

X ,Y = map(int, input().split())
n = 2 * Y - X
m = 2 * X - Y
r = 1
if n % 3 != 0:
    r = 0
elif m % 3 != 0:
    r = 0
else:
    r = cmb(n//3+m//3,n//3,mod)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-

#######################################################################
# ナップサック
# 重さ：Wー10**5くらい
# 価値：N*max_Viー10**11くらい
# dp[w]:wの重さで可能な最大の価値
#   dp[w]とdp[w-wi]+vi(i番目のアイテムをとる場合)との大きいほうで更新
#######################################################################

n, t = map(int, input().split())
dp = [0] * (t+1)
itm = [list(map(int, input().split())) for _ in range(n)]
itm.sort()
for w_ , v_ in itm:
    for i in range(1,t+1):
        dp[max(0,i-w_)] = max(dp[max(0,i-w_)], dp[i] + v_)
print(dp[0])


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

#######################################################################
# ナップサック
# 重さ：Wー10**5くらい
# 価値：N*max_Viー10**11くらい
# dp[w]:wの重さで可能な最大の価値
#   dp[w]とdp[w-wi]+vi(i番目のアイテムをとる場合)との大きいほうで更新
#######################################################################

n, t = map(int, input().split())
dp = [0] * (t+1)
itm = [list(map(int, input().split())) for _ in range(n)]
itm.sort()
for w_ , v_ in itm:
    for i in range(1,t+1):
        dp[max(0,i-w_)] = max(dp[max(0,i-w_)], dp[i] + v_)
print(dp[0])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    S = input()
    n = len(S)+1
    ret = 0
    for i in range(n):
        left = S[:i]
        l = left[::-1].find('>')
        if l==-1:
            l=len(left)
        right = S[i:]
        r = right.find('<')
        if r==-1:
            r=len(right)
#        print(i,l,r)
#        print(left,right)
        ret += max(l,r)
    print(ret)

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    S = input()
    n = len(S)+1
    left=[0]*n
    right=[0]*n
    for i,s in enumerate(S):
        if s=='<':
            left[i+1]=left[i]+1
    for i,s in enumerate(S[::-1]):
        if s=='>':
            right[n-i-2]=right[n-i-1]+1
    ret =0
    for i in range(n):
        ret+= max(left[i],right[i])
    print(ret)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
a.sort()
f.sort(reverse = True)
af = [a[i]*f[i] for i in range(n)]

def check(x):
  r = 0
  for i in range(n):
    r += (max(0,(af[i]-x))+f[i]-1)//f[i]
  #print(r, x)
  if r<=k:
    return True
  else:
    return False
ok = 10**12+1
ng = -1
while ok-ng>1:
  mid = (ok + ng)//2
  if check(mid):
    ok = mid
  else:
    ng = mid
print(ok)

Fixed submission:
n, k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
a.sort()
f.sort(reverse = True)
af = [a[i]*f[i] for i in range(n)]

def check(x):
  r = 0
  for i in range(n):
    r += (max(0,(af[i]-x))+f[i]-1)//f[i]
  #print(r, x)
  if r<=k:
    return True
  else:
    return False
ok = 10**12+1
ng = -1
while ok-ng>1:
  mid = (ok + ng)//2
  if check(mid):
    ok = mid
  else:
    ng = mid
print(ok)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
tmp = S[1]
ret = tmp
for i in S:
  if tmp == i:
    tmp = i
  else:
    ret += i
    tmp = i
print(len(ret))

Fixed submission:
N = int(input())
S = input()
tmp = S[0]
ret = tmp
for i in S:
  if tmp == i:
    tmp = i
  else:
    ret += i
    tmp = i
print(len(ret))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())

graph = [[] for _ in range(n)]
d = [[float("inf")]*n for i in range(n)]

for i in range(n):
    s = input()
    for j, sj in enumerate(s):
        d[i][i] = 1
        if sj == '1':
            graph[i].append(j)
            d[i][j] = 1
            d[j][i] = 1

colors = [0 for i in range(n)]

#2部グラフならTrue, そうでなければFalse
def is_bipartite():
    stack = [(0,1)] # (頂点、色)のタプルをスタックする。最初は(頂点0, 黒(1))
    while stack:
        #スタックから最後に追加された(頂点, 色)をpop
        v,color = stack.pop()
        #今いる点を着色
        colors[v] = color
        #今の頂点から行けるところをチェック
        for to in graph[v]:
            #同じ色が隣接してしまったらFalse
            if colors[to] == color:
                return False
            #未着色の頂点があったら反転した色と共にスタックに積む
            if colors[to] == 0:
                stack.append((to, -color))
    #調べ終わったら矛盾がないのでTrue
    return True

# ワーシャルフロイド法
# 全頂点間最短路
# d[i][j]は2頂点間i, j間の移動コストを格納, Mは頂点数

def warshall_floyd(d, M):
    for k in range(M):
        for i in range(M):
            for j in range(M):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    return d #d[i][j]に頂点i, j間の最短距離を格納

##############################


if is_bipartite():
    ret = 0
    for a in warshall_floyd(d,n):
        ret = max(ret, max(a))
    print(ret+1)
else:
    print(-1)


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())

graph = [[] for _ in range(n)]
d = [[float("inf")]*n for i in range(n)]

for i in range(n):
    s = input()
    for j, sj in enumerate(s):
        d[i][i] = 1
        if sj == '1':
            graph[i].append(j)
            d[i][j] = 1
            d[j][i] = 1

colors = [0 for i in range(n)]

#2部グラフならTrue, そうでなければFalse
def is_bipartite():
    stack = [(0,1)] # (頂点、色)のタプルをスタックする。最初は(頂点0, 黒(1))
    while stack:
        #スタックから最後に追加された(頂点, 色)をpop
        v,color = stack.pop()
        #今いる点を着色
        colors[v] = color
        #今の頂点から行けるところをチェック
        for to in graph[v]:
            #同じ色が隣接してしまったらFalse
            if colors[to] == color:
                return False
            #未着色の頂点があったら反転した色と共にスタックに積む
            if colors[to] == 0:
                stack.append((to, -color))
    #調べ終わったら矛盾がないのでTrue
    return True

# ワーシャルフロイド法
# 全頂点間最短路
# d[i][j]は2頂点間i, j間の移動コストを格納, Mは頂点数

def warshall_floyd(d, M):
    for k in range(M):
        for i in range(M):
            for j in range(M):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    return d #d[i][j]に頂点i, j間の最短距離を格納

##############################


if is_bipartite():
    ret = 0
    for a in warshall_floyd(d,n):
        ret = max(ret, max(a))
    print(ret+1)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
r = ""
for i in range(N):
  r+= str(A.index(i+1)+1)
  r+= " "
print(r)


Fixed submission:
N = int(input())
print( 1 - int(N/2) / N )
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
C.sort()
a, b = zip(*C)
print(" ".join(str(x) for x in b))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
C.sort()
a, b = zip(*C)
print(' '.join(b))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
C.sort()
a, b = zip(*C)
print(' '.join(b))


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
r = ""
for i in set(range(N)):
  r+= str(A.index(i+1)+1)
  r+= " "
print(r)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
r = ""
for i in range(N):
  r+= str(A.index(i+1)+1)
  r+= " "
print(r)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
r = []
for i in range(N):
  r.append(str(A.index(i+1)+1))
print(' '.join(r))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
R = ''
for i in range(1,N+1,1):
  R += str(A.index(i)+1) + " "
print(R)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(range(1,N+1,1))
C = zip(A,B)
D = sorted(C)
a, b = zip(*D)
print(" ".join(str(x) for x in b))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
dp = [[0]+[10**6] * (2**n-1) for i in range(m+1)]
for i in range(m):
    a, b = map(int, input().split())
    bit = ['0'] * n
    for x in set(map(int, input().split())):
        bit[x-1] = '1'
    bit = int(''.join(bit[::-1]), 2)
    for j, dpnw in enumerate(dp[i]):
        dp[i+1][j] = dpnw
    for j, dpnw in enumerate(dp[i]):
        dp[i+1][j | bit] = min(dp[i+1][j | bit], dp[i][j | bit], a + dpnw)
if dp[m][-1] == 1000000:
    print(-1)
else:
    print(dp[m][-1])

Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

INF = 10**6

n, m = map(int, input().split())
dp = [INF] * (2**n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split())
    bit = ['0'] * n
    for x in set(map(int, input().split())):
        bit[x-1] = '1'
    bit = int(''.join(bit[::-1]), 2)
    for j in range(2**n-1, -1, -1):
        dp[j|bit] = min(dp[j|bit], a + dp[j])
if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])
Buggy python submission (verdict: Runtime Error):
N,K,Q=map(int, input().split())
A=[int(input()) for i in range(Q)]
from collections import Counter
A=Counter(A)
B=list(A.most_common())
B.sort(key=lambda x:x[0])
for i in range(N):
  if (Q - B[i][1])< K:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q=map(int, input().split())
A=[int(input()) for i in range(Q)]
from collections import Counter
A=Counter(A)
B=list(A.most_common())
#B.sort(key=lambda x:x[0])
C = [0]*N
for i in B:
  C[i[0]-1]=i[1]
for i in range(N):
  if (Q - C[i])< K:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int, input().split())
A=[int(input()) for i in range(Q)]
for i in range(N):
  if (Q - A.count(i+1))< K:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q=map(int, input().split())
A=[int(input()) for i in range(Q)]
from collections import Counter
A=Counter(A)
B=list(A.most_common())
#B.sort(key=lambda x:x[0])
C = [0]*N
for i in B:
  C[i[0]-1]=i[1]
for i in range(N):
  if (Q - C[i])< K:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
print(sum([i for i in range(1,n)]))

Fixed submission:
n=int(input())
print(n*(n-1)//2)

Buggy python submission (verdict: Runtime Error):
nn=int(input())
pprint(sum([i for i in range(1,n)]))

Fixed submission:
n=int(input())
print(n*(n-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
aa=0
for i in range(1,n+1):
  if i==n:
    aa+=0
  else:
    aa+=i%(i+1)
print(aa)

Fixed submission:
n=int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
_=input()
print(1/sum[1/r for r in list(map(int,input().split()))])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
R = 0.0
for i in range(N):
  R += A[i]**(-1)
print(1/R)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
R = 0.0
for i in range(N):
  R += i**(-1)
print(1/R)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
R = 0.0
for i in range(N):
  R += A[i]**(-1)
print(1/R)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=map(int,input().split())
A.sort()
r=A[0]
for i in range(1,N,1):
  r=float((r+A[i])/2)
print(r)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
r=A[0]
for i in range(1,N,1):
  r=float((r+A[i])/2)
print(r)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=map(float,input().split())
A.sort()
r=A[0]
for i in range(1,N,1):
  r=(r+A[i])/2
print(r)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
r=A[0]
for i in range(1,N,1):
  r=float((r+A[i])/2)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=["".join(sorted(list(input()))) for i in range(N)]
ss = set(s)
cnt = 0
for i in ss:
  B = s.count(i)
  cnt += int(B * (B-1) /2)
print(cnt)


Fixed submission:
N=int(input())
d={}
for i in range(N):
  a = "".join(sorted(list(input())))
  if a not in d:
    d[a] = 1
  else:
    d[a]=d[a]+1
cnt = 0
for B in d.values():
  cnt += int(B * (B-1) /2)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=["".join(sorted(list(input()))) for i in range(N)]
ss = set(s)
cnt = 0
for i in ss:
  B = s.count(i)
  cnt += int(B * (B-1) /2)
print(cnt)


Fixed submission:
N=int(input())
d={}
for i in range(N):
  a = "".join(sorted(list(input())))
  if a not in d:
    d[a] = 1
  else:
    d[a]=d[a]+1
cnt = 0
for B in d.values():
  cnt += int(B * (B-1) /2)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=[sorted(list(input())) for i in range(N)]
from itertools import permutations, combinations,combinations_with_replacement,product
L = combinations(range(N), 2)   #nCr
cnt = 0
for i in L:
  if s[i[0]]==s[i[1]]:
    cnt +=1
print(cnt)


Fixed submission:
N=int(input())
d={}
for i in range(N):
  a = "".join(sorted(list(input())))
  if a not in d:
    d[a] = 1
  else:
    d[a]=d[a]+1
cnt = 0
for B in d.values():
  cnt += int(B * (B-1) /2)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=[sorted(list(input())) for i in range(N)]
t=[]
from collections import Counter

for i in s:
  a=Counter(i)
  t.append(a.most_common())

from itertools import permutations, combinations,combinations_with_replacement,product
L = combinations(range(N), 2)   #nCr
cnt = 0
for i in L:
  if t[i[0]]==t[i[1]]:
    cnt +=1
print(cnt)


Fixed submission:
N=int(input())
d={}
for i in range(N):
  a = "".join(sorted(list(input())))
  if a not in d:
    d[a] = 1
  else:
    d[a]=d[a]+1
cnt = 0
for B in d.values():
  cnt += int(B * (B-1) /2)
print(cnt)