Harryxun/stf_run huggingface dataset:
import math
import numpy as np

k = int(input())



def gcd(*numbers):
    return reduce(math.gcd, numbers)

answer = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            answer += np.gcd.reduce([a,b,c])

print(answer)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
 
K = int(read())
 
x = np.arange(1, K + 1)
nums = np.gcd.outer(np.gcd.outer(x, x), x)
print(nums.sum())
print(input.count("1"))

### FIXED CODE ###

print(input().count("1"))
print(a)

### FIXED CODE ###

h, a = [int(i) for i in input().split()]
i = h//a + 1
if h%a == 0:
  i -= 1
print(i)
a, b = map(int, input(),split())
c= a+b
if c%2==0:
 print(c/2)
else:
print((c+1)/2)

### FIXED CODE ###

a, b =map(int, input().split())
print(int((a+b+1)/2))
s=input()
s=list(s)
for i in s:
  if s.count(s[i])%2==1:
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

s=input()
s=list(s)
for i in s:
  if s.count(i)%2==1:
    print("No")
    exit()
print("Yes")
import collections
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = collections.Counter(a_list)
d = b.most_common()[:k]
sum = 0
for i in d:
    sum += i
print(n-sum)

### FIXED CODE ###

import collections
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = collections.Counter(a_list)
d = b.most_common()[k:]
sum = 0
for i in d:
    sum += i[1]
print(sum)
n = input()
if n = n[::-1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = input()
if n == n[::-1]:
  print('Yes')
else:
  print('No')
n=int(input())
a=list(map(int,input().split()))

increase_flag=False
decrease_flag=False
answer=0

for i in range(len(a)-1):
  if increase_flag==False and decrease_flag==False:

    if a[i+1]>a[i]:
      increase_flag=True
      answer+=1
    elif a[i+1]<a[i]:
      decrease_flag=True
      answer+=1
      
  else:
    if decrease_flag==True and a[i+1]>a[i]:
      decrease_flag=False
    elif increase_flag==True and a[i+1]<a[i]:
      increase_flag=False

if increase_flag==False and decrease_flag==False:
  if a[i+1]>a[i]:
    increase_flag=True
    answer+=1
  elif a[i+1]<a[i]:
    decrease_flag=True
    answer+=1
print(answer)
      
    

### FIXED CODE ###

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

increase_flag=False
decrease_flag=False
answer=0
if n!=1:
  for i in range(len(a)-1):
    if increase_flag==False and decrease_flag==False:

      if a[i+1]>a[i]:
        increase_flag=True
        answer+=1
      elif a[i+1]<a[i]:
        decrease_flag=True
        answer+=1
      
    else:
      if decrease_flag==True and a[i+1]>a[i]:
        decrease_flag=False
      elif increase_flag==True and a[i+1]<a[i]:
        increase_flag=False

  if increase_flag==False and decrease_flag==False:
    if a[-1]>a[-2]:
      increase_flag=True
      answer+=1
    elif a[-1]<a[-2]:
      decrease_flag=True
      answer+=1
  print(answer)
else:
  print(1)
import math
n=int(input())
for i in range(1,n+1):
    nn=int(math.sqrt(i))
    min=int((nn+1)/3)
    min1=int((nn+1)/2)
    count=0
    for x in range(1,min+1):
        for y in range(x,min1+1):
            for z in range(y,nn+1):
                #print(x*x+y*y+z*z+x*y+y*z+z*x)
                if (x*x+y*y+z*z+x*y+y*z+z*x)==i:
                    if x==y and y==z and z==x:
                        count=count+1
                    elif x!=y and y!=z and z!=x:
                        count=count+6
                    else:
                        count=count+3
    print(count)


### FIXED CODE ###

a = list(map(int,input().split()))
answer=int(a[1]/a[2])-int(a[0]/a[2])
if a[0]%a[2]==0:
    answer=answer+1
print(answer)
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)


N = int(input())

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

print(gcd(A))


### FIXED CODE ###

N = int(input())

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

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
        
a = A[0]
for i in range(N):
    a = gcd(a,A[i])

print(a)
import math

N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N)+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)


### FIXED CODE ###

import math

