Harryxun/stf_run huggingface dataset:
import fractions
from functools import reduce


n, m = map(int, input().split())
A = list(set(map(int, input().split())))

hA = [a//2 for a in A]
lcm = 1
for a in hA:
    lcm = (lcm * a) // fractions.gcd(lcm, a)
    if lcm > m:
        print(0)
        break
else:
    else:
        if (m//lcm) % 2 == 0:
            print(m//lcm//2)
        else:
            print(m//lcm//2 + 1)


### FIXED CODE ###

import fractions
from functools import reduce


n, m = map(int, input().split())
A = list(set(map(int, input().split())))

hA = [a//2 for a in A]
lcm = 1
for a in hA:
    lcm = (lcm * a) // fractions.gcd(lcm, a)
    if lcm > m:
        print(0)
        break
else:
    for a in A:
        if lcm % a == 0:
            print(0)
            break
    else:
        if (m//lcm) % 2 == 0:
            print(m//lcm//2)
        else:
            print(m//lcm//2 + 1)
(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))

print(str((a-c)*(b-d))))

### FIXED CODE ###

input1 = input().split()
input2 = input().split()

W = int(input1[0])
w = int(input2[0])
H = int(input1[1])
h = int(input2[1])

print(str((W-w)*(H-h)))
A=input('A')
B=input('B')
if 1<=A<=9 and 1<=B<=9:
    print(int(A)*int(B))
else
print('-1')

### FIXED CODE ###

A,B = map(int,input().split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print('-1')
N, M, Q = map(int,input().split())

C = [[0 for in range(N)] in range(N)]
for i in range(M):
	L,R = map(int,input().split())
	C[L][R] += 1

for j in range(Q):
	p,q = map(int,input().split())
	s = 0
	for i in range(p,q+1):
		for j in range(p,q+1):
			s += C[i][j]
	print(s)


### FIXED CODE ###

N, M, Q = map(int,input().split())

C = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(M):
	L,R = map(int,input().split())
	C[L][R] += 1


D = [[0 for i in range(N+4)] for j in range(N+4)]
E = [0 for i in range(N+4)]
F = [[0 for i in range(N+4)] for j in range(N+4)]
for i in range(N+1):
	for j in range(N+1):
		D[i][j+1] = D[i][j] + C[i][j]
for i in range(N+1):
	E[i+1] = E[i] + D[i][i]
for i in range(N+2):
	for j in range(N+2):
		F[i+1][j] = F[i][j] + D[i][j]

# C[l][l] + ... + C[l][r] = D[l][r+1] - D[l][l]
# C[i][i] + ... + C[i][r] = D[i][r+1] - D[i][i]
# C[r][r] + ... + C[r][r] = D[r][r+1] - D[r][r]

for j in range(Q):
	p,q = map(int,input().split())
	s = F[q+1][q+1] - F[p][q+1] - (E[q+1] - E[p])
	print(s)
n = int(input())
 
n = str(n)
 
flag = 0
 
for i in n:
  if(i != '7'):
    flag = 0
  else:
    flag = 1
 
    
if flag = 0:
  print('No')
else :
  print('Yes')

### FIXED CODE ###

n = int(input())
 
n = str(n)
 
flag = 0
 
for i in n:
  if(i != '7'):
    flag = 0
  else:
    flag = 1
    break
 
    
if flag == 0:
  print('No')
else :
  print('Yes')
import sys
sys.setrecursionlimit(100001)

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
visited = [False] * n
for _ in range(m):
    a, b = map(int, input().split())
    la = len(edges[a - 1])
    lb = len(edges[b - 1])
    edges[a - 1].append([b - 1, lb])
    edges[b - 1].append([a - 1, la])

def dfs(p, v):
    visited[v] = True
    for (i, r) in edges[v]:
        if not visited[i] and r != -1 and i != p:
            dfs(v, i)
    odd = False
    pr = -1
    for (i, r) in edges[v]:
        if i != p:
            if r != -1:
                print(v + 1, i + 1)
                edges[i][r][1] = -1
		odd = not odd
        else:
            pr = r
    if odd:
        print(v + 1, p + 1)
        edges[p][pr][1] = -1

if m % 2 == 1:
    print(-1)
else:
    dfs(-1, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
visited = [False] * n
for _ in range(m):
    a, b = map(int, input().split())
    la = len(edges[a - 1])
    lb = len(edges[b - 1])
    edges[a - 1].append([b - 1, lb])
    edges[b - 1].append([a - 1, la])

def dfs(p, v):
    visited[v] = True
    for (i, r) in edges[v]:
        if not visited[i] and r != -1 and i != p:
            dfs(v, i)
    odd = False
    pr = -1
    for (i, r) in edges[v]:
        if i != p:
            if r != -1:
                edges[i][r][1] = -1
                odd = not odd
        else:
            pr = r
    if odd:
        edges[p][pr][1] = -1

if m % 2 == 1:
    print(-1)
else:
    dfs(-1, 0)
    for v in range(n):
        for (i, r) in edges[v]:
            if r >= 0:
                print(v + 1, i + 1)
N, M = map(int, input().split())
a = list(map(int, input().split()))
mn = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

msort = lambda s: -s[0]

b = list(map(lambda i: [i, mn[i]], a))
b.sort(key = msort)
dp = [-100] * (N + 1)
dp[0] = 0
for i in range(2, N + 1):
  for n in b:
    if i >= n[1] and dp[i - n[1]] >= 0:
      dp[i] = max([dp[i], dp[i - n[1]] + 1])

match = N
ans = ''
while match > 0:
  for n in b:
    if dp[match] == dp[match - n[1]] + 1:
      ans += str(n[0])
      match -= n[1]
      break
    
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
a = list(map(int, input().split()))
mn = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

msort = lambda s: -s[0]

b = list(map(lambda i: [i, mn[i]], a))
b.sort(key = msort)
dp = [-100] * (N + 1)
dp[0] = 0
for i in range(2, N + 1):
  for n in b:
    if i >= n[1] and dp[i - n[1]] >= 0:
      dp[i] = max([dp[i], dp[i - n[1]] + 1])

match = N
ans = ''
while match > 0:
  for n in b:
    if match >= n[1] and dp[match] == dp[match - n[1]] + 1:
      ans += str(n[0])
      match -= n[1]
      break
    
print(ans)
numArray = list(map(int, input().split()))

if numArray.count(5) == 2 && numArray.count(7) == 1: print("YES")
else: print("NO")

### FIXED CODE ###


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

if numArray.count(5) == 2 and numArray.count(7) == 1: print("YES")
else: print("NO")
from collections import Counter
import sys
sys.setrecursionlimit(1000000000)

N = int(input())

edges = {i:[] for i in range(1, N+1)}
for _ in range(N-1):
    a, b = map(int, input().split())
    edges[a].append(b)
    edges[b].append(a)

vertice = [0 for _ in range(N+1)]

def dfs(v, color_i):
    vertice[v] = color_i
    for i in edges[v]:
        if vertice[i] == 0:
            dfs(i, color_i*(-1))

dfs(1, 1)

c = Counter(vertice)
ans = []
if c[1] > N/3 and c[2] > N/3:
    nums1 = [i for i in range(1, N+1) if i % 3 == 1]
    nums2 = [i for i in range(1, N+1) if i % 3 == 2]
    nums3 = [i for i in range(1, N+1) if i % 3 == 0]
    for v in vertice[1:]:
        if v == 1:
            if num1:
                ans.append(str(num1.pop()))
            else:
                ans.append(str(num3.pop()))
        else:
            if num2:
                ans.append(str(num2.pop()))
            else:
                ans.append(str(num3.pop()))
elif c[1] <= N/3:
    num_not_3 = [i for i in range(1, N+1) if i % 3 != 0]
    num3 = [i for i in range(1, N+1) if i % 3 == 0]
    for v in vertice[1:]:
        if v == 1:
            if num3:
                ans.append(str(num3.pop()))
            else:
                ans.append(str(num_not_3.pop()))
        else:
            ans.append(str(num_not_3.pop()))
else:
    num_not_3 = [i for i in range(1, N+1) if i % 3 != 0]
    num3 = [i for i in range(1, N+1) if i % 3 == 0]
    for v in vertice[1:]:
        if v == -1:
            if num3:
                ans.append(str(num3.pop()))
            else:
                ans.append(str(num_not_3.pop()))
        else:
            ans.append(str(num_not_3.pop()))

print("".join(ans))


### FIXED CODE ###

n = int(input())
edge = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
 
group = [False] * n
parent = list(range(n))
stack = [0]
while stack:
  v = stack.pop()
  while edge[v]:
    u = edge[v].pop()
    if parent[v] != u:
      group[u] = not group[v]
      parent[u] = v
      stack.append(u)
 
three = 3
p = [0] * n
if group.count(False) <= n // 3:
  other = 1
  for i in range(n):
    if group[i] and other <= n:
      p[i] = other
      other += other % 3
    else:
      p[i] = three
      three += 3
elif group.count(True) <= n // 3:
  other = 1
  for i in range(n):
    if not group[i] and other <= n:
      p[i] = other
      other += other % 3
    else:
      p[i] = three
      three += 3
else:
  one, two = 1, 2
  for i in range(n):
    if group[i] and one <= n:
      p[i] = one
      one += 3
    elif not group[i] and two <= n:
      p[i] = two
      two += 3
    else:
      p[i] = three
      three += 3
print(' '.join(map(str, p)))
import math 
a,b = map(int,input().split())
gcd = math.gcd(a,b)

if gcd !=1:
    left = 1
    right = 10**5
    while right -left > 1:
        m = (right+left) // 2 
        if  gcd * m < a * b:
            left = m
        else:
            right = m

    print(right)

else:
    print(a*b)

### FIXED CODE ###

import fractions
a,b = map(int,input().split())
gcd = fractions.gcd(a,b)

print(a*b//gcd)
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

cnt = 0
while len(a) > 0:
    same_cnt = 1
    j = 1
    while a[0] == a[j]:
        same_cnt += 1
        if j == len(a) - 1:
            break
        j += 1
    if same_cnt  % 2 == 1:
        cnt += 1
    del a[0:same_cnt]
print(cnt)

### FIXED CODE ###

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

def fanc(n, a):
    if n == 1: 
        print(1)
        return 0
    cnt = 0
    while len(a) > 1:
        same_cnt = 0
        j = 1
        while a[0] == a[j]:
            same_cnt += 1
            if j == len(a) - 1:
                break
            j += 1
        if same_cnt  % 2 == 0:
            cnt += 1
        del a[0:same_cnt+1]
    if len(a) == 1: cnt += 1
    print(cnt)
    return 0

fanc(n, a)
N = input().strip()
N = N + "."
N.strip("0")
N = N[:-1]
total = 0
for i in range(1, len(N), 2):
    total += int("1"+"0"*i) - int("1"+"0"*(i-1))
if len(N) % 2 == 0:
    pass
else:
    total += int(N[1:])+1
print(total)


### FIXED CODE ###

N = input().strip()
N = N + "."  # for removing the leading zeroes just in case
N.strip("0")
N = N[:-1]
total = 0
for i in range(1, len(N), 2):
    total += int("1"+"0"*i) - int("1"+"0"*(i-1))
if len(N) % 2 == 0:
    total += 0
else:
    total += int(N) - (int("1" + "0" * (len(N) - 1))) + 1
print(total)
n = int(input())
a = list(map(int, input().split()))
s = 1
for i in a:
  s *= i
  if s => 10 ** 18:
    s = -1
    break
if 0 in a:
  s = 0
print(s)
 

### FIXED CODE ###

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

ans = 1
for i in a :
  ans *= i
  if ans > 10**18 :
    ans = -1
    break
if 0 in a :
  ans = 0

print(ans)
import heapq
def SME(Whole,start,end,L,ANS):
    A = []
    if end > N : end = N
    count = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] == 0 and idx < end:
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count > N * 0.999 / M  : break
    for i in range(L):
        if ANS[i] == 0 : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] == 0 : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ANS = [0]*N
start = 0
K = L * int(N ** 0.3 + 2 )
if K > N : K = N
end = K
while (end <= N):
    ANS = SME(A, start, end, L, ANS)
    start = end
    end += K 
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
while True:
    try:
        Nu = list(map(int,input().split()))
        print(len(str(Nu[0]+Nu[1])))
    except IndexError:
        break

### FIXED CODE ###

while True:
    try:
        a,b = map(int,input().split())
        print(len(str(a+b)))
    except EOFError:
        break
x = int(input())

sosu = [2,3,5,7,11,13,17,19,23,29,31]

if(x==1):
  print(1)
else:
  ans = 1
  for i in range(len(sosu)):
    now = sosu[i]
    for j in range(1,11):
      now = now*sosu[i]
      if(now <= x and ans <= now):
        ans = now
      elif(now >= x):
        break

print(ans)

### FIXED CODE ###

x = int(input())

num = list(range(2,32))

ans = 1
for i in range(len(num)):
  now = num[i]
  while now < x:
    now = now*num[i]
    if(now <= x and ans <= now):
      ans = now
print(ans)
import sys
input = sys.stdin.buffer.readline
import heapq

N,M,S,T = map(int,input().split())

adj=[set()]*N

for _ in range(M):
    a,b,c,d = map(int,input().split())
    adj[a-1].add((b-1,c,d))
    adj[b-1].add((a-1,c,d))


D_S=[float("inf")]*N
D_T=[float("inf")]*N

D_S[S-1]=0
D_T[T-1]=0

Q=[]
heapq.heappush(Q,(0,S-1))


while Q:

    dist_to_node,node = heapq.heappop(Q)
    if D_S[node]< dist_to_node:
        continue
    for nex in adj[node]:
        (next_node,yen,_) = nex
        if dist_to_node+yen>=D_S[next_node]:
            continue
        else:
            D_S[next_node] = dist_to_node+yen
            heapq.heappush(Q,(D_S[next_node],next_node))

Q=[]
heapq.heappush(Q,(0,T-1))


while Q:

    dist_to_node,node = heapq.heappop(Q)
    if D_T[node]< dist_to_node:
        continue
    for nex in adj[node]:
        (next_node,_,yen) = nex
        if dist_to_node+yen>=D_T[next_node]:
            continue
        else:
            D_T[next_node] = dist_to_node+yen
            heapq.heappush(Q,(D_T[next_node],next_node))


tmp_min=float("inf")
ans=[]
gor i in reversed(range(N)):
    tmp_min = min(tmp_min,D_S[i]+D_T[i])
    ans.append(tmp_min)


for a in reversed(ans):
    print(10**15-a)


### FIXED CODE ###

import heapq
N,M,S,T = map(int,input().split())

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

for _ in range(M):
    a,b,c,d = map(int,input().split())
    adj[a-1].append((b-1,c,d))
    adj[b-1].append((a-1,c,d))


D_S=[float("inf")]*N
D_T=[float("inf")]*N

D_S[S-1]=0
D_T[T-1]=0

Q=[]
heapq.heappush(Q,S-1)


while Q:
    v = heapq.heappop(Q)
    dist_to_node,node=v//N,v%N
    for nex in adj[node]:
        (next_node,yen,_) = nex
        if dist_to_node+yen<D_S[next_node]:
            D_S[next_node] = dist_to_node+yen
            heapq.heappush(Q,D_S[next_node]*N+next_node)

Q=[]
heapq.heappush(Q,T-1)

while Q:
    v = heapq.heappop(Q)
    dist_to_node,node=v//N,v%N
    if D_T[node]< dist_to_node:
        continue
    for nex in adj[node]:
        (next_node,_,yen) = nex
        if dist_to_node+yen<D_T[next_node]:
            D_T[next_node] = dist_to_node+yen
            heapq.heappush(Q,D_T[next_node]*N+next_node)


tmp_min=float("inf")
ans=[]
for i in reversed(range(N)):
    tmp_min = min(tmp_min,D_S[i]+D_T[i])
    ans.append(tmp_min)


for a in reversed(ans):
    print(10**15-a)
s=input()
k=int(input())
count=0
for i in s:
    count+=int(i)**(5*(10**10))
    if count>=k:
        print(i)
        exit()

### FIXED CODE ###

s=input()
k=int(input())
count=0
ans=''
for i in range(k):
    if s[i]=='1':
        count+=1
    else:
        ans=s[i]
        break
print(1 if count==k else ans)
S = input()
N = len(S)
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i in (0, N, 2):
  if S[i] not in odd:
    ans += 1
for i in (1, N ,2):
  if S[i] not in even:
    ans += 1

if ans == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S = input()
N = len(S)
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
ans = 0

for i in range(0, N, 2):
  if not (S[i] in odd):
    ans += 1
for i in range(1, N, 2):
  if not(S[i] in even):
    ans += 1
 
if ans == 0:
  print('Yes')
else:
  print('No')
import sys
n,y = map(int, input().split())

n = n+1
y = y+1
for a in range(n+1):
#  for b in range(n+1-a):
    b = 1
    if a * 10000 + b * 5000 + (n-a-b) * 1000 == y:
		print(str(a) + ' ' + str(b) + ' ' + str(c))
		sys.exit()

print('-1 -1 -1')
sys.exit()

### FIXED CODE ###

import sys

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

for a in range(n+1):
	for b in range(n+1-a):
		c = n - a - b
		if (a * 10000 + b * 5000 + c * 1000 == y):
				print(str(a) + ' ' + str(b) + ' ' + str(c))
				sys.exit()
	
print('-1 -1 -1')
sys.exit()
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = [list(map(int, input().split())) for _ in range(M)]

# n番目の要素でソートsort
BC = sorted(BC, reverse=True, key=lambda x: x[1])

m = A[0]
D = []
p = 0
for b, c in BC:
    if c > m:
        _ = [D.append(c) for i in range(b)]
        p += 1
        if p > N:
            break
    else:
        continue

D.append(0)

for i, d in enumerate(D):
    if i > N:
        break
    if A[i] < d:
        A[i] = d
    else:
        break

print(sum(A))


### FIXED CODE ###

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = [list(map(int, input().split())) for _ in range(M)]

# n番目の要素でソートsort
BC = sorted(BC, reverse=True, key=lambda x: x[1])

m = A[0]
D = []
for b, c in BC:
    if c > m:
        _ = [D.append(c) for i in range(b)]
    else:
        continue
    if len(D) > N:
        break

D.append(0)

for i, d in enumerate(D):
    if i >= N:
        break
    if A[i] < d:
        A[i] = d
    else:
        break

print(sum(A))
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    graph = [[] for _ in range(n)]
    dp = dict()

    for _ in range(m):
        xi, yi = map(int, input().split())
        xi -= 1
        yi -= 1
        graph[xi].append(yi)

        dp[(xi, yi)] = 0

    def dfs(v, parent=-1, count=0):
        count += 1

        for u in graph[v]:
            if u == parent:
                continue

            dp[(v, u)] = max(dp[(v, u)], count)
            dfs(u, v, dp[(v, u)])

    for i in range(n):
        dfs(i)

    print(max(dp.values()))


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    from sys import setrecursionlimit

    setrecursionlimit(10 ** 7)

    n, m = map(int, input().split())
    graph = [[] for _ in range(n)]
    dp = [-1 for _ in range(n)]

    for _ in range(m):
        xi, yi = map(int, input().split())
        xi -= 1
        yi -= 1
        graph[xi].append(yi)

    # See:
    # https://qiita.com/drken/items/03c7db44ccd27820ea0d#g-%E5%95%8F%E9%A1%8C---longest-path
    def rec(v):
        if dp[v] != -1:
            return dp[v]

        result = 0

        for next_v in graph[v]:
            result = max(result, rec(next_v) + 1)

        dp[v] = result

        return dp[v]

    ans = 0

    for i in range(n):
        ans = max(ans, rec(i))

    print(ans)


if __name__ == '__main__':
    main()
n = int(input())

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

if l[0] == 0:
  print(0)
  exit()
res = 1

for i in l:
  res *= i
  if res > 10 **18:
    print(res)
    exit()
  print(res)

### FIXED CODE ###

n = int(input())

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

if l[0] == 0:
  print(0)
  exit()
res = 1

for i in l:
  res *= i
  if res > 10 **18:
    print(-1)
    exit()
print(res)
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N - 1)]
px = [list(map(int, input().split())) for i in range(Q)]

p = [[] for i in range(N + 1)]
result = [0 for i in range(N + 1)]

for i in range(N - 1):
    a = ab[i][0]
    b = ab[i][1]
    p[a].append(b)
    p[b].append(a)

for i in range(Q):
    result[px[i][0]] = result[px[i][0]] + px[i][1]


def dfs(point, result):
    for i in range(len(p[point])):
        next = p[point][i]
        p[next].remove(point)
        result[next] = result[next] + result[point]
        if len(p[next]) != 0:
            dfs(next, result)
    return result


result = dfs(1, result)

print(*result[1:])

### FIXED CODE ###

N, Q = map(int,input().split()) # 複数の数字を変数に格納
List_ab = [list(map(int,input().split())) for i in range(N-1)] # [[1,2],[3,4],[5,6]]
List_px = [list(map(int,input().split())) for i in range(Q)] # [[1,2],[3,4],[5,6]]

count_list = [0]*N

List_ab.sort()

for i in range(Q):
    count_list[List_px[i][0]-1] += List_px[i][1]
        
for i in range(N-1):
    count_list[List_ab[i][1]-1] += count_list[List_ab[i][0]-1]
    
print(*count_list)
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
argmn = np.argmin(A)
mn = A[argmn]
for m in range(mn+1):
  B = np.zeros(len(A))
  B[argmn] = m * 2
  for i in range(len(A)):
    idx = (i + argmn)%len(A)
    B[(idx+1)%len(A)]  += A[idx] * 2  - B[idx]
  B[argmn] -= m * 2
  if (B[argmn]+B[(argmn+1)%len(A)]==(A[argmn]*2)):
    print (" ".join(B.astype(np.int).astype(np.str)))
    exit()

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
sm = sum(A)
x = sm-2*sum(A[1::2])
X = []
X.append(str(x))
for i in range(N-1):
   x = 2*A[i]-x
   X.append(str(x))
print (" ".join(X))
N=int(input())
print(int(N**(1/2))**2)

### FIXED CODE ###

C1=list(input())
C2=list(input())
if C1[0]==C2[2] and C1[1]==C2[1] and C1[2]==C2[0]:
    print('YES')
else:
    print('NO')
s = input()
front = int(s[:2])
back = int(s[2:])
if 0 in (front, back):
    ans = 'NA'
elif 0 < front < 13 and 0 < back < 13:
    ans = 'AMBIGUOUS'
elif 0 < front < 13:
    ans = 'MMYY'
elif 0 < back < 13:
    ans = 'YYMM'
print(ans)


### FIXED CODE ###

s = input()
front = int(s[:2])
back = int(s[2:])
if 0 < front < 13 and 0 < back < 13:
    ans = 'AMBIGUOUS'
elif 0 < front < 13:
    ans = 'MMYY'
elif 0 < back < 13:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)
N,M=map(int,input().split())
A=dict()
ans=0
for i in range(N):
    a,b=map(int,input().split())
    A[a]=b
A=list(A.items())
A.sort()
for i in range(N):
    if M>=A[i][1]:
        M-=A[i][1]
        ans+=A[i][0]*A[i][1]
    else:
        ans+=A[i][0]*M
        break
print(ans)


### FIXED CODE ###

N,M=map(int,input().split())
A=dict()
ans=0
A=[list(map(int,input().split()))for i in range(N)]
A.sort()
for i in range(N):
    if M>A[i][1]:
        M-=A[i][1]
        ans+=A[i][0]*A[i][1]
    else:
        ans+=A[i][0]*M
        break
print(ans)
S=input()
print(S-"FESTIVAL")

### FIXED CODE ###

S=input()
print(S[:-8])
input()
nums = input().split()
int(nums)

maximium = max(nums)
minimium = min(nums)
sums = sum(nums)

print(maximium, minimium, sums)

### FIXED CODE ###

input()
nums = [int(i) for i in input().split()]

maximum = max(nums)
minimum = min(nums)
total = sum(nums)

print(minimum, maximum, total)
a=int(input(''))
b=int(input(''))
if (a*b)%2=0:
  print('Even')
else:
  print('Odd')


### FIXED CODE ###

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