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

N, M, Q = map(int, input().split())
coordinate = [[0 for _ in range(N)] for i in range(N)]
for m in range(M):
    l, r = map(int, input().split())
    coordinate[l-1][r-1] += 1
PQ = [list(map(int, input().split())) for i in range(Q)]

for pq in PQ:
    p, q = pq
    ans = 0
    for i in range(p-1, q):
        for j in range(p-1, q):
            ans += coordinate[i][j]
    print(ans)

### FIXED CODE ###

N, M, Q = map(int, input().split())
coordinate = [[0 for _ in range(N+1)] for i in range(N+1)]
for m in range(M):
    l, r = map(int, input().split())
    coordinate[l-1][r-1] += 1

for i in range(N):
    for j in range(1, N):
        coordinate[i][j] += coordinate[i][j-1]


for i in range(Q):
    p, q = map(int, input().split())
    ans = 0
    for i in range(p-1, q):
        ans += coordinate[i][q-1] - coordinate[i][p-2]
    print(ans)
### BUGGY CODE ###

from fractions import gcd
#from math import gcd
import numpy as np
import sys
input = sys.stdin.readline
mod = 10**9+7

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

lcm=1
for s in A:
    lcm=s*lcm//gcd(lcm, s)

ans = np.sum([lcm // s % mod for s in A]) % mod

print(int(ans))

### FIXED CODE ###

from fractions import gcd
#from math import gcd
import numpy as np
import sys
input = sys.stdin.readline
mod = 10**9+7

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

lcm = 1
for s in A:
    lcm = s*lcm//gcd(lcm, s)

ans = lcm*sum([pow(s, mod-2, mod) for s in A]) % mod
#ans = sum([lcm//s % mod for s in A]) % mod

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

import sys

x, y, z, k = map(int, sys.stdin.readline().split())

xlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(x, k)]
ylist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(y, k)]
zlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(z, k)]


anslist = [0]
for i in range(min(x, k)):
    for j in range(min(y, k)):
        for l in range(min(z, k)):
            if i*j*l <= k:
                anslist.append(xlist[i]+ylist[j]+zlist[l])

anslist = sorted(anslist, reverse=True)
for i in range(k):
    print(anslist[i])


### FIXED CODE ###

import sys

x, y, z, k = map(int, sys.stdin.readline().split())

xlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(x, k)]
ylist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(y, k)]
zlist = sorted(list([int(i)
                     for i in sys.stdin.readline().split()]), reverse=True)[:min(z, k)]


anslist = [0]
for i in range(min(x, k)):
    for j in range(min(y, k)):
        for l in range(min(z, k)):
            if (i+1)*(j+1)*(l+1) <= k:
                anslist.append(xlist[i] + ylist[j] + zlist[l])
            else:
                break

anslist = sorted(anslist, reverse=True)
for i in range(k):
    print(anslist[i])
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans='YES'
for i in range(min(a),1+max(a)):
  if a.count(i)>=2:
    ans='NO'
  if ans=='NO':
    break
print(ans)

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
ans='YES'
for i in range(n-1):
  if a[i]==a[i+1]:
    ans='NO'
  if ans=='NO':
    break
print(ans)
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

