peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

ma = 2 * 10 ** 6
tab = [False] * (ma)

mapp = {}
for i in a:
    if i in mapp:
        mapp[i] += 1
    else:
        mapp[i] = 1

ans = 0
for i in a:
    if not tab[i]:
        if mapp[i] == 1:
            ans += 1
        for j in range(i, ma, i):
            tab[j] = True
print(ans)
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
s = sum(a)
a = Counter(a)
for _ in range(q):
    b, c = map(int, input().split())
    if b in a:
        a[c] += a[b]
        s += (c-b) * a[b]
        a[b] = 0
    print(s)
# Judge status: Accepted
_N,A,B=map(int,input().split())
S=input()
a,b=0,0
for s in S:
  if a+b < A+B:
    if s=='a':
      a+=1
      print('Yes')
    elif s=='b' and b < B:
      b+=1
      print('Yes')
    else:
      print('No')
  else:
    print('No')
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
 
print( int((a + b) * h / 2) )
# Judge status: Wrong Answer
a, b, c, x, y = A = list(map(int, input().split()))

l = a * x + b * y
m = c * max(x, y) * 2

if x >= y :
    n = c * y * 2 +  a * (x - y)
else:
    n = c * x * 2 + a * (y - x)

ans = min(l, m, n)
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
print('YNEOS'[b-a!=c-b::2])
# Judge status: Wrong Answer
S = input()
#Aの探索
for i in range(len(S)):
    if S[i] == "A":
        S = S[i:]
        break

#Zの探索
for i in range(1, len(S)+1):
    if S[-i] == "Z":
        S = S[:-i+1]
        break
print(len(S))
# Judge status: Accepted
S = input()
c_a = 0
c_b = 0
c_c = 0
for i in range(len(S)):
  if S[i] == 'a':
    c_a += 1
  elif S[i] == 'b':
    c_b += 1
  else:
    c_c += 1
if abs(c_a -c_b) < 2 and abs(c_b - c_c) < 2 and abs(c_c - c_a) < 2:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
S = input()
K = int(input())
lc1 = -1
while lc1 + 1 < len(S) and S[lc1 + 1] == '1':
    lc1 += 1

print("1" if lc1 + 1 >= K else S[lc1 + 1])
# Judge status: Wrong Answer
x = int(input())
print(8 - (1800 - 400) // 200)
# Judge status: Accepted
import heapq
n = int(raw_input())
heap = [map(int, raw_input().split(' '))[::-1] for _ in range(n)]
heapq.heapify(heap)
def f(heap):
	t = 0
	while(heap):
		nd,d = heapq.heappop(heap)
		gap = nd - t - d
		if gap < 0:
			return False
		t += d
		
	return True
print 'Yes' if f(heap) else 'No'
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if a == b:
    print("YES")
    exit()

if v <= w:
    print("NO")
    exit()

if (v - w) * t >= abs(a - b):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from collections import deque

S = input()
Q = int(input())

ans = deque()
ans.append(S)
reverse = False

for i in range(Q):
    x = list(input().split())
    if int(x[0]) == 1:
        reverse = not reverse
        continue
    if int(x[1]) == 1 and not reverse:
        ans.appendleft(x[2])
    elif int(x[1]) == 2 and reverse:
        ans.appendleft(x[2])
    else:
        ans.append(x[2])

ans = ''.join(ans)

if reverse:
    print(ans[::-1])
else:
    print(ans)
# Judge status: Accepted
se = set(list(map(int, input().split())))

n = len(se)
print(str(n))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))


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

#print(B,number)

if len(B)==0:
    print(-1)
else:
    print(N-len(B))
# Judge status: Accepted
n, k = map(int, input().split())
s, p, r = map(int, input().split()) 
dic = {"p":p, "r":r, "s":s}
t = input()
ans = 0
for i in range(k):
    bef = "a"
    for j in range(i, n, k):

        if bef == t[j]:
            bef = "a"
        else:
            ans += dic[t[j]]
            bef = t[j]
print(ans)
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)


P = P[:X]
Q = Q[:Y]
print(sum(sorted(P + Q + R, reverse=True)[:X+Y]))
# Judge status: Accepted
x=int(input())
if x==7 or x==5 or x==3:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n, m = list(map(int, input().split()))

