Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, c, k = input().split()

if a >= k:
  print(1*k)
elif (a+b) > k:
  print(1*a)
else:
  ans = (1*a) - (k-(a-b))
  print(ans)

Fixed submission:
li = list(map(int, input().split()))
a, b, c, k = li[0], li[1], li[2], li[3]

if a >= k:
  print(1*k)
elif (a+b) >= k:
  print(1*a)
else:
  ans = (1*a) - (k-(a+b))
  print(ans)
Buggy python submission (verdict: Runtime Error):
import collections

n,k = input().split()
n = int(n)
k = int(k)
h =[]
for i in range(n):
    h.append(int(input()))

h = h.sort(reverse=True)
c = collections.Counter(h)
flg = False
for i in c:
    if c[i] >= 3:
        print(0)
        flg = True
        break

diff=[]
for i in range(0,n-k+1,k):
    diff.append(abs(h[i] - h[i+k-1]))
print(min(diff))

Fixed submission:
import collections

n,k = input().split()
n = int(n)
k = int(k)
h =[]
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)
# c = collections.Counter(h)
# flg = False
# for i in c:
#     if c[i] >= k:
#         print(0)
#         flg = True
#         break

diff=[]
for i in range(0,n-k+1):
    diff.append(abs(h[i] - h[i+k-1]))
print(min(diff))

Buggy python submission (verdict: Runtime Error):
import collections

n,k = input().split()
n = int(n)
k = int(k)
h =[]
for i in range(n):
    h.append(int(input()))

h = sorted(h)
c = collections.Counter(h)
flg = False
for i in c:
    if c[i] >= 3:
        print(0)
        flg = True
        break

if flg == False:
    print(abs(h[n] - h[n-k]))

Fixed submission:
import collections

n,k = input().split()
n = int(n)
k = int(k)
h =[]
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)
# c = collections.Counter(h)
# flg = False
# for i in c:
#     if c[i] >= k:
#         print(0)
#         flg = True
#         break

diff=[]
for i in range(0,n-k+1):
    diff.append(abs(h[i] - h[i+k-1]))
print(min(diff))
Buggy python submission (verdict: Runtime Error):
s = input()

a = 10000
index = 0
for i in range(len(s)):
    n = 100 * int(s[i]) + 10 * int(s[i+1]) + int(s[i+2])
    tmp = abs(n - 753)
    if a > tmp:
        a = tmp
    if i == (len(s) - 2 ):
        break

print(a)

Fixed submission:
s = input()

ans = 10000
index = 0
for i in range(len(s)-2):
    a = 100 * int(s[i])
    b = 10 * int(s[i+1])
    c = int(s[i+2])
    hog = a + b + c
    tmp = abs(hog - 753)
    if ans > tmp:
        ans = tmp

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

strA = str(input())

if strA == 'ABC':
  print('ARC')
elif strA == 'ARC':
  print('ABC')
else
  print('')

Fixed submission:
import sys

import math
input = sys.stdin.readline

hoge = str(input().strip())
if hoge == "ABC":
   print("ARC".strip())
if hoge == "ARC":
       print("ABC".strip())
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())

X = A // D
Y = C // B

if A % D > 0:
  X += 1

if C % B > 0:
  Y += 1

if Y > X:
  print('No')
else :
  print('Yes')

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

if X > Y:
  print('safe')
else:
  print('unsafe')
Buggy python submission (verdict: Runtime Error):
A = int(input())
  
B = A // 10
C = B // 10

  if A % 10 == 7:
   print ("Yes")

elif B % 10 == 7:
     print ("Yes")
  
elif C % 10 == 7:
  print ("Yes")
else:
  print ("No")

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

A = int(input())
      
B = A // 10
C = B // 10
 
if A % 10 == 7:
  print ("Yes")
elif B % 10 == 7:
  print ("Yes")
elif C % 10 == 7:
  print ("Yes")
else:
  print ("No")
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

#intの場合
N ,M = map(int,input().split())

intlist = list(map(int, input().split()))
newlist = sorted(intlist, reverse=True)[:M]

if newlist[M-1] > ( sum(intlist) / (4 * M) ):
  print ("Yes")
else:
  print ("No")
  

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

#intの場合
X,Y,Z = map(int,input().split())

Xa = Y
Ya = X
Xa = Z
Za = Y

print ( Z, X ,Y)
Buggy python submission (verdict: Runtime Error):
hp = int(input())
attack = int(input())

