Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N=int(input())
print(sum(range(1,N+1))-N)

### FIXED CODE ###

N=int(input())
print(N*(N+1)//2-N)
### BUGGY CODE ###

import numpy as np
import collections
N = int(input())
D = [int(i) for i in input().split()]

C = collections.Counter(D)
if C.most_common()[0][1] >= 3:
    print(0)
    exit()


ans = 0
for i in range(2 ** N):
    D0 = list((0, 24))
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            D0.append(24-D[j])
        else:
            D0.append(D[j])

    D0 = np.sort(np.array(D0))
    c = np.amin(np.diff(D0))
    ans = max(ans, c)

print(ans)


### FIXED CODE ###

import collections
import copy
N = int(input())
D = [int(i) for i in input().split()]

C = collections.Counter(D)
if C.most_common()[0][1] >= 3:
    print(0)
    exit()

D1 = [0, 24]
m = []
for k, v in C.items():
    if v == 2:
        D1.append(k)
        D1.append(24-k)
    elif v == 1:
        m.append(k)

ans = 0
for i in range(2 ** len(m)):
    D0 = copy.deepcopy(D1)
    for j in range(len(m)):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            D0.append(24-m[j])
        else:
            D0.append(m[j])

    # print(D0)

    D0 = sorted(D0)
    c = 24
    for i in range(N+1):
        c = min(c, D0[i+1]-D0[i])
    ans = max(ans, c)

print(ans)
### BUGGY CODE ###

N=int(input())
L=list(map(int,input().split()))

s=0
for i in range(N):
    for j in range(N-1-i):
        for k in range(N-2-i-j):
            if ((L[i]<L[i+j+1]+L[i+j+k+2]) and (L[i+j+1]<L[i]+L[i+j+k+2])) and(L[i+j+k+2]<L[i]+L[i+j+1]):
                s+=1
print(s)


### FIXED CODE ###

from heapq import *
from bisect import *

N=int(input())
L=list(map(int,input().split()))
h=[]
for i in range(N):
    heappush(h,L[i])
h2=[]
for i in range(N):
    heappush(h2,heappop(h))
s=0
for i in range(N):
    for j in range(N-1-i):
        bmc=h2[j+i+1]-h2[i]
        bpc=h2[j+i+1]+h2[i]
        a=-bisect_right(h2, bmc)+bisect_left(h2, bpc)-1
        if a>0:
            s+=a
            if bmc < h2[i]:
                s-=1
print(s//3)
### BUGGY CODE ###

import numpy
N,Q = (int(x) for x in input().split())

stop_arr = [(0,0,0) for _ in range(N)]
for i in range(N):
    S,T,X = (int(x) for x in input().split())
    stop_arr[i] = (S,T,X)
Q_arr = [0 for _ in range(Q)]
for i in range(Q):
    Q_arr[i] = int(input())

stop_arr_ind = list(range(N))
stop_arr_ind.sort(key=lambda x:stop_arr[x][2], reverse=True)
# stop_arr.sort(key=lambda x:x[2], reverse=True)
ans_arr = numpy.array([-1]*Q)

for i in stop_arr_ind:
    s,t,x = stop_arr[i]
    q_start = numpy.searchsorted(Q_arr, s-x)
    q_stop = numpy.searchsorted(Q_arr, t-x)
    ans_arr[q_start:q_stop] = x

ans = ""
for a in ans_arr:
    ans += str(a)+"\n"

print(ans[:-1])


### FIXED CODE ###

import bisect

N,Q = (int(x) for x in input().split())

stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]

stop_arr_ind = list(range(N))
stop_arr_ind.sort(key=lambda x:stop_arr[x][2])
# stop_arr.sort(key=lambda x:x[2], reverse=True)
ans_arr = [-1]*Q
skip_arr = [-1]*(Q+1)

def update_skip(skip_arr, x):
    if skip_arr[x] == -1:
        return x
    x_dest = update_skip(skip_arr, skip_arr[x])
    skip_arr[x] = x_dest
    return x_dest

for i in stop_arr_ind:
    s,t,x = stop_arr[i]
    q_start = bisect.bisect_left(Q_arr, s-x)
    q_stop = bisect.bisect_left(Q_arr, t-x)
    l = q_start
    while l < q_stop:
        if skip_arr[l] == -1:
            skip_arr[l] = q_stop
            ans_arr[l] = x
            l += 1
        else:
            l = update_skip(skip_arr, l)

print(*ans_arr, sep="\n")
### BUGGY CODE ###

from itertools import product, combinations

# 入力
N = int(input())
D = list(map(int, input().split()))

# N >=23 ならば鳩の巣原理より、max(s)=0である
# N <=22 ならば全探索で解を求める
ans = (
    0 if N >= 24 else
    max(
        int(len(set(t)) == N + 1) if N >= 12 else
        min(
            min(abs(a - b), 24 - abs(a - b))
            for a, b in combinations(t, 2)
        )
        for t in (
            product(
                (0,),
                *(
                    (d,) if d == 0 else
                    (d, 24 - d)
                    for d in D
                )
            )
        )
    )
)

# 出力
print(ans)


### FIXED CODE ###

from itertools import product, combinations

# 入力
N = int(input())
D = list(map(int, input().split()))

# N >= 24 ならば鳩の巣原理より、max(s)=0である
# N <= 23 ならば全探索で解を求める
ans = (
    0 if N >= 24 else
    int(
        (0 not in D) and
        (D.count(12) <= 1) and
        all(
            D.count(i) <= 2
            for i in range(1, 12)
        )
    ) if 12 <= N < 24 else
    max(
        min(
            min(abs(a - b), 24 - abs(a - b))
            for a, b in combinations(t, 2)
        )
        for t in (
            product(
                (0,),
                *(
                    (d, 24 - d)
                    for d in D
                )
            )
        )
    )
)

# 出力
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import numpy as np

N,M,L,R = map(int,input().split())

MOD = 10 ** 9 + 7

X=1000
fact = np.arange(X*X,dtype=np.int64).reshape(X,X)
fact[0,0] = 1
for n in range(1,X):
    fact[:,n] *= fact[:,n-1]
    fact[:,n] %= MOD
for n in range(1,X):
    fact[n] *= fact[n-1,-1]
    fact[n] %= MOD
fact = fact.ravel()

fact_inv = np.arange(1,X*X+1,dtype=np.int64)[::-1].reshape(X,X)
fact_inv[0,0] = pow(int(fact[-1]),MOD-2,MOD)
for n in range(1,X):
    fact_inv[:,n] *= fact_inv[:,n-1]
    fact_inv[:,n] %= MOD
for n in range(1,X):
    fact_inv[n] *= fact_inv[n-1,-1]
    fact_inv[n] %= MOD
fact_inv = fact_inv.ravel()[::-1]

U = N - M
comb = fact[U] * fact_inv[:U+1] % MOD * fact_inv[U::-1] % MOD
comb[1::2] *= (-1)

F = np.zeros(N+M+1,dtype=np.int64)
F[M:N+1] = comb

P = np.zeros(R+1,dtype=np.int64)
for i,x in enumerate(F[1:],1):
    P[::i] += x

P[:M-1:-1] -= P[-M-1::-1]
P %= MOD

# (1-x)^{N+1}で割る
Q = fact[N:N+R+1] * fact_inv[:R+1] % MOD * fact_inv[N] % MOD

def f(R):
    total = fact[R+N] * fact_inv[R] % MOD * fact_inv[N] % MOD
    x = (Q[R::-1] * P[:R+1] % MOD).sum() % MOD
    coef = fact[N] * fact_inv[M] % MOD * fact_inv[N-M] % MOD
    return (total - x*coef)%MOD

answer = (f(R) - f(L-1))%MOD
print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

N,M,L,R = map(int,input().split())

MOD = 10 ** 9 + 7

U = 6*10**5 + 100
fact = [1] * (U+1)
for n in range(1,U+1):
    fact[n] = fact[n-1]*n%MOD
fact_inv = [1] * (U+1)
fact_inv[U] = pow(fact[U],MOD-2,MOD)
for n in range(U,0,-1):
    fact_inv[n-1] = fact_inv[n] * n % MOD

fact = np.array(fact,dtype=np.int64)
fact_inv = np.array(fact_inv,dtype=np.int64)


U = N - M
comb = fact[U] * fact_inv[:U+1] % MOD * fact_inv[U::-1] % MOD
comb[1::2] *= (-1)

P = np.zeros(R+1,dtype=np.int64)
for i,x in enumerate(comb,M):
    P[::i] += x


P[M:] -= P.copy()[:-M]
P %= MOD

# (1-x)^{N+1}で割る
Q = fact[N:N+R+1] * fact_inv[:R+1] % MOD * fact_inv[N] % MOD

def f(R):
    total = fact[R+N] * fact_inv[R] % MOD * fact_inv[N] % MOD
    x = (Q[R::-1] * P[:R+1] % MOD).sum() % MOD
    coef = fact[N] * fact_inv[M] % MOD * fact_inv[N-M] % MOD
    return (total - x*coef)%MOD

answer = (f(R) - f(L-1))%MOD
print(answer)
### BUGGY CODE ###

s = input()
q = int(input())

query_list = [input().split() for _ in range(q)]

for query in query_list:
    if query[0] == "1":
        s = s[::-1]
    elif query[0] == "2":
        if query[1] == "1":
            s = query[2] + s
        elif query[1] == "2":
            s = s + query[2]

print(s)

### FIXED CODE ###

from collections import deque
s = input()
n = int(input())
q_list = [input().split() for _ in range(n)]
d = deque(list(s))
r_flag = False
for q in q_list:
    if q[0] == "1":
        r_flag = not r_flag
    elif q[0] == "2":
        if q[1] == "1":
            if r_flag:
                d.append(q[2])
            else:
                d.appendleft(q[2])
        elif q[1] == "2":
            if r_flag:
                d.appendleft(q[2])
            else:
                d.append(q[2])
if r_flag:
    d.reverse()
print("".join(d))
### BUGGY CODE ###

import sys
N = int(input())

for i in range(N):
	t, x, y = map(int, input().split(" "))
	if x > 0 and t >= x:
		t = t - x
		x = 0
		for j in range(t):
			if y >= 0:
				y -=1               
			else:
				y +=1
	elif x < 0 and t >= x * (-1):
		t = t -(-1 * x)
		x = 0      
		for j in range(t):
			if y >= 0:
				y -=1               
			else:
				y +=1
	else:
		for j in range(t):
			if y >= 0:
				y -=1               
			else:
				y +=1
	if x != 0 or y !=0:
		print("No")
		sys.exit()
print("Yes")

### FIXED CODE ###

import sys
N = int(input())

for i in range(N):
	t, x, y = map(int, input().split(" "))
	t = t - x - y
	if t % 2 != 0 or t < 0:
		print("No")
		sys.exit()

print("Yes")
### BUGGY CODE ###

import itertools 
n = int(input())
l = list(map(int, input().split()))
l_group = list(itertools.combinations(l,3))
count = 0
for i in range(len(l_group)):
        if l_group[i][0]<l_group[i][1]+l_group[i][2] and l_group[i][1]<l_group[i][0]+l_group[i][2] and l_group[i][2]<l_group[i][0]+l_group[i][1]:
            count += 1
print(count)


### FIXED CODE ###

import bisect
n = int(input())
l = sorted(([int(x) for x in input().split()]))
count = 0
for i in range(n-1,-1,-1):
    for j in range(i-1,-1,-1):
        k = bisect.bisect_left(l,l[i]+l[j])
        count += k-(i+1)
print(count)
### BUGGY CODE ###

# E - Two Currencies

import heapq

n, m, s = map(int, input().split())
adj = {u: [] for u in range(1, n+1)}
for i in range(m):
    u, v, a, b = map(int, input().split())
    adj[u].append((v, a, b)) # to, 料金, 時間
    adj[v].append((u, a, b)) # to, 料金, 時間
exch = {}
for u in range(1, n+1):
    c, d = map(int, input().split())
    exch[u] = (c, d) # レート, 時間

max_silver = 50 * m    # これだけ持ってたらどの都市へも行ける
s = min(s, max_silver) # max_silverまでで十分

# n <= 50, m <= 100, max_silver <= 5000

# (都市,所有銀貨)を頂点とする最短経路問題
# Dijkstra
dist = {(1, s): 0}  # 開始頂点のみ距離0
queue = [(0, 1, s)]

while len(queue) > 0:
    di, u, si = heapq.heappop(queue)
    # 無効なデータ
    if (u, si) in dist and di > dist[(u, si)]:
        continue
    for v, a, b in adj[u]:
        if si < a:
            continue
        xsi = si - a
        if (v, xsi) not in dist or \
            dist[(v, xsi)] > di + b:
            dist[(v, xsi)] = di + b
            heapq.heappush(queue, (di + b, v, xsi))
    c, d = exch[u]
    xsi = min(si + c, max_silver)
    if (u, xsi) not in dist or \
        dist[(u, xsi)] > di + d:
        dist[(u, xsi)] = di + d
        heapq.heappush(queue, (di + d, u, xsi))

for u in range(2, n+1):
    x = min(dist[(u, si)] for si in range(0, max_silver+1) if (u, si) in dist)
    print(x)


### FIXED CODE ###

# E - Two Currencies

import heapq

n, m, s = map(int, input().split())
adj = {u: [] for u in range(1, n+1)}
max_silver = 0
for i in range(m):
    u, v, a, b = map(int, input().split())
    adj[u].append((v, a, b)) # to, 料金, 時間
    adj[v].append((u, a, b)) # to, 料金, 時間
    max_silver += a # 全路線の料金の総和 (これ以上は不要)
exch = {}
for u in range(1, n+1):
    c, d = map(int, input().split())
    exch[u] = (c, d) # レート, 時間

s = min(s, max_silver) # max_silverまでで十分

# n <= 50, m <= 100, max_silver <= 5000

# (都市,所有銀貨)を頂点とする最短経路問題
# Dijkstra
dist = {(1, s): 0}  # 開始頂点のみ距離0
queue = [(0, 1, s)]
dmin = {1: 0} # dmin[u] = min(dist[(u, si)] for si)
nfin = 1      # 距離が決まった都市数

while len(queue) > 0:
    di, u, si = heapq.heappop(queue)
    # 用済みのデータ
    if (u, si) in dist and di > dist[(u, si)]:
        continue
    # 都市uの距離を保存
    if u not in dmin:
        dmin[u] = di
        nfin += 1
        if nfin >= n:  # 全都市の距離が決まった
            break
    # uから直接行ける各都市について
    for v, a, b in adj[u]:
        if si < a:  # 銀貨不足
            continue
        xsi = si - a
        if (v, xsi) not in dist or \
            dist[(v, xsi)] > di + b:
            dist[(v, xsi)] = di + b
            heapq.heappush(queue, (di + b, v, xsi))
    # 両替による遷移
    c, d = exch[u]
    xsi = min(si + c, max_silver)
    if (u, xsi) not in dist or \
        dist[(u, xsi)] > di + d:
        dist[(u, xsi)] = di + d
        heapq.heappush(queue, (di + d, u, xsi))

for u in range(2, n+1):
    print(dmin[u])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))

