Harryxun/stf_run huggingface dataset:
def answer(n, m, taro, hanako):
    for t in sorted(taro):
        for h in sorted(hanako):
            if sum(taro) - t + h == sum(hanako) - h + t:
                return '{t} {h}'
    return -1

while True:
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        break
    taro = []
    hanako = []
    for i in range(n)
        taro.append(int(input()))
    for i in range(m)
        hanako.append(int(input()))
    print(answer(n, m, taro, hanako)


### FIXED CODE ###

def answer(n, m, taro, hanako):
    for t in sorted(taro):
        for h in sorted(hanako):
            if sum(taro) - t + h == sum(hanako) - h + t:
                return f'{t} {h}'
    return -1


while True:
    n, m = map(int, input().split()) # 組み込み関数input()は標準入力から読み込まれた1行を返す．
    if n == 0 and m == 0:
        break
    taro = []
    hanako = []
    for i in range(n):
        taro.append(int(input()))
    for i in range(m):
        hanako.append(int(input()))
    print(answer(n, m, taro, hanako))
debug = 0
"""
N: state num
M: city num
"""


if debug:
    N = 2
    m = 10
else:
    (N, M) = list(map(int, input().split()))

if debug:
    p_y_list = [
        [1, 30]
        ,[1, 20]
        ,[1, 10]
        ,[1, 3]
        ,[2, 63]
        ,[2, 33]
        ,[2, 23]
        ,[3, 21]
        ,[3, 7]
    ]

city_id_list = []
# for z in range(M):
for (P, Y) in p_y_list:
    
    if not debug:
        (P, Y) = list(map(int, input().split()))

    city_id_list.append([Y, P])
    
city_id_list = sorted( city_id_list, key= lambda x: x[0])

state_cnt = {}
tmp_list = []
for (Y, P) in city_id_list:
    
    if P not in state_cnt.keys():
        state_cnt[P] = 1
    elif P in state_cnt.keys():
        state_cnt[P] += 1
        
    tmp_id = str(P).zfill(6) + str(state_cnt[P]).zfill(6)
    
    tmp_list.append([state_cnt[P], tmp_id])
    
for cid in sorted(tmp_list, key=lambda x: x[0]):
    print(cid[1])

### FIXED CODE ###

N, M = map ( int, input ( ).split ( ) )# N,Mを取得
#初期化
lists = [ ]
#listに要素を追加　後で並び変えるため並び替える前の順番を示すキーを第三要素に挿入しておく
for i in range ( M ):
    lists.append ( list ( map ( int, input ( ).split ( ) ) ) + [ i ] )
#第一要素に昇順で並び替えた後、第二要素で昇順に並び替える
lists.sort ( key=lambda x: x[ 1 ] )
lists.sort ( key=lambda x: x[ 0 ] )
# befは前回の第一要素　stateは第一要素での順位
bef = 0
state = 0
retstr = ''
triple = [ ]#第四要素に識別番号を追加したリストの初期化
for i in lists:
    if (i[ 0 ] != bef):
        bef = i[ 0 ]
        state = 1
        triple.append ( [ i[ 0 ], i[ 1 ], i[ 2 ], str ( i[ 0 ] ).rjust ( 6, '0' ) + str ( state ).rjust ( 6, '0' ) ] )
    else:
        state += 1
        triple.append ( [ i[ 0 ], i[ 1 ], i[ 2 ], str ( i[ 0 ] ).rjust ( 6, '0' ) + str ( state ).rjust ( 6, '0' ) ] )
 
triple.sort ( key=lambda x: x[ 2 ] )#第三要素で並び替えて、元の入力に対応した式ベンツ番号の順番に戻す
for i in triple:
    print ( i[ 3 ] )#識別番号の出力
A = input()
B = input()
C = input()

def next(X, i):
    if X[i] == 'a':
        return A[i]
    elif X[i] == 'b':
        return B[i]
    else:
        return C[i]

xa = 0
xb = 0
xc = 0


h = 'A'

k = next(A, xa) #最初
xa += 1

while True:
    if k == 'a':
        h = 'A'
        if(len(A) <= xa):
            break
        k = next(A, xa)
        xa += 1
    elif k == 'b':
        h = 'B'
        if(len(B) <= xb):
            break
        k = next(B, xb)
        xb += 1
    else:
        h = 'C'
        if(len(C) <= xc):
            break
        k = next(C, xc)
        xc += 1

print(h)


### FIXED CODE ###

A = input()
B = input()
C = input()

xa = 0
xb = 0
xc = 0

h = 'A'
k = A[0] #最初の１枚を抜く
xa += 1

while True:

    if k == 'a':
        h = 'A'
        if xa < len(A):
            k = A[xa]
            xa += 1
        else:
            break
    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = B[xb]
            xb += 1
        else:
            break
    elif k == 'c':
        h = 'C'
        xc += 1
        if xc < len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)
