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

N = int(input())

ans = 0
ctable = [[-1 for _ in range(10)] for _ in range(10)]

def c(x, y):
    cnt = 0
    strx = str(x)
    stry = str(y)
    for i in range(1, N+1):
        stri = str(i)
        if stri[0] == strx and stri[-1] == stry:
            cnt += 1
    return cnt

for i in range(10):
    for j in range(10):
        ctable[i][j] = c(i, j)

for i in range(10):
    for j in range(10):
        ans += ctable[i][j] * ctable[j][i]

print(ans)


### FIXED CODE ###

N = int(input())

cnt = 0
for i in range(1, N+1):
    first = str(i)[0]
    last = str(i)[-1]
    if first == last:
        cnt += 1
    if last != '0':
        if len(str(N)) == 2:
            if int(last+first) <= N:
                cnt += 1
        if len(str(N)) >= 3:
            for j in range(len(str(N))-2):
                cnt += 10**j
            middle = str(N)[1:-1]
            if last < str(N)[0]:
                cnt += 10**(len(str(N))-2)
            elif last == str(N)[0]:
                if first > str(N)[-1]:
                    cnt += int(middle)
                else:
                    cnt += int(middle) + 1

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

H,W = map(int, input().split())
grid = []
for i in range(H):
    grid.append(input())
horiz = [[0]*W for _ in range(H)]
for i in range(H):
    cur = 0
    for j in range(W):
        if grid[i][j] == '#':
            for k in range(cur, j):
                horiz[i][k] = j-cur
            cur = j+1
    for k in range(cur, W):
        horiz[i][k] = W-cur

maxv = 0
for c in range(W):
    cur = 0
    besth = 0
    for r in range(H):
        if grid[r][c] == '.':
            besth = max(besth, horiz[r][c])
        else:
            maxv = max(maxv, r-cur + besth - 1)
            cur = r+1
            besth = 0
    maxv = max(maxv, H-cur + besth - 1)

print(maxv)

### FIXED CODE ###

H,W = map(int, input().split())
grid = []
for i in range(H):
    grid.append(input())
horiz = [[None]*W for _ in range(H)]
horiv = [[] for _ in range(H)]
for i in range(H):
    cur = 0
    for j in range(W):
        if grid[i][j] == '.':
            horiz[i][j] = len(horiv[i])
        else:
            horiv[i].append(j - cur)
            cur = j + 1
    horiv[i].append(W-cur)

maxv = 0
for c in range(W):
    cur = 0
    besth = 0
    for r in range(H):
        if grid[r][c] == '.':
            besth = max(besth, horiv[r][horiz[r][c]])
        else:
            maxv = max(maxv, r-cur + besth - 1)
            cur = r+1
            besth = 0
    maxv = max(maxv, H-cur + besth - 1)

print(maxv)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
from collections import Counter
import numpy as np
c=Counter(A)
c_np=np.array(c.most_common())#リストにいったん変換しないと。
#Sx=Σmin(ci,x)を求める
#SxもDxもNまで作れば十分
Dx=[0] #D_0は使わない。インデックスの調整用
for i in range(1,N+1):
    target=c_np[c_np[:,1]>=i]
    Dx.append( len(target) )
#i以上の部分の個数はこれで決まり
Sx=[0]#初項は0
for j in range(1,N+1):
    Sx.append(Sx[j-1]+Dx[j])

#Sxが作れたので、xに関して二分探索をする
for k in range(1,N+1):
    x_min=0
    x_max=N+1
    while x_max>x_min+1:
        x_mid=(x_max+x_min)//2
        if Sx[x_mid]>=k*x_mid:
            x_min=x_mid
        else:
            x_max=x_mid
    print(x_min)

### FIXED CODE ###

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

c = [0] * (N + 1)
Dx = [0] * (N + 1)
for a in A:
    c[a] += 1 #cは、aという数が出た回数を記録
    Dx[c[a]]+=1
    #Dxは、その回数のところに種類を記録。賢い。

Sx=[0]#初項は0
for j in range(1,N+1):
    Sx.append(Sx[j-1]+Dx[j])
#解法2を真似してみる。
for h in range(1,N+1):
    Sx[h]=Sx[h]/h

x=N
k=1
while k<N+1:
    if x<0:
        for _ in range(N-k+1):
            print(0)
        exit(0)
    if k<=Sx[x]:
        print(x)
        k+=1
    else:
        x-=1
### BUGGY CODE ###

