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

n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

T = [0 for i in range(n)]
T[0] = t[0]
for i in range(n-1):
    T[i+1] = T[i] + t[i+1]

INF = float('inf')
V = [INF for i in range(2*T[n-1]+1)]

for i in range(2*T[n-1]+1):
    V[i] = min(V[i], 0.5 * i)
    V[i] = min(V[i], T[n-1] - 0.5 * i)

for vi in range(n):
    for ti in range(2*T[n-1]+1):
        if vi == 0:
            if ti <= T[0] * 2:
                V[ti] = min(V[ti], v[0])
            else:
                V[ti] = min(V[ti], v[0] + ti * 0.5 - T[0])
        else:
            if ti <= T[vi-1] * 2:
                V[ti] = min(V[ti], v[vi] + T[vi-1] - ti * 0.5)
            elif (T[vi-1] * 2 <= ti) and (ti <= T[vi] * 2):
                V[ti] = min(V[ti], v[vi])
            else:
                V[ti] = min(V[ti], v[vi] + (ti * 0.5 - T[vi]))

ans = 0
for i in range(2*T[n-1]):
    ans += (V[i] + V[i+1]) * 0.5 * 0.5

print(ans)

### FIXED CODE ###

n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

T = [0 for i in range(n)]
T[0] = t[0]
for i in range(n-1):
    T[i+1] = T[i] + t[i+1]

INF = float('inf')
V = [INF for i in range(2*T[n-1]+1)]

for i in range(2*T[n-1]+1):
    V[i] = min(V[i], 0.5 * i)
    V[i] = min(V[i], T[n-1] - 0.5 * i)

for vi in range(n):
    for ti in range(2*T[n-1]+1):
        if vi == 0:
            if ti <= T[0] * 2:
                V[ti] = min(V[ti], v[0])
            else:
                V[ti] = min(V[ti], v[0] + ti * 0.5 - T[0])
        else:
            if ti <= T[vi-1] * 2:
                V[ti] = min(V[ti], v[vi] + T[vi-1] - ti * 0.5)
            elif (T[vi-1] * 2 <= ti) and (ti <= T[vi] * 2):
                V[ti] = min(V[ti], v[vi])
            else:
                V[ti] = min(V[ti], v[vi] + (ti * 0.5 - T[vi]))

ans = 0
for i in range(2*T[n-1]):
    ans += (V[i] + V[i+1]) * 0.5 * 0.5

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

n = int,input()
a = list(map(int, input().split()))
wa = []
ans = 0
wa.append(a[0])
for i in range(1,len(a)):
    wa.append(wa[i-1] + a[i])
ans += wa.count(0)
for i in range(0,len(a)):
    wa2 = []
    wa2 = list(map(lambda x: x-wa[i], wa))
    wa3 = wa2[i+1:]
    ans += wa3.count(0)
print(ans)


### FIXED CODE ###

n = int,input()
a = list(map(int, input().split()))
total = []
ans = 0
dic = {0:1}
for i in range(0,len(a)):
    if(i == 0):
        total.append(a[0])
    else:
        total.append(total[i-1] + a[i])
    ans += dic.get(total[i],0)
    if total[i] in dic:
        dic[total[i]] += 1
    else:
        dic[total[i]] = 1
print(ans)
### BUGGY CODE ###

x=int(input())