print(-(-(hp) //attack))



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

print(-(-(kazu[0]) // kazu[1]))
Buggy python submission (verdict: Runtime Error):
hp = int(input())
hissatsu = int(input())
hissatsuatk = list(map(int, input().split()))

if hp <= sum(hissatsuatk):
    print('YES')
else:
    print('NO')


Fixed submission:
kazu1 = list(map(int, input().split()))
kazu2 = list(map(int, input().split()))

if kazu1[0] <= sum(kazu2):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
kazu1 = list(map(int, input().split()))
kazu2 = list(map(int, input().split()))
n = 0
kazu2.sort(reverse=True)

kazu2[0:kazu1[1]-1] = 0

n += sum(kazu2)

print(n)

Fixed submission:
kazu1 = list(map(int, input().split()))
kazu2 = list(map(int, input().split()))
n = 0
kazu2.sort(reverse=True)

kazu2[:kazu1[1]] = [0]

n += sum(kazu2)

print(n)

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

for i in range(kazu1[1]):
    kazu2[kazu2.index(max(kazu2))] = 0

n += sum(kazu2)

print(n)

Fixed submission:
kazu1 = list(map(int, input().split()))
kazu2 = list(map(int, input().split()))
n = 0
kazu2.sort(reverse=True)

kazu2[:kazu1[1]] = [0]

n += sum(kazu2)

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

n,m = map(int,input().split())
card_flg = [True for i in range(n + 1)]
false_flg = [False for i in range(n + 1)]



for i in range(m):
    l,r = map(int,input().split())
    card_flg_tmp = copy.copy(false_flg)
    card_flg_tmp[l:r + 1] = [True for i in range(l,r + 1)]
    card_flg = np.logical_and(card_flg, card_flg_tmp)

print(list(card_flg).count(True))


Fixed submission:
import numpy as np
import copy

n,m = map(int,input().split())
max_l = 0
min_r = n

for i in range(m):
    l,r = map(int,input().split())
    max_l = max(max_l, l)
    min_r = min(min_r, r)

if max_l <= min_r:
    print(min_r - max_l + 1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if (c-a-b <= 0)
    print("No")
else:
    ans = (c-a-b) * (c-a-b) > 4 * a  *b 
    if (ans):
        print("Yes")
    else:
        print("No")

Fixed submission:
a,b,c = map(int,input().split())
if (c-a-b <= 0):
    print("No")
else:
    ans = (c-a-b) * (c-a-b) > 4 * a  *b 
    if (ans):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
import math 
N = int(input())
A= list(map(int,input().split()))
memo_gcd_foward = [A[0]]
memo_gcd_backward = [A[N-1]]

for i in range(N-1):
    memo_gcd_foward.append(math.gcd(memo_gcd_foward[-1],A[i+1]))

for i in range(N-1):
    memo_gcd_backward.append(math.gcd(memo_gcd_backward[-1],A[-i-2]))


cand = []
cand.append(memo_gcd_foward[-1])
cand.append(memo_gcd_foward[-2])
cand.append(memo_gcd_backward[-2])

for i in range(N-2):
    cand.append(math.gcd(memo_gcd_foward[i],memo_gcd_backward[-i-3]))
print(max(cand))

Fixed submission:
import math 
N = int(input())
A= list(map(int,input().split()))
memo_gcd_foward = [A[0]]
memo_gcd_backward = [A[N-1]]

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

for i in range(N-1):
    memo_gcd_foward.append(gcd(memo_gcd_foward[-1],A[i+1]))

for i in range(N-1):
    memo_gcd_backward.append(gcd(memo_gcd_backward[-1],A[-i-2]))


cand = []
cand.append(memo_gcd_foward[-1])
cand.append(memo_gcd_foward[-2])
cand.append(memo_gcd_backward[-2])

for i in range(N-2):
    cand.append(gcd(memo_gcd_foward[i],memo_gcd_backward[-i-3]))
print(max(cand))
Buggy python submission (verdict: Runtime Error):
INPUT= input()
n, y = INPUT.strip().split(" ")
n = int(n)
y = int(y)
for i in range(n+2):
    for j in range(i+1,n+2):
        if flag == 1:
            break
        if y ==10000 *i + 5000* (j-i-1) + 1000 * (n-j+1):
            print("{} {} {}".format(i, j-i-1, n-j+1))
            flag = 1
            break
if flag == 0:
    print("-1 -1 -1")

Fixed submission:
INPUT= input()
n, y = INPUT.strip().split(" ")
n = int(n)
y = int(y)
flag = 0
for i in range(n+2):
    for j in range(i+1,n+2):
        if flag == 1:
            break
        if y ==10000 *i + 5000* (j-i-1) + 1000 * (n-j+1):
            print("{} {} {}".format(i, j-i-1, n-j+1))
            flag = 1
            break
if flag == 0:
    print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, h =[int(i) for i in input().split()]
ab = np.empty((n,2),dtype=int)
for i in range(n):
    ab[i,:] = np.array([int(i) for i in input().split()])
np.sort(ab[:,0])
b = ab[:,1]
sort_b_idx = np.argsort(b)
sort_b =ab[sort_b_idx,1]
max_a = np.max(ab[:,0])
b_sum = np.sum(b[b>max_a])
if b_sum > h:
    for i in range(1,n+1):
        if np.sum(sort_b[-i:]) > h:
            ret = i
            break
else:
    ret = len(b[b>max_a])
    ret += np.ceil((h -b_sum)/max_a)
print(str(int(ret)))

Fixed submission:
import numpy as np
n, h =[int(i) for i in input().split()]
a = np.empty(n)
b = np.empty(n)
for i in range(n):
    a[i], b[i] = [int(i) for i in input().split()]
sort_b = np.sort(b)
max_a = np.max(a)
b_big = sort_b[sort_b>max_a]
b_sum = np.sum(b_big)
if b_sum >= h:
    ret = np.sum(b_big[::-1].cumsum() <h) + 1 
else:
    ret = b_big.shape[0]
    ret += np.ceil((h -b_sum)/max_a)
print(int(ret))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, h =[int(i) for i in input().split()]
ab = np.empty((n,2),dtype=int)
for i in range(n):
    ab[i,:] = np.array([int(i) for i in input().split()])
np.sort(ab[:,0])
a = ab[:,0]
b = ab[:,1]
sort_a_idx =  np.argsort(a)
sort_b_idx = np.argsort(b)
sort_a =ab[sort_a_idx,0]
sort_b =ab[sort_b_idx,1]
max_a = sort_a[-1]
b_sum = np.sum(b[b>max_a])
if b_sum > h:
    for i in range(1,n+1):
        if np.sum(sort_b[-i:]) > h:
            ret = i
            break
else:
    ret = len(b[b>max_a])
    ret += np.ceil((h -b_sum)/max_a)
print(str(int(ret)))

Fixed submission:
import numpy as np
n, h =[int(i) for i in input().split()]
a = np.empty(n)
b = np.empty(n)
for i in range(n):
    a[i], b[i] = [int(i) for i in input().split()]
sort_b = np.sort(b)
max_a = np.max(a)
b_big = sort_b[sort_b>max_a]
b_sum = np.sum(b_big)
if b_sum >= h:
    ret = np.sum(b_big[::-1].cumsum() <h) + 1 
else:
    ret = b_big.shape[0]
    ret += np.ceil((h -b_sum)/max_a)
print(int(ret))
Buggy python submission (verdict: Runtime Error):
import numpy as np 
s = input()
fis = s[0]
n = len(s)
k = float('inf')
temp = s[0]
for i in range(n):
    if temp!=s[i]:
        temp = s[i]
        k = np.min((k, np.max( (i, n-i) ) ))
print("{}".format(int(k)))

Fixed submission:
import numpy as np 
s = input()
fis = s[0]
n = len(s)
k = n
temp = s[0]
for i in range(n):
    if temp!=s[i]:
        temp = s[i]
        k = np.min((k, np.max( (i, n-i) ) ))
print("{}".format(int(k)))

Buggy python submission (verdict: Runtime Error):
import numpy as np 
fis = s[0]
n = len(s)
k = float('inf')
temp = s[0]
for i in range(n):
    if temp!=s[i]:
        temp = s[i]
        k = np.min((k, np.max( (i, n-i) ) ))
print("{}".format(int(k)))

Fixed submission:
import numpy as np 
s = input()
fis = s[0]
n = len(s)
k = n
temp = s[0]
for i in range(n):
    if temp!=s[i]:
        temp = s[i]
        k = np.min((k, np.max( (i, n-i) ) ))
print("{}".format(int(k)))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
hoge = input()
N = int(hoge)
paper = set([])
for i in range(N):
    hoge = input()
    hoge = hoge.strip()
    if paper.issuperset(set([hoge])):
        paper = paper - set([hoge])
    else:
        paper = paper | set([hoge])
    
print(len(paper))

Fixed submission:
import numpy as np
hoge = input()
N = int(hoge)
paper ={}
for i in range(N):
    hoge = input()
    hoge = hoge.strip()
    if hoge in paper:
        paper.pop(hoge)
    else:
        paper[hoge] = 1
    
print(len(paper))

Buggy python submission (verdict: Runtime Error):
import numpy as np
hoge = input()
N = int(hoge)
paper = set([])
for i in range(N):
    hoge = input()
    hoge = hoge.strip()
    if paper.issuperset(hoge):
        paper = paper - set([hoge])
    else:
        paper = paper + set([hoge])
    
print(len(paper))

    


Fixed submission:
import numpy as np
hoge = input()
N = int(hoge)
paper ={}
for i in range(N):
    hoge = input()
    hoge = hoge.strip()
    if hoge in paper:
        paper.pop(hoge)
    else:
        paper[hoge] = 1
    
print(len(paper))
Buggy python submission (verdict: Runtime Error):
import numpy as np
hoge = input()
N,A,B,C,D = list(map(int,hoge.split(" ")))
k = np.abs(B-A)//D
l = np.abs(B-A)%D
times = k + 2 * np.ceil (l/ (D-C))
if times > N-2:
    print("NO")
else:
    print("YES")

Fixed submission:
import numpy as np
import scipy.misc as scm
hoge = input()
hoge = list(map(int,hoge.split(" ")))
N = hoge[0]
P = hoge[1]
A = input()
A = list(map(int,A.split(" ")))
A = np.array(A)

odd = len(A[A %2 == 1])
even = N -odd
perm = 0
if P == 0:
    for i in range(0,odd+1,2):
        perm +=scm.comb(odd,i,1)
else:
    for i in range(1,odd+1,2):
            perm +=scm.comb(odd,i,1)
ans = 2**even * perm
print(ans)

Buggy python submission (verdict: Runtime Error):
hoge = input()
N,A,B,C,D = list(map(int,hoge.split(" ")))
k = np.abs(B-A)//D
l = np.abs(B-A)%D
times = k + 2 * np.ceil (l/ (D-C))
if times > N-2:
    print("NO")
else:
    print("YES")

Fixed submission:
import numpy as np
import scipy.misc as scm
hoge = input()
hoge = list(map(int,hoge.split(" ")))
N = hoge[0]
P = hoge[1]
A = input()
A = list(map(int,A.split(" ")))
A = np.array(A)

odd = len(A[A %2 == 1])
even = N -odd
perm = 0
if P == 0:
    for i in range(0,odd+1,2):
        perm +=scm.comb(odd,i,1)
else:
    for i in range(1,odd+1,2):
            perm +=scm.comb(odd,i,1)
ans = 2**even * perm
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)

if n%2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)

import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")

Fixed submission:
import numpy as np
n = int(input())
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)
even= a[1::2]
odd= a[0::2]
if n%2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)
 
import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = input()
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)
odd = a[1::2]
even = a[0::2]
if n//2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)
import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")