from collections import Counter
n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for j, k in sorted(dic.items):
    if k == max(dic):
        print(j)


### FIXED CODE ###


n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
for o in b:
    if o in dic:
        dic[o] += 1
    else:
        dic[o] = 1
M = max(dic.values())
for j,k in sorted(dic.items()):
    if k == M:
        print(j)
def to_sec(a):
    h,m,s = map(int,a.split(":"))
    return 3600*h+60*m+s

while 1:
    n = int(raw_input())
    if n == 0: break
    used = [0]*84401
    for loop in range(n):
        a,b = raw_input().split()
        a,b = to_sec(a),to_sec(b)
        used[a] += 1
        used[b] -= 1
    for i in range(1,84400):
        used[i] += used[i-1]
    print max(used)

### FIXED CODE ###

def to_sec(a):
    h,m,s = map(int,a.split(":"))
    return 3600*h+60*m+s

while 1:
    n = int(raw_input())
    if n == 0: break
    used = [0]*86401
    for loop in range(n):
        a,b = raw_input().split()
        a,b = to_sec(a),to_sec(b)
        used[a] += 1
        used[b] -= 1
    for i in range(1,86401):
        used[i] += used[i-1]
    print max(used)
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


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

print(lcm(a, b))


### FIXED CODE ###

import fractions

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