N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N))+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)
s=input()
if ("N" in s and "S" not in s) or
	("S" in s and "N" not in s) or
	("E" in s and "W" not in s) or
    ("W" in s and "E" not in s):
      print("No")
else:
  print("Yes")

### FIXED CODE ###

S = input()
s = set(S)
if ("N" in s and "S" not in s) \
 or ("S" in s and "N" not in s) \
 or ("W" in s and "E" not in s) \
 or ("E" in s and "W" not in s):
    print("No")
else:
    print("Yes")
ans=0
N=int(input())
c=round(N/2)
for i in range(1,c):
    for j in range(c,i,-1):
        cnt=i+j
        if cnt=N:
            ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
c=-(-N//2)-1
print(c)
x=input()
while 1:
  k=1
  for i in range(2,x**0.5+1):
    if x%i==0:
      k=0
      break
  if k:
    print(x)
    break
  x+=1

### FIXED CODE ###

import math

x=int(input())
while 1:
  k=1
  for i in range(2,int(math.sqrt(x))+1):
    if x%i==0:
      k=0
      break
  if k:
    print(x)
    break
  x+=1
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N,Q=map(int,input().split())
    M = N-1  # 頂点数，辺数
    ans=[0]*N
    # グラフ入力受取 (ここでは無向グラフを想定)
    G = [[] for _ in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        a-=1
        b-=1
        G[a].append(b)
        G[b].append(a)
    
    for i in range(Q):
        p,x=map(int,input().split())
        p-=1
        ans[p]+=x

        
    
    seen = [False]*N
    
    
    def dfs(G, v):    
        seen[v] = True
    
        for next_v in G[v]:
            if seen[next_v]:
                continue
            ans[next_v]+=ans[v]
            dfs(G, next_v)
    
    
    # 頂点 0 をスタートとした探索
    dfs(G, 0)
    print(*ans)
    
    
    
resolve()

### FIXED CODE ###

from collections import Counter, deque, OrderedDict
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N, Q = map(int, input().split())
    M = N-1  # 頂点数，辺数
    ans = [0]*N

    # グラフ入力受取 (ここでは無向グラフを想定)
    G = [[] for _ in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append(b)
        G[b].append(a)

    for i in range(Q):
        p, x = map(int, input().split())
        p -= 1
        ans[p] += x

    seen = [False]*N

    def dfs(G, v):
        seen[v] = True
        stack = deque([v])
        while stack:
            v = stack.pop()
            for next_v in G[v]:
                if seen[next_v]:
                    continue
                seen[next_v] = True
                ans[next_v] += ans[v]
                stack.append(next_v)

    # 頂点 0 をスタートとした探索
    dfs(G, 0)
    print(*ans)


resolve()
x = input()

if x[2] == x[3] && x[4] == x[5]:
  print("Yes")
else:
  print("No")



### FIXED CODE ###

x = input()

if x[2] == x[3] and x[4]==x[5]:
  print("Yes")
else:
  print("No")
#!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(raw_input())
a = raw_input().split(" ")
output = 0

a.sort()

for i in a[N:2*N]:
    output = output + int(i)

print output

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(raw_input())
a = raw_input().split(" ")
output = 0

b = []

for i in a:
    b.append(int(i))

b.sort(reverse=True)

for i in range(N):
    output = output + int(b[2*i+1])

print output
n,k = map(int,input().split())
a = list(map(int,input().split()))
s_d2 = set()
d2 = []
cur = 1
d2.append(1)
s_d2.add(1)
st_idx = 0
rp_lgt = 0
for i in range(n):
  cur = a[cur-1]
  if cur in s_d2:
    for j in range(len(d2)):
      if cur == d2[j] :
        st_idx = j - 1 
        rp_lgt = i - j + 1
        break
  else:
    d2.append(cur)
    s_d2.add(cur)
wk = k - st_idx
md = wk % rp_lgt
if k < st_idx:
  ans = d2[k]
else:
  ans = d2[md+st_idx]
#print(d2)
print(ans)


### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
d2 = []
hist=[-1]*(n+1)
hist[0] = 0
cur = 1
d2.append(1)
st_idx = 0
rp_lgt = 1
for i in range(n):
  cur = a[cur-1]
  if hist[cur-1] >= 0 :
     d2.append(cur)
     st_idx = hist[cur-1]
     rp_lgt = i - st_idx + 1 
     break
  else:
    d2.append(cur)
    hist[cur-1] = i + 1
wk = k - st_idx
md = wk % rp_lgt
if k < st_idx:
  ans = d2[k]
else:
  ans = d2[md+st_idx]
print(ans)
N = int(input())

P = list(range(2, N+1)) + [1]
I = range(1, N+1)

print(sum((i % p) for p, i in zip(P, I)))

### FIXED CODE ###

N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))
N=int(input())
T=list(map(int,input().split()))
TA=sum(T)
M=int(input())
for i in range(M):
  P,X=map(int,input().split())
  ans=TA+X-T[p-1]
  print(ans)


### FIXED CODE ###

N=int(input())
T=list(map(int,input().split()))
T_ALL=sum(T)
M=int(input())

for i in range(M):
  P,X=map(int,input().split())
  ans=T_ALL+X-T[P-1]
  print(ans)
import copy

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

num = copy.deepcopy(list(range(a, b + 1)))

a_k = num[:k]
k_e = num[-k:]

# print(a_k, k_e)
ans_set = set(a_k + k_e)
ans_list = copy.deepcopy(list(ans_set))
ans_list.sort()
for i in ans_list:
    print(i)


### FIXED CODE ###

a,b,k=map(int,input().split())
r=range(a,b+1)
for i in sorted(set(r[:k])|set(r[-k:])):
  print(i)
n = int(raw_input())
minv =  10**9
R[0] = 0
maxv = (-1)*10**9

for j in range(n-1):
    if minv >= R[j]:
       minv = R[j]
    if maxv <= R[j+1] - minv:
       maxv = R[j+1] - minv
print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9  

for j in range(n-1):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a

print maxv
s=list(input())
k=int(input())
count=0
word=""
for i in range(1,len(s)):
    if s[i]==s[i-1]:
        if i==len(s)-1:
            word=s[i]
        s[i]="A"
        count +=1

if s[0]==s[-1]:
    word=s[-1]
    s[-1]="A"
    count +=1

print((count*k)-1 if (s[-1]=="A")and(s[-2]!=word) else count*k)

### FIXED CODE ###

s=list(input())
k=int(input())
A,B,C=0,0,0
test=s*3
for i in range(len(s)*3-1):
    if test[i]==test[i+1]:
        test[i+1]="A"
A=test[:len(s)].count("A")
B=test[len(s):len(s)*2].count("A")
C=test[len(s)*2:len(s)*3].count("A")

if s.count(s[0])==len(s):
    print((len(s)*k)//2)
else:
    if k==1:print(A)
    elif k==2:print(A+B)
    else:print(A+B*(k-2)+C)
N = int(input())
l = [-1]*N
def triplets(n):
  counter = 0
  lower = 1
  upper = round((n-2)**0.5-1)
  for x in range(1, upper+1):
    y_upper = round(0.5*((4*n-3*x**2)**0.5-x))
    for y in range(1, y_upper+1):
      root = (4*n-3*x**2-3*y**2-2*x*y)**0.5
      z = 0.5*(root-x-y)
      if z%1==0 and z>0:
        counter += 1
  return counter
for m in range(1, N+1):
  if l[m-1] == -1:
    tmp = triplets(m)
    l[m-1] = tmp
    if tmp != 0:
      for k in range(2,round((N/m)**0.5)):
        l[m*k**2-1] = tmp
for x in l:
  print(x)

### FIXED CODE ###

N = int(input())
l = [0]*N
upper = round((N-1)**0.5-1)
for x in range(1, upper+1):
    for y in range(1, upper + 1):
        for z in range(1, upper + 1):
            tmp = x**2+y**2+z**2+x*y+y*z+z*x
            if tmp < N+1:
                l[tmp-1]+=1
for x in l:
    print(x)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from functools import lru_cache

n, k = map(int, read().split())


@lru_cache(None)
def check(n, k):
    a, b = divmod(n, 10)
    cnt = 0
    if k >= 1:
        cnt += check(a, k - 1) * b
        cnt += check(a - 1, k - 1) * (9 - b)
    cnt += check(a, b)
    return cnt


if n < 10:
    if k == 1:
        print(n)
    else:
        print(0)
else:
    print(check(n, k))


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from functools import lru_cache

n, k = map(int, read().split())


@lru_cache()
def check(n, k):
    if n < 10:
        if k == 0:
            return 1
        if k == 1:
            return n
        return 0
    a, b = divmod(n, 10)
    cnt = 0
    if k >= 1:
        cnt += check(a, k - 1) * b
        cnt += check(a - 1, k - 1) * (9 - b)
    cnt += check(a, k)
    return cnt


print(check(n, k))
# 標準入力
X, Y, A, B, C = map(int, input().split())
red = list(map(int,input().split()))
green = list(map(int,input().split()))
trans = list(map(int,input().split()))

red.sort(reverse=True)
green.sort(reverse=True)
trans.sort(reverse=True)
apple = red[:X] + green[:Y]
apple.sort(reverse=True)

j = 0
for i in range(X + Y):
    if apple[X + Y - i - 1] < trans[j]:
        apple[X + Y - i - 1] = trans[j]
        j = j + 1
        if j is C:
            break
    else:
        continue
print(sum(apple))    
            

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
red = list(map(int,input().split()))
green = list(map(int,input().split()))
trans = list(map(int,input().split()))

red.sort(reverse=True)
green.sort(reverse=True)
trans.sort(reverse=True)
apple = red[:X] + green[:Y]
apple.sort()

j = 0
for i in range(X + Y):
    if apple[i] < trans[j]:
        apple[i] = trans[j]
        j = j + 1
        if j == C:
            break
    else:
        continue
print(sum(apple))
A, B = list(map(int, input().split()))

def calc_num(N):
  if N % 4 == 1:
    return (1, 0)
  if N % 4 == 2:
    return (N, 1)
  if N % 4 == 3:
    return (0, 0)
  return (N, 0)

A, subA = calc_num(A-1)
B, subB = calc_num(B)

A = [int(i) for i in str(bin(A)).split("b")[1]]
B = [int(i) for i in str(bin(B)).split("b")[1]]
A[-1] += subA
A[-1] %= 2
B[-1] += subB
B[-1] %= 2

if len(B) > len(A):
  temp = [0] * (len(B)-len(A))
  temp.extend(A)
  A = temp
#print(A)
#print(B)

res = [((A[i]+B[i])%2)*2**i for i in range(len(A))]
#print(res)
print(sum(res))


### FIXED CODE ###

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

def calc_num(N):
  if N==0:
    return 0
  if N % 4 == 1:
    return 1
  if N % 4 == 2:
    return N ^ 1
  if N % 4 == 3:
    return 0
  return N ^ 0

A = calc_num(A-1)
B = calc_num(B)

print(A^B)
import copy
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)

for i in range(n):
    Y  = copy.deepcopy(y)
    Y.remove(x[i])
    print(Y[int(n/2 -1)])
  


### FIXED CODE ###

a, b, x = map(int, input().split())
if x<a: print('NO')
elif x>a+b: print('NO')
else:print('YES')
n, k = map(int, input().split())
scores = list(map(int, input().split()))
right = k - 1
left = right - k + 1
prev = 1
now = 0
for i in range(left, right + 1):
    prev *= scores[left]
left += 1
right += 1

while right < n:
    now = prev / (scores[left - 1]) * scores[right]
    if now > prev:
        print("Yes")
    else:
        print("No")
    
    prev, now = now, 1

    right += 1
    left += 1

### FIXED CODE ###

n, k = map(int, input().split())
scores = list(map(int, input().split()))
right = k
left = right - k + 1

while right < n:
    if scores[right] > scores[left-1]:
        print("Yes")
    else:
        print("No")

    right += 1
    left += 1
def main():
    def inputs():
        li = []
        string = input()
        count = 0
        while count < 201 and string != "":
            li.append(string)
            string = input()
            count += 1
        return li

    li = inputs()
    for x in li:
        a = x.split(" ")
        print(int(a[0]) + int(a[1]))
    return None

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    def inputs():
        li = []
        count = 0
        try:
            while count < 200:
                li.append(input())
                count += 1
        except EOFError:
            return li
        return li

    li = inputs()
    for x in li:
        a = x.split(" ")
        result = len(str(int(a[0]) + int(a[1])))
        print(result)
    return None

if __name__ == '__main__':
    main()
import math
a,b,c,d=map(int, input().split()) 

i = (b//c- a//c)
j = (b//d- a//d)

f=math.gcd(c,d)
f2= c * d / math.gcd(c, d)
k = b//f2 - a//f2

count = int(i + j - k)

print(b-a+1-count)

### FIXED CODE ###

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

i = b//c- (a-1)//c
j = b//d- (a-1)//d

f=fractions.gcd(c,d)
f2= int(c * d / f)
k = b//f2 - (a-1)//f2

pot = i + j - k

print(b-(a-1)-pot)
n = int(input())
c = input()

w = []
r = []
for i in range(n):
  if c[i] == 'W':
    w.append(i+1)
  else:
    r.append(i+1)

w_len = len(w)
r_len = len(r)
if w_len == 0 or r_len == 0:
  print(0)
  exit(0)

w_min = w[0]
r_max = r[r_len-1]
count = 0
for i in range(n):
  tmp = w[i]
  w[i] = r[r_len-i-1]
  r[r_len-i-1] = tmp
  count += 1
  
  w_min = w[count]
  r_max = r[r_len - count - 1]
  
  if r_max < w_min:
    print(count)
    exit(0)
print(count)

### FIXED CODE ###

n = int(input())
c = input()

w = []
r = []
for i in range(n):
  if c[i] == 'W':
    w.append(i+1)
  else:
    r.append(i+1)

w_len = len(w)
r_len = len(r)
if w_len == 0 or r_len == 0:
  print(0)
  exit(0)

if w_len < r_len:
  search = w_len
else:
  search = r_len

w_min = w[0]
r_max = r[r_len-1]

if r_max < w_min:
  print(0)
  exit(0)

count = 0
for i in range(search):
  tmp = w[i]
  w[i] = r[r_len-i-1]
  r[r_len-i-1] = tmp
  count += 1
  
  if w_len > count and (r_len-count-1) >= 0:
    w_min = w[count]
    r_max = r[r_len - count - 1]
  else:
    w_min = w[w_len-1]
    r_max = r[0]
    
  if r_max < w_min:
    print(count)
    exit(0)
print(count)
S = input()
pre = int(S[0:2])
af = int(S[2:4])
if 1 <= pre <= 12:
    preM = 1
else:
    preM = 0
if 1 <= af <= 12:
    afM = 1
else:
    afM = 0
if preM == 1:
    if afM == 1:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if afM == 1:
        ans = "YYMM"
    else:
        ans == "NA"
print(ans)

### FIXED CODE ###

S = input()
pre = int(S[0:2])
af = int(S[2:4])
if 1 <= pre <= 12:
    preM = 1
else:
    preM = 0
if 1 <= af <= 12:
    afM = 1
else:
    afM = 0
if preM == 1:
    if afM == 1:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if afM == 1:
        ans = "YYMM"
    else:
        ans = "NA"
print(ans)
s = int (input)

if s[0] == s[1] and s[2] == s[3] and s[0] ! = s[2]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3] and s[0] ! =s[1]:
        print('Yes')
elif s[0] == s[3] and s[1] == s[2] and s[0] ! =s[2]:
    print('Yes')
else:
    print('No')
        

### FIXED CODE ###

s = input()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3] and s[0] !=s[1]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2] and s[0] !=s[2]:
    print('Yes')
