about summary refs log tree commit diff
path: root/codechef/teammate.py
blob: cc3846e1ce5502b830f016fb868b885a1beafb2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python3
from collections import defaultdict

for _ in range(int(input())):
    n = int(input())
    s = map(int, input().split())
    d = defaultdict(int)
    for i in s: d[i] += 1
    result = 0
    for value in s.values():
        if value % 2:
            pass
        else:
            result += value * (value-1) // 2