Harryxun/stf_run huggingface dataset:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

########

if __name__ == "__main__":
    N, M = l_inpl()

    to = [[] for _ in range(N)]

    for _ in range(M):
        u, v = l_inpl()
        u, v = u-1, v-1
        to[u].append(v)

    S, T = l_inpl()
    S, T = S-1, T-1

    dist = [[INF, INF, INF] for _ in range(N)]
    dist[S][0] = 0

    q = deque([S, 0])

    while q:
        v, l = q.popleft()
        for v_to in to[v]:
            nl = (l + 1) % 3
            if dist[v_to][nl] != INF:
                continue
            dist[v_to][nl] = dist[v][l] + 1
            q.append([v_to, nl])
    
    ans = dist[T][0]
    if ans == INF:
        ans = -1
    else:
        ans = ans//3
    
    print(ans)



### FIXED CODE ###

import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

########

if __name__ == "__main__":
    N, M = l_inpl()

    to = [[] for _ in range(N)]

    for _ in range(M):
        u, v = l_inpl()
        u, v = u-1, v-1
        to[u].append(v)

    S, T = l_inpl()
    S, T = S-1, T-1

    dist = [[INF, INF, INF] for _ in range(N)]
    dist[S][0] = 0

    q = deque([])
    q.append([S, 0])

    while q:
        v, l = q.popleft()
        for v_to in to[v]:
            nl = (l + 1) % 3
            if dist[v_to][nl] != INF:
                continue
            dist[v_to][nl] = dist[v][l] + 1
            q.append([v_to, nl])
    
    ans = dist[T][0]
    if ans == INF:
        ans = -1
    else:
        ans = ans//3
    
    print(ans)
import numpy as np
n,k = map(int,input().split())
L = list( map(int,input().split()))
L = np.array(L)
set1,cnt = np.unique(L,return_counts = True)
cnt1 = sorted(cnt)
print(sum(cnt1[:len(cnt1)-k]))

### FIXED CODE ###

from collections import Counter
n,k = map(int,input().split())
L = list( map(int,input().split()))
l = len(L)
L = Counter(L)
L = sorted(list(L.most_common(k)))

ans = 0
for i in range(len(L)):
    ans += L[i][1]
if l >= ans:
    print(l - ans)
else:
    print(0)
# ABC 162

A = int(input())
# 最小公倍数
ans = 0
import math


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)

### FIXED CODE ###

A = int(input())
# 最小公倍数
ans = 0
from math import gcd


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)
n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1


for k in range(n):
	 for i in range(n):
		 for j in range(n):
			 road_matrix[i][j]  = min(road_matrix[i][k] + road_matrix[k][j], road_matrix[i][j])


mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += road_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)

### FIXED CODE ###

import itertools
import sys
input = sys.stdin.readline

n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1


for k in range(n):
	 for i in range(n):
		 for j in range(n):
			 road_matrix[i][j]  = min(road_matrix[i][k] + road_matrix[k][j], road_matrix[i][j])


mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += road_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)
A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = [0 for i in range(M)]
y = [0 for i in range(M)]
c = [0 for i in range(M)]
for i in range(M):
  x[i], y[i], c[i] = map(int, input().split())
non_coupon_val = min(a) + min(b)
coupon_val_arr = [0 for i in range(M)]
for i in range(M):
  coupon_val_arr[i] = a[x[i]] + b[y[i]] - c[i]
  coupon_val = min(coupon_val_arr)
print(min([non_coupon_val, coupon_val]))

### FIXED CODE ###

A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = [0 for i in range(M)]
y = [0 for i in range(M)]
c = [0 for i in range(M)]
for i in range(M):
  x[i], y[i], c[i] = map(int, input().split())
non_coupon_val = min(a) + min(b)
coupon_val_arr = [0 for i in range(M)]
for i in range(M):
  coupon_val_arr[i] = a[x[i]-1] + b[y[i]-1] - c[i]
coupon_val = min(coupon_val_arr)
print(min([non_coupon_val, coupon_val]))
def act(t,m,l):
    t = (t+m) % len(l);
    del l[t-1]
    return (t-1) % (len(l)+1)

while True:
    i = raw_input().split()

    n = int(i[0])
    m = int(i[1])

    if n == 0 and m == 0:
        break
    else:
        l = range(1,n+1)
        t = 0
        for i in range(n-1):
            tt = act(t,m,l);
            t = tt;
        print l[0]

### FIXED CODE ###

def act(t,m,l):
    t = (t+m) % len(l);
    del l[t-1]
    return (t-1) % (len(l)+1)

