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

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

K = int(input())

tot = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            s = gcd(j, k)
            t = gcd(i, s)
            tot += t
print(tot)


### FIXED CODE ###

K = int(input())

GCD = [[0]*200 for i in range(200)]
def gcd(x, y):
    if GCD[x-1][y-1] == 0:
        if y == 0:
            return x
        else:
            return gcd(y, x % y)
    else:
        return GCD[x-1][y-1]

tot = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        s = gcd(i, j)
        if s != 1:
            for k in range(1, K+1):
                t = gcd(k, s)
                tot += t
        else:
            tot += K
print(tot)
### BUGGY CODE ###

def main():
	N, K, L = map(int, input().split())
	road = [0]*K
	rail = [0]*L
	road_graph = [[i, 1] for i in range(N+1)]
	rail_graph = [[i, 1] for i in range(N+1)]

	def root(graph, i):
		parent = graph[i][0]
		if parent == i:
			return i
		return root(graph, parent)

	def is_same_tree(graph, i, j):
		return root(graph, i) == root(graph, j)

	def unite(graph, i, j):
		if is_same_tree(graph, i, j):
			return
		l = graph[root(graph, i)]
		r = graph[root(graph, j)]
		if l[1] < r[1]:
			l[0] = r[0]
			r[1] += l[1]
		else:
			r[0] = l[0]
			l[1] += r[0]

	ans_list = [""]*N

	for i in range(K):
		road[i] = list(map(int, input().split()))
		unite(road_graph, road[i][0], road[i][1])
	for i in range(L):
		rail[i] = list(map(int, input().split()))
		unite(rail_graph, rail[i][0], rail[i][1])

	for i in range(1, N+1):
		both_connected = 1
		for j in range(1, N+1):
			if i == j:
				continue
			if is_same_tree(road_graph, i, j) and is_same_tree(rail_graph, i, j):
				both_connected += 1
		this_ans = str(both_connected)
		ans_list[i-1] = this_ans

	ans = " ".join(ans_list)
	print(ans)


if __name__ == '__main__':
	main()

### FIXED CODE ###

from collections import defaultdict
def main():
	N, K, L = map(int, input().split())
	road = [0]*K
	rail = [0]*L
	road_graph = [[i, 0] for i in range(N+1)]
	rail_graph = [[i, 0] for i in range(N+1)]

	def root(graph, i):
		parent = graph[i][0]
		if parent == i:
			return i
		return root(graph, parent)

	def is_same_tree(graph, i, j):
		return root(graph, i) == root(graph, j)

	def unite(graph, i, j):
		if is_same_tree(graph, i, j):
			return
		l = graph[root(graph, i)]
		r = graph[root(graph, j)]
		if l[1] < r[1]:
			l[0] = r[0]
			r[1] += 1
		else:
			r[0] = l[0]
			l[1] += 1

	ans_list = [""]*N

	for i in range(K):
		road[i] = list(map(int, input().split()))
		unite(road_graph, road[i][0], road[i][1])
	for i in range(L):
		rail[i] = list(map(int, input().split()))
		unite(rail_graph, rail[i][0], rail[i][1])

	ans_memo = defaultdict(int)
	road_memo = [0]*(N+1)
	rail_memo = [0]*(N+1)
	for i in range(1, N+1):
		road_root = root(road_graph, i)
		rail_root = root(rail_graph, i)
		road_memo[i] = road_root
		rail_memo[i] = rail_root
		ans_memo[(road_root, rail_root)] += 1

	for i in range(1, N+1):
		road_root = road_memo[i]
		rail_root = rail_memo[i]
		this_ans = str(ans_memo[road_root, rail_root])
		ans_list[i-1] = this_ans

	ans = " ".join(ans_list)
	print(ans)


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

s = input()
t = input()
len_s, len_t = len(s), len(t)
dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]
for index_s in range(len_s):
  char_s = s[index_s]
  dp_s = dp[index_s]
  dp_ss = dp[index_s + 1]
  for index_t in range(len_t):
    if char_s == t[index_t]:
      dp_ss[index_t + 1] = dp_s[index_t] + 1
    else:
      dp_ss[index_t + 1] = max(dp_s[index_t + 1], dp_ss[index_t])
