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

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

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

mod = 10**9 + 7

A.sort()
# print(A)


def cmb(n, r):
    from operator import mul
    from functools import reduce

    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


ans = 0
num1=None
num2=None

for i in range(N):
    if N - i - 1 >= K-1:
        if num1 is None:
            num1 = cmb(N-i-1, K-1) % mod
        else:
            num1 = int(num1 * ((N-i-K+1) % mod) * pow(N-i, mod-2, mod))
        # print(N-i-1, K-1, num1)

        if A[i] * num1 < 0:
            ans += (-A[i] * num1) % mod
        else:
            ans -= (A[i] * num1) % mod
        # print(f'-: {i}, {num}, {A[i]}')
    if i >= K-1:
        if num2 is None:
            num2 = cmb(i, K-1) % mod
        else:
            num2 = num2 * (i % mod) * pow(i-K+1, mod-2, mod)
        # print(i, K-1, num2)

        if A[i] * num2 < 0:
            ans -= (-A[i] * num2) % mod
        else:
            ans += (A[i] * num2) % mod
        # print(f'+: {i}, {num}, {A[i]}')

print(ans % mod)


### FIXED CODE ###

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

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
mod = 10**9 + 7


class Cmb(object):
    def cmb_precalc(self, n, r, mod: int = 10 ** 9 + 7):
        if (r < 0) or (r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % mod

    def cmb_prep(self, N: int, mod: int = 10 ** 9 + 7):
        self.g1 = [1, 1]  # 元テーブル
        self.g2 = [1, 1]  # 逆元テーブル
        inverse = [0, 1]  # 逆元テーブル計算用テーブル

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


ans = 0
cmb = Cmb()
cmb.cmb_prep(N + 5)

for i in range(N):
    if i >= K-1:
        ans += A[i] * cmb.cmb_precalc(i, i-K+1)
    if N - i - 1 >= K-1:
        ans -= A[i] * cmb.cmb_precalc(N-i-1, K-1)

print(ans % mod)
### BUGGY CODE ###

n, k, q = map(int, input().split())
#print(n,k,q)
l = [0] * n
#print(l)
katen = []
for i in range(q):
    katen.append(int(input()))
#print(katen)
for j in katen:
    x = l.pop(j-1)
    l.insert(j-1, x+1)
#print(l)

for y in l:
    if y+k-q > 0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

n, k, q = map(int, input().split())
#print(n,k,q)
l = [0] * n
#print(l)
katen = []
my_append = katen.append
for i in range(q):
    my_append(int(input()))
#print(katen)

    
for j in katen:
    l[j-1] += 1 

    
#print(l)

for y in range(n):
    if l[y] > q-k:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

n = int(input())
s = input()
R,G,B = [],[],[]
for i in range(n):
    if s[i]=='R':
        R.append(i)
    elif s[i]=='G':
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
cnt = 0
for r in R:
    for g in G:
        if 2*r - g in B:
            cnt += 1
        if 2*g - r in B:
            cnt += 1
        if g>r:
            if (g-r)%2==0 and r+(g-r)//2 in B:  
                cnt += 1
        if r>g:
            if (r-g)%2==0 and g+(r-g)//2 in B:
                cnt += 1
print(ans - cnt)

### FIXED CODE ###

n = int(input())
s = input()
ans = s.count('R')*s.count('G')*s.count('B')
if ans==0:
    print(ans)
else:
    for i in range(n):
        for j in range(i+1, n):
            k=2*j-i
            if k<n:
                if s[i]!=s[j] and s[j]!=s[k] and s[i]!=s[k]:
                    ans -= 1
    print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
S = input()
src = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)]

outdeg = [set() for i in range(2*N)]
for x,y in src:
    if S[x] == S[y]:
        #A0->A1, B0->B1
        outdeg[x].add(y+N)
        outdeg[y].add(x+N)
    else:
        #A1->B0, B1->A0
        outdeg[x+N].add(y)
        outdeg[y+N].add(x)

mem = [0] * (2*N)
def visit(v):
    if mem[v] == 1:
        print('Yes')
        exit()
    if mem[v] == 0:
        mem[v] = 1
        for to in outdeg[v]:
            visit(to)
        mem[v] = 2

for i in range(2*N):
    visit(i)

print('No')

### FIXED CODE ###

import sys,time
sys.setrecursionlimit(10**7)

