Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
 
H, N = map(int, input().split())
A, B = [], []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
dp_max = 10000000000
dp = [dp_max for i in range(H+1)]
#dp = np.full(H+1, dp_max, dtype=int)
dp[0] = 0
 
for i in range(H+1):
  if dp[i] == dp_max:
    continue
 
  for j in range(N):
    ni = min(H, i + A[j])
 
    dp[ni] = min(dp[ni], dp[i] + B[j])
print(dp[H])

Fixed submission:
#import numpy as np
 
H, N = map(int, input().split())
A, B = [], []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
dp_max = 10000000000
dp = [dp_max for i in range(H+1)]
#dp = np.full(H+1, dp_max, dtype=int)
dp[0] = 0
 
for i in range(H+1):
  if dp[i] == dp_max:
    continue
 
  for j in range(N):
    ni = min(H, i + A[j])
 
    dp[ni] = min(dp[ni], dp[i] + B[j])
print(dp[H])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

H, N = map(int, input().split())
A, B = [], []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
dp_max = 10000000000
dp = np.full(H+1, dp_max, dtype=int)
dp[0] = 0

for i in range(H+1):
  if dp[i] == dp_max:
    continue

  for j in range(N):
    ni = min(H, i + A[j])

    dp[ni] = min(dp[ni], dp[i] + B[j])
print(dp[H])

Fixed submission:
#import numpy as np
 
H, N = map(int, input().split())
A, B = [], []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
  
dp_max = 10000000000
dp = [dp_max for i in range(H+1)]
#dp = np.full(H+1, dp_max, dtype=int)
dp[0] = 0
 
for i in range(H+1):
  if dp[i] == dp_max:
    continue
 
  for j in range(N):
    ni = min(H, i + A[j])
 
    dp[ni] = min(dp[ni], dp[i] + B[j])
print(dp[H])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int, input().split()))

count = 1
for i in range(1, N):
  if min(l[:i]) >= l[i]:
    count = count + 1
  else:
    pass
    
print(count)

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

count = 1
min = l[0]
for i in range(1, N):
  if min > l[i]:
    count = count+1
    min = l[i]
    
print(count)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

cor = 0
penalty = 0
dic = {}
for i in range(M):
  p, S = input().split()
  p = int(p)
  if p not in dic:
    dic[p] = "_"
  if (S == "AC") & (dic[p] != "AC"):
    dic[p] = "AC"
    cor = cor+1
    continue
  elif (S == "WA") & (dic[p] != "AC"):
    penalty = penalty + 1
    
print("{} {}"penalty)

Fixed submission:
N, M = map(int, input().split())
 
cor = 0
penalty = 0
dic_penalty = {}
dic = {}
for i in range(M):
  p, S = input().split()
  p = int(p)
  if p not in dic:
    dic[p] = "_"
    dic_penalty[p] = 0
  if (S == "AC") & (dic[p] != "AC"):
    dic[p] = "AC"
    cor = cor+1
    penalty = penalty + dic_penalty[p]
    continue
  elif (S == "WA") & (dic[p] != "AC"):
    dic_penalty[p] = dic_penalty[p] + 1
    
print("{} {}".format(cor, penalty))
Buggy python submission (verdict: Runtime Error):
n = int(input())

print(n - (n+1)%2)//2

Fixed submission:
n = int(input())

print((n - (n+1)%2)//2)
Buggy python submission (verdict: Runtime Error):
a = int(input()) - int(input())*2
if a > 0:
  print(a)
else:
  print("0")


Fixed submission:
x,y = map(int, input().split())
a = x - y*2
if a > 0:
  print(a)
else:
  print("0")

Buggy python submission (verdict: Runtime Error):
a = int(input())
if int(input()) - int(input())*2 > 0:
  print(int(input()) - int(input())*2)
else:
  print("0")

Fixed submission:
x,y = map(int, input().split())
a = x - y*2
if a > 0:
  print(a)
else:
  print("0")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

S[K] -= 26

print(S)

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

S[K-1] = chr(ord(S[K-1]) + 32)

print("".join(S))
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().split()))
ss = sorted(s)
ssr = sorted(s, reverse=True)

if s=ss or s==ssr:
  print("No")
else:
  print("Yes")

Fixed submission:
A, B, C = map(int, input().split())

if A < C < B:
  print("Yes")
elif B < C < A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = list(input())
n = len(S)