else:
    print('No')
z=0
a,b,c,k = map(int,input().split())
z=k-a
if z>=0:
    z=z-b
print(a+b*0+z*-1)



### FIXED CODE ###

s = input()
t = input()
if s == t[:-1]:
    print("Yes")
else:
    print("No")
import math 
from functools import reduce

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

print(reduce(math.gcd,A))

### FIXED CODE ###

from functools import reduce

N=int(input())
A=list(map(int,input().split()))
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
print(reduce(gcd,A))
r=[float(x) for x in input().split()]
print(float(r**2*math.pi),float(2*r*math.pi))


### FIXED CODE ###

from math import pi
r = float(input())
print("{:.010f} {:.010f}".format(r * r * pi, 2 * pi * r))
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
  if(abs(x[i])+abs(y[i]))%2!=(abs(x[0])+abs(y[0]))%2:
    print(-1)
    exit()
d=[]
for i in reversed(range(33)):d.append(1<<i)
d+=[1,1]
if(abs(x[0])+abs(y[0]))%2==0:d.append(1)
print(len(d))
print(*d)
for i in range(n):
  X,Y=x[i],y[i]
  s=''
  for d in d:
    if abs(X)>abs(Y):
      if X>0:
        X-=d
        s+='R'
      else:
        X+=d
        s+='L'
    else:
      if Y>0:
        Y-=d
        s+='U'
      else:
        Y+=d
        s+='D'
  print(s)

