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

# from math import gcd
from fractions import gcd  # gcd: 2つの正の数を渡すと最大公約数を返す  # Atcoder ではこっち
from collections import defaultdict

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

# 正の公約数
cf=[] # 1が公約数なのは当然
for i in range(2,min(a, b)+1):
    if a % i == 0 and b % i == 0:
        cf.append(i)

# print(cf)

# 素数チェック
def is_prime(n):
    """
    Assumes that n is a positive natural number
    https://www.rookieslab.com/posts/fastest-way-to-check-if-a-number-is-prime-or-not
    """
    # We know 1 is not a prime number
    if n == 1:
        return False

    i = 2
    # This will loop from 2 to int(sqrt(x))
    while i*i <= n:
        # Check if i divides x without leaving a remainder
        if n % i == 0:
            # This means that n has a factor in between 2 and sqrt(n)
            # So it is not a prime number
            return False
        i += 1
    # If we did not find any factor in the above loop,
    # then n is a prime number
    return True

# disjoint_dict = defaultdict(lambda: True)

disjoint_dict = {i: True for i in cf}

# for i in range(0, len(cf)-1):

for i, cf_i in enumerate(cf):

    if is_prime(cf_i):  # 素数である
        continue
    if disjoint_dict[cf_i] == False:  # 既に互いに素ではないパターンが発見されている
        continue

    # for j in range(i, len(cf)):
    for cf_j in cf[i:]:
        if disjoint_dict[cf_j] == False:
            continue

        if gcd(cf_i, cf_j) != 1:
            disjoint_dict[cf_j] = False

# print(disjoint_dict)
print(sum(disjoint_dict.values())+1)  # 1は必ず全ての数字に対して互いに素なので +1 する


### FIXED CODE ###

"""
GCD(A, B) の公約数を素因数分解して出てきた素数の数+1 が答え.
"""

import math
from fractions import gcd  # gcd: 2つの正の数を渡すと最大公約数(Greatest Common Divisor)を返す  # Atcoder ではこっち
from collections import OrderedDict


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

# A, B の公約数 = gcd(a, b)の公約数
# GCD
gcd_num = gcd(a, b)

# 素因数分解
"""
N = p * q    (p <= q, pとqは素因数) の時
p <= sqrt(N)    となる

つまり, sqrt(N) まで試して, 割り切れなかった(残った)ものは素因数と言える.
言い方を変えると, sqrt(N)以上の素因数は高々1個まで.

これから, 順番に割っていくのをsqrt(N)までやり, 残ったのが1じゃなければそれも素数.
これなら計算量 O(sqrt(N)) でいける.
"""
def factorize(n):
    """素因数分解を行う

    Parameters
    ----------
    n : int
        正の自然数
    """
    res = dict()
    for i in range(2, math.ceil(math.sqrt(n))):
        if n%i:  # 割り切れなかったらcontinue
            continue
        res[i] = 0
        while (n%i == 0):
            n /= i
            res[i] += 1

    if (n != 1):
        res[n] = 1
    return res


res = factorize(gcd_num)
ans = len(res.keys()) + 1  # 1は必ず入る
print(ans)
### BUGGY CODE ###

def p_f():
    from sys import stdin
    input = stdin.readline
    N, u, v = map(int, input().split())
    edges = [list(map(int, input().split())) for i in range(N - 1)]
    if u == v:
        print(0)
        exit()

    def BFS(K, edges, N):
        roots = [[] for i in range(N)]
        for a, b in edges:
            roots[a - 1] += [(b - 1, 1)]
            roots[b - 1] += [(a - 1, 1)]
        dist = [-1] * N
        stack = []
        stack.append(K)
        dist[K] = 0
        while stack:
            label = stack.pop(-1)
            for i, c in roots[label]:
                if dist[i] == -1:
                    dist[i] = dist[label] + c
                    stack += [i]
        return dist

    dist_v = BFS(v - 1, edges, N)
    dist_u = BFS(u - 1, edges, N)
    # print(dist_v)
    # print(dist_u)
    maxIndex = [i for i, x in enumerate(dist_v) if x == max(dist_v)]
    for i in maxIndex:
        if max(dist_v) > dist_u[i]:
            print(max(dist_v) - 1)
            exit()
    if dist_v[u - 1] > max(dist_v) - dist_v[u - 1]:
        print(max(dist_v) - 1)
    else:
        print(dist_v[u - 1] - 1)