M = 10**6

import math

setwise = A[0]
for i in range(1,N):
    setwise = math.gcd(setwise,A[i])
    
PrimeFactorss = [[] for _ in range(M+1)]
for i in range(2, M+1):
    if len(PrimeFactorss[i]) == 0:
        for x in range(i, M+1, i):
            PrimeFactorss[x].append(i)
num_list = [0]*(M+1)

for i in range(N):
    num_list[A[i]] += 1

pairwise = [0]*N

for i in range(N):
    num_list[A[i]] -= 1
    for j in PrimeFactorss[A[i]]:
        for k in range(j,M+1,j):

            if num_list[k]==1:
                pairwise[i] += 1
                break
                
    num_list[A[i]] += 1
    
if sum(pairwise) == 0:
    print("pairwise coprime")
elif setwise == 1:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))

M = 10**6

import math

setwise = A[0]
for i in range(1,N):
    setwise = math.gcd(setwise,A[i])
    
PrimeFactorss = [[] for _ in range(M+1)]
for i in range(2, M+1):
    if len(PrimeFactorss[i]) == 0:
        for x in range(i, M+1, i):
            PrimeFactorss[x].append(i)
num_list = [0]*(M+1)

for i in range(N):
    num_list[A[i]] += 1

pairwise = [0]*(M+1)

