peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a,b = map(int,input().replace(".","").split())
print(a*b//100)
# Judge status: Accepted
n, d = map(int, input().split())

ans = n / (2 * d + 1)
if ans == int(ans):
    print(int(ans))
    exit()
else:
    print(int(ans) + 1)
    exit()
# Judge status: Wrong Answer
from collections import Counter

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

cnt = Counter(a)

s = sum(cnt)

for i in range(q):
	b, c = map(int, input().split())
	s = s - b*cnt[b]
	s = s + c*cnt[b]
	cnt[c] += cnt[b]
	cnt[b] = 0
	print(s)
# Judge status: Accepted
n,l=map(int,input().split())
no=1000
num=0
for i in range(n):
    if abs(l+i)<no:
        no=abs(l+i)
        num=i
ans=0
for i in range(n):
    ans+=l+i
ans=ans-l-num
print(ans)
# Judge status: Accepted
a , b =input().split()
 
if a <= b:
    print(a*int(b))
else:
	print(b*int(a))
# Judge status: Accepted
import math

n = int(input())
cap = []
for _ in range(5):
    cap.append(int(input()))

print(math.ceil(n/min(cap))+4)
# Judge status: Accepted
N,M = map(int,input().split())
if N == M:
		print('Yes')
else:
		print('No')
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
ans="NO"
for i in range(1,101):
    if i%A==0:
        if i%B==C:
            ans='YES'
            break
    else:
        continue
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())

cnt = 1
p = a

while p < b:
    p += a - 1
    cnt += 1
    
print(cnt)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
ans = 0
for i in range(1,n):
    if lst1[i-1]+lst1[i] > m:
        res = max(0,m-lst1[i-1])
        ans += lst1[i]-res
        lst1[i] = res

if lst1[0]+lst1[1] > m:
    ans += lst1[0]-m