if __name__ == '__main__':
    p_f()


### FIXED CODE ###

def p_f():
    from sys import stdin
    input = stdin.readline
    N, u, v = map(int, input().split())
    edges = [list(map(int, input().split())) for i in range(N - 1)]
    if u == v:
        print(0)
        exit()

    def BFS(K, edges, N):
        roots = [[] for i in range(N)]
        for a, b in edges:
            roots[a - 1] += [(b - 1, 1)]
            roots[b - 1] += [(a - 1, 1)]
        dist = [-1] * N
        stack = []
        stack.append(K)
        dist[K] = 0
        while stack:
            label = stack.pop(-1)
            for i, c in roots[label]:
                if dist[i] == -1:
                    dist[i] = dist[label] + c
                    stack += [i]
        return dist

    dist_v = BFS(v - 1, edges, N)
    dist_u = BFS(u - 1, edges, N)
    ans = 0
    for du, dv in zip(dist_u, dist_v):
        if du < dv and ans < dv - 1:
            ans = dv - 1
    print(ans)


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

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

Asmin=[i-1 for i in As]
Aspul=[i+1 for i in As]

ans=-100
for i in As:
  tmp=As.count(i+1)+As.count(i)+As.count(i-1)
  if ans<tmp:
    ans=tmp
for i in Asmin:
  tmp=As.count(i+1)+As.count(i)+As.count(i-1)
  if ans<tmp:
    ans=tmp
for i in Aspul:
  tmp=As.count(i+1)+As.count(i)+As.count(i-1)
  if ans<tmp:
    ans=tmp

print(ans)

### FIXED CODE ###

from itertools import chain
from collections import Counter
n=int(input())
As=list(map(int,input().split()))
As = [[a-1, a, a+1] for a in As]
As = list(chain.from_iterable(As))

result_cntr = Counter(As).most_common()
print(result_cntr[0][1])
### BUGGY CODE ###

import collections
N = int(input())
A = [int(_) for _ in input().split()]


class Prime:
    @staticmethod
    def trial_division(x):
        if x % 2 == 0:
            return True
        for p in range(3, int(x**0.5 + 1), 2):
            if x % p == 0:
                return False
        return True

    @staticmethod
    def factorization(x):
        ret = {}
        i = 0
        while True:
            if x % 2:
                break
            x //= 2
            i += 1
        if i:
            ret[2] = i
        f = 3
        while True:
            if f * f > x:
                break
            i = 0
            while True:
                if x % f:
                    if i:
                        ret[f] = i
                    f += 2
                    break
                x //= f
                i += 1
        if x > 1:
            ret[x] = 1
        return ret

    @staticmethod
    def miller_rabin(n):
        def suspect(a, t, n):
            x = pow(a, t, n)
            n1 = n - 1
            while t != n1 and x != 1 and x != n1:
                x = pow(x, 2, n)
                t <<= 1
            return t & 1 or x == n1

        if n == 2:
            return True
        if n < 2 or n % 2 == 0:
            return False
        d = (n - 1) >> 1
        while d & 1 == 0:
            d >>= 1

        if n < 2**32:
            check_list = (2, 7, 61)
        elif n < 2**48:
            check_list = (2, 3, 5, 7, 11, 13, 17, 19, 23)
        else:
            check_list = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37)

        for i in check_list:
            if i >= n:
                break
            if not suspect(i, d, n):
                return False
        return True


c = collections.defaultdict(int)
for a in A:
    for p in Prime.factorization(a):
        c[p] += 1
ans = 'pairwise coprime'
if c:
    x = max(c.values())
    if x == 1:
        ans = 'pairwise coprime'
    elif x == N:
        ans = 'not coprime'
    else:
        ans = 'setwise coprime'
print(ans)


### FIXED CODE ###

import collections
N = int(input())
A = [int(_) for _ in input().split()]


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


d = collections.defaultdict(int)
for a in A:
    for x in prime_factorize(a):
        d[x] += 1
if len(d):
    e = max(d.values())
if len(d) == 0 or e == 1:
    ans = 'pairwise coprime'
elif e == N:
    ans = 'not coprime'
else:
    ans = 'setwise coprime'
print(ans)
### BUGGY CODE ###

k=int(input())
ans=0
from fractions import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
#            print(a,b,c)
            ans+=gcd(a,gcd(b,c))
print(ans)



### FIXED CODE ###

k=int(input())
ans=0
from math import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)
### BUGGY CODE ###

# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = []
for i in range(n):
    for j in range(i+1, n):
        a = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans.append(a)
ans = [str(l) for l in ans]

for k in range(1, n):
    finalans=ans.count(str(k))
    print(finalans)


### FIXED CODE ###

# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0] * n
for i in range(n):
    for j in range(i+1, n):
        dist = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans[dist] += 1
for k in range(1, n):
    print(ans[k])
### BUGGY CODE ###

s = input()

is_all_swappd = False
n_swap = 0
while is_all_swappd is not True:
    start_idx = s.find('BW')
    if start_idx != -1:
        s_list = list(s)
        s_list[start_idx], s_list[start_idx+1] = \
            s_list[start_idx+1], s_list[start_idx]
        n_swap += 1
        s = "".join(s_list)
    else:
        is_all_swappd = True

print(n_swap)

### FIXED CODE ###

s = input()

is_all_swappd = False
n_swap = 0
n_white = s.count('W')
for i in range(n_white):
    w_idx = None
    if i == 0:
        w_idx = s.find('W')
    else:
        w_idx = s[last_w_idx + 1:].find('W') + last_w_idx + 1
    n_swap += w_idx - i
    last_w_idx = w_idx

print(n_swap)
### BUGGY CODE ###

n = int(input())
s = input()
sum = 0
for i in range(n):
    for j in range(n):
        if i < j:
            for k in range(n):
                if j < k and j-i!=k-j and s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                    sum += 1
print(sum)

### FIXED CODE ###

n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')

cnt = r*g*b

for i in range(n):
    j = 1
    while i+2*j < n:
        if s[i] != s[i+j] and s[i+j] != s[i+2*j] and s[i+2*j] != s[i]:
            cnt -= 1
            j += 1
        else:
            j += 1
print(cnt)
### BUGGY CODE ###

temp = input().split(" ")
a = min(int(temp[0]), int(temp[1]))
b = max(int(temp[0]), int(temp[1]))

def divisors(n):
  i = 2
  ret = [1]
  while True:
    while n % i == 0:
      if not i in ret:
        ret.append(i)
      n = n // i
    if i == n or n == 1:
      break
    i += 1
  return ret

ans = 0
ad = divisors(a)
bd = divisors(b)
for d in ad:
  if d in bd:
    ans += 1

print(ans)

### FIXED CODE ###

temp = input().split(" ")
a = min(int(temp[0]), int(temp[1]))
b = max(int(temp[0]), int(temp[1]))

def divisors(n):
  i = 2
  ret = [1]
  while True:
    while n % i == 0:
      if not i in ret:
        ret.append(i)
      n = n // i
    if n == 1 : break
    if i * i > n:
      ret.append(n)
      break
    i += 1
  return ret

# a < b
def gcd(a, b):
  if b % a == 0:
    return a
  else:
    return gcd(b % a, a)

print(len(divisors(gcd(a, b))))
### BUGGY CODE ###

n = int(input())
s = str(input())
tt = [1 if i  == "W" else 0 for i in s]
ans = float('Inf')
for i in range(0,n):
    #w = s[:i].count("W")
    W = sum(tt[:i])
    #e = s[i:].count("E")
    E = len(tt[i:]) - sum(tt[i:])
    ans = min(ans,W+E)
print(ans)

### FIXED CODE ###

from itertools import accumulate
n = int(input())
s = str(input())
tt = [1 if i  == "W" else 0 for i in s]
B = [0] + tt
B = list(accumulate(B))
#print(B)
ans = float('Inf')
for i in range(0,n+1):
    #w = s[:i].count("W")
    ##W = sum(tt[:i])
    w = B[i]
    #print(W,w)
    #e = s[i:].count("E")
    #E = len(tt[i:]) - sum(tt[i:])
    e = n - i - B[-1] + B[i]
    #print(E,e)
    #ans = min(ans,W+E)
    ans = min(ans,w+e)
print(ans)
### BUGGY CODE ###

from math import ceil
mod=10**9+7
def comb(a,b):
	if a<b:
		return 0
	fac=[1]
	for i in range(a):
		fac.append(fac[i]*(i+1))
	r=pow(fac[b]*fac[a-b]%mod,mod-2,mod)
	return fac[a]*r%mod
n,k=map(int,input().split())
for i in range(1,k+1):
	q=comb(n-k+1,i)
	qq=comb(k-i+i-1,i-1)
	print(q*qq%mod)



### FIXED CODE ###

