peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

import numpy as np
a = np.array(ri_())
ans = 0
while True:
    if np.any(a % 2 == 1):
        break
    if a[0] == a[1] and a[1] == a[2]:
        ans = -1
        break
    a = (sum(a) - a) // 2
    ans += 1
print(ans)
# Judge status: Wrong Answer
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
# Judge status: Accepted
N=int(input())
S=list(input())
x=0
maxx=0
for i in S:
  if i=='I':
    x+=1
  elif i =='D':
    x-=1
  if x>maxx:
    maxx=x
print(maxx)
# Judge status: Wrong Answer
x=int(input())
if 400<=x<599:
  print(8)
elif 600<=x<799:
  print(7)
elif 800<=x<999:
  print(6)
elif 1000<=x<1199:
  print(5)
elif 1200<=x<1399:
  print(4)
elif 1400<=x<1599:
  print(3)
elif 1600<=x<1799:
  print(2)
else:
  print(1)
# Judge status: Wrong Answer
a,b =map(int,input().split())
cnt =b-a+1

if a <0 and b>0 or a==0 or b==0:
    ans = 0
elif (a>0 and b>0) or(a<0 and b<0 and cnt%2==0) :
    ans="Positive"
    
elif(a<0 and b<0 and cnt%2!=0):
    ans="Negative"
    
print(ans)
# Judge status: Accepted
N, M, K = map(int, input().split())

for l in range(N+1):
    for k in range(M+1):
        if (N-l)*(M-k) + l*k == K:
            print("Yes")
            exit()
