peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
A, B, X = map(int, input().split())

def main():
    if A + B < X or A > X:
        print("NO")
    else:
        print("YES")

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = []
for i in range(n):
    a.append(int(input()) - 1)

hst = [0] * n
btn = 0
cnt = 0

while hst[btn] != 1:
    hst[btn] = 1
    btn = a[btn]

    cnt += 1
    if btn == 1:
        print(cnt)
        exit()

print(-1)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
n=10*A+B
m=10*B+C
print(max(n+C,A+m))
# Judge status: Wrong Answer
s=input()
k="keyence"
for i in range(8):
    print(k[:i],k[i:])
    if k[:i] not in s or k[i:] not in s:
        continue
    else:
        if s.find(k[:i])<s.find(k[i:]):
            print("YES" )
            exit()
print("NO")
# Judge status: Accepted
S,W=map(int,input().split())

if S<=W:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

a = list(range(1,N+1,2))
b = list(range(2,N+1,2))

if N%2 == 0:
    b.reverse()
    ind = b + a
else:
    a.reverse()
    ind = a + b

ans = []
for i in ind:
    ans.append(A[i-1])

print(*ans)
# Judge status: Wrong Answer
s=input()
a=[]
for i in range(len(s)):
    a.append(s[i])
    if s[i] in a:
        print("Bad")
        exit()
print("Good")
# Judge status: Accepted
X = int(input())
if X <= 599:
    print('8')
elif X <= 799:
    print('7')
elif X <= 999:
    print('6')
elif X <= 1199:
    print('5')
elif X <= 1399:
    print('4')
elif X <= 1599:
    print('3')
elif X <= 1799:
    print('2')
else:
    print('1')
# Judge status: Wrong Answer
A, B = map(int,input().split())

a = int(A / 0.08)

if A == int(a * 0.08) and B == int(a * 0.10) :
    print(a)
else :
    print('-1')
# Judge status: Wrong Answer
from fractions import Fraction
n=int(input())
a=[int(x) for x in input().split()]
y=a[0]
num,den=y,y
f=Fraction(0,1)
for i in range(1,len(a)):
    f=(Fraction(num,den)+Fraction(y,a[i]))
    num,den=f.numerator,f.denominator
print(f.numerator%(10**9+7))
# Judge status: Accepted
a,b,c = map(int,input().split())
s = a+b+c
if 2*b==s or 2*a==s or 2*c==s:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
s = []
res = "Yes"
for i in range(n):
  s.append(input())
  for j in range(i):
    if s[i] == s[j]:
      res = "No"
  if i != 0:
    if s[i][0] != s[i-1][len(s[i-1])-1]:
      res = "No"
print(res)
# Judge status: Accepted
S=input()
z=0
o=0
for i in range(len(S)):
    if S[i]=="0":
        z+=1
    elif S[i]=="1":
        o+=1
print(2*min(z,o))
# Judge status: Accepted
import math

a,b = map(int,input().split())
if b>a:
    a,b = b,a
