peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# input
N = int(input())
B = list(map(int, input().split()))

# check
A = []
append = A.append
for i, b in enumerate(B):
    while len(A[i:]) < 2:
        if not A:
            append(b)
        elif i < len(B) - 1 and max([A[i], b]) >= B[i + 1]:
            append(B[i + 1])
        else:
            append(b)

print(sum(A))
# Judge status: Wrong Answer
n, m = map(int, input().split())
x = (m-2*n)//4
a = min(n+x, (m-2*x)//2)
b = min(n+x-1, (m-2*(x-1))//2)
c = min(n+x+1, (m-2*(x+1))//2)
print(max(a, b, c))
# Judge status: Wrong Answer
from collections import deque, defaultdict
d = deque()
di = defaultdict(int)
N, K = map(int, input().split())
A = list(map(int, input().split()))


d.append(0)
for i in range(N * 2):
    p = d.pop()
    d.append(p)
    d.append(A[p] - 1)


P = []
k = 0
n = 0
for i, v in enumerate(d):
    if (v in P):
        k = i
        n = v
        break
    P.append(v)
    di[v] = i

le = k - di[n]
amari = K % le

print(d[le + amari] + 1)
# Judge status: Accepted
s=input()
print("A"+s[8]+"C")
# Judge status: Accepted
n = int(input())
num = list(int(input()) for i in range(n))
test = sorted(num, reverse=True)
i = 0

for i in range(n):
  if(num[i] == test[0]):
    print(test[1])
  else:
    print(test[0])
# Judge status: Accepted
n,m=map(int,input().split())
if abs(n-m)>1:
  print(0)
  exit()

sm=1 if n!=m else 2
while n>0:
  sm=(sm*n)%(10**9+7)
  n-=1
while m>0:
  sm=(sm*m)%(10**9+7)
  m-=1
print(sm)
# Judge status: Wrong Answer
def main():
    N = int(input())
    A = sorted([[t, i + 1] for i, t in enumerate(input().split())])
    print(' '.join(map(str, [row[1] for row in A])))


if __name__ == '__main__':
    main()
# Judge status: Accepted
s = input()
if (s.count('a') == 1 and s.count('b') and s.count('c')): print('Yes')
else: print('No')
# Judge status: Accepted
W, H, x, y = map(int, input().split())

if W/2==x and H/2==y:
    print(W*H/2, 1)
else:
    print(W*H/2, 0)
# Judge status: Wrong Answer
from bisect import bisect_right as br
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort()
A=[a for a,b in AB]
B=[b for a,b in AB]
works=[]
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  #worksにlatest日以内に報酬を貰える仕事を追加する
  if not A:
    continue
  for _ in range(br(A,latest)):
    A.pop(0)
    works.insert(br(works,B[0]),B[0])
    B.pop(0)
  if not works:
    continue
  ans+=works.pop(-1)

print(ans)
# Judge status: Accepted
from queue import Queue
q = Queue()

k = int(input())

for i in range(9):
  q.put(i+1)
for _ in range(k-1):
    x = q.get()
    mod = x%10
    
    if x%10 != 0:
      q.put(10*x + mod - 1)
      
    q.put(10*x + mod)
    
    if x%10 != 9:
      q.put(10*x + mod + 1)
      
print(q.get())
# Judge status: Accepted
# coding: utf-8

(h,a) = map(int, input().rstrip().split(" "))

ans = int(h/a) + min(1, h % a)
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

if n == 2:
  print(abs(a[0]-a[1]))
  exit()

ans = 10**10+1
for i in range(n):
    x = sum(a[0:i])
    y = sum(a[i+1:n-1])
    tmp = abs(x-y)
    ans = min(ans,tmp)

print(ans)
# Judge status: Wrong Answer
N = int(input())
count = 0
for i in range(N):
    if i % 3 != 0 and i % 5 != 0:
        count += i

print(count)
# Judge status: Accepted
c = str(input())

if c.islower():
    print('a')
else:
    print('A')
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))

v.sort()
ans = v[0]

for i in range(1, n):
    ans = (ans+v[i])/2

print(ans)
# Judge status: Wrong Answer
s=input()
print('Yes' if 'hi' in s else 'No')
# Judge status: Wrong Answer
a,b = map(int, input().split())
if(a+b<=16):
  print("Yay!")
else:
  print(":(")
# Judge status: Wrong Answer
m=list(map(int,input().split()))
a=int(m[0])-1+(len(m)-1)*9
s=sum(m)
print(max(s,a))
# Judge status: Accepted
x,y=map(int,input().split())
ans=1
for i in range(y):
    x*=2
    if x>y:
        break
    ans+=1
print(ans)
# Judge status: Wrong Answer
H1, M1, H2, M2, K = map(int, input().rstrip().split())
minutes = M2 - M1
hours = 0
if minutes < 0:
    minutes += 60
    hours += 1
hours = H2 - H1
minutes += hours * 60
answer = minutes - K
if answer < 0:
    answer = 0
print(answer)
# Judge status: Accepted
n = int(input())
v = [ int(x) for x in input().split()]
v.sort()

while len(v) > 1:
    x = v.pop(0)
    y = v.pop(0)
    z = (x+y)/2
    v.append(z)
    v.sort()

print(v[0])
# Judge status: Wrong Answer
s = int(input())
k = int(input())
 
for i in str(s):
    if i == '1':
        pass
    else:
        print(i)
        break
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = N - sum(A) if N > sum(A) else -1
print(ans)
# Judge status: Wrong Answer
q , h , s , d = map(int,input().split())
n = int(input())
qb = q*4
hb = h*2
db = d//2

if min(qb,hb,db,s) != db:
    print(n*min(qb,hb,s))
elif min(qb,hb,db,s) == db:
    if n % 2 == 0:
        print(n*db)
    elif n % 2 == 1:
        ans = (n//2) * d
        ans += min(qb,hb,s)
        print(ans)
# Judge status: Accepted
M = 10**9+7

S = int(input())

num_list = [0]*(S+1)
num_list[-1] = 1

for idx in reversed(range(3,S+1)):
    for i in reversed(range(idx-2)):
        num_list[i] += num_list[idx]


ans = num_list[0]%M
print(ans)
# Judge status: Accepted
N = int(input())
*A, = map(int, input().split())
dic = {}
ans = 0
for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1
for k, v in dic.items():
    if k == v:
        continue
    elif k > v:
        ans += v
    else:
        ans += v - k
print(ans)
# Judge status: Accepted
S = int(input())
a = list(map(int,input().split()))
ans = 1

if 0 in a:
    print(0)
    exit()
else:
    for i in range(S):
        ans*=a[i]
        if ans > 10**18:
            print(-1)
            exit()

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

cc=collections.Counter(A)
L=list(cc.values())

total=0
for i in range(len(L)):
    total+=L[i]*(L[i]-1)//2

ans=0
for a in A:
    temp=cc[a]*(cc[a]-1)//2
    ttemp=(cc[a]-1)*(cc[a]-2)//2
    ans=total-temp+ttemp
    print(ans)
# Judge status: Accepted
p,q,r = map(int,input().split())
time = [p+q,q+r,p+r]
print(min(time))
# Judge status: Accepted
n=int(input())
s=input()
if n<3200:
  print("red")
else:
  print(s)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s.sort()
s_cnt = Counter(s)
max_cnt = s_cnt.most_common()[0][1]
s_cnt_common = s_cnt.most_common()
for i in range(len(s_cnt_common)):
    if s_cnt_common[i][1] == max_cnt:
        print(s_cnt_common[i][0])
# Judge status: Accepted
import math

N = int(input())
max_a = math.sqrt(N)

r = N
for a in range(1, int(max_a) + 2):
    if (N % a == 0):
        r = min(int(N / a) + a - 2, r)
print(r)
# Judge status: Accepted
a = [list(map(int, input().split())) for l in range(3)]
n = int(input()) 
b = [int(input()) for i in range(n)] 

for x in range(n):
	for i in range(3):
		for j in range(3):
			if a[i][j] == b[x]:
				a[i][j] = 0

for r in range(3):
	if a[r]==[0, 0, 0]:
		print('Yes')
		exit()
	elif a[0][r]==a[1][r]==a[2][r]==0:
		print('Yes')
		exit()

if a[0][0]==a[1][1]==a[2][2]==0	or a[0][2]==a[1][1]==a[2][0]==0:	
		print('Yes')
		exit() 
print('No')
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))

