peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())

ans = [0 for i in range(n)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            n_2 = x ** 2 + y ** 2 + z ** 2 + x*y + x*z + y*z
            if n_2 > int(len(ans)):
                continue
            ans[n_2-1] += 1

for i in range(n):
    print(ans[i])
# Judge status: Wrong Answer
import sys
from collections import deque
input = sys.stdin.readline
N, M = map(int, input().split())
*A, = map(int, input().split())
lis = []
for _ in range(M):
    B, C = map(int, input().split())
    for _ in range(B):
        lis.append(C)
# Judge status: Accepted
n = int(input())
s = []
for _ in range(n):
    s.append(input())

m = int(input())
t = []
for _ in range(m):
    t.append(input())

ans = 0
for i in set(s):   
    ans = max(ans,s.count(i) - t.count(i))
        
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

A.sort()
stack = A[1:]
m = A[0]

while stack:
  stack = list(stack)
  l = []
  for x in stack:
    if x % m == 0:
      continue
    l.append(x % m)
  
  if not l:
    break
  m = min(l)
  stack = set(l)

print(m)
# Judge status: Accepted
x = int(input())
double, rest = divmod(x, 11)
if rest == 0:
    add = 0
elif 1<= rest <= 6:
    add = 1
else:
    add = 2
ans = double * 2 + add
print(ans)
# Judge status: Wrong Answer
N,A,B = map(int,input().split())

if N==0:
    print(0)
elif N==1 and A==B:
    print(1)
elif N==1 and A!=B:
    print(0)
elif N>=2:
    mx = B*(N-1)+A
    mn = A*(N-1)+B
    print(mx-mn+1)
# Judge status: Wrong Answer
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
tmp = min(a) + min(b)
for i in range(M):
    x,y,c = map(int,input().split(" "))
    sum1 = a[x-1]+b[y-1]-c
    ans = min(tmp,sum1)
print(ans)
# Judge status: Accepted
n,h=map(int,input().split())
a,b=[],[]
for _ in range(n):
    A,B=map(int,input().split())
    a+=[A]
    b+=[B]
c=max(a)
b.sort()
ans=0
for i in b[::-1]:
    if i>c and h>0:
        h-=i
        ans+=1
    else:
        break
print(ans-(-h//c)*(h>0))
# Judge status: Wrong Answer
s = list(input())
c = 0
if s[0] != 'A':
    print('WA')
else:
    s[0] = 'a'
    for i in range(2,len(s)-2):
        if s[i] == 'C':
            s[i] = 'c'
            c = 1
    news = ''.join(s)
    if news.islower() and c == 1:
        print('AC')
    else:
        print('WA')
# Judge status: Accepted
n,a,b=map(int,input().split())
m=10**9+7

def cmb(x,y):

    r=1

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

        r=(r*(x-i+1)*pow(i,m-2,m))%m
        
    return r
print((pow(2,n,m)-1-cmb(n,a)-cmb(n,b))%m)
# Judge status: Wrong Answer
import string


N = int(input())
S = string.ascii_lowercase

ans = ''
if N <= 26:
    ans = S[N - 1]

while True:
    N, b = divmod(N, 26)
    ans = S[b - 1] + ans
    if b == 0:
        N -= 1

    if N <= 26:
        ans = S[N - 1] + ans
        break

print(ans)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
ans=C-(A-B)
if (C>=0):
  print(ans)
else:
  print(0)
# Judge status: Accepted
S = input()

if len(S)%2:
    S = S[:len(S)-1]
else:
    S = S[:len(S)-2]
N = len(S)

while True:
    now = S[:N]
    L = len(now)
    if now[:L//2] == now[L//2:]:
        break
    N -= 2
print(N)
# Judge status: Accepted
a,b,c = map(int,input().split())
if (a+b == c) or (a+c == b) or (b+c == a):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n, *a = map(int, open(0).read().split())
ans = 0
for i in range(n-2):
    if a[i] < 0:
        ans += -1 * a[i]
        a[i+1] = -1 * a[i+1]
    else:
        ans += a[i]
if a[-2] * a[-1] < 0:  # 最後２つが異符号のとき
    ans += max(abs(a[-2]), abs(a[-1])) - min(abs(a[-2]), abs(a[-1]))
else:
    ans += abs(a[-2]) + abs(a[-1])
print(ans)
# Judge status: Accepted
s,t = map(str,input().split())
print(t+s)
# Judge status: Accepted
s = input()
t = input()

cnt = 0
for a, b in zip(s, t):
    if a != b:
        cnt += 1
print(cnt)
# Judge status: Accepted
#!/usr/bin/env python3
from decimal import Decimal

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

# ans = "Yes" if (math.sqrt(a) + math.sqrt(b)) < math.sqrt(c) else "No"
root = Decimal("0.5")
ans = "Yes" if ((a ** root) + (b ** root)) < (c ** root) else "No"


print(ans)
# Judge status: Accepted
s=input()
if s=='SSS':
  print(0)
elif s=='SSR':
  print(1)
elif s=='SRS':
  print(1)
elif s=='SRR':
  print(2)
elif s=='RSS':
  print(1)
elif s=='RSR':
  print(1)
elif s=='RRS':
  print(2)
elif s=='RRR':
  print(3)
# Judge status: Wrong Answer
N = int(input())

target_list = map(int, input().split())
trans_list = {}

for i in range(int(input())):
    trans_list[i] = list(map(int, input().split()))

result = {}

for target in target_list:
    print(result)
    for key, trans in trans_list.items():
        if target == trans[0]:
            target = trans[1]

        if key in result:
            result[key] = result[key] + target
        else:
            result[key] = target


for r in result.values():
    print(r)
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n):
    ans+=((n-1)//i)
print(ans)
# Judge status: Wrong Answer
S = input()

if S[-1] != "s":
    print(S+"s")
else:
    print(S[:-1]+"es")
# Judge status: Accepted
# vim: fileencoding=utf-8


def main():
    N = int(input())
    ans = [0] * N
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                t = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x - 1
                if t >= len(ans):
                    break
                ans[t] += 1

    print(*ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print("YNEOS"[b-a!=c-b])
# Judge status: Accepted
x = [int(i) for i in input().split()]
for i in range(len(x)):
	if x[i] == 0:
	    print(i+1)
# Judge status: Wrong Answer
n,m=map(int, input().split())
r = []
flg = []

for i in range(n):
    r.append(str(0))
    flg.append(0)

for i in range(m):
    s,c = map(int, input().split())
    if flg == 1 and int(r[s-1]) < c:
        r[s-1] = r[s-1]
    else:
        r[s-1] = str(c)
        flg[s-1] = 1
    
if n == 1 and r[0] == '0':
    print(0)
elif r[0] == '0':
    print('-1')
else:
    print(''.join(r))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ANS = A[0]

for i in range(N-2):
    index = i // 2
    print(index)
    ANS += A[index+1]
print(ANS)
# Judge status: Wrong Answer
def TriangleS(a,b,c):
  return a*b//2
# Judge status: Accepted
import sys
from bisect import bisect_right as br
input = sys.stdin.readline
N, M = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = []
for _ in range(M):
  k, x = map(int, input().split())
  b.append((x, k))
b.sort()
l = 0
res = 0
while len(b):
  x, k = b.pop()
  i = br(a, x)
  if l >= i: break
  if i - l > k:
    i = l + k
  res += x * (i - l)
  l = i
print(res + sum(a[l: ]))
# Judge status: Accepted
K,A,B = map(int,input().split())
ans = 1+K

rem = K-(A-1)
if rem <= 1:
    print(ans)
else:
    ans2 = A
    d,m = divmod(rem,2)
    ans2 += (B-A)*d
    ans2 += m
    print(max(ans, ans2))
# Judge status: Wrong Answer
import itertools
a=0;b=0;m=0;l=0
N,M=map(int,input().split())
X=list(map(int,input().split()))
l=M-N; m=sum(X)
if N>=M:
  print(0)
else:
  for i in itertools.combinations(X,l):
    L=sorted(list(map(int,i)))
    print(L)
    for j in range(1,l):
      a=a+(L[j]-L[j-1])
    print(a)
    if a<m:
      m=a
    a=0
  print(m)
# Judge status: Wrong Answer
N = input()

a = 0
for n in N:
    a += int(n)
    
if a % 9 == 0:
    ans = "Yse"
else:
    ans = "No"
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

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

C = {}
for i in range(N):
    C[i+1] = 0

D = {}

for i in range(M):
    P, Y = map(int, input().split())
    D[Y] = [P, i]

ret = {}
for y, p in sorted(D.items(), key=lambda x: x[0]):
    C[p[0]] += 1
    ret[p[1]] = str(p[0]).zfill(6) + str(C[p[0]]).zfill(6)
    
for i, r in sorted(ret.items(), key=lambda x: x[0]):
    print(r)
# Judge status: Accepted
X, Y = map(int, input().split())
if X * Y > 0:
    if X <= Y: print(Y-X)
    else: print(X-Y+2)
elif X == 0:
    print(Y if Y >= 0 else -Y+1)
elif Y == 0:
    print(-X if X <= 0 else X+1)
else:
    mi = abs(abs(Y)-abs(X))+1
    if X <= Y:
        mi = min(mi, Y-X)
    print(mi)
# Judge status: Accepted
from math import sqrt

n, d = map(int, input().split())
pq = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for p, q in pq:
    ans += (sqrt(p ** 2 + q ** 2) <= d)
print(ans)
# Judge status: Wrong Answer
import itertools

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

triangle = itertools.combinations(l, 3)

cnt = 0

for i in triangle:
  if max(i)*2 > sum(i):
    cnt += 1

print(cnt)
# Judge status: Accepted
a,b=map(int,input().split())
l=list(map(int,input().split()))
import itertools
b=min(b,50)
def ku(l):
    y=[0]*a
    for j,x in enumerate(l):
      y[max(0,j-x)]+=1
      r=min(j+x,a-1)
      if r<a-1:
        y[r+1]-=1
    return itertools.accumulate(y)

  
for _ in range(b):
  l=ku(l)
print(*l)
# Judge status: Accepted
from itertools import combinations_with_replacement

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

comb = list(combinations_with_replacement(range(1,M+1),N))

abcd = []
for i in range(Q):
    a,b,c,d = map(int,input().split())
    abcd.append([a-1,b-1,c,d])

ans = 0
for i in comb:
    tmp = 0
    for a,b,c,d in abcd:
        if i[b] - i[a] == c:
            tmp += d
    ans = max(ans,tmp)

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
ans = 0
for i in range(K,N):
    if T[i] == T[i-K]:
        T[i] = 'n'
score = {'r':P,'s':R,'p':S,'n':0}
for i in range(N):
    ans += score[T[i]]
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if c-b == b-a:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[list(map(int, input().split())) for num in range(m)]
count=0

for num1 in range(m):
    for num2 in range(m-num1):
        if a[num1][1]==a[num1+num2][0]:
            if a[num1][0]==1:
                if a[num1+num2][1]==n:
                    count=1

if count==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
sortA = sorted(A)
ma = sortA[-1]
ma2 = sortA[-2]
for a in A:
    if a == ma:
        print(ma2)
    else:
        print(ma)
# Judge status: Wrong Answer
from fractions import Fraction
N , K = list(map(int,input().split()))
denom_list = []
Z=0


def detame_keisan( N , K , i ):
    kijun = 10
    score = i
    count = 0
    
    while score < kijun:
        count += 1
        score = ( score *  2 )
        
        print(count)
    return N * (2 ** count)

for i in range( 1,N+1 ):
    X = detame_keisan( N , K , i)
    denom_list.append( X )

for item in denom_list:
    #Z += 1/item
    Z += Fraction(1, item)
print( Z.numerator / Z.denominator)
# Judge status: Wrong Answer
X, Y, Z = map(int, input().split())
print(Y, Z, X)
# Judge status: Wrong Answer
from collections import Counter
N=int(input())
A=Counter(sorted(list(map(int,input().split()))))
A=[i for i in A if A[i]>=2]
A.sort(reverse=True)
try:
    print(A[0]*A[1])
except:
    print(0)
# Judge status: Accepted
s = input()
n = len(s)-2
X = []

for i in range(n):
    X.append(int(s[i:i+3]))
    
ans = 753

for i in range(n):
    if abs(X[i]-753) < ans:
        ans = abs(X[i]-753)
        
print(ans)
# Judge status: Accepted
import numpy as np

a,b,h,m=[int(i) for i in input().split()]

def get_angle(h,m):
    long_angle=2*np.pi*m/60
    short_angle=2*np.pi*h/12+(2*np.pi/12)*m/60
    big_angle=max(long_angle,short_angle)
    small_angle = min(long_angle, short_angle)
    angle=min(big_angle-small_angle,2*np.pi-big_angle+small_angle)
    return angle

def yogen(a,b,theta):
    ans=a**2+b**2-2*a*b*np.cos(theta)
    return ans**0.5

print(yogen(a,b,get_angle(h,m)))
# Judge status: Accepted
from sys import stdin
N,L=list(map(int,stdin.readline().strip().split()))
taste=L-1
apple_list=[]
min=3000
j=0
for i in range(1,N+1):
    apple_list.append(taste+i)
    if min>abs(taste+i):
        min=abs(taste+i)
        j=i-1
apple=sum(apple_list)
print(apple-(apple_list[j]))
# Judge status: Wrong Answer
K = int(input())
A, B = map(int, input().split())

min_num = A//K
max_num = B//K

for i in range(min_num, max_num+1):
  if A <= i*K <= B:
    print("OK")
    exit(0)

print("NO")
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
min_ = inf
for i in range(len(s)-3):
  min_ = min(min_, abs(int(s[i:i+3])-753))
print(min_)
# Judge status: Accepted
n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(n):
    c = input()
    if c == 'AC':
        c0 += 1
    elif c == 'WA':
        c1 += 1
    elif c == 'TLE':
        c2 += 1
    else:
        c3 += 1
print(f'AC x {c0}')
print(f'WA x {c1}')
print(f'TLE x {c2}')
print(f'RE x {c3}')
# Judge status: Wrong Answer
print('win' if sum(list(map(int,input().split())))<22 else 'burst')
# Judge status: Accepted
n = int(input())
s = [int(input()) for _ in range(n)]

ans = sum(s)
x = []

for i in s:
    if i % 10 != 0:
        x.append(i)
x = sorted(x)

for i in x:
    if ans % 10 == 0:
        ans = ans - i
if ans % 10 == 0:
    print(0)
else:
    print(ans)
# Judge status: Accepted
from functools import reduce
input()
print(reduce(lambda a,b:(a+b)/2,sorted(map(int,input().split()))))
# Judge status: Accepted
l=int(input())
print(l/3*l/3*l/3)
# Judge status: Wrong Answer
i = int(input())
if i == 0:
    print(1)
else:
    print(1)
# Judge status: Accepted
N, L = map(int, input().split())
# 味：L + i - 1
aji_list = [L+i-1 for i in range(1, N+1)]

basic = abs(sum(aji_list))
min_diff = 9999999 
for i in aji_list:
    diff = abs(basic - abs(basic - abs(i)))
    min_diff = min(min_diff, diff)

for i in aji_list:
    if abs(basic - abs(basic - abs(i))) == min_diff:
        if basic == sum(aji_list):
            print(basic - abs(i))
        else:
            print(-1*(basic - abs(i)))
        break
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))

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

if miss==0 or miss==2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from collections import Counter

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

a=Counter(a)
ans=0
for key,count in a.most_common():
    key=int(key)
    if count>=key:
        ans+=count-key
    else:
        ans+=count
print(ans)
# Judge status: Accepted
import math

def isPrime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
    # ２ではない偶数は素数ではない
        return False

# nの半分まで計算する範囲を絞る
    m = math.floor(n / 2) + 1
    for p in range(3, m, 2): # 奇数だけ計算する
        if n % p == 0:
            return False
    return True
n=int(input())
while not isPrime(n):
    n+=1
print(n)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n=int(input())
dp=[[0]*10 for _ in range(10)]

for i in range(1,n+1):
    dp[int(str(i)[0])][int(str(i)[-1])]+=1

#print(dp)
ans = 0
for i in range(10):
    for j in range(10):
        ans+=dp[i][j]*dp[j][i]
print(ans)
# Judge status: Accepted
import sys
import fractions

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

g = 0
mx_2 = 0
for i in a:
    tmp = 0
    while i % (2 ** tmp) == 0: tmp += 1
    mx_2 = max(mx_2, tmp - 1)
    g = fractions.gcd(g, i)

if g % (2 ** mx_2) != 0 or g % (2 ** (mx_2 + 1)) == 0:
    print(0)
else:
    prod = 1
    lcm = 1
    g = 0
    for i in a:
        lcm = lcm * i // 2 // fractions.gcd(lcm, i // 2)

    print((m // lcm + 1) // 2)
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))

max = 0
count = 0
for x in range(N-1):
  if H[x]>=H[x+1]:
    count += 1
  else:
    if max < count:
      max = count
    count=0
if max < count:
  max = count
print(max)
# Judge status: Wrong Answer
k = int(input())
a, b = map(int, input().split())
if b - a >= k or k == 1:
    print('OK')
else:
    print('NG')
# Judge status: Accepted

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    A,B,C,K=map(int,input().split())
    if abs(B-A)>10**18:
        print('Unfair')
    else:
        if K%2==0:
            print(A-B)
        else:
            print(B-A)

resolve()
# Judge status: Accepted
a, b = map(int, input().split())
print (str(a)*b if a <= b else str(b)*a)
# Judge status: Wrong Answer
s = input()
K = int(input())
for i in range(len(s)):
  if(ord("a") + 26 - ord(s[i]) <= K):
    K -= ord("a") + 26 - ord(s[i])
    s = s[:i] + "a" + s[i+1:]
  if(i == len(s) - 1):
    s = s[:-1] + chr(ord("a") + ((ord(s[-1]) + K % 26) - ord("a")) % 26)
print(s)
# Judge status: Accepted
N,M=map(int,input().split())
L=[1]*N
S=[-1]*N
S[0]=1
for i in range(M):
	x,y=map(int,input().split())
	if S[x-1]==1:
		S[y-1]=1
	L[x-1]-=1
	L[y-1]+=1
	if L[x-1]==0:
		S[x-1]=-1
print(S.count(1))
# Judge status: Accepted
# from pprint import pprint
# import math
# import collections

# n = int(input())
a, b, x = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

_a = a // x + 1
_b = b // x + 1

if a % x == 0:
    _c = 1
else:
    _c = 0

ans = _b - _a + _c

# print(_a, _b, _c, ans)
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]

# 線形で計算できる
# j > iとしてA[j]+A[i] = j-iよりA[i]+i=j-A[j]
# iとjを分離できたのでjを前に進めていって、計算結果を貯めていけばいい
# 

counter = 0
dic = {}
for j in range(N):
    if j-A[j] in dic:
        counter += dic[j - A[j]]
    if j + A[j] in dic:
        dic[j+A[j]] += 1
    else:
        dic[j+A[j]] = 1
print(counter)
# Judge status: Wrong Answer
n = int(input())
ans = ""
for i in range(n):
    if i == 0:
        ans = sorted(input())
    else:
        tmp = sorted(input())
        ans = [v for v in ans if v in tmp]

print(''.join(map(str, ans)))
# Judge status: Accepted
n, x, t = map(int,input().split())
cnt=0
while True:
    n=n-x
    cnt+=t
    if n<=0:
        break
print(cnt)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(1,a+1):
  for j in range(1,b+1):
    for k in range(1,c+1):
      if i*500 + j*100 + k*50 == x:
        count += 1
        
        
print(count)
# Judge status: Accepted
N, M, X = [int(i) for i in input().split()]

CA = []
for i in range(N):
    CA.append([int(j) for j in input().split()])

min_money = 100000 ** N + 1
for i in range(2**N):
    money = 0
    result = [0] * M
    for j in range(N):
        if ((i >> j) & 1):
            money += CA[j][0]
            for n in range(1, M+1):
                result[n-1] += CA[j][n]
    if money < min_money and min(result) >= X:
        min_money = money

print(min_money if min_money != 100000 ** N + 1 else -1)
# Judge status: Accepted
def gcd(a, b):
	"""Compute the greatest common divisor of a and b"""
	while b > 0:
		a, b = b, a % b
	return a

def lcm(a, b):
	"""Compute the lowest common multiple of a and b"""
	return a * b // gcd(a, b)

def resolve():
	n = int(input())
	t = [int(input()) for _ in range(n)]
	ans = t[0]
	for i in t[1:]:
		ans = lcm(ans, i)
	print(ans)
resolve()
# Judge status: Accepted
A, B = map(int, input().split())
ans = 0

for i in range(A, B + 1):
    i = str(i)

    flag = True
    for j in range(len(i) // 2):
        if i[j] != i[len(i) - 1 - j]:
            flag = False
    if flag == True:
        ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
c=input()
d=c.count("R")
e=c[:d].count("R")
print(d-e)
# Judge status: Wrong Answer
from math import factorial
n,m=map(int,input().split())
mod=10**9+7
f=factorial(n)
if abs(n-m)>1:
  print(0)
elif abs(n-m)==1:
  print((f**2)%mod)
else:
  print((2*(f**2))%mod)
# Judge status: Wrong Answer
d, t, s = map(int, input().split())

if d // s <= t:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import fractions
from functools import reduce
N, X =list(map(int,input().split()))
listx = list(map(int,input().split()))
list1 = [abs(x-X) for x in listx]

for i in range(0,N-1):
  ans = fractions.gcd(list1[i],list1[i+1])

print(reduce(lambda a,b:fractions.gcd(a,b),list1,list1[0]))
# Judge status: Wrong Answer
N=int(input())
input1=list(map(int,input().split()))
max1=0
for  i in input1:
	if sum(input1)-i >=max1:
		max1=i 
print(max1)
# Judge status: Accepted
N = int(input())
S = list(input())

c = [0,0]
for s in S:
    if s == '(':
        c[0] += 1
    else:
        if c[0] > 0:
            c[0] -= 1
        else:
            c[1] += 1

pre = ['('] * c[1]
rear = [')'] * c[0]
ans = pre+S+rear
print(''.join(ans))
# Judge status: Accepted
X, Y = map(int, input().split())
MD = pow(10, 9) + 7

def choose(n, a):
    x, y = 1, 1
    for i in range(a):
        x = x * (n - i) % MD
        y = y * (i + 1) % MD
    return x * pow(y, MD - 2, MD) % MD

a = (2*Y-X)//3
b = (Y-2*X)//-3
if a < 0 or b < 0 or (X+Y) % 3 != 0:
    print(0)
    exit()
print(choose(a+b, min(a,b)))
# Judge status: Wrong Answer
n = int(input())

xl = [[int(i) for i in input().split()] for j in range(n)]

xl.sort(key = lambda x:x[1])
xl.sort(key = lambda x:x[0])

now = xl[0][0] + xl[0][1]
count = 1

if(n == 1):
    print(1)
else:
    for i in range(1, n):
        if(now <= xl[i][0] - xl[i][1]):
            count += 1
            now = xl[i][0] + xl[i][1]

    print(count)
# Judge status: Accepted
s = input()
print("yes" if len(set(s)) == len(s) else "no")
# Judge status: Wrong Answer
from itertools import accumulate
N = int(input())
a = tuple(map(int,input().split()))
s = list(accumulate(a))
b = [0]*(N+1)
if a[0] == 0:
    b[0] = 1
ans = 1
flag = 0
for d in range(1,N+1):
    b[d] = b[d-1]-a[d]
    tmp = min(s[-1]-s[d],2*b[d-1]-a[d])
    if b[d] > tmp or tmp < 0:
        flag = 1
        break
    else:
        b[d] = tmp
if flag:
    print(-1)
else:
    print(s[-1]+sum(b))
# Judge status: Accepted
import math

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

s=int(input())

sm=1

if s<3:
  print("0")
else:
  for i in range(2,(s//3)+1):
    a=s-(i*3)
    #print(i,",",a)
    sm+=comb(i+a-1,i-1)
    #print(sm)
  print(sm%((10**9)+7))
# Judge status: Accepted
c=[list(map(int,input().split())) for _ in range(3)]
yoko=[c[0][1]-c[0][0],c[0][2]-c[0][1]]
tate=[c[1][0]-c[0][0],c[2][0]-c[1][0]]
flag=1
for i in range(1,3):
 if not((c[i][1]-c[i][0]==yoko[0])and(c[i][2]-c[i][1]==yoko[1])):
  flag=0
 if not((c[1][i]-c[0][i]==tate[0])and(c[2][i]-c[1][i]==tate[1])):
  flag=0

if flag==1:
 print("Yes")
else:
 print("No")
# Judge status: Accepted
n=str(input())
N = int(n)
m=int(input())
cnt = 0
for i in range(m):
    if i >= N:
        break
    if n[i] == "1":
        cnt +=1
    else:
        break
      
    
if cnt == m:
    print(1)
elif cnt == 0:
    print(n[0])
elif  cnt < m:
    print(n[cnt])
# Judge status: Accepted
import bisect

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

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

WA = [0] * (N + 1)
WB = [0] * (M + 1)
for i in range(N):
    WA[i + 1] = WA[i] + A[i]
for j in range(M):
    WB[j + 1] = WB[j] + B[j]
ma = 0
last = False
for i in range(0, N + 1):
    if WA[i] > K:
        break
    t = K - WA[i]
    j = bisect.bisect(WB, t)
    ma = max(ma, i + j - 1)

print(ma)
# Judge status: Accepted
N = int(input())
li = list(map(int,input().split()))
li.sort(reverse=True)
Alice = 0
Bob = 0
for i in range(1,N+1):
    if i%2 !=0:
        Alice+=li[i-1]
    elif i%2 == 0:
        Bob += li[i-1]
ans = Alice-Bob
print(ans)
# Judge status: Accepted
W, H, N = map(int, input().split())
x_min, x_max, y_min, y_max = 0, W, 0, H 
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1 and x > x_min:
        x_min = x
    elif a == 2 and x < x_max:
        x_max = x
    elif a == 3 and y > y_min:
        y_min = y
    elif a == 4 and y < y_max:
        y_max = y
if x_max > x_min and y_max > y_min:
    S = (x_max - x_min) * (y_max - y_min)
else:
    S = 0
print(S)