### FIXED CODE ###

n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
  if(abs(x[i])+abs(y[i]))%2!=(abs(x[0])+abs(y[0]))%2:
    print(-1)
    exit()
D=[]
for i in reversed(range(33)):D.append(1<<i)
D+=[1,1]
if(abs(x[0])+abs(y[0]))%2==0:D.append(1)
print(len(D))
print(*D)
for i in range(n):
  X,Y=x[i],y[i]
  s=''
  for d in D:
    if abs(X)>abs(Y):
      if X>0:
        X-=d
        s+='R'
      else:
        X+=d
        s+='L'
    else:
      if Y>0:
        Y-=d
        s+='U'
      else:
        Y+=d
        s+='D'
  print(s)
s = list(input())

ans = ""

for i in range(len(s)):
    if s[i] == "0":
        ans += "0"
    elif s[i] == "1":
        ans += "1"
    elif s[i] == "B":
        if len(ans) > 0:
            ans = ans.replace(ans[i-1], "", 1)
        else:
            pass

print(ans)


### FIXED CODE ###

s = list(input())

ans = ""
add = ""

for i in range(len(s)):
    if s[i] == "0":
        ans += "0"
    elif s[i] == "1":
        ans += "1"
    elif s[i] == "B":
            ans = ans[:-1]

