peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,c,k = map(int,input().split())
T = sorted([int(input()) for _ in range(n)])
#print(T)
cnt = 0
i = 0
while i < n:
    start = i
    m = 1
    cnt += 1
    while i < n:
        if i - start < c and T[i] - T[start] <= k:
            i += 1
        else:
            break
print(cnt)
# Judge status: Accepted
x, y = map(int, input().split())

print(int(x + y/2))
# Judge status: Accepted
s, w = map(int,input().split())

if w >= s:
    print('unsafe')
else:
    print('safe')
# Judge status: Wrong Answer
n,y = map(int, input().split())
n10, n5, n1 = -1, -1, -1
for i in range(n+1):
    for j in range(i, n+1):
        if i*10000 + (j-i)*5000 + (n - j)*1000 == y:
            n10 = i
            n5 = j-i
            n1 = n-i
            break
print(n10, n5, n1)
# Judge status: Wrong Answer
a = list(map(int,input().split()))

f = 0
for i in a:
    if i % 2 == 0:
        f = 1

if f:
    ans = 0
else:
    tmp = []
    for i in range(2):
        for j in range(i+1,2):
            tmp.append(a[i] * a[j])
    ans = min(tmp)

print(ans)
# Judge status: Wrong Answer
n = int(input())

l = [int(x) for x in list(str(n))]

l.reverse()

dasu=0
turi=0
for num in l:

    num_kuri=num

    if num_kuri <=5:
        dasu+=num
    else:
        dasu+=1
        turi+=10-num

#print(dasu,turi)
print(dasu+turi)
# Judge status: Wrong Answer
N, M = map(int, input().split(" "))
print((N - 2) * (M - 2))
# Judge status: Accepted
a, b, c, d = map(int, input().split())

l, r = max(a, c), min(b, d)

print(max(0, r - l))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import *

S = input()[:-1]

if S=='keyence':
    print('YES')
    exit()

for i in range(len(S)):
    for j in range(i, len(S)):
        T = S[:i]+S[j+1:]
        
        if T=='keyence':
            print('YES')
            exit()

print('NO')
# Judge status: Accepted
def main():
    K = int(input())
    visited = [False]*K

    r = 0
    for i in range(1, K+1):
        r = r*10 + 7
        r %= K
        if r == 0:
            print(i)
            exit()

        if visited[r]:
            print(-1)
            exit()
        
        visited[r] = True
    
    
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
AB = [tuple(map(int, input().split())) for i in range(N)]
A = [AB[i][0] for i in range(N)]
B = [AB[i][1] for i in range(N)]

A.sort()
B.sort()
if N % 2 == 1:
    id = (N+1)//2
    print(B[-id] - A[id-1] + 1)
else:
    id = N // 2
    print(B[-id] - A[id-1] + 1)
# Judge status: Accepted
import fractions
from functools import reduce
from collections import deque

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

#累積GCD
left = deque([0])
right = deque([0])
for i in range(n):
    left.append(fractions.gcd(left[i],a[i]))
    right.appendleft(fractions.gcd(right[0],a[n - 1 - i]))

ans = 0
for i in range(n):
    ans = max(ans,fractions.gcd(left[i],right[i + 1]))
print(ans)
# Judge status: Accepted
n = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    if i+1 == P[i]:
        P[i], P[i+1] = P[i+1], P[i]
        ans+=1
if P[n-1]==n:
    ans += 1
print(ans)
# Judge status: Wrong Answer
import sys

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

ll = [0] * N
lr = [0] * N
for i in range(N):
    ll[i] = i + 1 + As[i]
    lr[i] = i + 1 - As[i]

print(ll, lr)

ans = 0
for l in ll:
    ans += lr.count(l)

print(ans)
# Judge status: Accepted
n, m, x = map(int, input().split()) 
a = [list(map(int, input().split())) for i in range(n)]
ans = 12*(10**5) + 1
for j in range(2**n):  
    mlist = [0]*m 
    money = 0
    for k in range(n): 
        if (j >> k) & 1 == 1:
            money += a[k][0]
            for l in range(1, m+1): 
                mlist[l-1] += a[k][l]
    if min(mlist) >= x:
        ans = min(ans, money)
if ans == 12*(10**5) + 1 :
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
N=int(input())
cnt=0
 
for i in range(1,N):
	for j in range(1,i-1):
		if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]:
			cnt+=2
			