n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(list(map(int,input().split())))
a.sort()
#print(a)
d=[]
for i in range(m):
    if a[i][0]==1:
        d.append(a[i][1])
    else:
        break
for i in range(len(d)):
    if [d[i],n] in a:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
#print([d[0],n])

### FIXED CODE ###

n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(list(map(int,input().split())))
a.sort()
#print(a)
d=[]
for i in range(m):
    if a[i][0]==1:
        d.append(a[i][1])
    else:
        break
e=[]
for i in range(m):
    if a[i][1]==n:
        e.append(a[i][0])
if len(set(e) & set(d))!=0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

import sys

input = sys.stdin.readline

def main():
    ans = 0
    mod = (10**9)+7
    n = int(input())
    a = list(map(int, input().split()))
    for i in a:
        i %= mod
    for i in range(n-1):
        for j in range(i+1, n):
            ans +=  a[i]*a[j]
    print(ans%mod)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

input = sys.stdin.readline

def main():
    ans = 0
    mod = (10**9)+7
    n = int(input())
    a = list(map(int, input().split()))
    suma = sum(a)
    for i in range(n-1):
        suma -= a[i]
        ans += a[i]*suma
    print(ans%mod)

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

N = int(input())
S = input()

#条件1を満たす(i,j,k)の組→R,G,Bの選び方
r,g,b = S.count('R'),S.count('G'),S.count('B')

ans = r*g*b

for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if j-i == k-j and S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                ans -= 1

print(ans)                


### FIXED CODE ###

N = int(input())
S = input()

#条件1を満たす(i,j,k)の組→R,G,Bの選び方
r,g,b = S.count('R'),S.count('G'),S.count('B')

ans = r*g*b

for i in range(N):
    for j in range(i+1,N):
        k = 2*j - i
        if k >= N:
            break
        else:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                ans -= 1

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

# -*- coding: utf-8 -*-
n = int(input())
s = input()
#a = [int(i) for i in input().split()]

ans = 0
for k in range(3, n + 1):
    for j in range(2, k):
        for i in range(1, j):
            if s[i-1] != s[j-1] and s[i-1] != s[k-1] and s[j-1] != s[k-1] and j - i != k - j:
                ans += 1
print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import collections
n = int(input())
s = list(input())

c = collections.Counter(s)
total = c['R'] * c['G'] * c['B']
tmp = 0
#print(total)
for i in range(1, n - 1):
    for j in range(i + 1, n):
        k = 2 * j - i
        if i <= k <= n:
            #print(i, j, k)
            if s[i-1] != s[j-1] and s[i-1] != s[k-1] and s[j-1] != s[k-1]:
                tmp += 1
print(total - tmp)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0 for _ in range(n)]

for i in range(1, n):
    dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
    for j in range(2, k + 1):
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

print(dp[-1])

### FIXED CODE ###

# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    dp[i] = min([pdp + abs(h[i] - ph) for pdp, ph in zip(dp[l:r], h[l:r])])

print(dp[-1])
### BUGGY CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

n, k = map(int, input().split())
s = str(input())

u = s + s[::-1]
ss = s

times = min(n, k)
for i in range(times):
    for j in range(n):
        part = u[j:j+n]
        if u[j:j+n] < ss:
            ss = part
    s = ss
    u = s[::-1] + s

print(s)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

n, k = map(int, input().split())
s = str(input())

u = s + s[::-1]
ss = s

if n < k**2:
    smallest = sorted(s)[0]
    print(smallest * n)

else:
    times = min(n, k)
    for i in range(times):
        for j in range(n):
            part = u[j:j+n]
            if part < ss:
                ss = part
        s = ss
        u = s[::-1] + s
    print(s)
### BUGGY CODE ###

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

ret = 0
for i in range(1, n+1):
    if p[i-1] == min(p[:i]):
        ret += 1

print(ret)


### FIXED CODE ###

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

ret = 1
min_num = p[0]
for i in range(1, n):
    if min_num > p[i]:
        ret += 1
        min_num = p[i]

print(ret)
### BUGGY CODE ###

