Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = [0] * (N+1)

for i in A:
    B[i] += 1
sum_original = sum(j*(j-1)//2 for j in B)
for k in range(N):
    print(sum_original - (B[A[k]]+1)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

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

for k in range(N):
    del A[k]
    ans = 0
    
    for i in range(1,N+1):
        n = A.count(i)
        nc2 = n * (n-1) / 2
        ans += nc2
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

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

for k in range(N):
    del A[k]
    ans = 0
    
    for i in range(1,N+1):
        n = A.count(i)
        nc2 = n * (n-1) / 2
        ans += nc2
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

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

for k in range(N):
    del A[k]
    ans = 0
    
    for i in range(1,N+1):
        n = sum(A[j] == i for j in range(N-1))
        nc2 = n * (n-1) / 2
        ans += nc2
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

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

for k in range(N):
         del A[k]
         ans = 0
         for i in range(1,N+1):
         	n = sum(A[j] == i for j in range(1,N))
         	nc2 = n * (n-1) / 2
         	ans += nc2
         
         print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

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

for k in range(1, N+1):
         A = A.remove(k)
         ans = 0
         for i in range(1,N+1):
         	n = sum(A[j] == i for j in range(1,N))
         	nc2 = n * (n-1) / 2
         	ans += nc2
         
         print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
N = list(range(1,N+1))
A = list(map(int, input().split())

for k in range(1, N+1):
         A = A.remove(A[k])
         ans = 0
         for i in range(1,N+1):
         	n = sum(A[j] == i for j in range(1,N))
         	nc2 = n * (n-1) / 2
         	ans += nc2
         
         print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)