n=M
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)

for i in primes:
    for j in range(i,M+1,i):
        if num_list[j]==1:
            pairwise[i] += 1
        
ans = 0    
for i in pairwise:
    if i>1:
        ans += 1
        break
    
if setwise == 1 and ans == 0:
    print("pairwise coprime")
elif setwise == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

import sys
MX = 10**5
def main():
    data = map(int, sys.stdin.buffer.read().split())
    N = next(data)
    IV, IW = [], []

    H = min(N + 1, 1 << 10)
    Hb = (H - 1).bit_length()
    dp = [[0] * (MX + 1) for _ in range(H)]
    i = 1
    for v, w in zip(data, data):
        IV.append(v)
        IW.append(w)
        if i < H:
            dpi = dp[i]
            dpip = dp[i >> 1]
            for j in range(w):
                dpi[j] = dpip[j]
            for j in range(w, MX + 1):
                dpi[j] = max(dpip[j], dpip[j - w] + v)
        i += 1
        if i > N:
            break

    Q = next(data)
    for v, L in zip(data, data):
        if v < H:
            print(dp[v][L])
            continue
        ans = []
        for i in range(1 << (v.bit_length() - Hb)):
            node = v
            value = weight = 0
            while node >= H:
                if i & 1:
                    value += IV[node - 1]
                    weight += IW[node - 1]
                    if weight > L:
                        break
                node >>= 1
                i >>= 1
            else:
                ans.append(value + dp[node][L - weight])
        print(max(ans))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