import bisect
import sys
def main():
    input = sys.stdin.readline
    s = input()[:-1]
    t = input()[:-1]
    S = "abcdefghijklmnopqrstuvwxyz"
    A = [[] for k in range(26)]
    for k in range(len(s)):
        A[S.index(s[k])].append(k+1)
    ans = 0
    now = 0
    for k in range(len(t)):
        if len(A[S.index(t[k])]) == 0:
            print(-1)
            exit(0)
        if max(A[S.index(t[k])]) <= now:
            ans += len(s)
            now = min(A[S.index(t[k])])
        else:
            for l in range(len(A[S.index(t[k])])):
    #            print(A[S.index(t[k])][l]>now)
                if A[S.index(t[k])][l] > now:
                    now = A[S.index(t[k])][l]
                    break
    print(ans+now)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from bisect import bisect_right as bisect
def main():
    input = sys.stdin.readline
    s = input()[:-1]
    t = input()[:-1]
#    S = "abcdefghijklmnopqrstuvwxyz"
    A = [[] for k in range(26)]
    for k in range(len(s)):
        A[ord(s[k])-97] += [k+1]
    ans = 0
    now = 0
    for k in range(len(t)):
        a = ord(t[k]) - 97
        if len(A[a]) == 0:
            print(-1)
            exit(0)
        if A[a][-1] <= now:
            ans += len(s)
            now = A[a][0]
        else:
            now = A[a][bisect(A[a],now)]
    print(ans+now)

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

# -*- coding: utf-8 -*-
MOD = 10**9+7
s = input()
n = len(s)

dp = [[0]*13 for _ in range(n+1)]
dp[0][0] = 1
b = 1
for i in range(1,n+1):
    if s[n-i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(j*b+k)%13] += dp[i-1][k]
    else:
        j = int(s[n-i])
        for k in range(13):
            dp[i][(j*b+k)%13] += dp[i-1][k]
    for k in range(13):
        dp[i][k] %= MOD
    b *= 10
    b %= 13

print(dp[n][5]%MOD)

### FIXED CODE ###

# -*- coding: utf-8 -*-
MOD = 10**9+7
s = input()
n = len(s)

dp = [[0]*13 for _ in range(n+1)]
dp[0][0] = 1
b = 1
for i in range(1,n+1):
    if s[n-i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(j*b+k)%13] += dp[i-1][k]
    else:
        j = int(s[n-i])
        for k in range(13):
            dp[i][(j*b+k)%13] += dp[i-1][k]
    for k in range(13):
        dp[i][k] %= MOD
    b *= 10
    b %= 13

print(dp[n][5]%MOD)
### BUGGY CODE ###

s=input()
n=len(s)
R=[[[0]*13 for _ in range(10)] for __ in range(13)]
for i in range(13):
  for j in range(10):
    for k in range(13):
      R[i][j][k]=(k-i*j)%13

DP=[[0]*13 for _ in range(n+1)]
DP[0][0]=1
for i in range(n):
  r=pow(10,n-1-i,13)
  if s[i]=="?":
    for k in range(13):
      DP[i+1][k]=sum(DP[i][R[r][j][k]] for j in range(10))
  else:
    for k in range(13):
      DP[i+1][k]=DP[i][R[r][int(s[i])][k]]
print(DP[n][5]%(10**9+7))

### FIXED CODE ###

mod=10**9+7
s=input()
n=len(s)
R=[[[0]*13 for _ in range(10)] for __ in range(13)]
for i in range(13):
  for j in range(10):
    for k in range(13):
      R[i][j][k]=(k-i*j)%13

P=[0]*(n+1)
P[0]=1
for i in range(n):
  P[i+1]=(P[i]*10)%13

DP=[[0]*13 for _ in range(n+1)]
DP[0][0]=1
for i in range(n):
  r=P[n-1-i]
  if s[i]=="?":
    for k in range(13):
      DP[i+1][k]=sum(DP[i][R[r][j][k]] for j in range(10))
      DP[i+1][k]%=mod
  else:
    for k in range(13):
      DP[i+1][k]=DP[i][R[r][int(s[i])][k]]
      DP[i+1][k]%=mod
print(DP[n][5]%mod)
### BUGGY CODE ###

N = int(input())
As = list(map(int,input().split()))
c = int(As[0])
f = True
for x in range(N):
  if 0 in As:
    print("0")
    f = False
    break
  if x == 0:
    continue
  c = int(c) * int(As[x])
  if 1000000000000000001 <= c:
    print("-1")
    f = False
    break
if f:
  print(c)


### FIXED CODE ###

N = int(input())
As = list(map(int,input().split()))
c = int(As[0])
i = 0
f = True
if 0 in As:
  print("0")
