Harryxun/stf_run huggingface dataset:
from math import gcd
num = (int)(input())
total = 0
 
for i in range(1, num + 1):
  for j in range(1, num + 1):
    sub = math.gcd(i, j)
    for k in range(1, num + 1):
      total += math.gcd(sub, k)
print(total)

### FIXED CODE ###

k = int(input())
import math
from functools import reduce

l = []
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(1, k+1):
    for j in range(1, k+1):
        for m in range(1, k+1):
            n = gcd(i, j, m)
            l.append(n)
print(sum(l))
N, T = raw_input().split()
sct = []
for i in xrange(int(N)):
    ci, ti = raw_input().split()
    if int(ti) < int(T):
        s = set()
        s.add(ci)
        s.add(ti)
        sct.append(ci)
print(min(sct))

### FIXED CODE ###

N, T = raw_input().split()
sct = []
for i in xrange(int(N)):
    ci, ti = raw_input().split()
    if int(ti) <= int(T):
        s = set()
        s.add(ci)
        s.add(ti)
        sct.append(int(ci))
print('TLE' if sct ==[] else min(sct))
s = input()
if len(S) % 2 == 1:
  print('No')
else:
  if s[0:(len(s)-1)/2] == s[(len(s)-1)/2+1:len(s)-1]:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

n = int(input())
s = input()
if n % 2 == 1:
  print('No')
