Harryxun/stf_run huggingface dataset:
import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

import numpy as np

x, y = na()
if y % 2 == 0 and y / x <= 4:
    print("Yes")
else:
    print("No")

### FIXED CODE ###


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

x, y = na()
for t in range(100):
    for k in range(100):
        if x == (t + k) and y == 2*t + 4*k:
            print("Yes")
            quit()
print("No")
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
ns=list(str(n))
if int("".join(ns[1:])) == "".join([str(9)]*(len(ns)-1)):
    print(int(ns[0])+9*(len(ns)-1))
else:
    print(int(ns[0])+9*(len(ns)-1)-1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
ns=list(str(n))
if len(ns)==1:
    print(n)
    exit()
#print(ns[1:])
if int("".join(ns[1:])) == int("".join([str(9)]*(len(ns)-1))):
    print(int(ns[0])+9*(len(ns)-1))
else:
    print(int(ns[0])+9*(len(ns)-1)-1)
n, a, b = map(int, input())

max_ = min(a,b)
if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = n - (a + b)

print(max_, min_)

### FIXED CODE ###

n, a, b = map(int, input().split())

max_ = min(a, b)

if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = 0

print(max_, min_)
import functools
import sys

n, m = map(int, input().split())
a = list(map(lambda x: x // 2, map(int, input().split())))


def gcd(x, y):
    if x == 0:
        return y

    return gcd(y % x, x)


# 2数を受け取って最小公倍数を返す関数
def lcm(a, b):
    y = a * b / gcd(a, b)
    return int(y)


# 可変引数を受け取って最小公倍数を返す関数
def lcm_2(vals):
    return functools.reduce(lcm, vals)


lc = lcm_2(a)
# ans = 0
# a = 1
# while True:
#     if lc * a <= m:
#         ans += 1
#         a += 2
#     else:
#         break
#
# print(ans)

ans = m // lc
if ans == 0:
    print(0)
    sys.exit()
if ans % 2 == 0:
    print(ans // 2)
else:
    print(ans // 2 + 1)


### FIXED CODE ###

import functools
import sys

n, m = map(int, input().split())
a = list(map(lambda x: x // 2, map(int, input().split())))

# A[0]を素因数分解して2で割り切れる回数を数える
div = 0

a_0 = a[0]
while a_0 % 2 == 0:
    a_0 /= 2
    div += 1

# print("count = " + str(div))#

# Aのすべての整数がA[0]と同じ回数2で割り切れるか調べる
for i in range(1, len(a)):
    div2 = 0
    tmp_a = a[i]
    while tmp_a % 2 == 0:
        tmp_a /= 2
        div2 += 1
    # print("A[" + str(i) + "] count = " + str(div2))#
    if div2 != div:
        print("0")
        sys.exit()


def gcd(x, y):
    if x == 0:
        return y

    return gcd(y % x, x)


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x * y // gcd(x, y)
    return functools.reduce(lcm, iter)


lc = least_common_multiple(a)
ans = 0
a = 1

ans = m // lc
if ans == 0:
    print(0)
    sys.exit()
if ans % 2 == 0:
    print(ans // 2)
else:
    print(ans // 2 + 1)
a=input()
x = list(map(int, input().split()))
x.sort(reverse=true)
if x[-1]==0:
  print(0)
else:
  sum=1
  for i in x:
    sum*=i
    if sum>10**18:
      print(-1)
      break
  if sum<=10**18: print(sum)

### FIXED CODE ###

a=input()
x = list(map(int, input().split()))
x.sort(reverse=True)
if x[-1]==0:
  print(0)
else:
  sum=1
  for i in x:
    sum*=i
    if sum>10**18:
      print(-1)
      break
  if sum<=10**18: print(sum)
K=int(input())
S=input()
if len(S)==K:
    print (S)
else:
    print(S[K])  

### FIXED CODE ###

# Take the input K
# Take the inpus S

#Compare the length of S with K and put in in length
#If length<=K... print all
#If length>K... print some of the character

K = int(input()) # 0(1)
S = input() #0(1)
second_answer = [] #0(1)
x = 0 #0(1)

length = len(S) #0(1)

if length <= K : 
    print(S) #0(1)
else:
    while x<K : #0(K)
        print(S[x], end= (""))
        x += 1
    print("...")
print("".join(x[0].upper()for x input().split()))

### FIXED CODE ###

print("".join(
  x[0].upper() for x in input().split()))
i=0
while True:
    i=i+1
    Indata = input()
    print("Case" +str(i) + ": " + Indata)
    if Indata == 0:
        break
    



### FIXED CODE ###

i=0
while True:
    Indata = int(input())
    if Indata == 0:
        break
    else:
        i=i+1
        print("Case " +str(i) + ": " + str(Indata))
def f(x):
    return x[1:],x[0]
x=input()
y=input()
z=input()
k='a'
while 1:
    if k=='a':
        if x=='':
            print('A')
            break
        else:
            x,k=f(x)
    if k=='b':
        if y=='':
            print('B')
            break
        else:
            z,k=f(z)
    if k=='c':
        if z=='':
            print('C')
            break
        else:
            z,k=f(z)

### FIXED CODE ###

import sys
def f(x):
    return x[1:],x[0]
a=input()
b=input()
c=input()
y='a'
while 1:
    if y=='a':
        if a=='':
            print('A')
            sys.exit()
        else:
            a,y=f(a)
    if y=='b':
        if b=='':
            print('B')
            sys.exit()
        else:
            b,y=f(b)
    if y=='c':
        if c=='':
            print('C')
            sys.exit()
        else:
            c,y=f(c)
A = int(input())
B = int(input())
print((A-1)*(B-1))

### FIXED CODE ###

A,B=map(int,input().split())
print((A-1)*(B-1))
import re
a,b = map(int,input().split())
s = input()
if s[a]=='-' and re.fullmatch(r'\d+',s[:a]) and re.fullmatch(r'\d+',s[a+1:]):
    print('Yes')
else:
    print('No')
    

### FIXED CODE ###

a,b = map(int,input().split())
s = input()
if s[a]=='-' and s.count('-')==1:
    print('Yes')
else:
    print('No')
while True:
    x = input()
    if x == 0:
        break
    print(sum(int(i) for i in x))



### FIXED CODE ###

while True:
  x = sum(map(int, input()))

  if x == 0:
    break

  print(x)
import sys

def main():
    args = sys.argv
    if int(args[0]) <= int(args[1]):
        print("unsafe")
    else:
        print("safe")

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    num = input().split()
    if int(num[0]) <= int(num[1]):
        print("unsafe")
    else:
        print("safe")

if __name__ == "__main__":
    main()
n,m = map(int,input().split())
a = []
b = []
for i in range(n):
    P,Y = map(int,input().split())
    a.append(P)
    b.append(Y)
#ここまで情報のインプット

#基本方針はまだ扱っていない最小のお金を持つ栄養ドリンクをとっていく。
#つまりは値がちいさいものから順に在庫が切れるまで選択するということ。

count = 0
ans = 0
i = 0
A = sorted(a)
if n-m < n//2:
    while i < n:
        if m-b[a.index(A[i])] > 0:
            m -= b[a.index(A[i])]
            ans += A[i] * b[a.index(A[i])]
        else:
            ans += A[i]* m
            break
        i+=1
else:
    while i < n:
        if m-b[a.index(A[(i+1)*(-1)])] > 0:
            m -= b[a.index(A[(i+1)*(i-1)])]
            ans += A([i+1)*(-1)] * b[a.index(A[(i+1)*(-1)])]
        else:
            ans += A[(i+1)*(-1)] * m
            break
        i+=1
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
mat = []
for i in range(n):
    mat.append(list(map(int,input().split())))
#ここまで情報のインプット

#基本方針はまだ扱っていない最小のお金を持つ栄養ドリンクをとっていく。
#つまりは値がちいさいものから順に在庫が切れるまで選択するということ。

ans = 0
i = 0
mat.sort()
#値でsortする
while True:
    if m - mat[i][1] > 0:
        ans += mat[i][1]*mat[i][0]
        m -= mat[i][1]
        i += 1
    else:
        ans += mat[i][0] *m
        break
print(ans)
S,T = map(input().split(" "))
A,B = map(int,input().split(" "))
U = input()

if S==U:
  A-=1
else:
  B-=1
  
print(f"{A} {B}")

### FIXED CODE ###

S,T = input().split(" ")
A,B = map(int,input().split(" "))
U = input()

if S==U:
  A-=1
else:
  B-=1
  
print("{} {}".format(A,B))
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif (n % divisor) == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for i in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

### FIXED CODE ###

def is_prime(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

count = 0

number = int(input())
for i in range(number):
    n = int(input())
    if is_prime(n):
        count = count + 1

print(count)
h,w = map(int,input())
L = [input() for i in range(h)]
ans = "ahe"
if L[0][0]=="#" and (L[0][1]=="." and L[1][0]=="."):
    ans="No"
elif L[0][w]=="#" and (L[0][w-1]=="." and L[1][w]=="."):
    ans="No"
elif L[h][0]=="#" and (L[h][1]=="." and L[h-1][0]=="."):
    ans="No"
elif L[h][w]=="#" and (L[h][w-1]=="." and L[h-1][w]=="."):
    ans="No"
for i in range(1,w):
    if L[0][i]=="#" and (L[0][i+1]=="." and L[1][i] =="." and L[1][i-1]):
        ans="No"
for i in range(1,w):
    if L[h][i]=="#" and (L[h][i+1]=="." and L[h-1][i] =="." and L[h][i-1]):
        ans="No"
for i in range(1,h):
    if L[i][0]=="#" and (L[i][1]=="." and L[i+1][0]=="." and L[i-1][0]=="."):
        ans="No"
for i in range(1,h):
    if L[i][w]=="#" and (L[i][w-1]=="." and L[i+1][w]=="." and L[i-1][w]==".")
for i in range(1,h):
    for j in range(1,w):
        if L[i][j]=="#" and (L[i+1][j]=="." and L[i-1][j]=="." and L[i][j+1]=="." and L[i][j-1]=="."):
            ans="No"
if ans !="No":
    ans ="Yes"
print(ans)

### FIXED CODE ###

h,w = map(int,input().split())
L =["b"*(w+2)] + ["b"+ input() + "b" for i in range(h)] + ["b"*(w+2)]
ans = "ahe"
for i in range(1,h+1):
    for j in range(1,w+1):
        if L[i][j]=="#" and (L[i+1][j]!="#" and L[i-1][j]!="#" and L[i][j+1]!="#" and L[i][j-1]!="#"):
            ans="No"
if ans!="No":
    ans="Yes"
print(ans)
N,M = input().split()
A = list(map(int, input().split()))
if int(N) - sum(A) < 0:
    print(-1)
else:
    print(int(N)-sum(A))

### FIXED CODE ###

import math
R = input()
print(2*int(R)*math.pi)
n, m = map(int, input().split())
s = [0] * m
c = [0] * m
tmp = [0] * m

for i in range(m):
    s[i], c[i] = map(int, input().split())
    
for x, y in zip(s, c):
    if tmp[x-1]==0:
        tmp[x-1] = y
    elif tmp[x-1]==y:
        continue
    else:
        print(-1)
        exit()

ans = 0

for i, a in enumerate(tmp[::-1]):
    ans += a*10**(i)

if n==1 & ans==0:
    print(ans)
elif ans // 10**(m-1) < 1:
    print(-1)
    exit()
    
print(ans)

### FIXED CODE ###

import math
print(math.ceil(int(input())/2))
A=input()
B=input()
C=input()
D=input()

int_A=int(A)
int_B=int(B)
int_C=int(C)
int_D=int(D)

while True:
    int_C-=int_B
    int_A-=int_D
    if int_C<=0:
        result="YES"
        break
    if int_A<=0:
        result="NO"
        break

print(result)


### FIXED CODE ###

A,B,C,D = map(int,input().split())

while True:
    C -= B
    A -= D

    if C <= 0:
        result = "Yes"
        break
    if A <= 0:
        result = "No"
        break

print(result)
n=int(input())
lis=list(map(int,input().split()))
if "Y" in lis:
  print("Four")
else:
  print("Three")

### FIXED CODE ###

n = int(input())
lis = list(input().split())
for i in range(n):
  if lis[i] == "Y":
    print("Four")
    break
  if i == n-1:
    print("Three")
A, B, C, K = list(map(int,input().split()))

if K <= A:
	max = K
elif A < K and K <= A+B
	max = A
else:
	max = A-(K-(A+B))
	
print(max)

### FIXED CODE ###

A, B, C, K = list(map(int,input().split()))

if K <= A:
	max = K
elif A < K and K <= A+B:
	max = A
else:
	max = A-(K-(A+B))
	
print(max)
n = int(input())
v = list(map(int,input().split()))

v1 = [0] * (10**5)
v2 = [0] * (10**5)

for i in range(0,n,2):
	v1[v[i]] += 1

for i in range(1,n,2):
	v2[v[i]] += 1

ans = n - ( max(v1) + max(v2) )
if ans == 0:
	if v[0] == v[1]:
		print(n//2)
		exit()

print(ans)

### FIXED CODE ###

n = int(input())
v = list(map(int,input().split()))

v1 = [0] * (10**5)
v2 = [0] * (10**5)
v1_max_1 = 0
v1_max_2 = 0
v2_max_1 = 0
v2_max_2 = 0

for i in range(0,n,2):
	v1[v[i]-1] += 1

for i in range(1,n,2):
	v2[v[i]-1] += 1

v1_max_index = v1.index(max(v1))
v2_max_index = v2.index(max(v2))

v1.sort(reverse=True)
v2.sort(reverse=True)
v1_max_1 = v1[0]
v2_max_1 = v2[0]
v1_max_2 = v1[1]
v2_max_2 = v2[1]

ans = n - ( v1_max_1 + v2_max_1 )

if ans == 0:
	if v[0] == v[1]:
		print(n//2)
		exit()

if v1_max_index == v2_max_index:
	print(min( n - ( v1_max_2 + v2_max_1 ),n  - ( v1_max_1 + v2_max_2 ) ))
else:
	print(ans)
n, a, b = map(int, input().split())


ans = (n //(a + b)) * a
if n % (a + b) <= a:
  print(ans + (n % (a + b))
elif n % (a + b) >= a:
  print(ans + a)
        


### FIXED CODE ###



n, a, b = map(int, input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)
N = int(input())
if N == 1:
    print(1)
    exit()
A = [0 for _ in range(N+1)]
l = [0,1]
H = []
for i in range(2**N):
    S = str(bin(i)).zfill(N)
    H.append(S[2:].zfill(N))
IXY = []
for i in range(1,N+1):
    A[i] = int(input())
    if A[i] == 0:
        continue
    for j in range(A[i]):
        x,y = map(int,input().split())
        IXY.append([i,x,y])
ANS = []
for h in H:
    for ixy in IXY:
        flg = True
        i,x,y = ixy[0]-1,ixy[1]-1,ixy[2]
        if h[i] == "1":
            if h[x] != str(y):
                flg = False
                break
    if flg:l.append(ANS.append(h))
ans = 0
for a in ANS:
    ans = max(a.count("1"),ans)
print(ans)

### FIXED CODE ###

N = int(input())

#人が一人しかいないとき
if N == 1:
    print(1)
    exit()

#人が2人以上いるとき
#N人それぞれが正直か不誠実かの全パターンを生成
H = []
for i in range(2**N):
    S = str(bin(i))
    H.append(S[2:].zfill(N))
#入力を受け取る
IXY = []
for i in range(N):
    t = int(input())
    for j in range(t):
        x,y = map(int,input().split())
        #i番目の人が「x番目の人はyである」と証言
        IXY.append([i,x,y])

ans = 0
for h in H:
    cnt = h.count("1")
    for ixy in IXY:
        i,x,y = ixy[0],ixy[1]-1,ixy[2]
        if h[i] == "1" and h[x] != str(y):
            cnt = 0
            break
    ans = max(ans,cnt)
print(ans)
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)

### FIXED CODE ###

import math
k=int(input())
ans=0

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)
import math

x,y = map(int,input().split())
print(math.gcd(x,y))

### FIXED CODE ###

x,y = map(int,input().split())
while y:
    x,y = y, x%y
print(x)
n,a,b = map(int, input().split())
print(min(n * a , b)

### FIXED CODE ###

n,a,b = map(int, input().split())
print(min(n * a , b))
from math import gcd
N = int(input())
A = list(map(int,input().split()))
ans = A[0]
for i in range(N):
    ans = gcd(ans,A[i])
print(ans)

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
N = int(input())
A = list(map(int,input().split()))
ans = A[0]
for i in range(1,N):
    ans = gcd(ans,A[i])
print(ans)
I = lambda: map(int, input().split())
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
minf = -float('inf')
n, _ = I()
*A, = sorted(I(), reverse = True)
digs = [0]*(n+1)
for i in range(1, n+1):
    d = []
    for a in A :
        before = i-nums[a]
        d.append(minf if before < 0 else digs[before]+1)
    digs[i] = max(d)
ans = []
while n > 0:
    for a in A:
        if digs[n-nums[a]] == (digs[n]-1):
            ans.append(a)
            n -= nums[a]
            break
print(*ans, sep = '')

### FIXED CODE ###

I = lambda: map(int, input().split())
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
minf = -float('inf')
n, _ = I()
*A, = sorted(I(), reverse = True)
digs = [0]*(n+1)+[-1]*9
for i in range(1, n+1):
    d = []
    for a in A :
        before = i-nums[a]
        d.append(minf if before < 0 else digs[before]+1)
    digs[i] = max(d)
ans = []
while n > 0:
    for a in A:
        if digs[n-nums[a]] == digs[n]-1:
            ans.append(a)
            n -= nums[a]
            break
print(*ans, sep = '')
a = int(input())
b = int(input())
c = int(input())
if a>b or b>c or a>c or a>b:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

form = input()
form = form.split()
form.sort()

if form == ["5","5","7"]:
  print("YES")
else:
  print("NO")
print(1000 - (int(input()) % 1000)) % 1000

### FIXED CODE ###

N = int(input())

if N % 1000 == 0:
    print(0)
else:
    print(1000 - (N % 1000))
# -*- coding: utf-8 -*-
X = int(input())

ans = ""
for i in range(70):
    for j in range(-70, i, 1):
        if i ** 5 - j ** 5 == X:
            ans = "{} {}".format(i, j)
            break
    if ans != "":
        break

if ans != "":
    print(ans)
else:
    print(aaa)

### FIXED CODE ###

# -*- coding: utf-8 -*-
X = int(input())

ans = ""
for i in range(10 ** 4):
    for j in range(-70, i, 1):
        if i ** 5 - j ** 5 == X:
            ans = "{} {}".format(i, j)
            break
    if ans != "":
        break

if ans != "":
    print(ans)
else:
    print(aaa)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

N, M, P = mis()

to = [[] for _ in range(N)]
ot = [[] for _ in range(N)]
edges = []

for i in range(M):
    a,b,c = mis()
    a -= 1
    b -= 1
    c = -(c-P)
    #
    to[a].append(b)
    ot[b].append(a)
    edges.append((a,b,c))

reachableFrom0 = [False] * N
reachableToN = [False] * N

def dfs(n):
    if reachableFrom0[n]:
        return
    reachableFrom0[n] = True
    for i in to[n]:
        dfs(i)

def rdfs(n):
    if reachableToN[n]:
        return
    reachableToN[n] = True
    for i in ot[n]:
        rdfs(i)

dfs(0)
rdfs(N-1)

ok = [a and b for a, b in zip(reachableFrom0, reachableToN)]

edges = [(a, b, c) for a, b, c in edges if ok[a] and ok[b]]

V = [float('inf')] * N
V[0] = 0

def bf_step():
    for a, b, c in edges:
        V[b] = min(V[b], V[a] + c)

def bf():
    for _ in range(N):
        bf_step()

bf()

Vb = tuple(V)
bf_step()

if tuple(V) == Vb:
    print(max(-V[-1], 0))
else:
    print(-1)




### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

def main():
    N, M, P = mis()
    
    to = [[] for _ in range(N)]
    ot = [[] for _ in range(N)]
    edges = []

    for i in range(M):
        a,b,c = mis()
        a -= 1
        b -= 1
        c = -(c-P)
        #
        to[a].append(b)
        ot[b].append(a)
        edges.append((a,b,c))

    reachableFrom0 = set()
    reachableToN = set()

    # dfs
    reachableFrom0.add(0)
    nodes = [0]
    while nodes:
        node = nodes.pop()
        for i in to[node]:
            if i not in reachableFrom0:
                nodes.append(i)
                reachableFrom0.add(i)

    #rdfs
    reachableToN.add(N-1)
    nodes = [N-1]
    while nodes:
        node = nodes.pop()
        for i in ot[node]:
            if i not in reachableToN:
                nodes.append(i)
                reachableToN.add(i)


    ok = reachableFrom0 & reachableToN

    edges = tuple((a, b, c) for a, b, c in edges if a in ok and b in ok)

    V = [float('inf')] * N
    V[0] = 0

    def bf(n):
        for _ in range(n):
            upd = False
            for a, b, c in edges:
                if V[b] > V[a] + c:
                    V[b] = V[a] + c
                    upd = True
            if not upd:
                return False
        return True

    bf(N)

    if not bf(1):
        print(max(-V[-1], 0))
    else:
        print(-1)

main()
import math

a, b, c, d = map(int, input().split())

a -= 1
lcm = (c * d) // math.gcd(c, d)

divisible_c = (b // c) - (a // c)
divisible_d = (b // d) - (a // d)
divisible_cd = (b // lcm) - (a // lcm)

print((b - a) - (divisible_c + divisible_d - divisible_cd))

### FIXED CODE ###

import fractions

a, b, c, d = map(int, input().split())

a -= 1
lcm = (c * d) // fractions.gcd(c, d)

divisible_c = (b // c) - (a // c)
divisible_d = (b // d) - (a // d)
divisible_cd = (b // lcm) - (a // lcm)

print((b - a) - (divisible_c + divisible_d - divisible_cd))
import math

a, b, c, d = map(int, input().split())


def lcm(x, y):
    return x * y // math.gcd(x, y)


a1 = a - 1
div_a = (a1 // c) + (a1 // d) - (a1 // lcm(c, d))
div_b = (b // c) + (b // d) - (b // lcm(c, d))

print((b - a + 1) - (div_b - div_a))


### FIXED CODE ###

# import math
import fractions


a, b, c, d = map(int, input().split())


def lcm(x, y):
    # DeprecationWarning: fractions.gcd() is deprecated. Use math.gcd() instead.
    return x * y // fractions.gcd(x, y)


a1 = a - 1
div_a = (a1 // c) + (a1 // d) - (a1 // lcm(c, d))
div_b = (b // c) + (b // d) - (b // lcm(c, d))

print((b - a + 1) - (div_b - div_a))
N = input().split()

a = N[0]
b = N[1]
c = N[2]

count = 0
for i in range(a, b):
    if c % i == 0:
       count += 1
         print(count)

### FIXED CODE ###

N = input().split()

a = int(N[0])
b = int(N[1])
c = int(N[2])

count = 0
while a <= b:
    if c % a == 0:
       count += 1
    a += 1
print(count)
N = int(input())

while n <= N:
  n += 1
  
print(str(n))

### FIXED CODE ###

N = int(input())
n = 0

for i in range(1,N+1,1):
  n += i
  
print(n)
l = ["Sunny","Cloudy", "Rainy" ]
s = input()
i = l.index(s)
printf(l[(i+1)%3])

### FIXED CODE ###

l,s=["Sunny","Cloudy","Rainy"],input()
i=l.index(s)
print(l[(i+1)%3])
from collections import Counter

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


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

S = Counter(A)

for i in range(l):
  ans = 0
  S[A[i]] -= 1
  for j in S.keys():
    ans += cmb(S[j],2,mod)
  S[A[i]] += 1
  print(ans)


### FIXED CODE ###

from collections import defaultdict,Counter
import sys

n = int(input())
a = list(map(int, sys.stdin.readline().split()))

d = Counter(a)
e = defaultdict(int)

base = sum(v * (v - 1) // 2 for v in d.values())
e = {k: base - (v >= 2) * (v - 1) for k, v in d.items()}

for x in a:
  print(e[x])