index_s, index_t = len_s - 1, len_t - 1
lcs_reverse = []
len_lcs = dp_ss[-1]
while len_lcs > 0:
  if s[index_s] == t[index_t]:
    lcs_reverse.append(s[index_s])
    index_s -= 1
    index_t -= 1
    len_lcs -= 1
  elif dp[index_s][index_t + 1] == len_lcs:
    index_s -= 1
  else:
    index_t -= 1
print(''.join(lcs_reverse[::-1]))

### FIXED CODE ###

s = input()
t = input()
len_s, len_t = len(s), len(t)
dp = [[0] * (len_t + 1) for _ in range(len_s + 1)]
for index_s in range(len_s):
  char_s = s[index_s]
  dp_s = dp[index_s]
  dp_ss = dp[index_s + 1]
  for index_t in range(len_t):
    if char_s == t[index_t]:
      dp_ss[index_t + 1] = dp_s[index_t] + 1
    else:
      dp_ss[index_t + 1] = max(dp_s[index_t + 1], dp_ss[index_t])
index_s, index_t = len_s - 1, len_t - 1
lcs_reverse = []
len_lcs = dp_ss[-1]
while len_lcs > 0:
  if s[index_s] == t[index_t]:
    lcs_reverse.append(s[index_s])
    index_s -= 1
    index_t -= 1
    len_lcs -= 1
  elif dp[index_s][index_t + 1] == len_lcs:
    index_s -= 1
  else:
    index_t -= 1
print(''.join(lcs_reverse[::-1]))
### BUGGY CODE ###

from functools import reduce
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
max = 0
idx = 0
for i in range(len(p) - k + 1):
	if sum(p[i:i+k]) > max:
		max = sum(p[i:i+k])
		idx = i
lst = p[idx:idx+k]

total = 0
shokei = 0
for i, v in enumerate(lst):
	kake = lst[0:i]
	if i != k - 1:
		kake += lst[i+1:i+k+1]
	shokei = reduce(lambda a, b: a*b, kake, 1)
	for j in range(1, v + 1):
		total += j * shokei
waru = reduce(lambda a, b: a*b, lst)
print(total/waru)

### FIXED CODE ###

from functools import reduce
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
tmp_max = sum([i / 2 + 0.5 for i in p[0:k]])
tmp = tmp_max
idx = 0
for i in range(1, len(p) - k + 1):
	tmp -= p[i - 1] / 2 + 0.5
	if i + k - 1 < len(p):
		tmp += p[i + k - 1] / 2 + 0.5
	tmp_max = max(tmp_max, tmp)
print(tmp_max)
### BUGGY CODE ###

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

num_list = [0] * (max(a) + 2)

for i in range(n):
    num_list[a[i]] += 1
    if i == n:
        continue
    elif a[i] == 0:
        continue
    else:
        num_list[a[i]-1] += 1
    if i == 0 or a[i] == max(a):
        continue
    else:
        num_list[a[i]+1] += 1

print(max(num_list))

### FIXED CODE ###

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

t = max(a)
num_list = [0] * (t + 2)

for i in range(n):
    num_list[a[i]] += 1
    if a[i] == 0:
        continue
    else:
        num_list[a[i]-1] += 1
    if a[i] == t:
        continue
    else:
        num_list[a[i]+1] += 1

print(max(num_list))
### BUGGY CODE ###

n = int(input())
a_list = [int(x) for x in input().split()]

temp_list = sorted([(a, i) for i, a in enumerate(a_list)])

ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        if temp_list[i][0] + temp_list[j][0] >= n:
            break
        if temp_list[i][0] + temp_list[j][0] == abs(temp_list[i][1] - temp_list[j][1]):
            ans += 1
print(ans)

### FIXED CODE ###

from collections import defaultdict

n = int(input())

a_list = [int(x) for x in input().split()]

l = defaultdict(int)
r = defaultdict(int)
for i in range(n):
    l[i + a_list[i]] += 1
    r[i - a_list[i]] += 1

ans = 0
for x in l.keys():
    ans += l[x] * r[x]
print(ans)
### BUGGY CODE ###

import functools
import operator
M = 10**9 + 7
n, k = map(int, input().split())
if k == 1:
    print(0)
    __import__('sys').exit(0)
a = list(map(int, input().split()))
a.sort(reverse=True)

def mul(a, b):
    ans = a * b
    if ans >= M:
        ans %= M
    return ans