Fixed submission:
import numpy as np
n = int(input())
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)
even= a[1::2]
odd= a[0::2]
if n%2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)
 
import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = np.zeros(N)
for i in range(N):
    a[i+1] = int(input())
i = 1
n = 0
for j in range(N):
    n = n+1
    i = a[i]
    if i == 2:
        print(n)
        break
if i!=2:
    print(-1)

Fixed submission:
import numpy as np
N = int(input())
a = np.zeros(N+1)
for i in range(N):
    a[i+1] = int(input())
i = 1
n = 0
for j in range(N):
    n = n+1
    i = a[i]
    if i == 2:
        print(n)
        break
if i!=2:
    print(-1)
Buggy python submission (verdict: Runtime Error):

a = input()

for target in set(s):
    s = a
    j = 0
    min = 10000
    while(1):
        
        if len(set(s)) == 1:
            break
        new_s = ""
        for i in range(len(s)-1):
            if s[i] == target or s[i+1] == target:
                new_s +=target
            else:
                new_s += s[i]
        j+=1;
        s = new_s
    if min > j:
        min = j
print(min)

Fixed submission:
a = input()
min = 10000
for target in set(a):
    s = a
    j = 0
    while(1):
        
        if len(set(s)) == 1:
            break
        new_s = ""
        for i in range(len(s)-1):
            if s[i] == target or s[i+1] == target:
                new_s +=target
            else:
                new_s += s[i]
        j+=1;
        if j > min:
            break
        s = new_s
    if min > j:
        min = j

