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

N=int(input())
S={input() for i in range(N)}
count=0
for x in S:
    for y in S-{x}:
        for z in S-{x,y}:
            A={x[0],y[0],z[0]}
            if len(A)==3 and A<={'M','A','R','C','H'}:
                count+=1
print(int(count/6))

### FIXED CODE ###

N=int(input())
S=[input() for i in range(N)]
m=len([s for s in S if s[0]=='M'])
a=len([s for s in S if s[0]=='A'])
r=len([s for s in S if s[0]=='R'])
c=len([s for s in S if s[0]=='C'])
h=len([s for s in S if s[0]=='H'])
count=0
march=[m,a,r,c,h]
for x in range(0,3):
    for y in range(x+1,4):
          for z in range(y+1,5):
                count+=march[x]*march[y]*march[z]
print(count)
### BUGGY CODE ###

N = int(input())
V = list(map(int,input().split()))
V1 = V[::2]
V2 = V[1::2]
V1_s = list(set(V1))
V2_s = list(set(V2))
S1 = len(V1_s)
S2 = len(V2_s)
if S1 == 1 and S2 == 1:
  if V1[0] != V2[0]:
    print(0)
  else:
    print(len(V) // 2)
else:
  tmp = 0
  ans = 0
  for i in range(S1):
    tmp = max(tmp,V1.count(V1_s[i]))
  ans += len(V1) - tmp
  tmp = 0
  for i in range(S2):
    tmp = max(tmp,V2.count(V2_s[i]))
  ans += len(V2) - tmp
  print(ans)

### FIXED CODE ###

N = int(input())
V = list(map(int,input().split()))
V1 = V[::2]
V2 = V[1::2]
V1_s = list(set(V1))
V2_s = list(set(V2))
S1 = len(V1_s)
S2 = len(V2_s)
if S1 == 1 and S2 == 1:
  if V1[0] != V2[0]:
    print(0)
  else:
    print(len(V) // 2)
else:
  V1_l = [0] * ((10 ** 5) + 1)
  V2_l = [0] * ((10 ** 5) + 1)
  for i in range(N // 2):
    V1_l[V1[i]] += 1
  for i in range(N // 2):
    V2_l[V2[i]] += 1
  S1_MAX = [V1_l.index(max(V1_l)),max(V1_l)]
  S2_MAX = [V2_l.index(max(V2_l)),max(V2_l)]
  if S1_MAX[0] != S2_MAX[0]:
    print(N - S1_MAX[1] - S2_MAX[1])
  else:
    V2_l.pop(S2_MAX[0])
    S2_MAX_s = [V2_l.index(max(V2_l)),max(V2_l)]
    ans1 = N - S1_MAX[1] - S2_MAX_s[1]
    V1_l.pop(S1_MAX[0])
    S1_MAX = [V1_l.index(max(V1_l)),max(V1_l)]
    ans2 = N - S1_MAX[1] - S2_MAX[1]
    print(min(ans1,ans2))
### BUGGY CODE ###

k,s = map(int,input().split())
count = 0
for i in range(k+1):
    for j in range(k+1):
        for t in range(k+1):
            if (i+j+t) == s:
                count += 1
print(count)

### FIXED CODE ###

k,s = map(int,input().split())
count = 0

for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            count += 1

print(count)
### BUGGY CODE ###

#!/usr/bin/env python
import numpy as np

def main():
    S = input()
    
    lenS = len(S)
    N = 13
    DP = np.zeros(N, dtype=np.int64)
    DP[0] = 1
    
    mod = 10 ** 9 + 7
    mul = 1
    for i in reversed(range(lenS)):
        nextDP = np.zeros(N, dtype=np.int64)
        c = S[i]
        if c == '?':
            for k in range(10):
                for j in range(N):
                    nextDP[(k * mul + j) %N] += DP[j]
                    nextDP[(k * mul + j) %N] %= mod

        else:
            k = int(S[i])
            for j in range(N):
                nextDP[(k * mul + j) %N] += DP[j]
                nextDP[(k * mul + j) %N] %= mod

        mul *= 10
        mul %= N
        DP = nextDP

    return DP[5]

if __name__ == '__main__':
    print(main())



### FIXED CODE ###

#!/usr/bin/env python

def main():
    S = input()
    
    lenS = len(S)
    N = 13
    DP = [0] * N
    DP[0] = 1
    
    mod = 10 ** 9 + 7
    mul = 1
    for i in reversed(range(lenS)):
        nextDP = [0] *13
        c = S[i]
        if c == '?':
            for k in range(10):
                for j in range(N):
                    nextDP[(k * mul + j) %N] += DP[j]
                    nextDP[(k * mul + j) %N] %= mod

        else:
            k = int(S[i])
            for j in range(N):
                nextDP[(k * mul + j) %N] += DP[j]
                nextDP[(k * mul + j) %N] %= mod

        mul *= 10
        mul %= N
        DP = nextDP

    return DP[5]

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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    mt = [None] * N

    for s in range(A[0] * 2, -1, -2):
        mt[0] = s
        for n in range(N-1):
            if mt[n] > A[n+1] * 2:
                break
            mt[n+1] = (A[n+1] - mt[n]//2) * 2

        if mt[N-1] != None:
            if mt[N-1] //2 + mt[0] // 2 == A[0]:
                print(mt[-1], ' '.join(list(map(str, mt[:-1]))))
                return

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
    X = [None] * len(A)
    X[0] = sum(A) - 2 * sum([A[i] for i in range(1, len(A), 2)])
    for i in range(len(A)-1):
        X[i+1] = 2 * A[i] - X[i]
    
    print(' '.join(list(map(str, X))))
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

#python D-Partition.py
"""
入力フォーマット
N M

出力:a_1+...+a_N=Mを満たす数列aについてmax(GCD(a_1,...,a_N))
"""
import math
line = list(map(int, input().split(" ")))
N = int(line[0])
M = int(line[1])

for i in range(math.floor(M/N),0,-1):
	tmp = M-i*(N-1)
	if tmp%i==0:
		print(i)
		break


### FIXED CODE ###

from math import sqrt

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

divisor = set([])
for i in range(1,int(sqrt(M))+1):
	if M % i == 0:
		if i <= int(M / N):
			divisor.add(i)
		if (M // i) <= int(M / N):
			divisor.add(M // i)

print(max(divisor))
### BUGGY CODE ###

from collections import deque
import copy
def bfs():
    h,w = map(int, input().split())
    maze = [list(input()) for i in range(h)]
    S, G = [], []
    for y in range(h):
        for x in range(w):
            if maze[y][x]=='.':
                S.append([y,x])
                G.append([y,x])
                maze[y][x]=float("inf")
    ans = 0
    for i in range(len(S)):
      for j in range(i+1, len(G)):
        maze1 = copy.deepcopy(maze)
        maze1[S[i][0]][S[i][1]]=0
        que=deque([[S[i][0],S[i][1]]])
        while que:
          y,x=que.popleft()
          for k,m in [(1,0),(0,1),(-1,0),(0,-1)]:
            nexty,nextx=y+k,x+m
            if nexty < 0 or nexty >= h or nextx < 0 or nextx >= w:
                continue
            dist=maze1[nexty][nextx]
            if dist!='#':
              if dist>maze1[y][x]+1:
                maze1[nexty][nextx]=maze1[y][x]+1
                if nexty == G[j][0] and nextx == G[j][1]:
                  break
                que.append([nexty,nextx])
        ans = max(ans, maze1[G[j][0]][G[j][1]])
    print(ans)
bfs()

### FIXED CODE ###

from collections import deque
import copy
def bfs():
    h,w = map(int, input().split())
    maze = [list(input()) for i in range(h)]
    S, G = [], []
    for y in range(h):
        for x in range(w):
            if maze[y][x]=='.':
                S.append([y,x])
                G.append([y,x])
                maze[y][x]=float("inf")
            else:
                maze[y][x]=-1
    l = []
    ans = 0
    for i in range(len(S)):
        maze1 = copy.deepcopy(maze)
        maze1[S[i][0]][S[i][1]]=0
        que=deque([[S[i][0],S[i][1]]])
        while que:
          y,x=que.popleft()
          for k,m in [(1,0),(0,1),(-1,0),(0,-1)]:
            nexty,nextx=y+k,x+m
            if nexty < 0 or nexty >= h or nextx < 0 or nextx >= w:
                continue
            dist=maze1[nexty][nextx]
            if dist!=-1:
              if dist>maze1[y][x]+1:
                maze1[nexty][nextx]=maze1[y][x]+1
                que.append([nexty,nextx])
            ans = max(ans, maze1[nexty][nextx])
    print(ans)
bfs()
### BUGGY CODE ###

N, M = map(int, input().split())
A = list([int(input()) for i in range(M)])

stairs = [1] * (N+1)
for i in reversed(range(N+1)):
    if i in A:
        stairs[i] = 0
        continue

    one_step, two_step = 1, 0
    if stairs[i+1:i+2]:
        one_step = stairs[i+1]
    if stairs[i+2:i+3]:
        two_step = stairs[i+2]

    stairs[i] = one_step + two_step
print(stairs[0] % 1000000007)

### FIXED CODE ###

import sys
max_num = 1000000007
input = sys.stdin.readline
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

stairs = [1] * (N+1)
for i in A:
    stairs[i] = 0

for i in range(1, N):
    if stairs[i+1] != 0:
        stairs[i+1] = stairs[i] + stairs[i-1]
print(stairs[N] % max_num)
### BUGGY CODE ###

N=int(input())
a=[int(input()) for i in range(N)]
ls=[]
mi=10**10
for elem in a:
  upd_flg=0
  if elem <= mi:
    ls.append(elem)
    mi=elem
    continue
  for i in range(len(ls)):
    if elem > ls[i]:
      ls[i]=elem
      upd_flg=1
      break
  if upd_flg==0:
    ls.append(elem)
    mi=elem
print(len(ls))

### FIXED CODE ###

import sys
input = sys.stdin.readline
import bisect
N = int(input())
a = [-int(input()) for i in range(N)]
ls = []
res = 0
for elem in a:
    idx = bisect.bisect_right(ls,elem)
    if idx == res:
        ls.append(elem)
        res += 1
    else:
        ls[idx] = elem
print(res)
### BUGGY CODE ###

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def logical_and(lst, l, r):
    res = []
    for i in range(l, r+1):
        if i in lst:
            res.append(i)
    return res

def solve():
    n, m = MI()

    l, r = MI()
    ans = list(range(l, r+1))
    for _ in range(m-1):
        l, r = MI()
        ans = logical_and(ans, l, r)
    print(len(ans))


if __name__ == '__main__':
    solve()


### FIXED CODE ###

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def solve():
    n, m = MI()

    maxl, minr = MI()
    for _ in range(m-1):
        l, r = MI()
        if maxl < l:
            maxl = l
        if r < minr:
            minr = r
    if maxl <= minr:
        print(minr - maxl + 1)
    else:
        print(0)

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

import sys
input = sys.stdin.readline

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

ans = 1
for i in range(n):
    ans *= A[i]

if ans > 10**18:
    ans = -1
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

ans = 1
for i in range(n):
    ans *= A[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)
### BUGGY CODE ###

def gcd(a, b):
	if a > b:
		a, b = b, a
	if a % b == 0:
		return b
	while a % b != 0:
		c = a% b
		a, b = b, c
	else:
		return c

def lcmCalc(x, y):
	return (x * y) // gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

str1 = ""
for i in range(lcm):
	str1 += "-"

for i in range(n):
	index = i * lcm // n + 1
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = i * lcm // m + 1
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print("-1")
		flg = 1
		break

if flg == 0:
	print(lcm)

### FIXED CODE ###

def gcd(a, b):
	if a > b:
		a, b = b, a
	if a % b == 0:
		return b
	while a % b != 0:
		c = a% b
		a = b
		b = c
	else:
		return c

def lcmCalc(x, y):
	return (x * y) // gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

# str1 = ""
# for i in range(lcm):
# 	str1 += "-"

flg = 0
for i in range(n):
	index = i * lcm // n + 1
	if (index - 1) % (lcm // m) == 0:
		j = (index - 1) // (lcm // m)
		if s[i] != t[j]:
			print("-1")
			flg = 1
			break
if flg == 0:
	print(lcm)


# 	str1 = str1[:index] + s[i] + str1[index+1:]

# flg = 0
# for i in range(m):
# 	index = i * lcm // m + 1
# 	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
# 		print("-1")
# 		flg = 1
# 		break

# if flg == 0:
# 	print(lcm)
### BUGGY CODE ###

N, L, T = [int(i) for i in input().split()]

ants = list(map(lambda x: [x[0] * 2, x[1]], [[int(i) for i in input().split()] for j in range(N)]))

for i in range(T * 2):
	for j in range(N):
		if ants[j][1] == 1:
			if ants[j][0] == 2 * L - 1:
				ants[j][0] = 0
			else:
				ants[j][0] += 1
			if j == N - 1:
				if ants[0][0] == ants[j][0]:
					ants[0][1] = 1
					ants[j][1] = 2
		else:
			if ants[j][0] == 0:
				ants[j][0] = 2 * L - 1
			else:
				ants[j][0] -= 1
			if j != 0:
				if ants[j - 1][0] == ants[j][0]:
					ants[j - 1][1] = 2
					ants[j][1] = 1

for i in range(N):
	print(ants[i][0] // 2)

### FIXED CODE ###

N, L, T = map(int, input().split())
X = []
W = []
for _ in range(N):
    x, w = map(int, input().split())
    X.append(x)
    if w == 2:
        w = -1
    W.append(w)

C = 0
for i in range(1, N):
    if W[i] != W[0]:
        C += T // (L / 2)
        if W[0] == 1:
            D = X[i] - X[0]
        else:
            D = X[0] + L - X[i]
        if T % (L / 2) * 2 >= D:
            C += 1

for i in range(N):
    X[i] = (X[i] + T * W[i]) % L

x = X[0]

X.sort()

ng = -1
ok = N
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if X[mid] >= x:
        ok = mid
    else:
        ng = mid
if W[0] == 1 and ok < N-1:
    if X[ok] == X[ok+1]:
        ok += 1

start = int((ok - C * W[0]) % N)
for i in X[start:]:
    print(i)
for i in X[:start]:
    print(i)
### BUGGY CODE ###

N, T = map(int, input().split())
AB = []
for i in range(N):
  A, B = map(int, input().split())
  AB.append([A, B])

AB.sort()

dp = [[0 for t in range(T)] for i in range(N+1)]

ans = 0
for i, ab in enumerate(AB):
  ans = max(ans, dp[i][T-1] + ab[1])
  for t in range(T):
    if t < ab[0]:
      dp[i+1][t] = dp[i][t]
    else:
      dp[i+1][t] = max(dp[i][t-ab[0]] + ab[1], dp[i][t])

print(ans)

### FIXED CODE ###

N, T = map(int, input().split())
AB = []
for i in range(N):
  A, B = map(int, input().split())
  AB.append([A, B])

AB.sort()

dp = [[0 for t in range(T)] for i in range(N+1)]

ans = 0
for i, ab in enumerate(AB):
  ans = max(ans, dp[i][T-1] + ab[1])
  for t in range(T):
    if t < ab[0]:
      dp[i+1][t] = dp[i][t]
    else:
      dp[i+1][t] = max(dp[i][t-ab[0]] + ab[1], dp[i][t])

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

def f1(l1):
    ret = []
    for i in l1:
      for n,j in enumerate(li[i]):
        if j == 1:
            if n in used or n in l1:
                return False
            elif n not in tree[nest-1]:
                ret.append(n)
    return list(set(ret))


N = int(input())
li = []
for _ in range(N):
    li.append(list(map(int,list(input()))))
    
max_nest = 0
for i in range(N):
    tree = [[]]
    used = []
    tree.append([i])
    nest = 1
    while True:
        ret = f1(tree[nest])
        nest += 1
        if ret == False:
            break
        elif ret != []:
            tree.append(ret)
            used.extend(tree[nest-2])
        else:
            if max_nest < nest:
                max_nest = nest
            break
        
print(max_nest-1)

### FIXED CODE ###

def f1(l1):
    ret = []
    for i in l1:
      for n,j in enumerate(li[i]):
        if j:
            if n in used or n in l1:
                return False
            elif n not in tree[nest-1] and n not in ret:
                ret.append(n)
    return ret


N = int(input())
li = []
for _ in range(N):
    li.append(list(map(int,list(input()))))
    
max_nest = 0
for i in range(N):
    tree = [[]]
    used = []
    tree.append([i])
    nest = 1
    while True:
        ret = f1(tree[nest])
        nest += 1
        if ret == False:
            break
        elif ret != []:
            tree.append(ret)
            used.extend(tree[nest-2])
        else:
            if max_nest < nest:
                max_nest = nest
            break
        
print(max_nest-1)
### BUGGY CODE ###

a,b,k = map(int,input().split())
for i in range(1,b+1):
    if (a<=i and b>=i) and (abs(a-i)<k or b-i<k):
        print(i)


### FIXED CODE ###

a,b,k = map(int,input().split())
if b-a<2*k:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
### BUGGY CODE ###

k=int(input())
import fractions
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        an=fractions.gcd(i,j)
        for s in range(1,k+1):
            anse=fractions.gcd(s,an)
            ans+=anse
print(ans)

### FIXED CODE ###

k=int(input())
from math import gcd
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for s in range(1,k+1):
            ans+=gcd(gcd(i,j),s)
print(ans)
### BUGGY CODE ###

s=input()
k=int(input())
ans=[]
for i in range(1,len(s)+1):
    ans=ans+list(set([s[x:x+i] for x in range(len(s)-i+1)]))
print(sorted(ans)[k-1])

### FIXED CODE ###

s=input()
k=int(input())
moji=sorted(list(set(s)))
ans=[moji[0]]
mojinum=0
if k==1:
    print(ans[0])
    import sys
    sys.exit()
while(True):
    for r in range(len(moji)):
        if ans[-1]+moji[r] in s:
            ans.append(ans[-1]+moji[r])
            break
        elif r==len(moji)-1:
            mojinum+=1
            ans.append(moji[mojinum])
    if len(ans)>=k:
        break
print(ans[k-1])
### BUGGY CODE ###

def actual(N, M, AB):
    count = 0
    payment = 0

    while count < M:
        AB = [x for x in AB if x[1] > 0]
        m = min(AB, key=lambda x: x[0])

        payment += m[0]
        m[1] -= 1
        count += 1

    return payment

N, M = map(int, input().split())
AB = []
for _ in range(N):
  a, b = map(int, input().split())
  AB.append([a, b])
  
print(actual(N, M, AB))

### FIXED CODE ###

def actual(N, M, AB):
    payment = 0

    shop_order_by_price_desc = sorted(AB, key=lambda x: x[0])

    for price, stock in shop_order_by_price_desc:
        if stock >= M:
            # 端数があるときは、残りの必要分だけ買えばよい
            return payment + (price * M)
        else:
            # 端数がないなら買い切る
            M -= stock
            payment += price * stock


N, M = map(int, input().split())
AB = []
for _ in range(N):
    a, b = map(int, input().split())
    AB.append([a, b])

print(actual(N, M, AB))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
sumlist = []
for i in range(N-1):
  sumlist.append(sum(A[-(i+1):]))
ans = 0
for i in range(N-1):
  ans += A[i]*sumlist[N-2-i]
print(ans%(1000000007))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
sumlist = [0]
for i in range(N-1):
  sumlist.append(sumlist[i]+A[N-1-i])
ans = 0
for i in range(N-1):
  ans += A[i]*sumlist[N-1-i]
print(ans%(1000000007))
### BUGGY CODE ###

x,k,d=map(int, input().split())
for i in range(k):
  if x>=0:
    x=x-d
  else:
    x=x+d
print(abs(x))

### FIXED CODE ###

x,k,d=map(int, input().split())
if abs(x)//d>=k:
    #print("ひ")
    print(abs(x)-d*k)
elif (k-abs(x)//d)%2==0:
    #print("fu")
    print(abs(x)%d)
else:
    #print("mi")
    print(d-abs(x)%d)
### BUGGY CODE ###

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

B = [max(A[i:]) for i in range(1, N)]

ans = 0
maxv = 0
for i in range(N-1):
    z = B[i] - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

print(ans)

### FIXED CODE ###

N, T = map(int, input().split())
A = list(map(int, input().split()))
B = A[::-1]
C = []

maxv = 0
for i in range(N):
    if maxv > B[i]:
        C.append(maxv)
    else:
        maxv = B[i]
        C.append(maxv)

C = C[::-1]

ans = 0
maxv = 0
for i in range(N-1):
    z = C[i] - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

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

import sys
input = sys.stdin.readline
import numpy as np
from numba import njit


def read():
    K = int(input().strip())
    S = input().strip()
    return K, S


def binom_preprocess(n, MOD=10**9+7):
    f = [0 for i in range(n+1)]  # n!
    invf = [0 for i in range(n+1)]  # (n!)^-1
    f[0] = 1
    f[1] = 1
    invf[0] = 1
    invf[1] = 1
    for i in range(2, n+1):
        f[i] = f[i-1] * i % MOD
    invf[n] = pow(f[n], MOD-2, MOD)
    for i in range(n, 2, -1):
        invf[i-1] = invf[i] * i % MOD
    return f, invf


def binom(n, k, f, invf, MOD=10**9+7):
    if n < k or n < 0 or k < 0:
        return 0
    else:
        return (f[n] * invf[k] % MOD) * invf[n-k] % MOD


def solve(K, S, MOD=10**9+7):
    T = len(S)
    f, invf = binom_preprocess(K+T+1)
    ans = 0
    for i in range(K+1):
        L = pow(25, i, MOD) * binom(T-1+i, i, f, invf, MOD) % MOD
        R = pow(26, K-i, MOD)
        ans += L * R
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline


def read():
    K = int(input().strip())
    S = input().strip()
    return K, S


def binom_preprocess(n, MOD=10**9+7):
    f = [0 for i in range(n+1)]  # n!
    invf = [0 for i in range(n+1)]  # (n!)^-1
    f[0] = 1
    f[1] = 1
    invf[0] = 1
    invf[1] = 1
    for i in range(2, n+1):
        f[i] = f[i-1] * i % MOD
    invf[n] = pow(f[n], MOD-2, MOD)
    for i in range(n, 2, -1):
        invf[i-1] = invf[i] * i % MOD
    return f, invf


def binom(n, k, f, invf, MOD=10**9+7):
    if n < k or n < 0 or k < 0:
        return 0
    else:
        return (f[n] * invf[k] % MOD) * invf[n-k] % MOD


def solve(K, S, MOD=10**9+7):
    T = len(S)
    f, invf = binom_preprocess(K+T+1)
    ans = 0
    for i in range(K+1):
        ans += pow(25, i, MOD) * binom(T-1+i, i, f, invf, MOD) * pow(26, K-i, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
### BUGGY CODE ###

N=int(input())
A=[int(x) for x in input().split()]
#重複始点終点調査
se=[]
for i in range(len(A)):
  if A[i]==sum(A)-N*(N+1)/2:
    se.append(i)

mod=10**9+7
 
#階乗計算
factorial=[1]
for i in range(1,N+2):
    factorial.append(factorial[i-1]*i %mod)
#逆元計算
inverse=[0]*(N+2)
inverse[N+2-1] = pow(factorial[N+2-1], mod-2,mod)
for i in range(N+2-2, -1, -1):
    inverse[i] = inverse[i+1] * (i+1) % mod
#combination計算
def nCr(n,r):
  if n<r or n==0 or r==0:
    return 0
  return factorial[n] * inverse[r] * inverse[n-r] % mod

print(N)
if N==1:
  print(N)
else:
  for i in range(1,N+1):
    print(int(nCr(N+1,i+1)-nCr(se[0]+N-se[1],i))%mod)

### FIXED CODE ###

N=int(input())
A=[int(x) for x in input().split()]
#重複始点終点調査
se=[]
c=sum(A)-N*(N+1)/2
for i in range(len(A)):
  if A[i]==c:
    se.append(i)
l=se[0]
r=se[1]

mod=10**9+7
 
#階乗計算
factorial=[1]
inverse=[1]
for i in range(1,N+2):
    factorial.append(factorial[-1]*i %mod)
    inverse.append((pow(factorial[i], mod-2, mod)))
#combination計算
def nCr(n,r):
  if n<r or n==0 or r==0:
    return 0
  return factorial[n] * inverse[r] * inverse[n-r] % mod

print(N)
for i in range(2,N+2):
    print(int(nCr(N+1,i)-nCr(l+N-r,i-1))%mod)
### BUGGY CODE ###

import math
import fractions
from functools import reduce

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())

list = list(map(int,input().split()))
ans2 = 0

for i in range(N):
  l = list[0:i]
  
  if -(N-i)+1 == 0:
    r = []
  else:
    r = list[-(N-i)+1:]
    
  if l == []:
    ans = gcd_list(r)
  elif r == []:
    ans = gcd_list(l)
  else:
    a = gcd_list(r)
    b = gcd_list(l)
    ans = gcd(a, b)
    
  ans2 = max(ans2,ans)
  
print(ans2)

### FIXED CODE ###

import math
import fractions
from functools import reduce

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())

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

a = List[0]
L = [0 for i in range(N)]
L[0] = a
for i in range(1,N):
  L[i] = gcd(List[i],L[i-1])
  
a = List[-1]
R = [0 for i in range(N)]
R[0] = a
for i in range(1,N):
  R[i] = gcd(List[-i-1],R[i-1])


p = 0
for i in range(N):
  if i == 0:
    ans = R[N-2]
  elif i == N-1:
    ans = L[-2]
  else:
    a = L[i-1]
    b = R[N-i-2]
    ans = gcd(a,b)
  p = max(p,ans)
  
print(int(p))