for i in reversed(range(0,n)):
  for j in range(0,n-i+1):
    s = S[j:j+i].strip("A").strip("C").strip("G").strip("T")
    if s == "":
      break

print(i)
    

Fixed submission:
S = input()
n = len(S)

flag = 0
for i in reversed(range(0,n+1)):
  for j in range(0,n-i+1):
    s = S[j:j+i].replace("A", "").replace("C", "").replace("G","").replace("T","")
    #print("+", s, "+", len(s))
    if len(s) == 0:
      flag=1
      break
  if flag==1:
    break

print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = 0
for n in range(N):
  x, t = input().split()
  if t == "BTC":
    ans += x*380000.0
  else:
    ans += x
print(ans)

Fixed submission:
N = int(input())

ans = 0
for n in range(N):
  x, t = input().split()
  if t == "BTC":
    ans += float(x)*380000.0
  else:
    ans += float(x)
print(ans)
Buggy python submission (verdict: Runtime Error):
print(int(input())*int(input())//2)

Fixed submission:
A, B, C = map(int, input().split())
print(A*B//2)
Buggy python submission (verdict: Runtime Error):
N, H, W = map(int, input().split())

print((N-H+1)*(N-W+1))

Fixed submission:
N = int(input())
H = int(input())
W = int(input())
 
print((N-H+1)*(N-W+1))
Buggy python submission (verdict: Runtime Error):
if input()==1:
  print("Hello World")
else:
  print(int(input()) + int(input()))

Fixed submission:
if input()=="1":
  print("Hello World")
else:
  print(int(input()) + int(input()))
Buggy python submission (verdict: Runtime Error):
X = int(input())

A_ = X//4+1
B_ = X//7+1

ans - 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
X = int(input())

A_ = X//4+1
B_ = X//7+1

ans = 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
Vx = int(input())

if x < 1200:
  print("ABC")
elif x < 2800:
  print("ARC")
else:
  print("AGC")


Fixed submission:
x = int(input())

if x < 1200:
  print("ABC")
elif x < 2800:
  print("ARC")
else:
  print("AGC")
Buggy python submission (verdict: Runtime Error):
x = int(input)

if x%2 == 0:
  print(x)
else:
  print(x*2)

Fixed submission:
x = int(input())
 
if x%2 == 0:
  print(x)
else:
  print(x*2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = map(int, input().split())

print(max(S) - min(S))

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

print(max(S) - min(S))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())

A_x = (B-A)-1

print(sum(list(range(A_x+1)))-A)

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

A_x = (B-A)-1

print(sum(list(range(A_x+1)))-A)
Buggy python submission (verdict: Runtime Error):
month, day = map(int, input().split())

ans = month-1 if month > day else month

if month < day:
  

print(ans)


Fixed submission:
month, day = map(int, input().split())

ans = month-1 if month > day else month

print(ans)
Buggy python submission (verdict: Runtime Error):
print(700 + input().count()*100)

Fixed submission:
print(700 + input().count("o")*100)
Buggy python submission (verdict: Runtime Error):
X , Y = map(int, input()split())

if X%Y == 0:
  print(-1)
else:
  i = 1
  while True:
    if X*i%Y != 0:
      print(X*i)
      break

Fixed submission:
X , Y = map(int, input().split())

if X%Y == 0:
  print(-1)
else:
  i = 2
  while True:
    if X*i > 10**18:
      print(-1)
      break
    if X*i%Y != 0:
      print(X*i)
      break
    i += 1
Buggy python submission (verdict: Runtime Error):
import math
x = int("".join([input(), input()]))

if int(math.sqrt(x))**2 == x:
  print("Yes")
else:
  print("No")

Fixed submission:
import math
x = int("".join(input().split()))

if int(math.sqrt(x))**2 == x:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = input()
s[0:3] = "2018"

print(s)

Fixed submission:
s = input()
s = s.replace("2017","2018")
 
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
lis = list(map(int, input().split()))

count = 0
while(1):
  if sum(lis) % 2 == 1:
    print(count)

Fixed submission:
import numpy as np

N = int(input())

lis = np.array(list(map(int, input().split())))

count = 0
while(1):
  if np.mod(lis, 2).sum() != 0:
    print(count)
    break
  else:
    lis = lis // 2
  count = count + 1
Buggy python submission (verdict: Runtime Error):
x = input()

xi = int(x)
xs = sum(list(x))

if xi%xs==0:
  print("Yes")
else:
  print("No")

Fixed submission:
x = input()

xi = int(x)
xs = sum([ int(xx) for xx in x])

if xi%xs==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import collections

s = input()

c = collections.Counter(s)

if len(c) == 1:
  print("Yes")
elif len(c) == 2:
  if (c.values()[0] == 1) | (c.values()[0] == 3):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
s = input()

if s[0] == s[1] == s[2]:
  print("Yes")
elif s[3] == s[1] == s[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
l = list(map(int, input().split()))

ans = 0
for i in l:
  ans += min([K-l, l])*2
  
print(ans)

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

ans = 0
for i in l:
  ans += min([K-i, i])*2
  
print(ans)
Buggy python submission (verdict: Runtime Error):
s = set(list(input()))
b = set(list("abcdefghijklmnopqrstuvwxyz"))

print(sorted(list(b-s))[0])

Fixed submission:
s = set(list(input()))
b = set(list("abcdefghijklmnopqrstuvwxyz"))

l = sorted(list(b-s))

if l == []:
  print("None")
else:
  print(sorted(list(b-s))[0])
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

if A<C:
  if B-C < 0:
    print(0)
  else:
    if D-B < 0:
      x = B-D
    else:
      x = 0
    print(B-C-x)
else:
  if D-A < 0:
    print(0)
  else:
    if B-D < 0:
      x = D-B
    print(D-A-x)


Fixed submission:
A, B, C, D = map(int, input().split())

if A<C:
  if B-C < 0:
    print(0)
  else:
    if D-B < 0:
      x = B-D
    else:
      x = 0
    print(B-C-x)
else:
  if D-A < 0:
    print(0)
  else:
    if B-D < 0:
      x = D-B
    else:
      x = 0
    print(D-A-x)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

dic = {}
for n in range(1,N+1):
  dic[n] = int(input())
  
lis = []
now = 1
count = 0
flag = False
while True:
  #count += 1
  if now in lis:
    break
  if dic[now] == 2:
    flag = True
    break
  lis.append(now)
  now = dic[now]

if flag:
  print(len(lis)+1)
else:
  print(-1)

Fixed submission:
N = int(input())

dic = {}
for n in range(1,N+1):
  dic[n] = int(input())

now = 1
count = 0
flag = False
while True:
  if now==2:
    flag = True
    break
  if now not in dic:
    break
  now = dic.pop(now)
  #del dic[now]
  count += 1

if flag:
  print(count)
else:
  print(-1)

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

dic = {}
for n in range(1,N+1):
  dic[n] = int(input())
  
lis = []
now = 1
count = 0
flag = False
while True:
  count += 1
  if now in lis:
    break
  if dic[now] == 2:
    flag = True
    break
  lis.append(now)
  now = dic[now]
  
if flag:
  print(count)
else:
  print(-1)

Fixed submission:
N = int(input())

dic = {}
for n in range(1,N+1):
  dic[n] = int(input())

now = 1
count = 0
flag = False
while True:
  if now==2:
    flag = True
    break
  if now not in dic:
    break
  now = dic.pop(now)
  #del dic[now]
  count += 1

if flag:
  print(count)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

dic = { m:0for m in range(M)}
for n in range(N):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for m in range(M):
  print(dic[m])

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

dic = { n:0for n in range(N)}
for m in range(M):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for n in range(N):
  print(dic[n])

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

dic = { m:0for m in range(M)}
for n in range(N):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for m in range(M):
  print(dic[m])

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

dic = { n:0for n in range(N)}
for m in range(M):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for n in range(N):
  print(dic[n])
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

As = np.array([["." for n in range(N)] for nn in range(N)])
for n in range(N):
  As[n,:] = np.array(list(input()))
  
Bs = np.array([["." for n in range(M)] for nn in range(M)])
for m in range(M):
  Bs[m,:] = np.array(list(input()))
  
ok = False
for i in range(N-M):
  for j in range(N-M):
    if (As[i:i+M,j:j+M] == Bs).all():
      ok = True
      break
if ok:
  print("Yes")
else:
  print("No")

Fixed submission:
import numpy as np

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

As = np.array([["." for n in range(N)] for nn in range(N)])
for n in range(N):
  As[n,:] = np.array(list(input()))
  
Bs = np.array([["." for n in range(M)] for nn in range(M)])
for m in range(M):
  Bs[m,:] = np.array(list(input()))
  
ok = False
for i in range(N-M+1):
  for j in range(N-M+1):
    if (As[i:i+M,j:j+M] == Bs).all():
      ok = True
      break
if ok:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
x = S if K>S else K

ans = 0
for i in range(x+1):
  x1 = S-i
  for j in range((K if x1>K else x1)+1):
    x2 = S-i-j
    for k in range((K if x2>K else x2)+1):
      if i+j+k==S:
        #print("{} {} {}".format(i,j,k))
        ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())
x = S if K>S else K

ans = 0
for i in range(x+1):
  x1 = S-i
  for j in range((K if x1>K else x1)+1):
    if S-i-j <= K:
      ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#from scipy.misc import comb

K, S = map(int, input().split())
x = S if K>S else K

#a = comb(3*K, S, exact=True)
#print(a)

ans = 0
for i in range(x+1):
  for j in range(x+1):
    for k in range(x+1):
      if i+j+k==S:
        ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())
x = S if K>S else K

ans = 0
for i in range(x+1):
  x1 = S-i
  for j in range((K if x1>K else x1)+1):
    if S-i-j <= K:
      ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
x1, op, x2 = input().split()

if op == "+":
  print(x1+x2)
else:
  print(x1-x2)

Fixed submission:
x1, op, x2 = input().split()
 
if op == "+":
  print(int(x1)+int(x2))
else:
  print(int(x1)-int(x2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
base_ = sum(Ts)

for m in range(1,M+1):
  p, t = map(int, input().split())
  print(base_ - (Ts[p]-t))

Fixed submission:
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
base_ = sum(Ts)

for m in range(M):
  p, t = map(int, input().split())
  #print(Ts[p-1])
  #print(t)
  #print((Ts[p-1]-t))
  print(base_ - (Ts[p-1]-t))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

for i in range(H):
  s = input().split()
  if W != 1:
    if len(set(s)) == 2:
      row = i+1
      col = 65+s.index('snuke')
      break
  else:
    if s == ["snuke"]:
      row = i+1
      col = 65
print("{}{}".format(chr(col), row))


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

for i in range(H):
  s = input().split()
  if "snuke" in s:
    row = i+1
    col = 65+s.index('snuke')
    break
print("{}{}".format(chr(col), row))

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

for i in range(H):
  s = input().split()
  if len(set(s)) == 2:
    row = i+1
    col = 65+s.index('snuke')
    break
print("{}{}".format(chr(col), row))

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

for i in range(H):
  s = input().split()
  if "snuke" in s:
    row = i+1
    col = 65+s.index('snuke')
    break
print("{}{}".format(chr(col), row))
Buggy python submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))


Fixed submission:
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Buggy python submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Fixed submission:
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Buggy python submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Fixed submission:
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))
Buggy python submission (verdict: Runtime Error):
s = list(input())
print("".join(s[:4] + [" "] + s[4:])

Fixed submission:
s = list(input())
print("".join((s[:4] + [" "] + s[4:])))
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

result = 1
for i in A:
    if i != 0:
        result = result * i
    else:
        print(0)
        exit()
        
    if result > 10**18 or result == -1:
        result = -1
print(result)

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

result = 1
if 0 in A:
    print(0)
    exit()

for i in A:
    result = result * i
        
    if result > 10**18:
        print(-1)
        exit()
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_list = list(map(int,input().split()))

for i in range(1,N+1):
    print(A_list.count(i))

Fixed submission:
import collections
N = int(input())
A_list = list(map(int,input().split()))

g = collections.Counter(A_list)
for i in range(1,N+1):
    print(g[i])
Buggy python submission (verdict: Runtime Error):
X = int(input())

500_cnt = X//500
new_X = X - 500_cnt * 500
5_cnt = new_X // 5
print(500_cnt*1000 + 5_cnt*5)

Fixed submission:
X = int(input())
 
cnt = X//500
new_X = X - cnt * 500
ncnt = new_X // 5
print(cnt*1000 + ncnt*5)
Buggy python submission (verdict: Runtime Error):
K,N = map(int,input().split())
A_list = list(map(int,input().split())
A_list.append(K+A_list[0])
A_split = []
i for in range(N):
    split = A_list[i+1] - A_list[i]
    A_split.append(split)

A_split.pop(A_split.index(max(A_split)))
print(sum(A_split))

Fixed submission:
K,N = map(int,input().split())
A_list = list(map(int,input().split()))
A_list.append(K + A_list[0])
A_split = []
for i in range(N):
    A_split.append(A_list[i+1]-A_list[i])

A_split.pop(A_split.index(max(A_split)))
print(sum(A_split))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))