print(min)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
s = raw_input()
counter = Counter(s)
target = counter.most_common()[0][0]
j = 0
while(1):
    if len(set(s)) == 1:
        break
    new_s = ""
    for i in range(len(s)-1):
        if s[i] == target or s[i+1] == target:
            new_s +=target
        else:
            new_s += s[i]
    j+=1;
    s = new_s
print(j)

Fixed submission:
a = input()
min = 10000
for target in set(a):
    s = a
    j = 0
    while(1):
        
        if len(set(s)) == 1:
            break
        new_s = ""
        for i in range(len(s)-1):
            if s[i] == target or s[i+1] == target:
                new_s +=target
            else:
                new_s += s[i]
        j+=1;
        if j > min:
            break
        s = new_s
    if min > j:
        min = j

print(min)
Buggy python submission (verdict: Runtime Error):
print(A+B/24)

Fixed submission:
import sys
a = sys.stdin.readline()
a,b = a.strip().split(" ")
print((int(a)+int(b))%24)
Buggy python submission (verdict: Runtime Error):
r = int(input())
pi = 3.14159265358979
print(2*r*pi)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    hws = list(map(int, input().split()))
    for i in hws:
        N -= i
        if (N<0):
            print(-1)
            return

    print(N)

solve()

Buggy python submission (verdict: Runtime Error):
r = int(input())
import math
print(2*r*math.pi)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    hws = list(map(int, input().split()))
    for i in hws:
        N -= i
        if (N<0):
            print(-1)
            return

    print(N)