def gcd(x,y):
  while y:
    x,y = y,x%y
  return x

ans = l[0]
for i in range(1,n):
  ans = gcd(ans, l[i])
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for j in range(m)]
S = list(set(s))
T = list(set(t))
print(S,T)
b = []
for x in range(len(S)):
  a = s.count(S[x]) - t.count(S[x])
  b.append(a)
ans = max(0, max(b))
print(ans)
# Judge status: Accepted
from math import ceil
N, X, T = map(int, input().split())

a = ceil(N / X)

print(a * T)
# Judge status: Accepted
a,b,x=map(int,input().split())
if a<=x and a+b>=x :
    print ("YES")
else:
    print("NO")
# Judge status: Accepted
x = int(input())

for a in range(-120, 120):
  f_a = a**5
  r_b = (x-f_a)**(1/5).real
  b = round(r_b.real)
  if f_a - b**5 == x:
    print(a, b)
    break
  b *= -1
  if f_a - b**5 == x:
    print(a, b)
    break
# Judge status: Accepted
import heapq

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

b = [0] * m
c = [0] * m
for i in range(m):
    b[i], c[i] = map(int, input().split())

hq = []

for i in range(n):
    heapq.heappush(hq, [-a[i], 1])

for i in range(m):
    heapq.heappush(hq, [-c[i], b[i]])