count = 0
for r in range(N//R + 1):
    Rr = R*r
    for g in range((N-Rr)//G + 1):
        Gg = G*g
        Rr_plus_Gg = Rr + Gg
        for b in range((N-Rr-Gg)//B + 1):
            if Rr_plus_Gg + B*b == N:
                count += 1
                break

print(count)


### FIXED CODE ###

R, G, B, N = map(int, input().split())

count = 0
for r in range(N//R + 1):
    for g in range((N-R*r)//G + 1):
        if (N-R*r-G*g) % B == 0:
            count += 1


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

L,R = map(int,input().split())
ans = 2018
for j in range(R+1):
    for i in range(L,j):
        ans = min(ans,(i*j)%2019)
        if ans == 0:
            print(0)
            exit()
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 ###

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

for i in range(K):
  if A>=1:
    A=A-1
  elif B>=1:
    B=B-1
  elif A==0 and B==0:
    pass

print(A,B)

### FIXED CODE ###

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

if K>=A+B:
  A,B=0,0
elif K<A+B:
  if K>A:
    A,B=0,B-K+A
  if K<=A:
    A,B=A-K,B

print(A,B)
### BUGGY CODE ###

N = int(input())
left = []
right = []
last = None
for i in range(N):
	s = input()
	l = len(s)
	r_needed = 0
	l_needed = 0
	for j in range(l):
		if s[j] == "(":
			r_needed += 1
		elif s[j] == ")" and r_needed > 0:
			r_needed -= 1

		if s[l-1 - j] == ")":
			l_needed += 1
		elif s[l-1 - j] == "(" and l_needed > 0:
			l_needed -= 1
	if r_needed < l_needed:
		right.append((-r_needed, l_needed))
	else:
		left.append((l_needed, -r_needed))

left.sort()
right.sort()
rest_l = 0
for l in left:
	l_needed = l[0]
	r_needed = -l[1]
	if rest_l < l_needed:
		print("No")
		exit()
	rest_l += r_needed - l_needed
for r in right:
	l_needed = r[1]
	r_needed = -r[0]
	if rest_l < l_needed:
		print("No")
		exit()
	rest_l -= l_needed
	rest_l += r_needed
if rest_l != 0:
	print("No")
else:
	print("Yes")

### FIXED CODE ###

N = int(input())
left = []
right = []
last = None
for i in range(N):
	s = input()
	l = len(s)
	r_needed = 0
	l_needed = 0
	for j in range(l):
		if s[j] == "(":
			r_needed += 1
		elif s[j] == ")" and r_needed > 0:
			r_needed -= 1

		if s[l-1 - j] == ")":
			l_needed += 1
		elif s[l-1 - j] == "(" and l_needed > 0:
			l_needed -= 1
	if r_needed < l_needed:
		right.append((-r_needed, l_needed))
	else:
		left.append((l_needed, -r_needed))

left.sort()
right.sort()
rest_l = 0
for l in left:
	l_needed = l[0]
	r_needed = -l[1]
	if rest_l < l_needed:
		print("No")
		exit()
	rest_l += r_needed - l_needed
for r in right:
	l_needed = r[1]
	r_needed = -r[0]
	if rest_l < l_needed:
		print("No")
		exit()
	rest_l -= l_needed
	rest_l += r_needed
if rest_l != 0:
	print("No")
else:
	print("Yes")
### BUGGY CODE ###

import math

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

def C(T):
    t = 0
    for i in range(N):
        t += math.ceil((h[i]-B*T)/(A-B))
    if t <= T:
        return True
    else:
        False
l, r = 0, 10**32
while r - l > 1:
    mid = (l+r) // 2
    if C(mid):
        r = mid
    else:
        l = mid


print(r)

### FIXED CODE ###

import math

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

def C(T):
    t = 0
    for i in range(N):
        if h[i] > B*T:
            t += math.ceil((h[i]-B*T)/(A-B))
    if t <= T:
        return True
    else:
        False
l, r = 0, 10**18
while r - l > 1:
    mid = (l+r) // 2
    if C(mid):
        r = mid
    else:
        l = mid


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

def resolve():
    '''
    code here
    '''

    R, G, B, N = [int(item) for item in input().split()]

    cnt = 0

    for i in range(N+1):
        for j in range(N+1):
            _b = N - (i * R + j * G)
            
            if _b % B == 0 and _b >= 0:
                cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    '''
    code here
    '''

    R, G, B, N = [int(item) for item in input().split()]

    cnt = 0

    for i in range(N+1):
        for j in range(N+1-i):
            _b = N - (i * R + j * G)
            
            if _b % B == 0 and _b >= 0:
                cnt += 1

    print(cnt)

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

a,b,x = map(int,input().split())
print(sum(1 for i in range(a,b+1) if i%x == 0))


### FIXED CODE ###

a,b,x = map(int,input().split())
print(b//x-(a-1)//x)
### BUGGY CODE ###

import numpy as np

N = int(input())
A = np.zeros(N).astype(int)
B = np.zeros(N).astype(int)

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

ans = 0
for i in reversed(range(N)):
    if A[i] % B[i] == 0:
        continue
    elif B[i] - A[i] > 0:
        ans += B[i] - A[i]
        A += B[i] - A[i]
    else:
        ans += B[i] - (A[i] % B[i])
        A += B[i] - (A[i] % B[i])
    
print(ans)

### FIXED CODE ###

import numpy as np

N = int(input())
A = np.zeros(N).astype(int)
B = np.zeros(N).astype(int)

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

ans = 0
for i in reversed(range(N)):
    A[i] = A[i] + ans
    if A[i] % B[i] == 0:
        continue
    elif B[i] - A[i] > 0:
        ans += B[i] - A[i]
    else:
        ans += B[i] - (A[i] % B[i])
    
print(ans)
### BUGGY CODE ###

from itertools import product

MEM = [0] * (10**6)

N = int(input())
XYP = [tuple(map(int, input().split())) for _ in range(N)]
X = [x for x, _, _ in XYP]
Y = [y for _, y, _ in XYP]
INF = 10**18

def calcCost(AP, A):
    ret = [[INF] * N for _ in range(1 << N)]
    for state in range(1 << N):
        useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
        for i, (a, p) in enumerate(AP):
            cost = abs(a)
            for z in useA:
                cost = min(cost, abs(a - z))
            ret[state][i] = cost * p
    return ret

costX = calcCost([(x, p) for x, _, p in XYP], X)
costY = calcCost([(y, p) for _, y, p in XYP], Y)

def makeState(state, sign):
    ret = 0
    for s in state:
        ret <<= 1
        if s == sign:
            ret |= 1
    return ret

ans = [INF] * (N + 1)
for state in product((0, 1, 2), repeat=N):
    stateX = 0
    stateY = 0
    M = N
    for s in state:
        stateX <<= 1
        stateY <<= 1
        if s == 0: M -= 1
        if s == 1: stateX |= 1
        if s == 2: stateY |= 1

    cx = costX[stateX]
    cy = costY[stateY]

    cost = 0
    for i in range(N):
        cost += min(cx[i], cy[i])

    if ans[M] > cost:
        ans[M] = cost

print(*ans, sep='\n')


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
from numba import njit
import numpy as np
INF = 10**18

@njit('(i8, i8[:,:])')
def solve(N, XYP):
    X = XYP[:, 0]
    Y = XYP[:, 1]

    def calcCost(sign, A):
        ret = np.ones((1 << N, N), dtype=np.int64) * INF
        for state in range(1 << N):
            useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
            for i in range(N):
                xyp = XYP[i]
                cost = abs(xyp[sign])
                for z in useA:
                    cost = min(cost, abs(xyp[sign] - z))
                ret[state][i] = cost * xyp[2]
        return ret

    costX = calcCost(0, X)
    costY = calcCost(1, Y)
    ans = np.ones(N + 1, dtype=np.int64) * INF

    for state in range(pow(3, N)):
        stateX = 0
        stateY = 0
        M = N
        for _ in range(N):
            state, r = divmod(state, 3)
            stateX <<= 1
            stateY <<= 1
            if r == 0: M -= 1
            if r == 1: stateX |= 1
            if r == 2: stateY |= 1

        cx, cy = costX[stateX], costY[stateY]
        cost = 0
        for i in range(N):
            cost += min(cx[i], cy[i])
        ans[M] = min(ans[M], cost)

    for a in ans:
        print(a)

def sol():
    N = int(input())
    XYP = np.asarray([list(map(int, input().split())) for _ in range(N)])
    solve(N, XYP)

sol()
### BUGGY CODE ###

def main():

    N, T = map(int, input().split())
    C = []
    for _ in range(N):
        A, B = map(int, input().split())
        C.append([B, A])
    # C.sort()

    dp = [[0, 0] for _ in range(T)]
    ans = 0
    for i in range(T):
        for j in range(N):
            if (dp[i][1] >> j) % 2 == 0:
                if i+C[j][1] > T-1:
                    ans = max(ans, dp[i][0] + C[j][0])
                else:
                    if dp[i][0]+C[j][0] > dp[i+C[j][1]][0]:
                        dp[i+C[j][1]][0] = dp[i][0]+C[j][0]
                        dp[i+C[j][1]][1] = (1 << j) | dp[i][1]
        ans = max(ans, dp[i][0])

    return ans

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

### FIXED CODE ###

def main():

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

    dp = [[0, set()] for _ in range(T)]
    ans = 0
    for i in range(T):
        for j in range(N):
            if j not in dp[i][1]:
                k = i+C[j][1]
                if k > T-1:
                    ans = max(ans, dp[i][0] + C[j][0])
                else:
                    if dp[i][0]+C[j][0] > dp[k][0]:
                        dp[k][0] = dp[i][0]+C[j][0]
                        dp[k][1] = dp[i][1] | {j}
        ans = max(ans, dp[i][0])

    return ans

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

x = int(input())

b = 1
p = 2

a = []

for i in range(x):
    for j in range(x):
        if (b+i) ** (p+j) <= x:
            a.append((b+i) ** (p+j))

print(max(a))

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

def main():
    x = int(input())

    b = 1
    p = 2

    a = []

    for i in range(int(x ** 0.5) + 1):
        for j in range(int(x ** 0.5) + 1):
            if (b+i) ** (p+j) <= x:
                a.append((b+i) ** (p+j))

    print(max(a))

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

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


a_i = []
for i in range(q):
    a_i.append(int(input())-1)


for i in range(len(a_i)):
    for j in range(len(score)):
        if(a_i[i] == j):
            pass
        else:
            score[j] -= 1
    

for i in range(len(score)):
    if(score[i] > 0):
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

import sys
n,k,q = map(int,input().split())
score = [k-q for i in range(n)]
a_i = [int(input())-1 for i in range(q)]


for i in range(len(a_i)):
    score[a_i[i]] += 1



for i in score:
    if(i > 0):
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

S = input()

dp = [[0 for _ in range(4)]for _ in range(len(S)+1)]
dp[0][0] = 1

for ind,i in enumerate(S):
    if(i!='?'):
        dp[ind+1][0] += dp[ind][0]
        dp[ind+1][1] += dp[ind][1]
        dp[ind+1][2] += dp[ind][2]
        dp[ind+1][3] += dp[ind][3]
        if(i=='A'):
            dp[ind+1][1] += dp[ind][0]
        elif(i=='B'):
            dp[ind+1][2] += dp[ind][1]
        elif(i=='C'):
            dp[ind+1][3] += dp[ind][2]
    else:
        dp[ind+1][0] += dp[ind][0]*3
        dp[ind+1][1] += dp[ind][1]*3 + dp[ind][0]
        dp[ind+1][2] += dp[ind][2]*3 + dp[ind][1]
        dp[ind+1][3] += dp[ind][3]*3 + dp[ind][2]


print(dp[-1][3]%(10**9+7))


### FIXED CODE ###

S = input()

MOD = 10**9+7
dp = [[0 for _ in range(4)]for _ in range(len(S)+1)]
dp[0][0] = 1

for ind,i in enumerate(S):
    if(i=='A'):
        dp[ind+1][0] = dp[ind][0]
        dp[ind+1][1] = dp[ind][1] + dp[ind][0]
        dp[ind+1][2] = dp[ind][2]
        dp[ind+1][3] = dp[ind][3]
    elif(i=='B'):
        dp[ind+1][0] = dp[ind][0]
        dp[ind+1][1] = dp[ind][1]
        dp[ind+1][2] = dp[ind][2] + dp[ind][1]
        dp[ind+1][3] = dp[ind][3]
    elif(i=='C'):
        dp[ind+1][0] = dp[ind][0]
        dp[ind+1][1] = dp[ind][1]
        dp[ind+1][2] = dp[ind][2]
        dp[ind+1][3] = dp[ind][3] + dp[ind][2]
    else:
        dp[ind+1][0] = dp[ind][0]*3
        dp[ind+1][1] = dp[ind][1]*3 + dp[ind][0]
        dp[ind+1][2] = dp[ind][2]*3 + dp[ind][1]
        dp[ind+1][3] = dp[ind][3]*3 + dp[ind][2]
        
    dp[ind+1][0]%=MOD
    dp[ind+1][1]%=MOD
    dp[ind+1][2]%=MOD
    dp[ind+1][3]%=MOD

print(dp[-1][3]%MOD)
### BUGGY CODE ###

N=int(input())
di = dict()
for i in range(N):
    s = input()
    if s in di:
        di[s] += 1
    else:
        di[s] = 0

maxlist = [kv for kv in di.items() if kv[1] == max(di.values())]
for d in sorted(maxlist):
    print(d[0])

### FIXED CODE ###

import collections
import itertools
N=int(input())
di = dict()
l = list()
for i in range(N):
    l.append( input())

c = collections.Counter(l)
ct = c.most_common()
m = ct[0][1]
li = list()
for t in ct:
    if m == t[1]:
        li.append(t[0]) 
    else:
        break
lis = sorted(li)
for s in lis:
    print(s)
### BUGGY CODE ###

from collections import deque

N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# print(N, M, K)
# print(A)
# print(B)


consumptions_A = []
for i in range(len(A) + 1):
    consumptions_A.append(sum(A[:i]))

consumptions_B = []
for i in range(len(B) + 1):
    consumptions_B.append(sum(B[:i]))

answer = 0
j = M
for i in range(len(consumptions_A)):
    if (consumptions_A[i] > K): break

    remaining_time = K - consumptions_A[i]
    while consumptions_B[j] > remaining_time:
        j -= 1
    
    num_books = i + j
    answer = max(answer, num_books)

print(answer)


### FIXED CODE ###

from collections import deque

N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# print(N, M, K)
# print(A)
# print(B)


consumptions_A = [0]
for i in range(len(A)):
    consumptions_A.append(consumptions_A[i] + A[i])

consumptions_B = [0]
for i in range(len(B)):
    consumptions_B.append(consumptions_B[i] + B[i])

answer = 0
j = M
for i in range(len(consumptions_A)):
    if (consumptions_A[i] > K): break

    remaining_time = K - consumptions_A[i]
    while consumptions_B[j] > remaining_time:
        j -= 1
    
    num_books = i + j
    answer = max(answer, num_books)

print(answer)
### BUGGY CODE ###

import fractions
import collections 
from functools import reduce
MOD = 10**9 + 7

N = int(input())
A = [int(i) for i in input().split()]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

dic = collections.defaultdict(int)
for a in A:
    c2 = collections.Counter(prime_factorize(a))
    for k, v in list(c2.items()):
        dic[k] = max(dic[k],v)
        
ans = 0
for a in A:
    c2 = collections.Counter(prime_factorize(a))
    B =1
    for k,v in list(dic.items()):
        B *= k ** (v-c2[k]) 
        B %= MOD
    ans += B
    ans %= MOD

print(ans)


### FIXED CODE ###

import fractions

N = int(input())
A = list(map(int,input().split()))
MOD = 10** 9 + 7
lcm = 1
for a in A:
    lcm = a // fractions.gcd(a,lcm) * lcm

print(sum(lcm//a for a in A)%MOD)
### BUGGY CODE ###

#dj 16D8101012J ito jun
n = int(input())
for _ in range(n):
    a = input()
    b = input()
    na=len(a)
    nb=len(b)
    array = [[0]*(nb+1) for _ in range(na+1)]
    for i,x in enumerate(a,1):
        prerow=array[i-1]
        row=array[i]
        for j,y in enumerate(b,1):
            if x == y:
                row[j]=prerow[j-1]+1
            else:
                row[j] = max(prerow[j],row[j-1])
    print(array[na][nb])



### FIXED CODE ###

#dj 16D8101012J ito jun
import sys
def search(a,b):
    na=len(a)
    nb=len(b)
    array = [[0]*(nb+1) for _ in range(na+1)]
    for i,x in enumerate(a,1):
        prerow=array[i-1]
        row=array[i]
        for j,y in enumerate(b,1):
            if x == y:
                row[j]=prerow[j-1]+1
            elif prerow[j] < row[j-1]:
                row[j] = row[j-1]
            else:
                row[j] = prerow[j]
    return array[-1][-1]

n = int(input())
strs = [list(i) for i in sys.stdin.read().splitlines()]
result = [search(strs[i*2], strs[i*2+1]) for i in range(n)]
print(*result, sep="\n")
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
S = sum(A)/2
x1 = S - sum([a for a in A[1:N:2]])
ans = "%d"%(x1*2)
x = x1
for a in A[:-1]:
  x = a-x
  ans += " %d"%(x*2)
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
S = sum(A)/2
x1 = S - sum([a for a in A[1:N:2]])
ans = "%d"%(x1*2)
x = x1
for a in A[:-1]:
  x = a-x
  ans += " %d"%(x*2)
print(ans)
### BUGGY CODE ###

import itertools

N = int(input())
for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            for y in range(1,x+1):
                for z in range(1,y+1):
                    if (x+y)*(x+z)+y**2+z**2 == n:
                        if x == y == z:
                            count = 1
                        elif x == y or y == z:
                            count = 3
                        else:
                            count = 6
                        #p=[x,y,z]
                        #q=[]
                        #for p in itertools.permutations(p):
                            #q.append(p)
                            #count = len(set(q))
                    else:
                        pass
        print(count)



### FIXED CODE ###

N = int(input())
lst = [0]*(N+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            p = (x+y)*(x+z)+y**2+z**2
            if p > N:
                break
            else:
                lst[p] += 1
for i in range(1,N+1):
    print(lst[i])
### BUGGY CODE ###

import sys,collections as cl
import fractions
from functools import reduce
import copy
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())


a = l()
su = 0

aa = copy.deepcopy(a)
for i in range(n):
	aa.pop(i)
	s = gcd_list(aa)
	su = max(su,s)
	aa = copy.deepcopy(a)
print(su)


### FIXED CODE ###

import sys,collections as cl
import fractions
from functools import reduce
import copy
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())

a = l()

m = gcd_list(a[1:])
m = max(m,gcd_list(a[:n-1]))
aa = [a[0]]
aaa = [a[-1]]
for i in range(n-1):
	aa.append(gcd(aa[-1],a[i+1]))
	aaa.append(gcd(aaa[-1],a[-(i+1)]))

for i in range(n-1):
	m = max(m,gcd(aa[i],aaa[-(i+2)]))
print(m)
### BUGGY CODE ###

S = input()
if not len(S):
  print(0)
else:
  N = len(S)
  ans = 0
  while 1:
    S = S.replace('10', '')
    tmp1 = N - len(S)
    N = len(S)
    S = S.replace('01', '')
    tmp2 = N - len(S)
    N = len(S)
    if not tmp1 + tmp2:
      break
    else:
      ans += tmp1 + tmp2
  print(ans)

### FIXED CODE ###

S = input()
print(min(S.count('0'), S.count('1')) * 2)
### BUGGY CODE ###

from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = []

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.append(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = set()

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.add(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")