print("No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
lmax=0
rmin=float('inf')
for i in range(m):
    l,r=map(int,input().split())
    lmax=max(lmax,l)
    rmin=min(rmin,r)

print(rmin-lmax+1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(c if b//a<=c else b//a)
# Judge status: Wrong Answer
from math import gcd

N = int(input())

res = 0
Tb = 1

for i in range(N):
   T = int(input())
   res = gcd(res, T)
   ans = T // res * Tb 
   Tb *= T

print(ans)
# Judge status: Wrong Answer
#from collections import deque
n,m=map(int,input().split())
root=[[] for _ in range(n)]
for i in range(m):
	a,b=map(int,input().split())
	root[a-1].append(b-1)
	root[b-1].append(a-1)
times=[0]*n
sign=[-1]*n
sign[0]=0
#q=deque(root[0])
flag=0
a=root[0]
b=[]
f=False
while True:
	for i in a:
		if sign[i]==-1:
			sign[i]=flag
			b.extend(root[i])
			f=True
	flag=i
	a=b
	b=[]
	if f==False:
		break
	f=False
for i in range(n-1):
	print(sign[i+1]+1)
# Judge status: Wrong Answer
import math
N,M = map(int, input().split())
#約数列挙
flag = True
yakusuu = []
for i in range(1, math.floor(math.sqrt(M))+1):
    if(M % i == 0):
        yakusuu.append(i)
yakusuu.reverse()
for i in yakusuu:
    if M / i >= N and flag == True:
        print(i)
        flag = False
# Judge status: Accepted
k = int(input())

even = k%2 == 0
ans = k >> 1

if even:
    ans **= 2
else:
    ans *= (ans+1)

print(ans)
# Judge status: Accepted
T = input()
S = input()

if T == S[:-1]:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
a,b,x = map(int,input().split())
print("YES" if x-a==b-x else "NO")
# Judge status: Wrong Answer
N, K = map(int,input().split())
prices = input().split()

for i in range(len(prices)):
    prices[i] = int(prices[i])

pricesSum = 0
while K > 0:
    newFruit = min(prices) 
    index = prices.index(newFruit)
    prices.pop(index)
    pricesSum += newFruit
    K -= 1
# Judge status: Wrong Answer
O, E = [input() for _ in range(2)]
pass_word = []
for i in range(len(E)):
  if len(O) < len(E) and i == len(E) - 1:
    pass_word.append(E[i])
  else:
    pass_word.append(O[i])
    pass_word.append(E[i])

ans = "".join(pass_word)
print(ans)
# Judge status: Accepted

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

def check(A,B,K):
    if A > 0:
        if A > K:
            A-=K
            K = 0
        else:
            result = K-A
            A = 0
            K = result
    if B > 0:
        if B > K:
            B-=K
        else:
            B = 0
    return "{0} {1}".format(A,B)

print(check(A,B,K))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort()
l = 0
m = 0
while len(A) >= 2:
    a = A.pop()
    b = A.pop()
    if a == b:
        if l == 0:
            l = a
        elif m == 0:
            m = a
print(l * m)
# Judge status: Wrong Answer
t = ""
s = input()
for i in s:
  if i == 'B' and len(t) > 0:
    t = t[:-1]
  else:
    t += i
print(t)
# Judge status: Accepted
n, m = map(int, input().split())
good = [True for _ in range(n)]
h = list(map(int, input().split()))
for i in range(m):
  a, b = map(int, input().split())
  if(h[a-1] >= h[b-1]):
    good[b-1] = False
  if(h[a-1] <= h[b-1]):
    good[a-1] = False
print(good.count(True))
# Judge status: Wrong Answer
h, a = map(int, input().split())

print(h // a + 1)
# Judge status: Accepted
a = int(input())

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

c = round(sum(b)/len(b))

ans = 0
for i in range(a):
    d = b[i] - c
    ans += d**2

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
for j in range(n):
    ans = 0
    for k in range(m):
        if ab[k][0] == j + 1:
            ans += 1
        elif ab[k][1] == j + 1:
            ans += 1
    print(ans)
# Judge status: Accepted
import sys
n = int(input())
a = list(map(int, input().split()))

ans = 0
cnt = sum(a)
node = 1

for i in range(n + 1):
    ans += node
    cnt -= a[i]
    node = min(cnt, (node - a[i]) * 2)

    if node < 0:
        print(-1)
        sys.exit()

print(ans)
# Judge status: Accepted
N = int(input())
p = list(map(lambda x: int(x), input().split(" ")))

cnt = 0
for i in range(len(p)):
  cnt += 1 if p[i] != i + 1 else 0

print("YES") if cnt in [0, 2] else print("NO")
# Judge status: Accepted
n = int(input())

r = []

for i in range(n):
    city, score = input().split()
    score = int (score)
    r.append((i+1, city, score))

r.sort(key=lambda x:x[2], reverse=True)
r.sort(key=lambda x:x[1])

for i in range(n):
    print(r[i][0])
# Judge status: Wrong Answer
# coding: utf-8

def get_ans():
    n = int(input().rstrip())
    dv = 1
    bit_list = []
    while n != 0:
        tmp = n % (dv*2)
        if tmp == 0:
            bit_list.append("0")
        else:
            bit_list.append("1")
        n -= tmp
        dv *= -2
    return "".join(reversed(bit_list))


print(get_ans())
# Judge status: Accepted
S=input()
N=len(S)
A=S.count('a')
B=S.count('b')
C=S.count('c')

print('YNEOS'[max([A,B,C])-min([A,B,C])>=2::2])
# Judge status: Accepted
import math
import itertools

n = int(input())
a = list(map(int, input().split()))
pf = [0]*(n+1)
pb = [0]*(n+1)
p = a[0]
for i in range(n):
  p = math.gcd(p, a[i])
  pf[i+1] = p
p = a[-1]
for i in range(-1, -n-1, -1):
  p = math.gcd(p, a[i])
  pb[i-1] = p
ans = [0]*n
for i in range(n):
  ans[i] = math.gcd(pf[i], pb[i+1])
print(max(ans))
# Judge status: Accepted
S = input()
mylist=([chr(ord('a') + i) for i in range(26)])
for i in range(26):
    if mylist[0] in S:
        mylist.pop(0)
        pass
    else:
        print(mylist[0])
        break
if mylist==[]:
    print("None")
# Judge status: Wrong Answer
A,B = map(int,input().split())

su = abs(A -B)
count = 0
for i in range(A, B):
    aa =str(i)
    rslt = aa[::-1]
    rr = aa
    # print("rslt{}".format(rslt))
    # print("rr{}".format(rr))
    if rr == rslt:
        count += 1
    print(count)
# Judge status: Accepted
import math

n = int(input())

lcm = n * 360 // math.gcd(n, 360)
print(lcm // n)
# Judge status: Wrong Answer
from itertools import product
n,k = map(int, input().split())
d = list(map(int, input().split()))

nums = []
for i in range(10):
  if i not in d: nums.append(i)

m = str(n)
for i in range(len(m), len(m)+2):
  print(i)
  for j in product(nums, repeat=i):
    ans = ""
    for k in j: ans += str(k)
    if int(ans) >= n:
      print(ans)
      exit()
# Judge status: Accepted
N,A,B=map(int,input().split())
d=B-A
if d%2==0:
    ans=d//2
else:
    ans=min(A-1,N-B)+1+(d-1)//2
print(ans)
# Judge status: Wrong Answer
def main():
    a, b = map(int, input().split())

    price = a

    if 6 <= b <= 12:
        price /= 2
    elif 5 >= b:
        price = 0

    print(price)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,M = map(int,input().split())
if N == M :
    print ('yes')
else :
    print ('no')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

s = 1000
c = 0
upflg = 0
dwnflg = 0
for i in range(n-1):
  if a[i+1] > a[i]:
    dwnflg = 0
    if upflg == 1:
      continue
    c = s//a[i]
    s -= c*a[i]
    upflg = 1
  elif a[i+1] == a[i]:
    continue
  else:
    upflg = 0
    if dwnflg == 1:
      continue
    s += c*a[i]
    dwnflg = 1
  # print (s)
if upflg == 1:
  s += c*a[-1]
print(max(s,1000))
# Judge status: Accepted
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    X, Y = map(int, input().split())

    if X % Y == 0:
        print(-1)
        exit()

    for i in range(1, 10**8):
        num = X * i
        if num % Y != 0:
            print(num)
            exit()

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S=input()
a=0
for i in range(len(S)-1):
    if (S[i]=="h") and (S[i+1]=="i"):
        a+=1
if a==0:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
# -*- coding: utf-8 -*-
from itertools import permutations

N = int(input().strip())
pat_P = tuple(map(int, input().rstrip().split()))
pat_Q = tuple(map(int, input().rstrip().split()))
#-----

perm_list = [ pat for pat in permutations(range(1,N+1))]

a = perm_list.index(pat_P) + 1
b = perm_list.index(pat_Q) + 1
print(abs(a-b))
# Judge status: Accepted
from collections import Counter


N, M = [int(x) for x in input().split()]
Cnter = Counter([int(x) for x in input().split()])
for i in range(M):
    b, c = [int(x) for x in input().split()]
    Cnter[c] += b
V = sorted(list(Cnter.most_common()))
cnt = 0
ans = 0
for v in V[::-1]:
    ans += v[0] * min(v[1], N - cnt)
    cnt += v[1]
    if cnt >= N:
        break
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
N = int(input())

ans = 0
for i in range(N):
    ans += i + 1
print(ans)
# Judge status: Wrong Answer
a=int(input())
print((a/3)*3)
# Judge status: Wrong Answer
n = int(input())
nums = list(map(int, input().split()))
pairlist = []
for i in range(len(nums)):
    pairlist.append([i, nums[i]])

sortedPairList = sorted(pairlist, key=lambda item: item[1])
print(sortedPairList)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
MINUS = 0
B = []

for i in A:
  if i < 0:
    MINUS += 1
  else:
    B.append(i)
  
if min(A) > 0:
  print(sum(A))
  exit(0)
  
ans = 0
if MINUS % 2 == 0:
  for a in A:
    ans += abs(a)
else:
  minB = max(A)
  for a in A:
    ai = abs(a)
    if ai < minB:
      minB = ai
    ans += ai
  ans -= minB * 2

print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
S = 0
for a in A:
    S = S ^ a
for i in range(len(A)):
    x = S ^ A[i]
    print(x)
# Judge status: Accepted
n=int(input())%28
flag=0
for a in range(0,32,4):
  for b in range(0,35,7):
    if a+b==n:
      print("Yes")
      flag=1
      break
if flag==0:
	print("No")
# Judge status: Accepted
s = int(input())
li = []
a = s
for i in range(1, 10 ** 6 + 1):
    if i == 1:
        a = s
    else:
        if a % 2 == 0:
            a = a // 2
        else:
            a = 3 * a + 1
    if a in li:
        print(i)
        exit()
    li.append(a)
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

count = 0
for i in a:
    if x < i:
        break
    x -= i
    count += 1
else:
    if x:
        count -= 1

print(count)
# Judge status: Wrong Answer
n,w=map(int,input().split())
l=[]
for i in range(n):
    w1,v1=map(int,input().split())
    l.append([v1,w1])
s=0
a=sorted(l,reverse=True)
for i in range(n):
    if w-a[i][1]>=0:
        w-=a[i][1]
        s+=a[i][0]
print(s)
# Judge status: Accepted
#093_B
a,b,k=map(int,input().split())
if b-a<2*k:
    print(*range(a,b+1),sep='\n')
else:
    print(*range(a,a+k),sep='\n')
    print(*range(b-k+1,b+1),sep='\n')
# Judge status: Accepted
from collections import deque

s=deque(list(input()))
flag=0
for i in range(int(input())):
  dir=input().split()
  if int(dir[0])==1:flag+=1
  else:
    if int(dir[1])==1:
      if flag%2==0:s.appendleft(dir[2])
      else:s.append(dir[2])
    else:
      if flag%2==0:s.append(dir[2])
      else:s.appendleft(dir[2])
s=list(s)
if flag%2==1:s.reverse()
print(*s,sep='')
# Judge status: Wrong Answer
def main():
  n, k = map(int, input().split())
  d = list(map(int, input().split()))
  a = n
  for i in range(n, 10000):
    if checknum(i, d):
      a = i
      break
  print(a)

def checknum(n, d):
  for s in str(n):
    if d.count(int(s)) > 0:
      return False
  return True

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
N,P=map(int,input().split())
*A,=map(int,input().split())

if N==1:
    print(2*(P==A[0]%2))
else:
    print(2**(N-1))
# Judge status: Accepted
from fractions  import gcd

def lcm(x, y):
  return (x * y) // gcd(x, y)

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

a_num = (a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // lcm(c, d))
b_num = b - (b // c + b // d - b // lcm(c, d))

ans = b_num - a_num

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
a = list(map(int, input().split()))
for k in range(N):
  a[k] //= 2

foo = 1
while a[0]%2 == 0:
  foo *= 2
  a[0] //= 2
for k in range(1, N):
  if a[k] % foo == 0 and a[k]%(2*foo) !=0:
    a[k] //= foo
    continue
  else:
    print(0)
    exit()
ans = 0

import math
lcm = a.pop()
for k in range(1, N):
  b = a.pop()
  lcm = lcm * b // math.gcd(lcm, b)
  if lcm* foo > M:
    print(0)
    exit()
lcm *= foo
ans = int((M / lcm -1)//2 + 1)
print(ans)
# Judge status: Accepted
def mul(a, b):
    return ((a % P) * (b % P)) % P

def div(x, y):
    return mul(x, pow(y, P-2, P))

def comb(n, r):
    x = 1
    for i in range(n, n - r, -1):
        x = (x * i) % P
        
    y = 1
    for i in range(1, r+1):
        y = (y * i) % P
    return div(x, y)
  
n, a, b = map(int, input().split())
P = 10 ** 9 + 7
res = pow(2, n, P) - 1 - comb(n, a) - comb(n, b)
print(res % P)
# Judge status: Accepted
n = int(input())
a_l = list(map(int, input().split()))
ans = float('inf')
for a in a_l:
    c = 0
    while a%2 == 0:
        a = a/2
        c += 1
    ans = min(ans,c)
print(ans)
# Judge status: Wrong Answer
def main():
    n = int(input())
    blis = list(map(int, input().split()))

    alis = [blis[0], blis[0]]
    if n > 3:
        for i in range(2, n):
            alis.append(min(blis[i-2], blis[i-1]))
    if n > 2:
        alis.append(blis[n-2])
    print(sum(alis))


    


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
from _collections import defaultdict
n=int(input())
S=input()
X=defaultdict(int)
for s in S:
    X[s]+=1
ans=1
for v in X.values():
    ans*=(v+1)
print(ans-1)
# Judge status: Accepted
a,b,c=map(int, input().split())
if a<=c and c<=b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = 0
while True:
    for i in range(n):
        if a[i] % 2 != 0:
            print(cnt)
            exit()
        else:
            a[i] /= 2
    cnt += 1
# Judge status: Accepted
s = int(input())
T = set()
T.add(s)
for i in range(1000001):
  if s%2:
    s = s*3 + 1
  else:
    s = s // 2
  l = len(T)
  T.add(s)
  if l == len(T):
    print(i+2)
    exit()
# Judge status: Wrong Answer
n = int(input())
ball = list(map(int,input().split()))

num = [0] * (n + 1)
data = [0] * (n + 1)

for i in ball:
    num[i] += 1

for i in range(n):
    data[i] = num[i] * (num[i] - 1) // 2

x = sum(data)

for i in ball:
    print(x - num[i] + 1)
# Judge status: Accepted
MOD = 998244353
N = int(input())
D = list(map(int, input().split()))
D_2 = [0]*(max(D)+1)
for i in D:
    D_2[i] += 1
ans = 1 if D_2[0] == 1 and D[0] == 0 else 0
for i in range(1,max(D)+1):
    ans *= D_2[i-1]**D_2[i]
    ans %= MOD
print(ans)
# Judge status: Accepted
# coding: utf-8

s = input().rstrip()

ans = min(s.count("0"), s.count("1")) * 2

print(ans)
# Judge status: Accepted
x = int(input())
k = x // 11
l = x % 11
ans = 2 * k
if l >= 7:
    ans += 2
elif l >= 1:
    ans += 1
print(ans)
# Judge status: Wrong Answer
X = int(input())
if 30 <= X:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = int(input())
x = 0
l = 0
while x < n:
    l += 1
    x += 26**l
for i in range(1,l):
    n -= 26**i
n -= 1
ans = ""
while len(ans) < l:
    ans += chr(ord("a")+n%26)
    n //= 26
print(ans[::-1])
# Judge status: Wrong Answer
a = []
a.append(int(input()))
cnt_4 = 0
for i in range(10**6):
    if a[i] % 2 == 0:
        a.append(a[i] // 2)
    else:
        a.append(3*a[i] + 1)
    if a[i + 1] == 4:
        cnt_4 += 1
    if cnt_4 == 2:
        break
print(len(a))
# Judge status: Accepted
a, b = list(map(int, input().split()))

if a == 1:
    a=14
if b == 1:
    b=14

if a == b:
    print("Draw")
elif a>b:
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
a=list(map(int,input().split()))
a.sort()
ans=a[2]-a[1]
a[0]+=a[2]-a[1]
a[1]+=ans
ans+=(a[1]-a[0])//2
a[0]+=((a[1]-a[0])//2)*2
if (a[0]==a[1])and(a[1]==a[2]):
    print(ans)
else:
    print(ans+2)
# Judge status: Wrong Answer
s=input()
print(min(s[::2].count("1")+s[1::2].count("0"),s[::2].count("0")+s[1::2].count("1")))
# Judge status: Accepted
a,b,c,k = list(map(int,input().split(' ')))

if a >= k:
    print(k)
elif a+b >= k:
    print(a)
else:
    print(a-(k-(a+b)))
# Judge status: Accepted
def main():
    from sys import stdin

    readline = stdin.readline

    N=int(readline().rstrip())
  
    count=0
    
    for i in range(N):
        x,y = list(map(int,readline().rstrip().split()))
        if ( x == y ):
            count += 1
            if ( count >= 3):
                break
        else:
            count = 0


    if ( count >= 3 ):
        print('Yes')
    else:
        print('No')

main()
# Judge status: Accepted
n=int(input())
x=list(map(int,input().split()))
d=sorted(x)
b1=d[len(x)//2-1]
b2=d[len(x)//2]
for i in x:
  if i<=b1:
    print(b2)
  elif i>=b2:
    print(b1)
# Judge status: Accepted
import sys
lis = list('abcdefghijklmnopqrstuvwxyz')
s = sorted(set(input()))
for i in lis:
    if i not in s:
        print(i)
        sys.exit()
print("None")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if c-a-b>0:
    print(c-a-b)
else:
    print("0")
# Judge status: Accepted
N = int(input())
W = []
for _ in range(N):
    W.append(input())

if len(set(W)) != len(W):
    print("No")
    exit(0)

for i in range(N-1):
    if W[i][-1] != W[i+1][0]:
        print("No")
        exit(0)

print("Yes")
# Judge status: Wrong Answer
s = input()
t = input()
count = 0
for i in range(len(s)):
  if s[i] == t[i]:
    count += 1
print(count)
# Judge status: Accepted
x=list(input())
n=len(x)

stack=['T',x[0]]
for i in range(1,n):
  if x[i]=='S':
    stack.append('S')
  else:
    if stack[-1]=='S':
      stack.pop()
    else:
      stack.append('T')
print(len(stack)-1)
# Judge status: Accepted
n,a,b = map(int,input().split())

if a == b:
    print (1)
    exit ()

if a >= b or n < b - a:
    print (0)
    exit ()

print ((b-a)*(n-2)+1)
# Judge status: Wrong Answer
N=int(input())
ABC=[]
for i in range(N):
	ABC+=[[int(i) for i in input().split()]]
DP=[[0,0,0] for i in range(N)]
for i in range(N):
	for j in range(3):
		DP[i][j]=int(ABC[i][j])+max(DP[i-1][(j+1)%3],DP[i-1][(j+2)%3])
print(max(DP[N-1]))
# Judge status: Wrong Answer
n = int(input())
count = 0
for a in range(n):
  for b in range(n):
    for c in range(n):
      if (a*b+c) == n:
        count += 1
print(count)
# Judge status: Accepted
N,M=map(int,input().split())
A=set(list(map(int,input().split()))[1:])
for _ in range(N-1):
    A = A & set(list(map(int,input().split()))[1:])
print(len(A))
# Judge status: Wrong Answer
d = int(input())

print("Christmas" + "Eve"*(d-25))
# Judge status: Accepted
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 1100000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])
# Judge status: Wrong Answer
s = input()
if s[2] == s[3] or s[4] == s[5]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

a = [int(i)-j for i,j in zip(input().split(),range(n))]

l = -10 ** 10

r = 10 ** 10

def f(x):
  return sum(map(lambda y: abs(y - x), a))

while r - l > 3:
  l_r = (r - l) // 3
  l_i = l + l_r
  i_r = r - l_r
  if f(l_i) > f(i_r):
    l = l_i
  else:
    r = i_r
print(min(f(l),f(l+1),f(l+2),f(l+3)))
# Judge status: Wrong Answer
s = input()

if s == 'AAA' or s == 'BBB':
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

for i in range(n - 1):
    if a[i] < 0:
        if a[i + 1] <= 0 or -a[i] - a[i + 1] >= 0:
            a[i] *= -1
            a[i + 1] *= -1
            

print(sum(a))
# Judge status: Accepted
n,a,b=map(int,input().split())
if a%2==b%2:
  print(abs((a+b)//2-a))
else:
  k=min(a-1,n-b)
  if a-1<n-b:
    flag=0
  else:
    flag=1
  if flag==0:
    if b-k-1>=0:
      print(k+1+abs(b-k-1-(1+b-k-1)//2))
    else:
      print(k+1)
  else:
    if a+k+1<=n:
      print(k+1+abs(a+k+1-(n+a+k+1)//2))
    else:
      pritn(k+1)
# Judge status: Accepted
A, B, C = map(int, input().split())

if(A+B+C >= 22):
  print("bust")
else:
  print("win")
# Judge status: Accepted
n,m=map(int,input().split())

favorite=[0]*(m+1)

for i in range(n):
  k_=list(map(int,input().split()))
  for j in range(1,k_[0]+1):
    
    favorite[k_[j]]+=1
    
  
print(favorite.count(n))
# Judge status: Wrong Answer
n,k=map(int,input().split())
A=list(map(int,input().split()))

def culc(L):
    subL=[0]*(n+1)

    for i in range(n):
        temp=L[i]
        bottom=max(i-temp,0)
        top=min(i+temp,n-1)

        subL[bottom]+=1
        subL[top+1]-=1
    
    resL=[0]*n
    resL[0]=subL[0]
    for i in range(1,n):
        resL[i]=resL[i-1]+subL[i]

    return resL

for i in range(min(k,50)):
    A=culc(A)

print(A)
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0]

for i in range(1,n):
    c = 100000
    for j in range(1,min(k+1,i+1)):
        c = min(abs(h[i] - h[i - j]) + dp[i - j], c)
    dp.append(c)
print(dp[-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()

left = a[-1]
sa = 199999999999999999999999999
for i in range(n):
  if sa > abs((left/2) -a[i]):
    right = a[i]
    sa = abs((left/2) - a[i])
    
print(left, right)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
x = [a,b]
y = [c,d]

if a * b < 0:
    x.append(-1)
    x.append(1)
    
if c * d < 0:
    y.append(-1)
    y.append(1)
    
ans = - (10 ** 20)
    
for i in x:
    for j in y:
        ans = max((i*j),ans)
        
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-

import sys

def main():
    input = sys.stdin.readline
    n = input()
    l = list(map(int, input().split()))
    max_l = max(l)
    l.remove(max_l)
    sum_l = sum(l)
    if max_l < sum_l:
        print("Yes")
    else:
        print("No")
    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from collections import Counter

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

c = Counter(a)
new = []
for key, val in c.most_common():
    if val == 1:
        new.append(key)

ans = 0
for i in range(len(new)):
    flag = True
    for j in range(len(new)):
        if i != j and new[i] % new[j] == 0:
            flag = False
            break

    if flag:
        ans += 1

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

num = 0
for i in range(1, len(p) - 1):
    left = p[i - 1]
    center = p[i]
    right = p[i + 1]

    if (left < center < right) or (right < center < left):
        num += 1

print(num)