Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

mid2 = a + b

if mid2 % 2 == 0:
    mid = mid2 / 2
  else:
    mid = 'IMPOSSIBLE'
    
print(mid)

Fixed submission:
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

mid2 = a + b

if mid2 % 2 == 0:
    mid = int(mid2 / 2)
else:
    mid = 'IMPOSSIBLE'
    
print(mid)

Buggy python submission (verdict: Runtime Error):
ab = int(input().split())
a = ab[1]
b = ab[2]

mid2 = a + b
if mid2 % 2 == 0:
    mid = str(mid2 / 2)
   else:
    mid = 'IMPOSSIBLE'
    
print(mid)   

Fixed submission:
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

mid2 = a + b

if mid2 % 2 == 0:
    mid = int(mid2 / 2)
else:
    mid = 'IMPOSSIBLE'
    
print(mid)
Buggy python submission (verdict: Runtime Error):
ns, ds = input().split()
n, d = int(ns), int(ds)

if n % (2 * d + 1) == 0:
  ans = n / (2 * d + 1)
else:
  ans = floor(n / (2 * d + 1)) + 1

print(ans)

Fixed submission:
import math
ns, ds = input().split()
n, d = int(ns), int(ds)

if n % (2 * d + 1) == 0:
  ans = n / (2 * d + 1)
else:
  ans = math.floor(n / (2 * d + 1)) + 1

print(int(ans))
Buggy python submission (verdict: Runtime Error):
S = input()

a = S[0]
b = S[1]
c = S[2]
d = S[3]

i = 0

if a == b:
  i += 1
if a == c:
  i += 1
if a == d:
  i += 1
  
if b == c:
  i += 1
if b == d:
  i += 1
if c == d:
  i += 1

if i == 2:
  print(YES)
else:
  print(NO)
S = input()

a = S[0]
b = S[1]
c = S[2]
d = S[3]

i = 0

if a == b:
  i += 1
if a == c:
  i += 1
if a == d:
  i += 1
  
if b == c:
  i += 1
if b == d:
  i += 1
if c == d:
  i += 1

if i == 2:
  print('YES')
else:
  print('NO')


Fixed submission:
S = input()

a = S[0]
b = S[1]
c = S[2]
d = S[3]

i = 0

if a == b:
  i += 1
if a == c:
  i += 1
if a == d:
  i += 1
  
if b == c:
  i += 1
if b == d:
  i += 1
if c == d:
  i += 1

if i == 2:
  print('Yes')
else:
  print('No')

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

a = S[0]
b = S[1]
c = S[2]
d = S[3]

i = 0

if a == b:
  i += 1
if a == c:
  i += 1
if a == d:
  i += 1
  
if b == c:
  i += 1
if b == d:
  i += 1
if c == d:
  i += 1

if i == 2:
  print(YES)
else:
  print(NO)

Fixed submission:
S = input()

a = S[0]
b = S[1]
c = S[2]
d = S[3]

i = 0

if a == b:
  i += 1
if a == c:
  i += 1
if a == d:
  i += 1
  
if b == c:
  i += 1
if b == d:
  i += 1
if c == d:
  i += 1

if i == 2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))

a = 0

for i in range(n - 1):
  p_l = [p[i], p[i + 1], p[i + 2]]
  p_l2 = sorted(p_l)
  if p_l2[1] == p_l[1]:
    a += 1
    
print(int(a))

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

a = 0

for i in range(n - 2):
  p_l = [p[i], p[i + 1], p[i + 2]]
  p_l2 = sorted(p_l)
  if p_l2[1] == p_l[1]:
    a += 1
    
print(int(a))
Buggy python submission (verdict: Runtime Error):
s = input()

ans = 0

for i in [0, 1, 2]:
  if s[i] == s[i + 1]:
    ans += 1
  else:
  
if ans >= 1:
  print('Bad')
else:
  print('Good')


Fixed submission:
s = input()

ans = 0

for i in [0, 1, 2]:
  if s[i] == s[i + 1]:
    ans += 1
    
if ans >= 1:
  print('Bad')
else:
  print('Good')