for i in range(1,N):
		if str(i)[0]==str(i)[-1]:
			cnt+=1			  
print(cnt)
# Judge status: Accepted
s=list(input())
wd=""
bef=""
ans=0
for i in s:
  wd+=i
  if bef!=wd:
    ans+=1
    bef=wd
    wd=""
    
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n,k = map(int,input().split())
A = list(map(int,input().split()))
# n = 2*10**5
# k = 40
# A = [0] * n

if k >= 41:
    print(*([n] * n))
else:
    for ii in range(k):
        B = [0] * (n+1)
        for i in range(n):
            B[max(0, i-A[i])] += 1
            B[min(n, i+A[i]+1)] -= 1
        for i in range(1,len(B)):
            B[i] += B[i-1]
        A = B[:n]
    print(*A)
# Judge status: Accepted
n = int(input())
ans = (n-1)*n//2
print(ans)
# Judge status: Accepted
N = int(input())

power = 1
for i in range(1, N + 1):
    power = power * i
    if power > 1000000000:
        power = power % 1000000007

print(power % 1000000007)
# Judge status: Accepted
N = int(input())
x = 9
order = 0
for i in range(16):
    if x > N:
        break
    x = x*10+9
    order = i+1
ans = x
for i in range(10):
    ans -= 10**order
    if  ans <= N:
        break
ret = 0
while True:
    if ans == 0:
        break
    ret += ans % 10
    ans = ans//10
print(ret)
# Judge status: Wrong Answer
def answer(n, a, b):
    if (a > b) or (n < 2): return 0
    n = n-2
    small = a*n
    big = b*n
    return big - small + 1

n, a, b = map(int, input().split())
print(answer(n, a, b))
# Judge status: Accepted
print("Yes" if [4*x+7*y for y in range(101) for x in range(101)].count(int(input())) else "No")
# Judge status: Accepted
A, B, C = map(int, input().split())

for i in range(100):
    if A*i%B == C:
        print("YES")
        exit()

print("NO")
# Judge status: Accepted
X, Y = map(int, input().split())
mod = pow(10, 9) + 7

m = (2*Y - X)/3
n = (2*X - Y)/3

if m.is_integer() == False or n.is_integer() == False:
  print(0)
  exit()
if m < 0 or n < 0:
  print(0)
  exit()

def comb(n, k):
  if k > n - k:
    return comb(n, n - k)
  mul, div = 1, 1
  for i in range(k):
    mul = mul * (n - i) % mod
    div = div * (k - i) % mod
  return mul * pow(div, mod-2, mod) % mod

ans = comb(int(n+m), int(n))
print(ans)
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(1,N-1):
    a = P[i-1:i+2]
    a.sort()
    if P[i]==a[1]:
        ans += 1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import sys
import collections
import math

sys.setrecursionlimit(10 ** 7)

# 1 ✕ N
A, B, C, D = list(map(int, input().rstrip().split()))
ar = (360 / 12) * C + D * 0.5
br = (360 / 60) * D

print(math.sqrt(A * A + B * B - (2 * A * B * math.cos(math.radians(abs(ar - br))))))
# Judge status: Wrong Answer
N,K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = A[i] -1
G = 0
lis = [0]*N
lis[0] = 1
roop = []
cnt = 0
while True:
    G = A[G]
    cnt +=1
    lis[G] += 1
    if lis[G] == 2:
        roop.append(G)
    elif lis[G] == 3:
        break

roop_cn = len(roop)
diff = cnt - roop_cn*2
K_n = K - diff
amari = K_n % roop_cn
print(roop[amari]+1)
# Judge status: Wrong Answer
n = int(input())
A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

print(A)

up = A[0][0]
bottom = A[1][0] + up
for i in range(n-1):
    up += A[0][i+1]
    bottom = max(up, bottom) + A[1][i+1]

print(bottom)
# Judge status: Accepted
s = list(input())
t = list(input())

for i in range(len(s)):
    if s == t:
        print('Yes')
        exit(0)
    a = s[-1]
    s.pop(-1)
    s[0:0] = a

print('No')
# Judge status: Accepted
n = int(input())
blocks = list(map(int,input().split()))

i = 1
count = 0
for e  in blocks:
    if e == i:
        count += 1
        i += 1

if count == 0:
    print(-1)
else:
    print(n-count)
