Harryxun/stf_run huggingface dataset:
"""
方針
nは１<= n <= 200なので、
あらかじめ200まで全探索 O(n*2*√n)
"""
def countyakusu(n):
    cnt = 0
    for i in range(1,int(math.sqrt(n))+1):
        if n%i == 0:
            cnt += 1
            if i != n//i:
                cnt += 1
    return cnt
result = [0]*200
for i in range(1,201):
    if i%2 != 0:
        result[i-1] = countyakusu(i)

n = int(input())
cnt = 0
for i in range(n):
    if result[i] == 8:cnt += 1
print(cnt)

### FIXED CODE ###

import math
"""
方針
nは１<= n <= 200なので、
あらかじめ200まで全探索 O(n*2*√n)
"""
def countyakusu(n):
    cnt = 0
    for i in range(1,int(math.sqrt(n))+1):
        if n%i == 0:
            cnt += 1
            if i != n//i:
                cnt += 1
    return cnt
result = [0]*200
for i in range(1,201):
    if i%2 != 0:
        result[i-1] = countyakusu(i)

n = int(input())
cnt = 0
for i in range(n):
    if result[i] == 8:cnt += 1
print(cnt)
N, M = [int(_) for _ in input().split()]
S = input()
T = input()


def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    else:
        return y


if N > M:
    L = N * M // gcd(N, M)
else:
    L = N * M // gcd(M, N)

p = L // N
q = L // M

U = ['a'] * L
for i in range(N):
    U[i * p] = S[i]
for i in range(M):
    U[i * q] = T[i]

if all([U[i * p] == S[i] for i in range(N)]):
    print(L)
else:
    print(-1)


### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
S = input()
T = input()


def gcd(x, y):
    if x < y:
        return gcd(y, x)
    elif y == 0:
        return x
    else:
        return gcd(y, x % y)