if len(ans) == 0:
    for i in range(len(s)):
        if s[i] != "B":
            add = s[i]
    ans = add

print(ans)
# そのまま問題文の通りにやるだけ
n = int(input())
ans = 0
for i in range(n):
    if n % i == 0:
        if n % 2 == 1:
            ans += 1
print(ans)
    



### FIXED CODE ###

n = int(input())
ans = 0
i = 1
for i in range(1,n+1):
    eight = 0 
    if i % 2 == 1:
        for j in range(1,i+1):
            if i % j == 0:
                eight += 1

    if eight == 8:
        ans += 1

print(ans)
N = int(input())
S = [input().sort() for _ in range(N)]

from scipy.special import comb

def main():
    dic = {}
    ans = 0
    for s in S:
        if s in dic:
            dic[s] += 1
        else:
            dic[s] = 1
    for val in dic.values():
        if val > 1:
            ans += comb(val,2)
    print(ans)
    return

if __name__ == "__main__":
    main()


### FIXED CODE ###

N = int(input())
S = [input() for _ in range(N)]

Dic = [1]*N
prime = {"a":2,"b": 3, "c":5, "d":7,"e": 11,"f": 13,"g": 17,"h": 19,"i": 23,"j": 29,"k": 31,"l": 37,"m": 41, "n":43,"o": 47,"p": 53,"q": 59,"r": 61,"s": 67,"t": 71,"u": 73,"v": 79,"w": 83,"x": 89,"y": 97,"z":101}

from operator import mul
from functools import reduce

def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


for i in range(N):
    for s in S[i]:
        Dic[i]*= prime[s]

Dic.sort()
pre = Dic[0]
ans = 0
temp = 1
for d in Dic[1:]:
    if pre == d:
        temp += 1
    else:
        if temp >= 2:
            ans += comb(temp,2)
        pre = d
        temp = 1

ans += comb(temp,2) if temp >= 2 else 0
print(int(ans))