# Judge status: Wrong Answer
def solve():
  s=list(input())
  for i in range(len(s)):
      if (i%2==0 and s[i]!='h'):
          print("No")
          return
      elif(i%2==1 and s[i]!='i'):
          print("No")
          return
  print("Yes")

solve()
# Judge status: Wrong Answer
N,K = map(int, input().split())
pi= list(map(int, input().split()))

print(sum(sorted(pi)[:N]))
# Judge status: Accepted
import numpy as np
s=int(input())

x2=int(np.ceil(np.sqrt(s)))
y3=x2

res=x2*y3-s

print('0 0 {} 1 {} {}'.format(x2,res,y3))
# Judge status: Accepted
a = list(input())
a.sort()
#sortメソッドを使って、順番に並べる。
# たとえbcaでもcbaでもabcの順にしてくれる
if a[0] == 'a' and a[1] == 'b' and a[2] == 'c':
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())

answer = 0
for i in range(1,n//2):
  next = i**2
  if next <= n:
    answer = i**2
  else :
    break

print(answer)
# Judge status: Wrong Answer
n,m = map(int,input().split())
list_A = list(input() for i in range(n))
list_B = list(input() for i in range(m))
k = "No"
for i in range(n-m+1):
  for t in range(n-m+1):
    for v in range(m):
      if list_A[v+i][t:t+m]!=list_B[v][0:m]:
        break
      k = "Yes"
print(k)
# Judge status: Accepted
from collections import Counter
N = int(input())
S = str(input())

c = Counter(S)
l = list(c.values())

ans = 1
for n in l:
  ans *= n+1
ans %= (10**9+7)
print(ans-1)
# Judge status: Accepted
A, s, C = input().split()
print("{}{}{}".format(A[0],s[0],C[0]))
# Judge status: Wrong Answer
N = int(input())
A = []
B = []
for n in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
#AB = sorted(AB, key=lambda x: x[0])
#print(AB)
A.sort()
B.sort()

if N % 2 == 1:
    print(int(B[N//2] - A[N//2] + 1))

elif N % 2 == 0:
    print(int((B[N//2] - A[N//2])/(1/2) + 1))
    
else:
    print('RE')
# Judge status: Accepted
A, B , C , D = map(int, input().split())
while True:
    C -= B
    if C <= 0:
        print("Yes")
        break
    A -= D 
    if A <= 0:
        print("No")
        break
# Judge status: Accepted
n, m = map(int, input().split())

if n * 2 >= m:
    print(m // 2)
else:
    m -= n * 2
    print(n + (m // 4))
# Judge status: Accepted
N = int(input())
S = input()

E_lst = []
cnt = 0
for i in range(N):
    if S[i] == 'E':
        cnt += 1
    E_lst.append(cnt)
min = N + 1
for i in range(N):
    nw = 0 #i番目の人の左側にいるWの人数
    if i > 0:
        nw = i - E_lst[i - 1]
    ne = E_lst[N - 1] - E_lst[i]
    if nw + ne < min:
        min = nw + ne
print(min)
# Judge status: Wrong Answer
N,K=(int(x) for x in input().split())
k=0
a=K
while a<=N:
    k=+1
    a=K*10**k
print(k)
# Judge status: Accepted
def resolve():
    N = int(input())
    h = [int(i) for i in input().split()]
    dp = [float("inf")] * N
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(2, N):
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]))
    print(dp[-1])


resolve()
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 998244353


def resolve():
    n = int(input())
    D = list(map(int, input().split()))

    tree = [0 for _ in range(max(D) + 1)]
    for i in range(n):
        idx = D[i]
        tree[idx] += 1

    if D[0] != 0 or tree[0] != 1 or 0 in tree:
        print(0)
        exit()

    res = 1
    for i in range(len(tree) - 1):
        res *= pow(tree[i], tree[i + 1], mod)

    print(res % mod)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
S={}
for i in range(D):
  S[i] = [int(x)-y for x,y in zip(input().rstrip('\n').split(),cs)]
for i in range(D):
  s1 = S[i]
  s1_s=sorted(s1,reverse=True)
  if i!=D-1:
    s2=S[i+1]
    if s2.index(max(s2))==s1.index(max(s1)):
      print(s1.index(s1_s[1])+1)
    else:
      print(s1.index(s1_s[0])+1)
print(S[D-1].index(max(S[D-1]))+1)
# Judge status: Accepted
str = input()

if(len(str)%2 != 0):
    print("No")
    exit()
for i in range(len(str)):
    if(i % 2 == 0):
        if(str[i]!='h'):
            print("No")
            exit()
    if(i % 2 == 1):
        if(str[i]!='i'):
            print("No")
            exit()
print("Yes")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cnt = sum(B) - sum(A)
for i in range(N):
    if A[i] < B[i]:
        cnt -= (B[i]-A[i])//2
        if cnt < 0:
            print("No")
            break
else:
    print("Yes")
# Judge status: Accepted
import math
a = int(input())
b = int(input())
n = int(input())
dum = max(a,b)
ans = n/dum
print(math.ceil(ans))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))

a.sort()
ai=max(a)
if n%2==0:
    jj=n//2-1
else:
    jj=n//2
aj=a[jj]

print(ai,aj)
# Judge status: Accepted
x,a,b=map(int,input().split())
print('A'if abs(x-a)<abs(x-b) else 'B')
# Judge status: Wrong Answer
n=int(input())
a=[]
for i in range(n):
    x,y=list(map(int,input().split()))
    a.append(x+y)

print(abs(max(a))-abs(min(a)))
# Judge status: Wrong Answer
contest_num = int(input())

if contest_num <= 999:
    print('ABC' + str(contest_num).zfill(3))
elif contest_num >= 1000:
    over_thousand_num_fix = contest_num - 999
    print('ABD' + str(over_thousand_num_fix).zfill(3))
# Judge status: Accepted
# AtCoder Beginner Contest 154: B (2020/02/09)
S = str(input())
T = ''
for i in range(len(S)):
    T = T + 'x'
print(T)
# Judge status: Wrong Answer
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, K = map(int, input().split())

l = []
for i in range(A, min(A+K, B+1)):
    l.append(i)
for i in range(max(B-K, A+1), B):
    l.append(i)

l = list(set(l))
l.sort()
print(*l, sep="\n")
# Judge status: Accepted
N=int(input())
P=list(map(lambda x : int(x)-1,input().split()))

ans=0
flag=False
for i in range(N):
    if flag:
        flag=False
        pass
    elif P[i]==i:
        ans+=1
        flag=True
    
    
print(ans)
# Judge status: Accepted
def main():
    s = input()
    t = input()
    S = ''.join(sorted(s))
    T = ''.join(sorted(t, reverse=True))
    if S < T:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Accepted
def main(N, A, B):
    if abs(A - B) % 2 == 0:
        return abs(A - B) // 2
    A, B = min(A, B), max(A, B)
    res1 = A+(B-A-1)//2

    A, B = N - B + 1, N - A + 1
    res2 = A+(B-A-1)//2
    return min(res1, res2)


if __name__ == "__main__":
    N, A, B = map(int, input().split())
    ans = main(N, A, B)
    print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
dic = {}
ls = [1]*(n+1)
ls[0] = 0
ans = 0
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ls[a] -= 1
    ls[b] += 1
    if dic.get(b,0) == 0:
        dic[b] = 1
for j in range(n+1):
    if ls[j] > 0 and dic.get(j,0) != 0:
        ans += 1
print(ans)
# Judge status: Accepted
import sys
import os


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

    A, B = list(map(int, sys.stdin.buffer.readline().split()))
    print((A+B)%24)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import itertools
grid = []
for _ in range(3):
    grid.append(list(map(int,input().split())))

sum = sum(list(itertools.chain.from_iterable(grid)))
if sum % 3 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math
n,k = map(int,input().split())


print(int(math.log(n,k))+1)
# Judge status: Wrong Answer
a=int(input())
print(['No','Yes'][a == 7 or a==5 or a==3])
# Judge status: Wrong Answer
from scipy.misc import comb

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

print(int(comb(N, 2)) + int(comb(M, 2)))
# Judge status: Accepted
from collections import defaultdict
S = input()
l = len(S)
d = {0:0}
mod10n = 1
for i in range(1, len(S)+1):
    s = int(S[l-i])
    d[i] = (d[i-1] + s * mod10n) %2019
    mod10n = (mod10n * 10) % 2019
count_d = defaultdict(int)
for key in d.keys():
    count_d[d[key]] += 1
counter = 0
for key in count_d.keys():
    counter += (count_d[key] * (count_d[key]-1)) //2

print(counter)
# Judge status: Accepted
#!/usr/bin/env python3
h1, m1, h2, m2, k = map(int, input().split())
print((h2 * 60 + m2) - (h1 * 60 + m1) - k)
# Judge status: Accepted
X=list(map(int,input().split()))
X.sort()
if X==[5,5,7]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
from collections import defaultdict as dd
from math import sqrt
d=dd(int)
def pr(n): 
    while n % 2 == 0:
        d[2]+=1
        n = n / 2
    for i in range(3,int(sqrt(n))+1,2): 
        while n % i== 0: 
            d[i]+=1
            n = n / i 
    if n > 2: 
        d[n]+=1

n=int(input())
pr(n)
ans=0
for i in d:
    ans+=(sqrt(1+8*d[i])-1)//2
print(int(ans))
# Judge status: Accepted
X,Y = map(int,input().split())
k = 0
while X<=Y:
    k += 1
    X = X*2
print(k)
# Judge status: Accepted
a,b,h=map(int,open(0));print((a+b)*h//2)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

ans=0
for i in range(n):
  if b[i]<=a[i]:
    a[i]-=b[i]
    ans+=b[i]
  elif b[i]<=(a[i]+a[i+1]):
    a[i+1]-=(b[i]-a[i])
    a[i]=0
    ans+=b[i]
  else:
    ans+=(a[i]+a[i+1])
    a[i]=0
    a[i+1]=0

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a <= c  <= b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
s=input()
c=[0]
for i in range(n):
    c.append(c[i]+(s[i]=='#'))
p=n
for i in range(n+1):
    p=min((n-c[-1]+c[i])+(c[i]-i),p)
print(p)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n, m, k = na()
dp = [[0] * (m+1) for _ in range(n+1)]

for ni in range(n):
    for mi in range(m):
        r = ni + mi
        s = ni * m + mi * n - (0+ni-1)*(ni)//2 - (0+mi-1)*(mi)//2
        if k == s:
            print("Yes")
            quit()
print("No")
# Judge status: Accepted
S = input()
N = int(S)
K = len(S)
c = int(S[0])

if len(S) == 1:
  ans = c
elif (N+1)/(10**(K-1))-1 == c:
  ans = c + 9*(K-1)
else:
  ans = (c-1) + 9*(K-1)

print(ans)
# Judge status: Wrong Answer
def main():
    a, b = map(float, input().split())
    zajedno = a*b
    print(int(zajedno))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
h,w,x,y=map(int,input().split())
print(h*w/2, int((2*x==w)*(y*2==h)))
# Judge status: Accepted
n = int(input())
n %= 10
if n == 3:
  print('bon')
elif n == 0 or n == 1 or n == 6 or n == 8:
  print('pon')
else:
  print('hon')
# Judge status: Accepted
n = range(1,int(input())+1)

def calc_div(n):
    cnt = 0
    while n/2 !=0:
        cnt += 1
        if n%2 != 1:
            n = n/2
        else:
            break
    return cnt

list = []
for i in n:
    j = calc_div(i)
    list.append(j)

max_value = max(list)
max_index = list.index(max_value)
print(n[max_index])
# Judge status: Accepted
K, A, B = map(int, input().split())

ans = 0
if A + 1 >= B or K <= A:
    ans += K + 1    
else:
    ans = A
    K -= A - 1
    ans += (B - A) * (K // 2) + K % 2
    
print(ans)
# Judge status: Wrong Answer
x=int(input())
ans=1
for i in range(1,x+1):
    for j in range(2,x+1):
        if i**j<=x:
            ans=i**j
print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
if N%2:
    x,y=N,1
    for i in range(M):
        print(x,y)
        x-=1
        y+=1
else:
    x,y=N,1
    for i in range(M):
        print(x,y)
        x-=1
        y+=1
        if x-y in (y+N-x,y+N-x-2):break
    x-=1
    for j in range(M-i-1):
        print(x,y)
        x-=1
        y+=1
# Judge status: Accepted
a,b,c=map(int,input().split())
print(["NO","YES"][(b*10+c)%4==0])
# Judge status: Accepted
N, K = map(int, input().split())
B = []
for i in range(1,N+1):
    count = 0
    while i < K:
        i *= 2
        count += 1
    B.append(count)

result = 0
for a in B:
    result += 1/N*0.5**a

print(result)
# Judge status: Wrong Answer
s,t = input(), input()
a = 0
for i in range(len(s)):
    if s[i]==t[i]:
        a = a + 1
    else:
        a = a + 0
print(a)
# Judge status: Accepted
n = int(input())
a_list = list(map(int, input().split()))

def gcd(a,b):
    '''
    3 個以上の値の最大公約数を求めるためには、
    res = 0 と初期化
    各 i に対して res = GCD(res, x[i]) と更新する
    '''
    while b!=0:
        a,b = b,a%b
    return a

ans = gcd(a_list[0],a_list[1])
for i in range(1,n):
    ans = gcd(ans,a_list[i])

print(ans)
# Judge status: Wrong Answer
a,b,c = input().split()
if (a==b or b==c or c==a and not a==b==c): print("YES")
else: print("NO")
# Judge status: Accepted
n = int(input())
al = [int(input())-1 for _ in range(n)]
used = [False] *n
s = 0
res = 0
used[s] = True
while s != 1:
    s = al[s]
    if used[s]:
        print(-1)
        exit()
    used[s] = True
    res += 1
print(res)
# Judge status: Accepted
n,m,k = list(map(int,input().split(" ")))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
cnt = 0
ans = 0
j = m
t = sum(b)

for i in range(n+1):
    while j>0:
        if t>k: #aのみの場合の処理が足りない（常にjでスキップされてしまう）
            j -= 1
            t -= b[j]
        else:break
    if t<=k:ans = max(ans,i+j)
    if i==n:break
    t += a[i]
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n = int(input())
s = list(input())
ans = 0
for i in range(n - 1):
  idx = n - 2 - i
  if s[idx] == 'W' and s[idx + 1] == 'R':
    ans += 1
    s[idx] = 'R'
print(ans)
# Judge status: Accepted
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

n, x = map(int, input().split())
xx = list(map(int, input().split()))

a = [abs(x - i) for i in xx]

print(gcd(*a))
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())

rCnt = 0
ttla = 0
ttlb = 0

for ia in range(a):
  ttla = 500 * ia
  for ib in range(b):
    ttlb = 100 * ib
    for ic in range(c):
      if ttla + ttlb + 50 * ic:
        rCnt = rCnt + 1
# Judge status: Accepted
n=int(input())
cnt=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    cnt+=1
    if cnt==3:
      print("Yes")
      exit()
  else:
    cnt=0
print("No")
# Judge status: Accepted
a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a-2):
  if b[i]<b[i+1] and b[i+1]<b[i+2] or b[i]>b[i+1] and b[i+1]>b[i+2]:
    c+=1
print(c)
# Judge status: Wrong Answer
import numpy as np
INPUT = input().split()
H = int(INPUT[0])
N = int(INPUT[1])
A_list = np.array(list(input().split()), dtype="int" )
if np.sum(A_list) >= H:
  print("yes")
elif np.sum(A_list) < H:
  print("no")
# Judge status: Accepted
A, B, C = input().split()

if A == B and C!=A:
    print("Yes")
elif B==C and A!=B:
    print("Yes")    
elif A==C and B!=A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = input().split()
H1 = int(a[0])
M1 = int(a[1])
H2 = int(a[2])
M2 = int(a[3])
K = int(a[4])
time = (H2 * 60 + M2) - K
okiru = 60 * H1 + M1
print(time - okiru)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = sum(a)
for i in range(len(b)):
  if a[i]+a[i+1]<b[i]:
    a[i] = 0
    a[i+1] = 0
  elif a[i]<b[i]:
    a[i+1] = a[i]+a[i+1]-b[i]
    a[i] = 0
  else:
    a[i]-=b[i]
    
print(x-sum(a))
# Judge status: Accepted
stdin = input().split(" ")
A = int(stdin[0])
B = int(stdin[1])
T = int(stdin[2])
x = 1
sums = 0

print(int(((T+0.5)//A)*B))
# Judge status: Accepted
N,K,S=map(int,input().split())
if S==10**9:
    for i in range(K):
        print(S,"",end="")
    for i in range(K,N):
        print(1,"",end="")
    print()
else:
    for i in range(K):
        print(S,"",end="")
    for i in range(K,N):
        print(S+1,"",end="")
    print()
# Judge status: Accepted
N, K = map(int, input().split())
H_list = list(map(int, input().split()))

H_list.sort()

if K >= len(H_list):
  print(0)
  
else:
  for i in range(K):
    H_list[-i - 1] = 0

  print(sum(H_list))
# Judge status: Wrong Answer
*c, = map(input().count, "ABC")
print(["YES","NO"][max(c) > -~min(c)])