peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import collections as c
N = int(input())
d = list(map(int, input().split()))
D = c.Counter(d)
mod = 998244353
cnt = 0
ans = 1
DD = sorted(list(D.keys()))
for i in DD:
	if i != cnt:
		ans = 0
		break
	if i == 0:
		if D[0] != 1:
			ans = 0
			break
		else:
			cnt += 1
			continue

	n = D[cnt-1]
	m = D[cnt]

	for _ in range(m):
		ans *= n
		ans %= mod

	cnt += 1

print(ans)
# Judge status: Accepted
#ABC047 A

s = sorted(list(map(int,input().split())))
if s[0] + s[1] == s[2] or s[0] == s[1] + s[2]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n= int(input())

list1= input().split()
list2=list(set(list1))
for i in range(n):
	if i+1 in list2:
		a=list.count(i+1)
		cnt+=a
		print(a)
	else:
		print(0)
# Judge status: Accepted
S=input()
K=int(input())
for i in range(K):
    if S[i]=="1":
        continue
    else:
        print(S[i])
        exit()
print("1")
# Judge status: Accepted
a,b,x=map(int,input().split())

from math import atan, degrees
if x>=a*a*b/2:#半分よりも多い場合
    rad=atan(2/a*(b-x/a**2))
else:
    rad=atan((a*b*b)/(2*x))
print(degrees(rad))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

cnt=[0]*((10**6)+1)

for elem in a:
    cnt[elem]+=1

unique=[]

for i in range((10**6)+1):
    if cnt[i]==1:
        unique.append(i)

cnt=[0]*((10**6)+1)

a=list(set(a))

for elem in a:
    for i in range(elem*2,(10**6)+1,elem):
        cnt[i]+=1

ans=0
for elem in unique:
    if cnt[elem]==0:
        ans+=1

print(ans)
# Judge status: Accepted
from sys import stdin

N = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
A = [0] + a
B = [0]*(N+1)
putBall = []

for i in range(N, 0, -1):
    if sum(B[i::i])%2 != A[i]:
        B[i] = 1
        putBall.append("%d" % i)

print(sum(B))
print(*putBall)
# Judge status: Accepted
s = input()
n = len(s)
t = s[0]
ans = 0
for i in range(1,n):
  if i % 2 == 1:
    if t == s[i]:
      ans += 1
  else:
    if t != s[i]:
      ans += 1
print(ans)
# Judge status: Accepted
n = int(input())

d = 2
ans = 0

while d * d <= n:
    if n % d != 0:
        d += 1
        continue

    z = d
    
    while n % z == 0:
        n //= z
        z *= d
        ans += 1

    while n % d == 0:
        n //= d

if n != 1:
    ans += 1

print(ans)
# Judge status: Accepted

N,M =map(int,input().split())
A =[int(j) for j in input().split()]
if N-sum(A) >=0:
    print(N-sum(A))