Buggy python submission (verdict: Runtime Error):
a,b = [int(input()).split()]

if a >=13:
  print(b)
elif a >= 6:
  print(int(b/2))
else:
  print('0')

Fixed submission:
a,b = [int(i) for i in input().split()]

if a >= 13:
  print(b)
elif a >= 6:
  print(int(b/2))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n, k = input().split()
n, k = int(n), int(k)

s = input()

s1 = s[:k - 1]
s3 = s[:k - 2]
s2 = s[k:]

if s[k - 1] =='A':
  s3.append('a')
  print(s3 + s2)
elif s[k - 1] == 'B':
  s3.append('b')
  print(s3 + s2)
elif s[k - 1] == 'C':
  print(s3 + s2)

Fixed submission:
n,k=map(int, input().split())
S=input()
s=S.lower()
print(S[:k-1]+s[k-1]+S[k:])
Buggy python submission (verdict: Runtime Error):
s = input()

a = s[:2]
b = s[2:]

ans = 0

if a <= 12 and a >= 1:
    ans += 2

if b <= 12 and b >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")


Fixed submission:
s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 0:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 1:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 2:
    x += 1


if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2

if int(sl[0]) == 1 and int(sl[1]) == 0:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 1:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 2:
    x += 2

b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')

Buggy python submission (verdict: Runtime Error):
s = input()

a = s[0:1]
b = s[2:3]

ans = 0

if a <= 12 and a >= 1:
    ans += 2

if b <= 12 and b >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")

Fixed submission:
s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 0:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 1:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 2:
    x += 1


if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2

if int(sl[0]) == 1 and int(sl[1]) == 0:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 1:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 2:
    x += 2

b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')

Buggy python submission (verdict: Runtime Error):
s = input()
a = 0

sf = s[:1]  #'sf' is the formar part of the S
sl = s[2:]  #'sl' is the latter part of the S

for i in range(1:9):
  if sf[0] == 0:
    if sf[1] == i:
      a += 1
    else:
  else:
for j in range(0:2):
  if sf[0] == 1:
      if sf[1] == j:
        a += 1
      else:
  else:

for i in range(1:9):
  if sl[0] == 0:
    if sl[1] == i:
      a += 1
    else:
  else:
for j in range(0:2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 1
      else:
  else:
    
if a == 0:
  print('NA')
elif a == 2:
  print('AMBIGUOUS')
elif a == 2:
  print('YYMM')

Fixed submission:
s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 0:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 1:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 2:
    x += 1


if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2

if int(sl[0]) == 1 and int(sl[1]) == 0:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 1:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 2:
    x += 2

b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')
Buggy python submission (verdict: Runtime Error):
n = list(map(int,input().split()))

p1 = (int(n[0]) + int(n[1]) * 1j)
p2 = (int(n[2]) + int(n[3]) * 1j)

p3 = (p2 - p1) * 1j + p2
p4 = p3 + (p1 - p2)

print(int(p3.real9), int(p3.imag), int(p4.real), int(p4.imag))

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

p1 = (int(n[0]) + int(n[1]) * 1j)
p2 = (int(n[2]) + int(n[3]) * 1j)

p3 = (p2 - p1) * 1j + p2
p4 = p3 + (p1 - p2)

print(int(p3.real), int(p3.imag), int(p4.real), int(p4.imag))

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

p1 = (n[0] + n[1]j)
p2 = (n[2] + n[3]j)

p3 = (p1 - p2) * j + p2
p4 = p3 + (p1 - p2)

print(real(p3),img(p3),real(p4)img(p4))

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

p1 = (int(n[0]) + int(n[1]) * 1j)
p2 = (int(n[2]) + int(n[3]) * 1j)

p3 = (p2 - p1) * 1j + p2
p4 = p3 + (p1 - p2)

print(int(p3.real), int(p3.imag), int(p4.real), int(p4.imag))
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
a = l[0]
b = l[1]

ans1 = a + b
ans2 = a - b
ans3 = a * b

print(max(ans1, ans2, ans3)

Fixed submission:
l = list(map(int, input().split()))
a = l[0]
b = l[1]

ans1 = a + b
ans2 = a - b
ans3 = a * b

print(max(ans1, ans2, ans3))
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
N = int(input())
n = []
for i in range(N):
  n.append(int(input()))

a = 1
c = -1

for i in range(N):
  a = n[a-1]
  if a == 2:
    if c < 0:
      c = (i+1)

print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
n = []
for i in range(N):
  n.append(int(input()))

a = 1
c = -1

for i in range(N):
  a = n[a-1]
  if c != -1:
    if a == 2:
      c = (i+1)
  else:

print(c)

Fixed submission:
N = int(input())
n = []
for i in range(N):
  n.append(int(input()))

a = 1
c = -1

for i in range(N):
  a = n[a-1]
  if a == 2:
    if c < 0:
      c = (i+1)

print(c)
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input().split())

i = 0

if a+b==c:
  i += 1
if b+c==a:
  i += 1
if c+a==b:
  i += 1
  
if i ==1:
  print('Yes')
else:
  print('No')

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

i = 0

if a+b==c:
  i += 1
if b+c==a:
  i += 1
if c+a==b:
  i += 1
  
if i ==1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:print(0)
elif a==b:print(1)
else:
    if (b-1)%(a-1)>0:print((b-1)//(a-1)+n)
    else:print((b-1)//(a-1))

Fixed submission:
a,b=map(int,input().split())
if b==1:print(0)
elif a==b:print(1)
else:
    if (b-1)%(a-1)>0:print((b-1)//(a-1)+1)
    else:print((b-1)//(a-1))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b or a==b:print(1)
  elif a<b and b%a==0:print(b//a)
    elif a<b and b%a!=0:print((b//a)+1)
      else:print(0)

Fixed submission:
a,b=map(int,input().split())
if b==1:print(0)
elif a==b:print(1)
else:
    if (b-1)%(a-1)>0:print((b-1)//(a-1)+1)
    else:print((b-1)//(a-1))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:print(1)
  elif a==b:print(1)
    elif a<b and b%a==0:print(b//a)
      elif b==0:print(0)
        else:print(b//(a+1))

Fixed submission:
a,b=map(int,input().split())
if b==1:print(0)
elif a==b:print(1)
else:
    if (b-1)%(a-1)>0:print((b-1)//(a-1)+1)
    else:print((b-1)//(a-1))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:print(1)
  elif a==b:print(1)
    elif a<b and b%a==0:print(b//a)
      elif b==0:print(0)
        else:print(b//a+1)

Fixed submission:
a,b=map(int,input().split())
if b==1:print(0)
elif a==b:print(1)
else:
    if (b-1)%(a-1)>0:print((b-1)//(a-1)+1)
    else:print((b-1)//(a-1))
Buggy python submission (verdict: Runtime Error):
return input().strip().split().index("0") + 1

Fixed submission:
print(input().strip().split().index("0") + 1)
Buggy python submission (verdict: Runtime Error):
n = input() % 10
if n in ("2", "4", "5", "7", "9"):
    print("hon")
elif n in ("0", "1", "6", "8"):
    print("pon")
else:
  	print("bon")

Fixed submission:
n = int(input().strip()) % 10
if n in (2, 4, 5, 7, 9):
    print("hon")
elif n in (0, 1, 6, 8):
    print("pon")
else:
  	print("bon")
Buggy python submission (verdict: Runtime Error):
n = int(input().strip().split())
arr = [int(i) for i in input().strip().split()]
result = {i:0 for i in range(1, n + 1)}
for i, j in enumerate(arr, 2):
    result[j] += 1
    
for i in result.values():
    print(i)

Fixed submission:
n = int(input().strip())
arr = [int(i) for i in input().strip().split()]
result = {i:0 for i in range(1, n + 1)}
for i, j in enumerate(arr, 2):
    result[j] += 1
    
for i in result.values():
    print(i)
Buggy python submission (verdict: Runtime Error):
coin_value = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
  result += value * (x // coin)
  x = x - x // coin * coin
  
print(result)

Fixed submission:
coin_values = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
    result += value * (x // coin)
    x = x - x // coin * coin
  
print(result)

Buggy python submission (verdict: Runtime Error):
coin_value = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
    result += value * (x // coin)
    x = x - x // coin * coin
  
print(result)
  
  

Fixed submission:
coin_values = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
    result += value * (x // coin)
    x = x - x // coin * coin
  
print(result)
Buggy python submission (verdict: Runtime Error):
k, n = [int(i) for i in input().strip().split()]
arr = [int(i) for i in input().strip().split()] + [k + arr[0]]
max_d = 0
for i in range(1, n + 1):
    max_d = max(max_d, abs(arr[i] - arr[i - 1]))
print(k - max_d)

Fixed submission:
k, n = [int(i) for i in input().strip().split()]
arr = [int(i) for i in input().strip().split()]
arr += [k + arr[0]]
max_d = 0
for i in range(1, n + 1):
    max_d = max(max_d, abs(arr[i] - arr[i - 1]))
print(k - max_d)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
ball = [int(i) for i in input().split()]
counter = Counter(ball)
for i in range(n):
  counter[ball[i]] -= 1
  result = 0
  print(sum([i * (i - 1) // 2 for i in counter.values()]))
  counter[ball[i]] += 1
  


Fixed submission:
from collections import Counter

n = int(input())
ball = [int(i) for i in input().split()]
counter = Counter(ball)
result = sum([i * (i - 1) // 2 for i in counter.values()])

for i in range(n):
  c = counter[ball[i]]
  print(result - (c - 1))

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

n = int(input())
ball = [int(i) for i in input().split()]
for i in range(n):
  counter = Counter(ball[:i]+ball[i+1:])
  result = 0
  print(sum([i * (i - 1) // 2 for i in counter.values()]))
  

Fixed submission:
from collections import Counter

n = int(input())
ball = [int(i) for i in input().split()]
counter = Counter(ball)
result = sum([i * (i - 1) // 2 for i in counter.values()])

for i in range(n):
  c = counter[ball[i]]
  print(result - (c - 1))
Buggy python submission (verdict: Runtime Error):
X, Y = [int(), input().split()]

if X % 2 == 0 and 2 * X < Y < 4 * X:
    print("Yes")
else:
    print("No")


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

if Y % 2 == 0 and 2 * X <= Y <= 4 * X:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
user_input = input()
user_input = user_input.split()
for i in range(len(user_input)):
	if user_input[i] == '0':
    	print(i+1)

Fixed submission:
def solution():
    user_input = input()
    user_input = user_input.split()
    for i in range(len(user_input)):
        if user_input[i] == '0':
            print(i+1)
            



solution()
Buggy python submission (verdict: Time Limit Exceeded):
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#from bisect import bisect_right #二分探索用のモジュール bisect_right(a_list,value)

#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。

# = int(input())

# = map(int,input().split())

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

# = [list(map(int,input().split())) for _ in range(XXXX)]

n = int(input())

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

result = 1

for i in range(n):
    result *= a[i]

if result > 10**18:
    print(-1)
    exit()
else:
    print(result)


Fixed submission:
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#from bisect import bisect_right #二分探索用のモジュール bisect_right(a_list,value)

#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。

# = int(input())

# = map(int,input().split())

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

# = [list(map(int,input().split())) for _ in range(XXXX)]

n = int(input())

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

result = 1
overflg = 0

if min(a) == 0:
    print(0)
    exit()

for aa in a:
    result *= aa
    if result > 10**18:
        print(-1)
        exit()

print(result)
Buggy python submission (verdict: Runtime Error):
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。

# = map(int,input().split())

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

# = [list(map(int,input().split())) for _ in range(XXXX)]

t = list(input())

#print(t)

#pdはプラス2カウントできるので、できるだけpdを作るように置き換える。

for i in range(len(t)):
    if t[i] == "?":
        if i == 0:
            if t[i+1] == "D":
                t[i] = "P"
            else:
                t[i] = "D"
        elif i == len(t)-1:
            t[i] = "D"
        elif t[i-1] == "P":
            t[i] = "D"
        elif t[i+1] == "P":
            t[i] = "D"
        elif t[i+1] == "D":
            t[i] = "P"
        elif t[i+1] == "?":
            t[i] = "P"
            t[i+1] = "D"

print("".join(t))

Fixed submission:
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。

# = map(int,input().split())

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

# = [list(map(int,input().split())) for _ in range(XXXX)]

t = list(input())

#print(t)

#pdはプラス2カウントできるので、できるだけpdを作るように置き換える。


for i in range(len(t)):
    if t[i] == "?":
        if i == len(t)-1:
            t[i] = "D"
        elif i == 0:
            if t[i+1] == "D":
                t[i] = "P"
            else:
                t[i] = "D"
        elif t[i-1] == "P":
            t[i] = "D"
        elif t[i+1] == "P":
            t[i] = "D"
        elif t[i+1] == "D":
            t[i] = "P"
        elif t[i+1] == "?":
            t[i] = "P"
            t[i+1] = "D"

print("".join(t))
Buggy python submission (verdict: Runtime Error):
s,w = int(input())

if s <= w:
  print("unsafe")
else:
  print("safe")

Fixed submission:
s,w = map(int,input().split())
 
if s <= w:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from pprint import pprint
from scipy.special import comb

n = int(input())

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

a_dict = defaultdict(int)

for i in a_list:
    a_dict[i] += 1

#pprint(a_dict)

#総数から(a_dict[k]-1)の値を引いていく。
#例えば5C2のものが一つ減った場合、4C2になる。この差分は5C2-4C2=10-6=4 
#例えば6C2のものが一つ減った場合、5C2になる。この差分は6C2-5C2=15-10=5 
#例えば7C2のものが一つ減った場合、6C2になる。この差分は7C2-6C2=21-15=6

total = 0

#組み合わせの総数を求める。
for j in a_dict.values():
    total += comb(j,2)

for k in a_list:
    print(int(total - (a_dict[k]-1)))

Fixed submission:
from collections import defaultdict
from pprint import pprint
#from scipy.special import comb

n = int(input())

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

a_dict = defaultdict(int)

for i in a_list:
    a_dict[i] += 1

#pprint(a_dict)

#総数から(a_dict[k]-1)の値を引いていく。
#例えば5C2のものが一つ減った場合、4C2になる。この差分は5C2-4C2=10-6=4 
#例えば6C2のものが一つ減った場合、5C2になる。この差分は6C2-5C2=15-10=5 
#例えば7C2のものが一つ減った場合、6C2になる。この差分は7C2-6C2=21-15=6

total = 0

#組み合わせの総数を求める。
for j in a_dict.values():
    total += j*(j-1)/2

for k in a_list:
    print(int(total - (a_dict[k]-1)))

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from pprint import pprint
from scipy.special import comb

n = int(input())

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

a_dict = defaultdict(int)

for i in a_list:
    a_dict[i] += 1

#pprint(a_dict)

#総数から(a_dict[k]-1)の値を引いていく。
#例えば5C2のものが一つ減った場合、4C2になる。この差分は5C2-4C2=10-6=4 
#例えば6C2のものが一つ減った場合、5C2になる。この差分は6C2-5C2=15-10=5 
#例えば7C2のものが一つ減った場合、6C2になる。この差分は7C2-6C2=21-15=6

total = 0

#組み合わせの総数を求める。
for j in a_dict.values():
    total += comb(j,2)

for k in a_list:
    print(int(total - (a_dict[k]-1)))

Fixed submission:
from collections import defaultdict
from pprint import pprint
#from scipy.special import comb

n = int(input())

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

a_dict = defaultdict(int)

for i in a_list:
    a_dict[i] += 1

#pprint(a_dict)

#総数から(a_dict[k]-1)の値を引いていく。
#例えば5C2のものが一つ減った場合、4C2になる。この差分は5C2-4C2=10-6=4 
#例えば6C2のものが一つ減った場合、5C2になる。この差分は6C2-5C2=15-10=5 
#例えば7C2のものが一つ減った場合、6C2になる。この差分は7C2-6C2=21-15=6

total = 0

#組み合わせの総数を求める。
for j in a_dict.values():
    total += j*(j-1)/2

for k in a_list:
    print(int(total - (a_dict[k]-1)))
Buggy python submission (verdict: Runtime Error):
print(^(-1*int(input()) // 2))

Fixed submission:
print(-1*(-1*int(input()) // 2))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())

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

max_sum = 0
max_where = 0

for i in range(0,n-k+1):
    temp_sum =0
    for j in range(k):
        temp_sum += ((p[i + j] + 1) * p[i + j] / 2) / p[i + j]

    if temp_sum > max_sum:
        max_sum = temp_sum

print(max_sum)




#n,k = map(int,input().split())
#
#p = list(map(int,input().split()))
#
#max_sum = 0
#max_where = 0
#
##pi ~ pi+2の合計が最大のものが期待値も最大になる。
#for i in range(0,n-k+1):
#    temp_sum = sum(p[i:i+k])
#    if temp_sum > max_sum:
#        max_sum = temp_sum
#        max_where = i
#
#result = 0
#
#for j in range(k):
#    result += ((p[max_where + j] + 1) * p[max_where + j] / 2) / p[max_where + j]
#
#print(result)

Fixed submission:
from copy import deepcopy

n,k = map(int,input().split())

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


max_sum = 0
temp_sum = 0

#最初の一組目を計算
for j in range(k):
    temp_sum += ((p[j] + 1) * p[j] / 2) / p[j]

if n == k:
    max_sum = temp_sum
    print(max_sum)

else:
    #2組目以降を計算
    for i in range(1,n-k+1):
        temp_sum = temp_sum - ((p[i-1] + 1) * p[i-1] / 2) / p[i-1] + ((p[i+k-1] + 1) * p[i+k-1] / 2) / p[i+k-1]

        if temp_sum > max_sum:
            max_sum = temp_sum


    print(max_sum)




#n,k = map(int,input().split())
#
#p = list(map(int,input().split()))
#
#max_sum = 0#for j in range(k):
#    result += ((p[max_where + j] + 1) * p[max_where + j] / 2) / p[max_where + j]
#max_where = 0
#
##pi ~ pi+2の合計が最大のものが期待値も最大になる。
#for i in range(0,n-k+1):
#    temp_sum = sum(p[i:i+k])
#    if temp_sum > max_sum:
#        max_sum = temp_sum
#        max_where = i
#
#result = 0
#

#
#print(result)

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

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

max_sum = 0
max_where = 0

#pi ~ pi+2の合計が最大のものが期待値も最大になる。
for i in range(0,n-k+1):
    temp_sum = sum(p[i:i+k])
    if temp_sum > max_sum:
        max_sum = temp_sum
        max_where = i

result = 0

for j in range(k):
    result += ((p[max_where + j] + 1) * p[max_where + j] / 2) / p[max_where + j]

print(result)

Fixed submission:
from copy import deepcopy

n,k = map(int,input().split())

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


max_sum = 0
temp_sum = 0

#最初の一組目を計算
for j in range(k):
    temp_sum += ((p[j] + 1) * p[j] / 2) / p[j]

if n == k:
    max_sum = temp_sum
    print(max_sum)

else:
    #2組目以降を計算
    for i in range(1,n-k+1):
        temp_sum = temp_sum - ((p[i-1] + 1) * p[i-1] / 2) / p[i-1] + ((p[i+k-1] + 1) * p[i+k-1] / 2) / p[i+k-1]

        if temp_sum > max_sum:
            max_sum = temp_sum


    print(max_sum)




#n,k = map(int,input().split())
#
#p = list(map(int,input().split()))
#
#max_sum = 0#for j in range(k):
#    result += ((p[max_where + j] + 1) * p[max_where + j] / 2) / p[max_where + j]
#max_where = 0
#
##pi ~ pi+2の合計が最大のものが期待値も最大になる。
#for i in range(0,n-k+1):
#    temp_sum = sum(p[i:i+k])
#    if temp_sum > max_sum:
#        max_sum = temp_sum
#        max_where = i
#
#result = 0
#

#
#print(result)