A_keys = collections.Counter(A)
keys_list= A_keys.keys()
for k in range(N):
    Ak = A[k]
    result = 0
    for i in keys_list:
        cnt = A_keys[i]
        if i == A[k] and cnt >= 2:
            result += (cnt-1)*(cnt-2)/2
        elif i != A[k] and cnt >= 2:
            result += cnt*(cnt-1)/2
    print(int(result))

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

A_keys = collections.Counter(A)
keys_list= A_keys.keys()

combi_sum = {}
for i in keys_list:
    cnt = A_keys[i]
    combi_sum[i] = cnt * (cnt-1)//2 

v_sum = sum(combi_sum.values())
for k in range(N):
    Ak = A[k]
    k_cnt = A_keys[Ak] - 1
    result = v_sum - combi_sum[Ak] + k_cnt*(k_cnt -1)//2
    print(int(result))

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

for k in range(N):
    Ak = A[k]
    A_keys = collections.Counter(A)
    keys_list= A_keys.keys()
    result = 0
    for i in keys_list:
        cnt = A_keys[i]
        if i == A[k] and cnt >= 2:
            result += (cnt-1)*(cnt-2)/2
        elif i != A[k] and cnt >= 2:
            result += cnt*(cnt-1)/2
    print(int(result))

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

A_keys = collections.Counter(A)
keys_list= A_keys.keys()