else:
    print(-1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = [1 if a[i] == i+1 else 0 for i in range(n)]
ans = 0
for i in range(n-1):
    if b[i] and b[i+1]:
        b[i] = 0
        b[i+1] = 0
        ans += 1
print(ans+sum(b))
# Judge status: Accepted
n,m = map(int,input().split())
print("Yes" if n==m else "No")
# Judge status: Accepted
n=int(input())
table=[100]*26
for i in range(n):
    k=[0]*26
    s=input()
    for j in s:
        k[ord(j)-97]+=1
    for j in range(26):
        table[j]=min(table[j],k[j])
ans=""
for i in range(26):
    ans+=chr(i+97)*table[i]
print(ans)
# Judge status: Wrong Answer
import sys
 
if __name__ == '__manin__':
  
    r=sys.argv[1]
    multiple = r^2
    print(multiple)
# Judge status: Accepted
def calc(k):
  cur = 0
  for i in range(1, 10 ** 7):
    cur *= 10
    cur += 7
    cur %= k
    if cur == 0:
      return i
  return -1

k = int(input())
print(calc(k))
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 0:
    print(N / 2)
else:
    print((N+1) / (2 * N))
# Judge status: Wrong Answer
s = input()
if s == 'AAA' or 'BBB':
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
n=int(input())
As = list(map(int,input().split()))
print(As)
c=0
ans = 0
for a in As:
    c+=1
    if c%2 == 0:
        if a%2 == 1:
            ans+=1
print(ans)
# Judge status: Wrong Answer
s = list(input())

s.sort()

if s[0] == s[1] and s[2] == s[3] and s[1] != s[2]:
   print('yes')

else:
   print('no')
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
mod=10**9+7
ans=pow(2,n,mod)-1
p=1
for i in range(a):
    p*=n-i
    p*=pow(i+1,mod-2,mod)
    p%=mod
for i in range(b):
    p*=n-i
    p*=pow(i+1,mod-2,mod)
    p%=mod
print((ans-p)%mod)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
for i in range(a):
    for j in range(b):
        if (a-i)*b+(b-j)*a==c:
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return a*b // gcd(a,b)

n = int(input())
a = list(map(int,input().split()))
l = [0]
r = [0]
for i in range(n):
    l.append(gcd(a[i],l[-1]))
    r.append(gcd(a[(n-1)-i],r[-1]))
r = r[::-1]
ans = 0
for i in range(n-1):
    ans = max(ans,gcd(l[i],r[i+1]))
print(ans)
# Judge status: Accepted
n,a,b=map(int,input().split())
l=a+b
for i in input():
    
    if i=="a" and l>0:
        l-=1
        print ("Yes")
    elif i=="b" and l>0 and b>0:
        print ("Yes")
        l-=1
        b-=1
    else:
        print ("No")
# Judge status: Wrong Answer
num = list(input())
n = int(num[-1])
print(n)
if n == 3:
    print('bon')
elif n in [2,4,5,7,9]:
    print('hon')
else:
    print('pon')
# Judge status: Wrong Answer
N=int(input())
A=list(map(int, input().split()))
q=int(input())
Q=[list(map(int, input().split())) for _ in range(q)]

L=[0]*(10**5+1)
S=0
for i in range(N):
    L[A[i]]+=1
    S+=A[i]

for i in range(q):
    S+=L[Q[i][0]]*(Q[i][1]-Q[i][0])
    L[Q[i][0]]=0
    L[Q[i][1]]+=L[Q[i][0]]
    print(S)
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
for i in range(1,n+1):
  for j in range(1,m+1):
    if n*m - (n-i)*(m-j) == k:
      print('Yes')
      exit()
print('No')
# Judge status: Wrong Answer
a = input().split()
b = sorted(a)
print(b)
if int(b[2]) == int(b[0]) + int(b[1]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
S = input()
ju1, ju2 = S[:2],S[2:]

if (int(ju1) > 0 and int(ju1) <= 12) or (int(ju2) > 0 and int(ju2) <= 12):
    if int(ju1) <= 12 and int(ju2) > 12:
        print('MMYY')
    if int(ju1) > 12 and int(ju2) <= 12:
        print('YYMM')
    if int(ju1) <= 12 and int(ju1) <= 12:
        print('AMBIGUOUS')
else:
    print('NA')
# Judge status: Accepted
n=int(input())
s=input()
x=0
max=0

for ss in s:
  if ss == "I":
    x+=1
  elif ss == "D":
    x-=1
  
  if x > max:
    max = x
    
print(max)
# Judge status: Accepted
n, m =map(int, input().split())

if n>=2 and m>=2:
	print(n*m-2*max(n,m)-2*(min(n,m)-2))
elif n==1 and m==1:
	print(1)
elif n==1 or m==1:
	print(max(n,m)-2)
# Judge status: Accepted
import math

a, b, c = list(map(int, input().split()))
cnt = math.floor(b / a)
if c <= cnt:
    print(c)
else:
    print(cnt)
# Judge status: Wrong Answer
N = int(input())

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


flag=0
count=1
for j in range(1,N):

    if A[j-1]>A[j] and flag==1:
        count+=1
        flag=0

    elif A[j-1]>=A[j] and (flag==0 or flag==-1):
        flag=-1

    elif A[j-1]<A[j] and flag==-1:
        count+=1
        flag=0
    elif A[j-1]<=A[j] and (flag==0 or flag==1):
        flag=1




print(count)
# Judge status: Accepted
# coding:utf-8
x, y = map(int, input().split())
ans = [x]
a = x

while a * 2 <= y:
    a = a * 2
    ans.append(a)

#print(ans, len(ans))
print(len(ans))
# Judge status: Accepted
import math
n,d=map(int,input().split())
print(math.ceil(n/(2*d+1)))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
am=max(a)
num=[0]*(am+1)
for i in a:
  num[i]+=1
#print(num)
mx=0
for i in range(1,am):
  #print(num[i-1:i+2])
  m=sum(num[i-1:i+2])
  if m>mx:
    mx=m
print(mx)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))
pair = 0
for i in range(n):
    for j in range(n):
        if i != j:
            if h[i] + h[j] == abs(i - j):
                pair += 1
