Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
moto = list(map(int,input().split()) for _ in range(N))

num = 0
for i in moto:
    num = num + i

k = 0
while X - num > num:
    X = X - num
    k += 1
#余ったXから最小のmiを作れるだけ作る
k2 = X % min(moto)
print(k1 + k2)

Fixed submission:
N,X = map(int,input().split())
#入力が一文字ずつだから split()は不要
moto = [int(input()) for _ in range(N)]

num = 0
for i in moto:
    num = num + int(i)

X = X - num
#余ったXから最小のmiを作れるだけ作る
k2 = X // min(moto)
#最初作った個数とその後最小のmiのものだけ作った個数の和
print(N + k2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    lst = list(i)
    if lst[0] == lst[-1] and lst[1] == lst[-2]:
        cnt += 1
print(cnt)

Fixed submission:
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    lst = list(str(i))
    if lst[0] == lst[-1] and lst[1] == lst[-2]:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    lst = list(i)
    if lst[0] == lst[-1] and lst[1] == lst[-2]:
        cnt += 1
plint(cnt)

Fixed submission:
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    lst = list(str(i))
    if lst[0] == lst[-1] and lst[1] == lst[-2]:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())

num = 0
for i in range(1,N+1):
    lst = list(str(i))
    s = sum(list(map(int,lst))
    if A <= s <= B:
        num += i
print(num)

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

num = 0
for i in range(1,N+1):
    lst = list(str(i))
    s = sum(list(map(int,lst)))
    if A <= s <= B:
        num += i
print(num)
Buggy python submission (verdict: Runtime Error):
ans = "AKIHABARA"


if len(s) >= 9 and s != "AKIHABARA":
    print("NO")
else:
    for i in range(2**(9-len(s)+2)):
        lst = [""]*50
        for j in range(9-len(s)+2):
            if i&(1<<j):
                lst[j] = "A"
        #print(lst)
        
        result = ""               
        for k1,k2 in zip(lst,s+[""]):
            result += k1+k2
        #print(result)
        if result == "AKIHABARA":
            print("YES")
            exit()
        else:
            continue
    else:
        print("NO")

Fixed submission:
s = list(input())

if len(s) >= 9 and "".join(s) != "AKIHABARA":
    print("NO")
elif "".join(s) == "AKIHABARA":
    print("YES")
else:
    for i in range(2**(len(s)+1)):
        lst = [""]*50
        for j in range(len(s)+1):
            if i&(1<<j):
                lst[j] = "A"
        #print(lst)
        
        result = ""               
        for k1,k2 in zip(lst,s+["",""]):
            result += k1+k2
        #print(result)
        if result == "AKIHABARA":
            print("YES")
            exit()
        else:
            continue
    else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def lucas(x):
    if x == 0:
        return 2
    elif x == 1:
        return 1
    else:
        return lucas(x-1) + lucas(x-2)

print(lucas(n))

Fixed submission:
n = int(input())

def luc(x):
    x1 = 2
    x2 = 1
    if x == 1:
        return x1
    elif x == 2:
        return x2
    else:
        for i in range(x-2):
            x1,x2 = x2, x1 + x2
        return x2

print(luc(n+1))

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

def lucas(x):
    if x == 0:
        return 2
    elif x == 1:
        return 1
    else:
        return lucas(x-1) + lucas(x-2)

print(lucas(n))

Fixed submission:
n = int(input())

def luc(x):
    x1 = 2
    x2 = 1
    if x == 1:
        return x1
    elif x == 2:
        return x2
    else:
        for i in range(x-2):
            x1,x2 = x2, x1 + x2
        return x2

print(luc(n+1))
Buggy python submission (verdict: Runtime Error):
S = input()
n = len(S)
#与えられた文字列をリスト化し分割
lst = list(n)

array = []
for i in range(n):
    array.append(lst[2*i])

new_lst = "".join(array)
print(new_lst)

Fixed submission:
s = list(input())
array = []
for i in range(len(s)):
    if i % 2 == 0:
        array.append(s[i])
        #print(array)

print("".join(array),end="")
Buggy python submission (verdict: Runtime Error):
print(a)
n = int(input())
t = list(map(int,input().split()))
m = int(input())

for i in range(m):
    lst = list(t)
    p,x = map(int,input().split())
    lst[p-1] = x
    print(sum(lst))

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

for i in range(m):
    lst = list(t)
    p,x = map(int,input().split())
    lst[p-1] = x
    print(sum(lst))

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

for i in range(m):
    lst = list(t)
    p,x = map(int,input().split())
    lst[p-1] = x
    print(sum(lst))
    print(lst)

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

for i in range(m):
    lst = list(t)
    p,x = map(int,input().split())
    lst[p-1] = x
    print(sum(lst))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
lst = list(range(a,b+1))

if a > 0 and b > 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
elif a < 0 and b < 0:
    if ((b-a)-1) % 2  != 0:
        print("Negative")
    else:
        print("Positive")

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

if a > 0 and b > 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
elif a < 0 and b < 0:
    if ((b-a)-1) % 2  != 0:
        print("Negative")
    else:
        print("Positive")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0

for i in range(1,N):
    for j in range(1,int(N/i)+1):
        if N - i*j > 0:
            count += 1

print(count)

Fixed submission:
N = int(input())
count = 0

for i in range(1,N):
    count += int((N-1)/i)

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = input().split()
A = [int(s) for s in A]
scores = []

for i in range(N-K+1):
    score = 1
    for j in range(i, K+i):
        score *= A[j]
    scores.append(score)

for i in range(len(scores)-1):
    if scores[i] < scores[i+1]:
        print('Yes')
    else:
        print('No')

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
scores = []

for i in range(N-K):
    if A[i] < A[K+i]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
#forループが多重ループになっているせいで時間がかかりすぎる
'''
import itertools
import numpy as np

K = int(input())
result = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            for a, b, c in itertools.combinations([i, j, k], 3):
                result += np.gcd.reduce([a, b, c])
print(result)
'''

import numpy as np

K = int(input())
result = 0

for i in range(1, K+1):
    result += i

for i in range(1, K):
    for j in range(i+1, K+1):
        result += np.gcd(i,j) * 6

if K >= 3:
    for i in range(1, K-1):
        for j in range(i+1, K):
            for k in range(j+1, K+1):
                result += np.gcd.reduce([i,j,k]) * 6

print(result)

Fixed submission:
import math
from math import gcd

K = int(input())
result = 0

for i in range(1, K+1):
    result += i

for i in range(1, K):
    for j in range(i+1, K+1):
        result += gcd(i,j) * 6

if K >= 3:
    for i in range(1, K-1):
        for j in range(i+1, K):
            for k in range(j+1, K+1):
                result += gcd(gcd(i,j),k) * 6

print(result)

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

K = int(input())
result = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            for a, b, c in itertools.combinations([i, j, k], 3):
                result += np.gcd.reduce([a, b, c])
print(result)

Fixed submission:
import math
from math import gcd

K = int(input())
result = 0

for i in range(1, K+1):
    result += i

for i in range(1, K):
    for j in range(i+1, K+1):
        result += gcd(i,j) * 6

if K >= 3:
    for i in range(1, K-1):
        for j in range(i+1, K):
            for k in range(j+1, K+1):
                result += gcd(gcd(i,j),k) * 6

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
number = []

for i in range(N):
    number.append(S.count('W', 0, i) + S.count('E', i, N))

print(min(number))

Fixed submission:
N = int(input())
S = input()

eastNumber = S.count('E')
westNumber = 0
minimum = N

for i in range(N):
    if S[i] == 'E':
        eastNumber -= 1
        number = eastNumber + westNumber
        if minimum > number:
            minimum = number
    else:
        number = eastNumber + westNumber
        if minimum > number:
            minimum = number
        westNumber += 1

print(minimum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for i in range(N)]
count = [0]*N
i = 0

while(True):
    i = a[i]-1
    count[i]+=1
    if i == 1:
        print(sum(count))
        break
    if max(count)==2:
        print(-1)
        break

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
count = [0]*N
i = 0

while(True):
    count[i]+=1
    i = a[i]-1
    if i == 1:
        print(sum(count))
        break
    if count[i] == 1:
        print(-1)
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1
for i in range(1,N+1):
    power *= i
print(power%1000000007)

Fixed submission:
N = int(input())
power = 1
for i in range(1,N+1):
    power = power * i % (10**9+7)
print(power)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
count_a = 0
count_b = 0
for i in range(a):
    if i%x == 0:
        count_a+=1

for i in range(b+1):
    if i%x == 0:
        count_b+=1

print(count_b-count_a)

Fixed submission:
a, b, x = map(int, input().split())
print(b//x - (a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n, k = map(int, input().split(" "))
aL = list(map(int, input().split(" ")))

ans = 0
sm = 1
for i in range(k):
    sm *= aL[i]

prev = sm

for i in range(1, n - k + 1):
    j = i + k - 1
    sm = sm // aL[i - 1]
    sm = sm * aL[j]
    if prev < sm:
        print("Yes")
    else:
        print("No")
    prev = sm

Fixed submission:
import math

n, k = map(int, input().split(" "))
aL = list(map(int, input().split(" ")))

ans = 0

for i in range(1, n - k + 1):
    j = i + k - 1
    if aL[i - 1] < aL[j]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
aL = list(map(int, input().split(" ")))
q = int(input())
bcL = [list(map(int, input().split(" "))) for _ in range(q)]

sums = [0 for i in range(10**5 + 1)]

for a in aL:
    sums[a] += 1

for b, c in bcL:
    sums[c] += sums[b]
    sums[b] = 0
    _sum = 0
    for i, s in enumerate(sums):
        _sum += i * s
    print(_sum)

Fixed submission:
import math

n = int(input())
aL = list(map(int, input().split(" ")))
q = int(input())
bcL = [list(map(int, input().split(" "))) for _ in range(q)]

sums = [0 for i in range(10**5 + 1)]

for a in aL:
    sums[a] += 1

_sum = 0
for i, a in enumerate(sums):
    _sum += i * a

for b, c in bcL:
    _sum += (c - b) * sums[b]

    sums[c] += sums[b]
    sums[b] = 0
    print(_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
aL = list(map(int, input().split(" ")))
q = int(input())
bcL = [list(map(int, input().split(" "))) for _ in range(q)]

d = {}
for i in range(n):
    if aL[i] in d:
        d[aL[i]] += 1
    else:
        d[aL[i]] = 1

for b, c in bcL:
    if b in d.keys():
        if c in d:
            d[c] += d[b]
        else:
            d[c] = d[b]
        del d[b]

    _sum = 0
    for k, v in d.items():
        _sum += k * v
    print(_sum)

Fixed submission:
import math

n = int(input())
aL = list(map(int, input().split(" ")))
q = int(input())
bcL = [list(map(int, input().split(" "))) for _ in range(q)]

sums = [0 for i in range(10**5 + 1)]

for a in aL:
    sums[a] += 1

_sum = 0
for i, a in enumerate(sums):
    _sum += i * a

for b, c in bcL:
    _sum += (c - b) * sums[b]

    sums[c] += sums[b]
    sums[b] = 0
    print(_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
aL = list(map(int, input().split(" ")))
q = int(input())
bcL = [list(map(int, input().split(" "))) for _ in range(q)]

d = {}
for i in range(n):
    if aL[i] in d:
        d[aL[i]] += 1
    else:
        d[aL[i]] = 1

for b, c in bcL:
    if b in d.keys():
        if c in d:
            d[c] += d[b]
        else:
            d[c] = d[b]
        del d[b]

    _sum = 0
    for k, v in d.items():
        _sum += k * v
    print(_sum)

Fixed submission:
import math

n = int(input())
aL = list(map(int, input().split(" ")))
q = int(input())
bcL = [list(map(int, input().split(" "))) for _ in range(q)]

sums = [0 for i in range(10**5 + 1)]

for a in aL:
    sums[a] += 1

_sum = 0
for i, a in enumerate(sums):
    _sum += i * a

for b, c in bcL:
    _sum += (c - b) * sums[b]

    sums[c] += sums[b]
    sums[b] = 0
    print(_sum)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
aL = list(map(int, input().split(" ")))

ans = 0
for s in range(n):
    for e in range(s + 1, n):
        if e - s == aL[s] + aL[e]:
            ans += 1

print(ans)

Fixed submission:
import math

n = int(input())
aL = list(map(int, input().split(" ")))

d1 = {}
d2 = {}
for i in range(n):
    d1i = i - aL[i]
    d2i = i + aL[i]

    if d1i in d1:
        d1[d1i] += 1
    else:
        d1[d1i] = 1

    if d2i in d2:
        d2[d2i] += 1
    else:
        d2[d2i] = 1

ans = 0
for k, v in d2.items():
    if k in d1:
        ans += v * d1[k]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
aL = list(map(int, input().split(" ")))

ans = 0
for i in range(n):
    for j in range(i, n):
        if j - i == aL[i] + aL[j]:
            ans += 1

print(ans)


Fixed submission:
import math

n = int(input())
aL = list(map(int, input().split(" ")))

d1 = {}
d2 = {}
for i in range(n):
    d1i = i - aL[i]
    d2i = i + aL[i]

    if d1i in d1:
        d1[d1i] += 1
    else:
        d1[d1i] = 1

    if d2i in d2:
        d2[d2i] += 1
    else:
        d2[d2i] = 1

ans = 0
for k, v in d2.items():
    if k in d1:
        ans += v * d1[k]

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import itertools

n, m, q = map(int, input().split(" "))
aL = []
_max = 0

for i in range(q):
    aL.append(list(map(int, input().split(" "))))

li = []


def dfs(i, _n, p):
    if i == n:
        li.append(list(map(int, list(str(_n)))))
        return
    for j in range(p, m + 1):
        dfs(i + 1, _n * 10 + j, j)


if m != 1:
    for i in range(1, m + 1):
        dfs(1, i, i)
else:
    li = [[i] for i in range(1, n + 1)]

for t in li:
    if t[0] == 0:
        continue
    _sum = 0
    for a in aL:
        if t[a[1] - 1] - t[a[0] - 1] == a[2]:
            _sum += a[3]
    _max = max(_max, _sum)

print(_max)

Fixed submission:
import math
import itertools

n, m, q = map(int, input().split(" "))
aL = []
_max = 0

for i in range(q):
    aL.append(list(map(int, input().split(" "))))

zLi = itertools.combinations_with_replacement(list(range(m + 1)), n)
for t in zLi:
    if t[0] == 0:
        continue
    _sum = 0
    for a in aL:
        if t[a[1] - 1] - t[a[0] - 1] == a[2]:
            _sum += a[3]
    _max = max(_max, _sum)

print(_max)

Buggy python submission (verdict: Runtime Error):
import math
import itertools

n, m, q = map(int, input().split(" "))
aL = []
_max = 0

for i in range(q):
    aL.append(list(map(int, input().split(" "))))

li = []


def dfs(i, _n, p):
    if i == n:
        li.append(list(map(int, list(str(_n)))))
        return
    for j in range(p, m + 1):
        dfs(i + 1, _n * 10 + j, j)


if m != 1:
    for i in range(1, m + 1):
        dfs(1, i, i)
else:
    li = [[i] * m for i in range(1, n + 1)]

for t in li:
    if t[0] == 0:
        continue
    _sum = 0
    for a in aL:
        if t[a[1] - 1] - t[a[0] - 1] == a[2]:
            _sum += a[3]
    _max = max(_max, _sum)

print(_max)

Fixed submission:
import math
import itertools

n, m, q = map(int, input().split(" "))
aL = []
_max = 0

for i in range(q):
    aL.append(list(map(int, input().split(" "))))

zLi = itertools.combinations_with_replacement(list(range(m + 1)), n)
for t in zLi:
    if t[0] == 0:
        continue
    _sum = 0
    for a in aL:
        if t[a[1] - 1] - t[a[0] - 1] == a[2]:
            _sum += a[3]
    _max = max(_max, _sum)

print(_max)
Buggy python submission (verdict: Time Limit Exceeded):
import math

a, b, n = map(int, input().split(" "))

_max = 0
for i in range(n + 1):
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    if _max > 0 and _max > val: break
    _max = max(_max, val)

print(_max)

Fixed submission:
import math

a, b, n = map(int, input().split(" "))

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math

a, b, n = map(int, input().split(" "))

_max = 0
for i in range(n + 1):
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    if _max > 0 and val == 0: break
    _max = max(_max, val)

print(_max)

Fixed submission:
import math

a, b, n = map(int, input().split(" "))

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math

a, b, n = map(int, input().split(" "))

_max = 0
i = 0
while i <= n:
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    _max = max(_max, val)
    i += 1

print(_max)

Fixed submission:
import math

a, b, n = map(int, input().split(" "))

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math

a, b, n = map(int, input().split(" "))

_max = 0
i = 0
while i <= n:
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    _max = max(_max, val)
    i += 1

print(_max)

Fixed submission:
import math

a, b, n = map(int, input().split(" "))

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math

a, b, n = map(int, input().split(" "))

_max = 0
for i in range(n + 1):
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    _max = max(_max, val)

print(_max)

Fixed submission:
import math

a, b, n = map(int, input().split(" "))

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))
Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
mp = [[-1] * k for _ in range(k)]

c1, c2 = 0, 0


def gcd(a, b):
    global c1, c2
    if b == 0:
        return a
    if mp[a - 1][b - 1] == -1:
        mp[a - 1][b - 1] = gcd(b, a % b)
        c1 += 1
        return mp[a - 1][b - 1]
    c2 += 1
    return mp[a - 1][b - 1]


ans = 0

for i in range(1, k + 1):
    for j in range(1, k + 1):
        for k in range(1, k + 1):
            ans += gcd(k, gcd(j, i))

print(ans)

Fixed submission:
import math

k = int(input())
mp = [[-1] * k for _ in range(k)]

def gcd(a, b):
    if b == 0:
        return a
    if mp[a - 1][b - 1] == -1:
        mp[a - 1][b - 1] = gcd(b, a % b)
        return mp[a - 1][b - 1]
    return mp[a - 1][b - 1]


ans = 0

for i in range(1, k + 1):
    for j in range(1, k + 1):
        for k in range(1, k + 1):
            ans += gcd(k, gcd(j, i))

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

arr = []
for i in range(10000):
    si = str(i + 1)
    for i2 in range(len(si) - 1):
        if abs(int(si[i2]) - int(si[i2 + 1])) >= 2:
            break
    else:
        arr.append(si)

print(arr[n - 1])


Fixed submission:
import math

k = int(input())

l = [1, 2, 3, 4, 5, 6, 7, 8, 9]

c = 0
while k > len(l):
    f = l[c] - (l[c] // 10 * 10)

    if f != 0:
        l.append(l[c] * 10 + f - 1)

    l.append(l[c] * 10 + f)

    if f != 9:
        l.append(l[c] * 10 + f + 1)

    c += 1

print(l[k - 1])
Buggy python submission (verdict: Time Limit Exceeded):
import math


def kumiawase(n):
    if n == 0 or n == 1:
        return 0
    return math.floor(math.factorial(n) / math.factorial(n - 2) / 2)


n = int(input())
aL = list(map(int, input().split(" ")))

d = {}

for a in aL:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

d2 = {}
d3 = {}

for dk, di in d.items():
    d2[dk] = kumiawase(di)
    d3[dk] = kumiawase(di - 1)

for a in aL:
    sm = sum(d2.values())
    print(sm - d2[a] + d3[a])


Fixed submission:
import math
import collections


def kumiawase(n):
    if n == 0 or n == 1:
        return 0
    return (n**2 - n) // 2


n = int(input())
aL = list(map(int, input().split(" ")))

d = collections.Counter(aL)

s = 0
for i in d.values():
    s += kumiawase(i)

for a in aL:
    print(s - d[a] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import math


def kumiawase(n):
    if n == 0 or n == 1:
        return 0
    return math.floor(math.factorial(n) / math.factorial(n - 2) / 2)


n = int(input())
aL = list(map(int, input().split(" ")))

d = {}

for ai in aL:
    if ai in d:
        d[ai] += 1
    else:
        d[ai] = 1

for ai in aL:
    sm = 0
    for dk, di in d.items():
        if dk == ai:
            sm += kumiawase(di - 1)
        else:
            sm += kumiawase(di)
    print(sm)

Fixed submission:
import math
import collections


def kumiawase(n):
    if n == 0 or n == 1:
        return 0
    return (n**2 - n) // 2


n = int(input())
aL = list(map(int, input().split(" ")))

d = collections.Counter(aL)

s = 0
for i in d.values():
    s += kumiawase(i)

for a in aL:
    print(s - d[a] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import math


def kumiawase(n):
    if n == 0 or n == 1:
        return 0
    return math.floor(math.factorial(n) / math.factorial(n - 2) / 2)


n = int(input())
aL = list(map(int, input().split(" ")))

d = {}

for ai in aL:
    if ai in d:
        d[ai] += 1
    else:
        d[ai] = 1

for ai in aL:
    sm = 0
    for dk, di in d.items():
        if dk == ai:
            sm += kumiawase(di - 1)
        else:
            sm += kumiawase(di)
    print(sm)

Fixed submission:
import math
import collections


def kumiawase(n):
    if n == 0 or n == 1:
        return 0
    return (n**2 - n) // 2


n = int(input())
aL = list(map(int, input().split(" ")))

d = collections.Counter(aL)

s = 0
for i in d.values():
    s += kumiawase(i)

for a in aL:
    print(s - d[a] + 1)
Buggy python submission (verdict: Runtime Error):
import math
from decimal import *

a, b, c = list(map(int, input().split(" ")))

print("Yes" Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt if else "No")


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

if c - a - b > 0 and 4 * a * b < (c - a - b)**2:
    print("Yes")
else:
    print("No")

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

a, b, c = list(map(int, input().split(" ")))

print("Yes" if (sympy.sqrt(a) + sympy.sqrt(b)) < sympy.sqrt(c) else "No")


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

if c - a - b > 0 and 4 * a * b < (c - a - b)**2:
    print("Yes")
else:
    print("No")

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

a, b, c = list(map(Decimal, input().split(" ")))

print("Yes" if (sympy.sqrt(a) + sympy.sqrt(b)) < sympy.sqrt(c) else "No")


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

if c - a - b > 0 and 4 * a * b < (c - a - b)**2:
    print("Yes")
else:
    print("No")