g = gcd(N, M)
if (g == 1 and S[0] == T[0]) or S[::N // g] == T[::M // g]:
    print(N * M // g)
else:
    print(-1)
import heapq
n=int(input())
l=list(map(int,input().split()))
q=[]
for i in range(n):
    heapq.heappush(q,l[i])
a1=[0]*(n+1)
a1[0]=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    a1[i+1]=a1[i]-p+max(p,l[i+n])
    heapq.heappush(q,max(p,l[i+n]))
q=[]
l.reverse()
for i in range(n):
    heapq.heappush(q,-l[i])
a1.reverse()
a1[0]-=sum(l[:n])
z=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    z=z-min(-p,l[i+n])
    a1[i+1]-=z
    heapq.heappush(q,max(p,-l[i+n])
print(max(a1))

### FIXED CODE ###

import heapq
n=int(input())
l=list(map(int,input().split()))
q=[]
for i in range(n):
    heapq.heappush(q,l[i])
a1=[0]*(n+1)
a1[0]=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    a1[i+1]=a1[i]-p+max(p,l[i+n])
    heapq.heappush(q,max(p,l[i+n]))
#print(a1)
q=[]
l.reverse()
for i in range(n):
    heapq.heappush(q,-l[i])
a1.reverse()
a1[0]-=sum(l[:n])
z=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    z=z+p+min(-p,l[i+n])
    a1[i+1]-=z
    heapq.heappush(q,max(p,-l[i+n]))
print(max(a1))
a,b,c = map(int,input.split())
print('bust') if a+b+c>= 22 else print('win')

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b+c>= 22:
  print('bust')
else:
  print('win')
n, h, d = map(int, input().split())
MOD = 10 ** 9 + 7


if n * h >= 10 ** 7:
    print(re)

# dp[i][j] := 高さiのブロックが最大高さでj個ある時の通り数
dp = [[0] * (n + 1) for i in range(h + 1)]
dp[0][n] = 1

# O(HN)
ru = [[0] * (n + 2) for i in range(h + 1)]
ru[0][n + 1] = 1
for i in range(h):
    # j = 0 -> j = 1 にする
    for diff in range(1, d + 1):
        if i + 1 - diff < 0:
            continue
        dp[i + 1][1] += ru[i + 1 - diff][n + 1]

    # j - 1 -> j にする
    for j in range(2, n + 1):
        dp[i + 1][j] += dp[i + 1][j - 1] * j
        dp[i + 1][j] %= MOD

    for j in range(n + 1):
        ru[i + 1][j + 1] = ru[i + 1][j] + dp[i + 1][j]
        ru[i + 1][j + 1] %= MOD

print(dp[-1][-1] % MOD)

### FIXED CODE ###

n, h, d = map(int, input().split())
MOD = 10 ** 9 + 7


fact = [1] * (n + 1)
for i in range(n):
    fact[i + 1] = fact[i] * (i + 1)
    fact[i + 1] %= MOD

# fact_sum = fact[1] + fact[2] + ... + fact[n]
fact_sum = 0
for i in range(1, n + 1):
    fact_sum += fact[i]
    fact_sum %= MOD

dp = [0] * (h + 1)
ru = [0] * (h + 2)
dp[0] = 1
ru[1] = 1
for i in range(h):
    l = max(i + 1 - d, 0)
    dp[i + 1] += (ru[i + 1] - ru[l]) * fact_sum
    dp[i + 1] %= MOD
    ru[i + 2] = ru[i + 1] + dp[i + 1]
    ru[i + 2] %= MOD

print((dp[-1] * fact[n] * pow(fact_sum, MOD - 2, MOD)) % MOD)
def prime(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








n=int(input(""))

s=0

t=0
lista=prime(n)
aa=len(lista)
c=lista[0]
for i in lista:
    if (c==i):
        t+=1
    else:
        k=1
        while(t>=k):
            t-=k
            s+=1
            k+=1
        t=1
        c=i

if(t!=1):
    k=1
    while(t>=k):
        t-=k
        s+=1
        k+=1
    


        
    
    
    
    
if(n==1):
    print(0)
else:

    print(s)
    
        
            
            
    
    


### FIXED CODE ###

def prime(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





n=int(input(""))
s=0
if(n!=1):
    

    

    t=0
    lista=prime(n)
    #print(lista)
    
    c=lista[0]
    for i in lista:
        if (c==i):
            t+=1
        else:
            k=1
            while(t>=k):
                t-=k
                s+=1
                k+=1
            t=1
            c=i


    k=1
    while(t>=k):
        t-=k
        s+=1
        k+=1
        


            
        
        
    
    


print(s)
a,b = [0]*n,[0]*n
c = h//max(a) + 1
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
    c = min(c,c0)
print(c)

### FIXED CODE ###

n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
A = max(a)
s = list()
for i in range(n):
    if b[i] > A:
        s.append(b[i])
s.sort()
s.reverse()
c = sum(s)
if c < h:
    print(len(s) + (h-c)//A + [1,0][(h-c)%A==0])
else:
    S = 0
    for i in range(len(s)):
        S += s[i]
        if S >= h:
            print(i+1)
            break
N,A = map(int,input().split())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")
A,B,K = map(int,input().split())
if K < A:
  print(A - k, B)
elif A < K and K < A + B:
  print(0, B - (K - A))
else:
  print(0,0)

### FIXED CODE ###

A,B,K = map(int,input().split())
if K < A:
  print(A - K, B)
elif A <= K and K < (A + B):
  print(0, B - (K - A))
else:
  print(0,0)
n = int(input())
a = input().split(" ")

max = a[0]
for i in range(1,n) :
    if max < a[i] :
        max = a[i]

f = 0
for j in range(1,int(max)) :
    for d in range(0,n) :
        f[j] += j//a[d]

max1 = 0
for i in range(1,int(max)):
    if max1 < f[i] :
        max1 = f[i]

print(max1)

### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split()]
print(sum(a)-N)
N, M ,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ruiA, ruiB = [0], [0]

for i in range(N):
    ruiA.append(ruiA[i] + A[i])

for j in range(M):
    ruiB.append(ruiB[j] + B[j])

tmpa, tmpb = 0, 0
tmp = 0
t = False
for i in range(N + M + 1):
    if i <= N and ruiA[i] <= K:
        continue
    if i <= M and ruiB[i] <= K:
        continue
    if ruiA[N] + ruiB[i - N] <= K:
        continue
    if ruiA[i - M] + ruiB[M] <= K:
        continue
    
    t = False
    for j in range(max(0, i - N), min(i, M)):
        if ruiA[i - j] + ruiB[j] <= K:
            t = True
            break

    if not t:
        print(i - 1)
        exit()

print(N + M)


### FIXED CODE ###

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

ruiA, ruiB = [0], [0]

for i in range(N):
    ruiA.append(ruiA[i] + A[i])

for j in range(M):
    ruiB.append(ruiB[j] + B[j])

t = False
for i in range(N + M + 1):
    if i <= N and ruiA[i] <= K:
        continue
    if i <= M and ruiB[i] <= K:
        continue
    if i > N and ruiA[N] + ruiB[i - N] <= K:
        continue
    if i > M and ruiA[i - M] + ruiB[M] <= K:
        continue

    t = False
    for j in range(0, i + 1):
        if j > M or i - j > N:
            continue
        if ruiA[i - j] + ruiB[j] <= K:
            t = True
            break

    if not t:
        print(i - 1)
        exit()

print(N + M)
L,R=map(int,input().split())
li=[]
for i in range(L,R):
  for j in range(i+1,R+1):
    mod=(i*j)%2019
    if mod==0:
      break
    li.append(mod)
print(min(li))

### FIXED CODE ###

n,a,b=map(int,input().split())
print(min(n*a,b))
N = int(input)
if N ==0:
  print(1)
else:
  print(0)

### FIXED CODE ###

N = int(input())
if N ==0:
  print(1)
else:
  print(0)
if int(input)>=30:print('Yes')
else:print('No')

### FIXED CODE ###

if int(input())>=30:print('Yes')
else:print('No')
n=int(input())
x=input()
import sys
sys.setrecursionlimit(10**7)

def pc(x):
  a=bin(x)[2:]
  return a.count('1')
def func(x):
  if x==0:
    return 0
  else:
    return func(x%pc(x))+1
pcx=x.count('1')
x0,x1=0,0
for i in range(n):
  if x[i]=='1':
    x0+=pow(2,n-1-i,pcx-1)
    x0%=pcx-1
    x1+=pow(2,n-1-i,pcx+1)
    x1%=pcx+1
for i in range(n):
  ans=0
  if x[i]=='1':
    xx=x0-pow(2,n-1-i,pcx-1)
    xx%=pcx-1
    print(func(xx)+1)
  else:
    xx=x1+pow(2,n-1-i,pcx+1)
    xx%=pcx+1
    print(func(xx)+1)


### FIXED CODE ###

n=int(input())
x=input()
import sys
sys.setrecursionlimit(10**7)
if n==1:
  print(0 if x=='1' else 1)
  exit()
def pc(x):
  a=bin(x)[2:]
  return a.count('1')
def func(x):
  if x==0:
    return 0
  else:
    return func(x%pc(x))+1
pcx=x.count('1')
if pcx==0:
  for _ in range(n):
    print(1)
else:
  x0,x1=0,0
  for i in range(n):
    if x[i]=='1':
      if pcx!=1:
        x0+=pow(2,n-1-i,pcx-1)
        x0%=pcx-1
      x1+=pow(2,n-1-i,pcx+1)
      x1%=pcx+1
  for i in range(n):
    ans=0
    if x[i]=='1':
      if pcx==1:
        print(0)
      else:
        xx=x0-pow(2,n-1-i,pcx-1)
        xx%=pcx-1
        print(func(xx)+1)
    else:
      xx=x1+pow(2,n-1-i,pcx+1)
      xx%=pcx+1
      print(func(xx)+1)
N = int(input()) 
A = list(map(int,input().split()))
c = 1
for i in N-1:
  c *= A[i]
  print(c)
if c >= 10**18:
  print(-1)


### FIXED CODE ###

n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=1
  for i in ls:
    num*=i
    if num>10**18:
      num=-1
      break

  print(num)
MOD = 10**9 + 7
n = int(input())
A = list(map(int, input().split()))

import numpy
A_CS = numpy.cumsum(sorted(A, reverse=True))
A_CS = A_CS%MOD

A = sorted(A)

#print(A_CS)
ans = 0
for i in range(n-1):
#    print(A[i], A_CS[-i-2])
#    A_CS -= A[i]
    ans = (ans+(A[i]*A_CS[-i-2])%MOD)%MOD
print(ans)

### FIXED CODE ###

MOD = 10**9 + 7
n = int(input())
A = list(map(int, input().split()))

import numpy
A_CS = numpy.cumsum(sorted(A, reverse=True))
A_CS = A_CS%MOD

A = sorted(A)

#print(A_CS)
ans = 0
for i in range(n-1):
#    print(A[i], A_CS[-i-2])
#    A_CS -= A[i]
    ans = (ans+(A[i]*A_CS[-i-2])%MOD)%MOD
print(ans)
n,s = (input().split())
n = int(n)
if n % 2 == 1:
    print("No")
else: 
    t = s[0 : n//2]
    if s[n//2: n] == t:
        print('Yes')
    else:
         print('No')

### FIXED CODE ###

n = input()
s = input()
n = int(n)
if n % 2 == 1:
    print("No")
else: 
    t = s[0 : n//2]
    if s[n//2: n] == t:
        print('Yes')
    else:
         print('No')
#スペース区切りの整数の入力
tairyoku_A, kougeki_B,tairyoku_C,kougeki_D = map(int, input().split())

one = int(tairyoku_A /kougeki_D)
two = int(tairyoku_C /kougeki_B)


if(one>two):
  print("Yes")
elif:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

#スペース区切りの整数の入力
A, B,C,D = map(int, input().split())

ans_a = A
ans_c = C
count_a = 0
count_c = 0

while(ans_a>0):
  ans_a = ans_a - D
  count_a = count_a +1
  #print(count_a,":",ans_a)

while(ans_c>0):
  ans_c = ans_c - B
  count_c = count_c +1
  #print(count_c,":",ans_c)
  
if(count_a>=count_c):
  print("Yes")
else:
  print("No")
# 1.Nが三の倍数でない場合、全てが0でなければならない.(総排他的論理和が各数と等しくならねばならず、その中でa_(i-1)+a_(i+1)=a_iとなるのは0のみ)
# 2.Nが3の倍数の場合、a,b,a+bの三種類の数字で構成されていなければならず、かつそれであればよい。

N = int(input())
if(N%3 == 0):
    input_dict = {}
    for i in map(int, input().split()):
        if(i in input_dict):
            input_dict[i] += 1
        else:
           input_dict[i] = 1
    num_count = len(input_dict.keys())
    if(num_count > 3 ):
        print("No")
    elif(num_count == 2):
        if(0 in input_dict and input_dict[0] == N//3):
            print("Yes")
        else:
            print("No")
    elif(num_count == 1):
        if(0 in input_dict):
            print("Yes")
        else:
            print("No")
    else:
        if(input_list[0] ^ input_list[1] == input_list[2]):
            print("Yes")
        else:
            print("No")
else:
    for i in map(int, input().split()):
        if(i != 0):
            print("No")
            break
    else:
        print("Yes")


### FIXED CODE ###

# 1.Nが三の倍数でない場合、全てが0でなければならない.(a_i=Σa_k∧a_(i-1)+a_(i+1)=a_iとなるのはa_i=0のみ)
# 2.Nが3の倍数の場合、a,b,a+bを満たす三種類以下の数字で構成されていなければならず、かつそれであればよい。

N = int(input())
string = "No"
input_dict = {}
for i in map(int, input().split()):
    if(i in input_dict):
        input_dict[i] += 1
    else:
        input_dict[i] = 1
if((N % 3) == 0):
    num_count = len(input_dict.keys())
    if(num_count == 3 ):
        input_list = list(input_dict.keys())
        if(input_list[0] ^ input_list[1] == input_list[2] and input_dict[input_list[0]] == N//3 and input_dict[input_list[1]] == N//3):
            string = "Yes"
    elif(num_count == 2):
        if(0 in input_dict and input_dict[0] == N//3):
            string = "Yes"
    elif(num_count == 1):
        if(0 in input_dict):
            string = "Yes"
else:
    if(0 in input_dict and input_dict[0] == N):
        string = "Yes"
print(string)
while True:
    W = input()
    H = input()
    if H == 0 and W == 0: break

    for i in range(0,H) :
        for j in range(0,W):
            if(i+j)%2 == 0:
                print("#", end='')
            else:
                print(".", end='')
        print("")
     print("") 


### FIXED CODE ###

while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0: break

    for i in range(0,H) :
        for j in range(0,W):
            if(i+j)%2 == 0:
                print('#', end="")
            else:
                print('.', end="")
        print()
    print()
N = int(input())
l = [2,1]
if N <= 2 :
    print(l[N])
    exit()
for i in range(2,N+1) :
    l.append(l[i-2] + l[i-1])
print(l[-1])

### FIXED CODE ###

N = int(input())
l = [2,1]
if N  == 1 :
    print(l[1])
    exit()
for i in range(2,N+1) :
    l.append(l[i-2] + l[i-1])
print(l[-1])
number1 = input("First number: ") 
number2 = input("\nSecond number: ") 
number3 = input("\nSecond number: ") 
  
if ( (number1==5&number1==7&number1==5) |
     (number1==7&number1==5&number1==5) |
     (number1==5&number1==5&number1==7) ) : 
    print("Yes") 
else: 
    print("No" ) 

### FIXED CODE ###

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

a.sort()

if a == [5,5,7] : 
  print( "YES" )
else :
  print( "NO" )
import math
a,b,c,d = map(int,input().split())
x = math.floor(b/c) - math.ceil(a/c) + 1
y = math.floor(b/d) - math.ceil(a/d) + 1
g = c * d // math.gcd(c,d)
z = math.floor(b/g) - math.ceil(a/g) + 1
print(b-a+1-(x+y-z))

### FIXED CODE ###

import math
from fractions import gcd
a,b,c,d = map(int,input().split())
x = b//c - (a-1)//c
y = b//d - (a-1)//d
l = c * d // gcd(c,d)
z = b//l - (a-1)//l
print(b-a+1-x-y+z)
N = int(input())
items = [input() for _ in range(N)]

print(len(set(items)))

### FIXED CODE ###

R = int(input())
G = int(input())

print(2*G-R)
def insertionSort(A, n, g):
    global cnt 

    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt+=1
        A[j+g] = v

def shellSort(A, n):
    global cnt
    cnt = 0
    g = 1
    G = [1]
    m = 1
    for i in range(1,101):
        tmp = G[-1]**2+g**2
        if tmp <= n:
            m = i+1
            G.append(tmp)
            g += 1
        else:
            break
    G.reverse() 
    print(m)  # 1行目
    print(" ".join(list(map(str,G))))  # 2行目
    for i in range(0,m):
        insertionSort(A, n, G[i])
    print(cnt)  # 3行目
    for i in range(0,len(A)):
        print(A[i]) # 4行目以降

cnt = 0
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellSort(A,n)


### FIXED CODE ###

def insertionSort(A, n, g):
    global cnt 

    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt+=1
        A[j+g] = v

def shellSort(A, n):
    global cnt
    cnt = 0
    g = 1
    G = [1]
    m = 1
    for i in range(1,101):
        tmp = G[i-1]+(3)**i
        if tmp <= n:
            m = i+1
            G.append(tmp)
            g += 1
        else:
            break
    G.reverse() 
    print(m)  # 1行目
    print(" ".join(list(map(str,G))))  # 2行目

    for i in range(0,m):
        insertionSort(A, n, G[i])
    print(cnt)  # 3行目
    for i in range(0,len(A)):
        print(A[i]) # 4行目以降

cnt = 0
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellSort(A,n)
x = int(input())
print x**3

### FIXED CODE ###

x=int(input())
print(x**3)
letter=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in range(len(alphabet)):
  if alphabet[i]=＝letter:
    print(alphabet[i+1])

### FIXED CODE ###

letter=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in range(len(alphabet)):
  if alphabet[i]==letter:
    print(alphabet[i+1])
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 10 ** 9+ 7
    ans = 1

    def answer(a):
        ans =1
        for i in range(k):
            ans *= a[i]
            ans %= mod
        print(ans)

    if n == k:
        answer(a)
        return

    if all([True if x < 0 else False for x in a]):
        a.sort(reverse=True)
        answer(a)
        return

    a.sort(reverse=True, key=lambda x: abs(x))
    flag = 1
    for i in range(k):
        if a[i] < 0:
            flag ^= 1
    if flag or 0 in a[:k]:
        answer(a)
        return
    
    x1, x2, y1, y2 = k-1, k-1, k, k
    while a[x1] >= 0 and x1 >= 0:
        x1 -= 1
    while a[x2] < 0 and x2 >= 0:
        x2 -= 1
    while a[y1] < 0 and y1 < n:
        y1 += 1
    while a[y2] >= 0 and y2 < n:
        y2 += 1

    if x1 == -1 or y1 == n:
        a[x2], a[y2] = a[y2], a[x2]
    
    elif x2 == -1 or y2 == n:
        a[x1], a[y1] = a[y1], a[x1]
    else:
        if a[x1]*a[y2] > a[x2]*a[y1]:
            a[x2], a[y2] = a[y2], a[x2]
        else:
            a[x1], a[y1] = a[y1], a[x1]
    answer(a)
    
    

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 10 ** 9+ 7
    ans = 1

    def answer(a):
        ans =1
        for x in a:
            ans *= x
            ans %= mod
        return ans

    if n == k:
        print(answer(a))
        return
    a.sort(reverse=True, key= lambda x:abs(x))
    if sum(x<0 for x in a[:k])%2 == 0:
        print(answer(a[:k]))
    else:
        if all(x < 0 for x in a):
            print(answer(a[-k:]))
        else:
            try:
                x1, y1= min([x for x in a[:k] if x > 0]), min([x for x in a[k:] if x < 0])
            except ValueError:
                x1, y1 = 1, 0
            try:
                x2, y2= max([x for x in a[:k] if x < 0]),\
                    max([x for x in a[k:] if x >= 0])
            except ValueError:
                x2, y2 = 1, 0
            if abs(x2*y1) > abs(x1*y2):           
                a[a.index(x1)] = y1
            else:
                a[a.index(x2)] = y2
            print(answer(a[:k]))
            


if __name__ == '__main__':
    main()
N = int(input())
AList = list(map(int, input().split()))

def getNum(a, b):
    if a == b:
        return a
    while(True):
        a, b = max(a, b), min(a, b)
        a -= b
        if a == b:
            return a

ansList = []
for i in range(0, N-1):
    ansList.append(getNum(AList[i], AList[i+1]))

print(sorted(ansList, reverse=False)[1])


### FIXED CODE ###

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

def getNum(a, b):
    while(True):
        if a == 0:
            return b
        a, b = max(a, b), min(a, b)
        a %= b

leftGBC, rightGBC= [AList[0]], [AList[-1]]
for i in range(1, N):
    leftGBC.append(getNum(leftGBC[i - 1], AList[i]))
for i in range(1, N):
    rightGBC.append(getNum(rightGBC[i - 1], AList[N - i - 1]))

rightGBC.reverse()

ans = max(leftGBC[-2], rightGBC[1])
for i in range(0, N-2):
    ans = max(getNum(leftGBC[i], rightGBC[i + 2]), ans)

print(ans)
n,k,x,y = [int(input) for i in range(4)]
print(min(n,k) * x + max(n-k,0) * y)

### FIXED CODE ###

n,k,x,y = [int(input()) for i in range(4)]
print(min(n,k) * x + max(n-k,0) * y)
N,A,B =int(input())
r = 1
S=string()
while r<=10**100:
	S='b'*B+ S+ 'r'*A
    r += 1


print(S[1:N].count(b))

### FIXED CODE ###

n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod>a:
  mod=a
print(q*a+mod)
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

A.sort()

B = []
for i in range(N):
    if i==0 or i==N-1:
        B[].append((-1)**i)
    else:
        B[i].append(((-1)**i)*2)
B.sort()

print(max(abs(sum([A[i]*B[i] for i in range(N)])),abs(sum([A[i]*B[N-1-i] for i in range(N)]))))

### FIXED CODE ###

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

A.sort()

B = []
for i in range(N):
    if i==0 or i==N-1:
        B.append((-1)**i)
    else:
        B.append(((-1)**i)*2)
B.sort()

print(max(abs(sum([A[i]*B[i] for i in range(N)])),abs(sum([A[i]*B[N-1-i] for i in range(N)]))))
a,b,k = map(int,input().split())
ans = [1]
for i in range(2,min(a,b)):
    if a%i==0 and b%i==0:
        ans.append(i)
ans.sort(reverse = True)
print(ans[k-1])

### FIXED CODE ###

a,b,k = map(int,input().split())
ans = [1]
for i in range(2,min(a,b)+1):
    if a%i==0 and b%i==0:
        ans.append(i)
ans.sort(reverse = True)
print(ans[k-1])
n,time=(map(int,input().split()))
c=[]
t=[]
for i in range(n):
    C,T=map(int,input().split())
    c.append(C)
    t.append(T)
#print(c)
#print(t)
if min(t)>time:
    print("TLE")
else:
    p=[]
    for i in range(len(t)):
        if t[i]>time:
            p.append(i)
    if len(p)==n-1:
        print(c[p[0]])
    #print(p)
    for i in p:
        del t[i]
        del c[i]
    print(min(c))

### FIXED CODE ###

n,time=(map(int,input().split()))
c=[]
t=[]
for i in range(n):
    C,T=map(int,input().split())
    c.append(C)
    t.append(T)
#print(c)
#print(t)
if min(t)>time:
    print("TLE")
else:
    for i in range(len(t)):
        if t[i]>time:
            c[i]=max(c)


    #print(c)
    if len(c)==1:
        print(c[0])
    elif len(c)==2:
        if c[0]>=c[1]:
            print(c[1])
        else:
            print(c[0])
    else:
        print(min(c))
b = input()
ACGT = 0
for i in range(len(b)):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    MAX = ACGT
    ACGT = 0
print(MAX)

### FIXED CODE ###

b = input()
len = len(b)
ACGT = 0
MAX = 0
flag = 0
for i in range(len):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    if ACGT > MAX:
      MAX = ACGT
    ACGT = 0
if ACGT > MAX:
  MAX = ACGT
print(MAX)
a = int(input())
b= [int(s) for s in input().split()]
b=sorted(b)

t = (b[0] + b[1])/2
for i in range(a-2):
  k = (t + b[i+2])/2
  t=k
  
print(k)


### FIXED CODE ###

a = int(input())
b= [int(s) for s in input().split()]
b=sorted(b)

t = (b[0] + b[1])/2

if a!=2:
	for i in range(a-2):
  		k = (t + b[i+2])/2
  		t=k

print(t)