while True:
    i = raw_input().split()

    n = int(i[0])
    m = int(i[1])

    if n == 0 and m == 0:
        break
    else:
        l = range(1,n+1)
        t = 0
        for i in range(n-1):
            tt = act(t,m,l);
            t = tt;
        print l[0]
n, k = input().split()

q, mod = divmod(int(n) - 1, int(k) - 1)

if mod == 0:
  print(q)
else:
  print(q + 1)

### FIXED CODE ###

inp = input()
print(list(inp).count("+") - list(inp).count("-"))
n=int(input())
print((k//2)*(k//2+1))

### FIXED CODE ###

n=int(input())
o=int(n/2)
e=int((n+1)/2)
print(o*e)
# 人数を入力する
N = int(input())
# 名前を入力する
S = [input() for _ in range(N)]
# 単語をwordとする
word = "MARCH"
# 単語の文字数をsとする
n = len(word)
# 単語の各文字を頭文字とする人数を格納する辞書を初期化する
dic_initial = dict()
for letter in word:
    dic_initial[letter] = 0
# 単語の各文字を頭文字とする人数を調べる
for i in range(N):
    # 頭文字が単語の各文字のいずれかである場合
    if S[i][0] in dic_initial:
        # dic_initial内の人数を更新する
        dic_initial[S[i][0]] += 1
# 人の選び方の組み合わせの数を初期化する
ans = 0
# 3つの文字の組み合わせ全てについて、人の選び方の組み合わせの数を調べる
for p in range(n - 2):
    # 単語の頭からp番目の文字を頭文字とする人の数をnum_pとする
    num_p = dic_initial[word[p]]
    # num_pが0の場合、以降の処理は行わず、次の繰り返しに移る
    if num_p == 0:
        continue
    for q in range(p + 1, n - 1):
        num_q = dic_initial[word[q]]
        if num_q == 0:
            continue
        for r in range(q + 1, n):
            ans += num_p * num_q *num_r
# 出力する
print(ans)

### FIXED CODE ###

# 人数を入力する
N = int(input())
# 名前を入力する
S = [input() for _ in range(N)]
# 単語をwordとする
word = "MARCH"
# 単語の文字数をsとする
n = len(word)
# 単語の各文字を頭文字とする人数を格納する辞書を初期化する
dic_initial = dict()
for letter in word:
    dic_initial[letter] = 0
# 単語の各文字を頭文字とする人数を調べる
for i in range(N):
    # 頭文字が単語の各文字のいずれかである場合
    if S[i][0] in dic_initial:
        # dic_initial内の人数を更新する
        dic_initial[S[i][0]] += 1
# 人の選び方の組み合わせの数を初期化する
ans = 0
# 3つの文字の組み合わせ全てについて、人の選び方の組み合わせの数を調べる
for p in range(n - 2):
    # 単語の頭からp番目の文字を頭文字とする人の数をnum_pとする
    num_p = dic_initial[word[p]]
    # num_pが0の場合、以降の処理は行わず、次の繰り返しに移る
    if num_p == 0:
        continue
    for q in range(p + 1, n - 1):
        num_q = dic_initial[word[q]]
        if num_q == 0:
            continue
        for r in range(q + 1, n):
            num_r = dic_initial[word[r]]
            ans += num_p * num_q * num_r
# 出力する
print(ans)
N, K = map(int, input().split())
N = N % K

print(min(N, abs(N-K))

### FIXED CODE ###

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

print(min(N, abs(N-K)))
s=input()
list=[]
def roopR(l,n):
  if list[l]==-1:
    if n%2==0:
      return l
    else:
      return l-1
  else:
    return roopR(l+1,n+1)
  
def roopL(l,n):
  if list[l]==1:
    if n%2==0:
      return l
    else:
      return l+1
  else:
    return roopL(l-1,n+1)

a=len(s)
for i in range(a):
  if s[i]=='R':
    list.append(1)
  else:
    list.append(-1)
s.clear()
endlist=[]
for j in range(a):
  endlist.append(0)
for k in range(a):
  if list[k]==1:
    b=roopR(k,0)
    endlist[b] += 1
  else:
    b=roopL(k,0)
    endlist[b] += 1
print(*endlist)

### FIXED CODE ###

S=input()
dp=[0]*len(S)
a=0
for i in range(len(S)):
  if S[i]=='R':
    a+=1
  else:
    dp[i]+=a//2
    dp[i-1]+=a-a//2
    a=0
for i in range(len(S)-1,-1,-1):
  if S[i]=='L':
    a+=1
  else:
    dp[i]+=a//2
    dp[i+1]+=a-a//2
    a=0
print(*dp)
x = int(input())

quarter = int(x ** 0.25)
for B in range(-quarter, quarter+1):
  A = int((B**5 + x) ** 0.2)
  if A % 1 == 0:
    print(A, B)
    break

### FIXED CODE ###

x = int(input())

q = 0
while abs(x) > q**4:
  q += 1

deta = False
for A in range(-q, q+1):
  if deta:
    break
  for B in range(-q, q+1):
    if A**5 - B**5 == x:
      print(A,B)
      deta = True
      break
import math
A,B,H,M = map(float,input().split())
X = sqrt(A**2+B**2-2*A*B*math.cos(math.radians(5.5*M-30*H)))
print(X)

### FIXED CODE ###

import math
A,B,H,M = map(float,input().split())
X = math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(5.5*M-30*H)))
print(X)
N=input()
S=list(input())
 
if len(N)%2!=0:
  print('No')
else:
  if S[:N/2]==S[N/2:]:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

print(int(input())**2)
s = input()
t = input()

tl = len(t)
sl = len(s)
for i in range(sl,tl,-1) :
  st = s[i-tl:i]
  c = 0
  for j in range(tl) :
    if st[j] == '?' :
      continue
    elif st[j] != '?' and st[j] == t[j] :
      continue
    c = 1
    break
  if c == 0 :
    s = s[:i-tl] + t + s[i:]
    break

if c == 1 :
  print('UNRESTORABLE')
else : 
  print(s.replace('?', 'a'))

### FIXED CODE ###

import sys

s = input()
t = input()

tl = len(t) ; sl = len(s)

c = 1
for i in range(sl,tl-1,-1) :
  st = s[i-tl:i]
  c = 0
  for j in range(tl) :
    if st[j] == '?' :
      continue
    elif st[j] != '?' and st[j] == t[j] :
      continue
    c = 1
    break
  if c == 0 :
    s = s[:i-tl] + t + s[i:]
    break

if c == 1 :
  print('UNRESTORABLE')
else : 
  print(s.replace('?', 'a'))
A, B, C, D = [int(n) for n in input().split(' ')]

while True:
  C -= B
  if C <=0:
    print("Yes")
    break
  A-=D
  if A<=:
    print("No")
    break

### FIXED CODE ###

A, B, C, D = [int(n) for n in input().split(' ')]
 
while True:
  C -= B
  if C <=0:
    print("Yes")
    break
  A-=D
  if A<=0:
    print("No")
    break
n=int(raw_input())
s=range(1,14)
h=range(1,14)
c=range(1,14)
d=range(1,14)
 
for i in range(n):
    hd,r=raw_input().split()
    if hd=='S':
        s[int(r)-1]=0
    elif hd=='H':
        h[int(r)-1]=0
    elif hd=='C':
        c[int(r)-1]=0
    elif hd=='D':
        d[int(r)-1]=0
 
a='S '
for i in range(13):
    if s[i]!=0:
        print a +str(s[i])
a='H '
for i in range(13):
    if h[i]!=0:
        print a +str(h[i])
a='C '
for i in range(13):
    if c[i]!=0:
        print a +str(c[i])
a='D '
for i in range(13):
    if d[i]!=0:
        print a +str(d[i])

### FIXED CODE ###

cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
  
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
  
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))
import sys
n = input()
arr = [int(_) for _ in input().split()]