solve()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    a = k[i]
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
for key in d:
    a = d[key]
    dd[key] = int(a*(a-1)/2)
for i in range(N):
    res = 0
    for key in d:
        if d[key]>1:
            if key != k[i]:
                res += dd[key]
            else:
                a = d[key]
                res += int((a-1)*(a-2)/2)
    print(res)

Fixed submission:
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    a = k[i]
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
tot = 0
for key in d:
    a = d[key]
    dd[key] = int(a*(a-1)/2)
    tot += dd[key]
for i in range(N):
    print(tot - d[k[i]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    if k[i] in d:
        d[k[i]] += 1
    else:
        d[k[i]] = 1
for key in d:
    dd[key] = int(d[key]*(d[key]-1)/2)
for i in range(N):
    res = 0
    for key in d:
        if d[key]>1:
            if key == k[i]:
                res += int((d[key]-1)*(d[key]-2)/2)
            else:
                res += dd[key]
    print(res)

Fixed submission:
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    a = k[i]
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
tot = 0
for key in d:
    a = d[key]
    dd[key] = int(a*(a-1)/2)
    tot += dd[key]
for i in range(N):
    print(tot - d[k[i]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    if k[i] in d:
        d[k[i]] += 1
    else:
        d[k[i]] = 1
for key in d:
    dd[key] = d[key]*(d[key]-1)/2
for i in range(N):
    res = 0
    for key in d:
        if d[key]>1:
            if key == k[i]:
                res += (d[key]-1)*(d[key]-2)/2
            else:
                res += dd[key]
    print(int(res))

Fixed submission:
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    a = k[i]
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
tot = 0
for key in d:
    a = d[key]
    dd[key] = int(a*(a-1)/2)
    tot += dd[key]
for i in range(N):
    print(tot - d[k[i]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = list(map(int, input().split()))
d = {}
for i in range(N):
    if k[i] in d:
        d[k[i]] += 1
    else:
        d[k[i]] = 1

for i in range(N):
    res = 0

    for key in d:
        if d[key]>1:
            if key == k[i]:
                res += (d[key]-1)*(d[key]-2)/2
            else:
                res += d[key]*(d[key]-1)/2
    print(int(res))

Fixed submission:
N = int(input())
k = list(map(int, input().split()))
d = {}
dd = {}
for i in range(N):
    a = k[i]
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
tot = 0
for key in d:
    a = d[key]
    dd[key] = int(a*(a-1)/2)
    tot += dd[key]
for i in range(N):
    print(tot - d[k[i]]+1)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
 
if (c-a-b)<=0:
  import sys
  print("No")
  sys.exit()
if 4*a*b < (c-a-b)*(c-a-b):
    print("Yes")
else:
    print("No")

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = int(input()) -1
print(a[index])

Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = input()
print(a[index-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = int(input()) -1
print(a[index])

Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = int(input().split())
print(a[index-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = int(input()) -1
print(a[index])