def powmod(a, n):
    if n == 0:
        return 1
    if n % 2:
        ans = a * powmod(a, n - 1)
    else:
        ans = powmod(a, n // 2) ** 2
    if ans >= M:
        ans %= M
    return ans

deno = functools.reduce(mul, range(n, n - (k - 1), -1))
nume = functools.reduce(mul, range(1, k))

max_sum = 0
min_sum = 0
for i, left in enumerate(range(n, k - 1, -1)):
    # print(deno // left * (left - (k - 1)))
    deno = deno * powmod(left, M - 2) * (left - (k - 1)) % M
    # print(deno // nume)
    c = deno * powmod(nume, M - 2) % M

    max_sum += c * a[i]
    min_sum += c * a[-(i + 1)]


print((max_sum - min_sum) % M)


### FIXED CODE ###

import functools
import operator
M = 10**9 + 7
n, k = map(int, input().split())
if k == 1:
    print(0)
    __import__('sys').exit(0)
a = list(map(int, input().split()))
a.sort(reverse=True)

def mul(a, b):
    return mod(a * b)

def powmod(a, n):
    if n == 0:
        return 1
    if n % 2:
        ans = a * powmod(a, n - 1)
    else:
        ans = powmod(a, n // 2) ** 2
    return mod(ans)

def mod(a):
    if a >= M:
        a %= M
    return a
deno = functools.reduce(mul, range(n, n - (k - 1), -1))
nume = functools.reduce(mul, range(1, k))

# max_sum = 0
# min_sum = 0
result = 0
for i, left in enumerate(range(n, k - 1, -1)):
    # print(deno // left * (left - (k - 1)))
    deno = mod(mod(deno * powmod(left, M - 2)) * (left - (k - 1)))
    # print(deno // nume)
    c = mod(deno * powmod(nume, M - 2))

    result += mod(c * a[i]) - mod(c * a[-(i + 1)])
    # max_sum += c * a[i]
    # min_sum += c * a[-(i + 1)]


# print((max_sum - min_sum) % M)
print(result % M)
### BUGGY CODE ###

# 解説放送
# 関数を切り分けたものはTLEした

def main():
    inf = 10 ** 18 + 1

    n, k = map(int, input().split())
    *a, = sorted(map(int, input().split()))

    def is_ok(x):
        """x未満の値はk個未満か"""
        tot = 0
        for a_ in a:
            if a_ < 0:
                l, r = -1, n
                while (r - l) > 1:
                    c = (l + r) // 2
                    if a[c] * a_ < x:
                        r = c
                    else:
                        l = c
                tot += n - r
            else:
                l, r = -1, n
                while (r - l) > 1:
                    c = (l + r) // 2
                    if a[c] * a_ < x:
                        l = c
                    else:
                        r = c
                tot += r
            if a_ * a_ < x:
                tot -= 1
        tot //= 2
        return tot < k

    l, r = -inf, inf
    while (r - l) > 1:
        x = (l + r) // 2
        if is_ok(x):  # x未満の値はk個未満か？
            l = x
        else:
            r = x
        # 「x未満がk個未満」であるxの最大値
    print(l)


if __name__ == '__main__':
    main()
    

### FIXED CODE ###

# https://maspypy.com/atcoder-%E5%8F%82%E5%8A%A0%E6%84%9F%E6%83%B3-2019-02-16abc-155#toc3
# https://atcoder.jp/contests/abc155/submissions/10152895
# 写経


# 条件を満たす要素を抽出
# ndarray[条件式]

def binary_search(*, ok, ng, func):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if func(mid):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    import sys
    import numpy as np

    inf = 10 ** 18 + 1
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = np.array(input().split(), dtype=np.int64)

    A.sort()

    zero = A[A == 0]
    pos = A[A > 0]
    neg = A[A < 0]

    def count(x):
        """
        定数cに対して Ai*Aj<=c となる(i,j)の数え上げ
        順序制約 i<j -> 順序制約のない(i,j)からi==jの場合の個数を引いて2で割る
        iを固定して a=Ai とする
        a=0
            ax=0(<=c?),解なしまたは任意のx
        a>0
            ax<=c
            <-> x<=c/a
            <-> x<=c//a
        a<0
            ax<=c
            <-> (-a)x>=(-c)

            否定をとり,aの対候補全体=Nから引く

            (-a)x<(-c)
            <-> (-a)x<=(-c-1)
            <-> x<=(-c-1)//(-a)
        """
        cnt = 0
        if x >= 0:
            cnt += zero.size * N  # (a:=0)*v<=x
        cnt += np.searchsorted(a=A, v=x // pos, side='right').sum()  # (a:>0)*v<=x
        cnt += (N - np.searchsorted(a=A, v=(-x - 1) // (-neg), side='right')).sum()  # (a:<0)*v<=x
        cnt -= ((A * A) <= x).sum()  # i==j
        assert cnt % 2 == 0
        return cnt // 2

    ans = binary_search(
        ng=-inf,
        ok=inf,
        func=lambda x: count(x) >= K
    )

    print(ans)


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

from collections import Counter
n = int(input())
ls = []
for _ in range(n):
    ls.append(input())
res = []
counter = Counter(ls).most_common(1)
check=counter[0][1]
for x in set(ls):
    if ls.count(x) == check:
        res.append(x)
print("\n".join(sorted(res)))

### FIXED CODE ###

from collections import Counter
n = int(input())
ls = []
for _ in range(n):
    ls.append(input())
res = []
counter = Counter(ls).most_common()
for x in counter:
    if x[1] == counter[0][1]:
        res.append(x[0])
print("\n".join(sorted(res)))
### BUGGY CODE ###

from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


# 間に合わない
a, b = MI()
binlen = len(bin(b)) - 2
ans = [0] * binlen
for i in range(a, b + 1):
    for j in range(binlen):
        ans[j] += i // (2 ** j)
num = ''
for i in ans:
    num = str(i & 1) + num
print(int(num, 2))


### FIXED CODE ###

from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


def f(n):
    if n == 0:
        return n
    elif n & 1:  # nが奇数
        return ((n // 2) & 1) ^ (n - 1) ^ n
    else:
        return ((n // 2) & 1) ^ n


a, b = MI()
print(f(a - 1) ^ f(b))
### BUGGY CODE ###

from collections import deque

s = list(input())
q = int(input())
d = deque(s)
flag = 1
for i in range(q):
    query = input().split()
    if query[0] == '1':
        flag = - flag
    elif query[0] == '2':
        if flag == 1:
            if query[1] == '1':
                d.appendleft(query[2])
            elif query[1] == '2':
                d.append(query[2])
        else:
            if query[1] == '1':
                d.append(query[2])
            elif query[1] == '2':
                d.appendleft(query[2])
if flag == -1:
    d.reverse()
ans = ''
l = len(d)
for i in range(l):
    ans += d[i]
print(ans)

### FIXED CODE ###

from collections import deque

d = deque(list(input()))
q = int(input())
flag = 1
for i in range(q):
    query = input().split()
    if query[0] == '1':
        flag = - flag
    elif query[0] == '2':
        if flag == 1:
            if query[1] == '1':
                d.appendleft(query[2])
            elif query[1] == '2':
                d.append(query[2])
        else:
            if query[1] == '1':
                d.append(query[2])
            elif query[1] == '2':
                d.appendleft(query[2])
if flag == -1:
    d.reverse()
print(''.join(list(d)))
### BUGGY CODE ###

#Beginner 048 C
import copy

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

lst1 = copy.copy(A)
cnt1 = 0
for i in range(N-1):
    while lst1[i] + lst1[i+1] > x:
        lst1[i] -= 1
        cnt1 += 1

lst2 = copy.copy(A)
cnt2 = 0
for j in range(N-1):
    while lst2[j] + lst2[j+1] > x:
        lst2[j+1] -= 1
        cnt2 += 1

if cnt1 >= cnt2:
    print(cnt2)
else:
    print(cnt1)

### FIXED CODE ###

# Beginner 50 C
N, x = map(int, input().split())
A = list(map(int, input().split()))
sum_s = sum(A)

for i in range(N-1):
    s = A[i] + A[i+1] - x
    if s > 0:
        A[i+1] = x - A[i]
        if A[i+1] >= 0:
            pass
        else:
            A[i] = A[i] + A[i+1]
            A[i+1] = 0
    else:
        pass

sum_e = sum(A)
print(sum_s - sum_e)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(4100000)
N = int(input())
tree = [[] for _ in range(N+1) ]
already_make = [-1]*(N+1)
for i in range(1,N):
    a,b = map(int,input().split(' '))
    tree[a].append([b,i])

last_color = 0
bfs_use_coler = [[] for _ in range(N+1)]

def solve(n,last_color):
    '''
    use_colers =[]
    for val in bfs_use_coler[0:n-2]:
        use_colers = use_colers + val
    '''
    for val in tree[n]:
        if already_make[val[1]] != -1:
            continue
        use_coloer = -1
        length = last_color+1
        for i in range(1,length):
            if i in bfs_use_coler[val[0]] or i in bfs_use_coler[n]:
                continue
            else:
                use_coloer = i
                break
        if use_coloer == -1:
            last_color +=1
            use_coloer = last_color
        bfs_use_coler[val[0]].append(use_coloer)
        bfs_use_coler[n].append(use_coloer)
        already_make[val[1]] = use_coloer
    return last_color

for i in range(1,N+1):
    last_color = solve(i,last_color)
print(last_color)
for val in already_make[1:N]:
    print(val)


### FIXED CODE ###

import sys
sys.setrecursionlimit(4100000)
N = int(input())
tree = [[] for _ in range(N+1) ]
already_make = [-1]*(N+1)
for i in range(1,N):
    a,b = map(int,input().split(' '))
    tree[a].append([b,i])

last_color = 0
#bfs_use_coler = [[ -1 for _ in range(N+1) ] for _ in range(N+1) ] 

def solve_bfs(previous_colors,n_list,last_color):
    '''
    use_colers =[]
    for val in bfs_use_coler[0:n-2]:
        use_colers = use_colers + val
    '''
    next_colors = []
    next_n_list =[]
    for idx1,n in enumerate(n_list):
        use_color_num = 1
        for idx2,val in enumerate(tree[n]):
            if use_color_num == previous_colors[idx1]:
                use_color_num += 1
            already_make[val[1]] = use_color_num
            next_colors.append(use_color_num)
            next_n_list.append(val[0])
            last_color = max(use_color_num,last_color)
            use_color_num += 1
    if len(next_colors) > 0:
        return solve_bfs(next_colors,next_n_list,last_color)
    else:
        return last_color

last_color = solve_bfs([0],[1],last_color)
print(last_color)
for val in already_make[1:N]:
    print(val)
### BUGGY CODE ###

N,M = map(int, input().split())
A = []
for a in range(M):
	A.append(int(input()))
	
DP = [0] * (N + 1)	
DP[0] = 1

mod = (10 ** 9) + 7

for i in range(1,N+1):
	if i in A:
		DP[i] = 0
	else:
		DP[i] = DP[i-1] + DP[i-2]

print(DP[N] % (mod))

### FIXED CODE ###

N,M = map(int, input().split())
A = [int(input()) for a in range(M)]
A = set(A)
	
DP = [0] * (N + 1)	
DP[0] = 1

mod = (10 ** 9) + 7

for i in range(1,N+1):
	if i in A:
		DP[i] = 0
	else:
		DP[i] = DP[i-1] + DP[i-2]

print(DP[N] % (mod))
### BUGGY CODE ###

#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    #output
    import numpy as np
    mod = 998244353
    dp = np.zeros((N+1, S+1), int)
    #dp[i, j]を、A[0]...A[i]までを使って、Tの空でない部分集合
    #{x_1, x_2, ..., x_k}であって、Ax_1 + A_x_2 + ... + A_x_k = jを満たすものの個数とする。
    dp[0, 0] = 1
    #iまででjが作られている時、i+1ではA[i]がどのような値であっても、部分集合としてjは作れる。
    #iまででjが作られない時、j-A[i]が作られていれば、A[i]を足せばjは作れる。
    for i in range(N):
        for j in range(S+1):
            dp[i+1, j] += dp[i, j] * 2 % mod
            if j >= A[i]:
                dp[i+1, j] += dp[i, j-A[i]]
                dp[i+1, j] %= mod
                    
    print(dp[N][S] % mod)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

### FIXED CODE ###

#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    #output
    mod = 998244353
    dp = [[0] * ( S+1) for _ in range(N+1)]
    #dp[i, j]を、A[0]...A[i]までを使って、Tの空でない部分集合
    #{x_1, x_2, ..., x_k}であって、Ax_1 + A_x_2 + ... + A_x_k = jを満たすものの個数とする。
    dp[0][0] = 1
    #iまででjが作られている時、i+1ではA[i]がどのような値であっても、部分集合としてjは作れる。
    #iまででjが作られない時、j-A[i]が作られていれば、A[i]を足せばjは作れる。
    for i in range(N):
        for j in range(S+1):
            dp[i+1][j] += dp[i][j] * 2 
            dp[i+1][j] %= mod
            if j >= A[i]:
                dp[i+1][j] += dp[i][j-A[i]]
                dp[i+1][j] %= mod
                    
    print(dp[N][S] % mod)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import collections
import math

N = int(input())

word_dict = []
num = [0 for _ in range(10**5)]

for i in range(N):
    s = [i for i in input()]
    count = collections.Counter(s)
    if count in word_dict:
        num[word_dict.index(count)] += 1
    else:
        word_dict.append(count)

ans = 0

for i in num:
    i += 1
    if i >= 3:
        ans = ans + (math.factorial(i) // (math.factorial(i - 2) * math.factorial(2)))
    elif i == 2:
        ans += 1
    else:
        continue

print(ans)


### FIXED CODE ###

import collections
import math

N = int(input())
word_dict = {}

ans = 0

for _ in range(N):
    s = input()
    s = "".join(sorted(s))
    if s in word_dict:
        ans += word_dict[s]
        word_dict[s] += 1
    else:
        word_dict[s] = 1
    
print(ans)
### BUGGY CODE ###

import sys
input=sys.stdin.readline

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

if d[0]!=0:
  print(0)
  exit()
  
kyori=[] #1からmaxdまでの距離について、それぞれ何個のdが該当するかメモした配列
maxd=max(d)

for i in range(0,maxd+1):
  kyori.append(d.count(i))

#1個目以外で距離0のやつある場合は停止。
if kyori[0]!=1:
  print(0)
  exit()

ans=1
for i in range(1,maxd):
  temp=kyori[i]**kyori[i+1]
  ans*=temp%998244353
  ans=ans%998244353
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline

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

if d[0]!=0:
  print(0)
  exit()

 #1からmaxdまでの距離について、それぞれ何個のdが該当するかメモした配列
maxd=max(d)
kyori=[0]*(maxd+1)

#計算量減らし、、
for i in d:
  kyori[i]+=1

#1個目以外で距離0のやつある場合は停止。
if kyori[0]!=1:
  print(0)
  exit()

ans=1
for i in range(1,maxd):
  temp=kyori[i]**kyori[i+1]
  ans*=temp%998244353
  ans=ans%998244353
print(ans)
### BUGGY CODE ###

N, X = map(int, input().split())
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
k = min(y)

for i in range(k):
    p = k -i
    z = [yi % p for yi in y]
    if sum(z) == 0:
        print(p)
        break


### FIXED CODE ###

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


N, X = map(int, input().split())
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = gcd(r, y[i+1])

print(r)
### BUGGY CODE ###

S=input()
T=input()
dp=[["" for j in range(len(T))] for i in range(len(S))]
for i in range(len(S)):
    for j in range(len(T)):
        if S[i]==T[j]:
            dp[i][j]=dp[max(i-1,0)][max(j-1,0)]+S[i]
        else:
            L=[dp[max(i-1,0)][max(j-1,0)],dp[max(i-1,0)][j],dp[i][max(j-1,0)]]
            L_len=[len(L[0]),len(L[1]),len(L[2])]
            dp[i][j]=L[L_len.index(max(L_len))]
print(dp[-1][-1])

### FIXED CODE ###

S=input()
T=input()
dp=[[0 for j in range(len(T)+1)] for i in range(len(S)+1)]
for i in range(len(S)):
    for j in range(len(T)):
        if S[i]==T[j]:
            dp[i+1][j+1]=dp[i][j]+1
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j])
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j+1])
i=len(S)
j=len(T)
ans=""
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans=S[i-1]+ans
        i-=1
        j-=1
print(ans)
### BUGGY CODE ###

n,k,q = map(int, input().split())
a = [int(input()) for i in range(q)]
for i in range(n):
    if 0 < k-q+a.count(i+1):
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

n,k,q = map(int, input().split())
p = [k-q]*n
for i in range(q):
    a = int(input())
    p[a-1] += 1
for j in p:
    if 0 < j:
        print('Yes')
    else:
        print('No')