if n * 2 < m:
  print(n + (m - n * 2) // 4)
else:
  print(m // 2)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a_cumsum = [0]*(n+1)
for i in range(n):
    a_cumsum[i+1] = a_cumsum[i] + a[i]

ans = 10**18
for i in range(n):
    ans = min(ans, abs(a_cumsum[-1] - a_cumsum[i]*2))
print(ans)
# Judge status: Wrong Answer
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split()]

a.sort()
amax = a.pop()
ans = a[0]
for i in a :
    if abs(amax/2 - ans) > abs(amax/2 - i) :
        ans = i

print(amax, ans)
# Judge status: Accepted
N,D = map(int,input().split())
Ref = D ** 2
cnt = 0
for _ in range(N):
  p,q = map(int,input().split())
  if p ** 2 + q ** 2 <= Ref:
    cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
CSF = [list(map(int,input().split())) for i in range(N-1)]

for j in range(0,N,1):
    t = 0
    for i in range(j,N-1,1):
        C,S,F = CSF[i]

        if t < S:#まだ１ポンも出てないなら待つしかない
            t = S
        
        if t%F != 0:
            t += F-t%F
        
        t += C

    print(t)
# Judge status: Accepted
n,W=map(int,input().split())
dp=[0]*(W+1)
for i in range(n):
	w,v=map(int,input().split())
	for j in range(W,-1,-1):
		cw=j+w
		cv=dp[j]+v
		if cw <=W and dp[cw]<cv:
			dp[cw]=cv
print(dp[W])
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a < c < b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    b_lst = list(map(int, input().split()))
    c_lst = list(map(int, input().split()))
    ans = 0

    for a in a_lst:
        ans += b_lst[a - 1]

    for i in range(n - 1):
        if a_lst[i] + 1 == a_lst[i + 1]:
            ans += c_lst[a_lst[i] - 1]

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b, x = [int(i) for i in input().split()]
print((b//x+1) - ((a-1)//x+1 if a >= 0 else 0))
# Judge status: Accepted
import sys, itertools

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))

S = list(itertools.accumulate(A))

mini = 10 ** 18
for i in range(N):
    mini = min(mini, abs(S[N - 1] - 2 * S[i]))

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

if not a < b:
  b *=2
  k -=1
if not b < c:
  c *=2
  k -=1
  
if k <= 0:
  print('No')
  exit()
elif not a<b<c:
  print('No')
  exit()  

print('Yes')
# Judge status: Wrong Answer
N=int(input())
A=list(map(int, input().split()))
D={}
E={}
for i in range(N):
  a=i+1+A[i]
  b=i+1-A[i]
  D.setdefault(a-1,0)
  E.setdefault(b-1,0)
  D[a-1]+=1
  E[b-1]+=1
print(D,E)
ans=0
for i in D:
  if i in E:
    ans+=D[i]*E[i]
print(ans)
# Judge status: Accepted
from fractions import gcd

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

print((A * B) // gcd(A, B))
# Judge status: Wrong Answer
def main():
    from string import ascii_lowercase
    S = input()
    T = input()

    dic = {a: set() for a in ascii_lowercase}
    for s, t in zip(S, T):
        dic[t].add(s)
    if all(len(s) <= 1 for s in dic.values()):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b=input().split()

li=[a*int(b),b*int(a)]

li.sort()

print(li[0])
# Judge status: Accepted
N,x = list(map(int,input().split()))
a =  list(map(int,input().split()))
counter = 0
for i in range(N-1):
    sum_a = a[i] + a[i+1] 
    if sum_a > x:
        if sum_a - x > a[i+1]:
            counter += sum_a -x
            a[i] = a[i] -(sum_a-x-a[i+1]) #この行はなくてもいい
            a[i+1] = 0
        else:
            counter += sum_a-x
            a[i+1] = a[i+1] - (sum_a -x)
print(counter)
# Judge status: Wrong Answer
w,h,n = map(int,input().split())
x_min = 0
y_min = 0
x_max = w
y_max = h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    x_min = x
  elif a == 2:
    x_max = x
  elif a == 3:
    y_min = y
  elif a == 4:
    y_max = y
S = (x_max-x_min)*(y_max-y_min)
if S < 0:
  print(0)
else:
  print(S)
# Judge status: Wrong Answer
N = int(input())
A = []
cnt = 0
for _ in range(N):
    a = int(input())
    cnt += a//2
    A.append(a%2)
cur = 0
for i in range(N):
    if A[i]==1:
        cur += 1
    else:
        cnt += cur//2
        cur = 0
cnt += cur//2
print(cnt)
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    sx, sy, tx, ty = MII()
    x1 = tx-sx
    y1 = ty-sy
    go1 = 'U'*y1 + 'R'*x1
    bk1 = 'D'*y1 + 'L'*x1
    go2 = 'L'+'U'+go1+'R'+'D'
    bk2 = 'R'+'D'+bk1+'L'+'U'
    print(go1+bk1+go2+bk2)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
  a[i] += a[i-1]
for  i in range(1,m):
  b[i] += b[i-1]
ans = -100
for i in range(n):
  if(a[i]>k):
    break
  for j in range(1,m):
    if(a[i]+b[(-1)*j]>k):
      break
    ans = max(ans,i+j+1)
print(ans)
# Judge status: Wrong Answer
print(8-int(int(input())-400)/200)
# Judge status: Accepted
N = int(input())

ans = 1
judg = 0


for i in range(N):
    x = i+1
    counter = 0
    while True:
        if x%2==0:
            x = x / 2
            counter += 1
        else:
            break
    if judg<counter:
        ans = i+1
        judg = counter


print(ans)
# Judge status: Accepted
a,b,x=map(int,input().split())
shita=a//x
ue=b//x
if a%x==0:
  print(ue-shita+1)
else:
  print(ue-shita)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

cnt = 0
A_ = []
for i in A:
    if i < 0:
        cnt += 1
        A_.append(-i)
    else:
        A_.append(i)

if cnt%2 == 0:
    print(sum(A_))
else:
    print(sum(A_) - 2*min(A_))
# Judge status: Wrong Answer
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    S = int(input())
    y = (S+10**9-1)//(10**9)
    x = y*(10**9)-S
    print(' '.join(map(str,[0,0,1,10**9,x,y])))

if __name__ == '__main__':
    main()
# Judge status: Accepted
h = int(raw_input())
w = int(raw_input())
n = int(raw_input())
if h > w:
    h, w = w, h
print (n + w - 1) / w
# Judge status: Accepted
A,B,C,D = map(int,input().split())
Flag = False

while Flag == False:
    C = C - B
    if C <= 0 :
        Flag = True
        break
    A = A - D
    if A <= 0 :
        break

if Flag == True :
    print('Yes')
else :
    print('No')
# Judge status: Wrong Answer
X, K = map(int, input().split())

if X == 1:
    print(K)
else:
    for i in range(K - X +1,K + X -1):
        print(i,end=" " )
# Judge status: Accepted
m = dict()
a0 = [1,3,5,7,8,10,12]
a1 = [4,6,9,11]
a2 = [2]

for i,j in enumerate([a0,a1,a2]):
    for k in j:
        m[k] = i

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

if m[a] == m[b]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
S = input()
T = input()

if S==T:
    print(N)
    exit()
for i in range(N):
    if S[i:] == T[:-i]:
        print(N+i)
        exit()
print(N+N)
# Judge status: Accepted
A = sorted(list(map(int, input().split())))
print('YES' if A[0] == 5 and A[1] == 5 and A[2] == 7 else 'NO')
# Judge status: Wrong Answer
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    W = {'SUN': 1,
         'MON': 2,
         'TUE': 3,
         'WED': 4,
         'THU': 5,
         'FRI': 6,
         'SAT': 7}

    print(W[S])


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
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)
# Judge status: Accepted
from fractions import *
a,b=map(int,input().split())
g=gcd(a,b)
l=[g]
for i in range(2,int(g**.5)+1):
  if g%i<1: l+=[i,g//i]
c=1
for i in sorted(l):
  if g<2: break
  if g%i<1: c+=1
  while g%i<1: g//=i
print(c)
# Judge status: Wrong Answer
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
print(A)

for i in range(3):
  for j in range(3):
    if A[i][j] in b:
      A[i][j] = 0
  
for i in range(3):
  if A[i][0] + A[i][1] + A[i][2] == 0 or A[0][i] + A[1][i] + A[2][i] == 0 or A[0][0]+A[1][1]+A[2][2] ==0 or A[2][0]+A[1][1]+A[0][2] ==0:
    print('Yes')
    break
  
  else:
    print('No')
    break
# Judge status: Accepted
n = int(input())

t0, x0, y0 = 0, 0, 0
cnt = 0

for _ in range(n):
    t, x, y = map(int, input().split())
    diff_t = t-t0
    distance = abs(x0-x)+abs(y0-y)
    if diff_t >= distance and (diff_t - distance == 0 or (diff_t - distance) % 2 == 0):
        cnt += 1
    t0, x0, y0 = t, x, y

print('Yes' if cnt == n else 'No')
# Judge status: Accepted
N, M = list(map(int, input().split()))
TENBOUDAI = list(map(int, input().split()))
# linked_list = { i: set() for i in range(N)}

_list = {i:1 for i in range(1,N+1)}
for m in range(M):
    i,j= list(map(int, input().split()))
    # if i in _list and j in _list:
    if TENBOUDAI[i-1] <= TENBOUDAI[j-1]:
        # _list.remove(i)
        _list[i] =0
    if TENBOUDAI[j-1] <= TENBOUDAI[i-1]:
        # _list.remove(j)
        _list[j] =0


# print(_list)
print(sum(_list.values()))
# Judge status: Accepted
N=int(input())
def money(n):
    dp=[n]*(n+1)
    dp[0]=0
    for i in range(1,n+1):
        power=1
        while power<=i:
            dp[i]=min(dp[i],dp[i-power]+1)
            power*=6
        power=1
        while power<=i:
            dp[i]=min(dp[i],dp[i-power]+1)
            power*=9
    return dp[n]
print(money(N))
# Judge status: Accepted
import math


X,Y=map(int, input().split())
if math.isclose(-Y/2+2*X, math.ceil(-Y/2+2*X)) and math.isclose(Y/2-X, math.ceil(Y/2-X)):
    if Y//2-X>0 and -Y/2+2*X>0:
        print("Yes")


    elif Y/2-X==0 and -Y/2+2*X>0:
         print("Yes")


    elif Y/2-X>0 and -Y/2+2*X==0:
         print("Yes")

    else:
         print("No")


else:
    print("No")
# Judge status: Wrong Answer
import heapq
N = int(input())
A = list(int(input()) for _ in range(N))

S = [A[0]]
for i in range(1, N):
    if A[i] <= S[0]:
        S.insert(0, A[i])
        continue
    for j in range(len(S)):
        if A[i] < S[j]:
            S[j-1] = A[i]
            break
    else:
        S[-1] = A[i]
print(len(S))
# Judge status: Accepted
X = int(input())

ans = 1
for i in range(2, X + 1):
    tmp = i ** 2
    while tmp <= X:
        ans = max(ans, tmp)
        tmp *= i
    
print (ans)
# Judge status: Accepted
from collections import deque

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

tree=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tree[a].append(b)
  tree[b].append(a)

dist=[-1 for i in range(n)]
dist[0]=0

ans=[-1 for i in range(n)]
ans[0]=0

dq=deque()
dq.append(0)
while dq:
  x=dq.popleft()
  for i in tree[x]:
    if ans[i]==-1:
      ans[i]=x
      dq.append(i)

if -1 in ans:
  print('No')
  exit()

print('Yes')
for i in ans[1:]:
  print(i+1)
# Judge status: Wrong Answer
n = int(input())
a = list(int(input()) for _ in range(n))
i= 1
cnt=0

for _ in range(n):
    i = a[i-1]
    cnt += 1
    if(a[i-1] == 2):
        print(cnt+1)
        quit()
    else:
        continue
print(-1)
# Judge status: Accepted
N, M = map(int, input().split())
ans = ['-1'] * N

if N == 1 and M == 0:
    print(0)
    exit()

for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == str(c):
        continue
    elif ans[s-1] == '-1':
        ans[s-1] = str(c)
    else:
        print(-1)
        exit()

if N >= 2 and ans[0] == '0':
    print(-1)
    exit()
elif ans[0] == '-1':
    ans[0] = '1'

ans = ''.join(ans).replace('-1', '0')
print(ans)
# Judge status: Accepted
n=int(input())

#0を一回も使わない
no_0 = 9**n

#9を一回も使わない
no_9 = 9**n

#0と9を一回も使わない
no_09 = 8**n

#全体-上記集合
yes_09 = 10**n - (no_0+no_9-no_09)

print(yes_09%(10**9+7))
# Judge status: Accepted
from math import ceil

a,b = map(int,input().split())
print(ceil((a+b)/2))
# Judge status: Wrong Answer
x,a,b = map(int,input().split())

print('delicious') if b <= a else print('safe') if b < a+b else print('dangerous')
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
K=int(input())
list=[A,B,C]

for i in range(K):
    mini=min(list)
    for n in range(3):
        if mini==list[n]:
            list[n]=2*list[n]
           
A=list[0]
B=list[1]
C=list[2]

if A<B<C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
MOD = (10**9) + 7
n = int(input())
a = list(map(int,input().split()))

cnt = [0] * 60

for num in a:
  for j in range(60):
    cnt[j] += (num >> j) % 2
ans = 0
for b in range(60):
  ans += cnt[b] * (n-cnt[b]) << b
  
ans %= MOD
print(ans)
# Judge status: Accepted
n=int(input())
xy=[list(map(int,input().split()))for _ in range(n)]
xy1ma=-10**10
xy1mi=10**10
xy2ma=-10**10
xy2mi=10**10
for x,y in xy:
  xy1ma=max(xy1ma,x-y)
  xy1mi=min(xy1mi,x-y)
  xy2ma=max(xy2ma,x+y)
  xy2mi=min(xy2mi,x+y)
print(max(xy1ma-xy1mi,xy2ma-xy2mi))
# Judge status: Wrong Answer
H, W = map(int, input().split())

if W % 2 == 1:
    w = W // 2 + 1
    ans = w * (H // 2) + (w - 1) * (H // 2)
    if H % 2 == 1:
        ans += w
    print(ans)
else:
    w = W // 2
    ans = w * H
    print(ans)
# Judge status: Accepted
n=input()
print('Yes' if n[0]==str(9) or n[1]==str(9) else 'No')
# Judge status: Wrong Answer
s = input()
ans = 0

for i in range(1,4):
  p = "R"*i
  if p in s:
    ans = i
print(i+1)
# Judge status: Accepted
X = map(int,input().split())

for i,x in enumerate(X):
    if x == 0:
        print(i+1)
# Judge status: Accepted
r=int(input())
print(2*3.14*r)
# Judge status: Accepted
n = int (input())
ans=0
for i in range (15):
    for j in range (15):
        if 4*i+7*j==n:
            ans+=1
        else:
            ans+=0
if ans == 0:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
def main():
    from operator import itemgetter 
    n,m=map(int,input().split())
    W=[list(map(int,input().split())) for _ in range(n)]

    W.sort(key=itemgetter(1,0),reverse=True)

    
    i,j,income=0,0,0
    while i<m and j<n:
        if W[i][0]+i<=m:
            income+=W[i][1]
            i+=1
            j+=1
        else:
            j+=1
    
    print(income)

if __name__=='__main__':
    main()
# Judge status: Accepted
N, T = map(int, input().split())
ans = 10000
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print('TLE' if ans == 10000 else ans)
# Judge status: Accepted
N = int(input())

B = list(map(int, input().split()))
ans = [0] * N
ans[0] = B[0]
ans[-1] = B[-1]
for i in range(1, N-1):
    ans[i] = min(B[i], B[i-1])
print(sum(ans))
# Judge status: Accepted
n=int(input())
d=list(map(int,input().split()))

mod=998244353
from collections import Counter
c=Counter(d)
if not(d[0]==0 and sorted(d)[1]!=0):
  print(0)
  exit()
d.sort()
ans=1
for i in range(1,d[-1]+1):
  if c[i]==0:
    ans*=0
  else:
    ans*=c[i-1]**c[i]
  ans%=mod
print(ans)
# Judge status: Accepted
a = list(map(int,input().split()))

print(a[2],a[0],a[1])
# Judge status: Wrong Answer
# import itertools
# import math


def solve(H, N, A):
    if (sum(A) > H):
        return 'Yes'
    return 'No'


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

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(H, N, A))
# Judge status: Accepted
s = list(input())

if s[0] == s[1] and s[1] == s[2]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
from collections import deque
 
s = input()
q = int(input())
 
query = [input().split() for i in range(q)]
 
a = deque([s])
 
flag = True
 
for i in range(q):
    if query[i][0] == "1":
        flag = not(flag)
    else:
        if (query[i][1] == "1" and flag) or (query[i][1] != "1" and not(flag)):
            a.appendleft(query[i][2])
        else:
            a.append(query[i][2])
 
b = "".join(a)
if not(flag):
    b = b[::-1]
 
print(b)
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
print(a + b + c + (2**k - 1) * max(a, b, c))
# Judge status: Accepted
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def solve(a,b,c,counter=0):
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return counter
    elif a == b == c: 
        return -1
    else:
        return solve((b+c)//2,(c+a)//2,(a+b)//2,counter+1)


def main():
    A, B, C = map(int,input().split())
    print(solve(A,B,C))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N, K, q=map(int, input().split())
score=[0]*N

for i in range(q):
    tmp=int(input())
    score[tmp-1]+=1

for i in range(N):
    if K-(q-score[i])>0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
a, b = map(int, input().split())
ave = (a+b)/2
print(int(ave+0.5))
# Judge status: Accepted
a = list(map(int,input().split()))
count = 0
while max(a)-min(a) >= 2:
    count += (max(a)-min(a))//2
    a =sorted(a)
    if (a[-1]-a[0])%2 == 0:
        a[0] = a[-1]
    else:
        a[0] = a[-1] - 1
while max(a)!=min(a):
    a =sorted(a)
    a[0] += 1
    a[1] += 1
    count += 1
print(count)
# Judge status: Accepted
a,b=map(int,input().split())
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  return arr
def gcd(a,b):
  if b==0:
    return a
  return gcd(b,a%b)

g=gcd(a,b)
l=factorization(g)
print(len(l)+1)
# Judge status: Wrong Answer
n,k=map(int,input().split())
x=list(map(int,input().split()))

st=0
m=3*10**8
for i in range(n-1):
  if x[i]<0 and x[i+1]>=0:
    st=i+1

for i in range(n-k+1):
  mi=x[k+i-1]-x[i]+min(abs(x[k+i-1]),abs(x[i]))
  if k+i<st or i>st:continue
  if mi <m:m=mi
print(m if x[0]!=0 else m-1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
for i in [a,b,c]:
  if i==0:
    print(0)
    break
else:
  s=a*b*c/max(a,b,c)
  print(int(s))
# Judge status: Wrong Answer
N = int(input())
dic = {}
for i in range(1, N+1):
  n = i 
  cnt = 0
  while i % 2 == 0:
    cnt += 1
    i = i // 2
  dic[n] = cnt

a = 0
b = 0
for k, v in dic.items():
  if a < v:
    b = k
    a = v

print(b)
# Judge status: Wrong Answer
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())
ans = []
while n!=0 and n!=1:
    ans.append((-n)%2)
    n = -(n//2)
ans.reverse()
ans = [n]+ans
ans = [str(n) for n in ans]
print(''.join(ans))
# Judge status: Accepted
n = input()
m = n.split(" ")
 
x_min = int(m[0])
x_max = int(m[1])
y_min = int(m[2])
y_max = int(m[3])
 
a = x_min * y_min
b = x_min * y_max
c = x_max * y_min
d = x_max * y_max
 
if a >= b and a >= c and a >= d:
    print(a)
 
elif b >= a and b >= c and b >= d:
    print(b)
 
elif c >= a and c >= b and c >= d:
    print(c)
 
elif d >= a and d >= b and d >= c:
    print(d)
# Judge status: Accepted
n = int(input())
ans = [0,0,0,0]
for _ in range(n):
  s = input()
  if s == 'AC':
    ans[0] += 1
  elif s == 'WA':
    ans[1] += 1
  elif s == 'TLE':
    ans[2] += 1
  else:
    ans[3] += 1
print('AC x ' + str(ans[0]))
print('WA x ' + str(ans[1]))
print('TLE x ' + str(ans[2]))
print('RE x ' + str(ans[3]))
# Judge status: Wrong Answer
a = list(map(int,input().split()))
for i in range(len(a)):
  if a[i] == 0:
    print(i)
    break