print(pair/2)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
s=0
for i in range(N-1):
  s+=sum([A[i]^a for a in A[i+1:]])
print(s)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
                continue
            else:
                t=[l[i],l[j],l[k]]
                t.sort()
                if t[0]+t[1]>t[2]:
                    ans+=1
print(ans)
# Judge status: Wrong Answer
N = int(input())

if N == 0:
    print(0)
    exit()

ans = ''
while N:
    d = N % 2
    ans = str(d) + ans
    N -= d
    N //= -2
print(ans[::-1])
# Judge status: Accepted
N = int(input())
L = sorted(list(map(int,input().split())))

if L[-1]<sum(L[:-1]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
from sys import stdin
from fractions import gcd
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    A=list(map(int,readline().split()))

    for i in range(N-1):
        if i==0:
            g=gcd(A[i],A[i+1])
        else:
            g=gcd(g,A[i+1])
        if g==1:
            print(1)
            break
    else:
        print(g)

if __name__=="__main__":
    main()
# Judge status: Wrong Answer
from functools import reduce
from math import gcd
N=int(input())
ans=0
for i in range(N):
  for j in range(N):
    for k in range(N):
      ans+=reduce(gcd,(i,j,k))
print(ans)
# Judge status: Accepted
n = list(map(int, list(input().strip())))

total = sum(n)

for i in range(len(n)):
    subtotal = 0
    for j in range(i - 1):
        subtotal += n[j]
    subtotal += n[i] - 1
    for k in range(i + 1, len(n)):
        subtotal += 9

    total = max(total, subtotal)

print(total)
# Judge status: Wrong Answer
from sys import stdin

def main():
	l = stdin.readline().strip()
	print(l)
	print(l + " is followed by " +chr(ord(l)+1)+".")
main()
# Judge status: Wrong Answer
a = int(input())
print((a**2) *3.14)
# Judge status: Accepted
import numpy as numpy 
import bisect as bisect
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
a.insert(0,0)
ali = numpy.cumsum(a)
bli = numpy.cumsum(list(map(int,input().split())))
a = [0]
for i in range(n+1):
    if ali[i] > k:
        break
    b = bisect.bisect_right(bli,k-ali[i])
    a.append(i+b)
print(max(a))
# Judge status: Accepted
N = int(input())

D1, D2 = [0] * N, [0] * N

for i in range(N):
    a, b = map(int, input().split())

    D1[i], D2[i] = a, b

for i in range(2, N):

    if D1[i-2] == D2[i-2] and D1[i-1] == D2[i-1] and D1[i] == D2[i]:
        print("Yes")
        exit()

print("No")
# Judge status: Wrong Answer
import math
a,b,c,d = map(int, input().split())
e = c*d/(math.gcd(c,d))

ac = math.floor(a/c)
bc = math.floor(b/c)
acd = math.floor(a/e)
ad = math.floor(a/d)
bd = math.floor(b/d)
bcd = math.floor(b/e)

xa = ac + ad - acd

xb = bc + bd - bcd

print(int(b-a+1-(xb-xa)))
# Judge status: Accepted
n = int(input())
if n%2 == 0:
  print((n/2)/n)
else:
  print((n//2+1)/n)
# Judge status: Accepted
X=int(input())
ans=1
for i in range(1,X+1):
  for j in range(2,X+1):
    if i**j<=X:
      ans=max(ans,i**j)
    else:
      break
print(ans)
# Judge status: Wrong Answer
k, n = map(int, input().split())
a = list(map(int, input().split()))
kankaku = [(a[i] - a[i-1]) % 20 for i in range(len(a))]
print(k-max(kankaku))
# Judge status: Wrong Answer
list_of_num = list(range(10))
inputs = input().split(' ')
n, k = int(inputs[0]), int(inputs[1])
[list_of_num.remove(int(i))for i in input().split(' ')]

if list_of_num[0] == 0:
    print(n*list_of_num[1])
else:
    print(n* list_of_num[0])
# Judge status: Wrong Answer
a=input().split()
a.sort(reverse=True)
if len(set(a))==1:
  print(12*a[0])
else:
  ans=int(a[0]+a[1])+int(a[2]) 
  print(ans)
# Judge status: Wrong Answer
from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
YY=abs(Y)
NN=abs(N)
count=YY-NN
if N>0 and Y>0:
    print(count)
elif N>0 and Y<0:
    print(count+1)
elif N<0 and Y>0:
    print(count+1)
else:print(count+2)
# Judge status: Accepted
n=int(input())
s=input()
if n%2==1:
    print("No")
    exit()
half=n//2
if s[:half]==s[half:]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = input()
if "R" in s:
    if "RR" in s:
        if "RRR" in s:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    print(0)
# Judge status: Wrong Answer
S = str(input())
l = len(S)
k = 0
for i in range (l - 1):
    if S[i] == "h":
        if S [i + 1] == "i":
            k = 1
if k == 0:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
c = input()
l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
     'v','w','x','y','z']
a1 = l.index('c') 
print(l [a1 + 2])
# Judge status: Wrong Answer
import math

delta=int(input())
theta=90+delta
dist= 1
x,y=0,1
count=1
while(round(dist)!=0):
    rad= theta*math.pi/180
    vx= math.cos(rad)
    vy=math.sin(rad)
    x+=vx
    y+=vy
    dist= math.sqrt(x*x+y*y)
    count+=1
    theta=(theta+delta)%360
print(count)
# Judge status: Accepted
n,a,b=map(int,input().split())
num,number,ans=[],[],0

for i in range(1,n+1):
  for j in range(len(str(i))):
    num.append(str(i)[j])
    
  number=[int(j) for j in num]
  number=sum(number)
  
  if number>=a and number<=b:
    ans+=i
    
  num,number=[],[]
  
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()])[::-1]
print(sum(H[K:]))
# Judge status: Wrong Answer
n,d=map(int,input().split())

