peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

a,b,c = inm()
k = inn()
x = 0
while b<=a:
  b *= 2
  x += 1
while c<=b:
  c *= 2
  x += 1
print('Yes' if x<=k else 'No')
# Judge status: Accepted
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]

last=[0]*26


for d in range(1,D+1):
    ans=[]
    for choice in range(1,27):
        ans_tmp=0
        ans_tmp+=s[d-1][choice-1]
        for i in range(26):
            if i+1==choice:
                continue
            ans_tmp-=c[i]*(d-last[i])*10
        ans.append((ans_tmp,choice))
    _,case=max(ans)
    last[case-1]=d
    print(case)
# Judge status: Accepted
N, M = map(int, input().split())

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

A_sum = 0
for i in A:
    A_sum += i

A.sort(reverse = True)

YN = True
for i in range(M):
    if A[i] < A_sum / (4 * M):
        YN = False
        break

if YN == True:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a_L = map(int,input().split())

a_L = list(sorted(a_L))

diff1 = a_L[2]-a_L[1]
diff2 = a_L[2]-a_L[1]


if (diff1+diff2) % 2 == 0:
    print((diff1+diff2)//2)
else:
    print((diff1+diff2+3)//2)
# Judge status: Accepted
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
x = make_divisors(n)

if len(x)%2 == 0:
    print(x[len(x)//2]+x[(len(x)//2)-1]-2)
else:
    print((x[(len(x)//2)]*2)-2)
# Judge status: Accepted
N, R = [int(i) for i in input().split()]

if N >= 10:
    print(R)
else:
    print(R + 100 * (10 - N))
# Judge status: Accepted
s = str(input())
n = len(s)
for i in range(n):
    for j in range(i, n):
        t = s[0:i]+s[j:]
        if t == 'keyence':
            print('YES')
            exit()
else:
    print('NO')
# Judge status: Wrong Answer
W, H, x, y = map(int, input().split(' '))

x1 = x
x2 = W - x

y1 = y
y2 = H - y

r1 = x1 * H
r2 = x2 * H
r3 = y1 * W
r4 = y2 * W

r12 = min(r1, r2)
r34 = min(r3, r4)

n = 0
if r12 == r34:
    n = 1

print(max(r12, r34), n)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
mod=set()
tmp=0
D=A
while tmp not in mod:
    mod.add(tmp)
    tmp=D%B
    if tmp==C:
        print('Yes')
        exit()
    D+=A
print('No')
# Judge status: Accepted
n = int(input())
cnt = 0
ok = False
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        cnt += 1
        if cnt >= 3:
            ok = True
    else:
        cnt = 0
print('Yes' if ok else 'No')
# Judge status: Wrong Answer
N,X,Y = map(int, input().split())
D = [0] * N
for i in range(1,N):
  for j in range(i+1,N+1):
    D[min(abs(i-j),abs(X-i)+abs(Y-j)+1)] += 1 
print (D[1:], sep="\n")
# Judge status: Accepted
X = int(input())

q,mod = divmod(X,100) 
#100*q<=X<=(100+5)*q
#0<=mod_x<=5q :1

if 5*q>=mod and mod>=0:
  print(1)
else:
  print(0)
# Judge status: Wrong Answer
K, N = list(map(int, input().split()))
A = list(map(int, input().split())) + [K]


B = []
for i in range(N):
    B.append(A[i+1] - A[i])

B = sorted(B,reverse = False)

print(sum(B[:N-1]))
# Judge status: Accepted
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
  for y in range(k+1):
    z = s-x-y
    ans += (0 <= z <= k)
print(ans)
# Judge status: Accepted
S = input()
print('2018' + S[4:])
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = []
for _ in range(N):
  Ai,Bi = map(int,input().split())
  A.append([Ai,Bi])
A.sort(key=lambda x: x[0],reverse=True)  
k = A[N-1][0]
A.sort(key=lambda x: x[1],reverse=True)

sum_pay = 0
checked = [1]*N
j=0
for i in range(M-k+1):
  while A[j][0] > M-i or checked[j] == 0:
    if j == N-1:
      break  
    j += 1
  if A[j][0] <= M-i:
    sum_pay += A[j][1]
    checked[j] = 0
    j = 0
print(sum_pay)
# Judge status: Wrong Answer
S = input()
T = input()

tbl = {}
for s,t in zip(S,T):
    if t not in tbl:
        tbl[t] = s
    if tbl[t] != s:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n>=k:
  print(k*x+(n-k)*y)
else:
  print(k*x)
# Judge status: Wrong Answer

n=int(input())
ans=0
v=list(map(int,input().split()))
v.sort()

if n>2:
    for i in range(2,n):
        ans=(v[0]+v[1])*(2**(-n+1))+v[i]*(2**(-n+i))
else:
    ans=(v[0]+v[1])*(2**(-n+1))

if ans-int(ans)==0:
    print(int(ans))
else:
    print(ans)
# Judge status: Accepted
i = input()
if i[-1] in ["2","4","5","7","9"]:
	print("hon")
elif i[-1] in ["0","1","6","8"]:
	print("pon")
elif i[-1] == "3":
	print("bon")
# Judge status: Wrong Answer
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))
# Judge status: Accepted
x = list(map(int,input().split()))
count=0
for a in range(max(0,x[1]-2*x[0]),min(x[0],x[1])+1):
    for b in range(max(0,x[1]-a-x[0]),min(x[0],x[1]-a)+1):
        for c in range(max(x[1]-a-b,0),min(x[1]-a-b,x[0])+1):
            if(a+b+c==x[1]):
                count+=1
print(count)
# Judge status: Accepted
#!/usr/bin/env python3
n, k = map(int, input().split())
# 選ぶ数が違う時絶対に違う
# 1..N の中で和が同じにならない組み合わせを引いたらいい
# 解説AC  k ... n+1 について最大、最小をとってその間は全部作れる
ans = 0
mod = 10 ** 9 + 7
for i in range(k, n + 2):
    mi = (i - 1) * i // 2
    ma = (2 * n - i + 1) * i // 2
    # print(i, (ma - mi + 1))
    ans += (ma - mi + 1) % mod
print(ans % mod)
# Judge status: Accepted
n=int(input())
if n==7 or n==5 or n==3:
  print('YES')
else:
  print("NO")
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print(C if B // A > C else C)
# Judge status: Accepted
n = int(input())
mod = 10**9  + 7
if n <= 2:
    print((n-1)*2)
else:
    print((10**n - 9**n - 9**n + 8**n)%mod)
# Judge status: Accepted
"""
aを10^3くらいまででいいよね
"""
# print(19**5-10**5)
x = int(input())
# a>0 b>0のとき
for i in range(10**3):
    for j in range(i+1,10**3):
        if j ** 5 - i ** 5 == x:
            print(j,i)
            exit()
# a>0, b<0のとき
for i in range(10**3):
    for j in range(10**3):
        if i**5 + j**5 == x:
            print(i,-j)
            exit()
# Judge status: Wrong Answer
import collections
from scipy.misc import comb
n = int(input())
s = [''.join(sorted(input())) for i in range(n)]

c = 0
r = collections.Counter(s)
for k, v in r.items():
    if v > 1:
        c += comb(v, 2)

print(int(c))
# Judge status: Wrong Answer
a, b, c = input().split()
k = int(input())

for _ in range(k):
  if int(a) > int(b):
    b = int(b) * 2
  else:
    c = int(c) * 2
    
if int(a) < int(b) and int(b) < int(c):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,a,b=map(int,input().split())
print((n//(a+b))*a+min(n%(a+b),a))
# Judge status: Accepted
import itertools
import numpy as np

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

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,N))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans,res=0,0
for i in range(n):
    ans+=a[i]
    res=a[i]
    if ans>sum(a)-ans:
        break
if ans==res:
    print(abs(ans-(sum(a)-ans)))
else:
    print(min(abs(ans-(sum(a)-ans)),abs(ans-res-(sum(a)-(ans-res)))))
# Judge status: Accepted
a, b, c = map(int, input().split())
L = []
L.append(a)
L.append(b)
L.append(c)

L = list(set(L))

print(len(L))
# Judge status: Accepted
n = input()
if n[:-1].count(n[0]) == 3 or n[1:].count(n[3]) == 3:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
import sys
S=input()
T=input()

for i in range(len(S)):
    S=S[-1]+S[:-1]
    if T==S:
        print('Yes')
        sys.exit()

print('No')
# Judge status: Accepted
L,R=map(int,input().split())
a=2020
for i in range(L,min(R, L+2020)):
    for j in range(i+1, min(R+1, L+2020)):
        a=min(a, (i%2019*j%2019)%2019)
print(a)
# Judge status: Accepted
input_line = list(map(int, input().split()))
input_line.sort()

print("YES" if input_line == [5, 5, 7] else "NO")
# Judge status: Accepted
import math
 
def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            tmp = math.gcd(i,j)
            for k in range(1,n+1):
                ans += math.gcd(tmp,k)
 
    print(ans)
 
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,m = list(map(int,input().strip().split()))
p = 10**9+7

result = 1
for i in range(1,n+1):
  result *= i % p
for j in range(1,m+1):
  result *= j % p
  
if n == m:
  result *= 2 % p

print(result)
# Judge status: Accepted
N = int(input())
arm = [list(map(int, input().split())) for _ in range(N)]
dist = [[0 for _ in range(3)] for _ in range(N)]

for i in range(N):
  dist[i][0] = arm[i][0] + arm[i][1]
  dist[i][1] = arm[i][0]
  dist[i][2] = arm[i][1]

dist.sort()

ans = 1
left = dist[0][1] + dist[0][2]
for i in range(1, N):
  if left <= dist[i][1] - dist[i][2]:
    ans += 1
    left = dist[i][1] + dist[i][2]

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
l = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x:x[1], reverse=True)

res = 0
pos_1 = 0
pos_2 = 0
for _ in range(n):
    if pos_2 == m or a[pos_1] > l[pos_2][1]:
        res += a[pos_1]
        pos_1 += 1
    else:
        res += l[pos_2][1]
        l[pos_2][0] -= 1
        if l[pos_2][0] == 0:
            pos_2 += 1

print(res)
# Judge status: Accepted
def func(n):
  if n % 2 == 0:
    return n / 2
  else:
    return 3*n + 1

s = int(input())
ans = [s]
while True:
  s = func(s)
  if s in ans:
    ans.append(s)
    print(len(ans))
    break
  ans.append(s)
# Judge status: Wrong Answer
from math import log2

def main():
    N = int(input())
    if N == 0:
        print(0)
        return
    K = int(log2(abs(N))) + 1
    Ans = []
    for _ in range(K):
        r = N%2
        Ans.append(r)
        N = -1*( N // 2)
    print(*Ans[::-1],sep="")
    return

if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
ac=Counter(a)
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  ans=ans+(c-b)*ac[b]
  ac[c]+=(ac[b])
  ac[b]=0
  print(ans)
# Judge status: Accepted
def main():
    a = int(input())
    s = input()

    if a >= 3200:
        print(s)
    else:
        print("red")


if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
for i in range(N,999+1):
  if i%111==0:
    print(i)
    exit()
# Judge status: Wrong Answer
def main():
    d, n = map(int, input().split())
    div = 100**d
    ans = div*n
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v-w==0 or w>v:
    print("NO")
    quit()
if abs(a-b)/(v-w)>t:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
n, m = map(int,input().split())
h_l = list(map(int,input().split()))
ab = []
for _ in range(m):
    ab.append(list(map(int,input().split())))

good = [1]*n
for a, b in ab:
    h1 = h_l[a-1]
    h2 = h_l[b-1]
    if h1 > h2:
        good[b-1] = 0
    elif h1 < h2:
        good[a-1] = 0
    else:
        good[a-1] = 0
        good[b-1] = 0

ans = 0
for val in good:
    ans += val

print(ans)
# Judge status: Wrong Answer
n = input()
(p,q) = n.split()
print(p+q)
# Judge status: Accepted
import sys
import math
h, w = map(int, sys.stdin.readline().split())

ans = math.ceil(h*w/2) if h != 1 and w != 1 else 1
print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    t,a=map(int, input().split())
    h=list(map(int,input().split()))
    tempabs=[abs(a-(t-i*0.006)) for i in h]
    minabs=min(tempabs)
    print(tempabs.index(minabs)+1)
resolve()
# Judge status: Wrong Answer
#!/usr/bin/env python3

K = int(input())

if K % 2 == 0:
    print((K//2)**2)
else:
    print(((K-1)/2)*((K-1)/2 + 1))
# Judge status: Accepted
S=input()
N=len(S)
def is_kaibun(a,b):#ind a~b
    for i in range(a,b+1):
        if i>=b-i:
            break
        if S[i]!=S[b-i]:
            return False
    return True
if is_kaibun(0,(N-3)//2) and is_kaibun((N+1)//2,N-1) and is_kaibun(0,N-1):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]
for i in range(D):
    print(s[i].index(max(s[i]))+1)
# Judge status: Accepted
n = 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: Accepted
import sys

S = list(sys.stdin.readline().strip())
S.sort()
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
src = []
src.append(list(map(int, input().split())))
src.append(list(map(int, input().split())))
src.append(list(map(int, input().split())))
for n1, n2 in zip([0, 1, 2], [1, 2, 0]):
    if not len(set(s[n1] - s[n2] for s in src)) == 1 or\
       not len(set(s1 - s2 for s1, s2 in zip(src[n1], src[n2]))) == 1:
        dst = "No"
        break
else:
    dst = "Yes"
print(dst)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n - k):
    if a[i] < a[i+k]:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 0:
  print(N/2)
else:
  print(N//2+1)
# Judge status: Accepted
N, C, K=map(int, input().split())
X=[]
for _ in range(N):
  X.append(int(input()))
X.sort()
X.append(10**19)
ans=0
tamatta=0
hayaihito=X[0]
for i in range(N+1):
  if tamatta<C and hayaihito+K>=X[i]:
    tamatta+=1
  else:
    ans+=1
    tamatta=1
    hayaihito=X[i]
    
print(ans)
# Judge status: Accepted
def LI():
    return list(map(int, input().split()))


N, total = LI()
a = LI()
Nlist = [0]*N
a.sort()
ans = 0
if sum(a) == total:
    ans = N
elif sum(a) < total:
    ans = N-1
else:
    for i in range(N):
        if total == a[i]:
            ans += 1
            break
        elif total > a[i]:
            ans += 1
            total -= a[i]
        else:
            break
print(ans)
# Judge status: Accepted
#--------------------------------------------
#ライブラリ呼び出し
import sys
import math
#--------------------------------------------
D, N = map(int, input().split())

if N ==100:
    N=101

ans=(100**D)*N
print(ans)
# Judge status: Wrong Answer
x, y = map(int, input().split())

if x * y < 0:
  ans = abs(x+y) + 1
elif x * y == 0:
  ans = abs(x+y)
elif x < y:
  ans = abs(y-x)
else:
  ans = abs(abs(x)-abs(y)) + 2
  
print(ans)
# Judge status: Accepted
n = int(input())
a = []
counter = 0
a = input().split()
success_result = [0] * n
while True:
    for index, item in enumerate(a):
        if int(item) % 2 == 0:
            a[index] = int(item) / 2
            success_result[index] = True
        else:
            continue
    if all(success_result):
        counter += 1
        success_result = [None for _ in range(n)]
    else:
        break
print(counter)
# Judge status: Accepted
N = int(input())
As  = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
for a in As:
    d[a-1] +=1
for i in range(N):
    print(d[i])
# Judge status: Accepted
n, x, t = map(int, input().split())

if n%x == 0:
    print(n//x*t)
else:
    print((n//x+1)*t)
# Judge status: Accepted
MOD = 1000000007
 
N = int(input())
A = list(map(int, input().split())) 
 
ans = 0
s = sum(A)
 
for a in A:
    s -= a
    ans += (a * s)

ans %= MOD

print(ans)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

a,b,t = iim()
print(t//a*b)
# Judge status: Wrong Answer
N = int(input())
V = list(map(int, input().split()))
V.sort(reverse=True)
V = iter(V)
res = 0
L = N.bit_length()
for i in range(L):
    if (N>>i)&1 != 1:
        continue
    for _ in range(1<<i):
        v = next(V)
        res += v/(1<<(i+2-(N&-N)))

print(res)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    ans = 0
    before = 'A'
    i = 0
    while i < len(S):
        T = S[i]
        while i + 1 < len(S) and T == before:
            i += 1
            T += S[i]
        i += 1
        ans += 1
        if T == before:
            ans -= 1
        before = T
    print(ans)
if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
if n % 2 ==0:
  print(n//2)
else:
  print(n//2+1)
# Judge status: Accepted
N = int(input())
counter = 0
while N >= 2:
  N //= 2
  counter +=1
ans = 2**counter
print(ans)
# Judge status: Accepted
n, m = list(map(int, input().split()))

if n == 1:
    if m == 1:
        print(1)
    else:
        print(m-2)
elif m == 1:
    print(n-2)
else:
    print((n-2)*(m-2))
# Judge status: Accepted
print('red' if int(input()) < 3200 else input())
# Judge status: Accepted
n = int(input())

l = []
ans = 'Yes'

for i in range(n):
    w = input()

    if l.count(w) >= 1:
        ans = 'No'
        break
    
    if i > 0:
        befor = l[i - 1]

        if w[0] != befor[-1]:
            ans = 'No'
            break

    l.append(w)

print(ans)
# Judge status: Accepted
from heapq import nlargest

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

print('Yes' if nlargest(M, A)[-1] >= sum(A) / 4 / M else 'No')
# Judge status: Accepted
s = input()
k = int(input())

for _s in s:
    if _s == "1":
        if k == 1:
            print(1)
            break
        else:
            k -= 1
    else:
        print(_s)
        break
# Judge status: Accepted
N,M = map(int,input().split())
D = []
for i in range(N):
    D.append(tuple(map(int, input().split())))
D.sort()

drinks=M
cost = 0
for i in D:
    if drinks > i[1]:
        drinks -= i[1]
        cost += i[1] * i[0]
    else:
        cost += (drinks * i[0])
        break

print(cost)
# Judge status: Accepted
N = int(input())
S = input()

white_sum = 0
for i in range(N):
    if S[i] == '#':
        continue
    else:
        white_sum += 1

left_black = 0
right_white = white_sum
min_sum = white_sum
for i in range(N):
    if S[i] == '#':
        left_black += 1
    else:
        right_white -= 1

    min_sum = min(min_sum, left_black + right_white)
print(min_sum)
# Judge status: Wrong Answer
import math

a,b,h,m = (int(x) for x in input().split())
print(a)
dh = 30*h
dm = 6*m
ab = abs(dh-dm)
if ab == 0:
  print(abs(a-b))
elif ab == 180:
  print(a+b)
elif ab < 180:
  print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(ab))))
else:
  print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(360-ab))))
# Judge status: Accepted
N = int(input())
A = int(input())
if N%500 <= A:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a, b = map(int, input().split())

s1 = ''
s2 = ''

for i in range(0, a):
    s1 += str(b)
for i in range(0, b):
    s2 += str(a)

if s1 <= s2:
    print(s1)
else:
    print(s2)
# Judge status: Wrong Answer
from fractions import gcd
# ユークリッド互除法
#def gcd(n, m):
#    return n if m == 0 else gcd(m, n%m)

N = int(input())
a = list(map(int, input().split()))
r = [a[-1]]
l = [a[0]]
for i in range(1, N-1):
    r.append(gcd(l[i-1], a[i]))
    l.append(gcd(r[i-1], a[-1-i]))
ans = r[-1]    
for i in range(N-2):
    ans = max(ans, gcd(l[i], r[-2-i]))
ans = max(ans, l[-1])
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
temp=[0]*(max(a)+1)
for i in range(n):
  temp[a[i]]=temp[a[i]]+1
ans=0
for i in range(1,max(a)):
  ans=max(ans,temp[i-1]+temp[i]+temp[i+1])
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=MI()
    f=0
    if b-a==c-b:
        f=1
        
    if f==1:
        print("YES")
    else:
        print("NO")

main()
# Judge status: Wrong Answer

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

count = 0
flag = True
while flag == True:
  for i in range(N):
    if A[i] % 2 == 1:
      flag = False
  if flag == True:
    count += 1
 
    A = list(map(lambda x: int(x / 2), A))
  print(A)

print(count)
# Judge status: Accepted
N, M = map(int, input().split())
num = [1] * N
possible = [False] * N
possible[0] = True

for i in range(M):
  x, y = map(int, input().split())
  x -= 1; y -= 1
  nx, ny = num[x], num[y]
  if possible[x]:
    possible[y] = True
    if nx == 1:
      possible[x] = False
  
  num[x] -= 1; num[y] += 1

print(sum(possible))
# Judge status: Accepted
from math import gcd
n=int(input())
ans=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans+=gcd(gcd(i,j),k)
print(ans)
# Judge status: Accepted
a=[list(map(int,input().split())) for _ in range(3)]
n=int(input())
b=[int(input()) for _ in range(n)]
atari=[]

for i in range(3):
    atari.append([a[i][0],a[i][1],a[i][2]])
for i in range(3):
    atari.append([a[0][i],a[1][i],a[2][i]])
    
atari.append([a[0][0],a[1][1],a[2][2]])
atari.append([a[0][2],a[1][1],a[2][0]])

for k in range(len(atari)):
    if len(list(set(atari[k]) & set(b)))==3:
        print("Yes")
        break
else:
    print("No")
# Judge status: Accepted
n = len(input())
print("x" * n)
# Judge status: Accepted
S = list(input())
minf = 1000
ans = -1
for i in range(len(S)-2):
    tmp = int("".join(S[i:i+3]))
    if (minf > abs(753-int(tmp))):
        minf = abs(753-int(tmp))

print(minf)
# Judge status: Accepted
from collections import Counter


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

if max(cnt.values()) == 1:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a, b = map(int,input().split())
n = input()
s = "Yes"

A = n[:a]
B = n[b:]
if not A.isdecimal():
  s = "No"
if not n[a] == "-":
  s = "No"
if not B.isdecimal():
  s = "No"
print(s)
# Judge status: Accepted
N = int(input())

count = [[0 for _ in range(9)] for _ in range(9)]
for i in range(1, N + 1):
    s = str(i)
    prefix = int(s[0])
    surfix = int(s[-1])
    if surfix != 0:
        count[prefix - 1][surfix - 1] += 1

ans = 0
for i in range(9):
    for j in range(9):
        if i == j:
            continue
        ans += count[i][j] * count[j][i]

for i in range(9):
    ans += count[i][i] ** 2

print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
d={}
for i in range(m):
    p,s=map(str,input().split())
    if p not in d:
        d[p]=[s,1]
    elif d[p][0]=="WA":
        d[p][0]=s
        d[p][1]+=1
ans=[0,0]
for i in d:
    if d[i][0]=="AC":
        ans[0]+=1
        ans[1]+=d[i][1]-1
print(*ans)
# Judge status: Accepted
S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD')
# Judge status: Accepted
s = input()
cnt = [s.count("a"),s.count("b"), s.count("c")]
if sum(cnt) == 1: print("YES")
elif len(set(s)) == 1 or max(cnt) - min(cnt) > 1: print("NO")
else: print("YES")
# Judge status: Accepted
N = int(input())
s = []
for i in range(N):
  tmp = list(input())
  tmp.sort()				# ソート
  s.append(''.join(tmp))	# 文字列の結合
s.sort()

i, j = 0, 1
count = 0
total = 0
while j < N:
  while s[i] == s[j]:
    count += 1
    j += 1
    if j == N:
      break
  
  if count >= 1:
    tmp1, tmp2 = 1, 2
    for k in range(count+1, count+1-2, -1):
      tmp1 *= k
    total += int(tmp1/tmp2)
  i = j
  j += 1
  count = 0
print(total)