peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())


def fn(n, a):
    res = 0
    while n > 0:
        res += n % a
        n = n // a
    return res


ans = 1 << 60
for i in range(0, N+1):
    tmp = fn(i, 6) + fn(N - i, 9)
    ans = min(ans, tmp)

print(ans)
# Judge status: Accepted
s = input()
flag = -1
k = -1
for i in range(len(s)):
  flag += 1
  k += 1
  a = s[0:(len(s)-k)//2]
  b = s[(len(s)-k)//2:(len(s)-k)]
  if a == b:
    if flag != 0:
      print(len(a)+len(b))
      break
# Judge status: Wrong Answer
N = int(input())
flg = 0
for i in range(1,9):
    for j in range(1,9):
        if i*j==N:
            flg = 1
if flg == 1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
mod=10**9+7
l=list(map(int,input().split()))
d=len(str(bin(max(l))))-2
ll=[[0,0] for i in range(d)]
ans=0
for i in l:
  f=bin(i)[2:]
  for v in range(len(f)):
    ll[-1-v][int(f[v])]+=1
for i,(a,s) in enumerate(ll):
  ans+=pow(2,i,mod)*a*s%mod
  ans%=mod
print(ans)
# Judge status: Accepted
s = input()

l = ['x' for i in range(len(s))]
print(''.join(l))
# Judge status: Accepted
# ABC 130: B – Bounding
N, X = map(int, input().split())
L = [int(s) for s in input().split()]

D = [0]

for i in range(N):
    D.append(D[i] + L[i])

print(len([d for d in D if d <= X]))
# Judge status: Wrong Answer
import collections
N=int(input())
S=[]
for i in range(N):
  s=str(input())
  S +=[s]
T=collections.Counter(S)
P=list(T.keys())
Q=list(T.values())
for i in range(len(P)):
  if Q[i]==max(Q):
    print(P[i])
# Judge status: Accepted
data1 = input()
data2 = input()

count = 3 -1
sw = 0
i = 0
j = len(data2)-1
while i <= count:
    if data1[i] == data2[j]:
        sw += 1
    i += 1
    j -= 1
if sw == 3:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

ans = 0
for a in A:
    B_a = [b > a for b in B]
    for b in B_a:
        C_b = [c > b for c in C]
        ans += len(C_b)
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
from itertools import product, permutations, combinations
N=int(input())
A=sorted(list(map(int, input().split())), reverse=True)
B=sorted(list(map(int, input().split())), reverse=True)
C=sorted(list(map(int, input().split())), reverse=True)


ret = 0
for i in C:
    if i <= B[0]:
        break
    small_b = [b for b in B if b < i]
    for j in small_b:
        if j <= small_b[0]:
            break
        small_a = [a for a in A if a < j]
        ret += len(small_a)

print(ret)
# Judge status: Accepted
s=input()
t=input() 
if s==(t[::-1]) and t==(s[::-1]):
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
import math
X, Y = map(int, input().split())
ans = math.floor(math.log2(Y/X))
if ans == 0:
  print(0)
else:
  print(ans+1)
# Judge status: Accepted
n = int(input())
l_ls = list(map(int,input().split()))
l_ls.sort()
s_len = 0

for i in range(n-1):
    s_len += l_ls[i]

if s_len > l_ls[-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
c = input()
list = 'aeiou'
if c in list:
    print('vowel')
else:
    print('consonant')
# Judge status: Accepted
a = int(input())
sum_a = a + a**2 + a**3
print(sum_a)
# Judge status: Accepted
N = int(input())

if N > 81:
    print('No')

ans_list = []
if N <= 81:
    for i in range(1,10):
        for j in range(1,10):
            ans_list.append(i * j) 
    if N in ans_list:
        print('Yes')
    if N not in ans_list:
        print('No')
# Judge status: Accepted
N = int(input())
A = []
B = []
for _ in range(N):
    x, y = map(int, input().split())
    A.append(x+y)
    B.append(x-y)
    
A.sort()
B.sort()

print(max(A[N-1]-A[0],abs(B[N-1]-B[0])))
# Judge status: Accepted
n = int(input())


def judge(x):
    i = 1
    ans = 0
    while i*i < x:
        if x%i == 0:
            ans+=1
            if (x//i)*i == x:
                ans += 1
        i+=1
    if ans == 8:
        return True
    else:
        return False

ans = 0

for i in range(1,n+1,2):
    if judge(i):
        ans += 1
print(ans)
# Judge status: Accepted
S = input()
target = 'keyence'
if target in S:
    print('YES')
    exit()
l = 0
r = 0
while S[l] == target[l]:
    l += 1
while S[len(S)-r-1] == target[6-r]:
    r += 1
if l + r >= 7:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
task = []
for _ in range(n):
    a, b = map(int, input().split())
    task.append((b, a))
task.sort()

time = 0
for b, a in task:
    time += a
    if time > b:
        print("No")
        quit()
print("Yes")
# Judge status: Wrong Answer
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min_a = min(a)
min_b = min(b)
for k in range(M):
      x, y, c = map(int, input().split())
      ans = min((min_a + min_b), ((a[x - 1] + b[y - 1]) - c))
print(ans)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
i=0
ans =0
while i<n-1:
    if p[i]==i+1 or p[i+1]==i+2:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
    i+=1
print(ans)
# Judge status: Wrong Answer
import numpy as np
a, b= map(str, input().split())
ab = int(a+b)
c = 4
d = -1
print(ab)

while np.power(c, 2) < ab + 1:
     if np.power(c, 2) != ab:
        c  += 1
     else:
        d = np.power(c, 2) 
        break

if d != -1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A, B = map(int, input().split())
if A>=B+1:
    print(2*A-1)
elif A+1<=B:
    print(2*B-1)
elif A==B:
    print(2*A)
# Judge status: Accepted
import numpy as np
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

my_max = np.max(np.array(A))
max_count = np.count_nonzero(A == my_max)

if max_count > 1:
    [print(my_max) for _ in range(N)]
else:
    my_next_max = np.max(np.array([a for a in A if a != my_max]))
    [print(my_max) if a != my_max else print(my_next_max) for a in A]
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
chk = []
for i in range(n):
  a,b =  map(int,input().split())
  if a <= m:
    chk.append((a,b))
    
from operator import itemgetter
chk = sorted(chk,key=itemgetter(0),reverse=True)
chk = sorted(chk,key=itemgetter(1),reverse=True)
from collections import Counter
c = Counter()
s = 0
ss = m*(m+1)//2
ans = 0
for nn,i in enumerate(chk):
  if s == m:
    break
  a,b = i
  if c[a] <= m-a and ss >= a:
    ans += b
    c.update({a:1})
    s += 1
    ss -= a
    
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=100
for i in range(10**18):
 a+=int(a/100)

 if a>=n:
  print(i+1)
  exit()
# Judge status: Wrong Answer
n = int(input())
h = []

for i in range(n):
    h.append(int(input()))
    
h_sort = sorted(h, reverse=True)

for i in range(n):
    if h[i] == h_sort[0]:
        print(h[1])
    else:
        print(h[0])
# Judge status: Accepted
S = input()
if S[-1] == 's':
  print(S+'es')
else:
  print(S+'s')
# Judge status: Accepted
N, T = map(int, input().split())
cost = []

for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        cost.append(c)
    
print('TLE' if len(cost) == 0 else min(cost))
# Judge status: Accepted
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*(10**5+10)
for a in A:
    cnt[a]+=1
s=sum(A)
Q=int(input())
for _ in [0]*Q:
    b,c=map(int,input().split())
    s+=cnt[b]*(c-b)
    cnt[c]+=cnt[b]
    cnt[b]=0
    print(s)
# Judge status: Accepted
#!/usr/bin/env python3
import sys
import string


def solve(C: str):
    print(chr(ord(C) + 1))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    C = next(tokens)  # type: str
    solve(C)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
sl = sum(l)
ans = 'Yes'
for i in l:
    if sl - i*2 <= 0:
        ans = 'No'
print(ans)
# Judge status: Accepted
N = int(input())

v = float("inf")
for a in range(1, N):
    b = N - a
    c = sum(map(int, str(a))) + sum(map(int, str(b)))
    if c < v:
        v = c
print(v)
# Judge status: Accepted
def main():
    x, y = map(int, input().split(' '))
    if y >= x:
        print(str(x) * y)
    else:
        print(str(y) * x)


if __name__ == '__main__':
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-

H,W,N = [int(input()) for _ in range(3)]

ans = N/max(H,W) if N%max(H,W)==0 else N/max(H,W)+1
print(int(ans))
# Judge status: Accepted
import bisect

N, X = map(int, input().split())
l = list(map(int, input().split()))
d = [-1]*(N+1) #0-index #バウンドする位置を格納するリスト
d[0] = 0 #バウンドする初期値は0

for i in range(1, N+1):
    d[i] = d[i-1] + l[i-1]

#print(d)
#print('left:', bisect.bisect_left(d, X))
#print('right:', bisect.bisect_right(d, X))
print(bisect.bisect_right(d, X))
# Judge status: Accepted
a, b, c = map(int, input().split())

print('Yes' if a > c > b or a < c < b else 'No')
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

dist = abs(b - a)
mys = v - w

if mys * t >= dist:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
ok='AGCT'
s=list(input())
cnt=0
ans=0
for si in s:
  if si in ok:
    cnt+=1
  else:
    ans = max(ans,cnt)
    cnt=0
ans = max(ans,cnt)
print(ans)
# Judge status: Accepted
N = int(input())
A = sorted(list(map(int,input().split())),reverse = True)

edge = []

for i in range(1,N):
  if A[i] == A[i - 1] and A[i] not in edge:
    edge.append(A[i])
  elif A[i] == A[i - 3]:
    edge.append(A[i])
  
  if len(edge) == 2:
    break
    
if len(edge) <= 1:
  print(0)
else:
  print(edge[0] * edge[1])
# Judge status: Accepted
n = int(input())
s = list(input())
cum_s = []
wum = 0
eum = 0
for i in range(n):
    if s[i] == "W":
        wum += 1
    else:
        eum += 1
    cum_s.append([wum,eum])
r = cum_s[-1]
ans = int(1e10)
for i in range(n):
    tar = cum_s[i]
    cnt = 0
    if s[i] == "W":
        cnt += tar[0]-1
        cnt += r[1] - tar[1]
    else:
        cnt += tar[0]
        cnt += r[1] - tar[1]
    ans = min(ans,cnt)
print(ans)
# Judge status: Accepted
n = int(input())
for i in range(n, 0, -1):
    if (i**0.5).is_integer():
        print(i)
        break
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(1,N+1):
  if (i%3 !=0) & (i%5!=0):
    ans = ans +i
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

def main():

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

    if (A + B) % 2 == 0:
        ans = (A + B) / 2

    else:
        ans = 'IMPOSSIBLE'

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
from collections import Counter
def main():
    n = int(input())
    ans = []
    for x in range(1, n):
        for y in range(1, n):
            for z in range(1, n):
                ans.append(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)
    counter = Counter(ans)
    for i in range(1, n+1):
        print(counter[i], i)
 
 
if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k,s=map(int,input().split())
if s==10**9:
  ans=[s]*k+[10**9-1]*(n-k)
else:
  ans=[s]*k+[10**9]*(n-k)
print(*ans)
# Judge status: Accepted
# coding:utf-8
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v < 10050:  #vはnを表していて、vのところで与式を満たす
                ans[v] += 1
for i in range(n):
    print(ans[i+1])
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        # print(i)
        ans += 1

print(ans)
# Judge status: Wrong Answer
n,p=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]%2
a.sort()
one=sum(a)
zero=n-one
if p==1 and one==0:
    print(0)
    exit()
print(2**(zero)*2**(one-1))
# Judge status: Accepted
def main():
    A, B = map(int, input().split())

    if (A + B) % 2 == 0:
        ans = (A + B) // 2
    else:
        ans = "IMPOSSIBLE"

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys

def resolve():
    N = int(input())
    for i in range(4, 100, 4):
        if N == i:
            print("Yes")
            return
        for j in range(7, (100//7), 7):
            if N == j:
                print("Yes")
                return
            if N == i + j:
                print("Yes")
                return
    print("No")

if '__main__' == __name__:
    resolve()
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = 0
for i in range(1, a+1):
  for j in range(1, b+1):
    if i == j:
      ans += 1
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = list(map(int,input().split()))
print(a)
for i in range(m):
    n=n-a[i]
if(i>=0):
    print(n)
else:
    print(-1)
# Judge status: Accepted
import math
def main():
  d,n = list(map(int,input().split()))
  if n==100:
    n+=1
  print(pow(100,d)*n)
main()
# Judge status: Accepted
n,m=map(int, input().split())
table = [0]*m
c = 0
for i in range(n):
    ans = list(map(int, input().split()))
    for j in range(1,len(ans)):
        table[ans[j]-1] += 1
for i in range(m):
    if table[i] == n:
        c += 1
print(c)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(lambda a: int(a) - 1, input().split()))
INF = 10**18

minDist = [INF] * N
minDist[0] = 0

now = 0
R = 0
while minDist[now] < INF:
    to = A[now]
    if minDist[to] < INF:
        R = minDist[now] + 1 - minDist[to]
        break
    minDist[to] = minDist[now] + 1
    now = to

if minDist.count(K) > 0:
    print(minDist.index(K) + 1)
    exit()

K -= minDist[now]
M = K % R
for _ in range(M):
    now = A[now]
print(now + 1)
# Judge status: Accepted
n = int(input())
power = 1
for i in range(1,n+1):
    power *= i
    power = power % (10 ** 9 + 7)

print(power % (10 ** 9 + 7))
# Judge status: Accepted
def main():
    n = int(input())
    s = input()
    t = input()

    for i in range(n):
        if s[i:] == t[:n - i]:
            print(n + i)
            break
    else:
        print(2 * n)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,y = map(int, input().split())
a = -1
b = -1
c = -1

for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if k < 0:
            pass
        else:
            yy = 10000*i + 5000*j + 1000*k
            if yy == y:
                a = i
                b = j
                c = k
                break
print(a,b,c)
# Judge status: Accepted
import fractions

n,x=map(int,input().split())
x2=list(map(int,input().split()))
li=[abs(x2[i]-x) for i in range(n)]

ans=li[0]
for i in range(n):
    ans=fractions.gcd(ans,li[i])
print(ans)
# Judge status: Accepted
import math
a,b,c,d = map(int, input().strip().split())

if math.ceil(a/d) >= math.ceil(c/b):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())

m = max(a, b, c)
print(sum([a, b, c])-m+(m*2)**k)
# Judge status: Wrong Answer
n = int(input())
s = input()
so = ''
for i in range(len(s)):
    ni = ord(s[i]) + n
    if ni > 122:
        ni -= 26
    so += chr(ni)
print(so)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

b = [(a[i]-i-1) for i in range(n)]
b = sorted(b)

if n % 2 == 1:
  res = b[(n-1)//2]
else:
  res = (b[n//2-1] + b[n//2])//2
  
print(sum(map(abs, [b[i]-res for i in range(n)])))
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())

wake_time = h2*60 + m2 - (h1 *60 + m1);

if wake_time > k:
    print(wake_time - k);
else:
    print(0);
# Judge status: Accepted
n = int(input())
data = input().split()

int_data = [int(int_data) for int_data in data]
int_data.sort(reverse=True)

Alice = 0
Bob = 0

for i in range(n):
    if i % 2 == 0:
        Alice += int_data[i]
    else:
        Bob += int_data[i]
        
print(Alice - Bob)
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  a, b, c = map(int, input().strip().split())
  print(max(c - (a - b), 0))

if __name__=='__main__':
  main()
# Judge status: Wrong Answer
s = str(input())
count = 0
for i in range(len(s)):
    if(s[i] == ">"):
        count += 1
ans = 0
for i in range(1,count+1):
    ans += i
print(ans)
# Judge status: Wrong Answer
from collections import Counter
N=int(input())
d={chr(i):100 for i in range(ord("a"),ord("z")+1)}
for i in range(N):
  A={chr(i):0 for i in range(ord("a"),ord("z")+1)}
  A.update(Counter(list(input())))
  for i in A:
    if d[i]>A[i]:
      d[i]=A[i]
for i in d:
  if d[i]==100:
    d[i]=0
ans=""
for i in d:
  ans+=i*d[i]
print(ans)
# Judge status: Accepted
import math

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

print(m*n//(math.gcd(m, n)))
# Judge status: Accepted
a,b=map(int,input().split());print((a+b)%24)
# Judge status: Accepted
m=int(input())//2
l=sorted(list(map(int,input().split())))
print(l[m]-l[m-1])
# Judge status: Wrong Answer
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
ans = [''] * len(S)
cur = 0
for s in S:
    if s == 'B':
        ans[cur] = ''
        cur -= 1
        cur = max(0, cur)
    else:
        ans[cur] = s
        cur += 1

print("".join(ans))
# Judge status: Accepted
# 入力
A, B = map(int,input().split())

# 処理
start = A + B
if start >= 24:
    print(start - 24)
else:
    print(start)
# Judge status: Accepted
k, n = map(int, input().split())
array = list(map(int,input().split()))
max_length = 0
sum_length = 0
for i in range(n - 1):
  length = array[i + 1] - array[i]
  sum_length += length
  if length > max_length:
    max_length = length
last_length = k - array[n - 1] + array[0]
sum_length += last_length
max_length = max(max_length, last_length)
print(sum_length - max_length)
# Judge status: Accepted
import sys
a,b = list(map(int, input().split()))

if a<=0 and b>= 0:
  print("Zero")
  sys.exit()
elif a < 0 and b < 0:
  if (-(a-b)+1)%2 == 0:
    print("Positive")
    sys.exit()
  else:
    print("Negative")
    sys.exit()
elif a==0 or b==0:
  print("Zero")
  sys.exit()
elif a>0 and b>0:
  print("Positive")
  sys.exit()
else:
  if (-a)%2 == 0:
    print("Positive")
  else:
    print("Negative")
# Judge status: Accepted
import sys
import bisect

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = sorted(list(map(int, input().split())))
    if n == 2:
        print(*A[::-1])
        exit()

    idx = bisect.bisect_left(A, A[-1] // 2)
    if abs(A[-1] - A[idx] - A[-1] // 2) > abs(A[-1] - A[idx - 1] - A[-1] // 2):
        idx -= 1

    print(A[-1], A[idx])


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
import numpy as np
n=int(input())
l=list(map(int,input().split()))

arr=np.sort(np.array(l))
med=np.median(arr)

med_max=int(np.median(np.delete(arr,0)))
med_min=int(np.median(np.delete(arr,n-1)))


if n%2==0:
    p=(n+1)//2
    for i in range(n):
        if l[i]<arr[p-1]:
            print(med_max)
        else:
            print(med_min)
# Judge status: Accepted
# abc171_c.py
import math
N = int(input())
ans=[]
while N > 0:
    ans.append(N%26)
    N = math.floor((N-1)/26)
alphabet = 'abcdefghijklmnopqrstuvwxyz'
ans = reversed(ans)
for i in ans:
    print(alphabet[i-1],end="")
# Judge status: Accepted
import sys

X, K, D = [int(x) for x in input().strip().split(" ")]

X = abs(X)
k, x = divmod(X, D)

if K <= k:
    print(X - D * K)
    sys.exit(0)

X = x
K -= k

if K % 2 == 0:
    print(abs(X))
    sys.exit(0)

print(abs(X - D))
# Judge status: Accepted
k,a,b = map(int, input().split())
print(k+1 if b-a <= 2 else a + ((k-a+1)//2*(b-a) + ((k-a+1)%2)))
# Judge status: Wrong Answer

abc = list(input().split())
list = sorted(abc)
print("Yes" if int(list[0])+int(list[1])==int(list[2]) else "No")
# Judge status: Accepted
N = list(input())

if '7' in N:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
w, h ,x, y=map(int, input().split())
ans=w*h/2

if w==2*x and h==2*y:
    p=1
else:
    p=0

print(ans, p)
# Judge status: Wrong Answer
N,K = map(int,input().split())
A = list(map(int,input().split()))
flag = 0
position = [0]
while flag == 0:
  temp = position[-1]
  if A[temp] -1 in position:
    flag = 1
  position.append(A[temp]-1)
for i in range(len(position)):
  if position[i] == position[-1]:
    start = i
    break

x = start + (K - start)%(len(position) - start -1)

print(position[x]+1)
# Judge status: Accepted
n = int(input())
lst = [2]

if n==1:
    print(1)
else:
    lst.append(1)
    for _ in range(n-2):
        lst.append(lst[-1]+lst[-2])
    print(lst[-1]+lst[-2])
# Judge status: Wrong Answer

S = str(input())

if S[0] != S[1] and S[1] != S[2] and S[2] != S[0]:
    print('Yes')
    
else:
    print('Bad')
# Judge status: Accepted
N,M=map(int,input().split())
A=list(map(int,input().split()))
if N<sum(A):
    print(-1)
    exit()
print(N-sum(A))
# Judge status: Accepted
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

a,b,t=input2()
ans=0

for i in range(1,21):
	if a*i>t:
		break
	ans+=b
print(ans)
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a) + a[0] * 9)
# Judge status: Wrong Answer
H1,M1,H2,M2,K=map(int,input().split())

t1=60*H1 + M1
t2=60*H2 + M2
ans=0
tmp=t1
while(1):
    tmp+=K
    if tmp>=t2:
        break
    ans+=K

print(ans)
# Judge status: Accepted
import sys
a, b, c=map(int, input().split())
k=int(input())
while(k>=1 and a>=b):
    b=b*2
    k=k-1
if a>=b:
    print("No")
    sys.exit()
while(k>=1 and b>=c):
    c=c*2
    k=k-1
if b>=c:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
x,a,b=map(int,input().split())
 
print('delicious'if b<=a else 'safe' if a<b and b-a<=x else 'dangerous')
# Judge status: Accepted
# B 
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a,b=nm()

if a<=0<=b:
    print('Zero')
elif b<0:
    if (b-a+1)%2==1:
        print('Negative')
    elif (b-a+1)%2==0:
        print('Positive')
elif 0<a:
    print('Positive')
# Judge status: Accepted
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())

A = [0] + A
answer = 0
for i in range(1, N + 1):
    if A[i - 1] and A[i]:
        answer += 1
        A[i] -= 1
    n, A[i] = divmod(A[i], 2)
    answer += n
print(answer)
# Judge status: Accepted
n = int(raw_input())
count = 0
res = 0
ais = map(int , raw_input().split())

for i in range(n + 1):
	if (ais[i] if i < n else -1) != i + 1:
		#flush the count
		res += (count + 1)/2# + 1
		count = 0
	else:
		count +=1
print res
# Judge status: Wrong Answer
k = int(input())
s = input()
if len(s) >= k:
    print(s[0:k] + "...")
elif len(s) < k :
    print(s)
# Judge status: Accepted
n,r=map(int,input().split())
ra=r
if n<=10:
  ra=ra+1000-100*n
print(ra)
# Judge status: Accepted
N=int(input())
ans=[0]*10001

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            tmp=x**2+y**2+z**2
            tmp+=x*y+y*z+z*x
            if tmp<=N:
                ans[tmp]+=1
                
for i in range(1,N+1):
    print(ans[i])
# Judge status: Accepted
import math
from functools import reduce
n, m = input().split()
a = list(map(int, input().split()))
b =[0]*int(n)
for i in range(len(a)):
  b[i] = a[i]//2

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
c = 0

x = lcm_list(b)
for i in range(int(n)):
  if (x // b[i]) % 2 == 0:
    c = -1
    break
  else:
    continue
    
if c == -1:
  print(0)
else:
  print(math.floor(((int(m)/x)+1)/2))
# Judge status: Wrong Answer
X = int(input())
if X == 7 or X == 5 or X == 3:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input()
k = input()

for a in s:
    if a != '1':
        print(int(a))
        exit()

print(1)