peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
cnt = 0
for _ in range(N):
    a, b = map(int, input().split())
    if a == b:
        cnt += 1
    else:
        cnt = 0
    
    if cnt == 3:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    S = input()

    first = int(S[:2])
    second = int(S[2:])

    if 0 < first <= 12 and 0 < second <= 12:
        print('AMBIGUOUS')
    elif 0 < first <= 12:
        print('MMYY')
    elif 0 < second <= 12:
        print('YYMM')
    else:
        print('NA')


if __name__ == "__main__":
    main()
# Judge status: Accepted
(_, _, M) = [int(inp) for inp in input().split()]

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

minA = min(A)
minB = min(B)

min = minA+minB

for m in range(0, M):
    (aindex, bindex, waribiki) = [int(inp) for inp in input().split()]
    newmin = A[aindex-1]+B[bindex-1] -waribiki
    if (newmin < min):
        min=newmin

print(min)
# Judge status: Accepted

n = int(input())
s = 0
for i in range(1,n+1):
    s +=  i * ( (n // i) * (n // i + 1) // 2 )


print(s)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ch=0

b=[0 for _ in range(8)]
for r in a:
  t=r//400
  if t>=8:
    ch+=1
  else:
    b[t]+=1
    
c=8-b.count(0)
print(str(max(1,c))+' '+str(c+ch))
# Judge status: Wrong Answer
k=int(input())
if k%2==0:
  ans=k**2
else:
  ans=k*(k+1)
# Judge status: Accepted
num = input().split()
num_i = [int(s) for s in num]

if(num_i[0] == num_i[1]):
    print('Draw')
    
elif(num_i[0] != 1 and num_i[1] != 1):
    if(num_i[0] > num_i[1]):
        print('Alice')
    else:
        print('Bob')

else:
    if(num_i[0] == 1):
        print('Alice')
    else:
        print('Bob')
# Judge status: Accepted
N, D = map(int, input().split())
XY = [[] for _ in range(N)]
X = [0] * N
Y = [0] * N
for i in range(N):
    XY[i] = list(map(int, input().split()))
    X[i] = XY[i][0]
    Y[i] = XY[i][1]

ans = 0
for i in range(N):
    if (X[i]**2 + Y[i]**2) ** 0.5 <= D:
        ans += 1
print(ans)
# Judge status: Accepted
s = str(input())
year = ""
for i in range(0,4):
    year += s[i]
year = int(year)
if(s[5] == 0):
    mon = int(s[6])
else:
    mon = int(s[5] + s[6])
if(year >= 2019):
    if(year >= 2020):
        print("TBD")
    elif(mon >= 5):
        print("TBD")
    else:
        print("Heisei")
else:
    print("Heisei")
# Judge status: Accepted
def main():
    n,k=map(int,input().split())
    d=set(map(str,input().split()))

    while True:
        s=set(str(n))
        flag=True
        for i in s:
            if i in d:
                flag=False
                break
        if flag:
            break
        else:
            n+=1       
    print(n)               
if __name__=='__main__':
    main()
# Judge status: Wrong Answer
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

x,y = iim()
xabs = abs(x)
yabs = abs(y)

if y>=x:
    if x*y>=0:
        ans = y-x
    else:
        ans = y-abs(x)+1
else:
    if x*y>0:
        ans = x-y+2
    else:
        ans = abs(y)-x+1
print(ans)
# Judge status: Wrong Answer
n = int(input())
toshi = []
for i in range(5):
    toshi.append(int(input()))
#ここまで入力
mn = min(toshi)
ans = n//mn+5
print(ans)
# Judge status: Wrong Answer
import math
import sys
MOD = 1000000007

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

if n == 1:
    print(m)
    sys.exit()

ans = 1
for i in range(1, int(math.sqrt(m))+1):
    if i > m/n:
        break
    if m % i == 0:
        ans = i

print(ans)
# Judge status: Wrong Answer
a, b, c = map(int,input().split())
print(min(a,b+c))
# Judge status: Accepted
import sys
S = input()
K = int(input())

k=0
for s in S:
  s = int(s)
  k += 1
  if not s == 1:
    print(s)
    sys.exit()
  elif k == K:
    print(1)
    sys.exit()
# Judge status: Wrong Answer
N = int(input())
a = 1/2*N*(N+1)
print(a)
# Judge status: Accepted
aa, bb = open(0).read().splitlines()

aa = sorted(aa)

bb = sorted(bb, reverse=True)

import sys
for a, b in zip(aa, bb):
    if a == b:
        continue
    else:
        if a<b:
            print('Yes')
            sys.exit()
        else:
            print('No')
            sys.exit()
        break
if len(aa)<len(bb):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
n = len(s)
ans = 0
for i in range(n//2):
    if s[i] != s[n-i-1]:
        ans += 1
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
 
if b * c >= a:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A=int(input())
B=int(input())
C=int(input())
X=int(input())

count = 0
for a in range(min([A,X//500])):
  for b in range(min([B,(X-500*A)//100])):
    if (X-500*b-100*b) % 50 == 0:
      count = count + 1

print(count)
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]

def flag(l,r):
    return 1 if [a for a in A if l <= a <= r] else 0

ans = 0
for l in range(0,2801, 400):
    ans += flag(l, l + 399)

ans1 = ans + len([a for a in A if a >= 3200])
if ans == 0:
    print(1,ans1)
else:
    print(ans,ans1)
# Judge status: Accepted
a, b = map(int, input().split())

for i in range(1, 1001):
  if a <= i*0.08 < a+1:
    if b <= i*0.1 < b+1:
      print(i)
      exit(0)
      
print(-1)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
a = h[0]
m = 0
ans = 0
for i in range(1,n):
    if a >= h[i]:
        m += 1
    else:
        ans = max(ans,m)
        m = 0
    a = h[i]
print(max(ans,m))
# Judge status: Wrong Answer
import math
N = int(input())
A = sorted(list(map(int,input().split())))

B = A[1:]

if len(A) == 2:
    print(max(A))
else:
    c = []
    for b in B:
        c.append(math.gcd(b,A[0]))
    cd = sorted(c)[1]

    d = []
    for i in range(1,len(A)):
        d.append(math.gcd(A[i],A[1]))
    dd = min(d)
    print(max(cd,dd))
# Judge status: Accepted
a=input()
if a in "abcdefghijklmnopqrstuvwxyz":
  print("a")
else:
  print("A")
# Judge status: Accepted
N=int(input())

a={}
c=0
while N%2==0:
  N//=2
  c+=1
if c!=0:
  a[2]=c

f,c=3,0
while f*f<=N:
  if N%f==0:
    N//=f
    c+=1
    a[f]=c
  else:
    f+=2
    c=0
if N!=1:
  if N in a:
    a[N]+=1
  else:
    a[N]=1

t=0
for v in a.values():
  i=1
  while v>=i:
    t+=1
    v-=i
    i+=1

print(t)
# Judge status: Accepted
n = int(input())
N = list(map(int, input().split()))
ans=1
N.sort()
for i in range(n) :
    ans *= N[i]
    if ans > 10**18 :
        ans = -1
        break
print( ans )
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
li = []
for i in range(n):
  li.append(abs(sum(w[0:i]) - sum(w[i:])))
print(min(li))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
Alice = 0
Bob = 0

for i in range(0, N, 2):
    Alice += a[i]

Bob = sum(a) - Alice
ans = Alice - Bob

print(ans)
# Judge status: Wrong Answer
N = int(input())
v = sorted(map(int,input().split()))
value = v[0]
for i in range(1,N):
  value=(value+v[i])/2
  print(value)
print(value)
# Judge status: Accepted
n, h = map(int, input().split())
AB = [(list(map(int, input().split()))) for _ in range(n)]

A = []
B = []
for a, b in AB:
    A.append(a)
    B.append(b)

max_A = max(A)
C = sorted([b for b in B if b >= max_A], reverse=True)

cnt = 0
for c in C:
    h -= c
    cnt += 1
    if h <= 0:
        print(cnt)
        exit()

atack = h // max_A
cnt += atack
h -= atack * max_A
if h <= 0:
    print(cnt)
else:
    print(cnt+1)
# Judge status: Accepted
import numpy as np

N, M, X = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]

cost = float("inf")
for i in range(2**N):
  tmp = np.array([0 for _ in range(M+1)])
  for j in range(N):
    if (i>>j) & 1:
      tmp += np.array(C[j])
  if min(tmp[1:]) >= X:
    cost = min(cost, tmp[0])

print(-1 if cost == float("inf") else cost)
# Judge status: Accepted
n ,m = map(int, input().split())
L = []
R = []
for i in range(m):
    l, r = input().split()
    L.append(int(l))
    R.append(int(r))
x = min(R) - max(L) + 1
print(x if x > 0 else "0")
# Judge status: Wrong Answer
import fractions
 
def lcm(a,b):
  return (a*b)//fractions.gcd(a,b)
 
N=int(input())
T=1
for i in range(T):
  T=lcm(T,int(input()))
print(T)
# Judge status: Accepted
n = int(input())
numbers = list(map(int, input().split()))
count = 0
next_number = 1
if 1 in numbers :
    for i in range(len(numbers)):
        if numbers[i] != next_number:
            count += 1
        else:
            next_number += 1
    print(count)
else:
    print(-1)
# Judge status: Accepted
#!/usr/bin/env python3

A, B = list(map(int, input().split()))
x = -1
for i in range(1, 10000):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        x = i
        break

ans = x
print(ans)
# Judge status: Accepted
k , x = map(int, input().split())
'''
a = [ x , x+1 , x-1 , x+2 , x-2 ]
print(sorted(a))
'''
'''
for i in range(2*k-1):
  print(x-k+1 + i)
'''

for i in range(x-k+1,x+k):
    print(i,end=" ")

'''
for i in range(-3,10):
    print(i,end=" ")
'''
# Judge status: Accepted
N, R = map(int, input().split())

if N >= 10:
    print(R)
else:
    rev = 100 * (10 - N)
    print(R + rev)
# Judge status: Accepted
from fractions import gcd

P = int(1e9)+7
n = int(input())

def lcm(p,q):
    return p*q//gcd(p,q)

a = list(map(int, input().split()))
x = a[0]
for i in range(1,n):
    x = lcm(x,a[i])
ans = 0
for i in range(n):
    ans += x//a[i]
ans = ans%P
print(ans)
# Judge status: Wrong Answer
n ,x , y = map(int,input().split())
x = x -1
y = y -1
ans = [0] * n
for i in range(n):
    for j in range(i+1,n):
        d = min(j -i, abs(i-x) + (j-y)+1)
        ans[d] +=1
print(*ans[1:],sep = '\n')
# Judge status: Accepted
import math
N, X, T = map(int, input().split())

ans = math.ceil(N/X)*T

print(ans)
# Judge status: Wrong Answer
n = int(input())
for i in range(1, 10):
    if n % i == 0 and n // i < 10:
        print('yes')
        break
print('No')
# Judge status: Wrong Answer
a = int(input())
sum = 0
for i in range(a):
    sum += a ** (i+1)
    if i == 2:
        break
print(int(sum))
# Judge status: Wrong Answer
S = list(input())
print("Yes" if "S" in S == "N" in S and "E" in S == "W" in S else "No")
# Judge status: Accepted
import math

X = int(input())
year = 0
amount = 100
while True:
  if amount >= X:
    break
  amount += math.floor(amount//100)
  year += 1
print(year)
# Judge status: Accepted
k = int(input())
nums = set()


def rec(past: int, num: int):
    nums.add(num)
    if num > 10**10:
        return
    if past > 0:
        rec(past - 1, num * 10 + past - 1)
    rec(past, num * 10 + past)
    if past < 9:
        rec(past + 1, num * 10 + past + 1)


for i in range(1, 10):
    rec(i, i)
ans = sorted(nums)
print(ans[k - 1])
# Judge status: Accepted
import math
A,B,H,M = map(int,input().split())

tmp = M * 0.5
if H == 0:
    H = 12
if M == 0:
    M = 60

h = H*30
m = (M/5)*30

if h >= m:
    rad = (h+tmp)-(m)
else:
    rad = (m)-(h+tmp)

ans = A**2 + B**2 - 2*A*B*(math.cos(math.radians(rad)))
print(ans**0.5)
# Judge status: Accepted
from collections import Counter

N = int(input())
S = input()
c = Counter(S)
MOD = 10**9 + 7
# print('c', c)

ans = 1
for v in c.values():
    ans *= v + 1
    ans %= MOD
ans -= 1
ans %= MOD
print(ans)
# 4C4 = 1
# 4C3 = 4
# 4C2 = 6
# 4C1 = 4

# b
#  a
#   a
# ba
# b a
# Judge status: Accepted
import math
N=int(input())
print(int(math.sqrt(N))**2)
# Judge status: Wrong Answer
N, R = map(int, input().split())
print(R + 100 * (10 - N))
# Judge status: Accepted
Sp=list(input())
Tp=list(input())
L=len(Sp)
K=len(Tp)
for i in reversed(range(L-K+1)):
  for j in range(K):
    a=Sp[i+j]
    b=Tp[j]
    if a!='?' and a!=b:
      break
  else:
    for j in range(K):
      Sp[i+j]=Tp[j]
    break
else:
  print('UNRESTORABLE')
  exit()
for i in range(L):
  if Sp[i]=='?':
    Sp[i]='a'
print(''.join(Sp))
# Judge status: Accepted
a,b,c = map(int,input().split())
k = int(input())
print(max(a,b,c)*2**k+a+b+c-max(a,b,c))
# Judge status: Accepted
d= int(input())

if d==22:
    print('Christmas Eve Eve Eve')
elif d==23:
    print('Christmas Eve Eve')
elif d==24:
    print('Christmas Eve')
else:
    print('Christmas')
# Judge status: Accepted
a,b = map(int, input().split())

if a <= 8 and b <= 8:
    print('Yay!')

else:
    print(':(')
# Judge status: Accepted
def inp():return map(int,input().split())
a,b,c=inp()

c=c-(a-b)
print(max(0,c))
# Judge status: Wrong Answer
n=int(input())
num=[]
a=input().split(" ")
ans=[]
for i in range(n):
    num.append(int(a[i]))
for i in range(n):
    count=0
    if i==0:
        ans.append(a[i])
    else:
        for j in range(0,i):
            if a[i]>a[j]:
                count+=1
                break
        if count==0:
            ans.append(a[i])
print(len(ans))
# Judge status: Accepted
s, c = map(int, input().split())

if 2*s >= c:
    print(c // 2)
    exit()
g = s
c -= s * 2
print(g + c//4)
# Judge status: Accepted
N=int(input())

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

for i in range(N):
	for j in range(i+1, N):
		for k in range(j+1, N):
			m = max(max(L[i], L[j]), L[k])
			if m < L[i]+L[j]+L[k]-m and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
				ans+=1
				
print(ans)
# Judge status: Accepted
n = int(input())
ls = [list(map(int, input().split())) for i in range(n)]
ls1=list()
ls2=list()
for i in range(n):
    ls1.append(ls[i][0])
    ls2.append(ls[i][1])
ls1.sort()
ls2.sort()

if n%2:
    print(ls2[n//2]-ls1[n//2]+1)
else:
    a=ls2[n//2-1]+ls2[n//2]
    b=ls1[n//2-1]+ls1[n//2]
    print(a-b+1)
# Judge status: Accepted
coffee = "coffee"
input_str = input()

if input_str[2] == input_str[3] and input_str[4] == input_str[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    N, P = (int(i) for i in input().split())
    A = [int(i) % 2 for i in input().split()]
    from collections import Counter
    c = Counter(A)
    odd = 2**(c[1]-1) if c[1] > 0 else 0
    even = 2**c[0]
    if 0 < odd:
        even *= odd
    print(odd*2**c[0] if P == 1 else even)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = input()
n = len(N)
if N == "9"*n:
  ans = 9*n
else:
  ans = int(N[0])-1 + 9*(n-1)
print(ans)
# Judge status: Accepted
x, a, b = map(int,input().split())
if abs(x-a) > abs(x-b):
    print('B')
else:
    print('A')
# Judge status: Accepted
def main():
    N = int(input())
    a = [int(input()) for _ in range(N)]
    i = 1
    ans = 0

    for K in range(N):
        i = a[i-1]
        ans += 1
        if i == 2:
            return ans
    ans = -1
    return ans

print(main())
# Judge status: Accepted
s = input()
print(s[0] + s[8] + s[-7])
# Judge status: Wrong Answer
N = int(input())
A = [int(i) for i in input().split(" ")]
Min = 10**9
L = 0
R = sum(A)
for i in range(0,len(A)-1):
    L+=A[i]
    R-=A[i]
    diff = abs(L - R)
    if diff < Min:
        Min = diff
print(Min)
# Judge status: Accepted
X,Y,Z = map(int,input().split())

print(X*Y//2)
# Judge status: Accepted
N = int(input())

MAX_N = 10000000

Y = []
for j in range(1,N+1):
  Y.append(N//j)

ans = 0
for j in range(1,N+1):
  ans += (j)*Y[j-1]*(Y[j-1]+1)//2


print(ans)
# Judge status: Accepted
D,T,S = map(int, input().split())
if D<=T*S:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#def main(S, b):
if __name__ == '__main__':
    k, n = map(int, input().split())

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

    for i in range(n):
        A.append(A[i] + k)

    #print(A)
    ans = 10000000000
    for i in range(n):
        #print(ans, A[i + n - 1], A[i])
        if (ans > A[i + n - 1] - A[i]):
            ans = A[i + n - 1] - A[i]

    print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
B=list()
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    B.extend(A)
B=set(B)
print(N-len(B))
# Judge status: Accepted
N, K = map(int, input().split())
X = sorted(list(map(int, input().split())))
cnt = []

for i in range(N - K + 1):
    left = X[i]
    right = X[i+K-1]
    cnt.append(min(abs(right)+abs(left-right), abs(left) + abs(right - left)))
print(min(cnt))
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = input()

cnt = 0
happy = 0
for i in range(n-1):
    if s[i:i+2] == 'RL':
        cnt += 1
    elif s[i] == s[i+1]:
        happy += 1
happy += 2 * min(cnt, k)
if k - cnt > 0 and s[0] != s[-1]:
    happy += 1
print(happy)
# Judge status: Accepted
a,b,c,d=map(int,input().split());print("Yes"if abs(a-c)<=d or (abs(a-b)<= d and abs(b-c)<= d) else "No")
# Judge status: Accepted
n = int(input())
flag = 0

for i in range(26):
  for j in range(15):
    if 4*i + 7*j == n:
      print('Yes')
      flag = 1
  if flag == 1:
    break
    
    
if flag == 0:
  print('No')
# Judge status: Accepted
N = input()
if (int(N) <= 999):
    print("ABC")
else:
    print("ABD")
# Judge status: Wrong Answer
s = input()
s = sorted(s)

if s == 'abc':
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a, b = map(int, input().split())
if a < 10 and b < 10:
  print(a * b)
else:
  print(-1)
# Judge status: Wrong Answer
n,k,s=map(int,input().split())
ans=[str(s)]*k+[str(10**10)]
print(" ".join(ans))
# Judge status: Accepted
n = int(input())
 
_sum = 0
_tmp = 0
while _sum <= n:
    _tmp += 1
    _sum += _tmp
    if _sum >= n:
        break
 
ans = []
while n:
    if n - _tmp < 0:
        _tmp -= 1
    else:
        ans.append(_tmp)
        n -= _tmp
        _tmp -= 1
 
for i in ans:
    print(i)
# Judge status: Accepted
INF = 1000000000
N, K = list(map(int, input().split()))
items = list(map(int, input().split()))

mi = INF

for l_index in range(N-K+1):
  left = items[l_index]
  right = items[l_index+K-1]

  if right <= 0:
    mi = min(mi, 0-left)
  elif left >= 0:
    mi = min(mi, right)
  else:
    min_l = min(0-left, right)
    mi = min(mi, (0-left) + right + min_l)

print(mi)
# Judge status: Wrong Answer
N = int(input())
h = list(map(int, input().split()))

ans = [100000000] * N
ans[0] = 0
for i in range(N-1):
    ans[i+1] = min(ans[i+1], ans[i] + abs(h[i] - h[i+1]))
    if i  < N - 2:
        ans[i+2] = min(ans[i+2], ans[i] + abs(h[i] - h[i+2]))
print(ans[-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)[::-1]
ans = 2 * sum(a[1:n // 2]) + a[0]
if n % 2 == 1:
    ans += a[n // 2]

print(ans)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
array = [A,B,C]
array.sort()
print(array[0]*array[1]/2)
# Judge status: Accepted
# coding: utf-8

import math

n = int(input())
n_max = 46298

for i in range(1, n_max):
    x = math.floor(i * 1.08)
    if x == n:
        print(i)
        exit()

print(':(')
# Judge status: Accepted
p, q, r = map(int, input().split())
print(min(p+q, q+r, r+p))
# Judge status: Accepted
# -*- coding: utf-8 -*-

d = int(input())
if d==25:
    print("Christmas")
elif d==24:
    print("Christmas Eve")
elif d==23:
    print("Christmas Eve Eve")
elif d==22:
    print("Christmas Eve Eve Eve")
# Judge status: Accepted
# coding = SJIS

w, h, x, y = map(int, input().split())

area = w * h
ans = area / 2
ok = 0

if x == w / 2 and y == h / 2:
    ok = 1

print(ans, ok)
# Judge status: Accepted
import math
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

indp = 1
indq = 1

# pの辞書式順列番号
for i in range(n):
  c = 1
  for j in p[:i]:
    if (j < p[i]):
      c += 1
  indp += math.factorial((n-1)-i) * (p[i]-c)

# qの辞書式順列番号
for i in range(n):
  c = 1
  for j in q[:i]:
    if (j < q[i]):
      c += 1
  indq += math.factorial((n-1)-i) * (q[i]-c)

print(abs(indp-indq))
# Judge status: Wrong Answer
S = input()
print('2017' + S[4:])
# Judge status: Accepted
S=input()
p=1
head=""
tail=""
Q=int(input())
for _ in range(Q):
  q=input()
  if q=='1':
    p^=1
  else:
    a,f,c=q.split()
    f=int(f)%2
    if p==0:
      f=(f+1)%2
    if f:
      head+=c
    else:
      tail+=c
if p:
  S=head[::-1]+S+tail
else:
  S=tail[::-1]+S[::-1]+head
print(S)
# Judge status: Accepted
import re
S = input()
if re.match("^(dream|dreamer|erase|eraser)+$", S):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
s = input()
n = len(s)

ans = int(s[0]) + 9 * (n - 1)

if n != 1:
  if s[1:] != '9' * (n-1):
    ans -= 1

print(ans)
# Judge status: Wrong Answer
import numpy as np
a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(max(x1,x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+1)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
lis.append(a//lis[-1])
lis.append(b//lis[-1])
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
print(len(s))
# Judge status: Wrong Answer
N = int(input())
count = 0

for a in range(1, N+1):
  tmp = (N-1) // a
  if a < (N-1) // 2:
    count += tmp
  else:
    count += 1          

print(count)
# Judge status: Accepted
import numpy as np
N = int(input())
a=0
list1 = np.array([0] * N)
list2 = np.array([0] * N)
ans = np.array([[0] * 10 for i in range(10)])
for i in range(N):
    s=str(i+1)
    list1[i]=int(s[-len(s)])
    list2[i]=(i+1)%10

for i in range(N):
    ans[list1[i]][list2[i]]+=1

for i in range(10):
    for j in range(10):
        a+=ans[i][j]*ans[j][i]

print(a)
# Judge status: Accepted
N = int(input())
a = list(map(int,(input().split())))
n1,n2,n4 = 0,0,0
for i in range(N):
    if a[i]%2 != 0:
        n1 += 1
    elif a[i]%4 == 2:
        n2 += 1
    else:
        n4 += 1

if n4*2 + 1 >= N:
    print("Yes")
else:
    if n4*2 + n2 >= N:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
import sys
readline = sys.stdin.readline

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

# Mの約数Pのうち、M // P >= Nとなるものの最大値

ans = 0
for i in range(1,int(M ** 0.5) + 1):
  if M % i == 0:
    p = M // i
    if i >= N:
      if ans < p:
        ans = p
    if p >= N:
      if ans < i:
        ans = i

print(ans)
# Judge status: Accepted
n = list(map(int, input()))

if (n[0]==n[1] and n[1]==n[2]) or (n[1]==n[2] and n[2]==n[3]):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,m,x = map(int,input().split())
ca = [0]*n
for i in range(n):
    ca[i] = list(map(int,input().split()))
ans = 10**10
for i in range(n**2):
    s = [0]*m
    c = 0
    for j in range(n):
        if (i>>j)&1:
            c += ca[j][0]
            for k in range(1,m+1):
                s[k-1] += ca[j][k]
    s = sorted(s)
    if s[0] >= x:
        ans = min(ans,c)
if ans == 10**10:
    print(-1)
else:
    print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
l = {}
for i in a:
    if i in l:
        l[i] += 1
    else:
        l[i] = 1
ans = 0
for i in l.keys():
    if i <= l[i]:
        ans += l[i]-i
    else:
        ans += l[i]
print(ans)
# Judge status: Accepted
abc = list(map(int, input().split()))
a, b, c = sorted(abc)
cou = c - b
if (b-a) % 2 == 0:
    cou += (b-a)//2
else:
    cou += (b-a)//2 + 2
print(cou)
# Judge status: Accepted
N, Y = map(int, input().split())

for x in range(N + 1):
    for y in range(N + 1 - x):
        z = N - x - y
        if 10000 * x + 5000 * y + 1000 * z == Y:
            print(x, y, z)
            exit()

print("-1 -1 -1")
# Judge status: Accepted
from math import sqrt, floor

N = int(input())

for i in range(1, floor(sqrt(N))+1)[::-1]:
    if N % i == 0:
        print(i+N//i-2)
        exit()
# Judge status: Accepted

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

for i in range(a, a + k):
    if i > b:
        break
    print(i)
for i in range(max(a + k, b - k + 1), b + 1):
    if i > b:
        break
    print(i)
# Judge status: Wrong Answer
A, B = map(int, input().split())
if A == B:
    print("Draw")
elif A == 1:
    print("Alice")
elif B == 1:
    print("Bod")
elif A > B:
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
S = str(input())
if S == 'Sunny':
  my_result = 'Cloudy'
elif S == 'Cloudy':
  my_result = 'Rainy'
else:
  my_result = 'Sunny'
print(my_result)
# Judge status: Accepted
a, b , c, x, y = map(int, input().split())

s = set()
s.add(a*x + b*y)
if x < y:
    s.add(2*x*c + b*(y-x))
    s.add(2*(x+1)*c + b*(y-x-1))
    s.add(2*y*c)
    print(min(s))
else:
    s.add(2*y*c + a*(x-y))
    s.add(2*(y+1)*c + a*(x-y-1))
    s.add(2*x*c)
    print(min(s))