MX = 10**5
def main():
    data = map(int, sys.stdin.buffer.read().split())
    N = next(data)

    H = min(N + 1, 1 << 10)
    dp = [None] * H
    dp[0] = [0] * (MX + 1)
    IV, IW = [], []
    i = 1
    for v, w in zip(data, data):
        if i < H:
            dpi = dp[i >> 1][:]
            dp[i] = dpi
            for j in range(MX, w - 1, -1):
                dpi[j] = max(dpi[j], dpi[j - w] + v)
        else:
            IV.append(v)
            IW.append(w)
        i += 1
        if i > N:
            break

    Q = next(data)
    for v, L in zip(data, data):
        if v < H:
            print(dp[v][L])
            continue

        item_values = []
        item_weights = []
        while v >= H:
            item_values.append(IV[v - H])
            item_weights.append(IW[v - H])
            v >>= 1

        l = len(item_values)
        V = [0] * (1 << l)
        W = [0] * (1 << l)
        ans = dp[v][L]
        for i in range(1, 1 << l):
            msb = i & (-i)
            msbb = msb.bit_length() - 1
            wi = W[i - msb] + item_weights[msbb]
            W[i] = wi
            if wi <= L:
                vi = V[i - msb] + item_values[msbb]
                ans = max(ans, vi + dp[v][L - wi])
                V[i] = vi
        print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