else:
  for x in As:
    if i == 0:
      i += 1
      continue
    c = c * x 
    if 1000000000000000001 <= c:
      print("-1")
      f = False
      break
  if f:
    print(c)
### BUGGY CODE ###

A, B, N = list(map(int,input().split()))
Max=(-1)*A
for x in range(N+1):
  S= A*x//B
  T=x//B
  ans= S-A*T
  Max=max(Max,ans)

print(Max)
  



### FIXED CODE ###

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

x = min(N,B-1)
print(A*x//B)
### BUGGY CODE ###

N=int(input())
A=[0]*N
for i in range(N):
    A[i]=int(input())

j=0
ans=0
count=[0]*N
while j!=1:
    ans+=1
    j=A[j]-1
    count[ans]=j
    if count.count(j)>=2:
        ans=-1
        break

print(ans)

### FIXED CODE ###

N=int(input())
A=[0]*N
for i in range(N):
    A[i]=int(input())

j=0
ans=0
count=[0]*N
while j!=1:
    ans+=1
    j=A[j]-1
    count[j]+=1
    if count[j]>=2:
        ans=-1
        break

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

import os, sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
 
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7

def N(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))
def bulk_li(): return list(map(lambda s: list(map(int, s.split())), sys.stdin.readlines()))

n, w = li()
wv = bulk_li()

# print(wv)
table = dict()

# 以下の条件で最大の価値の総和を返す
# i番目以降(i+1..n)の品物 / 残重量jのナップサック
def dp(i, j):
    if i == n:
        return 0
    if (i, j) in table:
        return table.get((i, j))

    w, v = wv[i]
    if w > j:
        return dp(i+1, j)

    table[(i, j)] = max(v + dp(i+1, j-w), dp(i+1, j))
    return table[(i, j)]

print(dp(0, w))


"""
TLE
https://atcoder.jp/contests/dp/submissions/6675353

recursionでやると遅い。
"""


### FIXED CODE ###

import numpy as np
N, W = map(int, input().split())
ndp = np.full(1000*100+1, 10**11, dtype=np.int64)
ndp[0] = 0

for _ in range(N):
    w, v = map(int,input().split())

    np.minimum(ndp[:-v] + w, ndp[v:], out = ndp[v:])

print(np.max(np.where(ndp<=W)))

"""
https://atcoder.jp/contests/dp/submissions/6646897
から失敬

貪欲法はこの手の書き方で表現できるっぽい。
価値テープのなかで同価値のindexでは、より少ない重量の物品で済む方を残していく。
したがってテープの初期化は擬似infで行い、価値0の部分は重さも0で始める。

"""
### BUGGY CODE ###

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

dp = [0]*(N+1)
dp[0] = 1
ans = 0

for i in range(1, N+1):
    if i in a:
        dp[i] = 0
        if dp[i-1] == 0:
            ans = 0
            break
    else:
        try:
            dp[i] = dp[i-1] + dp[i-2]
        except:
            dp[i] = dp[i-1]
else:
    ans = dp[-1] % 1000000007

print(ans)


### FIXED CODE ###

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

dp = [-1]*(N+1)
for i in a:
    dp[i] = 0

dp[0] = 1
mod = 1000000007

for i in range(1, N+1):
    if dp[i] == 0:
        continue
    else:
        if i > 1:
            dp[i] = (dp[i-1] + dp[i-2]) % mod
        else:
            dp[i] = dp[i-1] % mod

print(dp[-1])
### BUGGY CODE ###

nums = [int(e) for e in input().split()]
a=nums[0]
b=nums[1]
c=nums[2]
d=nums[3]
i = 0
j = 0
max = a*c
for i in range(a, b+1, 1):
    for j in range(c, d+1, 1):
        if max < i * j:
            max = i * j
print(max)


### FIXED CODE ###

nums = [int(e) for e in input().split()]
a=nums[0]
b=nums[1]
c=nums[2]
d=nums[3]
max = a*c
if a * d > max:
    max = a * d
if b * c > max:
    max = b * c
if b * d > max:
    max = b * d

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

N,K,S=map(int,input().split())
answers=[S]*K
for _ in range(N-K):
    answers.append(S+1)
answer=''
for answer_ in answers:
    answer+=str(answer_)
    answer+=' '
print(answer)


### FIXED CODE ###

N,K,S=map(int,input().split())
answers=[str(S)]*K
answers_=[str(S+1)]*(N-K)
a=' '.join(answers)
b=' '.join(answers_)
if K==0:
    if S==pow(10,9):
        answers_ = ['1'] * (N - K)
        b = ' '.join(answers_)
        c=b
    else:
        c=b