ans=0
for i in range(x//105+1):
    for j in range(x//104+1):
        for k in range(x//103+1):
            for l in range(x//102+1):
                for m in range(x//101+1):
                    for n in range(x//100+1):
                        if i*105+j*104+k*103+l*102+m*101+n*100==x:
                            ans=1
                            break

print(ans)

### FIXED CODE ###

x=int(input())

num = x//100
div = x%100
ans=0

if  0<=div<=(num*5):
    ans=1

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

import math
from functools import reduce
import itertools

limit_num = int(input())

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

result = 0

for num in list(itertools.product(range(1, limit_num + 1), repeat=3)):
	result += gcd(num)

print(int(result))


### FIXED CODE ###

import math
from functools import reduce
import itertools

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

limit_num = int(input())
result_list = []
for num in itertools.product(range(1, limit_num + 1), repeat=3):
	result_list.append(gcd(num))

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

N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(lis):
  p = lis.pop(0)
  primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
print(' '.join(map(str, primes[:N])))

### FIXED CODE ###

N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(p*p < 55555):
  p = lis.pop(0)
  if p%5==1:primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
while(len(primes)<=56):
  p = lis.pop(0)
  if p%5==1:primes.append(p)

print(' '.join(map(str, primes[:N])))
### BUGGY CODE ###

import bisect
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
d = int(input())
graph = [0 for i in range(n+1)]
for i in range(n-1):
  x = bisect.bisect_right(a,a[i]+d)
  graph[i+1] = x
group = [0]*(n+1)
row = [[] for i in range(n)]
cnt = 0
for i in range(1,n+1):
  if group[i] == 0:
    cnt += 1
    x = i
    while True:
      row[cnt].append(x)
      group[x] = cnt
      if x == n:
        break
      x = graph[x]
q = int(input())
for _ in range(q):
  l,r = map(int,input().split())
  if l>r:
    l,r = r,l
  x = group[l]
  yl = bisect.bisect_left(row[x],l)
  yr = bisect.bisect_left(row[x],r)
  print(yr-yl)

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
d = int(input())
graph = [[0 for i in range(n+1)] for j in range(18)]
for i in range(n):
  x = bisect.bisect_right(a,a[i]+d)
  graph[0][i+1] = x
for j in range(1,18):
  for i in range(n):
    t = graph[j-1][i+1]
    graph[j][i+1] = graph[j-1][t]
q = int(input())
for _ in range(q):
  x,y = map(int,input().split())
  x,y = min(x,y),max(x,y)
  ans = 0
  for j in range(18)[::-1]:
    if graph[j][x] < y:
      ans += 2**j
      x = graph[j][x]
    if j == 0 and x < y:
      ans += 1
  print(ans)
### BUGGY CODE ###

n, s = map(int, input().split())
a = tuple(map(int, input().split()))
MOD = 998244353

# dp0 = [[0] * (s + 1) for _ in range(n + 1)]
# dp0[0][0] = 1
# for i in range(n):  # ここをrange(i, n)にすると、f(i, r)の計算ができる
#     for j in range(s + 1):
#         dp0[i + 1][j] += dp0[i][j]  # do NOT use a[i]
#         if j + a[i] <= s:
#             dp0[i + 1][j + a[i]] += dp0[i][j]  # USE a[i]
# # f(1, n) = dp0[n][s]
# # f(1, i) = dp0[i][s] (i = 1, 2, ..., n)
# print('dp0')
# print(*dp0, sep='\n')

dp = [[[0] * 2 for _ in range(s + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
ans = 0
for i in range(n):
    for j in range(s + 1):
        # i番目の要素は使わない
        dp[i + 1][j][0] += dp[i][j][0]
        dp[i + 1][j][0] %= MOD
        dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1]
        dp[i + 1][j][1] %= MOD

        if j + a[i] <= s:
            dp[i + 1][j + a[i]][1] += dp[i][j][0] + dp[i][j][1]
            dp[i + 1][j + a[i]][1] %= MOD

    ans += dp[i + 1][s][1]
    ans %= MOD
# dp[r][s][1] = \sum_{i=1}^{r} f(i, r)

# print('dp[][][1]')
# for i in range(n + 1):
#     print([dp[i][j][1] for j in range(s + 1)])

print(ans)


### FIXED CODE ###

n, s = map(int, input().split())
a = tuple(map(int, input().split()))
MOD = 998244353

# dp = [[0] * (s + 1) for _ in range(n + 1)]
# dp[0][0] = 1
# for i in range(n):  # ここをrange(i, n)にすると、f(i, r)の計算ができる
#     for j in range(s + 1):
#         dp[i + 1][j] += dp[i][j]  # do NOT use a[i]
#         if j + a[i] <= s:
#             dp[i + 1][j + a[i]] += dp[i][j]  # USE a[i]
# # f(1, n) = dp[n][s]
# # f(1, i) = dp[i][s] (i = 1, 2, ..., n)
# print('dp')
# print(*dp, sep='\n')

dp0 = [[0] * (s + 1) for _ in range(n + 1)]
dp1 = [[0] * (s + 1) for _ in range(n + 1)]
dp0[0][0] = 1
ans = 0
for i in range(n):
    for j in range(s + 1):
        # i番目の要素は使わない
        dp0[i + 1][j] += dp0[i][j]
        dp0[i + 1][j] %= MOD
        dp1[i + 1][j] += dp0[i][j] + dp1[i][j]
        dp1[i + 1][j] %= MOD

        if j + a[i] <= s:
            dp1[i + 1][j + a[i]] += dp0[i][j] + dp1[i][j]
            dp1[i + 1][j + a[i]] %= MOD

    ans += dp1[i + 1][s]
    ans %= MOD
# dp[r][s][1] = \sum_{i=1}^{r} f(i, r)

# print('dp[][][1]')
# for i in range(n + 1):
#     print([dp[i][j][1] for j in range(s + 1)])

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

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

ok = [P[i] <= min(P[0:i]) for i in range(1, len(P))]
print(ok.count(True)+1)


### FIXED CODE ###

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

ac = list(itertools.accumulate(P, min))
ok = [P[i] <= ac[i] for i in range(len(P))]
print(ok.count(True))
### BUGGY CODE ###

def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    a.sort(reverse=True)
    cost=[0,2,5,5,4,5,6,3,7,6]
    dp=[-2*n]*(n+10)
    dp[0]=0
    ans=[]
    for i in range(1,n+1):
        for j in cost:
            if i>=j:
                dp[i]=max(dp[i],dp[i-j]+1)
    cnt=n
    while cnt:
        for j in a:
            if cnt>=j and dp[cnt-cost[j]]==dp[cnt]-1:
                ans.append(j)
                cnt-=cost[j]
                break
    print(''.join(map(str,ans)))

if __name__ == '__main__':
    main()

### FIXED CODE ###

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

A.sort()
A.reverse()

match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

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

for i in range(1, N + 1):
  for j in A:
    if i >= match[j]:
      dp[i] = max(dp[i], dp[i - match[j]] + 1)

max_list = []
while N:
  for j in A:
    if N >= match[j] and dp[N] == dp[N - match[j]] + 1:
      max_list.append(j)
      N -= match[j]
      break

for j in max_list:
  print(j, end="")
print("")
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque()
d.append((Ch, Cw))
flag = True
ans = 0

while True:
  while flag:
    flag = False
    for _ in range(len(d)):
      Th, Tw = d.popleft()
      for i,j in [(1,0),(-1,0),(0,1),(0,-1),(0,0)]:
        _h = Th + i
        _w = Tw + j
        _p = (_h, _w)
        temp = (Th + i, Tw + i)
        if (not (_p) in d) and _h >= 0 and _h < h and _w >= 0 and _w < w and t[_h][_w] == '.':
          d.append(_p)
          # print(_p)
          if not(i == 0 and j == 0):
            flag = True
  if (Dh,Dw) in d:
    print(ans)
    exit()
  else:
    l = set(d)
    d = deque()
    for Th,Tw in l:
      for i in [-2,-1,0,1,2]:
        for j in [-2,-1,0,1,2]:
          _h = Th + i
          _w = Tw + j
          _p = (_h, _w)
          temp = (Th + i, Tw + i)
          if (not (_p) in l) and (not (_p) in d) and _h >= 0 and _h < h and _w >= 0 and _w < w and t[_h][_w] == '.':
            d.append(_p)
    if len(d) == 0:
      print('-1')
      exit()
    ans += 1

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque([(Ch, Cw)])
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]

while True:
  # 移動A
  stemp = set()
  while len(d) != 0:
    Th, Tw = d.popleft()
    # s.add((Th, Tw))
    visited[Th][Tw] = 1
    stemp.add((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  for Th,Tw in stemp:
    for i in range(-2, 3) :
      for j in range(-2, 3) :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
  if len(d) == 0:
    print('-1')
    exit()
### BUGGY CODE ###

# i, j, k

# N * (N - 1) * (N - 2)
# 4000^3

# 4
# RRGB

# B (k=4)
# G (j=3)
# R (i=1)

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

def resolve_v1(N, S):
    count = 0
    
    for k in range(N): # O(N)
        for j in range(k):# O(k)
            for i in range(1, j): # O(j)
                if S[k] != S[j] and S[j] != S[i] and S[i] != S[k] and not k-j == j-i:
                    count += 1

    return count

def resolve_v2(N, S):
    count = 0

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

            for k in range(j+1, N):
                if S[i] == S[k] or S[j] == S[k] or k-j == j-i:
                    continue

                count += 1

    return count

if __name__ == '__main__':
    
    count = resolve_v2(N, S)
    print(count)


### FIXED CODE ###

# i, j, k

# N * (N - 1) * (N - 2)
# 4000^3

# 4
# RRGB

# B (k=4)
# G (j=3)
# R (i=1)

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

def resolve_v1(N, S):
    count = 0
    
    for k in range(N): # O(N)
        for j in range(k):# O(k)
            for i in range(1, j): # O(j)
                if S[k] != S[j] and S[j] != S[i] and S[i] != S[k] and not k-j == j-i:
                    count += 1

    return count

def resolve_v2(N, S):
    count = 0

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

            for k in range(j+1, N):
                if S[i] == S[k] or S[j] == S[k] or k-j == j-i:
                    continue

                count += 1

    return count

# R GBR G BGRGRGRGR

# k - j = j - i
# k = 2 * j - i

def resolve_v3(N, S):
    r, g, b = 0, 0, 0
    for i in range(N):
        if S[i] == 'R':
            r += 1
        elif S[i] == 'G':
            g += 1
        elif S[i] == 'B':
            b += 1

    count = r * g * b

    for i in range(N-2):
        for j in range(i+1, N-1):
            k = 2 * j - i

            if k >= N:
                break

            if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
                count -= 1

    return count


if __name__ == '__main__':
    
    count = resolve_v3(N, S)
    print(count)
### BUGGY CODE ###

while 1:
    n = input()
    if n == 0:
        break
    D = list({x**2 % n for x in xrange(1, n)})
    C = [0]*((n-1)/2)
    for i in xrange(len(D)):
        p = D[i]
        for j in xrange(i):
            q = D[j]
            g = (p - q) % n
            C[min(g, n-g)-1] += 2
    print "\n".join(map(str, C))

### FIXED CODE ###

import sys
readline = sys.stdin.readline
write = sys.stdout.write

def solve():
    N = int(readline())
    if N == 0:
        return False
    if N == 1:
        return True
    *S, = set(i**2 % N for i in range(1, N))
    S.sort()
    L = len(S)
    C = [0]*N
    D = [0]*((N-1)//2)
    for i in range(L):
        a = S[i]
        for b in S[:i]:
            C[a - b] += 2
    for i in range(1, N):
        D[min(i, N-i)-1] += C[i]
    write("\n".join(map(str, D)))
    write("\n")
    return True
while solve():
    ...
### BUGGY CODE ###

s = input()[::-1]
 
dp = [[0 for i in range(13)] for j in range(len(s)+1)]
dp[0][0]=1

res = [[x * 10 ** i % 13 for x in range(10)] for i in range(6)]
 
mod = 10 ** 9 + 7
 
for idx, char in enumerate(s):

    if char != "?":
        for i in range(13):
            new_i = (i + res[idx % 6][int(char)]) % 13
            dp[idx+1][new_i] += dp[idx][i]
    else:
        for i in range(13):
            for j in range(10):
                new_i = (i + res[idx % 6][j]) % 13
                dp[idx+1][new_i] += dp[idx][i]
        #dp = [x % mod for x in new_dp]

 
print(dp[-1][5]%mod)



### FIXED CODE ###

s=input()[::-1]

amari=[[(10**i)*x%13 for x in range(10)] for i in range(6)]
dp=[1]+[0]*12
new_dp=[0]*13

mod=10**9+7

for id,char in enumerate(s):
    new_dp=[0]*13
    if char!='?':
        for i in range(13):
            new_i=(i+amari[id%6][int(char)])%13
            new_dp[new_i]+=dp[i]
        dp=new_dp
    else:
        for i in range(13):
            for j in range(10):
                new_i=(i+amari[id%6][j])%13
                new_dp[new_i]+=dp[i]
        dp=[x%mod for x in new_dp]
print(dp[5])
### BUGGY CODE ###

N, K, L = map(int, input().split())

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, u, v):
        ru = self.root(u)
        rv = self.root(v)
        if self.rank[ru] < self.rank[rv]:
            self.par[ru] = rv
        else:
            self.par[rv] = ru
            if self.rank[ru] == self.rank[rv]:
                self.rank[ru] += 1

    def same(self, u, v):
        return self.root(u) == self.root(v)


u_road = UnionFind(N)
u_train = UnionFind(N)

for i in range(K):
    p, q = map(int, input().split())
    u_road.unite(p, q)
for i in range(L):
    r, s = map(int, input().split())
    u_train.unite(r, s)

ans = [1] * N

for i in range(1, N):
    for j in range(i+1, N+1):
        if u_road.same(i, j) and u_train.same(i, j):
            ans[i-1] += 1
            ans[j-1] += 1

print(*ans)

### FIXED CODE ###

N, K, L = map(int, input().split())

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, u, v):
        ru = self.root(u)
        rv = self.root(v)
        if self.rank[ru] < self.rank[rv]:
            self.par[ru] = rv
        else:
            self.par[rv] = ru
            if self.rank[ru] == self.rank[rv]:
                self.rank[ru] += 1

    def same(self, u, v):
        return self.root(u) == self.root(v)


u_road = UnionFind(N)
u_train = UnionFind(N)

for i in range(K):
    p, q = map(int, input().split())
    u_road.unite(p, q)
for i in range(L):
    r, s = map(int, input().split())
    u_train.unite(r, s)

mem = [set() for _ in range(N)]
mem_dict = dict()
for i in range(N):
    a = (u_road.root(i+1), u_train.root(i+1))
    mem[i] = a
    if a in mem_dict:
        mem_dict[a] += 1
    else:
        mem_dict[a] = 1

for i in range(N):
    print(mem_dict[mem[i]], end=' ')

print()
### BUGGY CODE ###

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

from fractions import gcd

def lcm(a,b):
    return a*b//gcd(a,b)

AA = 1
for i in range(N):
    AA = lcm(AA,A[i])

ans = 0
for i in range(N):
    ans += AA//A[i]
    
mod = 10**9 + 7
print(ans%mod)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
 
from fractions import gcd
 
def lcm(a,b):
    return a//gcd(a,b)*b

AA = 1
for i in range(N):
    AA = lcm(AA,A[i])
AA %= mod

ans = 0
for i in range(N):
    ans += AA*pow(A[i],mod-2,mod)
    
print(ans%mod)
### BUGGY CODE ###

a = int(input())
b = list(map(int, input().split()))
c = 1
for i in range(a):
  c *= b[i]

if c > 10**18:
  print("-1")
else:
  print(c)

### FIXED CODE ###

a = int(input())
b = list(map(int, input().split()))
c = 1
if 0 in b:
  print(0)
  exit()
for i in range(a):
  c *= b[i]
  if c > 10**18:
    print(-1)
    break
else:
  print(c)
### BUGGY CODE ###

import math
N= int(input())
c=list(str(input()))
#N=4
#c=['W', 'W', 'R', 'R']
#c.reverse()
#print(c)


num=0
for i in reversed(range(N)):
    if c[i]=='R' :
        for u in (range(num,i)):
            if c[u]=='W':
                c[u]='y'
                c[i]='W'
                num+=1
                break
            
#print(c)
print(num)

### FIXED CODE ###

N= int(input())
c=list(str(input()))
#N=4
#c=['W', 'W', 'R', 'R']
#c.reverse()
#print(c)

t1=t2=True

n1=0
n2=0
num=0
while t1:
    t2=True
    if not 0<=N-1-n1<=N-1:
        t1=False
    if c[N-1-n1]=='W':
        n1+=1
        continue
    else:
        while t2:
            if c[n2]=='W':
                if n2<N-1-n1:
                    c[N-1-n1]='W'
                    c[n2]='R'
                    num+=1
                    t2=False
                    continue
                else:
                    t1=False 
            n2+=1
            if not 0<=n2<=N-1:
                t1=False
                t2=False
print(num)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
from functools import reduce
from fractions import gcd
ans=[]
B=A.copy
for i in range(N):
    tmp=A[i]
    del A[i]
    ans.append(reduce(gcd,A))
    A.insert(i,tmp)
print(max(ans))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
from fractions import gcd
gcd_l=[0]
gcd_r=[0]
for i in range(N):
    gcd_l.append(gcd(gcd_l[i],A[i]))
    gcd_r.append(gcd(gcd_r[i],A[-(i+1)]))
gcd_r=gcd_r[::-1]
ans=[]
for i in range(N):
    ans.append(gcd(gcd_l[i],gcd_r[i+1]))
print(max(ans))
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]

c = [a.count(x) for x in set(a)]
print(len([x for x in c if x % 2 == 1]))


### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

y = a[0]
c = 1
ans = 0
for i in range(1, n):
   if (a[i] == y):
      c += 1
   else:
      if (c % 2 == 1):
         ans += 1
      y = a[i]
      c = 1

if (c % 2 == 1):
   ans += 1

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

#coding: UTF-8

x=int(input('>'))

i=1

while x !=0:
    print('Case {}: {}'.format(i,x))
    i=i+1;




### FIXED CODE ###

c = 0

while True:
    x = int(input())
    c +=1
    
    if x == 0:
        break
   
    print("Case {}: {}".format(c, x))
### BUGGY CODE ###

n=int(input())
p=[int(i) for i in input().split()]
ans=n
for i in range(1,n):
    for j in range(i):
        if (p[i]>p[j]):
            ans-=1
            break
        
print(ans)

### FIXED CODE ###

n=int(input())
p=[int(i) for i in input().split()]
flag=p[0]
ans=1
for i in range(1,n):
    if (p[i]<flag):
        flag=p[i]
        ans+=1
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
L = [i + a[i] for i in range(n)]
R = [i - a[i] for i in range(n)]
def make_dic(L):
    L_set = set(L)
    return dict([(i, L.count(i)) for i in L_set])
L_dic, R_dic = make_dic(L), make_dic(R)
cnt = 0
for Lk, Lv in L_dic.items():
    try:
        cnt += R_dic[Lk] * Lv
    except KeyError:
        pass
print(cnt)

### FIXED CODE ###

n = int(input())
L_dict, R_dict = {}, {}
i = 0
for ipt in input().split():
    try:
        L_dict[i + int(ipt)] += 1
    except KeyError:
        L_dict[i + int(ipt)] = 1
    try:
        R_dict[i - int(ipt)] += 1
    except KeyError:
        R_dict[i - int(ipt)] = 1
    i += 1
cnt = 0
for Lk, Lv in L_dict.items():
    try:
        cnt += R_dict[Lk] * Lv
    except KeyError:
        pass
print(cnt)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
import functools
import fractions
l1=[]
for i in range(n):
  a=l[0]
  del l[0]
  s = functools.reduce(fractions.gcd, l)
  l1.append(s)
  l.append(a)
print(max(l1))


### FIXED CODE ###

def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
n=int(input())
l=list(map(int,input().split()))
l1=[]
l1.append(l[0])
for i in range(1,n):
  l1.append(gcd(l1[-1],l[i]))
l2=[]
l2.append(l[-1])
for i in range(n-2,-1,-1):
  l2.append(gcd(l2[-1],l[i]))
l3=[]
for i in range(2,n):
  l3.append(gcd(l1[i-2],l2[n-i-1]))
l3.append(l2[n-2])
l3.append(l1[n-2])
print(max(l3))