start_time = time.time()
N,M = map(int,input().split())
S = input()
src = [tuple(map(lambda x:int(x)-1,sys.stdin.readline().split())) for i in range(M)]

outdeg = [set() for i in range(2*N)]
for x,y in src:
    if S[x] == S[y]:
        #A0->A1, B0->B1
        outdeg[x].add(y+N)
        outdeg[y].add(x+N)
    else:
        #A1->B0, B1->A0
        outdeg[x+N].add(y)
        outdeg[y+N].add(x)

mem = [0] * (2*N)
def visit(v):
    if time.time() - start_time > 1.8:
        # gori~~~
        print('No')
        exit()
    if mem[v] == 1:
        print('Yes')
        exit()
    if mem[v] == 0:
        mem[v] = 1
        for to in outdeg[v]:
            visit(to)
        mem[v] = 2

for i in range(2*N):
    visit(i)

print('No')
### BUGGY CODE ###

n=int(input())
s=input()
if n<=3:
    print(0)
    exit()
r=[]
g=[]
b=[]
for i,c in enumerate(s):
    if c=='R':
        r.append(i)
    elif c=='G':
        b.append(i)
    else:
        g.append(i)
ans=0
for i in r:
    for j in g:
        for k in b:
            l=sorted([i,j,k])
            if l[1]-l[0]!=l[2]-l[1]:
                ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
if n<=3:
    print(0)
    exit()
r=set()
g=set()
b=set()
for i,c in enumerate(s):
    if c=='R':
        r.add(i)
    elif c=='G':
        b.add(i)
    else:
        g.add(i)
ans=0
lb=len(b)
for i in r:
    for j in g:
        t1=-1
        if abs(i-j)%2==0:
            t1=min(i,j)+abs(i-j)//2
        t2=max(i,j)+abs(i-j)
        t3=min(i,j)-abs(i-j)
        tc=0
        if t1 in b:
            tc+=1
        if t2 in b:
            tc+=1
        if t3 in b:
            tc+=1
        ans+=max(0,lb-tc)
print(ans)
### BUGGY CODE ###