def f_knapsack_for_all_segments(MOD=998244353):
    N, S = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    dp = [[[0] * 3 for s in range(S + 1)] for i in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for s in range(S + 1):
            # i 番の要素を採用しない場合
            dp[i + 1][s][0] += dp[i][s][0]
            dp[i + 1][s][1] += dp[i][s][0] + dp[i][s][1]
            dp[i + 1][s][2] += dp[i][s][0] + dp[i][s][1] + dp[i][s][2]
            for t in range(3):
                dp[i + 1][s][t] %= MOD

            # i 番の要素を採用できる場合
            if s + A[i] <= S:
                dp[i + 1][s + A[i]][1] += dp[i][s][0] + dp[i][s][1]
                dp[i + 1][s + A[i]][2] += dp[i][s][0] + dp[i][s][1]
                for t in range(1, 3):
                    dp[i + 1][s + A[i]][t] %= MOD
    return dp[N][S][2]

print(f_knapsack_for_all_segments())

### FIXED CODE ###

def f_knapsack_for_all_segments(MOD=998244353):
    # 参考: https://maspypy.com/atcoder-参加感想-2019-03-22abc-159
    import numpy as np
    N, S = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    ans = 0
    f = np.zeros(S + 1, np.int64)  # f[k]: 多項式の x**k の項の係数
    for a in A:
        # f で表される多項式に対して (f + 1)(1 + x**a) を新しい f とする
        f[0] += 1  # f + 1
        f[a:] += f[:-a].copy()  # 1 + x**a を掛ける
        f %= MOD
        # x**S の項の係数を解に加える
        ans += f[S]
        ans %= MOD
    return ans

print(f_knapsack_for_all_segments())
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i]<L[j]+L[k] and L[j]<L[k]+L[i] and L[k]<L[i]+L[j]:
                ans += 1
print(ans)


### FIXED CODE ###

def is_ok1(a,b,c):
    return L[b] < L[c] + L[a]