ans = 0

for i in range(n):
    val, cnt = heapq.heappop(hq)
    ans += -val
    if cnt > 1:
        cnt -= 1
        heapq.heappush(hq, [val, cnt])

print(ans)
# Judge status: Wrong Answer
import math
ans = 0
for i in range(1,201):
  for j in range(1, 201):
    for k in range(1, 201):
      ans += math.gcd(i, math.gcd(j, k))
print(ans)
# Judge status: Accepted
import math
N = int(input())
ans = (int(math.sqrt(N))**2)
print(ans)
# Judge status: Accepted
N,K = map(int, input().split())

d=[0]*K
A=[0]*N
for i in range(K):
    d[i]=int(input())
    temp = list(map(int, input().strip().split()))
    for k in range(d[i]):
        A[temp[k]-1]=1
        

print(A.count(0))
# Judge status: Accepted
s = input()
n = len(s)
res = [0] * (n + 1)
t = 0
for i in range(n):
	if s[i] == '<':
		t += 1
	else:
		t = 0
	res[i + 1] = t

t = 0
for i in range(n - 1, -1, -1):
	if s[i] == '>':
		t += 1
	else:
		t = 0
	res[i] = max(res[i], t)

print(sum(res))
# Judge status: Accepted
v = list(map(int, input().split()))
v.sort()
d = v.pop()
print(10 * d + sum(v))
# Judge status: Wrong Answer
n = int(input())
x = [list(map(int, list(input().split()))) for i in range(n)]

x.sort()

ans = n
cp = ans
maxs = 0
for i in range(n - 1):
    if cp == ans:
        maxs = max(maxs, x[i][0] + x[i][1])
    ming = x[i + 1][0] - x[i + 1][1]
    if ming < maxs:
        ans -= 1
    else:
        cp = ans

print(ans)
# Judge status: Accepted
import math
n = int(input())
ls = "abcdefghijklmnopqrstuvwxyz"
cnt = 0
base = 26
while n >= base ** cnt:
    n -= base ** cnt
    cnt += 1
ans = ""
#print(cnt, n)
for i in range(cnt-1, -1, -1):
    res = n // (base ** i)
    ans += ls[res]
    n -= base ** i * res
print(ans)
# Judge status: Wrong Answer
n = int(input())
count=0
#p = [input() for i in range(n)]
p=list(map(int,input().split()))
for i in range(n-2):
    if (p[i]<p[i+1]<p[i+2]) or (p[i+2]>p[i+1]>p[i]):
        count+=1
print(count)
# Judge status: Accepted
n,k=map(int,input().split())
d=list(input().split())

for i in range(n,n*10+1):
  s=str(i)
  for p in d:
    if p in s:
      break
  else:
    print(i)
    break
# Judge status: Accepted
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
bn = [int(input()) for _ in range(N)]

flag = False
for row in A:
    if all(item in bn for item in row):
        flag = True

for col in zip(*A):
    if all(item in bn for item in col):
        flag = True

if all(A[i][i] in bn for i in range(3)):
    flag = True

if all(A[i][3-1-i] in bn for i in range(3)):
    flag = True

print('Yes' if flag else 'No')
# Judge status: Accepted
N, M = map(int, input().split())
aaa = list(map(int, input().split()))
acc = sum(aaa)
print('Yes' if sum(4 * M * a >= acc for a in aaa) >= M else 'No')
# Judge status: Wrong Answer
from math import factorial
n,m = map(int,input().split())
if abs(n-m) >= 2:
  print(0)
elif abs(n-m) == 1:
  print((factorial(n)%(10**9+7))*(factorial(m)%(10**9+7)))