elif S==pow(10,9):
    answers_=['1']*(N-K)
    b = ' '.join(answers_)
    c=a+' '+b
else:
    c = a + ' ' + b
print(c)
### BUGGY CODE ###

from collections import defaultdict
n, p = map(int, input().split())
cnt = defaultdict(int)
while p != 1:
    for i in range(2, p + 1):
        flag = False
        while p % i == 0:
            p //= i
            cnt[i] += 1
            flag = True
        if flag:
            break
ans = 1
for k, v in cnt.items():
    ans *= k ** (v // n)

print(ans)

### FIXED CODE ###

from collections import defaultdict
n, p = map(int, input().split())
cnt = defaultdict(int)
if n == 1:
    print(p)
    exit()
for i in range(2, int(p ** 0.5) + 1):
    flag = False
    while p % i == 0:
        p //= i
        cnt[i] += 1
ans = 1
for k, v in cnt.items():
    ans *= k ** (v // n)

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

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

mod = 10 ** 9 + 7

combi = list(itertools.combinations(range(N), 2))

S = 0
for x in combi:
    S = (S + A[x[0]] * A[x[1]]) % mod
print(S)


### FIXED CODE ###

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

mod = 10 ** 9 + 7

sumA = sum(A)
S = 0

for x in range(N):
    sumA -= A[x]
    S = (S + A[x] * (sumA)) % mod

print(S)
### BUGGY CODE ###

L,R = map(int,input().split())
ans = 2019
for j in range(R+1):
    for i in range(L,j):
        ans = min(ans,(i*j)%2019)
print(ans)

### FIXED CODE ###

L,R = map(int,input().split())
ans = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        ans = min(ans,(i*j)%2019)
        if ans == 0:
            print(0)
            exit()
print(ans)
### BUGGY CODE ###

import numpy as np

n = int(input())
a_list = [int(i) for i in input().split()]
a_list = np.array(a_list, int)

for i in range(n):
    print(np.sum(a_list==i+1))

### FIXED CODE ###

n = int(input())
a_list = [int(i) for i in input().split()]
a_dict = {}

for a in a_list:
    if a in a_dict.keys():
        a_dict[a] += 1
    else:
        a_dict[a] = 1

for i in range(n):
    if i+1 in a_dict.keys():
        print(a_dict[i+1])
    else:
        print(0)
### BUGGY CODE ###

from functools import reduce
import sys
MOD = 1000000007
def culc(s, h, w, x, y):
	if s[y][x] == 1:
		return 0
	count = 1
	for i in range(x):
		if s[y][x - i - 1] == 1:
			break
		count+=1
	for i in range(w - x - 1):
		if s[y][x + i + 1] == 1:
			break
		count+=1
	for i in range(y):
		if s[y - i - 1][x] == 1:
			break
		count+=1
	for i in range(h - y - 1):
		if s[y + i + 1][x] == 1:
			break
		count+=1
	return count

h, w = map(int, input().split())
s = []
for i in range(h):
	s2 = input()
	s3 = []
	for j in range(len(s2)):
		s3.append(1 if s2[j] == "#" else 0)
	s.append(s3)

max = 0
for i in range(h):
	for j in range(w):
		tmp = culc(s, h, w, j, i)
		if max < tmp:
			max = tmp

print(max)

### FIXED CODE ###

from functools import reduce
import sys
import numpy as np
MOD = 1000000007

buffer = sys.stdin.buffer
H, W = list(map(int,buffer.readline().split()))
S = np.frombuffer(buffer.read(H*(W+1)), dtype="B") == ord(".")
S = S.reshape((H,W+1))[:,:-1]
L = np.empty((H,W), dtype="i4")
R = np.empty((H,W), dtype="i4")
U = np.empty((H,W), dtype="i4")
D = np.empty((H,W), dtype="i4")
 
L[:,0] = S[:,0]
for i in range(1,W):
    L[:,i] = (L[:,i-1] + 1) * S[:,i]
 
R[:,-1] = S[:,-1]
for i in range(1,W):
    R[:,-1-i] = (R[:,-i] + 1) * S[:,-1-i]
 
U[0] = S[0]
for i in range(1,H):
    U[i] = (U[i-1] + 1) * S[i]
 
D[-1] = S[-1]
for i in range(1,H):
    D[-1-i] = (D[-i] + 1) * S[-1-i]
 
score = L + R + U + D - 3
print(int(score.max()))
### BUGGY CODE ###

import math
def gcd_arg3(a,b,c):
    return math.gcd(a,math.gcd(b,c))

k = int(input())

sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            sum += gcd_arg3(a,b,c)

print(sum)

### FIXED CODE ###

import math
def gcd_arg3(a,b,c):
    return math.gcd(a,math.gcd(b,c))

k = int(input())

sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        gcd_a_b = math.gcd(a,b)
        for c in range(1,k+1):
            sum += math.gcd(gcd_a_b,c)

print(sum)
### BUGGY CODE ###

a,b,n = map(int, input().split())
ans = 0

for i in range(n):
    tmp = (a*i+a)//b - (i+1)//b * a
    ans = max(ans, tmp)

print(ans)

### FIXED CODE ###

a,b,n = map(int, input().split())
y = min(b-1, n)
ans = a*y//b - y//b * a

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

from math import floor
while(True):
    x,y,s=map(int,input().split())
    if (x,y,s)==(0,0,0):
        quit()
    ans=0
    for i in range(1,s):
        for j in range(1,s):
            if floor(i*(1+0.01*x))+floor(j*(1+0.01*x))==s:
                ans=max(ans,floor(i*(1+0.01*y))+floor(j*(1+0.01*y)))
    print(ans)



### FIXED CODE ###

from math import floor
while(True):
    x,y,s=map(int,input().split())
    if (x,y,s)==(0,0,0):
        quit()
    ans=0
    for i in range(1,s):
        j=s-floor(i*(100+x)/100)
        if j<1:
            continue
        j=floor((j+1)*(100/(100+x)))
        for k in [j-1,j]:
            if floor(i*(100+x)/100)+floor(k*(100+x)/100)==s:
                ans=max(ans,floor(i*(100+y)/100)+floor(k*(100+y)/100))
    print(ans)
### BUGGY CODE ###

def GCD(a: int, b: int) -> int:
    return a if b == 0 else GCD(b, a % b)


class SegTree():
    def __init__(self, n_, ele_id, operation_func):
        self.n = 1
        while self.n < n_:
            self.n *= 2
        self.data = [ele_id] * (2 * self.n - 1)
        self.ele_id = ele_id
        self.operation_func = operation_func

    def __getitem__(self, idx):
        return self.data[idx + self.n - 1]

    def init(self, data_init):
        for i in range(len(data_init)):
            self.data[i + self.n - 1] = data_init[i]
        for i in range(self.n - 2, -1, -1):
            self.data[i] = self.operation_func(self.data[2 * i + 1],
                                               self.data[2 * i + 2])

    def update(self, idx, x):
        # idx番目の要素をxに更新する
        idx += self.n - 1
        self.data[idx] = x
        while idx > 0:
            idx = (idx - 1) // 2
            self.data[idx] = self.operation_func(self.data[2 * idx + 1],
                                                 self.data[2 * idx + 2])

    def query(self, a, b):
        return self.query_(a, b, 0, 0, self.n)

    def query_(self, a, b, k, l, r):
        # [a, b)の最小値を求める
        if r <= a or b <= l:
            # [a, b)が[l, r)と交差しない
            return self.ele_id

        if a <= l and r <= b:
            # [a, b)が[l, r)を完全に含む
            return self.data[k]
        else:
            # [a, b)と[l, r)は一部被る
            child_l = self.query_(a, b, 2 * k + 1, l, (l + r) // 2)
            child_r = self.query_(a, b, 2 * k + 2, (l + r) // 2, r)
            return self.operation_func(child_l, child_r)


n = int(input())
a = list(map(int, input().split()))
seg_gcd = SegTree(n, 0, GCD)
seg_gcd.init(a)

ans = seg_gcd.data[0]
for i in range(n):
    seg_gcd.update(i, 0)
    ans = max(ans, seg_gcd.data[0])
    seg_gcd.update(i, a[i])

print(ans)


### FIXED CODE ###

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

def GCD(a: int, b: int) -> int:
    return a if b == 0 else GCD(b, a % b)

l = [0]
r = [0]
for i in range(n):
    l.append(GCD(l[i], a[i]))
    r.append(GCD(r[i], a[n-1 - i]))
r = r[::-1]

ans = 1
for i in range(n):
    ans = max(ans, GCD(l[i], r[i+1]))

print(ans)