ans=n//(2*(d+1))

if n%(2*(d+1))==0:
  print(ans)
else:
  print(ans+1)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')


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


c = 1
ans = 0
for a in A:
    if a == c:
        c += 1
        continue
    ans += 1
if ans == N:
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
import sys,queue,math,copy
from functools import reduce
from fractions import gcd
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
LI = lambda : [int(x) for x in input().split()]
LI_2 = lambda : [int(x) / 2 for x in input().split()]

lcm = lambda a : reduce(lambda x, y : x * y // gcd(x,y), a)
N,M = LI()
A = LI_2()
c = lcm(A)
for i in A:
    if (c // i) % 2 == 0:
        print (0)
        exit (0)
print (round((M+c//2)/(c*2)))
# Judge status: Accepted
n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if premin>=x:
    ans+=1
    premin=x
print(ans)
# Judge status: Wrong Answer
N = int(input())
csf = [0]*(N-1)
for i in range(N-1):
    csf[i] = list(map(int,input().split()))

for i in range(N-1):
    ans = 0
    ans += csf[i][1] + csf[i][0]
    for j in range(i+1, N-1):
        if ans >= csf[j][1]:
            ans += ans % csf[j][2] + csf[j][0]
        else:
            ans = csf[j][1] + csf[j][0]
    
    print(ans)
print(0)
# Judge status: Wrong Answer
n,m=map(int,input().split())
print(n*m-(2*n+2*m-4))
# Judge status: Wrong Answer
n = int(input())
ll = list(map(int,input().split()))

ll = sorted(ll)

import bisect

ans = 0
for i in range(n):
    for j in range(i+1, n):
        k = ll[i] + ll[j]
        idx1 = bisect.bisect_right(ll, ll[j])
        idx2 = bisect.bisect_left(ll, k)
        ans += idx2 - idx1
print(ans)
# Judge status: Wrong Answer
import bisect

n = int(input())
A = sorted(list(map(int,input().split())))
ma = A[-1]
half = ma // 2
index = bisect.bisect_left(A,half)

if index != 0:
    ans = A[index-1] if half - A[index-1] < A[index] - half else A[index]
else:
    ans = A[0]

print(ma,ans)
# Judge status: Wrong Answer
import itertools
n=int(input())
l=list(map(int,input().split()))
L=list(itertools.combinations(l,3))
cnt=0
for i in range(len(L)):
  ll=[]
  ll.append(L[i][0])
  ll.append(L[i][1])
  ll.append(L[i][2])
  ll.sort()
  if ll[1]-ll[0]<ll[2]<ll[1]+ll[0]:
    cnt+=1
print(cnt)
# Judge status: Accepted
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
x = 0
y = 0
t = 0
for i in range(n):
    if abs(a[i][1] - x) + abs(a[i][2] - y) > abs(a[i][0] - t) or (a[i][1] - x + a[i][2] - y) % 2 != (a[i][0] - t) % 2:
        print('No')
        exit()
    else:
        x = a[i][1]
        y = a[i][2]
        t = a[i][0]
print('Yes')
# Judge status: Wrong Answer
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())

ans = 0
div1,div2 = [],[]
for m in range(1,int(M**.5)+1):
    if M%m == 0:
        div1.append(m)

for d in div1:
    if M%d == 0:
        div2.append(M//d)

for d in div1+div2:
    if d < M//N:
        ans = d

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

s1 = S[0:int((len(S)-1)/2)]
s2 = S[int((len(S)/2))+1:len(S)+1]
if S == S[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b, n = map(int, input().split(' '))

import math

x = n
tmp1 = math.floor(a*x/b) - a*math.floor(x/b)
ret = tmp1

if n//b == 0:
    print(tmp1)
else:
    q, _ = divmod(n, b)
    for i in range(1,10**4):
        x = i*b-1
        tmp2 = math.floor(a*x/b) - a*math.floor(x/b)
        ret = max(ret, tmp2)
    print(ret)
# Judge status: Wrong Answer
#!/usr/bin/env python3

s = str(input())

flag = 1
if s[0] != "A":
    flag = 0
if s[2] != "C":
    flag = 0


num_C = 0
for i in s[1:]:
    if i == "C":
        num_C += 1
if num_C >= 2:
    flag = 0

if flag == 0:
    print("WA")
else:
    print("AC")
# Judge status: Wrong Answer
L = int(input())
s,a = divmod(L,3)
print((s+a)*s*s)
# Judge status: Accepted
A, B, C = map(int, input().split())
if C < max(A, B) and C > min(A, B):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def t1():
    s=input()
    t=input()
    if s==t[0:len(t)-1]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    t1()
# Judge status: Accepted
N, L = map(int, input().split())
S = sorted(list(input() for _ in range(N)))
print(*S, sep='')
# Judge status: Accepted
K=int(input())
if K%2==0:
    print((K//2)**2)
else:
    d = (K-1)//2
    k = (K+1)//2
    print(d*k)
# Judge status: Accepted
n = int(input())
a = []
b = []
for i in range(n):
    at, bt = map(int, input().split())
    a.append(at)
    b.append(bt)
if(n % 2 == 1):
    a.sort()
    b.sort()
    min_med = a[(n-1)//2]
    max_med = b[(n-1)//2]
    result = max_med - min_med + 1
else:
    a.sort()
    b.sort()
    min_med = (a[n//2-1] + a[n//2])/2
    max_med = (b[n//2-1] + b[n//2])/2
    result = (max_med - min_med)*2 + 1
print(int(result))
# Judge status: Accepted
n = int(input())
L = [2, 1]
for i in range(2, n + 1):
    L.append(L[i-1] + L[i-2])
print(L[-1])
# Judge status: Accepted
n, m = map(int, input().split())
c = []
for i in range(n):
  c.append(list(map(int, input().split())))
c.sort()
cost = 0
s = 0
for i in range(n):
  if s + c[i][1] >= m:
    print(cost + (m - s) * c[i][0])
    break
  s += c[i][1]
  cost += c[i][0] * c[i][1]
# Judge status: Accepted
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
A = [int(i) for i in input().split()]
del A[m:len(A)]
print(n - sum(A)) if sum(A) <= n else print(-1)
# 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: Wrong Answer
n = int(input())

L = list(map(int, input().split()))

L = list((sorted(L)))

A = [0] * 1001
for i in L:
    A[i] += 1

t = 0
for i in range(n):
    for j in range(i+1, n):
        t += sum(A[L[j]+1:L[i] + L[j]])
print(t)
# Judge status: Wrong Answer
s=int(input())
m=10**9
a=s//m
b=s%m
print(0,0,a+1,m-b,1,m)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
S=0
for i in a:
  S^=i
print([i^S for i in a])
# Judge status: Accepted
t = input()
ans = 0
maxans = 0
for i in t:
  if i =="R":
    ans += 1
  else:
    maxans = max(ans,maxans)
    ans = 0
print(max(maxans,ans))
# Judge status: Accepted
N, M, X = map(int, input().split())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

saisyo = float("inf")
for i in range(2**N):
    a = [0]*M
    gokei = 0
    for j in range(N):
        if (i>>j)&1:
            gokei += A[j][0]
            for k in range(1, M+1):
                a[k-1] += A[j][k]
    if all(a[l] >= X for l in range(M)):
        saisyo = min(saisyo, gokei)

print(saisyo if saisyo != float("inf") else -1)
# Judge status: Accepted
# coding UTF-8
# 
# problem C
# 

import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

seq = tuple(range(1,N+1))
seqlist = list(itertools.permutations(seq))

#print(seqlist)
#print(seqlist.index(P))
#print(seqlist.index(Q))

print(abs(seqlist.index(P)-abs(seqlist.index(Q))))
# Judge status: Wrong Answer
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]

BC.sort(reverse=True)
cnt = 0
for b, c in BC:
    if cnt + b > n:
        b = n-cnt
    for _ in range(b):
        A.append(c)
    cnt += b
    if cnt == n:
        break

A.sort(reverse=True)

print(sum(A[:n]))
# Judge status: Wrong Answer
N = str(input())
if N[0] == 7 or N[1] == 7 or N[2] == 7:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
lens = len(s)
for i in range(2, lens, 2):
  if s[:(lens - i) // 2] == s[(lens - i) // 2:lens - i]:
    print(s[:(lens - i) // 2])
    exit()
# Judge status: Accepted
import numpy as np
A, B, C, D, E = [int(input()) for i in range(5)]

x = np.array([A, B, C, D, E])
ans = int((np.ceil((x / 10)) * 10).sum())
x = x %10

if x.sum()==0:
    tmp = 0
else:
    tmp = 10 - x[np.where(x>0)].min()

ans = ans - tmp

print(ans)
# Judge status: Wrong Answer
a = input()
b = list(map(int, input().split()))
min = 100000


for i in range(len(b)):
  left = 0
  right = 0
  for j in range(i+1):
    left += b[j]
  for j in range(len(b)):
    right += b[j]
  if min > abs(left - right):
    min = abs(left - right)
    
print(min)
# Judge status: Wrong Answer
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
#方角が南北/東西でセットであればよさげ
    s = input()
    s = set(s)

    if s == "WE" or s == "EW":
        print("Yes")
    elif s == "NS" or s ==  "SN":
        print("Yes")       
    elif s == set(["W","E","N","S"]):
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()
# Judge status: Accepted
a,b=list(map(int,input().split()))
print('Yay!' if a<=8 and b<=8 else ':(')
# Judge status: Accepted
A, B = map(int, input().split(' '))
if A <= 5:
    print(0)
elif A <= 12:
    print(B // 2)
else:
    print(B)
# Judge status: Accepted
n = int(input())
a = int(input())
n %= 500
if a >= n:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from math import floor


def main():
    result = 0
    N = int(input())
    if N % 2 == 0:
        while N > 0:
            # Nは偶数，かつ5の倍数　∴10の倍数
            result += floor(N / 10)
            N = floor(N / 5)
        print(result)
    else:
        print(0)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
Word = []
tail = ""
for i in range(N):
    W = list(input())
    Word.append(W)
    tail = W[-1]
    if i != 0:
        if tail != W[0] or (W in Word):
            print("No")
            exit()
print("Yes")
# Judge status: Wrong Answer
N = int(input())
W = list(map(int, input().split()))
ans = float("inf")
for i in range(1, N-1):
  ans = min(abs(sum(W[:i]) - sum(W[i:])), ans)
print(ans)
# Judge status: Accepted
n = int(input())
N = n

ans = ""

while n != 0:
    if n % 2 == 1:
        ans += "1"
        n = n - 1
        n //= -2
    else:
        ans += "0"
        n //= -2

print(ans[::-1] if N != 0 else 0)