for i in arr:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      print("DENIED")
      sys.exit(1)

print("APPROVED")

### FIXED CODE ###

n = input()
arr = [int(_) for _ in input().split() if int(_) % 2 == 0 and int(_) % 3 != 0 and int(_) % 5 != 0]
 
if len(arr) == 0:
  print("APPROVED")
else:
  print("DENIED")
if ('a' in S) and ('b' in S) and ('c' in S):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = input()

if ('a' in S) and ('b' in S) and ('c' in S):
  print("Yes")
else:
  print("No")
import math

a, b, x = cin()

if 2 * x <= a ** 2 * b:
    p = 2 * x / (a * b)
    print(math.degrees(math.atan(b / p)))
else:
    S = x / a
    p = 2 * (a * b - S) / a
    print(90 - math.degrees(math.atan(a / p)))

### FIXED CODE ###

import math

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

a, b, x = cin()
if a * a * b == x:  print(0)
else:
    if 2 * x <= a ** 2 * b:
        p = 2 * x / (a * b)
        print(math.degrees(math.atan(b / p)))
    else:
        S = x / a
        p = 2 * (a * b - S) / a
        print(90 - math.degrees(math.atan(a / p)))
num, t = map(int, input().split())
taste = []
findmin = []

sum= 0
for i in range(1,len(num)+1):
  taste.append(t+i-1)
  sum += t+i-1
