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

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)
list3 = copy.copy(list1)

kei1=0
kei2=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in range(n):
    list3 = copy.copy(list1)
    k = list3.pop(x)
    if k in list3:
        kei2 = list3.count(k)

    print(kei1-kei2)

Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))

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

n = int(input())
list1 = list(map(int,input().split()))
list2 = copy.copy(list1)
list3 = copy.copy(list1)

kei1=0
kei2=0

for j in range(n):
    l = list2.pop(0)
    if l in list2:
        kei1 += list2.count(l)

for x in range(n):
    list3 = copy.copy(list1)

    k = list3.pop(x)
    if k in list3:
        kei2 = list3.count(k)

    print(kei1-kei2)

Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))

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

n = int(input())
list1 = list(map(int,input().split()))
list2 = copy.copy(list1)
list3 = copy.copy(list1)

kei1=0
kei2=0

for j in range(n):
    l = list2.pop(0)
    if l in list2:
        kei1 += list2.count(l)

for x in range(n):
    list3 = copy.copy(list1)

    k = list3.pop(x)
    if k in list3:
        kei2 = list3.count(k)

    print(kei1-kei2)

Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))

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

n = int(input())
list1 = list(map(int,input().split()))
list2 = copy.copy(list1) 　　#全体の組み合わせ計算
list3 = copy.copy(list1)    #K番目の数字との組み合わせ計算

kei1=0
kei2=0

for x in range(n):
    l = list2.pop(0)
    if l in list2:
        kei1 += list2.count(l)

    k = list3.pop(x)
    if k in list3:
        kei2 += list3.count(k)

    print(kei1-kei2)

Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))

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

n = int(input())
list1 = list(map(int,input().split()))
list2 = copy.copy(list1)

for x in range(n):
    kei = 0
    list2 = copy.copy(list1)
    del list2[x]
    for m in range(n-1):
        l = list2.pop(0)
        if l in list2:
            kei += list2.count(l)

    print(kei,sep="\n")


Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))

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

n = int(input())
list1 = list(map(int,input().split()))
list2 = copy.copy(list1)

for x in range(n):
    kei = 0
    list2 = copy.copy(list1)
    del list2[x]
    for m in range(n-1):
        l = list2.pop(0)
        if l in list2:
            kei += list2.count(l)

    print(kei,sep="\n")


Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))