else:
  print((2*(factorial(n) % (10**9+7))**2) %(10**9+7))
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
if sum(l) > 2*max(l):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

def main():
    ans = [0]*(n+1)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if fn > n:
                    break
                else:
                    ans[fn] += 1

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
#157b
a=[[int(i) for i in input().split()] for _ in range(3)]

n=int(input())
b=[[int(i) for i in input().split()] for _ in range(n)]
for i in range(3):
	for j in range(3):
		for e in b:
			if a[i][j]==e:
				a[i][j]=0
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())
ans = 0


def f(x):
    s = str(x)
    arr = list(map(int, s))
    return sum(arr)


for i in range(1, N+1):
    if A <= f(i) <= B:
        ans += i
print(ans)
# Judge status: Wrong Answer
s = input()
ans = 0
for i in range(len(s)//2+1):
  if s[i]!=s[-i-1]: ans+=1
print(ans)
# Judge status: Accepted
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


if __name__ == '__main__':
    S = int(input())

    x1, y1 = 0, 0
    x2, y2 = 1000000000, 1
    x3 = (x2 - S % x2) % x2
    y3 = (S + x3) // x2
    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))
# Judge status: Accepted
a,b = map(int,input().split())
if a<=b:
  print(a)
else:
  print(a-1)
# Judge status: Wrong Answer
import fractions
N=int(input())
a = list(map(int, input().split()))

#------------最小公倍数---------------------
lcm = a[0]
for i in range(1, N):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
#------------------------------------------
b= []
for i in range(N):
    b.append(lcm //a[i])
ans=0
print(lcm)
print(b)

for j in range(len(b)):
    ans +=b[j]

ans%=1000000007

print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
n = 1
for i in range(min(a, b), max(a, b)+1):
  n = n * i
if n == 0:
  print(0)
elif n > 0:
  print('Zero')
else:
  print('Negative')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ma=max(a)
ma=ma//2
aaa=max(a)
ans=10**10
for i in range(n):
    if abs(ma-a[i])<ans and a[i]!=aaa:
        ans=abs(ma-a[i])
        aaaaaa=a[i]
print(max(a),aaaaaa)
# Judge status: Wrong Answer
z,y,x=map(int,input().split())
z-=x
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)
# Judge status: Accepted
N = int(input())
S = str(input())
cl = [0]*N
for i in range(1,N):
  Y = S[i:]
  X = S[:i]
  X = list(set(X))
  Y = list(set(Y))
  count = 0
  for j in range(len(X)):
    for k in range(len(Y)):
      if X[j] == Y[k]:
        count += 1
  cl[i] = count

print(max(cl))
# Judge status: Accepted
import sys

n = int(input())

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

cofg=sum(x)//n
cofg2=cofg+1

sum=0
sum2=0
for i in range(n):
    sum+=(x[i]-cofg)**2
    sum2+=(x[i]-cofg2)**2


ans = sum if sum < sum2 else sum2



print(ans)
# Judge status: Wrong Answer
n = int(input())
x = list(map(int, input().split()))
hp_min = 10000 * n
for i in range(min(x), max(x)):
    hp = sum([(x[j] - i) ** 2 for j in range(len(x))])
    if hp < hp_min:
        hp_min = hp
print(hp_min)
# Judge status: Accepted
n,k = map(int, input().split())
H = list(map(int, input().split()))

H.sort()
ans = 0
for i in range(n-k):
    ans += H[i]

print(ans)
# Judge status: Accepted
w,h,x,y = map(int,input().split())

if x == w/2 and y == h/2:
  ans = 1
else:
  ans = 0
