peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
print('Possible' if sum(list(map(int, input().split())))%3==0 else 'Impossible')
# Judge status: Accepted
q,h,s,d=map(int,input().split())
n=int(input())
 
l=min(q*n*8,h*n*4,s*n*2,d*n)
if l != d*n:
    print(l//2)
else:
    m=min(q*4,h*2,s)
    print((d*(n-1))//2+m if n%2==1 else l//2)
# Judge status: Accepted
grid = [list(map(int, input().split())) for _ in range(3)]


for i in range(3):
    c = grid[i][0]
    for j in range(3):
        grid[i][j] -= c

ans = 'Yes' if grid[0] == grid[1] and grid[1] == grid[2] else 'No'
print(ans)
# Judge status: Accepted
n=int(input())
#print(sum([((n//i)*(i+(n//i*i))//2) for i in range(1,n+1)]))
ans=0
for i in range(1,n+1):
    ans+=((n//i)*(i+(n//i*i))//2)
print(ans)
# Judge status: Accepted
n = int(input())
s = list(input())
l = []
for i in range(n):
    l.append(len(set(s[:i]) & set(s[i:])))
print(max(l))
# Judge status: Accepted
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  if N == 0:
    print(0)
  else:  
    for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か
      zero_count += (N//2)//(5**i)
    print(int(zero_count))
# Judge status: Wrong Answer
import numpy as np
n,k=input().split()
n=int(n)
k=int(k)
clist=list(map(int,input().split()))

for i in range(len(clist[k:])):
  i=i+k
  x=np.prod(clist[i-k:i])
  if(x<((x*clist[i])//clist[i-k])):
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (2*b-a)%3!=0 or (2*a-b)%3!=0:
  print(0)
n=(2*b-a)//3
m=(2*a-b)//3
p = 10**9+7
def nCr(n,r):
    if r*2>n:
        return nCr(n,n-r)
    else:
        a = b = 1
        for i in range(r):
            a = a * (n - i) % p
            b = b * (r - i) % p
        return (a * pow(b,p-2,p)) % p

print(nCr((m+n),m))
# Judge status: Wrong Answer
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))

sum_a = sum(A)
ans = 0
for i,a in enumerate(A):
    if a > sum_a / (4 * M):
        ans += 1

if ans >= M:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
l=[int(input()) for i in range(4)]

if(l[0]>l[1]):
    a=l[1]*l[2]+(l[0]-l[1])*l[3]
else:
    a=l[0]*l[2]

print(a)
# Judge status: Accepted
A,B = map(int,input().split())
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
A,B,C,D = map(int,input().split())
 
if (A+D-1)//D >= (C+B-1)//B:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, x, y = map(int, input().split())

ans=[0] * n
for i in range(1, n+1):
    for j in range(i+1, n+1):
        dist1 = j-i
        dist2 = abs(x-i)+abs(y-j)+1
        d = min(dist1,dist2)
        ans[d] += 1
for i in range(1, n):
    print(ans[i])
# Judge status: Wrong Answer
n = int(input())
s = input()
ans = ''
for i in s:
  ans += chr((ord(i)+n-1 - ord('A'))%26 + 1 + ord('A'))
print(ans)
# Judge status: Wrong Answer
s = input()
q_number = int(input())
reverse_flag = 1
for i in range(q_number):
  temp = input().split()
  if temp[0] == "1": 
    reverse_flag = reverse_flag * -1
  else:
    if int(temp[1])*reverse_flag == 1 or -2:
      s = temp[2] + s
    else:
      s = s + temp[2]      
      
if reverse_flag == -1:
  s = s[::-1]
print(s)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

cnt = 0
increased = False
for i in range(n):
    if increased:
        increased = False
        continue

    if p[i] == i+1:
        cnt += 1
        i += 1
        increased = True

print(cnt)
# Judge status: Wrong Answer
N=int(input())
j=0

for i in range(1,N+1):
    if 2**i <=N:
        j=2**i

print(j)
# Judge status: Accepted
n=int(input())
if n&1:
    print((n+1)//2)
else:
    print(n//2)
# Judge status: Accepted
import itertools
N,D=map(int,input().split())
X=[]
for _ in range(N):
    X.append(list(map(int,input().split())))

n=[i for i in range(N)]
comb=itertools.combinations(n,2)
conunter=0

for c in comb:
    XI=X[c[0]]
    XJ=X[c[1]]
    total=0
    for d in range(D):
        total+=(XI[d]-XJ[d])**2
    total=total**0.5
    if(total.is_integer()):
        conunter+=1


print(conunter)
# Judge status: Wrong Answer
def ans():
    if t==0:
        return "N0"
    if d//s <=t:
        return "Yes"
    else:
        return "No"
        
d, s, t = map(int, input().split())
print(ans())
# Judge status: Accepted
# ABC084B

a, b = map(int, input().split())
s = input()
ans = 'Yes'
if s[a] != '-':
    ans = 'No'
else:
    for i, c in enumerate(s):
        if (c < '0' or c > '9') and i != a:
            ans = 'No'
            break
print(ans)
# Judge status: Accepted
n, k = map(int,input().split())
mod = 10 ** 9 + 7

ans = 0
for i in range(k, n+2):
    min_i = (i-1) * i // 2
    max_i = i * (2*n - i + 1) // 2
    ans += max_i - min_i + 1
    ans %= mod

print(ans)
# Judge status: Accepted
import math

n = int(input())
count = 0
p = n

for z in range(2, int(math.sqrt(n)) + 1):
    e = 1
    while n % z ** e == 0:
        n //= z ** e
        count += 1
        e += 1
    if n % z == 0: #これを行わなければ，素因数同士でかける場合も含んでしまう．
        while n % z == 0:
            n //= z

if n != 1:
    count += 1
if count == 0 and p != 1:
    count = 1

print(count)
# Judge status: Accepted
def main():
    N = int(input())
    di = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

    for _ in range(N):
        di[input()] += 1

    for k, v in di.items():
        print(f"{k} x {v}")


if __name__ == "__main__":
    main()
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())
for i in range(k):
    if b<=a: b*=2
    elif c<=b: c*=2
if a<b<c: print('Yes')
else: print('No')
# Judge status: Accepted
from fractions import gcd
from functools import reduce

n = int(input())
aaa = list(map(int, input().split()))
lcm = reduce(lambda a, b: a * b // gcd(a, b), aaa)
print(sum(lcm // a for a in aaa) % 1000000007)
# Judge status: Accepted
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split())) + [X]
y = list(map(int, input().split())) + [Y]
if min(y)-max(x) >= 1:
    print('No War')
else:
    print('War')
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
  print(N * X)
else:
  print(X * K + Y * (N - K))
# Judge status: Accepted
import collections


S = input()

C = collections.Counter(S)
ans = "No"
if C.most_common()[0][1] == 2 and C.most_common()[1][1] == 2:
    ans = "Yes"
print(ans)
# Judge status: Accepted
import math

N, K = map(int, input().split())
ans = 0

for i in range(1,N+1):
    tmp = math.log(K/i, 2)
    x = int(math.log(K/i,2))
    if i >= K:
        ans += 1/N
    else:
        if tmp - x != 0:
            x += 1
        ans += 1/N * (0.5)**x

print(ans)
# Judge status: Wrong Answer
import collections
n=int(input())
s=[input() for k in range(n)]
s1=[k for k in list(sorted(set(s))) if s.count(k)>1]
c=collections.Counter(s)
p=[]
for i in s1:
    p.append(c[i])
for j, x in enumerate(p):
    if(x == max(p)):
        print(s1[j])
# Judge status: Accepted
N = input()
if '9'in N:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x, y= map(int, input().split())
mod=10**9+7
import math
a=(2*y-x)//3
b=(2*x-y)//3

if (2*x-y)%3!=0 or (2*y-x)%3!=0 or a<0 or b<0:
	print(0)

else:
	L=[1]*(a+b+1)
	for i in range(1,a+b+1):
		L[i]=L[i-1]*i
		L[i]=L[i]%mod
	p=pow(L[a], mod-2, mod)
	q=pow(L[b], mod-2, mod)
	ans=(L[a+b]*p*q)%mod
	print(ans)
# Judge status: Wrong Answer
S = input()

highInt = int(S[0:2])
lowInt =int(S[2:4])

if highInt < 13 and lowInt < 13:
    ans = 'AMBIGUOUS'
elif highInt > 12 and lowInt > 12:
    ans = 'NA'
elif highInt < 13:
    ans = 'MMYY'
else:
    ans = 'YYMM'

print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())

if 500 * n > m:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
W,H,N=map(int,input().split())
xl,xr,yh,yl=0,W,H,0
for i in range(N):
    x,y,a=map(int,input().split())
    if a==1:
        xl=max(xl,x)
    elif a==2:
        xr=min(xr,x)
    elif a==3:
        yl=max(yl,y)
    elif a==4:
        yh=min(yh,y)
print(max((xr-xl)*(yh-yl),0))
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A==B:
  print('Draw')
elif A < B or B==1 and A!=1:
  print('Bob')
else:
  print('Alice')
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))

newv = sorted(v)

for i in range(n-1):
    newv[i+1] = (newv[i] + newv[i+1])/2

print(newv[n-1])
# Judge status: Accepted
N, K = map(int, input().split())
S = input()
ans = S[:K-1]+S[K-1].lower()+S[K:]
print(ans)
# Judge status: Accepted
from collections import deque


k = int(input())
queue = deque([i for i in range(1, 10)])

ans = 1
for _ in range(k):
    ans = queue.popleft()
    right_digit = ans % 10
    if right_digit == 0:
        queue.append(ans * 10 + right_digit)
        queue.append(ans * 10 + right_digit + 1)
    elif right_digit == 9:
        queue.append(ans * 10 + right_digit - 1)
        queue.append(ans * 10 + right_digit)
    else:
        queue.append(ans * 10 + right_digit - 1)
        queue.append(ans * 10 + right_digit)
        queue.append(ans * 10 + right_digit + 1)
print(ans)
# Judge status: Accepted
from math import ceil
N = int(input())
dia = [0]*(N-1)
for i in range(N-1):
    c,s,f = map(int,input().split())
    dia[i] = (c,s,f)
for i in range(N-1):
    time = 0
    for j in range(i,N-1):
        c,s,f = dia[j]
        if time > s:
            x = (time - s)/f
            s += ceil(x)*f
        time =  s + c
    print(time)
print(0)
# Judge status: Accepted
n = int(input())

total = 0
n = str(n)
for i in range(len(n)):
    total += int(n[i])

if total % 9 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b = Input()
    if a >= 13:
        print(b)
    elif 6 <= a <= 12:
        print(b//2)
    else:
        print(0)

main()
# Judge status: Accepted
number = input()
sum = 0

for i in range(3):
  if number[i] == '1':
    sum += 1
print(sum)
# Judge status: Accepted
N,W=map(int,input().split())
dp=[-1]*(W+1)
dp[0]=0
for _ in range(N):
    w,v=map(int,input().split())
    for i in range(W+1)[::-1]:
        if dp[i]!=-1 and i+w<=W:
            dp[i+w]=max(dp[i+w],dp[i]+v)
print(max(dp))
# Judge status: Accepted
l = list(map(int, input().split()))
l = sorted(l)

print(l[0] + l[1])
# Judge status: Accepted
N, M = map(int, input().split())
if N == 1:
    print(int((M*(M-1))/2))
elif M == 1:
    print(int((N*(N-1))/2))
else:
    print(int((N*(N-1))/2)+int((M*(M-1))/2))
# Judge status: Accepted
#ABC165
x = int(input())
a = 100
ans = 0
while a < x:
    a = a*101//100
    ans+=1
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    posi = [0, 0]
    time = 0
    txy = [[int(i) for i in input().split()] for _ in range(N)]
    for t, x, y in txy:
        move = abs(posi[0] - x) + abs(posi[1] - y)
        if (t - time) < move or (t - time) % 2 != move % 2:
            return print("No")
        time = t
        posi = [x, y]
    print("Yes")


if __name__ == '__main__':
    main()
# Judge status: Accepted
# import math
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter

import numpy as np
# import scipy as scp

# 入力の受け取り
s = input()

lis = ["Sunny","Cloudy","Rainy"]

idx = (lis.index(s) +1) % 3
ans = lis[idx]

print(ans)
# Judge status: Wrong Answer
num=int(input())
ans_list=[]
ans=400000
for i in range(2,num-1): 
	max_list=list(map(int,str(num-i)))  
	min_list=list(map(int,str(i)))
	tot=sum(max_list)+sum(min_list)
	ans=min(tot,ans)
print(ans)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = readline().strip()

    if '9' in N:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
w, h, n = map(int, input().split())
high = h
low = 0
left = 0
right = w


for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        left = max(left, x)
    elif a == 2:
        right = min(right, x)
    elif a == 3:
        low = max(low, y)
    else:
        high = min(high, y)

print(max(high - low, 0)*max(right - left, 0))
# Judge status: Wrong Answer
n =int(input())
a =list(map(int,input().split()))

ans =0
for i in range(1,n,2):
    if a[i]%2==1:
        ans +=1
print(ans)
# Judge status: Accepted
K=int(input())
S=input()
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")
# Judge status: Accepted
n = int(input())

a, b = [*map(list, zip(*[[*map(int, input().split())] for _ in range(n)]))]
a.sort()
b.sort()

l0, r0 = a[(n-1)//2], b[(n-1)//2]
if n % 2 == 1:
    print(r0-l0+1)
else:
    l1, r1 = a[n//2], b[n//2]
    print((r1+r0)-(l1+l0)+1)
# Judge status: Accepted
import math
a = list(map(int,input().split()))

flag = False
for i in range(1001):
  if math.floor(i*0.08) == a[0]:
    if math.floor(i*0.1) == a[1]:
      flag = True
      break

if flag:
  print(i)
else:
  print("-1")
# Judge status: Wrong Answer
A,V = map(int,input().split())
B,W = map(int,input().split())
N = int(input())
if W > V:
  print('No')
else:
  if abs(A-B) <= N*(V-W):
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
import bisect
N = int(input())
v = list(map(int,input().split()))
v.sort()

while len(v) > 1:
    l = v.pop(0)
    r = v.pop(0)
    t = (l+r)/2
    bisect.insort(v,t)
print(v[0])
# Judge status: Wrong Answer
c = input()
boin = 'aeiou'
if boin.find(c) == -1:
    print("consonant")
else:
    print("voel")
# Judge status: Accepted
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u==s:
    print(a-1, b)
else:
    print(a,b-1)
# Judge status: Accepted
N,M = map(int,input().split())
SC = [tuple(map(int,input().split())) for i in range(M)]

if N==1:
    r = range(0,10)
elif N==2:
    r = range(10,100)
else:
    r = range(100,1000)

for n in r:
    n = str(n)
    for s,c in SC:
        s -= 1
        if n[s] != str(c):
            break
    else:
        print(n)
        exit()
print(-1)
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
ans = 1
for i in range(1,N+1):
    ans *= i
    ans %= 10**9+7
print(ans)
# Judge status: Accepted
a,b = (int(i) for i in input().split())

ans = ""
roop = max(a,b)
min_num_str = str(min(a,b))

for i in range(roop):
  ans += min_num_str

print(ans)
# Judge status: Accepted
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
    t=list(map(int,input().split()))
    s.append(t)

for i in range(d):
    p=sorted(s[i])
    print(s[i].index(p[-3])+1)
# Judge status: Accepted
N, L = map(int, input().split())
S = []
for _ in range(N):
    S.append(input())
    
S = sorted(S)

choniki = str(S[0])

for i in range (1, N):
	choniki=choniki+S[i]

print(choniki)
# Judge status: Wrong Answer
s = input()
cnt_0, cnt_1 = s.count('0'), s.count('1')
print(max(cnt_0, cnt_1) - min(cnt_0, cnt_1))
# Judge status: Wrong Answer
N = int(input())
button = [int(input()) for _ in range(N)]
ans = 0
number = button[0]
while ans <= N + 5:
    number = button[number - 1]
    ans += 1
    if number == 2:
        print(ans + 1)
        exit()
print(-1)
# Judge status: Wrong Answer
f=0
N, M = map(int, input().split())
list = []
for i in range(M):
    a,b=input().split()
    list.append((int(a), int(b)))

for i in range(1000):
	f=0
	for j in range(M):
		if int(i/(10**(N-list[j][0])))%10 != list[j][1]:
			f=1
			break
	if f==0:
		print(i)
		break
		
if f==1:
	print(-1)
# Judge status: Wrong Answer
N = int(input())
ans = 0
prev = 0
for i in range(N):
  a = int(input())
  ans += a // 2
  if prev == 1 and a % 2:
    ans += 1
    a -= 1
  prev = a % 2
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = list(map(int, input().split()))
sum, c = 0, 0
for i in a:
	sum += i
for i in a:
	if sum / (m * 4) <= i:
		c += 1
if c > m:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
#065_C
n,m=map(int,input().split())
mod=10**9+7
f=[i for i in range(max(n,m)+1)]
for i in range(1,max(n,m)):
    f[i+1]=(f[i+1]*f[i])%mod
ans=0

if abs(n-m)==1:
    ans=(f[n]*f[m])%mod
elif n==m:
    ans=(f[n]**2)*2%mod
    
print(ans)
# Judge status: Wrong Answer
O = list(input())
E = list(input())
N = len(O)+len(E)
if len(O)>len(E):
    E += ' '
elif len(O)<len(E):
    O += ' '
print(E)
print(O)
answer = []
for i,j in zip(O,E):
    answer.append(i)
    answer.append(j)
print(''.join(answer))
# Judge status: Accepted
N, A, B = map(int, input().split())

total = 0
for i in range(1, N+1):
    nstr = str(i)
    s = 0
    for c in nstr:
        s += int(c)
    if A <= s <= B:
        total += i
print(total)
# Judge status: Wrong Answer
X, Y, Z = map(int, input().split())
data = [X, Y, Z]
data[0] = Z
data[1] = X
data[2] = Y
print(data)
# Judge status: Accepted
def dfs(n, i, s, maxi):
    global ans
    maxi = max(i, maxi)
    s += chr(i)
    if n == N:
        ans += [s]
        return
    for ii in range(97, maxi+2):
        dfs(n+1, ii, s, maxi)

N = int(input())
i = 97
ans = []
dfs(1, 97, '', 97)
ans = sorted(ans)
for a in ans:
    print(a)
# Judge status: Accepted
N=int(input())
coins = [100,101,102,103,104,105]
dp = [int(i%coins[0]==0) for i in range(N+1)]
for coin in coins[1:]:
  for i in range(coin,N+1):
    dp[i] += dp[i - coin]
if dp[-1] != 0:
  print(1)
else:
  print(0)
# Judge status: Accepted
l = int(input())
x = l/3
print(x**3)
# Judge status: Accepted
d, n = map(int, input().split())
if n < 100:
    print(n * (100 ** d))
else:
    print((n + 1) * (100 ** d))
# Judge status: Wrong Answer
import sys
a,b = map(int,input().split())
s = input()

if not s[:a].isdigit() or not s[a]=='-' or  not s[a+2:].isdigit():
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N=int(input())
S=input()
r = S.count("R")
g = S.count("G")
b = S.count("B")
out =r*g*b

for i in range(0,N):
    w = 1
    while i+w*2<N:
        if S[i]!=S[i+w] and S[i]!=S[i+2*w] and S[i+w]!=S[i+2*w]:
            out = out -1
        w = w+1
        
print(out)
# Judge status: Wrong Answer
a = input()

if a.isupper():
    print(a.upper())
elif a.islower():
    print(a.lower())
# Judge status: Accepted
N = input()
c = N[0]
K = len(N)

temp = int(c + "9"*(K-1))
temp_s = sum(int(a) for a in list(str(temp)))

if temp <= int(N):
    print(temp_s)
else:
    print(temp_s - 1)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N, x = map(int, input().split())
    a_list = list(map(int, input().split()))
    ans = 0
    for a in sorted(a_list):
        if a <= x:
            ans += 1
            x -= a
        else:
            break
    if x == 0 or ans != N:
        print(ans)
    else:
        print(max(ans - 1, 0))

if __name__ == '__main__':
    main()
# Judge status: Accepted
num = list(input())
n = len(num) - 1

for i in range(2**n):
    temp = [0]*(len(num)+n)
    lst = ["-"]*n
    for j in range(n):
        if i&(1<<j):
            lst[j] = "+"
    temp[::2] = num
    temp[1::2] = lst
    wa = eval("".join(temp[:]))
    if wa == 7:
        print("".join(temp[:]) + "=7")
        exit()
# Judge status: Accepted
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
sorted_ab = sorted(ab, key=lambda AB: AB[1])
ans = 'Yes'
t = 0
for AB in sorted_ab:
  t += AB[0]
  if t > AB[1]:
    ans = 'No'
    break

print(ans)
# Judge status: Accepted
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    As = sorted(A)

    res = 0

    for i in range(1,N):
        res += As[N-1-i//2]

    print(res)



main()
# Judge status: Accepted
from heapq import heapify,heappop,heappush
N,M=map(int,input().split())
item=[list(map(int,input().split())) for i in range(N)]
item.sort(key=lambda x:x[0])
que=[]
heapify(que)
ans=0
j=0
for i in range(1,M+1):
    while(j<N and item[j][0]<=i):
        heappush(que,-item[j][1])
        j+=1
    if que:
        ans+=-heappop(que)
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
N = [1]*n
P = [1] + [0]*(n-1)
for i in range(m):
    x, y = list(map(lambda tmp: tmp-1, map(int, input().split())))
    P[y] = (P[y]*N[y]+P[x])/(N[y]+1)
    N[x] -= 1; N[y] += 1
    P[x] = 0 if N[x]==0 else P[x]
print(sum(map(bool, P)))
# Judge status: Accepted
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

Counter_S = Counter(S)
Counter_T = Counter(T)
Counter_plus = Counter_S - Counter_T
if len(Counter_plus.values()):
    print(max(Counter_plus.values()))
else:
    print(0)
# Judge status: Wrong Answer
T = input()
k = 0

for i in range(len(T)):
  if T[i] == '?':
    T[i] == 'D'
print(T)
# Judge status: Wrong Answer
#!/usr/bin/env python3

N = int(input())
d = {}
for i in range(N):
    a = int(input())
    if a in d:
        d[a] = 0
    else:
        d[a] = 1
cnt = 0
for a in d:
    if d[a]:
        cnt += 1
print(cnt)
# Judge status: Accepted
N,K = map(int, input().split())
A = list(map(int, input().split()))

l,r = 1,max(A)
while l<r:
	m = (l+r)//2
	s = sum([a//m+(not a%m==0)-1 for a in A])
	if s <= K:
		r = m
	else:
		l = m+1
print(r)
# Judge status: Accepted
c = []
for _ in range(3):
    l = list(map(int, input().split()))
    c += l

n = int(input())
for _ in range(n):
    m = int(input())
    if m in c:
        c[c.index(m)]=0

if c[0]==c[1]==c[2]==0 or c[3]==c[4]==c[5]==0 or c[6]==c[7]==c[8]==0 or c[0]==c[3]==c[6]==0 or c[1]==c[4]==c[7]==0 or c[5]==c[8]==c[2]==0 or c[0]==c[4]==c[8]==0 or c[2]==c[4]==c[6]==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
former=0
ans=0
for i in range(0,N):
    a=int(input())
    if former==0:
        former=a%2
        ans+=a//2
    else:
        if a%2==0:
            if a!=0:
                former=1
                ans+=a//2
            else:
                former=0
        else:
            former=0
            ans+=a//2+1

print(ans)
# Judge status: Accepted
s = input()
ans = 0
cnt = 0
for i in s:
    if i == "S":
        cnt += 1
    else:
        if cnt:
            ans += 1
            cnt -= 1
print(len(s) - (2*ans))
# Judge status: Accepted
MOD = 10 ** 9 + 7
n = int(input())
print((pow(10, n, MOD) - pow(9, n, MOD) - pow(9, n, MOD) + pow(8, n, MOD)) % MOD)
# Judge status: Wrong Answer
x=int(input())

if x==7 or x==5 or x==3:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
H,M,h,m,K=map(int,input().split())
print((h-H)*60+m-M-K)
# Judge status: Accepted
S = input()
# L = len(S) % 2
youtube = 0

for i in range(len(S)):
  if i % 2 == 0: # 奇数
    if S[i] == "L":
      youtube += 1
  else:#偶数
    if S[i] == "R":
      youtube += 1
if youtube > 0:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
n,m=map(int,input().split())
MOD=10**9+7
ans = 1
if abs(n-m) > 1:
  print(0)
else:
  if abs(n-m) == 0:
    for i in range(1,n+1):
      ans = ans*i%MOD
    for i in range(1,m+1):
      ans = ans*i%MOD
    ans = ans*2%MOD
  else:
    for i in range(1,n+1):
      ans = ans*i%MOD
    for i in range(1,m+1):
      ans = ans*i%MOD
print(ans)
# Judge status: Wrong Answer
S, T =map(str, input().split())
A, B =map(int, input().split())
U = input("")

if U == "red":
    A += -1
else:
    B += -1

print(A, B)
# Judge status: Accepted
import math

n, d = map(int, input().split())
ans = math.ceil(n / (2*d+1))
print(ans)
# Judge status: Accepted
S = str(input())

print(S.replace('7', '8', 1))
# Judge status: Accepted
def actual(a, b, x):
    if a <= x <= a + b:
        return 'YES'

    return 'NO'

a, b, x = map(int, input().split())
print(actual(a, b, x))
# Judge status: Wrong Answer
a = list(map(int,input().split()))

max = a[0]*a[2]
if max < a[0]*a[3]:
    max = a[0]*a[3]
if max < a[1]*a[2]:
    max = a[1]*a[2]
if max < a[1]*a[3]:
    max < a[1]*a[3]

print(max)
# Judge status: Wrong Answer
N,x = map(int,input().split())
a = list(map(int,input().split()))
count = 0
#昇順に並べ替える
sort_a = sorted(a)

for i in range(len(a)):
    if x >= sort_a[i]:
        count += 1
        x -= sort_a[i]
        continue
    else:
        continue
    break
print(count)