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

import sys
from bisect import insort_left
INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
sys.setrecursionlimit(10 ** 9)


def main():
    _, M = MAP()
    A = LIST()
    A = sorted(A)

    for _ in range(M):
        v = A[-1] // 2
        A.pop(-1)
        insort_left(A, v)

    print(sum(A))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M = MAP()
    A = LIST()

    minus_A = list(map(lambda x: x*(-1), A))
    heapify(minus_A)
    for i in range(M):
        temp = heappop(minus_A) * (-1)
        heappush(minus_A, temp//2 * (-1))

    print(sum(minus_A) * (-1))


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

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

A_list = np.array([0]+list(map(int, input().split())))
#print(A_np)


for j in range(K):
  new_A=np.array([0]*(N+2))
  for i in range(1,N+1):
    #print(new_A)
    mi=i-A_list[i]
    ma=i+A_list[i]
    if mi<0:
      mi=0
    if ma>N:
      ma=N
    #new_A[mi:ma+1]+=1
    new_A[mi]+=1
    new_A[ma+1]-=1

  A_list=np.cumsum(new_A)
  if sum(A_list[1:N+1])==N*N:
    break
    
for i in range(1,N+1):
  print(A_list[i],end=" ")


### FIXED CODE ###

import numpy as np
from numba import njit

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

A_list = np.array([0]+list(map(int, input().split())))

@njit
def update(A_list):

  for j in range(min(K,46)):
    new_A=np.zeros(N+2,dtype=np.int64)
    for i in range(1,N+1):
      #print(new_A)
      mi=i-A_list[i]
      ma=i+A_list[i]
      if mi<0:
        mi=0
      if ma>N:
        ma=N
      #new_A[mi:ma+1]+=1
      new_A[mi]+=1
      new_A[ma+1]-=1

    A_list=np.cumsum(new_A)
    #if sum(A_list[1:N+1])==N*N:
    #  return(A_list)    
    #  break
      
  return(A_list)

A_list=update(A_list)
for i in range(1,N+1):
  print(A_list[i],end=" ")
### BUGGY CODE ###

import sys
read = sys.stdin.read
from itertools import accumulate
from copy import deepcopy
def main():
    n = int(input())
    x = list(input())
    for i1 in range(n):
        x2 = deepcopy(x)
        if x2[i1] == '1':
            x2[i1] = '0'
        else:
            x2[i1] = '1'
        x3 = int("".join(x2), 2)
        r = 0
        while x3:
            r += 1
            p = bin(x3).count('1')
            x3 = x3 % p
        print(r)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.read
from collections import defaultdict
def main():
    n = int(input())
    x = list(input())
    # 0除算よけ。
    if n == 1:
        if x[0] == '1':
            print(0)
        else:
            print(1)
        sys.exit()
    # xの10進数換算と１の数カウント。
    x10 = int("".join(x), 2)
    xcount1 = x.count('1')
    # 2**i(mod 1の数)をケースごとに用意する。
    mod2plus = [0] * n
    mod2plus[0] = (1 % (xcount1+1)) # 必ず1になる。xcount1=0はありえない。
    for j1 in range(1, n):
        mod2plus[j1] = (mod2plus[j1 - 1] * 2) % (xcount1+1)
    mod2minus = [0] * n
    if xcount1 > 1:
        mod2minus[0] = 1
        for j1 in range(1, n):
            mod2minus[j1] = (mod2minus[j1 - 1] * 2) % (xcount1-1)
    # x(mod 1の数)をケースごとに用意する。
    modx_plus = x10 % (xcount1 + 1)
    if xcount1 == 1:
        modx_minus = 0
    else:
        modx_minus = x10 % (xcount1 - 1)
    popcount = defaultdict(int)
    for i1 in range(n):
        if x[i1] == '1':
            if xcount1 == 1:
                print(0)
                continue
            else:
                x3 = modx_minus - mod2minus[n - 1 - i1]
                if x3 < 0:
                    x3 += (xcount1 - 1)
                elif x3 > (xcount1 - 1):
                    x3 -= (xcount1 - 1)
                elif x3 == (xcount1 - 1):
                    print(1)
                    continue
        else:
            x3 = modx_plus + mod2plus[n - 1 - i1]
            if x3 < 0:
                x3 += (xcount1 + 1)
            elif x3 > (xcount1 + 1):
                x3 -= (xcount1 + 1)
            elif x3 == (xcount1 + 1):
                print(1)
                continue
        r = 1
        while x3:
            r += 1
            if popcount[x3] == 0:
                p = bin(x3).count('1')
                popcount[x3] = p
                x3 = x3 % p
            else:
                x3 = x3 % popcount[x3]
        print(r)

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

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

for i in range(k, n+2):
  minsum = sum(range(0, i))
  maxsum = sum(range(n+1-i ,n+1))
  ans += maxsum - minsum + 1

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
mod = 10**9 + 7
count = 0
for n in range(K, N+2):
  maxSum = (n*(N + N-n+1))//2
  minSum = (n*(n-1))//2
  count += maxSum - minSum + 1
  count %= mod

print(count)
### BUGGY CODE ###

import math
N = int(input())

P = [1]
for k in range(2,math.floor(math.sqrt(N))+1):
    if N % k == 0:
        P.append(k)
        P.append(N//k)
P = sorted(P)

for e in P:
    for x in range(2*e+1):
        y = x-e
        if x**4 + (x**3)*y + (x**2)*(y**2) + x*(y**3) + y**4 == N//e:
            print(x,y)
            exit(0)


### FIXED CODE ###

X = int(input())
for A in range(-1001,1001):
    for B in range(-1001,1001):
        if A**5 - B**5 == X:
            print(A,B)
            exit(0)
### BUGGY CODE ###

if __name__ == '__main__':
    n = int(input())
    a_list = []
    for i in range(n):
        a = int(input())
        a_list.append(a)

    for i in range(n):
        cp = a_list.copy()
        del cp[i]
        print(max(cp))

### FIXED CODE ###

if __name__ == '__main__':
    n = int(input())
    a_list = []
    max_num = 0
    second_max = 0
    max_count = 0
    for i in range(n):
        a = int(input())
        a_list.append(a)
        if a > max_num:
            max_num = a
            max_count = 1
        elif a > second_max:
            second_max = a

    for i in range(n):
        if a_list[i] != max_num:
            print(max_num)
        else:
            print(second_max)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import numpy as np

N,M,R = map(int, input().split())
r = list(map(int, input().split()))
ds = np.zeros([N,N])
neighbors = [[]]*N
for _ in range(M):
    a,b,c = map(int, input().split())
    ds[a-1][b-1] = c
    ds[b-1][a-1] = c
    neighbors[a-1].append(b-1)
    neighbors[b-1].append(a-1)
visitedls = []
totalds = 0
minds = 1e9+7

def dfs(a, prev):
    global visitedls, totalds, ds, minds, neighbors, r
    visitedls.append(a+1)
    totalds += ds[a][prev]
    if set(r) & set(visitedls) == set(r):
        if minds > totalds:
                minds = totalds  
    for nxt in neighbors[a]:
        if nxt+1 not in visitedls:
            dfs(nxt, a)
    del visitedls[-1]
    totalds -= ds[a][prev]

def main():
    for a in r:
        dfs(a-1, a-1)
    print(int(minds))
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

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

adj = [[] for i in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    adj[-A].append((B, C))
    adj[-B].append((A, C))

import heapq

def Dijkstra(N, v_st, v_go):
    cost = [float('inf') for i in range(N)]

    pq = []
    heapq.heappush(pq, (0, v_st))

    while pq:
        c, v_now = heapq.heappop(pq)

        if v_now == v_go:
            return c

        if cost[-v_now] < c:
            continue

        cost[-v_now] = c

        for v, c2 in adj[-v_now]:
            if cost[-v_now] + c2 < cost[-v]:
                cost[-v] = cost[-v_now] + c2
                heapq.heappush(pq, (cost[-v], v))

cost_min = [[float('inf') for i in range(R)] for j in range(R)]

for i in range(R):
    for j in range(i, R):
        cost_min[i][j] = Dijkstra(N, r[i], r[j])
        cost_min[j][i] = cost_min[i][j]

import itertools
p = list(itertools.permutations(range(R)))

ans = float('inf')
for pp in p:
    c = 0
    for i in range(R - 1):
        c += cost_min[pp[i]][pp[i + 1]]

    ans = min(ans, c)
    
print(ans)
### BUGGY CODE ###

def resolve():
    import sys
    input = sys.stdin.readline

    n = input().rstrip()
    a_list = []

    ans = 0
    for a in input().rstrip().split(" "):
        a = int(a)
        for past_a in a_list:
            ans += a * past_a
        a_list.append(a)
    x = 1000000007

    ans = ans % x

    print(ans)

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

def resolve():
    import sys
    input = sys.stdin.readline

    n = input().rstrip()
    past_a = 0

    ans = 0
    for a in input().rstrip().split(" "):
        a = int(a)
        ans += a * past_a
        past_a += a

    x = 1000000007

    ans = ans % x

    print(ans)

if __name__ == "__main__":
    resolve()
### BUGGY CODE ###

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

for i in range(len(A)-1):
  for j in range(i+1,len(A)):
    ans = (ans + A[i]*A[j])%1000000007

print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
#a = [100]*N
A = dict(zip(list(range(len(a))),a))
ans = 0
suma = 0
suma = sum(a)

for i in range(len(a)-1):
  suma -= A[i]
  ans = (ans + A[i]*suma)%1000000007
  
print(ans)
### BUGGY CODE ###

n = int(input())
i = 1
ans = 0
while True:
    d, m = divmod(n, i)
    if m != 0:
        i += 1
        continue
    d -= 1
    if i >= d:
        break
    ans += d
    i += 1
print(ans)


### FIXED CODE ###

n = int(input())
i = 1
ans = 0
while True:
    d, m = divmod(n, i)
    d -= 1
    if i >= d:
        break
    if m != 0:
        i += 1
        continue
    ans += d
    i += 1
print(ans)
### BUGGY CODE ###

MOD = 10**9+7
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
sums = [[0]*(M+2) for i in range(N+2)]
dp = [[0]*(M+1) for i in range(N+1)]
dp[0][0] = 1
for i in range(N+1):
    for j in range(M+1):
        if i-1>=0 and j-1>=0 and S[i-1] == T[j-1]:
            dp[i][j] = sums[i][j]
        sums[i+1][j+1] = sums[i][j+1]+sums[i+1][j]-sums[i][j]+dp[i][j]
        sums[i+1][j+1] %= MOD
print(sums[N+1][M+1])


### FIXED CODE ###

MOD = 10**9+7
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [[0]*(M+1) for i in range(N+1)]
dp[0][0] = 1
for i in range(N+1):
    for j in range(M+1):
        if i-1 >= 0 and j-1>=0 and S[i-1] == T[j-1]:
            dp[i][j] += dp[i-1][j-1]
        if i-1 >= 0:
            dp[i][j] += dp[i-1][j]
        if j-1>= 0:
            dp[i][j] += dp[i][j-1]
        if i-1 >= 0 and j-1>=0:
            dp[i][j] -= dp[i-1][j-1]
        dp[i][j] %= MOD
print(dp[N][M]%MOD)
### BUGGY CODE ###

n = int(input())

p = []
for i in range(n):
    p.append(int(input()))

dic = {p[0]:1}
for i in range(1,n):
    #print(dic)
    check = 0
    for k in list(dic):
        #print(k, dic[k])
        if p[i] == k + dic[k]:
            dic[k] += 1
            check = 1
            break
        elif p[i] == k - 1:
            dic[p[i]] = 1
            if dic[k] < max(dic.values()):
                dic.pop(k)
        else:
            dic[p[i]] = 1

print(n - max(dic.values()))

### FIXED CODE ###

n = int(input())

p = []
for i in range(n):
    p.append(int(input()))


q = [0 for i in range(n)]
for i in range(n):
    q[p[i] - 1] = i

result = 1
temp = 1
for i in range(1, n):
    if q[i] < q[i-1]:
        if temp > result:
            result = temp
        temp = 1
    else:
        temp += 1

if temp == n:
    result = temp

print(n - result)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
 
cnt, prev_cnt = 0, -1
while cnt != prev_cnt:
    prev_cnt = cnt
    for i in range(n):
        
        adj_sum = b[i - 1] + b[(i + 1) % n]
        k = (b[i] - a[i]) // adj_sum
        if k > 0:
            b[i] -= k * adj_sum
            cnt += k
print(cnt if a == b else -1)

### FIXED CODE ###

#import sys
#input = sys.stdin.readline

n = int(input())
a = [0]*n
b = [0]*n
a =[int(xi) for xi in input().split()]
b =[int(yi) for yi in input().split()]

cnt, prev_cnt = 0, -1
while cnt != prev_cnt:
    prev_cnt = cnt
    for i in range(n):
        
        adj_sum = b[i - 1] + b[(i + 1) % n]
        k = (b[i] - a[i]) // adj_sum
        if k > 0:
            b[i] -= k * adj_sum
            cnt += k

print(cnt if a == b else -1)
### BUGGY CODE ###

R,G,B,N = map(int,input().split())
ans = 0
RGB = sorted([R,G,B],reverse=True)
R,G,B = RGB[0],RGB[1],RGB[2]
for r in range(-(-N//R)+1):
    for g in range(((N-R*r)//G)+1):
        for b in range((N-(R*r+G*g)//B)+1):
            if(R*r + G*g + B*b == N):
                ans += 1
print(ans)


### FIXED CODE ###

R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-R*r)//G+1):
        if (N-R*r-G*g)%B == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

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

s_cnt = [0]*n
for i in range(n):
  s_cnt[s.index(s[i])] += 1

cnt_max = max(s_cnt)
s_unique = []
for i in range(n):
  if (s_cnt[i] == cnt_max):
    s_unique.append(s[i])

for s in sorted(s_unique):
  print(s)

### FIXED CODE ###

from collections import Counter

n = int(input())
s = [input() for i in range(n)]
s = Counter(s)
s = s.most_common()

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

if (len(s) != 1):
  for i in range(1, n):
    if (s[i][1] < cnt):
      break
    else:
      ans.append(s[i][0])

for s in sorted(ans):
  print(s)
### BUGGY CODE ###

H,W = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(H)]
B = [[int(b) for b in input().split()] for _ in range(H)]

dp = [[{} for _ in range(W)] for _ in range(H)]
t = A[0][0]-B[0][0]
if t < 0:
    dp[0][0][-t*2] = True
    dp[0][0][-t*2-1] = True
elif t > 0:
    dp[0][0][2*t-1] = True
    dp[0][0][2*t] = True
else:
    dp[0][0][0] = True

for i in range(H):
    for j in range(W):
        if i > 0:
            for k in dp[i-1][j]:
                if k % 2 == 0:
                    num = -k//2
                else:
                    num = (k+1)//2
                num += A[i][j]-B[i][j]
                if num <= 0:
                    idx = -num*2
                else:
                    idx = num*2-1
                dp[i][j][idx] = True
                num += (-A[i][j]+B[i][j])*2
                if num <= 0:
                    idx = -num*2
                else:
                    idx = num*2-1
                dp[i][j][idx] = True
        if j > 0:
            for k in dp[i][j-1]:
                if k % 2 == 0:
                    num = -k//2
                else:
                    num = (k+1)//2
                num += A[i][j]-B[i][j]
                if num <= 0:
                    idx = -num*2
                else:
                    idx = num*2-1
                dp[i][j][idx] = True
                num += (-A[i][j]+B[i][j])*2
                if num <= 0:
                    idx = -num*2
                else:
                    idx = num*2-1
                dp[i][j][idx] = True
                    
ans = 10**9
for k in dp[H-1][W-1]:
    ans = min(ans, k//2+k%2)
        
print(ans)

### FIXED CODE ###

H,W = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(H)]
B = [[int(b) for b in input().split()] for _ in range(H)]

C = [[0]*W for _ in range(H)]
num = 80
for i in range(H):
    for j in range(W):
        C[i][j] = abs(A[i][j]-B[i][j])
        
dp = [[0]*W for _ in range(H)]
dp[0][0] |= (1<<num+C[0][0]) | (1<<num-C[0][0])

for i in range(H):
    for j in range(W):
        if i > 0:
            dp[i][j] |= (dp[i-1][j]<<num+C[i][j]) | (dp[i-1][j]<<num-C[i][j])
        if j > 0:
            dp[i][j] |= (dp[i][j-1]<<num+C[i][j]) | (dp[i][j-1]<<num-C[i][j])
            
b = list(bin(dp[-1][-1]))[::-1]
ans = 10**9
for i in range(len(b)):
    if b[i] == "1":
        ans = min(ans, abs(num*(H+W-1)-i))

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

import itertools
def my_index(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

H,W,M=map(int,input().split())
P=list()
P_X=[0]*(H+1)
P_Y=[0]*(W+1)
for _ in range(M):
    P.append(list(map(int,input().split())))
for m in range(M):
    P_X[P[m][0]]+=1
for m in range(M):
    P_Y[P[m][1]]+=1
Max_X=max(P_X)
Max_Y=max(P_Y)
max_X=my_index(P_X,Max_X)
max_Y=my_index(P_Y,Max_Y)
max_list=list()
for i, j in itertools.product(max_X, max_Y):
    max_list.append([i,j])
m_count=0
for k in range(M):
    if P[k] in max_list:
        m_count += 1
if m_count==len(max_list):
    answer=Max_X+Max_Y-1
else:
     answer=Max_X+Max_Y
    
print(answer)


### FIXED CODE ###


def my_index(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

H,W,M=map(int,input().split())
P=list()
P_X=[0]*(H+1)
P_Y=[0]*(W+1)
for m  in range(M):
    P.append(list(map(int,input().split())))
    P_X[P[m][0]]+=1
    P_Y[P[m][1]]+=1
Max_X=max(P_X)
Max_Y=max(P_Y)
max_X=my_index(P_X,Max_X)
max_Y=my_index(P_Y,Max_Y)
m_count=0
for k in P:
    if  P_X[k[0]] == Max_X and P_Y[k [1]] == Max_Y:
        m_count += 1
if m_count==len(max_X)*len(max_Y):
    answer=Max_X+Max_Y-1
else:
     answer=Max_X+Max_Y
    
print(answer)
### BUGGY CODE ###

S = input()
N = len(S)
mod = 10 ** 9 + 7
dp = [[0] * 13 for _ in range(N + 1)]

dp[0][0] = 1
for i in range(N):
    s = S[i]
    if s == "?":
        for j in range(10):
            for k in range(13):
                dp[i + 1][(10 * k + j) % 13] += dp[i][k]
                dp[i + 1][(10 * k + j) % 13] %= mod
    else:
        j = int(s)
        for k in range(13):
            dp[i + 1][(10 * k + j) % 13] += dp[i][k]
            dp[i + 1][(10 * k + j) % 13] %= mod

print(dp[N][5] % mod)


### FIXED CODE ###

S = input()
N = len(S)
mod = 10 ** 9 + 7
dp = [[0] * 13 for _ in range(N + 1)]

dp[0][0] = 1
for i in range(N):
    s = S[i]
    if s == "?":
        for j in range(10):
            for k in range(13):
                dp[i + 1][(10 * k + j) % 13] += dp[i][k]
                dp[i + 1][(10 * k + j) % 13] %= mod
    else:
        j = int(s)
        for k in range(13):
            dp[i + 1][(10 * k + j) % 13] += dp[i][k]
            dp[i + 1][(10 * k + j) % 13] %= mod

print(dp[N][5] % mod)
### BUGGY CODE ###

N, W = map(int, input().split())

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
weight = []
value = []
for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)

for i in range(N):
    for sum_w in range(W+1):
        # i 番目の品物を選ぶ場合
        if sum_w >= weight[i]:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - weight[i]] + value[i])
        # i 番目の品物を選ばない場合
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

print(dp[N][W])

### FIXED CODE ###

N, W = map(int, input().split())
INF = float('inf')
MAX_V = 100100

dp = [[INF for _ in range(MAX_V+1)] for _ in range(N+1)]
dp[0][0] = 0
weight = []
value = []
for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)

for i in range(N):
    for sum_v in range(MAX_V + 1):
        # i 番目の品物を選ぶ場合
        if sum_v - value[i] >= 0:
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i])
        # i 番目の品物を選ばない場合
        dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])

ans = 0
for sum_v in range(MAX_V + 1):
    if dp[N][sum_v] <= W:
        ans = sum_v

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

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

ans = 0

for i in range(0,N):
  for j in range(i,N):
    for k in range(j,N):
      if j - i != k - j:
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
          ans += 1

print(ans)

### FIXED CODE ###

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

r = S.count('R')
g = S.count('G')
b = S.count('B')

ans = r*g*b

for i in range(0,N):
  for j in range(i,N):
    k = 2*j - i
    if j < k <= N-1:
      if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
        ans -= 1

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

import fractions
import functools

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

max_gcd = 1
for i in range(N):
        tmp_list =[]
        tmp_list.extend(A[:i])
        tmp_list.extend(A[i+1:])
        # print(tmp_list)
        tmp_gcd = functools.reduce(fractions.gcd, tmp_list)
        if max_gcd < tmp_gcd:
                max_gcd = tmp_gcd

print(max_gcd)

### FIXED CODE ###

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

max_gcd = 1

L, R, M = [0]*(N+1), [0]*(N+1), []

def gcd(a, b):
        if a == 0:
                return b
        elif b == 0:
                return a
        else:
                return fractions.gcd(a,b)

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

print(max(M))
### BUGGY CODE ###

n=int (input())
a= list(map(int, input().strip().split()))
b=[0]*n
for i in range(n):
    for j in range(1,n+1):
        b[a[i]-1]=i+1
print(*b)

### FIXED CODE ###

n=int (input())
a= list(map(int, input().strip().split()))
b=[0]*n
for i in range(n):
    b[a[i]-1]=i+1
print(*b)
### BUGGY CODE ###

S = int(input())
n = len(str(S))
dp = [0]*2019
dp[0] = 1
D = {}
for i in range(1,n+1):
    X = S%10**i
    dp[X % 2019] += 1
answer = 0
for i in range(2019):
    answer += dp[i]*(dp[i]-1)/2
print(int(answer))

### FIXED CODE ###

S = input()[::-1]
n = len(S)
dp = [0]*2019
dp[0] = 1
X = 0
Y = 1
for s in S:
    Z=(int(s)*Y)%2019
    X = (X+Z)%2019
    dp[X] += 1
    Y = (10*Y)%2019
answer = 0
for i in range(2019):
    answer += dp[i]*(dp[i]-1)/2
print(int(answer))
### BUGGY CODE ###

# -*- coding: utf-8 -*-


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

def solve(A, i, m, n):
    if m == 0:
        return True
    if i >= n:
        return False
    res = solve(A, i + 1, m, n) or solve(A, i + 1, m - A[i], n)
    return res

for i in M:
    if solve(A, 0, i, n):
        print ("yes")
    else:
        print ("no")

### FIXED CODE ###

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

R = [[None for j in range(2000)] for i in range(n + 1)]

def solve(i, m):
    if R[i][m] != None:
        return R[i][m]
    if m == 0:
        R[i][m] = True
        return True
    elif i > n - 1:
        R[i][m] = False
        return False
    else:
        ans = solve(i + 1, m) or solve(i + 1, m - A[i])
        R[i][m] = ans
        return ans

sum_A = sum(A)
for i in M:
    if sum_A < i:
        print('no')
    elif solve(0, i):
        print('yes')
    else:
        print('no')
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    print(a.index(i+1)+1,end=' ')

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append([a[i],i+1])
b.sort()
for i in b:
    print(i[1],end=' ')