print(ans)
# Judge status: Accepted
def divisor(n):
    i = 1
    res = set()
    for i in range(1, int(n**.5) + 1):
        if n%i == 0:
            res.add(i)
            res.add(n//i)
    return res

def main():
    n, m = map(int, input().split())
    md = list(divisor(m))
    md.sort(reverse=True)
    for i in md:
        if i*n <= m:
            print(i)
            exit()

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
a = 0
for i in range(1,10):
  if n%i==0 and n%i<10:
    a = 1
    break
print('Yes' if a==1 else 'No')
# Judge status: Wrong Answer
import math
X, Y = list(map(int, input().split()))

val = 2
i = 1
while True:
    val = 2**i
    if val > 2*Y/X:
        break
    i += 1

print(i-1)
# Judge status: Accepted


n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort(reverse=True)

t_b = t[0]
cnt = 0
ans = 0

for i in t:
    # print(i, t_b, cnt, ans)
    if t_b - i <= k and cnt + 1 <= c: # 差がk以下で人数に余裕がある
        cnt += 1
        continue
    else:
        t_b = i
        cnt = 1
        ans += 1

print(ans + 1)
# Judge status: Accepted
n, k = map(int, input().split())

h_list = []
for _ in range(n):
    h = int(input())
    h_list.append(h)

h_list.sort()

ans = 10000000000
for i in range(n-k+1):
    tmp = abs(h_list[i]-h_list[i+k-1])
    if ans > tmp:
        ans = tmp

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = list(input())
m = 0
c1, c2 = 0, 0
for i in range(n):
    if s[i] == ")":
        m += 1
        c2 = c1
    else:
        c1 += 1
j = 0
while True:
    if j == n:
        break
    if s[j] == "(":
        break
    j += 1
l = max((m - c2), j)
s1 = ["("] * l
for i in s:
    if i == "(":
        l += 1
    else:
        l -= 1
s2 = [")"] * l
s = s1 + s + s2
print("".join(s))
# Judge status: Accepted
#7  Integer Cards
n,m = map(int,input().split())
a = list( map(int,input().split()))
bc=[[0]*2 for _ in range(m)]
for i in range(m):
    bc[i] = list(map(int,input().split()))

a.sort()
bc.sort(reverse=True,key=lambda x:x[1])

nokori=n
bc2=[]
for (bb,cc) in bc:
    if bb<=nokori:
        bc2.extend([cc]*bb)
        nokori-=bb
    else:
        bc2.extend([cc]*nokori)
        nokori=0
        break

print( sum(sorted(a+bc2,reverse=True)[:n]) )
# Judge status: Accepted
def main():
  s=input()
  #while s%10==0:
  #    s//=10
  #s=9**100
  #s=str(s)
  lens=len(s)

  d=int(s[0])
  p=11-int(s[0])

  for c in s[1:]:
      j=int(c)
      a=min(d+j,p+j)
      b=min(d+11-j,p+9-j)
      d,p=a,b

  print(min(d,p))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
ans = 0
if 100 <= n <= 111:
  ans = 111
elif 112 <= n <= 222:
  ans = 222
elif 223 <= n <= 333:
  ans = 333
elif 334 <= n <= 444:
  ans = 444
elif 445 <= n <= 555:
  ans = 555
elif 556 <= n <= 666:
  ans = 666
elif 667 <= n <= 777:
  ans = 777
elif 778 <= n <= 888:
  ans = 888
elif 889 <= n <= 999:
  ans = 999
print(ans)
# Judge status: Accepted
a,b,c = map(int, input().split())
if ((a == b ) + (b == c ) + (c==a))==1:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    xy = [list(map(int, rl().split())) for _ in range(N)]
    xy.sort(key=lambda n: sum(n))
    ans = sum(xy[-1]) - sum(xy[0])
    print(ans)


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
n = int(input())

yesterday = "d"
happiness = 0
for i in range(n):
  point = list(map(int,input().strip().split()))
  if yesterday == 0:
    point[0] = 0
  elif yesterday == 1:
    point[1] = 0
  elif yesterday == 2:
    point[2] = 0
  yesterday = point.index(max(point))
  happiness += max(point)
print(happiness)
# Judge status: Accepted
n = int(input())

count = 0
for i in range(1, n+1):
    if i % 2 == 1:
        yaku = 0
        for j in range(1, i+1):
            if i % j == 0:
                yaku += 1
        if yaku == 8:
            count += 1
print(count)
# Judge status: Accepted
x,y,z = map(int, input().split())
if (z+y)%2==1:
        d = min(y + z - 2, 2*x-y-z)+1
        print(d//2)
else:
	print((abs(y-z)+1)//2)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
baisu = [0,0,0]
flag = 0

for i in a:
    if i % 4 == 0:
        baisu[2] += 1
    elif i % 2 == 0:
        baisu[1] += 1
    else:
        baisu[0] += 1

if baisu[0] == 0 and (baisu[2] != 0 or baisu[1] != 1):
    flag = 1

while baisu[2] != 0:
    baisu[2] -= 1
    baisu[0] -= 2

if baisu[1] > 0:
    baisu[0] += 1

if baisu[0] < 1 or flag == 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s=input()
n=len(s)
odd=[s[i] for i in range(0,n,2)]
even=[s[i] for i in range(1,n,2)]
if "L" in odd:
  print("No")
elif "R" in even:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
k = int(input())
o = (k + 1) // 2
e = k // 2
print(o * e)
# Judge status: Wrong Answer
x = int(input())
flag = False
for a in range(0, 100):
  for b in range(-100, 1000):
    if a**5-b**5 == x:
      print(a, b)
      flag = True
      break
  if flag:
    break
# Judge status: Accepted
A, B, X = map(int, input().split())

if A <= X <= (A + B):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x % 10)
        x = int(x /10)
        #print(keta_wa,x)
    
    if a <= keta_wa <= b:
        ans += i 

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
 
eight = 0
one = 0
two = 0
 
 
for i in A:
    if i%4 == 0:
        eight = eight + 1
    if i == 1:
        one = one + 1
    if i % 2 == 0:
        two = two + 1
 
if len(A)//2 <= eight:
    print("Yes")
elif (len(A)//2) <= (eight + (two//2)):
    print("Yes")
 
elif (eight >= one) and (eight + one +(two//2)) > (len(A)//2):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [-1] * N
dp[0] = 0

inf = 100000

for i in range(1, N):
    mindp_i = inf

    for jump in range(1, min(i, K) + 1):
        dpcand = dp[i - jump] + abs(h[i] - h[i - jump])
        if dpcand < mindp_i:
            mindp_i = dpcand

    dp[i] = mindp_i

print(dp[N-1])
# Judge status: Wrong Answer
D,T,S=map(int,input().split())
if D*S>T:
	print("No")
else:
	print("Yes")
# Judge status: Accepted
n=int(input())
v=list(map(int,input().split()))
v.sort()
bkv=(v[0]+v[1])/2
if n!=2:
  for i in range(1,n-1):
    bkv=(bkv+v[i+1])/2
print(bkv)
# Judge status: Accepted
s=input()
data=[]
for i in range(len(s)):
  if s[i]=='0':
    data.append('0')
  elif s[i]=='1':
    data.append('1')
  else:
    if len(data)==0:
      continue
    else:
      data.pop()
print(*data,sep='')
# Judge status: Accepted
N, M = map(int, input().split())

bs = [True for i in range(N+1)]
for i in range(M):
    a = int(input())
    bs[a] = False

dp = [0 for i in range(N+1)]
dp[0] = 1
if bs[1] != False: dp[1] = 1

for i in range(2,N+1):
    if bs[i-1] != False:
        dp[i] += dp[i - 1]
    if bs[i - 2] != False:
        dp[i] += dp[i - 2]

print(dp[N] % 1000000007)
# Judge status: Accepted
import math

a, b, x = map(int, input().split())
if 2*x <= a*a*b:
    t = math.atan((a*b*b)/(2*x))
else:
    t = math.atan(2*(a*a*b-x)/(a*a*a))

print(180*t/math.pi)
# Judge status: Accepted
# 初期入力
import sys
input = sys.stdin.readline

#
S =input().strip()
ans =S[:3]
print(ans)
# Judge status: Wrong Answer
import sys
X = int(input())
b = 0
if X**(1/5) == int(X**(1/5)):
    print("{0} {1}".format(int(X**(1/5)),0))
    sys.exit(0)
b = 1
if (X+1)**(1/5) == int((X+1)**(1/5)):
    print("{0} {1}".format(int((X+1)**(1/5)),1))
    sys.exit(0)
b = -1
if (X-1)**(1/5) == int((X-1)**(1/5)):
    print("{0} {1}".format(int((X-1)**(1/5)),-1))
    sys.exit(0)
# Judge status: Wrong Answer
print('YNeos'[int(input())%50>int(input())::2])
# Judge status: Accepted
import sys
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]
X = sorted(X, key=lambda x:x[1])
t = 0
for x in X:
    t += x[0]
    if t > x[1]:
        print('No')
        sys.exit()
print('Yes')
# Judge status: Wrong Answer
N = int(input())
L_list = list(map(int, input().split()))

if max(L_list) * 2 > sum(L_list):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())
x=[int(x) for x in input().split()]
s=x[0]
for i in range(1,len(x)):
	s=s^x[i]
z=[]
for i in range(len(x)):
	z.append(s^x[i])
print(*z)
# Judge status: Accepted
k=int(input())
s=input()
if len(s)<=k:
  print(s)
else:
  print(s[:k]+'...')
# Judge status: Wrong Answer
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    NI = lambda : int(sys.stdin.readline())

    N = NI()

    ans = N * (N-1) - 1
    for i in range(2,int(math.sqrt(N))+1):
        ans += i*i
        j = i + 1
        while i * j <= N:
            ans += 2 * i * j
            j += 1

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
d = list(map(int, input().split()))
e = [0 for i in range(n)]
if d[0] > 0:
    exit(print(0))
for i in d:
    e[i] += 1
ans = 1
for i in range(1, n):
    ans *= e[d[i] - 1]
    ans %= 998244353
print(ans)
# Judge status: Accepted

ma = lambda : map(int,input().split())
ni = lambda : int(input())

a,b = ma()
s = input()
if s[:a].isdecimal() and s[a] =="-" and s[a+1:].isdecimal():
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
s = input()

ans = 3*(10**5)
to_east = 0
to_west = s.count('E', 1)

for i in range(1, n):
  ans = to_east+to_west if ans>to_east+to_west else ans
  if s[i-1]=='W':
    to_east += 1
  if s[i]=='E':
    to_west -= 1

  
print(ans)
# Judge status: Accepted
import itertools
from collections import defaultdict

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


seq = list(range(1, M+1))
dlist = defaultdict(list)
dres  = defaultdict(int)
Na    = 0

for i,v in enumerate(itertools.combinations_with_replacement(seq, N)):
    dlist[i] = v
    Na += 1


for i in range(Q):
    ai, bi, ci, di = map(int, input().split())
    for j in range(Na):
        tmp = dlist[j]
        if tmp[bi-1] - tmp[ai-1] == ci:
            dres[j] += di
print(max([dres[i] for i in range(Na)]))
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = input()

s = S[0]
count = 0
k = 0
for i in range(1, len(S)):
    #print(S[i], s)
    if s == S[i]:
        count += 1
    else:
        s = S[i]
        k += 1
        
if K > k:
    count += k * 2
elif K < k:
    count += K * 2
else:
    count += K * 2 - 1
print(count)
# Judge status: Wrong Answer
K=int(input())
temp=0
for i in range(1,10**6+1):
  t="7"*K
  r=int(t)%K
  if(r%K==0):
    print(i)
    temp=1
    break
if(temp==0):
  print(-1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)[::-1]
ans = sum(a[1:2*n:2])
print(ans)
# Judge status: Wrong Answer
a,b = map(int,input().split())
i = 0
while a+(a-1)*i <b:
  i += 1
print(i+1)
# Judge status: Accepted
n, l = map(int,input().split())
a = [input() for i in range(n)]
a.sort()
print("".join(a))
# Judge status: Accepted
from math import sqrt

n = int(input())

i = 2

c = []

while i*i <= n:
    j = 0
    while n%i == 0:
        j += 1
        n //= i   
    else:
        if j != 0:
            c.append(j)
    i += 1
if n > 1:
    c.append(1)
             
d = 0        
if c == []:
    print(d)
else:
    for k in c:
        d += int((sqrt(1 + 8*k)-1)/2)
    print(d)
# Judge status: Accepted
S=list(input())

s=0
f=0
g=0
h=0
for i in range(len(S)):
    if S[i]==">":
        g=0
        f+=1
        if h>=f:
            s+=f-1
        else:
            s+=f
        
    else:
        f=0
        g+=1
        s+=g
        h=g

print(s)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
count = 0
for i in range(N):
  if A[i] - B[i] < 0:
    count += A[i]
    B[i] -= A[i]
    if A[i+1] - abs(A[i] - B[i]) < 0:
      count += A[i+1]
      A[i+1] = 0
    else:
      count += B[i]
      A[i+1] -= abs(A[i] - B[i])
  elif A[i] - B[i] == 0:
    count += A[i]
  else:
    count += B[i]
print(count)
# Judge status: Accepted
#n, m = map(int,input().split())
x = int(input())
#hl = list(map(int,input().split()))

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)
elif 1800 <= x <= 1999:
    print(1)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

t = [0]*101
for i in range(a, b):
    t[i] += 1

for i in range(c, d):
    t[i] += 1

ans = 0
for _t in t:
    if _t == 2:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
p = input()
q = input()

import itertools
x = [str(i) for i in range(1,n+1)]

y = []
for i in itertools.permutations(x):
    y.append(''.join(i))

p = list(p)
q = list(q)
p = [a for a in p if a != ' ']
q = [a for a in q if a != ' ']
p = ''.join(p)
q = ''.join(q)
#print(p,q,y)
print(abs(y.index(p) - y.index(q)))
# Judge status: Wrong Answer
n=int(input())
k=int(input())
x=int(input())
y=int(input())
ans = k*x
if k <= n:
    ans += (n -k)*y
print(ans)
# Judge status: Wrong Answer
s = input().split()

for c in s:
  print("x", end="")
# Judge status: Accepted
x, y, z = map(int, input().split())
count = 1
if x != y:
    count += 1
if x != z and y != z:
    count += 1
print(count)
# Judge status: Accepted
from collections import defaultdict
N, M = map(int, input().split())
tmp = [list(set(list(map(int, input().split()))[1:])) for _ in range(N)]

d = defaultdict(int)
for i in range(N):
    for j in range(len(tmp[i])):
        d[tmp[i][j]] += 1
print(list(d.values()).count(N))
# Judge status: Accepted
K = int(input())
L = 0
if K % 7 == 0:
  L = 9*K//7
else:
  L = 9*K
  
ans = -1
s = 10
for i in range(1,L,1):
  if s % L == 1:
    ans = i
    break
  s = s % L * 10
print(ans)
# Judge status: Wrong Answer
def __input__():
    X = str(input("―― "))
    em = 0
    Return = []
    for spam in range(len(X)):
        if X[spam] == " ":
            Return.append(int(X[em:spam]))
            em = spam+1
    Return.append(int(X[em:]))
    return Return
l = __input__();x = 1
for a in l:
    x = x * a
print(x)
# Judge status: Wrong Answer
s=input()
if len(s) == len(set(s)):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    line = list(map(int, input().split()))
    a += line
a_set = set(a)
cnt = 0
for i in range(1,n+1):
    if not i in a_set:
        cnt += 1
print(cnt)
# Judge status: Accepted

def main():
    N,D = map(int, input().split())
    print(-(-N//(2*D+1)))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
#総価値、現金、株数
dp = [[1000,1000,0] for i in range(N+1)]
for i in range(N):
    dp[i+1][0] = max(dp[i][0],dp[i][1]+dp[i][2]*A[i])
    dp[i+1][1] = dp[i+1][0] % A[i]
    dp[i+1][2] = dp[i+1][0] // A[i]
print(dp[N][0])
# Judge status: Accepted
# A - Favorite Sound
A,B,C=list(map(int,input().split()))

D=B//A

if C>D:
    print(D)
else:
    print(C)
# Judge status: Accepted
num_s, *D,  = [s.split() for s in open(0)]
flag = 0
D  = [d[0] for d in D]
pw = D[0]
if len(D) != len(set(D)):
    flag += 1
else:
    for i in range(1, len(D)):
        w = D[i]
        if pw[-1] != w[0]:
            flag += 1
            break 
        pw = w 
        
if flag:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
s = input()
t = input()
s_lst = [i for i in s]
ans = 0
for i in range(len(s_lst)):
    tmp = s_lst[len(s_lst)-1]
    s_lst.pop()
    a = []
    a.append(tmp)
    for j in s_lst:
        a.append(j)
    s_lst = a
    b = "".join(a)
    if b == t:
        ans += 1
if ans >=1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
l.sort()
print(sum(l[n:2*n]))
# Judge status: Accepted
s=input()

if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print('Bad')
else:
  print('Good')
# Judge status: Accepted
n=int(input())
x=0
while True:
    if (x+1)**5-x**5>10**9:
        x+=1
        break
    x+=1
for i in range(-x,x):
    for j in range(-x,x):
        if i**5-j**5==n:
            print(i,j)
            exit()
# Judge status: Wrong Answer
N=int(input())
print("ABC" if N<=1000 else "ABD")
# Judge status: Accepted
a,b = map(int, input().split())
if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
x,a,b=map(int, input().split())
if abs(x-a) > abs(b-x):
  print('B')
else:
  print('A')
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
print(max(0,(n-1)*(b-a)+1))
# Judge status: Accepted
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if n >= m:
    print(0)
    exit()
l = [0 for _ in range(m-1)]
for i in range(m-1):
    l[i] = x[i+1] - x[i]
l.sort(reverse=True)
print(sum(l[n-1:]))
# Judge status: Wrong Answer
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    ans = float("inf")
    if r - l >= 2500:
        ans = 0
    else:
        for i in range(l, r):
            ans = min((i*(i+1) % 2019), ans)
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import math
a = list(map(int, input().split()))
print(math.ceil(a[0]/(a[1]*2+1)))
# Judge status: Accepted
n = int(input())

ls = []
rs = []
for _ in range(n):
    x, y = map(int, input().split())
    ls.append(x)
    rs.append(y)

ls = sorted(ls)
rs = sorted(rs)

if n % 2 == 1:
    print(rs[len(rs)//2] - ls[len(ls)//2] + 1)
else:
    a = (rs[len(rs)//2-1] * 10 + rs[len(rs)//2] * 10) // 2
    b = (ls[len(ls)//2-1] * 10 + ls[len(ls)//2] * 10) // 2
    print((a - b) // 5 + 1)
# Judge status: Wrong Answer
A,B,C=[int(s) for s in input().split(" ")]

A=[A]
B=[B]
C=[C]

Count=0
for i in range(1000):
    A.append(B[i]/2+C[i]/2)
    B.append(A[i]/2+C[i]/2)
    C.append(B[i]/2+A[i]/2)
    Count+=1
    if A[i+1]%2!=0 or B[i+1]%2!=0 or C[i+1]%2!=0:
        break
    if Count>=1000:
        Count=-1

print(Count)
# Judge status: Accepted
s = input()
 
print(s.rfind("Z") - s.find("A") + 1)
# Judge status: Wrong Answer
N, K = map(int, input().split())

max_n = 0
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    max_n = max(max_n, d)

print(N - max_n)
# Judge status: Wrong Answer
n = int(input())
aa = list(map(int,input().split()))

d2 = 0
d4 = 0

for ai in aa:
  if ai % 4 == 0:
    d4 += 1
  elif ai % 2 == 0:
    d2 += 1
  else:
    pass  

if d2<=1:
  d2=0

dd = (d4*2 +1) + d2
if d4==0:
  dd -= 1
  
if dd >= n :
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, K= map(int, input().split())
A = list(map(int, input().split()))

print(-(-(N-K)//(K-1))+1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
now_number = 0
now_count = 0

for i in range(n):
  if a[i] == now_number+1:
    now_number = a[i]
    now_count = i

if now_number == 0:
  print(-1)
else:
  print(now_count+1 - now_number)
# Judge status: Accepted
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    c = collections.Counter(a)
    box = []
    for i in c:
        if c[i] >= 2:
            for _ in range(c[i]//2):
                box.append(i)
    if len(box) < 2:
        print(0)
    else:
        box.sort(reverse=True)
        print(box[0]*box[1])
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
D = {}
D["A"] = input()
D["B"] = input()
D["C"] = input()

t = "A"
while 1:
    if len(D[t]) == 0:
        winner = t
        break
    if D[t][0] == "a":
        u = "A"
    elif D[t][0] == "b":
        u = "B"
    elif D[t][0] == "c":
        u = "C"
    D[t] = D[t][1:]
    t = u
print(winner)
# Judge status: Accepted
import math
e=[int(input()) for i in range(6)]
ans=5+math.ceil(e[0]/min(e[1:])-1)
print(ans)
# Judge status: Accepted
s, w = list(map(int, input().split()))

if s <= w:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
x = int(input())
print("Christmas"+" Eve"*(25-x))
# Judge status: Accepted
N=int(input())
v=sorted(list(map(int,input().split())))
s=v[0]
for i in range(N-1):
    s=(s+v[i+1])/2
print(s)
# Judge status: Accepted
n = int(input())

if n >= 30:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())

l = 0

for i in range(n):
  if i % 3 != 0 and i % 5 != 0:
    l += i
print(l)
# Judge status: Accepted
n = int(input())
dlist = list(map(int, input().split()))

dlist_sorted = sorted(dlist)

kiwa_upper = dlist_sorted[n//2]
kiwa_low = dlist_sorted[(n//2)-1]

# 同じ数の選び方が存在しない場合
if len(dlist_sorted[n//2:]) != n//2:
    print(0)
# 存在する場合
else:
    print(kiwa_upper - kiwa_low)
# Judge status: Wrong Answer
import numpy as np
N,M = map(int,input().split())
A = [[int(i) for i in input().split()] for _ in range(N)]

ans=-1
for i in range(1,M+1):
    count=0
    for j in range(N):
        if not i in A[j]:
            break
        else:
            count+=1
        if count==N:
            ans+=1
print(ans)
# Judge status: Accepted
N, P = map(int, input().split())
A = list(map(int, input().split()))
def comb(x, y):
  m = c = 1
  for i in range(y):
    m *= x-i
    c *= y-i
  return m//c
even = odd = 0
for a in A:
  if a%2 == 0:
    even += 1
  else:
    odd += 1
if P == 0:
  ans = 0
  for i in range(0, odd+1, 2):
    ans += comb(odd, i)
  print(pow(2, even) * ans)
else:
  ans = 0
  for i in range(1, odd+1, 2):
    ans += comb(odd, i)
  print(pow(2, even) * ans)
# Judge status: Wrong Answer
import numpy as np


def check_bingo(A):
    for i in range(3):
        if not np.all(A[i]) or not all(A[:, i]):
            return 'Yes'
    if not np.all(A[list(range(3)), list(range(3))]):
        return 'Yes'

    return 'No'


def main():
    A = np.array([list(map(int, input().split())) for _ in range(3)])
    n = int(input())
    for i in range(n):
        b = int(input())
        A = np.where(A == b, 0, A)
    ans = check_bingo(A)
    print(ans)


if __name__ == '__main__':
    main()