def is_ok2(a,b,c):
    return L[c] < L[a] + L[b]
def meguru_bisect(ng, ok, is_ok, a, b):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(a, b, mid):
            ok = mid
        else:
            ng = mid
    return ok
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for a in range(N):
    for b in range(a+1, N):
        ans += max(0, meguru_bisect(N, b, is_ok2, a, b)-meguru_bisect(b, N, is_ok1, a, b)+1)
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

# 0 0
# 1 0
# 2 1
# 3 3
# 4 6

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
A = list(map(int, input().split()))

data = collections.Counter(A)

for i in range(N):
    #print(data)
    ans = 0
    tmp = copy.copy(data)
    tmp[A[i]] = data[A[i]] - 1
    C = list(tmp.values())
    #print(C)
    for j in range(len(C)):
        if C[j] >= 2:
            ans += comb(C[j],2)
    print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]


N = int(input())
A = list(map(int, input().split()))

C = [0]*(2*10**5+1)

for i in A:
    C[i] += 1

ans = sum(i*(i-1)//2 for i in C)

for i in A:
    print(ans-C[i]+1)
### BUGGY CODE ###

# given an array of Heights, jump from 1 to N with at most K sized jump to N
# each jump incurs abs(H[j] - H[i]) cost
# minimize cost of jumps from 1 to N
#
def frog(H, k):
    K = [0] * (k + 1)
    n = len(H)
    for i in range(n):
        cost = 0
        if i > 0:
            maxjump = min(i, k)
            cost = min([abs(H[i] - H[i - j]) + K[len(K) - j] for j in range(1, maxjump + 1)])
        K.append(cost)
        K.pop(0)
    return cost

assert frog([40, 10, 20, 70, 80, 10, 20, 70, 80, 60], 4) == 40
assert frog([10, 10], 100) == 0
assert frog([10, 20, 10], 1) == 20

N, k = map(int, input().split())
H = list(map(int, input().split()))
ans = frog(H, k)
print(ans)


### FIXED CODE ###

# given an array of Heights, jump from 1 to N with at most K sized jump to N
# each jump incurs abs(H[j] - H[i]) cost
# minimize cost of jumps from 1 to N
#
def frog(H, k):
    if k > len(H):
        k = len(H)
    n = len(H)
    K = [0] * n
    inf = float("inf")
    for i in range(n):
        cost = 0
        if i > 0:
            maxjump = i if i < k else k # min(i, k)
            cost = inf
            hi = H[i]
            # jump source going backwards from i-1 (smallest 1 sized jump) to i - maxjumps
            for j in range(i - 1, i - maxjump - 1, -1):
                jcost = abs(hi - H[j]) + K[j]
                if jcost < cost:
                    cost = jcost
        K[i] = cost
    return cost

assert frog([40, 10, 20, 70, 80, 10, 20, 70, 80, 60], 4) == 40
assert frog([10, 10], 100) == 0
assert frog([10, 20, 10], 1) == 20

if __name__ == "__main__":
    import sys
    s = sys.stdin.read()
    N, k, *H = map(int, s.split())
    ans = frog(H, k)
    print(ans)
### BUGGY CODE ###

S = input()
K = int(input())
N = len(S)
A = set([s for s in S])
A = sorted(A)
C = set()
k = 0
while len(C)<K:
    for i in range(N):
        if S[i]==A[k]:
            for j in range(i,N):
                C.add(S[i:j+1])
    k+=1
C = sorted(C)
print(C[K-1])

### FIXED CODE ###

S = input()
K = int(input())
N = len(S)
C = set()
for i in range(N):
    for j in range(i,min(i+K,N)):
        C.add(S[i:j+1])
C = sorted(C)
print(C[K-1])
### BUGGY CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
MAX = 10**9
dp = [MAX]*N
dp[0] = 0
for i in range(0,N):
    for j in range(1,K+1):
        if i+j>=N:
            break
        tmp = dp[i] + abs(H[i+j]-H[i])
        dp[i+j] = min(dp[i+j], tmp)
print(dp[-1])

### FIXED CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
MAX = 10**9
dp = [MAX]*N
dp[0] = 0
for i in range(0,N):
    for j in range(1,K+1):
        if i+j>=N:
            break
        tmp = dp[i] + abs(H[i+j]-H[i])
        dp[i+j] = min(dp[i+j], tmp)
print(dp[-1])