else:
  if s[0:n//2] == s[n//2:n]:
    print('Yes')
  else:
    print('No')
K = int(input())
mod = []
a[0] = 7%K
if a[0] == 0:
    print(a[0])
    exit()
for i in range(1,K+1):
    a[i] = (a[i-1]*10 + 7)%K
    if a[i] == 0:
        print("%d",a[i])
        break

else:
    print(-1)

### FIXED CODE ###

K = int(input())

n = 0
for i in range(1,K+1):
    n = (n*10 + 7)%K
    if n == 0:
        print(i)
        break

else:
    print(-1)
s=input()
print(s.count(1))

### FIXED CODE ###

s=input()
print(s.count('1'))
n,m,q = map(int, input().split())
m_dict = dict()
for i in range(1,m+1):
  m_dict[i] = []
for i in range(m):
  s,e = map(int, input().split())
  m_dict[s].append(e)
for i in range(q):
  s,e = map(int, input().split())
  cnt = 0
  for j in m_dict.keys():
    if len(m_dict[j]) == 0: continue
    elif j < s: continue  
    elif e < j: break  
    else: cnt += len([ k for k in m_dict[j] if k <= e ])
  print(cnt)

### FIXED CODE ###

n,m,q = map(int, input().split())
mmap = [ [ 0 for j in range(n+1) ] for i in range(n+1) ]
for i in range(m):
  s,e = map(int, input().split())
  mmap[s][e] += 1
for i in range(n+1):
  for j in range(1,n+1):
    mmap[i][j] = mmap[i][j] + mmap[i][j-1]
for j in range(n+1):
  for i in range(n-1,0,-1):
    mmap[i][j] = mmap[i][j] + mmap[i+1][j]
for i in range(q):
  s,e = map(int, input().split())
  print(mmap[s][e])
N=int(input())
H=map(int, input().split())
for i in range(N-1):
    if H[i+1] < H[i]:
        print(No)
    else:
        print(Yes)

### FIXED CODE ###

N=int(input())
H=list(map(int, input().split()))
Z=0
count=0
for i in range(N-1):
    A=H[i+1]
    B=H[i]-1
    if A < B:
        print('No')
        Z=Z+1
        break
    if A == B:
        count=count+1
        if count >=2 and A < C:
            print('No')
            Z=Z+1
            break
        else:
            C=A
if Z == 0:
    print('Yes')
import string
def CaesarCipher():
    
    low=str.ascii_lowercase
    
    for cry in sys.stdin: 
        for i in range(1,27):
            
            dec=cry.translate(str.maketrans(low,low[i:]+low[:i]))
    
            if 'this' in dec or 'that' in dec or 'the' in dec:
                print(dec)
            
                
    
CaesarCipher()

### FIXED CODE ###


import string
import sys

def CaesarCipher():
    
    low=string.ascii_lowercase
    
    for cry in sys.stdin: 
        for i in range(1,27):
            
            dec=cry.translate(str.maketrans(low,low[i:]+low[:i]))
    
            if 'this' in dec or 'that' in dec or 'the' in dec:
                print(dec[:-1])
            
                
    
CaesarCipher()
a = int(input())
b = int(input())

if (a*b)%2 == 0 :
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

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

if (a*b)%2 == 0 :
  print("Even")
else:
  print("Odd")
x,a,b=map(int, input()split())
if abs(x-b) > abs(x-a):
  print('A')
else:
  print('B')

### FIXED CODE ###

x,a,b=map(int, input().split())
if abs(x-b) > abs(x-a):
  print('A')
else:
  print('B')
#!/usr/bin/env python3

def main():
    import sympy
    N = int(input())
    print(sum([i * sympy.divisor_count(i) for i in range(N + 1)]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

def main():
    N = int(input())

    def fanc(N):
        return N * (N + 1) // 2
    ans = 0
    for i in range(1, N + 1):
        ans += i * fanc(N // i)
    print(ans)


if __name__ == "__main__":
    main()
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

for Cx in range(101):
    for Cy in range (101):
        ls =[]
        for i in range (N):
            x = xyh[i][0]
            y = xyh[i][1]
            h = max(H-abs(x-Cx)-abs(y-Cy),0)
            ls.append([x,y,h])
    if set(ls) == set(xyh):
        ans = [Cx,Cy,h]
    ls = []

print(ans.split()) 
        


### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] > 0:
        xstd = xyh[count][0]
        ystd = xyh[count][1]
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(xstd-Cx) + abs (ystd - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(xi-Cx)-abs(yi-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = " ".join([str(x),str(y),str(H)])
            break
        
print(ans)
import sys

s=input()
k=int(input())


i=0
while i<=k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

### FIXED CODE ###

import sys

s=input()
k=int(input())


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")
aalphabets = [""] + [s for s in "abcdefghijklmnopqrstuvwxyz"]

s = int(input())

nums = []

while s > 0:
  nums.append((s - 1) % 26 + 1)
  s = (s - 1) // 26

res = ""
  
for _ in range(len(nums)):
  res = res + alphabets[nums.pop()]

print(res)

### FIXED CODE ###

alphabets = [""] + [s for s in "abcdefghijklmnopqrstuvwxyz"]

s = int(input())

nums = []

while s > 0:
  nums.append((s - 1) % 26 + 1)
  s = (s - 1) // 26

res = ""
  
for _ in range(len(nums)):
  res = res + alphabets[nums.pop()]

print(res)
N,M=map(int,input().split())
L=list([0]*M for _ in range(N))
if N>=2 and M>=2:
    print((N-2)*(M-2))
elif max(N,M)>=2:
    print(max(N,M)-2)
else:
    print(1)

### FIXED CODE ###

N,M=map(int,input().split())
if N>=2 and M>=2:
    print((N-2)*(M-2))
elif max(N,M)>=2 and min(N,M)==1:
    print(max(N,M)-2)
else:
    print(1)
N = int(input())
ans = 0
for i in range(1, N + 1):
	if len(int(i)) % 2 == 1:
		ans += 1
print(ans)

### FIXED CODE ###

a,b,c=map(int,input().split())
s=c-min(c,a-b)
print(s)
#coding: utf-8
from collections import defaultdict

N = int(input())
G = {}
for i in range(1, N+1):
    G[i] = []

for i in range(N-1):
    u, v, w = (int(n) for n in input().split())
    G[u].append((v, w))
    G[v].append((u, w))

ret = [-1] * (N+1)

def dfs(node, d):
    if ret[node] != -1:
        return

    if d % 2 == 0:
        ret[node] = 0
    else:
        ret[node] = 1 

    for next_node in G[node]:
        dfs(next_node[0], d + next_node[1])

dfs(1, 0)
for i in range(N):
    print(ret[i+1])


### FIXED CODE ###

#coding: utf-8
from collections import defaultdict, deque

N = int(input())
G = {}
for i in range(1, N+1):
    G[i] = []

for i in range(N-1):
    u, v, w = (int(n) for n in input().split())
    G[u].append((v, w))
    G[v].append((u, w))

ret = [-1] * (N+1)

que = deque()
que.append((1, 0))

while len(que) > 0:
    node, distance = que[0]
    que.popleft()

    ret[node] = distance % 2
    for next_node, next_distance in G[node]:
        if ret[next_node] == -1:
            que.append((next_node, distance + next_distance))

for i in range(N):
    print(ret[i+1])
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(len(set(data))-1)

### FIXED CODE ###

from sys import stdin
import numpy as np
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(len(set(np.array(data).reshape(-1,))))
input().split()

x,y,z = input().split()
D=int x
T=int y
S=int z

if T-D/S>= 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

D,T,S = map(int, input().split())

if T-D/S >= 0:
    print("Yes")
else:
    print("No")
n = int(input())

bl = [int(i) for i in input().split()]
al = []
memo = 0
for idx,i in enumerate(bl[::-1]):
    if idx in (0,len(bl)):
        al.append(i)
    else:
        al.append(min(i,al[idx-1]))
    memo = i
    
al.append(bl[0])
print(sum(al))



### FIXED CODE ###

n = int(input())

print(n**3)
a,b = list(map(int,input().split())
print(a+b//2)

### FIXED CODE ###

a,b = map(int,input().split())
print(a+b//2)
r = float(input())
print '%f %f' % (2*3.141592653589*r, 3.141592653589*r^2)

### FIXED CODE ###

import math
r = float(input())
print '%f %f' % (math.pi*r*r, 2*math.pi*r)
#074-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
w1,w2,s1,s2,c,lim=IL()
l=[]
for i in range(31):
    for j in range(31):
        w=w1*i*100+w2*j*100
        if w<lim:
            l.append(w)
ans_c=0
for w in l:
    maxs=min(c*w//100,lim-w)
    maxs1=maxs//s1+1
    maxs2=maxs//s2+1
    for i in range(maxs1+1):
        for j in range(maxs2+1):
            s=s1*i+s2*j
            if s+w!=0:
                if s+w<=lim and s<=maxs and ans_c<100*s/(s+w):
                    ans_c=100*s/(s+w)
                    ans=[s+w,s]
print(ans[0],ans[1])

### FIXED CODE ###

#074-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
w1,w2,s1,s2,c,lim=IL()
l=[]
for i in range(31):
    for j in range(31):
        w=w1*i*100+w2*j*100
        if w<lim:
            l.append(w)
ans_c=0
ans=[100*w1,0]
for w in l:
    maxs=min(c*w//100,lim-w)
    maxs1=maxs//s1+1
    maxs2=maxs//s2+1
    for i in range(maxs1+1):
        for j in range(maxs2+1):
            s=s1*i+s2*j
            if s+w!=0:
                if s+w<=lim and s<=maxs and ans_c<100*s/(s+w):
                    ans_c=100*s/(s+w)
                    ans=[s+w,s]
print(ans[0],ans[1])
import numpy as np

def main():
    n, m, x = map(int, input().split())
    cl = [None]*n
    al = [None]*n
    for i in range(n):
        cl[i], *al[i] = map(int, input().split())
    
    def dfs(i, cost, A):
        if i == n-1:
            global ans
            if all([a >= x for a in A]) and cost < ans:
                ans = cost
            return
        i += 1
        dfs(i, cost, A[:])
        dfs(i, cost+cl[i], A[:]+al[i])
    
    dfs(-1, 0, np.array([0]*n))
    
    print(ans)
        

if __name__ == "__main__":
    ans = 10**7
    main()

### FIXED CODE ###

import numpy as np
import sys
sys.setrecursionlimit(100000)

def main():
    n, m, x = map(int, input().split())
    cl = [None]*n
    al = [None]*n
    total = np.array([0]*m)
    global ans
    ans = 10**7
    for i in range(n):
        c, *a = map(int, input().split())
        a = np.array(a)
        cl[i] = c
        al[i] = a
        total += a
    def dfs(i, cost, A):
        i += 1
        if i == n:
            global ans
            if all([ai >= x for ai in A]) and ans > cost:
                ans = cost
            return
        dfs(i, cost, A[:])
        dfs(i, cost+cl[i], A[:]+al[i])
    dfs(-1, 0, np.array([0]*m))
    if ans == 10**7:
        print(-1)
    else:
        print(ans)
        

if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int,input().split()))
b = a.sort()
print(abs(b[0] - b[-1]))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = list(sorted(a))
print(abs(b[0] - b[-1]))
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    ga, sa, ba = map(int, rl().split())
    gb, sb, bb = map(int, rl().split())
    
    dp1 = [0] * 10000000
    dp1[0] = N
    M = N
    for i in range(N + 1):
        dp1[i + ga] = max(dp1[i + ga], dp1[i] - ga + gb)
        dp1[i + sa] = max(dp1[i + sa], dp1[i] - sa + sb)
        dp1[i + ba] = max(dp1[i + ba], dp1[i] - ba + bb)
        M = max(M, dp1[i])
    
    dp2 = [0] * 10000000
    dp2[0] = M
    ans = M
    for i in range(M + 1):
        dp2[i + gb] = max(dp2[i + gb], dp2[i] - gb + ga)
        dp2[i + sb] = max(dp2[i + sb], dp2[i] - sb + sa)
        dp2[i + bb] = max(dp2[i + bb], dp2[i] - bb + ba)
        ans = max(ans, dp2[i])
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    ga, sa, ba = map(int, rl().split())
    gb, sb, bb = map(int, rl().split())
    
    dp1 = [0] * 30000000
    dp1[0] = N
    M = N
    for i in range(N + 1):
        dp1[i + ga] = max(dp1[i + ga], dp1[i] - ga + gb)
        dp1[i + sa] = max(dp1[i + sa], dp1[i] - sa + sb)
        dp1[i + ba] = max(dp1[i + ba], dp1[i] - ba + bb)
        M = max(M, dp1[i])
    
    dp2 = [0] * 30000000
    dp2[0] = M
    ans = M
    for i in range(M + 1):
        dp2[i + gb] = max(dp2[i + gb], dp2[i] - gb + ga)
        dp2[i + sb] = max(dp2[i + sb], dp2[i] - sb + sa)
        dp2[i + bb] = max(dp2[i + bb], dp2[i] - bb + ba)
        ans = max(ans, dp2[i])
    print(ans)


if __name__ == '__main__':
    solve()
n=int(input())
li=list(map(int,input().split()))

ans=[]
for i in range(n,n//2,-1):
  if li[i]==1:
    ans.append(i+1)

for i in range(n//2,0,-1):
  count=0
  for j in ans:
    if j%i==0:
      count+=1
  count+=li[i-1]
  if count%2==1:
    ans.append(i)
ans.reverse()
print(len(ans))
L=[str(a) for a in ans]
L=" ".join(L)
if len(L)!=0:
  print(L)

### FIXED CODE ###

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

ans=[]
li2=[0 for _ in range(n)]
for i in range(n,0,-1):
  count=0
  for j in range(i*2,n+1,i):
    if li2[j-1]==1:
      count+=1
  if count%2!=li[i-1]:
    li2[i-1]=1
    ans.append(i)

ans.reverse()
print(len(ans))
L=[str(a) for a in ans]
L=" ".join(L)
if len(L)!=0:
  print(L)
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range:
    S[i] = list(map(int, input().split()))
 
b = 0
 
for i in range:
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
 
print(str(b))

### FIXED CODE ###

N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range(N):
    S[i] = list(map(int, input().split()))

b = 0
 
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
print(str(b))
N, K, X, Y = [input() for i in range(4)]
if N <= K:
    print(N*X)
else:
    print((N-K)*Y + K*X)

### FIXED CODE ###

N, K, X, Y = [int(input()) for i in range(4)]
if N <= K:
    print(N*X)
else:
    print((N-K)*Y + K*X)
from copy import deepcopy
n=int(input())
l=[tuple(map(int,input().split()))for i in range(n)]
l=[i for i in l if i[2]!=0]
s=l[0]
l2=[[x,y,s[2]+abs(x-s[0])+abs(y-s[1])]for y in range(101)for x in range(101)]
l3=deepcopy(l2)
for s in l3:
    for t in l:
        if s[2]!=t[2]+abs(s[0]-t[0])+abs(s[1]-t[1]):
            try:
                l2.remove(s)
            except:
                continue
print(*l2[0])

### FIXED CODE ###

input()
try:print(int(input())+int(input()))
except:print("Hello World")
import sys
from math import factorial

def comb(n, r):
    if r < 0:
        return 0
    if n < r:
        return 0
    return factorial(n) / factorial(r) / factorial(n - r)

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10**9 + 7

    used = set()
    first = 0
    second = 0
    for i in range(N+1):
        if A[i] in used:
            second = i
            first = A.index(A[i])
        else:
            used.add(A[i])

    for i in range(1, N+2):
        ans = comb(N+1, i)
        for j in range(i):
            m_f = first
            r_f = j

            m_b = N - second
            r_b = i - (j + 1)

            ans -= comb(m_f, r_f) * comb(m_b, r_b)

        print(int(ans) % MOD)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10**9 + 7

    used = set()
    first = 0
    second = 0
    for i in range(N+1):
        if A[i] in used:
            second = i
            first = A.index(A[i])
        else:
            used.add(A[i])

    factrial = [1] * (N+2)
    for k in range(1, N+2):
        factrial[k] = (factrial[k-1] * k) % MOD

    fact_inv = [1] * (N+2)
    fact_inv[N+1] = pow(factrial[N+1], MOD - 2, MOD)
    for k in range(N, -1, -1):
        fact_inv[k] = (fact_inv[k+1] * (k+1)) % MOD

    def comb(n, r, MOD):
        if n < 0 or r < 0 or n < r:
            return 0
        else:
            return (factrial[n] * fact_inv[r] * fact_inv[n-r]) % MOD

    m = first + (N - second)
    for i in range(1, N+2):
        ans = comb(N+1, i, MOD) - comb(m, i-1, MOD)
        print(int(ans) % MOD)


if __name__ == '__main__':
    main()
from decimal import Decimal

n = int(input())
training = 1
for i in range(1, n):
    training *= i
print(Decimal(training) % (10 ** 9 + 7))


### FIXED CODE ###

n = int(input())
training = 1
for i in range(1, n + 1):
    training = i * training % (10 ** 9 + 7)
print(training)
import sys

a = int(input())
b = int(input())

if a>0 and 10>a and b>0 and 10>b:
    print(a*b)

else:
    print(-1)


### FIXED CODE ###

import sys

a,b = (int(x) for x in input().split())

if a>0 and 10>a and b>0 and 10>b:
    print(a*b)

else:
    print(-1)
S = input()
n = len(S)
dp = {0:1}
q = 1
p = 0
for i in range(n):
    p += int(S[n-1-i])*q
    q *= 10
    q = q % 2019
    p = p % 2019
    if p not in dp:
        dp[p] = 1
    else:
        dp[p] += 1
print(dp)
print(sum(dp[i]*(dp[i]-1)//2 for i in dp))

### FIXED CODE ###

s,w = map(int,input().split())
print("safe" if s > w else "unsafe")
n,m,k = map(int,input().split())
mod = 998244353
def inv(x):
  y = 1
  while x != 1:
    y *= mod // x + 1
    y %= mod
    x -= mod % x
  return y
#print(inv(2))
now = m
for _ in range(n-1):
  now *= m-1
  now %= mod
ans = int(now)
for i in range(k):
  now *= inv(m-1)
  now *= n-1-i
  now *= inv(i+1)
  now %= mod
  #print(now)
  ans += now
  ans %= mod
print(ans)

### FIXED CODE ###

n,m,k = map(int,input().split())
mod = 998244353
if m == 1:
  if k == n-1:
    print(1)
  else:
    print(0)
  exit()
def inv(x):
  y = 1
  while x != 1:
    y *= mod // x + 1
    y %= mod
    x -= mod % x
  return y
#print(inv(2))
now = int(m)
for _ in range(n-1):
  now *= m-1
  now %= mod
ans = int(now)
for i in range(k):
  now *= inv(m-1)
  now *= n-1-i
  now *= inv(i+1)
  now %= mod
  #print(now)
  ans += now
  ans %= mod
print(ans)
pqr = list(map(int, input().split()))
kumi = [(pqr[0], pqr[1]), (pqr[1], pqr[2]), (pqr[0], pqr[2])
seki = []
for c in kumi:
	seki.append(c[0]*c[1])
print(min(seki))

### FIXED CODE ###

def main():
    p,q,r = map(int, input().split())
    min_time = min([p+q, q+r, r+p])
    print(min_time)

if __name__ == '__main__':
	main()
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]

ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]

i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())

ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]

def main(N, M, PYm):
    # 県番号pと市誕生年yから認識番号を得られる辞書
    # dic[p][y] -> 認識番号
    dic = {}
    # 県ごとに、市誕生年を昇順ソートし、認識番号を1,2,...と対応づける
    # dic2[p] -> [(1, sorted_y1), (2, sorted_y2), ...]
    # dic2tmp[p] -> [y1, y2, ...]
    #dic2 = {}
    dic2tmp = {}
    for p in range(N+1):
        dic[p] = {}
        #dic2[p] = []
        dic2tmp[p] = []
    for p, y in PYm:
        dic2tmp[p].append(y)
    for p in range(N+1):
        dic2tmp[p].sort()
        nby = [(i+1, y) for i, y in enumerate(dic2tmp[p])]
        #dic2[p] = nby
        for nb, y in nby:
            dic[p][y] = nb
    # 表示
    for p, y in PYm:
        nb = dic[p][y]
        print('%06d%06d' % (p, nb))
N, M = i2nn()
PYs = ss2nnn(ii2ss())
main(N, M, PYs)


### FIXED CODE ###

import sys
 
s2nn = lambda s: [int(c) for c in s.split(' ')]
 
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
 
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
 
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
 
def main(N, M, PYm):
    # 県番号pと市誕生年yから認識番号を得られる辞書
    # dic[p][y] -> 認識番号
    dic = {}
    # 県ごとに、市誕生年を昇順ソートし、認識番号を1,2,...と対応づける
    # dic2[p] -> [(1, sorted_y1), (2, sorted_y2), ...]
    # dic2tmp[p] -> [y1, y2, ...]
    #dic2 = {}
    dic2tmp = {}
    for p in range(N+1):
        dic[p] = {}
        #dic2[p] = []
        dic2tmp[p] = []
    for p, y in PYm:
        dic2tmp[p].append(y)
    for p in range(N+1):
        dic2tmp[p].sort()
        nby = [(i+1, y) for i, y in enumerate(dic2tmp[p])]
        #dic2[p] = nby
        for nb, y in nby:
            dic[p][y] = nb
    # 表示
    for p, y in PYm:
        nb = dic[p][y]
        print('%06d%06d' % (p, nb))

N, M = i2nn()
PYs = ss2nnn(ii2ss(M))
main(N, M, PYs)
import math
a,b,x = map(int,input().split())
s = 2*x/(a*b)
if s < a:
	print(math.atan(b/s)/math.pi*180)
else:
	s = 2*b-2*x/(a**2)
	print(90-math.atan(a/s)/math.pi*180)

### FIXED CODE ###

import math
a,b,x = map(int,input().split())

if b*a**2 == x:
	print(0)
	exit()

s = 2*x/(a*b)
if s < a:
	print(math.atan(b/s)/math.pi*180)
else:
	s = 2*b-2*x/(a**2)
	print(90-math.atan(a/s)/math.pi*180)
import sys
import math
from collections import Counter
n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
def comb(n):
  return int(math.factrial(n)/(math.factrial(n-2)*2))
for k in range(n):
  ans =0
  L=A[:k]+A[k+1:]
  for v in Counter(L).values():
    if v>=2:
      ans +=comb(v)
  print(ans)


### FIXED CODE ###

#ABC159D
import sys, math
from collections import Counter

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

def comb(n):
    return int(math.factorial(n)/(2*math.factorial(n-2)))

total = 0
L = Counter(A)
for v in L.values():
    if v>=2:
        total += comb(v)

for k in range(N):
    print(total - (L[A[k]]-1))