l = (a*b)//(math.gcd(a,b))
print(l)
# Judge status: Wrong Answer
A, B = map(int, input().split())
print(-(-B//A))
# Judge status: Accepted
N, M = map(int, input().split(' '))
if N == M:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
route=["","","",""]
route[0]='U'*dx+'R'*dy
route[1]='D'*dx+'L'*dy
route[2]='L'+'U'*(dx+1)+'R'*(dy+1)+'D'
route[3]='R'+'U'*(dx+1)+'L'*(dy+1)+'U'
print("".join(route))
# Judge status: Accepted
n,m = map(int,input().split())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
    
ab.sort()
cnt = 0
ans = 0
for i in range(n):
    a = ab[i][0]
    b = ab[i][1]
    if cnt +b >= m:
        ans += (m-cnt)*a
        break
    else:
        ans +=a*b
        cnt +=b
print(ans)
# Judge status: Wrong Answer
n = int(input())
b = list(map(int, input().split()))

a = [b[0]]
for num, i in enumerate(b):
  if num == 0:
    a.append(i)
  elif num == n-2:
    a.append(i)
  elif i <= b[num + 1]:
    a.append(i)
  elif i > b[num + 1]:
    a.append(b[num + 1])
print(sum(a))
# Judge status: Accepted
s=list(input())
m=1000
for x in range(len(s)-2):
    m=min(m,abs(753-int("".join(s[x:x+3]))))
print(m)
# Judge status: Accepted
N , M = map(int,input().split())
s = [list(map(int,input().split())) for _ in range(M)]

ans = "IMPOSSIBLE"

start_candidate = [X[1] for X in s if X[0]==1 ]
goal_candidate = [X[0] for X in s if X[1]==N]

ans = len(start_candidate)+len(goal_candidate)-len(set(start_candidate+goal_candidate))
if ans != 0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
import math
a,b,x=map(int,input().split())
if x<a*a*b/2:
    t=a*b*b/2/x
else:
    t=2*b/a-2*x/(a**3)
print(math.atan(t)/math.pi*180)
# Judge status: Accepted
# B - バイナリハックイージー
s = input()
lst = []
for i in s:
    if i == 'B' and len(lst) !=0:
        lst.pop()
    elif i == 'B':
        continue
    else:
        lst.append(i)
print(''.join(lst))
# Judge status: Wrong Answer
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    city = list(map(int, sys.stdin.readline().split()))
    brave = list(map(int, sys.stdin.readline().split()))

    ret = 0
    tmp = 0
    for n in range(N):
        ret += min(city[n], brave[n])
        ret += min(city[n + 1], brave[n] - min(city[n], brave[n]))

    print(ret)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,m=map(int,input().split())
A=sorted(list(map(int,input().split())))
BC=[list(map(int,input().split())) for i in range(m)]
BC=sorted(BC,reverse=True,key=lambda x: x[1])
flag=0
t=0
for i in range(m):
  if flag==1:
    break
  for j in range(t,n):
    if BC[i][1]>A[j]:
      A[j]=BC[i][1]
      BC[i][0]-=1
      t=j+1
      if BC[i][0]==0:
        break
    else:
      flag=1
      break
print(sum(A))
# Judge status: Accepted
N = int(input())
A = int(input())
r = N%500
if A >= r:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import numpy as np

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

mod = 10**9 + 7
ans = 0
two = 1
for i in range(61):
    one = np.count_nonzero(a & 1)
    a = a >> 1
    ans = (ans + (one*(n-one))*two) % mod
    two = (two * 2) % mod
print(ans)
# Judge status: Wrong Answer
data=input().split()
a=int(data[0])
b=int(data[1])
a=a%b
print(a)
# Judge status: Accepted
x, y = map(int, input().split())
ans=0
while x<=y:
    x*=2
    ans+=1
print(ans)
# Judge status: Accepted

def main():
  n, k = map(int, input().split())

  A = tuple(map(lambda a: int(a) - 1, input().split()))

  arrival = [None] * n
  arrival[0] = 0

  pos = 0
  for i in range(1, k + 1):
    next_pos = A[pos]

    if arrival[next_pos]:
      loop_len = i - arrival[next_pos]
      remaining = k - i
      kk = arrival[next_pos] + remaining % loop_len
      print(arrival.index(kk) + 1)
      return

    arrival[next_pos] = i
    pos = next_pos

  print(pos + 1)


main()
# Judge status: Accepted
alf = {c:i for i,c in enumerate('abcdefghijklmnopqrstuvwxyz')}
a = 'abcdefghijklmnopqrstuvwxyz'
s = input()
k = int(input())
diff = [26-alf[c] if c != 'a' else 0 for c in s]
ans = []
for i in range(len(s)):
    if k >= diff[i]:
        ans.append('a')
        k -= diff[i]
    else:
        ans.append(s[i])
    # print(ans,k)
if k > 0:
    ans[-1] = a[(alf[ans[-1]] + k % 26)]
print(''.join(ans))
# Judge status: Accepted
cand=[(5,5,7),(5,7,5),(7,5,5)]
X=tuple(map(int,input().split()))
print("YES") if X in cand else print("NO")
# Judge status: Accepted
N=int(input())
a=list(map(int, input().split()))
b=[0]*N
for i in range(N):
  if i%2==0: # 前から
    b[i//2]=str(a[N-1-i])
  else:
    b[N-1-i//2]=str(a[N-1-i])
print(" ".join(b))
# Judge status: Accepted
N = int(input())
j = 0
while 1:
    if 2**j > N:
        print(2**(j-1))
        break
    else:
        j += 1
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
x,y,z = a//2, b//2, c//2
p,q,r = a-x, b-y, c-z
print(min(abs(a*b*(z-r)), abs(b*c*(z-p)), abs(c*a*(y-q))))
# Judge status: Accepted
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n,k = map(int,readline().split())
p = [int(input()) for i in range(n)]
p.sort()
ans = 10**9 
for i in range(n-k+1):
    if p[i+k-1]-p[i] < ans: ans =  p[i+k-1]-p[i]
print(ans)
# Judge status: Accepted
S = input()
Q = int(input())
#query = [input().split() for _ in range(Q)]

rev = False
forw = ""
back = ""
for i in range(Q):
  query = input().split()
  if query[0] == "1":
    rev = not rev
  else:
    if (not rev and query[1] == "1") or (rev and query[1] == "2"):
      forw = query[2] + forw
    else:
      back += query[2]
#S = forw + S + back
if rev:
  S = back[::-1] + S[::-1] + forw[::-1]
else:
  S = forw + S + back
print(S)
# Judge status: Accepted
N, K = map(int, input().split())

n = N%K
print(min(n, abs(n-K)))
# Judge status: Accepted
N=int(input())
A=input()
B=input()
k=0
for i in range(N):
   if A[N-i-1:N+1]==B[0:i+1]:
      k=i+1
print(N*2-k)
# Judge status: Accepted
n,k=map(int, input().split())
a=[int(i) for i in input().split()]
if n==k:
    print(1)
else:
    k-=1
    print((n+k-2)//k)
# Judge status: Wrong Answer
n,k,*a=map(int,open(0).read().split())
for i in range(n,10**6):
    if not set(str(i))&set(a):
        print(i)
        exit()
# Judge status: Wrong Answer
n,d = map(int,input().split())
i=0
num_list=[]
for k in range(n):
  num_list.append(list(map(int,input().split())))
for j in range(n):
  if num_list[j][0]**2 + num_list[j][1]**2 <= 5:
    i = i + 1
print(i)
# Judge status: Wrong Answer
N = int(input())
ans = float("inf")
for i in range(N):
    if sum(map(int, str(i))) + sum(map(int, str(N-i))) < ans:
        ans = sum(map(int, str(i))) + sum(map(int, str(N-i)))
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(readline())
A = list(map(int,readline().split()))
total = sum(A)
B = [0] * N
for i in range(N):
    B[i] = total-A[i]
ans = 0 
for i in range(N):
    ans += A[i]*B[i]
    if ans >= 2*MOD:
        ans %= MOD
print(ans//2)
# Judge status: Wrong Answer
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

from heapq import heapify, heappush, heappop, heappushpop, heapreplace

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = [r if i == 's' else s if i == 'p' else p for i in list(input())]
ans = 0
for i in range(k):
    j = i
    prev = False
    while j < n:
        if prev and t[j] == t[j-k]:
            prev = False
        else:
            ans += t[j]
            prev = True
        j += k
print(ans)
# Judge status: Accepted
s = int(input())

A = [s]
n = (s/2 if s%2==0 else 3*s+1)
ans = 1

while n not in A:
    ans +=1
    A.append(n)
    n = (n/2 if n%2==0 else 3*n+1)

print(ans+1)
# Judge status: Accepted
N,L = [int(i) for i in input().split(" ") ]

S = []
for _ in range(N):
  S.append( input() )
 
sd =  sorted(S, key=lambda x: (str(x)[0], x))

print("".join(sd))
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
S = input()
if c < d:
    if "##" in S[a-1:d]:
        print("No")
    else:
        print("Yes")
else:
    f = S[b-2:d+1].find("...")
    if f != -1 and ("##" not in S[a-1:c]):
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
S = input()
ls = list(S)
lsa = [ls[0],ls[1]]
lsb = [ls[2],ls[3]]

a = int(''.join(lsa))
b = int(''.join(lsb))

if (a >= 1 and a <= 12):
  if b >= 1 and b <= 12:
    print('AMBIGIOUS')
  else:
    print('MMYY')
elif b >= 1 and b <= 12:
  print('YYMM')
else:
  print('NA')
# Judge status: Wrong Answer
n = int(input())
arr = list(map(int, input().split()))
for i in range(n-1, 0, -1):
    if arr[i]>arr[i-1]:
        arr[i-1]-=1
        if arr[i]>arr[i-1]:
            print('No')
            break
else:
    print('Yes')
# Judge status: Accepted
import math
N = int(input())
A = [list(map(int,input().split())) for _ in range(N-1)]
for i in range(N):
    t = 0
    for C,S,F in A[i:]:
        if t < S:
            t = S+C
        else:
            t = math.ceil((t-S)/F)*F+S+C
    print(t)
# Judge status: Wrong Answer

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

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    print(0)
else:
    print(min(a*b,b*c,c*a))
# Judge status: Accepted
n = int(input())
x,y,t=0,0,0

for i in range(n):
  mt,mx,my= map(int,input().split())
  ft = mt - t
  fx = abs(x-mx)
  fy = abs(y-my)
  if fx + fy > ft:
    print("No")
    exit()
  elif (ft - (fx + fy)) % 2 == 0:
    pass
  else:
    print("No")
    exit()
  x,y,t=mx,my,mt
print("Yes")
# Judge status: Accepted
n,k = map(int, input().split())
r,s,p = map(int, input().split())
T = list(input())

# restore
for i in range(n):
    if i >= k:
        if T[i] == T[i - k]:
            T[i] = '-'

# point sum
psum = 0
for i in range(n):
    if T[i] == 'r':
        psum = psum + p
    elif T[i] == 'p':
        psum = psum + s
    elif T[i] == 's':
        psum = psum + r
print(psum)
# Judge status: Accepted
N=int(input())
A=sorted(map(int,input().split()))
m=max(A)
ans=0
dp=[True]*(m+1)
for i in range(N):
    if not dp[A[i]]:
        continue
    if i==N-1:
        ans+=1
    elif i<N-1 and A[i+1]!=A[i]:
        ans+=1
    for j in range(1,m//A[i]+1):
        dp[A[i]*j]=False
print(ans)
# Judge status: Accepted
K = int(input())
count = 9
lunlun = [1,2,3,4,5,6,7,8,9]
i = 0

while count < K:
  if (lunlun[i]%10) != 0:
    lunlun.append(lunlun[i]*10+lunlun[i]%10-1)
    count = count + 1
  lunlun.append(lunlun[i]*10+lunlun[i]%10)
  count = count + 1
  if (lunlun[i]%10) != 9:
    lunlun.append(lunlun[i]*10+lunlun[i]%10+1)
    count = count+1
  i= i+1
print(lunlun[K-1])
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]

sa = sorted(a)
amx = sa[-1]
amx2 = sa[-2]

for ai in a:
  print(amx if ai != amx else amx2)
# Judge status: Accepted
S = input()
if S[-1] == 's':
    S += 'e'
print(S + 's')
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    s = input()

    if(s[-1] == 's'):
        print(s+'es')
    else:
        print(s+'s')


if __name__ == '__main__':
    main(sys.stdin.readline, print)
# Judge status: Wrong Answer
import sys
import math
N=int(input())
S = []
s=N
for i in range(N):
    S.append(input()) 
for i in range(N):
    for j in range(i+1,N):
        if  S[j]==S[i]:
            S[j]=[]
            s=s-1
print(s)
# Judge status: Wrong Answer
arr=[int(i) for i in input().split()]
if(arr[0]//arr[2]<=arr[1]):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import itertools
import math
k=int(input())
ans=0
for x,y,z in itertools.combinations_with_replacement(range(2,k+1),3):
    ans+=math.gcd(math.gcd(x,y),z)
print(ans+3*((k-1)**2)+3*(k-1)+1)
# Judge status: Accepted
D=int(input())
c = list(map(int,input().split()))
s=[[0 for e in range(26)] for f in range(D)]
for i in range(D):
 s[i]=list(map(int,input().split()))
last=[0]*26
ans=0
point=[0]*D
for i in range(D):
 saidai=-(10**10)
 kouho=1
 for j in range(26):
  if s[i][j]+c[j]*((i+1)-last[j])>=saidai:
   kouho=j+1
   saidai=s[i][j]+c[j]*((i+1)-last[j])
 print(1)
# Judge status: Accepted
n, p = map(int, input().split())
A = list(map(int, input().split()))
if all(a % 2 == 0 for a in A):
    if p:
        print(0)
    else:
        print(pow(2, n))
else:
    print(pow(2, n-1))
# Judge status: Accepted
x = int(input())

for i in range(1,10**5):
    curr_max = i*(i+1)//2
    if curr_max >= x:
        print(i)
        break
# Judge status: Wrong Answer
n = int(input())
a = list(map(str,input().split()))
b = []

for i in range(len(a)):
    if i%2 == 0:
        b.append(a[i])
    else:
        b.insert(0,a[i])
print(' '.join(b))
# Judge status: Accepted
N, A, B = map(int, input().split())

AB = A + B
ans = 0

ans += (N // AB) * A

if N % AB > A:
  ans += A
else:
  ans += N % AB

print(ans)
# Judge status: Accepted
def main():
    n, l = map(int, input().split())
    S = list(input() for _ in range(n))

    print(''.join(sorted(S)))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import collections
import itertools
N=int(input())
#P=list(map(int,input().split()))
st=[]
for i in range(N):
    s=str(input())
    st.append(s)
c = collections.Counter(st)

ret = [letter for letter,count in c.most_common() if count == c.most_common()[0][1]]

sorted(ret)
for r in ret:
    print(r)
# Judge status: Wrong Answer
N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L.sort(key = lambda x: x[0]**2 + x[1]**2, reverse = True)

base_x = L[0][0] 
base_y = L[0][1]
ans = 0
for l in L:
    ans = max(ans, abs(l[0] - base_x) + abs(l[1] - base_y))

print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())

n_c = N // (A+B)
n = N - n_c*(A+B)

ans = n_c*A + min(n, A)
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
S = input()
T = input()
if len(S) - len(T) > 0:
  score_list = []
  for i in range(0, len(S) - len(T) + 1):
    s = S[i:i+len(T)]
    if len(s) != len(T):
      continue
    score = sum([1 if s[i]==T[i] else 0 for i in range(len(s))])
    score_list.append(score)
  print(len(T) - max(score_list))
elif len(S) == len(T):
  score = sum([1 if S[i]==T[i] else 0 for i in range(len(S))])
  print(len(T) - score)
# Judge status: Wrong Answer
gross = int(input())
numbers = input().split()
numbers = sorted(numbers)
count = 0

for n in range(gross-2):
    for m in range(gross-1):
        for l in range(gross):
            if (n < m) and (m < l):
                if (int(numbers[n]) != (int(numbers[m]))) and (int(numbers[n]) != (int(numbers[l]))) and (int(numbers[m]) != (int(numbers[l]))):
                    if (int(numbers[n]) + int(numbers[m])) > int(numbers[l]):
                        count += 1
print(count)
# Judge status: Wrong Answer
a, b = map(int, input().split())
h = 0

for i in range(1, 999):
  h += i
  
  if h >= a:
    print(h - a)
    exit()
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())
while 0==0:
    D -= B
    # print(D)
    if D <= 0:
        print("Yes")
        exit(0)
    A -= C
    # print(A)
    if A <= 0:
        print("No")
        exit(0)
# Judge status: Wrong Answer
n,l = [int(i) for i in input().split()]
ss = [input() for _ in range(n)]
ss.sort()
for s in ss:
  print(s, sep="")
print("")
# Judge status: Accepted
from math import atan2, degrees
a,b,x = map(int, input().split())

s = x/a
if x >= a**2*b/2:
  print(degrees(atan2(2*(a*b-s)/a, a)))
else:
  print(degrees(atan2(b, 2*s/b)))
# Judge status: Accepted
from sys import stdin
import math

n=int(input())
n=int(math.sqrt(n))
print(n*n)
# Judge status: Accepted
A,B,X=map(int,input().split())
if A<=X and A+B>=X:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
import math
N = int(input())

flag = False

for i in range(math.ceil(N/7)):
    for j in range(math.ceil(N/4)):
        if N - i * 7 - j * 4 == 0:
            flag = True

if flag == True:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [inp() for _ in range(n)]
now = a[0]
for i in range(1,n):
    now = a[i]*now//fractions.gcd(a[i],now) 
print(now)
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
ret =0
if a[0]>x:
  ret+=a[0]-x
  a[0]=x
for i in range(1,n):
  if a[i-1]+a[i]>x:
    ret+=a[i-1]+a[i]-x
    a[i]=max(0,x-a[i-1])
print(ret)
# Judge status: Wrong Answer
A,B,N=map(int,input().split())
x=min(B-1,N)
print(int(A*x/B)-A*int(x/B))
# Judge status: Accepted
import sys

N, M = map(int, sys.stdin.readline().strip().split())
A = set()
for _ in range(M):
    A.add(int(sys.stdin.readline()))

# i段目の階段への到達方法の数
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 0 if 1 in A else 1

for i in range(2, N+1):
    if i in A:
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= 1000000007

print(dp[N])
# Judge status: Accepted
import math
a, b = map(int, input().split())
print(math.ceil((a+b)/ 2))
# Judge status: Accepted
from functools import reduce
from fractions import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
res = list(abs(i-X) for i in x)

# resの最大公約数を求める。　コードは reduce(gcd, list)
print(reduce(gcd, res))
# Judge status: Accepted
N = int(input())
li = list(map(int, input().split()))
li.sort()


S = 1
for i in range(N-1):
    if  li[i+1] == li[i]:
        S = S*0
    else:
        S = S
if S == 0:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
print(int((a+b)*(c//2)))
# Judge status: Accepted
a,b,c,n=map(int,input().split())
if abs(c-a)<=n:
  print("Yes")
elif abs(c-b)<=n and abs(b-a)<=n:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
k,a,b = map(int,input().split())
if a >= b-2:
  print(k+1)
else:
  d = k-(a-1)
  e = a
  e += (b-a)*(d//2)
  e += d%2
  print(e)
# Judge status: Accepted
n=int(input())
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]
ans=0
for i in range(len(b)):
  if a[i]+a[i+1]<=b[i]:
    ans+=a[i]+a[i+1]
    a[i]=0
    a[i+1]=0
  
  elif a[i]<=b[i]:
    ans+=a[i]
    ans+=(b[i]-a[i])
    a[i+1]=a[i+1]-(b[i]-a[i])
  else:
    a[i]-=b[i]
    ans+=b[i]
print(ans)
# Judge status: Wrong Answer
N,M=map(int, input().split())
dic={}
for n in range(M):
    for x in map(int, input().split()):
        if x in dic.keys():
            dic[x]+=1
        else:
            dic[x]=1
[print(v) for v in dic.values()]
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
a=[0]*200001
cnt=0
for i in range(N):
    if a[A[i]]==0:
        cnt+=1
    a[A[i]]+=1
a.sort(reverse=True)
sum=0
for i in range(cnt-K):
    sum+=a[cnt-i-1]

print(sum)
# Judge status: Accepted
n=int(input())
c=sorted(list(map(int, input().split())))
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if c[i] != c[j] and c[k] != c[i] and c[k] != c[j]:
                if c[i] + c[j] > c[k]:
                    ans += 1
print(ans)
# Judge status: Accepted
s = input()

lst1 = []
for i in range(len(s)):
   lst1.append(s[i])
lst1.sort()

lst2 = list(set(lst1))
lst2.sort()

if lst1 == lst2:
   print('yes')
else:
   print('no')
# Judge status: Wrong Answer
s = 'abcde'
t = 'bcdea'
n = len(s)
cnt = 0
for i in range(n):
    if s[i] != t[i]:
        cnt += 1
print(cnt)
# Judge status: Accepted
N,M = list(map(int, input().split()))

if N%2 == 1:
  for i in range(1,M+1):
    print(i, N-i)
else:
  # N=8 M=3 (8,1), (4,6), (7,2)
  # N=10, M=4 (10,1), (5,7), (9,2), (4,8)
  for i in range(M):
    if i%2 == 0:
      x = i//2
      print(N-x, 1+x)
    else:
      cent = N//2+1
      x = i//2+1
      print(cent-x, cent+x)
# Judge status: Accepted
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
temp = list(map(lambda x: abs(a - (t-0.006*x)), h))
p = temp.index(min(temp))
print(p + 1)
# Judge status: Wrong Answer
import fractions
N, X = map(int, input().split())
x = list(map(int, input().split()))
tmp = x[0]
for i in range(1,N):
  tmp = fractions.gcd(tmp,x[i])
print(tmp)
# Judge status: Wrong Answer
import math

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

ab = a/b
maxi = 0
st = max(0, n-a-1)
for x in range(st, n+1):
    z = 0
    
    z = math.floor(ab * x) - a * math.floor(x/b)
    if z > maxi:
        maxi = z

for x in range(0, a):
    # z = 0
    if x < b:
        z = math.floor(ab * x)
    else:
        z = math.floor(ab * x) - a * math.floor(x/b)
    if z > maxi:
        maxi = z

print(maxi)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
B=[A[i]-(i+1) for i in range(N)]

b=sum(B)//N
ans=0
for i in range(N):
  ans+=abs(B[i]-b)
print(ans)
# Judge status: Accepted
N,X,Y = map(int, input().split())

ans = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        if j <= X:
            ans[j-i-1] += 1
        elif i <= X:
            ans[min(j-i, X-i+1+abs(Y-j))-1] += 1
        elif i < Y:
            ans[min(j-i, i-X+abs(j-Y)+1)-1] += 1
        else:
            ans[j-i-1] += 1
for a in ans:
    print(a)