print(w*h/2,ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
S = int(input())
print(0, 0, 10 ** 9, 1, -S % (10 ** 9), -(-S // (10 ** 9)))
# Judge status: Accepted
from fractions import gcd
from functools import reduce


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


def solve(string):
    n, m, *a = map(int, string.split())
    l = reduce(lcm, a)
    c = 1
    while a[0] % (2 * c) == 0:
        c *= 2
    for _a in a:
        if _a % c or not _a // c % 2:
            return "0"
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Judge status: Wrong Answer
K = int(input())
a = 0
n = 0
out = -1
for _ in range(K):
  a += 7 * (10 ** n)
  if a % K == 0:
    out = n + 1
    break

print(out)
# Judge status: Wrong Answer
A = 100
X = int(input())
cnt = 0

while X > A:
    cnt += 1
    A *= 1.01
    A = int(A // 1)
print(cnt)
# Judge status: Accepted
n = int(input())
from collections import defaultdict
l = defaultdict(list)

for i in range(n):
  s,p = input().split()
  p=int(p)
  l[s].append({"i":i,"p":p})

for city in sorted(l.keys()):
  l[city].sort(
    key = lambda x: (x["p"])
    ,reverse = True
  )
  for c in l[city]:
    print(c["i"]+1)
# Judge status: Accepted
a,b = map(int, input().split())

if a > b:
    print(a-1)
else:
    print(a)
# Judge status: Accepted
from math import *

n = int(input()) - 1
c = [0] * n
s = [0] * n
f = [0] * n
for i in range(n):
  c[i], s[i], f[i] = map(int, input().split())
  
for i in range(n):
  a = s[i] + c[i]
  for j in range(i + 1, n):
    if a <= s[j]:
      a = s[j] + c[j]
    else:
      a = s[j] + f[j] * ceil((a-s[j])/f[j]) + c[j]
  print(a)
print(0)
# Judge status: Accepted
import math
r=int(input())
print(2*r*math.pi)
# Judge status: Wrong Answer
S=input()
tmp=S[0]
i=1
ans=1
while i<len(S):
    # print(S[i],tmp)
    if S[i]!=tmp:
        ans+=1
        tmp=S[i]
        i+=1
    else:
        ans+=1
        tmp=S[i:i+2]
        i+=2
if S[-2]==S[-1] and tmp!=S[-2:]:
    ans-=1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

n = int(input())

if n <= 999:
    print("ABC")
else:
    print("ABD")
# Judge status: Accepted
N=int(input())

sums=0
A=[]
i=1
while sums<N:
    sums+=i
    A.append(i)
    i+=1

cnt=sum(A)-N
for i in A:
    if i!=cnt:
        print(i)
# Judge status: Wrong Answer
count=0
n=input()
k=len(n)
for i in range(k):
    count+=int(i)
if count%9==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
print('Yes' if 'A' in s and 'B' in s else 'No')
# Judge status: Accepted
a = int(input())
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    ar.append(l)
ar.reverse()
count = 0
for r in ar:
    x = r[0] + count
    y = r[1]
    m = x % y
    if m != 0:
        count += y - m
print(count)
# Judge status: Accepted
import math 
import bisect
import heapq
from collections import deque

n,k = map(int,input().split())
s = input()
dif = 0

for i in range(n-1):
    if s[i] != s[i+1]:
        dif += 1

same = n-1-dif
if k > dif // 2:
    ans = n-1
else: ans = same + 2*k

print(ans)
# Judge status: Accepted
a, b = map(int,input().split())
print(-(-(a+b)//2))
# Judge status: Accepted
s = input().rstrip()
n = len(s)

removed = 0
cnt_s = cnt_t = 0

for i in range(n):
    if s[i] == 'S':
        cnt_s += 1
    else:
        cnt_t += 1
    if i == n-1:
        removed += min(cnt_s,cnt_t)
    elif cnt_t > cnt_s:
        removed += cnt_s
        cnt_s = cnt_t = 0
#     print(cnt_s,cnt_t)
print(len(s) - removed*2)
# Judge status: Accepted
A=sorted(map(int,input().split()))
print( A[1]*2-1 if A[1]+A[0] <= A[1]*2-1 else A[1]+A[0] )
# Judge status: Accepted
def check(N,target,A,K):
  cnt = 0
  for i in range(N):
    cnt += -(-A[i]//target)-1
  if cnt>K:
    return False
  return True

def solve():
  ans = 0
  N, K = map(int, input().split())
  A = list(map(int, input().split()))
  low = 1
  high = 10**9+1
  mid = (low+high)//2
  while high>low+1:
    if check(N,mid,A,K):
      high = mid
    else:
      low = mid
    mid = (low+high)//2
  if check(N,low,A,K):
    ans = low
  else:
    ans = high
  return ans
print(solve())
# Judge status: Accepted
a,b,c,x,y=[int(i)  for i in input().split()]
ans=1000000000
for k in range(10**5+1):
	money=2*c*k + max(x-k,0)*a + max(y-k,0)*b
	if(ans>money):
		ans=money
print(ans)
# Judge status: Wrong Answer
n, c, k = map(int, input().split())
T = sorted([int(input()) for _ in range(n)])
ta = 0; cnt = 0; ans = 0
for i in range(n - 1):
    if ta + T[i + 1] - T[i] < k and cnt < c:
        ta = ta + T[i + 1] - T[i]
        cnt += 1
        if cnt >= c:
            ans += 1
            ta = 0; cnt = 0
    else:
        ans += 1
        ta = 0; cnt = 0
print(ans + 1)
# Judge status: Accepted
S=input()
N=len(S)
if N%2!=0:
    print("No")
    exit()

for i in range(N//2):
    if S[i*2:(i*2)+2]!="hi":
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
# coding: utf-8
N=int(input())
a=0
m=float('inf')
for i in range(N):
    s=int(input())
    a+=s
    if s%10!=0:
        m=min(m,s)

if m>100:
    print(0)
else:
    if a%10==0:
        print(a-m)
    else:
        print(a)
# Judge status: Accepted
n, m = map(int, input().split())
count = [1 for i in range(n + 1)]
count[0] = 0
flag = [False for i in range(n + 1)]
flag[1] = True
for i in range(m):
    x, y = map(int, input().split())
    if flag[x] == True:
        flag[y] = True
    count[x] -= 1
    count[y] += 1
    if count[x] == 0:
        flag[x] = False
print(sum(flag))
# Judge status: Accepted
N = int(input())
res = 0
for n in range(1, N+1, 2):
    cnt = 0
    for i in range(1, n+1):
        if n % i == 0:
            cnt += 1
    if cnt == 8:
        res += 1
print(res)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

cnt = 0
for i in range(n):
  if a[i] >= b[i]:
    cnt += b[i]
  elif b[i] > a[i] :
    if b[i] - a[i]  > a[i+1]:
      cnt += a[i] + a[i+1]
      a[i+1] = 0
    else:
      cnt += b[i]
      a[i+1] = a[i]+ a[i+1] - b[i]


print(cnt)
# Judge status: Wrong Answer
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    A_1 = list(map(int, input().split()))
    B_l = [1 - A_1[0]]

    sum = 0
    
    for i in range(1, N):
        if A_1[i] in B_l:
            sum += 1

        B_l = list(map(lambda x: x+1, B_l))
        B_l.append(1 - A_1[i])

        
    print(sum)
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
A=int(input())
B=int(input())

if(A+B==3):
    print(3)
elif(A+B==4):
    print(2)
else:
    print(1)
# Judge status: Accepted
n = list(map(int, input().split()))
N = n[0]
M = n[1]
X = []
Y = []
for i in range(M):
    a = list(map(int, input().split()))
    X.append(a[0])
    Y.append(a[1])
v=0
w=0
x=max(X)
y=min(Y)
if y>=x:
    print(y-x+1)
else:
    print(0)
# Judge status: Accepted
import bisect

def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    num_list.sort()

    ans = 0

    for i in range(n-2):
        for j in range(i+1,n-1):
            tmp = bisect.bisect_left(num_list, num_list[i]+num_list[j])
            ans += tmp - j - 1

    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

work = 1
exceeded = False
for i in a:
    work *= i
    if work > 1000000000000000000:
        exceeded = True
        break

if work > 1000000000000000000:
    exceeded = True

if exceeded:
    print(-1)
else:
    print(work)
# Judge status: Wrong Answer
import math
n,m=map(int,input().split())
dog = math.factorial(n)
monkey = math.factorial(m)
ans = dog*monkey%(10**9+7)
if abs(n-m)==0:
    print(ans*2)
elif abs(n-m)==1:
    print(ans)
else:
    print(0)
# Judge status: Accepted
k,x=map(int,input().split())
ans=""
for i in range(-k+1,k):
    print(x+i,end=" ")
# Judge status: Accepted
a,b = map(int, input().split())

j = 0
l = []

for i in range(1,1000):
    j +=i
    l.append(j)

# print(l)
print( l[abs(b - a - 1)] - b)
# Judge status: Wrong Answer
N,K = map(int,input().split())
sum = 0

for i in range(K,N+2):
    max = (N+(N-(i-1)))*i*(0.5)
    min = (0+(i-1))*i*0.5
    sum += max-min+1

print(sum%(10**9+7))
# Judge status: Accepted
import collections
MOD = 998244353
def main():
    N = int(input())
    D = [int(_) for _ in input().split()]
    Dmax = max(D)
    cc = collections.Counter(D)
    if D[0] != 0: return 0
    if cc[0] != 1: return 0
    for i in range(Dmax+1):
        if cc[i] == 0: return 0
    output = 1
    for i in sorted(cc.keys()):
        if i in (0, 1): continue
        output *= pow(cc[i-1], cc[i], MOD)
        output %= MOD
    return output

if __name__ == '__main__':
    print(main())