for j in range(len(taste)):
  findmin.append(j*j)
m = findmin.index(min(findmin))
print(sum - taste[m])





### FIXED CODE ###

num, t = map(int, input().split())
taste = []
findmin = []

sum= 0
for i in range(1,num + 1):
  taste.append(t+i-1)
  sum += t+i-1
for j in range(len(taste)):
  findmin.append(taste[j]*taste[j])
m = findmin.index(min(findmin))
print(sum - taste[m])
n,k = map(int,input().split())


import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):

    print((combinations_count(n-k+1,i)*combinations_count(k-1,i-1))%(10**9+7))

### FIXED CODE ###

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


import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):
    if n-k+1>=i:
        red = combinations_count(n-k+1,i)
    else:
        red = 0
    
    ls = [int(x) for x in range(1,)]

    
    print((red*combinations_count(k-1,i-1))%(10**9+7))
import math
from functools import reduce
def gcbd_list(numbers):
    return reduce(math.gcd, numbers)
def get_primenumber(number):
    prime_list = []
    search_list = list(range(2,number+1))
    while search_list[0] <= math.sqrt(number):
        head_num = search_list.pop(0)
        prime_list.append(head_num)
        search_list = [num for num in search_list if num % head_num != 0]
    prime_list.extend(search_list)
    return prime_list
N = int(input())
A = list(map(int, input().split()))
P = get_primenumber(max(A))
D = [False] * (max(A)+1)
c = True
for i in range(N):
    for j in range(len(P)):
        if A[i] % P[j] == 0:
            if D[j]:
                c = False
            D[j] = True
if c:
    print('pairwise coprime')
    exit()
if gcbd_list(A) == 1:
    print('setwise coprime')
    exit()
print('not coprime')


### FIXED CODE ###

import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
N = int(input())
A = list(map(int, input().split()))
M = [0] * (10**6+1)
for i in A:
    M[i] += 1
if gcd_list(A) > 1:
    print('not coprime')
    exit()
for i in range(2,10**6+1):
    c = 0
    for j in range(i,10**6+1,i):
        c += M[j]
    if c > 1:
        print('setwise coprime')
        exit()
print('pairwise coprime')
import math
r = int(input())
print(r ** 2 * math.pi, r * 2 * math.pi)


### FIXED CODE ###

import math

r = float(input())
print(float(r ** 2 * math.pi), float(r * 2 * math.pi))
import sys

input = sys.stdin.readline

A = int(input())
B = int(input())
ans = [1,2,3]

for value in ans:
    if A == value or B == value:
        continue:
    else:
        print(value)

### FIXED CODE ###

import sys

input = sys.stdin.readline

A = int(input())
B = int(input())
ans = [1,2,3]

for value in ans:
    if A == value or B == value:
        continue
    else:
        print(value)
S = input()
N = len(S)
zen = S[:int((N-1)/2)]
kou = S[int((N+3)/2)-1:]
if zen == zen[::-1] and kou == kou[::-1]
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
N = len(S)
zen = S[:int((N-1)/2)]
kou = S[int((N+3)/2)-1:]
if S == S[::-1] and zen == zen[::-1] and kou == kou[::-1]:
    print("Yes")
else:
    print("No")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


from collections import defaultdict


def main():
    n, m, k = map(int, input().split())
    fr_ed_c = defaultdict(int)  # node -> count

    parents = {}  # node -> parent_node
    root_2_nc = {}  # node -> count

    for i in range(m):
        a, b = map(int, input().split())
        fr_ed_c[a] += 1
        fr_ed_c[b] += 1

        p_a = get_root(parents, a)
        p_b = get_root(parents, b)

        if p_a == p_b:
            # already same cluster. do nothing.
            pass
        else:
            # cluster integration
            parents[p_a] = p_b
            if p_b not in root_2_nc:
                root_2_nc[p_b] = 1
            root_2_nc[p_b] += root_2_nc.pop(p_a, 1)

    br_ed = defaultdict(set)  # node -> set()
    for i in range(k):
        c, d = map(int, input().split())
        br_ed[c].add(d)
        br_ed[d].add(c)

    ans_list = []
    for i_m in range(n):
        i = i_m + 1
        root = get_root(parents, i)
        block_count = 0
        for b in br_ed[i]:
            b_root = get_root(parents, b)
            block_count += 1 if root == b_root else 0
        ans = root_2_nc[root] - 1 - fr_ed_c[i] - block_count
        ans_list.append(str(ans))
    print(" ".join(ans_list))