def main():

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

    count = [0 for _ in range(N)]

    for i in range(N):
        Ai = A[i]
        for j in range(i+1, N):
            Aj = A[j]
            if Ai%Aj == 0:
                count[i] += 1
            if Aj%Ai == 0:
                count[j] += 1

    ans = 0
    for i in range(N):
        if count[i] == 0:
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():

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

    A = sorted(A)
    Amax = A[-1]
    count = [0 for _ in range(Amax+1)]

    for a in A:
        for i in range(1, Amax//a+1):
            count[i*a] += 1

    ans = 0
    for i in range(N):
        a = A[i]
        if count[a] == 1:
#            print(i)                                                                                                                                            
            ans += 1

    print(ans)

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

# 積が負で絶対値が T 以上の組合せ数を求める
# A, B は昇順
def count1(T, A, B):
	return count1_by_binsearch(T, A, B)
	
	if T <= 0 or len(A) == 0 or len(B) == 0:
		return 0

	count, it = 0, -1
	for i in range(len(A) - 1, -1, -1):
		while it + 1 < len(B) and A[i] * B[it + 1] < T:
			it += 1

		# A[i] * B[it], A[i] * B[it + 1], ... は条件を満たす
		count += len(B) - it - 1
	return count


# 積が正で絶対値が T 以下の組合せ数を求める
# 絶対値が T より大きいものの組合せ数を求めてから全体から引く
# A は昇順
def count2(T, A):
	count_all = len(A) * (len(A) - 1) // 2
	count = count1(T + 1, A, A)

	# A[i] * A[i] が余計にカウントされた分を減らす．
	for e in A:
		if e * e >= T + 1:
			count -= 1

	count /= 2 # 同じ配列を渡しているため (i, j) == (j, i) が二回カウントされる

	return count_all - count


def count1_by_binsearch(T, A, B):
	if T <= 0 or len(A) == 0 or len(B) == 0:
		return 0

	count = 0
	for i in range(len(A)):
		if A[i] * B[-1] < T:
			continue;
			
		ok, ng = len(B) - 1, -1
		while abs(ok - ng) > 1:
			mid = (ok + ng) // 2

			if A[i] * B[mid] >= T:
				ok = mid
			else:
				ng = mid
		count += len(B) - ok

	return count

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = list(map(int, input().split()))

	# X: 負の数の絶対値の配列
	# Y: 正の数の配列
	# Z: 0 の個数
	X, Y, Z = [], [], 0
	for e in A:
		if e < 0:
			X.append(-e)
		elif e > 0:
			Y.append(e)
		else:
			Z += 1
	X.sort()
	Y.sort()


	# 積が T 以下な組合せ数が K 未満か？
	def check(T):
		count = 0
		if T < 0:
			count += count1(abs(T), X, Y)
		else:
			count += len(X) * len(Y) # 結果が負
			count += Z * (Z - 1) // 2 + Z * (N - Z) # 結果が 0
			count += count2(T, X) + count2(T, Y)

		return count < K


	ok, ng = -10 ** 18, 10 ** 18
	while ng - ok > 1:
		mid = (ok + ng) // 2
		
		if check(mid):
			ok = mid
		else:
			ng = mid

	print(ok + 1)


### FIXED CODE ###

# 積が負で絶対値が T 以上の組合せ数を求める
# A, B は昇順
def count1(T, A, B):
	if T <= 0 or len(A) == 0 or len(B) == 0:
		return 0

	count, it = 0, -1
	for i in range(len(A) - 1, -1, -1):
		while it + 1 < len(B) and A[i] * B[it + 1] < T:
			it += 1

		# A[i] * B[it], A[i] * B[it + 1], ... は条件を満たす
		count += len(B) - it - 1
	return count


# 積が正で絶対値が T 以下の組合せ数を求める
# 絶対値が T より大きいものの組合せ数を求めてから全体から引く
# A は昇順
def count2(T, A):
	count_all = len(A) * (len(A) - 1) // 2
	count = count1(T + 1, A, A)

	# A[i] * A[i] が余計にカウントされた分を減らす．
	for e in A:
		if e * e >= T + 1:
			count -= 1

	count /= 2 # 同じ配列を渡しているため (i, j) == (j, i) が二回カウントされる

	return count_all - count


if __name__ == "__main__":
	N, K = map(int, input().split())
	A = list(map(int, input().split()))

	# X: 負の数の絶対値の配列
	# Y: 正の数の配列
	# Z: 0 の個数
	X, Y, Z = [], [], 0
	for e in A:
		if e < 0:
			X.append(-e)
		elif e > 0:
			Y.append(e)
		else:
			Z += 1
	X.sort()
	Y.sort()


	# 積が T 以下な組合せ数が K 未満か？
	def check(T):
		count = 0
		if T < 0:
			count += count1(abs(T), X, Y)
		else:
			count += len(X) * len(Y) # 結果が負
			count += Z * (Z - 1) // 2 + Z * (N - Z) # 結果が 0
			count += count2(T, X) + count2(T, Y)

		return count < K


	ok, ng = -10 ** 18, 10 ** 18
	while ng - ok > 1:
		mid = (ok + ng) // 2
		
		if check(mid):
			ok = mid
		else:
			ng = mid

	print(ok + 1)
### BUGGY CODE ###

def main():
    from collections import Counter
    import sys
    sys.setrecursionlimit(10 ** 7)
    readline = sys.stdin.readline

    n = int(readline())
    *a, = map(int, readline().split())

    ctr = Counter(a)

    def prob(c1, c2, c3):
        if memo[c1][c2][c3] != -1:
            return memo[c1][c2][c3]

        ret = n
        if c1 > 0:
            ret += c1 * prob(c1 - 1, c2, c3)
        if c2 > 0:
            ret += c2 * prob(c1 + 1, c2 - 1, c3)
        if c3 > 0:
            ret += c3 * prob(c1, c2 + 1, c3 - 1)
        ret /= c1 + c2 + c3

        memo[c1][c2][c3] = ret
        return ret

    memo = [[[-1] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
    memo[0][0][0] = 0

    ret = prob(*(ctr[k] for k in range(1, 3 + 1)))
    print(ret)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter

    n = int(input())
    a = tuple(int(x) for x in input().split())

    c = Counter(a)
    c1 = c[1]
    c2 = c[2]
    c3 = c[3]

    x1 = 310 ** 2
    x2 = 310

    dp = [0.0] * (310 ** 3)
    dp[0] = 0.0
    # dp[x * x1 + y * x2 + z]:=1,2,3個の皿がx,y,z残っているときの期待値

    for r3 in range(c3 + 1):
        d3 = c3 - r3
        for r2 in range(c2 + d3 + 1):
            for r1 in range(c1 + d3 + c2 - r2 + 1):
                ind = r1 * x1 + r2 * x2 + r3
                if ind != 0:
                    dp[ind] = (n \
                               + (dp[ind - x1] * r1 if r1 > 0 else 0) \
                               + (dp[ind + x1 - x2] * r2 if r2 > 0 else 0) \
                               + (dp[ind + x2 - 1] * r3 if r3 > 0 else 0)) \
                              / (r1 + r2 + r3)

    print(dp[c1 * x1 + c2 * x2 + c3])


if __name__ == '__main__':
    main()

# dp[now] =
# 1
# + dp[1個の皿を食べた] * p
# + dp[2個の皿を食べた] * p
# + dp[3個の皿を食べた] * p
# + dp[0個の皿を食べた==now] * p

# if mainの追加
# 初期値None->-1.0にした
# checked配列を辞めた
# チェック済みかどうかの判定を-1.0と一致するかの比較にした

# カウントはCounterを使う方が速い
# 1次元にした
# resの加算を複数回に分けると
# 三項演算子より遅くなる
# 再帰関数を辞めた
### BUGGY CODE ###

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

import fractions
from functools import reduce

for i in range(sorted(a)[1]+1, 0, -1):
  x = 0
  for j in a:
    if j % i != 0:
      x += 1
  if x <= 1:
    print(i)
    break

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
end = sorted(a)[1]

for i in range(end+1, 0, -1):
  x = 0
  for j in a:
    if j % i != 0:
      x += 1
    if x >= 2:
      break
  if x <= 1:
    print(i)
    break
### BUGGY CODE ###

n,m = map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())
ans = [1]*(n+1)
for i in range(1,n+1):
    if i in a:
        ans[i] = 0
    elif i == 1:
        continue
    else:
        ans[i] = (ans[i-1]+ans[i-2])%1000000007
print(ans[n])

### FIXED CODE ###

n, m = map(int, input().split())
mod = 10**9 + 7
dp = [1]*(n+1)
 
for _ in range(m):
    a = int(input())
    dp[a] = 0
 
for i in range(2, n+1):
    if dp[i]>0:
        dp[i] = (dp[i-1]+dp[i-2])%mod
 
print(dp[n])
### BUGGY CODE ###

N = int(input())
seq = list(input())
# print(seq)

import itertools
combination = list(itertools.combinations(seq, 3))

print(len(set(combination)))

### FIXED CODE ###

#三井住友信託銀行プログラミングコンテスト2019-D
N = int(input())
S = input()
ans = 0

possible_pass = [str(i).zfill(3) for i in range(1000)]

for password in possible_pass:
    try:
        first_num = S.index(password[0])
        S_second = S[first_num+1:]
        second_num = S_second.index(password[1])
        S_third = S_second[second_num+1:]
        third_num = S_third.index(password[2])
        ans += 1
    except:
        continue
    
print(ans)
### BUGGY CODE ###

l, r = map(int, input().split())
m = 2019

flg = False
for i in range(l, r):
    for j in range(l+1, r+1):
        if i*j%2019 == 0:
            flg = True
            break
        elif i*j%2019 < m:
            m = i*j%2019

if flg == True:
    print(0)
else:
    print(m)

### FIXED CODE ###

l, r = map(int, input().split())

if (r-l)//2019 >= 1:
    print(0)
else:
    ans = float('inf')
    for i in range(l, r+1):
        for j in range(l, r+1):
            if i != j:
                ans = min(ans, (i*j)%2019)

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

# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    a,b,k=map(int,input().split())
    l=[i for i in range(a,b+1)]

    ans=[]
    if k>b-a+1:
        ans=[_ for _ in range(a,b+1)]
        for i in sorted(ans):
            print(i)
    else:
        for i in range(a,a+k):
            ans.append(i)
        for j in range(b,b-1-(k-1),-1):
            ans.append(j)


        for i in sorted(set(ans)):
            print(i)


resolve()


### FIXED CODE ###

# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

    ans=[]
    if k>=b-a+1:
        for i in range(a,b+1):
            print(i)
    else:
        for i in range(a,a+k):
            ans.append(i)
        for j in range(b-k+1,b+1):
            if j not in ans:
                ans.append(j)


        for i in ans:
            print(i)


resolve()
### BUGGY CODE ###

N = int(input())
ratios = [[i for i in map(int,input().split())] for j in range(N)]

ans_a = 0
ans_t = 0
ratio = ratios.pop(0)
ans_a = ratio[0]
ans_t = ratio[1]

for ratio in ratios:
  
  i = min(ans_a // ratio[0], ans_t // ratio[1])
  
  while True:
    temp_a = ratio[0]*i
    temp_t = ratio[1]*i
    if temp_a >= ans_a and temp_t >= ans_t:
      ans_a = temp_a
      ans_t = temp_t
      break
    i += 1
    
print(ans_a + ans_t)

### FIXED CODE ###

N = int(input())
ratios = [[i for i in map(int,input().split())] for j in range(N)]

ans_a = 0
ans_t = 0
ratio = ratios.pop(0)
ans_a = ratio[0]
ans_t = ratio[1]

for ratio in ratios:
  i = max(ans_a // ratio[0], ans_t // ratio[1])
  while True:
    temp_a = ratio[0]*i
    temp_t = ratio[1]*i
    if temp_a >= ans_a and temp_t >= ans_t:
      ans_a = temp_a
      ans_t = temp_t
      break
    i += 1
    
print(ans_a + ans_t)
### BUGGY CODE ###

n = input()
t = len(n)
total = 0
for i in range(t-4):
    for j in range(i+4,t):
        k = (n[i:j+1])
        l = int(k)
        if l%2019 == 0:
            total += 1
            break

print(total)

### FIXED CODE ###

S = input()[::-1]
ans = 0
mods = [0] * 2019
mods[0] = 1
current = 0
x = 1
for s in S:
    current = (current + x * int(s)) % 2019
    ans += mods[current % 2019]
    mods[current % 2019] += 1
    x = x * 10 % 2019
print(ans)
### BUGGY CODE ###

# coding: utf-8
n,m=map(int,input().split())
v=[[0 for i in range(n)] for i in range(n)]
used=[[0 for i in range(n)] for i in range(n)]
cost_table=[[99999999 for i in range(n)] for i in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    v[a-1][b-1]=1
    v[b-1][a-1]=1
    cost_table[a-1][b-1]=c
    cost_table[b-1][a-1]=c

init_cost_table=[]
for i in range(n):
    init_cost_table.append(cost_table[i][:])

for i in range(n):
    for j in range(n):
        for k in range(n):
            if cost_table[i][k]>cost_table[i][j]+cost_table[j][k]:
                cost_table[i][k]=cost_table[i][j]+cost_table[j][k]
    cost_table[i][i]=0

def Path(start,goal):
    cur = start;
    while cur != goal:
        for i in range(n):
            if (i != cur and init_cost_table[cur][i] + cost_table[i][goal] == cost_table[cur][goal]):
                used[cur][i]=1
                cur = i
                break

for i in range(n):
    for j in range(n):
        if i==j:
            continue
        Path(i,j)
ans=0
for i in range(n):
    ans+=sum(v[i])
for i in range(n):
    ans-=sum(used[i])
print(ans//2)



### FIXED CODE ###

import sys

sys.setrecursionlimit(100000)
input=lambda : sys.stdin.readline().rstrip('\n')

n,m=map(int,input().split())
g=[[]for i in range(n)]
s=set()
for i in range(m):
    a,b,c=map(int,input().split())
    g[a-1].append((c,b-1))
    g[b-1].append((c,a-1))
    if a>b:
        a,b=b,a
    s.add((a-1,b-1))

def dijkstra(g,st,s):
    from heapq import heappush, heappop, heapify
    inf=10**18
    dist=[inf for i in range(len(g))]
    visited=[False for i in range(len(g))]
    dist[st]=0
    que=[]
    heappush(que,(0,st,-1))
    while que:
        c,v,past=heappop(que)
        if visited[v]:
            continue
        visited[v]=True
        try:
            s.remove((v,past) if v<past else (past,v))
        except:
            pass
        for x in g[v]:
            tmp=x[0]+c
            if tmp<dist[x[1]] and not visited[x[1]]:
                dist[x[1]]=tmp
                heappush(que,(tmp,x[1],v))

for i in range(n):
    dijkstra(g,i,s)
print(len(s))
### BUGGY CODE ###

r,g,b,n=map(int,input().split())
rr=0
ans=0
while rr*r<=n:
    gg=0
    while rr*r+gg*g<=n:
        if (n-(rr*r+gg*g))%b == 0:
            ans+=1
        gg+=1
    rr+=1
print(ans)

### FIXED CODE ###

r,g,b,n=map(int,input().split())
rr=0
ans=0
while rr*r<=n:
    gg=0
    while rr*r+gg*g<=n:
        if (n-(rr*r+gg*g))%b == 0:
            ans+=1
        gg+=1
    rr+=1
print(ans)
### BUGGY CODE ###

N = int(input())
data = []
for i in range(N):
    data.append(''.join(sorted(list(input()))))

cnt = 0

for i in range(N):
    for j in range(i+1, N):
        if data[i] == data[j]:
            cnt += 1

print(cnt)


### FIXED CODE ###

N = int(input())
dic = {}
cnt = 0

for i in range(N):
    k = ''.join(sorted(list(input())))
    if k in dic:
        cnt += dic[k]
        dic[k] += 1
    else:
        dic[k] = 1

print(cnt)
### BUGGY CODE ###

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

cnt = 0
for i in range(N - 1):
  s = sorted(S[i])
  for j in range(i + 1, N):
    if s == sorted(S[j]):
      cnt += 1
print(cnt)

### FIXED CODE ###

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

for i in range(N):
  S[i] = "".join(sorted(S[i]))

ans = {}
for i in range(N):
  if S[i] in ans:
    ans[S[i]] += 1
  else:
    ans[S[i]] = 1

cnt = 0
for a in ans:
  cnt += ans[a] * (ans[a] - 1) // 2
print(cnt)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
jyunban = []
for i in range(n):
    jyunban.append(a.index(i+1)+1)
for i in range(n):
    print(jyunban[i], end = " ")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
jyunban = [0 for i in range(n)]
for i in range(n):
    jyunban[a[i]-1] += i+1
for i in range(n):
    print(jyunban[i], end = " ")
### BUGGY CODE ###

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

    e = 0
    for i in range(a,b+1,1):
        if not i % c == 0:
            if not i % d == 0:
                e += 1

    print(e)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import fractions

def lcm(p,q):
    return (p*q) // fractions.gcd(p,q)

def g(x,k):
    return x // k

def f(x,c,d):
    return x - (g(x,c)+g(x,d)-g(x,lcm(c,d)))

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

print(f(b,c,d)-f(a-1,c,d))
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(K):
        m = True
        a = [0] * N
        t = 0
        for i in range(N):
            t += a[i] + 1
            if i + A[i] + 1< N:
                a[i + A[i] + 1] -= 1
            a[i] = t
        t = 0
        b = [0] * N
        for i in reversed(range(N)):
            t += b[i]
            b[i] = t
            t += 1
            if i - A[i] - 1 >= 0:
                b[i - A[i] - 1] -= 1
            A[i] = a[i] + b[i]
            if a[i] < N:
                m = False
        if m:
            break
    return A

print(*main())


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(K):
        m = True
        a = [0] * N
        t = 0
        for i in range(N):
            t += a[i] + 1
            if i + A[i] + 1< N:
                a[i + A[i] + 1] -= 1
            a[i] = t
        t = 0
        b = [0] * N
        for i in reversed(range(N)):
            t += b[i]
            b[i] = t
            t += 1
            if i - A[i] - 1 >= 0:
                b[i - A[i] - 1] -= 1
            A[i] = a[i] + b[i]
            if A[i] < N:
                m = False
        if m:
            break
    return A

print(*main())
### BUGGY CODE ###

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

if 0.5 * M < N:
    print(1)

else:
    i = N
    while i < M//2+1:
        if M % i == 0:
            print(M // i)
            exit()
        i += 1

    print(1)


### FIXED CODE ###

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


def get_divisor(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if n // i != i:
                divisors.append(n // i)

    return sorted(divisors)


divisors = get_divisor(M)
for d in divisors:
    if d >= N:
        print(M // d)
        exit()

print(1)
### BUGGY CODE ###

import numpy as np

n, k, q = map(int, input().split())
a = []
for i in range(q):
    a.append(int(input()))

players_score = np.array([k for i in range(n)])
for item in a:
    players_score -= 1
    players_score[item-1] += 1

indict = ['No' if i <= 0 else 'Yes' for i in players_score ]

for i in indict:
    print(i)


### FIXED CODE ###

import numpy as np

n, k, q = map(int, input().split())
a = np.array([int(input()) for i in range(q)])

players_score = np.full(n, k-q)

for item in a:
    players_score[item-1] += 1

for i in players_score:
    if i <= 0:
        print("No")
    else:
        print("Yes")