combi_sum = {}
for i in keys_list:
    cnt = A_keys[i]
    combi_sum[i] = cnt * (cnt-1)//2 

v_sum = sum(combi_sum.values())
for k in range(N):
    Ak = A[k]
    k_cnt = A_keys[Ak] - 1
    result = v_sum - combi_sum[Ak] + k_cnt*(k_cnt -1)//2
    print(int(result))
Buggy python submission (verdict: Runtime Error):
S = input()
cnt = 0
for i in len(S):
  if S[i] == 'A':
    cnt = cnt +1

if cnt == 3 or cnt == 0:
  print('No')
else:
  print('Yes')

Fixed submission:
S = input()
cnt = 0
for i in range(3):
  if S[i] == 'A':
    cnt = cnt +1
 
if cnt == 3 or cnt == 0:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())

A_list = [1 for i in range(A)]
B_list = [0 for v in range(B)]
S = A+B
S_list = A_list + B_list
total = []
for _ in range(N//S + 1):
  total.extend(S_list)
cnt = 0

for x in range(N):
  cnt = cnt + total[x]

print(cnt)

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

S = A+B
count = N//S
pre_cnt = A*count
S_amari  = N-S*count
if S_amari >= A:
  cnt  = pre_cnt + A
else:
  cnt = pre_cnt + S_amari

print(cnt)
Buggy python submission (verdict: Runtime Error):
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b_list=[]
for i in range(N):
  b_list.append(int(input))

for i in b_list:
  A1 = [x in A1 if x != i else -1]
  A2 = [y in A2 if y != i else -1]
  A3 = [z in A3 if z != i else -1]

if sum(A1)==-3 or sum(A2)==-3 or sum(A3)==-3:
  print('Yes')
  exit()
for t in range(3)
  if A1[t]+A2[t]+A3[t] == -3:
    print('Yes')
    exit()
if A1[0]+A2[1]+A3[2] == -3 or A1[2]+A2[1]+A3[0] == -3:
  print('Yes')
  exit()
print('No')

Fixed submission:
import sys
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b_list=[]
for i in range(N):
  b_list.append(int(input()))
 
for i in b_list:
  A1 = [x if x != i else -1 for x in A1]
  A2 = [y if y != i else -1 for y in A2]
  A3 = [z if z != i else -1 for z in A3]
 
if sum(A1)==-3 or sum(A2)==-3 or sum(A3)==-3:
  print('Yes')
  sys.exit()
for t in range(3):
  if A1[t]+A2[t]+A3[t] == -3:
    print('Yes')
    sys.exit()
if A1[0]+A2[1]+A3[2] == -3 or A1[2]+A2[1]+A3[0] == -3:
  print('Yes')
  sys.exit()
print('No')