def get_root(parents, i):
    if i not in parents:
        return i
    return get_root(parents, parents[i])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


from collections import defaultdict


def main():
    n, m, k = map(int, input().split())
    fr_ed_c = defaultdict(int)  # node -> count

    parents = {}  # node -> parent_node
    root_2_nc = {}  # node -> count

    for i in range(m):
        a, b = map(int, input().split())
        fr_ed_c[a] += 1
        fr_ed_c[b] += 1

        p_a = get_root(parents, a)
        p_b = get_root(parents, b)

        if p_a == p_b:
            # already same cluster. do nothing.
            pass
        else:
            # cluster integration
            p_a_c = root_2_nc.get(p_a, 1)
            p_b_c = root_2_nc.get(p_b, 1)
            p_a, p_b = (p_a, p_b) if p_a_c < p_b_c else (p_b, p_a)
            parents[p_a] = p_b
            if p_b not in root_2_nc:
                root_2_nc[p_b] = 1
            root_2_nc[p_b] += root_2_nc.pop(p_a, 1)

    br_ed = defaultdict(set)  # node -> set()
    for i in range(k):
        c, d = map(int, input().split())
        br_ed[c].add(d)
        br_ed[d].add(c)

    ans_list = []
    for i_m in range(n):
        i = i_m + 1
        root = get_root(parents, i)
        block_count = 0
        for b in br_ed[i]:
            b_root = get_root(parents, b)
            block_count += 1 if root == b_root else 0
        ans = root_2_nc.get(root, 1) - 1 - fr_ed_c.get(i, 0) - block_count
        ans_list.append(str(ans))
    print(" ".join(ans_list))


def get_root(parents, i):
    if i not in parents:
        return i
    return get_root(parents, parents[i])


if __name__ == '__main__':
    main()
l = [int(s) for s in l]
for i in range(1,l[0]):
    if l[0] % i == 0 and l[1] % i == 0:
        c = i
print(c)



### FIXED CODE ###

l=input().split()
l = [int(s) for s in l]
a = l[0]
b = l[1]
while (b != 0 and a != 0):
    if(a < b):
        b = b % a
    else:
        a = a % b
if(a == 0):
    print(b)
else:
    print(a)
import math

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

Prefix=[0 for i in range(n + 2)] 
Suffix=[0 for i in range(n + 2)] 

Prefix[1] = a[0] 
for i in range(2,n+1): 
    Prefix[i] = math.gcd(Prefix[i - 1], a[i - 1]) 

Suffix[n] = a[n - 1] 

for i in range(n-1,0,-1): 
    Suffix[i] =math.gcd(Suffix[i + 1], a[i - 1]) 

ans = max(Suffix[2], Prefix[n - 1]) 

for i in range(2,n): 
    ans = max(ans, math.gcd(Prefix[i - 1], Suffix[i + 1])) 

print(ans)

### FIXED CODE ###

def gcd(x, y): 
   while(y): 
       x, y = y, x % y 
  
   return x

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

Prefix=[0 for i in range(n + 2)] 
Suffix=[0 for i in range(n + 2)] 

Prefix[1] = a[0] 
for i in range(2,n+1): 
    Prefix[i] = gcd(Prefix[i - 1], a[i - 1]) 

Suffix[n] = a[n - 1] 

for i in range(n-1,0,-1): 
    Suffix[i] = gcd(Suffix[i + 1], a[i - 1]) 

ans = max(Suffix[2], Prefix[n - 1]) 

for i in range(2,n): 
    ans = max(ans, gcd(Prefix[i - 1], Suffix[i + 1])) 

print(ans)
n = int(input())
s = list(set([int(input()) for _ in range(n)]))
print(len(s) )

### FIXED CODE ###

n = int(input())
s = list(set([input() for _ in range(n)]))
print(len(s) )
def main():
    import sys
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a = sorterd(a)
    limit = 10**18
    ans = 1
    for ai in a:
        ans *= ai
        if ans > limit:
            print(-1)
            exit(0)
        if ans == 0:
            break
    print(ans)

    


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(a)
    limit = 10**18
    ans = 1
    for ai in a:
        ans *= ai
        if ans > limit:
            print(-1)
            exit(0)
        if ans == 0:
            break
    print(ans)

    


if __name__ == '__main__':
    main()