from math import ceil
mod=10**9+7
fac=[1]
for i in range(2002):
	fac.append(fac[i]*(i+1))
def comb(a,b):
	if a<b:
		return 0
	r=pow(fac[b]*fac[a-b]%mod,mod-2,mod)
	return fac[a]*r%mod
n,k=map(int,input().split())
for i in range(1,k+1):
	q=comb(n-k+1,i)
	qq=comb(k-i+i-1,i-1)
	print(q*qq%mod)
### BUGGY CODE ###

n = int(input())
if n%2 == 0 or n%5 == 0:
    print(-1)
else:
    s = 7
    c = 1
    while(True):
        if s % n == 0:
            print(c)
            break
        if c > n:
            print(-1)
            break
        s = s*10 + 7
        c+= 1

### FIXED CODE ###

def phi(n):
    res = n
    i = 2
    while i * i <= n:
        if n % i == 0:
            res = res // i * (i - 1)
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res = res // n * (n - 1)
    return res


def divisors(n):
    sq = int(n ** .5)
    res = ((i, n // i) for i in range(1, sq + 1) if n % i == 0)
    from itertools import chain
    flatten = chain.from_iterable
    return sorted(set(flatten(res)))


def f(K):
    L = 9 * K
    if K % 7 == 0:
        L //= 7
    r1 = phi(L)
    for d in divisors(r1):
        if pow(10, d, L) == 1:
            return d
    return -1


###
if __name__ == '__main__':
    K = int(input())
    res = f(K)
    print(res)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
ball = [0 for i in range(n)]
count = 0 #ボールが入ってる箱の数
index = [] #ボールが入ってる番号

for i in range(n-1, -1, -1):
    balls = 0
    for j in [k for k in range(i,n) if (k+1)%(i+1)]:
        balls += ball[j]
    if a[i] != balls%2:
        a[i] = 1
        count += 1
        index.append(i+1)
        
ans = ""
for i in range(len(index)):
    if i < len(index)-1:
        ans += str(index[i]) + " "
    else:
        ans += str(index[i])
print(count)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ball = [0 for i in range(n)]
count = 0 #ボールが入ってる箱の数
index = [] #ボールが入ってる番号

for i in range(n-1, -1, -1):
    balls = 0
    j = i
    while j +(i+1) < n:
        j += i + 1
        balls += ball[j]
    
    if a[i] != balls%2:
        ball[i] = 1
        count += 1
        index.append(i+1)
        
ans = ""
for i in range(len(index)):
    if i < len(index)-1:
        ans += str(index[i]) + " "
    else:
        ans += str(index[i])
print(count)
print(ans)
### BUGGY CODE ###

n = int(input())
a = [0]
a.extend(list(map(int, input().split())))
max_a = max(a)
counter = [0]*(max_a+1)
combi = [0]*(max_a+1)
for num in a:
    counter[num] += 1
# print(counter)
for i in range(1, max_a+1):
    if counter[i] != 0:
        for j in range(max_a+1):
            if i != j:
                combi[j] += counter[i]*(counter[i]-1)//2
            else:
                combi[j] += (counter[i]-1)*(counter[i]-2)//2
for j in range(1,n+1):
    print(combi[a[j]])

### FIXED CODE ###

n = int(input())
a = [0]
a.extend(list(map(int, input().split())))
max_a = max(a)
counter = [0]*(max_a+1)
combi_common = 0
for num in a:
    counter[num] += 1
for i in range(1, max_a+1):
    if counter[i] >= 2:
        combi_common += counter[i]*(counter[i]-1)//2
for j in range(1,n+1):
    cou = counter[a[j]]
    if cou >= 2:
        out = combi_common + ((cou-1)*(cou-2) - cou*(cou-1))//2
    else:
        out = combi_common
    print(out)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n,m=map(int,input().split())
a=[]
mod=1000000007
for _ in range(m):
    a.append(int(input()))
ans=[1]+[0]*(n)
for i in range(1,n+1):
    if i in a:
        ans[i]=0
    else:
        ans[i]=(ans[i-1]+ans[i-2])%mod
print(ans[n])

### FIXED CODE ###

# -*- coding: utf-8 -*-
n,m=map(int,input().split())
a=[]
mod=1000000007
for _ in range(m):
    a.append(int(input()))
a=set(a)
ans=[1]+[0]*(n)
for i in range(1,n+1):
    if i in a:
        ans[i]=0
    else:
        ans[i]=(ans[i-1]+ans[i-2])%mod
print(ans[n])
### BUGGY CODE ###

N,M=map(int, input().split())
G=[list() for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
ans=0
index=-1
for i in range(1,N):
    for p in G[i]:
        if index<p<i:
            ans+=1
            index=i-1
import time
time.sleep(1.54)
print(ans)


### FIXED CODE ###

N,M=map(int, input().split())
G=[list() for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
ans=0
index=-1
for i in range(1,N):
    for p in G[i]:
        if index<p<i:
            ans+=1
            index=i-1
print(ans)
### BUGGY CODE ###

N=int(input())

graph=[]
for i in range(N):
  graph.append([])

for i in range(N):
  S=list(map(int,input()))
  for j in range(N):
    if S[j]==1:
      graph[i].append(j)
      
#print(graph)
max_set=-1
for i in range(N):
  node_list=[-1]*N
  #bfs
  d=1
  queue=[i]
  illegal=False
  while(True):
    new_queue=[]
    for q in queue:
      node_list[q]=d
      for qq in graph[q]:
        if node_list[qq]==-1:
          new_queue.append(qq)
        elif node_list[qq]!=d-1:
          illegal=True
          break
      
    if illegal:
      break
    elif len(new_queue)==0:
      #print(node_list,d)
      max_set=max(max_set,d)
      break
    else:
      #print(node_list,new_queue)
      queue=new_queue
      d+=1
      
print(max_set)


### FIXED CODE ###

N=int(input())

graph=[]
for i in range(N):
  graph.append([])

for i in range(N):
  S=list(map(int,input()))
  for j in range(N):
    if S[j]==1:
      graph[i].append(j)
      
#print(graph)
max_set=-1
for i in range(N):
  node_list=[-1]*N
  #bfs
  d=1
  queue={i}
  illegal=False
  while(True):
    new_queue=set()
    for q in queue:
      node_list[q]=d
      for qq in graph[q]:
        if node_list[qq]==-1:
          new_queue.add(qq)
        elif node_list[qq]!=d-1:
          illegal=True
          break
      
    if illegal:
      break
    elif len(new_queue)==0:
      #print(node_list,d)
      max_set=max(max_set,d)
      break
    else:
      #print(node_list,new_queue)
      queue=new_queue
      d+=1
      
print(max_set)
### BUGGY CODE ###

from collections import deque

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

G = [[] for i in range(n)]
check, dist = [0 for i in range(n)], [-1 for i in range(n)]


def bfs(s, e):
    for i in range(n):
        check[i], dist[i] = 0, -1
    q = deque()

    check[s], dist[s] = 1, 0
    q.append(s)

    while len(q) != 0:
        u = q.popleft()
        for v in range(len(G[u])):
            if check[G[u][v]] == 0:
                check[G[u][v]], dist[G[u][v]] = 1, dist[u] + 1
                q.append(G[u][v])

        check[u] = 2

    return dist[e]


def main():
    for i in range(m):
        a, b = map(int, input().split())
        G[a].append(b)
        G[b].append(a)

    q = int(input())

    for i in range(q):
        s, t = map(int, input().split())
        k = bfs(s, t)
        if k == -1:
            print("no")
        else:
            print("yes")


if __name__ == '__main__':
    main()



### FIXED CODE ###

from collections import deque

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

G = [[] for i in range(n)]
check = [0 for i in range(n)]


def bfs(s, c):
    q = deque()

    check[s] = 1
    q.append(s)

    while len(q) != 0:
        u = q.popleft()
        for v in range(len(G[u])):
            if check[G[u][v]] == 0:
                check[G[u][v]] = 1
                q.append(G[u][v])

        check[u] = c


def main():
    for i in range(m):
        a, b = map(int, input().split())
        G[a].append(b)
        G[b].append(a)

    cnt = 2
    for i in range(n):
        if check[i] == 0:
            bfs(i, cnt)
            cnt += 1

    q = int(input())
    for i in range(q):
        s, t = map(int, input().split())
        if check[s] == check[t]:
            print("yes")
        else:
            print("no")


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

import sys,math,collections,itertools
input = sys.stdin.readline

H,W=list(map(int,input().split()))
s = [ input().rstrip() for _ in range(H)]

def isOK(start,goal):
    q =  collections.deque([start])
    dp = [[0]*W for _ in range(H)]
    while q:
        nowh,noww = q.popleft()
        dp[nowh][noww] = 1
        if s[nowh][noww] == '.':
            target_mark = '#'
        else:
            target_mark = '.'
            
        if nowh >0 and s[nowh-1][noww] == target_mark and dp[nowh-1][noww]==0:
            q.append((nowh-1,noww))
            if (nowh-1,noww)==goal:
                return True

        if nowh <H-1 and s[nowh+1][noww] == target_mark and dp[nowh+1][noww]==0:
            q.append((nowh+1,noww))
            if (nowh+1,noww)==goal:
                return True
            
        if noww > 0 and s[nowh][noww-1] == target_mark and dp[nowh][noww-1]==0:
            q.append((nowh,noww-1))
            if (nowh,noww-1)==goal:
                return True

        if noww < W-1 and s[nowh][noww+1] == target_mark and dp[nowh][noww+1]==0:
            q.append((nowh,noww+1))
            if (nowh,noww+1)==goal:
                return True
    return False

cnt = 0

for iw in range(W):
    for ih in range(H):
        if s[ih][iw] =='#':
            start = (ih,iw)
        else:
            continue
        for giw in range(W):
            for gih in range(H):
                flag = abs(iw-giw)+abs(ih-gih)
                if flag%2==1 and s[gih][giw] == '.':
                    goal = (gih,giw)
                    cnt += isOK(start,goal)
                else:
                    continue
print(cnt)


### FIXED CODE ###

import sys,math,collections,itertools
input = sys.stdin.readline

H,W=list(map(int,input().split()))
s = [ input().rstrip() for _ in range(H)]
dp = [[0]*W for _ in range(H)]

def isOK(start):
    q =  collections.deque([start])
    dp[start[0]][start[1]] = 1
    black,white=0,0
    while q:
        nowh,noww = q.popleft()
        if s[nowh][noww] == '.':
            target_mark = '#'
            white +=1
        else:
            target_mark = '.'
            black +=1
        if nowh >0 and s[nowh-1][noww] == target_mark and dp[nowh-1][noww]==0:
            q.append((nowh-1,noww))
            dp[nowh-1][noww]=1
        if nowh <H-1 and s[nowh+1][noww] == target_mark and dp[nowh+1][noww]==0:
            q.append((nowh+1,noww))
            dp[nowh+1][noww]=1
        if noww > 0 and s[nowh][noww-1] == target_mark and dp[nowh][noww-1]==0:
            q.append((nowh,noww-1))
            dp[nowh][noww-1]=1
        if noww < W-1 and s[nowh][noww+1] == target_mark and dp[nowh][noww+1]==0:
            q.append((nowh,noww+1))
            dp[nowh][noww+1]=1
            
    return black*white

cnt = 0

start_candi = []
end_candi = []
for ih in range(H):
    for iw in range(W):
        if s[ih][iw] == '#':
            start_candi.append((ih,iw))
        else:
            end_candi.append((ih,iw))

for ih in range(H):
    for iw in range(W):
        if dp[ih][iw] == 0:
            start = (ih,iw)
            cnt += isOK(start)
        else:
            continue

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

import fractions
from functools import reduce

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

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

max_gcd = 0
for i in range(len(li)):
    if li[i] <= max_gcd:
        continue
    tmp = li[i]
    del li[i]
    tmp_gcd = gcd(*li)
    if max_gcd < tmp_gcd:
        max_gcd = tmp_gcd
    li.insert(0,tmp)

print(max_gcd)

### FIXED CODE ###

from fractions import gcd

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

# 入力が2つなら最大値が解となる
if n == 2:
    print(max(A))
    exit()

# A1 A2 A3の最大公約数はA1とA2の最大公約数とA3の最大公約数と同値になるので、
# 左右から順番に最大公約数を求めていく。
# 初期値を代入する（右からは0番目にAの最初の要素を、左からは末尾にAの末尾の要素）
gcdL = [0]*n
gcdR = [0]*n
gcdL[0] = A[0]
gcdR[-1] = A[-1]

for i in range(1, n):
    gcdL[i] = gcd(gcdL[i-1], A[i])
    gcdR[-i-1] = gcd(gcdR[-i], A[-i-1])

# A0～AiとAi+1～Anの最大公約数を求めていく
# 最大値が解となる
ans = gcdR[1]
for i in range(1, n-1):
    tmp = gcd(gcdL[i-1], gcdR[i+1])
    ans = max(ans, tmp)
ans = max(ans, gcdL[-2])

print(ans)