From a0f399b092350c90a06707ba65e6877ccf70d1b2 Mon Sep 17 00:00:00 2001 From: Indra Adhikary <43936212+IndraAdhikary@users.noreply.github.com> Date: Sat, 2 Oct 2021 11:37:14 +0530 Subject: [PATCH] Create 1527c.py --- codeforces/C/1527c.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 codeforces/C/1527c.py diff --git a/codeforces/C/1527c.py b/codeforces/C/1527c.py new file mode 100644 index 0000000..d454d09 --- /dev/null +++ b/codeforces/C/1527c.py @@ -0,0 +1,10 @@ +from collections import defaultdict as dd +for _ in range(int(input())): + n = int(input()) + l = list(map(int,input().split())) + d = dd(int) + s=0 + for i in range(n): + s += d[l[i]]*(n-i) + d[l[i]]+=i+1 + print(s)