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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in sayilar:
    count = numbers.count(i)
    counters[i] = count

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in sayilar:
    count = numbers.count(i)
    counters[i] = count

for i in sayilar:
    sonuc = 0
    for sayi in counters:
        count = counters[sayi]
        if i == sayi:
            count -= 1
        sonuc += count * (count - 1) / 2
    cevap_list[i] = int(sonuc)

for i in range(n):
    print(cevap_list[numbers[i]])

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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
numbers = list(map(int, input().split(' ')))

counters = {}
used_list = []
for i in numbers:
    if i in used_list:
        continue
    counters[i] = numbers.count(i)
    used_list.append(i)
cevap_list = {}

for i in range(n):
    sonuc = 0
    try:
        print(cevap_list[numbers[i]])
    except:
        for sayi in counters:
            count = counters[sayi]
            if numbers[i] == sayi:
                count -= 1
            sonuc += count*(count-1)/2
        cevap_list[numbers[i]] = int(sonuc)
        print(int(sonuc))


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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

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

counters = {}
used_list = []
for i in numbers:
    if i in used_list:
        continue
    counters[i] = numbers.count(i)
    used_list.append(i)
for i in range(n):
    sonuc = 0
    for sayi in counters:
        count = counters[sayi]
        if numbers[i] == sayi:
            count -= 1
        sonuc += count*(count-1)/2
    print(int(sonuc))

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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

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

counters = {}
for i in numbers:
    counters[i] = numbers.count(i)
for i in range(n):
    sonuc = 0
    for sayi in counters:
        count = counters[sayi]
        if numbers[i] == sayi:
            count -= 1
        sonuc += count*(count-1)/2
    print(int(sonuc))


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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
numbers = list(map(int, input().split(' ')))

for i in range(n):
    used_list = []
    sonuc = 0
    for j in range(n):
        if j == i:
            continue
        if numbers[j] not in used_list:
            counter = numbers.count(numbers[j])
            used_list.append(numbers[j])
        else:
            continue
        if numbers[j] == numbers[i]:
            counter -= 1
        # print("count", counter)
        sonuc += int(counter*(counter-1)/2)
    print(sonuc)

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

counters = {}
cevap_list = {}
sayilar = set(numbers)
for i in numbers:
    if i in counters:
        counters[i] += 1
    else:
        counters[i] = 1

sonuc = 0
for sayi in counters:
    count = counters[sayi]
    sonuc += int(count * (count - 1) / 2)


for i in range(n):
    print(sonuc-counters[numbers[i]]+1)