print((a * b) // fractions.gcd(a, b))
a = input()
b = input()

if a * b * 2  == 1:
    print('odd')
else:
    print('Even')

### FIXED CODE ###

a,b = map(int,input().split())
 
print("Even" if (a * b) % 2 == 0 else "Odd" )
n = int(input())

s = [input() for i in range(n)]

order = "MARCH"

initial_arary = [name[0] for name in s]
nums = [initial_array.count(order[i]) for i in range(len(order))]

ans = 0
for i in range(0, 5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += nums[i] * nums[j] * nums[k]
            
print(ans)



### FIXED CODE ###

n = int(input())

s = [input() for i in range(n)]

order = "MARCH"

nums = [[name[0] for name in s].count(order[i]) for i in range(len(order))]

ans = 0
for i in range(0, 5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += nums[i] * nums[j] * nums[k]
            
print(ans)
from collections import Counter

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

b = []
c = []
for i in range(q):
	B, C = map(int, input().split())
	b.append(B)
	c.append(C)

arr = Counter(a)

s = sum(arr)

for i in range(q):
	s -= b[i]*arr[b[i]]
	s += c[i]*arr[c[i]]
	ans[c[i]] += ans[b[i]]
	ans[b[i]] = 0
	print(s)

### FIXED CODE ###

from collections import Counter

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

cnt = Counter(a)

s = sum(a)

for i in range(q):
	b, c = map(int, input().split())
	s = s - b*cnt[b]
	s = s + c*cnt[b]
	cnt[c] += cnt[b]
	cnt[b] = 0
	print(s)
n, y = map(int, input())
k = 0

for i in range(n+1):
  for j in range(n+1):
    k = n - (i + j)
    z = 10000*i + 5000*j + 1000*k
    if z == y:
      print(i, j, k)
      exit()

print(-1, -1, -1)

### FIXED CODE ###

n, y = map(int, input().split())
result = 0

for i in range(n+1):
    for j in range(n+1):
        k = n - i - j
        z = 10000*i + 5000*j + 1000*k
        if z == y and k >= 0:
            result += 1
            print(i, j, k)
            exit()

if result == 0:
    print('-1 -1 -1')
N=int(input())
ans=4/n
for h in range(1,3501):
  for n in range(1,3501):
    tmp=4*h*n-N*h-N*n
    if tmp>0 and N*h*n%tmp==0:
      print(h,n,N*h*n//tmp)
      exit()

### FIXED CODE ###

N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    tmp=4*n*h-N*h-N*n
    if tmp>0:
      if N*h*n%tmp==0:
        print(h,n,N*h*n//tmp)
        exit()
N = int(input())
D = [int(input()) for i in range(N)]
D = sorted(D)[::-1]

for i in range(N):
    D[i] -= 0

DtoI = {}
pD = [-1] * N
L = [1] * N
T = [0] * N

Y = {}
cnt = 0
for i in range(N):
    DtoI[D[i]] = i

for i in range(N):
    if D[i] in Y:
        for y in Y[D[i]]:
            L[i] += L[y]
            T[i] += T[y] + L[y]
            cnt += 1
        
    p = N - 2 * L[i]
    if p <= 0 or i == N-1:
        pd = -1
    else:
        pd = D[i] - p
    pD[i] = pd
    
    if pd not in Y:
        Y[pd] = []
    Y[pd].append(i)

for i in range(N-1):
    print (i + 1, DtoI[pD[i]] + 1)

### FIXED CODE ###

def main():
    N = int(input())
    D = [int(input()) for i in range(N)]
    C = [1] * N
    T = [0] * N
    DI = {}
    for i in range(len(D)):
        DI[D[i]] = i
    D = sorted(D)
    P = [-1] * N
    while len(D) > 1:
        d = D.pop()
        i = DI[d]
        nd = d - N + C[i] * 2
        if nd in DI:
            ni = DI[nd]
        else:
            print(-1)
            return
        P[i] = ni
        C[ni] += C[i]
        T[ni] += T[i] + C[i]
    
    if D[0] == T[DI[D[0]]]:
        for i in range(N):
            if P[i] >= 0: print(i+1, P[i]+1)
    else:
        print(-1)

main()
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
for i in hyou:
  if i >= 1/4*M:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))
#!/usr/bin/env python3

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

cnt = 0
for i in range(N):
    if i+1 == P[i]:
        p = P[i]
        P[i] = P[i+1]
        P[i+1] = p
        cnt += 1

print(cnt)



### FIXED CODE ###

#!/usr/bin/env python3

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

cnt = 0
for i in range(N-1):
    if i+1 == P[i]:
        p = P[i]
        P[i] = P[i+1]
        P[i+1] = p
        cnt += 1

if P[N-1] == N:
    cnt += 1

print(cnt)
n=int(input())
d=list(map(int,input().split()))
D=sorted(d)
num=D[n/2]-D[(n/2)-1]
print(num)

### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
D=sorted(d)
num=D[n//2]-D[(n//2)-1]
print(num)
N = int(input())
s = input()

if N >= 3200:
  print(s)
else:
  print(red)

### FIXED CODE ###

N = int(input())
s = input()
 
if N >= 3200:
  print(s)
else:
  print('red')
NM = input().split(" ")
N = int(NM[0])
M = int(NM[1])

Xin= input().split(" ")


Xls = []
tousa = []
for i in range(0,M):
    Xls.append(int(Xin[i]))

Xls.sort()

for i in range(0,M-1):
    tousa.append(abs(Xls[i+1] - Xls[i]))

if M == 1:
    print(0)

tousa.sort()
for i in range(0,N-1):
    tousa.pop()

ret = 0

for i in tousa:
    ret = i + ret

print(ret)


### FIXED CODE ###

NM = input().split(" ")
N = int(NM[0])
M = int(NM[1])

Xin= input().split(" ")


Xls = []
tousa = []
for i in range(0,M):
    Xls.append(int(Xin[i]))

Xls.sort()

if M != 1:
    for i in range(0,M-1):
        tousa.append(abs(Xls[i+1] - Xls[i]))




tousa.sort()


if N<M:
    for i in range(0,N-1):
        tousa.pop()
else:
    print(0)
    exit()
ret = 0

for i in tousa:
    ret = i + ret

print(ret)
import numpy as np

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
s = np.array(s)
s = (s == ".") * 1
def neext(a):
    l, m = a[0], a[1]
    if l == 0:
        if m == 0:
            return [(l, m+1), (l+1, m)]
        elif m == w - 1:
            return [(l, m-1), (l+1, m)]
        else:
            return [(l, m+1), (l, m-1), (l+1, m)]
    elif m == 0:
        if l == h - 1:
            return [(l, m+1), (l-1, m)]
        else:
            return [(l, m+1), (l+1, m), (l-1, m)]
    elif l == h - 1:
        if m == w - 1:
            return [(l, m-1), (l-1, m)]
        else:
            return [(l, m+1), (l, m-1), (l-1, m)]
    elif m == w - 1:
        return [(l, m-1), (l+1, m), (l-1, m)]
    else:
        return [(l, m+1), (l, m-1), (l+1, m), (l-1, m)]
def solve(i, j):
    if s[i][j] == 0:
        return 0
    else:
        pre = 0
        p = np.full_like(s, -1)
        check = [((-1, -1), (i, j), 0)]#(from,now, dist)
        while check:
            From, now, d = check.pop(0)
            p[now[0]][now[1]] = d
            pre = max(pre, d)
            for b, c in neext((now[0], now[1])):
                if (b == From[0] and c == From[1]) or p[b][c] != -1 or s[b][c] == 0:
                    continue
                else:
                    check.append(((i, j), (b, c), d + 1))
        return pre
ans = 0
for H in range(len(s)):
    for W in range(len(s[0])):
        ans = max(ans, solve(H, W))
print(ans)

### FIXED CODE ###

import numpy as np
from collections import deque
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
ans = 0
for i in range(len(s)):
    for j in range(len(s[0])):
        if s[i][j] == '#':
            continue
        pre = 0
        p = np.full((h, w), -1)
        p[i][j] = 0
        check = deque([((i, j), 0)])#(from,now, dist)
        while check:
            now, d = check.popleft()
            pre = max(pre, d)
            for k, l in [(1,0), (-1,0),(0,1), (0,-1)]:
                b = now[0] + k
                c = now[1] + l
                if b < 0 or c < 0 or b >= h or c >= w:
                    continue 
                elif p[b][c] == -1 and s[b][c] != '#':
                    check.append(((b, c), d + 1))
                    p[b][c] = d + 1
        ans = max(ans, pre)

print(ans)
import math
 
N = int(input())
A = [int(i) for i in input().split()] 

 
print(math.gcd(A))

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

N = int(input())
A = [int(i) for i in input().split()]
g = A[0]
for n in range(1,N):
    g = gcd(g,A[n])

print(g)
import match
from  decimal import Decimal
a,b=map(map(Decimal,input().split()));
c=a*b
print(math.floor(c))

### FIXED CODE ###

import math
from decimal import Decimal
a,b=map(Decimal,input().split());
c=a*b
print(math.floor(c));
k = input()
if k % 2 == 1:
    print((k//2) * (k//2+1))
else:
    print((k//2) * (k//2))


### FIXED CODE ###

k = int(input())
if k % 2 == 1:
    print(k//2 * (k//2+1))
else:
    print(k//2 * k//2)
import math


def main():
    A, B, C, D = map(int, input().split())
    lcm = (C * D) // math.gcd(C, D)
    bc = B // C
    ac = A // C
    if A % C == 0:
        ac -= 1
    bd = B // D
    ad = A // D
    if A % D == 0:
        ad -= 1
    blcm = B // lcm
    alcm = A // lcm
    if A % lcm == 0:
        alcm -= 1
    print(B - A + 1 - ((bc - ac) + (bd - ad) - (blcm - alcm)))


main()


### FIXED CODE ###

import fractions


def main():
    A, B, C, D = map(int, input().split())
    lcm = (C * D) // fractions.gcd(C, D)
    bc = B // C
    ac = A // C
    if A % C == 0:
        ac -= 1
    bd = B // D
    ad = A // D
    if A % D == 0:
        ad -= 1
    blcm = B // lcm
    alcm = A // lcm
    if A % lcm == 0:
        alcm -= 1
    print(B - A + 1 - ((bc - ac) + (bd - ad) - (blcm - alcm)))


main()
mod = 1000000007
def power(x, y):
    if   y == 0     : 
        return 1
    elif y == 1     : 
        return x % mod
    elif y % 2 == 0 : 
        return power(x, y//2)**2 % mod
    else            : 
        return power(x, y//2)**2 * x % mod
X,Y = (int(i) for i in input().split())

Z = X + Y
A = max(X,Y)
B = min(X,Y)
C = A - B

if Z % 3 != 0:
    print(0)
else:
    N = Z // 3
    if (N - C) % 2 != 0:
        print(0)
    else:
        M = (N - C) // 2


        a = 1
        b = 1
        for i in range(M):
            a = (a * (i + 1)) % mod
            c = power(a, mod-2)
        for i in range(M):
            b = (b * (N-i)) % mod
        ans = b * c % mod

        print(ans)

### FIXED CODE ###

mod = 1000000007
def power(x, y):
    if   y == 0     : 
        return 1
    elif y == 1     : 
        return x % mod
    elif y % 2 == 0 : 
        return power(x, y//2)**2 % mod
    else            : 
        return power(x, y//2)**2 * x % mod
X,Y = (int(i) for i in input().split())

Z = X + Y
A = max(X,Y)
B = min(X,Y)
C = A - B

if Z % 3 != 0:
    print(0)
elif A > 2*B :
    print(0)
else:
    N = Z // 3
    if (N - C) % 2 != 0:
        print(0)
    else:
        M = (N - C) // 2


        a = 1
        b = 1
        for i in range(M):
            a = (a * (i + 1)) % mod
            b = (b * (N-i)) % mod
        c = power(a, mod-2)
        ans = b * c % mod

        print(ans)
import sys
c = 0
line = sys.stdin.readline():
while line:
    c += 1
    print 'Case %d: %s' %(c, int(x))
    line = sys.stdin.readline():

### FIXED CODE ###

c = 0
while True:
    a = int(raw_input())
    if a == 0: break
    c += 1
    print 'Case %d: %d' %(c, a)
N, M = map( int, input().split())
A = list( map( int, input().split()))
C = [0,2,5,5,4,5,6,3,7,6]
dp = [(0,0)]*(N+1)
for a in A:
    if a <= N:
        dp[C[a]] = (1,0)
Z = list( set( C[a] for a in A))
Z.sort()
for i in range(2,N+1):
    for z in Z:
        if i > z:
            if dp[i-z][0] == 1:
                dp[i] = (1, i-z)
                break
s = N
ANS = [0]*10
while s != 0:
    _, b = dp[s]
    ANS[s-b] += 1
    s = b
ans = ""
for i in range(9,0,-1):
    if ANS[C[i]] > 0:
        if i in A:
            ans = ans + str(i)*ANS[C[i]]
            ANS[C[i]] = 0
print( ans)

### FIXED CODE ###

N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*10
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    if x <= N:
        dp[x] = 1
for i in range(1,N):
    t = dp[i]
    for x in Check:
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for a in A:
        x = Needs[a]
        if t-x>=0:
            if dp[t-x]+1 == dp[t]:
                W[V[x]] += 1
                t -= x
                break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
ans = 1

for i in range(n):
  d += l[i]
  if d < x:
    ans ++;
  else:
    break
    
print(ans)

### FIXED CODE ###

x, a = map(int, input().split())
if x < a:
  print(0)
else:
  print(10)
a,b = map(int,input().)

### FIXED CODE ###

N,M = map(int,input().split())
a = int((N*(N-1))/2+(M*(M-1))/2)
print(a)
import sys
import math

r = int(sys.stdin.readline())
print('%.5f %.5f' % (r**2 * math.pi, r*2 * math,pi))

### FIXED CODE ###

import sys
import math

r = float(sys.stdin.readline())
print('%.5f %.5f' % (r**2 * math.pi, r*2 * math.pi))
import math
N = int(input())
l = []
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = math.lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K / l[i])%MODp)

Ans = Ans % MODp
print(Ans)

### FIXED CODE ###

import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

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

MODp = 1000000007
K = 1
for i in range(N):
  K = lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K // l[i]))

Ans = Ans % MODp
print(Ans)
cond = [int(n) for n in input().split(" ")]

while True:
    case = []
    cards = [n for n in range(1,cond[0] + 1)]
    for c in range(cond[1]):
        case = ([int(n) for n in input().split(" ")]
        disp = cards[case[0]:case[0]+case[1]]
        cards[case[0]:case[0]+case[1]] = cards[case[0]-case[1]:case[0]]
        cards[case[0]-case[1]:case[0]] = disp
    else:
        print(cards[0])
        cond = [int(n) for n in input().split(" ")]
        if cond[0] == 0 and cond[1] == 0:
            break
        else:
            continue

### FIXED CODE ###

cards,trial = (int(n) for n in input().split(" "))
while True:
    cards = list(reversed([int(n) for n in range(1,(cards)+1)]))
    for n in range(trial):
        num,change = (int(n) for n in input().split(" "))
        num -= 1
        disp = cards[num:num+change]
        cards[change:change+num] = cards[:num]
        cards[:change] = disp
    print(cards[0])
    cards,trial = (int(n) for n in input().split(" "))
    if cards == 0 and trial == 0:
        break
import functools
import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        index = i
        value = gcd_1
        gcd_all = gcd_1

A[index] = value

print(functools.reduce(math.gcd, A))




### FIXED CODE ###

from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

L = [0] * (N+1)
R = [0] * (N+1)
for i in range(N):
    L[i+1] = gcd(L[i], A[i])
    R[N-i-1] = gcd(R[N-i], A[N-i-1])

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)
import math
n, x, *a = list(map(int, open(0).read().split()))
ans = abs(a[0] - x)
for i in range(1, n):
    ans = math.gcd(ans, abs(x - a[i]))
print(ans)


### FIXED CODE ###

from fractions import gcd
n, x, *a = list(map(int, open(0).read().split()))
ans = abs(a[0] - x)
for i in range(1, n):
    ans = gcd(ans, abs(x - a[i]))
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))

import numpy as np
A = np.array(A, dtype=int)
lenA = len(A)
for i in range(K):
    B = np.zeros(lenA, dtype=int)
#    print(B)
    for j in range(lenA):
        num = A[j]
#        print(j, num)
        B[max(0, j - num): min(lenA, j + num + 1)] += 1
#        print(j, B)
    if np.all(A == B):
#        print('same')
        break
    else:
        A = B
print(' '.join(map(str, A)))

### FIXED CODE ###

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

lenA = len(A)
for i in range(K):
    B = [0 for _ in range(lenA)]
#    print(B)
    for j in range(lenA):
        num = A[j]
#        print(j, num)
        if j - num >= 0:
            B[max(0, j - num)] += 1
        else:
            B[0] += 1
        if j + num + 1 < lenA:
            B[min(lenA, j + num + 1)] -= 1
#        print(j, B)
    for i in range(1, lenA):
        B[i] = B[i-1] + B[i]
    if all([a == b for a, b in zip(A,B)]):
#        print('same')
        break
    else:
        A = B
#print(i+1)
print(' '.join(map(str, A)))
a = int(input())
t = [int(i) for i in input().split()]

x = 0

for i in t:
  x += 1 / i

print(1 / x)

### FIXED CODE ###

a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print("red")
n, d = map(int, input().split())
count = 0
x_list = (list(map(int, input().split())) for _ in range(n))

for i in range(n-1):
    for j in range(i+1, n):
        count += (sum((a-b)**2 for a,b in zip(x_list[i], x_list[j]))**0.5).is_integer
print(count)

### FIXED CODE ###

import math

n, d = map(int, input().split())
x_list = []
count = 0

for i in range(n):
    x_list.append([int(i) for i in input().split()])

for i in range(len(x_list)-1):
    for j in range(i+1, len(x_list)):
        cal = 0
        for k in range(d):
            cal += (x_list[i][k] - x_list[j][k])**2
        if math.sqrt(cal) == int(math.sqrt(cal)):
            count += 1

print(count)
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = list[list%2 == 0]
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))
if A == B :
    print('APPROVED')
else:
    print('DENIED')


### FIXED CODE ###

import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = np.unique(list[list%2 == 0])
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')