peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x = ns()
ct = 0
ans = 0
for c in x:
    if c == 'S':
        ct += 1
    else:
        if ct > 0:
            ct -= 1
            ans += 2
print(len(x)-ans)
# Judge status: Accepted
N = input().strip()
k = len(N)
if k==1:
    print(int(N))
else:
    if N[1:]=="9"*(k-1):
        print(int(N[0])+9*(k-1))
    else:
        print(int(N[0])-1+9*(k-1))
# Judge status: Wrong Answer
N = int(input())
P = [int(i) for i in input().split()]
num = 1

if(N>1):
    for i in range (1,N):
      if P[i] < P[i-1]:
        num +=1
print(num)
# Judge status: Accepted
n, r = map(int, input().split())

if n >= 10:
    print(r)
else:
    print(r + (100 * (10 - n)))
# Judge status: Wrong Answer
N = input()
N_list = list(N)
print(N_list)
if N_list[0] == "2" or N_list[0] == "4" or N_list[0] == "5" or N_list[0] == "7" or N_list[0] == "9":
    print("hon")
elif N_list[0] == "0" or N_list[0] == "1" or N_list[0] == "6" or N_list[0] == "8":
    print("pon")
else:
    print("bon")
# Judge status: Wrong Answer
s = input()
cnt = 0
li = [0]
for i in range(len(s)):
  if s[i] == "A" or s[i] == "C" or s[i] == "G"or s[i] == "T":
    cnt += 1
  else:
    li.append(cnt)
    cnt = 0
print(max(li))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
n=0
if all(aa%2==0 for aa in a):
  n+=1
print(n)
# Judge status: Accepted
S = list(map(int, list(input())))
for pattern in range(1 << 3):
    this_sum = S[0]
    for i in [1, 2, 3]:
        if pattern & 1 << i-1:
            this_sum += S[i]
        else:
            this_sum -= S[i]
    if this_sum == 7:
        break
output = str(S[0]) + "".join(["-+"[bool(pattern & 1 << i-1)] + str(S[i]) for i in [1, 2, 3]]) + "=7"
print(output)
# Judge status: Accepted
n,a,b,c,d = map(int,input().split())
s = input()

if('##' in s[a-1:d]):
    print('No')
    exit()
if(c < d):
    print('Yes')
else:
    if('...' in s[b-2:d+1]):
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
# 初期入力
import numpy as np
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A.sort()
A_set =set(A)
A_np =np.array(A,dtype=np.int64)
count =set()
for i in range(N):
    a_mod =np.where(A_np %A_np[i] ==0)
    aa =A_np[a_mod]
    a_self =np.where(aa==A_np[i])  
    a_count =np.delete(aa,a_self)
    a_count = a_count.tolist()
    count |= set(a_count)      
ans =len(A_set - count)
print(ans)
# Judge status: Accepted
from math import ceil

s = int(input())
a = ceil(s / 10**9)
b = 10**9*a - s
print(*[0, 0, 10**9, b, 1, a])
# Judge status: Accepted
s = input()
x = s.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
if x:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
n=int(input())
v=list(map(int,input().split()))
ans=0
x=0
for i in range(n):
    ans+=v[i]
    if ans>=sum(v)/2:
        x=i
        break
print(abs(sum(v[:x+1])-sum(v[x+1:])))
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))

cnt = 0
for i in range(N):
  if P[i] != i+1:
    cnt += 1
    
if cnt <= 2:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N , M =map(int , input().split())
S = set(k for k in range(0,N))
H = list(map(int , input().split()))
for i in range(M):
    f , g =map(int , input().split())
    x=f-1
    y=g-1
    if H[x]<=H[y]:
            S.discard(x)
    if H[x]>=H[y]:
            S.discard(y)
print(len(S))
# Judge status: Wrong Answer
h = int(input())

sum=0

for i in range(int(h/2)+1):
    sum = sum+(2**i)
print(sum)
# Judge status: Accepted
a,b=map(int,input().split())
if 13<=a:
    print(b)
elif 6<=a<=12:
    print(b//2)
else:
    print(0)
# Judge status: Accepted
import itertools
import numpy as np

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

score = []
ans = 0
for A in itertools.combinations_with_replacement(range(1, M+1), N):
  for i in range(Q):
    a = abcd[i][0]
    b = abcd[i][1]
    c = abcd[i][2]
    d = abcd[i][3]
    if A[b-1]-A[a-1] == c:
      score.append(d)
  if ans <= sum(score):
    ans = sum(score)
  score.clear()
print(ans)
# Judge status: Accepted
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())
# Judge status: Accepted
import numpy as np
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(input()))
a = np.array(a)
b = []
for _ in range(m):
    b.append(list(input()))
b = np.array(b)
for dy in range(n-m+1):
    for dx in range(n-m+1):
        if (a[dy:m+dy, dx:m+dx]==b).all():
            print('Yes')
            break
    else:
        continue
    break
else:
    print('No')
# Judge status: Accepted
import sys
ab=input().rstrip().split(" ")
a=int(ab[0])
b=int(ab[1])
if a>=b:
    l=a
    s=b
elif a<b:
    l=b
    s=a
for i in range(1,s+1):
    u=i*l
    if u%s==0:
        ans=u
        print(ans)
        sys.exit()
# Judge status: Accepted
from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
print(reduce(gcd, a))
# Judge status: Accepted
S = list(input())

if S[2] == S[3] and S[4] == S[5]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
A = 15
B = 200

if A >= 13:
  price = B
elif 6 <= A <= 12:
  price = B/2
else:
  price = 0

print(price)
# Judge status: Wrong Answer
import collections
n,m = map(int, raw_input().split(' '))
elems = map(int, raw_input().split(' '))

def gcd(a,b):
	return gcd(b,a%b) if b else a

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

for i in range(len(elems)):
	elems[i] /= 2

glcm = reduce(lcm, elems)

count = m / glcm
count-= count/2
print count

"""
x = ak * (p + 0.5)

x = ak/2 2p + ak/2
x = ak/2 * (2p+1)

x is a multiple of ak/2, with an odd pp (2p + 1)
for all k
x is a muliple of lcm([ak/2 for k in range(n)])

"""
# Judge status: Accepted
a,b = map(int,input().split())
print( b if a >= 13 else int(b/2) if a < 13 and a >= 6 else 0)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
l.sort()
tmp = 0
for i in range(n-1):
    tmp += l[i]

if l[-1] < tmp:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
p = [220000] + list(map(int, input().split()))

cnt = 0
m = 220000
for i in range(1, n+1):
    now = p[i]
    m = min(m, now)
    if now == m:
        cnt += 1
print(cnt)
# Judge status: Accepted
N=int(input())
while N:
    if N**0.5%1==0:
        print(N)
        break
    else:
        N-=1
# Judge status: Accepted
S = list(input())
S_uniq = list(set(S))

a_z_list = list('abcdefghijklmnopqrstuvwxyz')
not_holding_sorted = sorted(list(set(a_z_list) - set(S)))

if len(not_holding_sorted) == 0:
    ans = 'None'
else:
    ans = not_holding_sorted[0]
    
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = [0 for i in range(N+1)]

for a in A:
  B[a] += 1

nums = [b for b in B if b > 0]
nums.sort()
n = len(nums)
if n <= K:
  print(0)
else:
  print(sum(nums[:K-n]))
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 21 20:57:48 2020

@author: naoki
"""

alpha = input()

if alpha.isupper() == True:
    print("A")
else:
    print("a")
# Judge status: Wrong Answer
s=input()
n=len(s)
ans=10**10
for i in range(n-3):
  m=int(s[i:i+3])
  ans=min(ans,abs(m-753))
print(ans)
# Judge status: Accepted
print(7 - ['SUN','MON','TUE','WED','THU','FRI','SAT'].index(input()))
# Judge status: Accepted
import sys
input = sys.stdin.readline

from itertools import combinations_with_replacement

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

ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

lst = [i for i in range(M)]

ans = 0
for tmp in combinations_with_replacement(lst, N):
    score = 0
    for a, b, c, d in ABCD:
        if tmp[b - 1] - tmp[a - 1] == c:
            score += d
    ans = max(ans, score)

print (ans)
# Judge status: Wrong Answer
n, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if A[i]+A[i+1]>x:
        ans += A[i+1]+A[i]-x
        A[i+1] = x-A[i]
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

div = 0
sum = 0
l = [a, b, c, d, e]

for i in range(len(l)):
    if(l[i] % 10 != 0):
        sum += (l[i]//10+1)*10
        if((l[i]//10+1)*10 - l[i] > div):
            div = (l[i]//10+1)*10 - l[i]
    else:
        sum += l[i]
        
print(sum-div)
# Judge status: Accepted
import math

def main():
    A,B,C,D = list(map(int, input().split()))
    
    print("Yes" if math.ceil(C / B) <= math.ceil(A / D) else "No")
    pass

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, k = map(int,input().split())
list = []
if k ==1:
  d = input()
  #print(i)
  for a in map(int,input().split()):
    list.append(a)
    
else:
  
  for i in range(0,k-1):
    d = input()
    #print(i)
    for a in map(int,input().split()):
      list.append(a)
    
    
#print(list)
print(n - len(set(list)))
# Judge status: Wrong Answer
n,x,y=map(int,input().split())
ans=[0]*n
for i in range(n):
    for j in range(i):
     dis=min(abs(i-j),abs(x-i)+1+abs(y-j))
     ans[dis]+=1
for i in ans:
    print(i)
# Judge status: Accepted
# coding: utf-8
# Your code here!
a=input()
b=input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N = int(input())

ans = 1
for i in range(1,N+1):
    ans = (ans%(1000000007)) * i

print(ans)
# Judge status: Accepted
k,x=map(int,input().split())
print("Yes") if k*500>=x else print("No")
# Judge status: Wrong Answer
a,b=input().split(' ')
if int(a)<100 and int(b)<100:
    print(int(a)*int(b))
else:
    pass
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
        if i + j > k:
          if j + k > i:
            if k + i > j:
              ans += 1
              
print(ans)
# Judge status: Accepted
import numpy as np
S=list(input())
S=[True if i=="0" else False for i in S]
stripeA=[True]*len(S)
stripeB=[True]*len(S)
for i in range(len(S)):
    if i%2==0:
        stripeA[i]=False
    else:
        stripeB[i]=False
stripeA=list(np.logical_xor(S,stripeA))
stripeB=list(np.logical_xor(S,stripeB))
stripeA=stripeA.count(True)
stripeB=stripeB.count(True)
if stripeA>stripeB:
    print(stripeB)
else:
    print(stripeA)
# Judge status: Accepted
n = int(input())
s = str(input())
t = str(input())

if s == t:
    print(n)
    exit()

for i in range(1, n):
    s_ = s[i:n]
    t_ = t[0:n-i]
    if s_ == t_:
        ans = s[:i]+t
        print(len(ans))
        exit()
else:
    print(2*n)
# Judge status: Accepted
S=input()
print('x'*len(S))
# Judge status: Wrong Answer
l = input().split()
print(l[0]+l[1])
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
if a >= b:
  print('delicious')
elif x < a-b:
  print('dangerous')
else:
  print('safe')
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))
flag = True
reach = False

for n in range(N - 1):
  if H[n] > H[n + 1]:
    if n >= 1 and H[n] - 1== H[n + 1] and H[n] - 1 >= H[n - 1]and reach == False:
      reach = True
      H[n] -= 1
    elif n == 0 and H[n] - 1== H[n + 1] and reach == False:
      reach = True
      H[n] -= 1
    else:
      flag = False
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
if N >= 1000:
    print("ABD")
else:
    print("ABC")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

ans = [0] * N
for i,a in enumerate(A[::-1]):
    n = m = N-i
    s = 0
    while m <= N:
        s += ans[m-1]
        m += n
    ans[n-1] = (s%2)^a

ans = [i+1 for i,a in enumerate(ans) if a]
print(len(ans))
if ans:
    print(*ans, sep='\n')
# Judge status: Accepted
A,B = map(int,input().split())
from fractions import gcd
C = gcd(A,B)
num = []
for i in range(2,int(C**0.5)+1):
    while C%i==0:
        num.append(i)
        C //= i
if C != 1:
    num.append(C)
from collections import Counter
CC = Counter(num)
print(len(CC)+1)
# Judge status: Accepted
s = input()
a = ""
tmp = ""
cnt = 0
while True:
    for cha in s:
        a+= cha
        if tmp !=a:
            tmp =a
            cnt +=1
            a = ""
    break
print(cnt)
# Judge status: Wrong Answer
S = str(input())
year = S[0] + S[1]
month = S[2] + S[3]
if int(year) <= 12 and int(month) <= 12 and int(year) != 0 and int(month) != 0:
    print('AMBIGUOUS')
elif int(month) > 12 and int(month) != 0 and int(year) == 0:
    print('MMYY')
elif int(year) > 12 and int(year) != 0 and int(month) != 0:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
s = input()
ans = 0
for i in range(len(s)):
  if s[i] != s[-(i+1)]:
    ans += 1
print(ans // 2)
# Judge status: Accepted
from fractions import gcd

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

L=[0]*n
R=[0]*n
L[0]=A[0]
R[n-1]=A[n-1]
res=0

for i in range(1,n):
	L[i]=gcd(L[i-1],A[i])
for i in range(0,n-1):
	R[n-i-2]=gcd(R[n-i-1],A[n-i-2])

for i in range(1,n-1):
	res=max(res,gcd(L[i-1],R[i+1]))
	
print(max(res,L[n-2],R[1]))
# Judge status: Accepted
s = list(map(str, input().rstrip()))
k = int(input())

diff = [(ord("a") + 26 - ord(x)) % 26 for x in s]

for i in range(len(s) - 1):
    if diff[i] <= k:
        s[i] = "a"
        k -= diff[i]
    else:
        continue

tmp = ord(s[-1]) + k % 26
if tmp > 122:
    tmp -= 26

s[-1] = chr(tmp)

print("".join(s))
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())
print(
    'R' * (tx - sx) + \
    'U' * (ty - sy) + \
    'L' * (tx - sx) + \
    'D' * (ty - sy + 1) + \
    'R' * (tx - sx + 1) + \
    'U' * (ty - sy + 1) + \
    'L' + 'U' + \
    'L' * (tx - sx + 1) + \
    'D' * (ty - sy + 1) + \
    'R'
)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
G=1000
K=0
for i in range(N-1):
  if A[i+1]>A[i]:
    K=K+G//A[i]
    G=G % A[i]
  if A[i+1]<A[i]:
    G=G+A[i]*K
    K=0
G=G+A[N-1]*K
print(G)
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[a[i]//2 for i in range(n)]
from fractions import gcd
from functools import reduce
def lcm(x,y):
  return (x*y)//gcd(x,y)
x=reduce(lcm,b,1)
y=reduce(lcm,a,1)
if x>m:
  print(0)
else:
  z=(m-x)//y+1
  for i in b:
    if (x//i)%2==0:
      z=0
      break
  print(z)
# Judge status: Accepted
N,K = map(int,input().split())
S = input()
ans = S
S = S[:K-1] + S[K-1].lower() + S[K:]
print(S)
# Judge status: Wrong Answer
n = int(input())
s = [input() for i in range(n)]
a = s[0]
for i in range(1,n):
    tmp = set(s[i])
    t = []
    for j in range(len(a)):
        if a[j] in tmp:
            t.append(a[j])
    a = ''.join(t)
    if not a:
        print()
        exit()
print(''.join(sorted(a)))
# Judge status: Accepted
N = int(input())
c = input()
rlist = []
wlist = []
for i in range(N):
    if c[i] == 'R':
        rlist.append(i)
    else:
        wlist.append(i)

cnt = 0
if len(rlist) == 0:
    print(0)
    exit()
for i in range(len(wlist)):
    if wlist[i] < rlist[-cnt - 1]:
        cnt += 1
    else:
        break
print(cnt)
# Judge status: Accepted
def main():
	n = int(input())
	h = list(map(int,input().split()))

	sum_h = sum(h)%(10**9 + 7)
	ans = 0
	for i in h:
		i = i%(10**9 + 7)
		sum_h -= i
		ans += i*sum_h

	print(ans%(10**9 + 7))
	

	

if __name__ == '__main__':
	main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a.sort()
ans = 0

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if a[i] != a[j] and a[j] != a[k] and a[k] != a[i] and a[i]+a[j] > a[k]:
                ans += 1
print(ans)
# Judge status: Accepted
import sys
import numpy as np
n = int(input())
s = list(map(str, input().rstrip()))

ss = s.count("#")
sd = s.count(".")

if ss == 0 or sd == 0:
    print(0)
    sys.exit()

s = np.array([x == "#" for x in s])

dp = np.zeros([2, n], dtype=int)

# dp0は黒の数、dp0は白の数
dp[0] = s
dp[1] = ~s

dp = dp.cumsum(axis=1)

# 白の数は「それ以降の」と読み替える
dp[1] = dp[1].max() - dp[1]

print(min((dp[0] + dp[1]).min(), ss, sd))
# Judge status: Accepted
print(2**(len(bin(int(input()))[2:]))-1)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
tot = sum(A)
for i in range(n):
    en = A[i] + A[i+1]
    A[i] = max(A[i] -B[i],0)
    if A[i] == 0:
        A[i+1] = max(en - B[i],0)
        #print(A[i],A[i+1])
print(tot-sum(A))
# Judge status: Accepted

N = int(input())
S = input()

W = [0]
E = [0]

for i in range(N): 
  s = S[i]
  if s == "W":
    W.append(W[-1] + 1)
    E.append(E[-1])
  else:
    W.append(W[-1])
    E.append(E[-1] + 1)


ans = float("inf")
for i in range(N):
  ans = min(ans, W[i] + (E[-1] - E[i+1]))
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys
from collections import OrderedDict


def solve(S: int):
    print(0, 0, 1, 10 ** 9, S % (10 ** 9), S // (10 ** 9))
    return


# Generated by 1.1.7.1 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()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()
# Judge status: Accepted

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

sss = list(map(int, input().split()))
sss.sort(reverse = True)

a = sum(sss)

if sss[m - 1]  < (a / (4 * m)):
  print('No')
else:
  print('Yes')
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
diff = b - a
ah = sum(range(1, diff))
print(ah - a)
# Judge status: Accepted
n = int(input())

h = list(map(int, input().split()))
h[0] -= 1
for i in range(1, n):
    if h[i - 1] < h[i]:
        h[i] -= 1
    elif h[i - 1] == h[i]:
        pass
    else:
        print("No")
        break
else:
    print("Yes")
# Judge status: Accepted
s =input()
s2 = int(s)
n= int(s)%9
mn = 0
while s2:
    mn+=s2%10
    s2//=10
print(max(mn,(len(s)-1)*9+(int(s[0])-1)))
# Judge status: Accepted
import math
N = int(input())

if math.sqrt(N) > 10:
    print('No')
else:
    for i in range(1, 10):
        if N % i == 0 and N // i < 10:
            print('Yes')
            exit()
    print('No')
# Judge status: Accepted
A,B,C = map(int,input().split())
mini = 10**27
if A%2 == 0 or B%2 ==0 or C%2 ==0:
  mini = 0
  ans =0
else:
  x = int(A/2)
  ans1 = (x+1)*B*C-x*B*C 
  y = int(B/2)
  ans2 = (y+1)*A*C - y*A*C
  z = int(C/2)
  ans3 = (z+1)*B*A - z*B*A

  ans = min([ans1,ans2,ans3])
print(ans)
# Judge status: Accepted

def main():
  dance = input()
  
  for i in range(0, len(dance)):
    if (i+1) % 2 == 0:
      if dance[i] == "R": 
        print("No")
        return 0
    else:
      if dance[i] == "L":
        print("No")
        return 0
  print("Yes")
  return 1

main()
# Judge status: Accepted
n=int(input())
s=str(input())
ans="Yes"
if len(s)%2==1:
    ans="No"
for i in range(len(s)//2):
    if s[i]!=s[len(s)//2+i]:
        ans="No"
        break
print(ans)
# Judge status: Accepted
N = int(input())
jobs = [0]*N
for i in range(N):
    a, b = map(int, input().split())
    jobs[i] = (a, b)

jobs.sort(key=lambda x:x[1])

now = 0
jobIndex = 0
for i in range(N):
    if now + jobs[i][0] > jobs[i][1]:
        print("No")
        exit()
    now += jobs[i][0]

print("Yes")
# Judge status: Wrong Answer
n,k=map(int,input().split())
d=set([int(x) for x in input().split()])
for i in range(n,10001):
    flag=True
    for j in str(d):
        if j in str(i):
            flag=False
            break
    if flag==True:
        print(i)
        exit()
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = -1
sub = float("INF")
for i in range(N):
  temp = T - H[i] * 0.006
  if sub > abs(temp-A):
    sub = abs(temp-A)
    ans = i + 1
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
def f(x, k):
    d = abs(k-x)
    if d<x:
        return f(d, k)
    else:
        return x
x = N%K
print(f(x, K))
# Judge status: Accepted
#!python3

LI = lambda: list(map(int, input().split()))

# input
N, M = LI()


def main():
    s = N
    c = M
    x = min(s, c // 2)
    c -= 2 * x
    y = c // 4
    ans = x + y
    print(ans)
    


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
s = [int(input()) for s in range(n)]
s1 = []
sum0 = 0
for i in s:
    if i%10 == 0:
        sum0 += i
    else:
        s1.append(i)

if len(s1) == 0:
    print(0)
else:
    sum1 = sum(s1)
    if sum1%10 != 0:
        print(sum0 + sum1)
    else:
        print(sum0 + sum1 - min(s1))
# Judge status: Accepted
X = int(input())
A = 0
for i in range(1, 100000):
  A += i
  if X <= A:
    print(i)
    break
# Judge status: Accepted
from itertools import groupby
from math import ceil
*A, T = open(0).read().split()
n, k, r, s, p = map(int, A)
T = T.strip()

d = {'r':p, 's':r, 'p':s}
X = [T[i::k] for i in range(k)]
s = 0
for x in X:
    for key, rep in groupby(x):
        s += d[key] * ceil(len(list(rep)) / 2)
print(s)
# Judge status: Wrong Answer
n = int(input())
box  = []
prime = []
ans = 0
def Prime_Factorization(n):
    i = 2
    prime_factors = []
    while n > 1:
        if n % i == 0:
            prime_factors.append(i)
            n = n / i
        else:
            i += 1
    return prime_factors

for i in range(1,n):
    prime = Prime_Factorization(i)
    box.append(prime.count(2))
    #print(box)


if n == 1:
    print(1)
else:
    ans = box.index(max(box)) + 1
    print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())
x = list(map(int, input().split()))
t = []
for p in range(1, 101):
    q = 0
    for j in x:
        q += (j-p)**2
    t.append(q)
print(min(t))
# Judge status: Wrong Answer
print("Chrismas"+" Eve"*(25-int(input())))
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
ABCD = []
for _ in range(Q):
    ABCD.append(list(map(int, input().split())))
M_list = [i+1 for i in range(M)]
N_list = itertools.combinations_with_replacement(M_list, N)
max_point = 0
for n in N_list:
    point = 0
    for abcd in ABCD:
        if n[abcd[1]-1] - n[abcd[0]-1] == abcd[2]:
            point += abcd[3]
    if max_point < point:
        max_point = point
print(max_point)
# Judge status: Accepted
x=int(input())
cnt=0
m=100
while m<x:
    m+=m//100
    cnt+=1

print(cnt)
# Judge status: Accepted
N = int(input())
x = [0]* N
y = [0] * N
for i in range(N):
  a , b = map(int,input().split())
  x[i] = a+b
  y[i] = a-b

ans = max([max(x) - min(x),max(y) - min(y)])
print(ans)
# Judge status: Wrong Answer
import math
x = int(input())
a = round(math.pow(x,1/5))
a_five = a**5
if a_five-x < 0:
    b = int(math.pow((a_five-x)*-1,1/5))
    b *= -1
else:
    b = int(math.pow(a_five-x,1/5))
print(a)
print(b)
# Judge status: Accepted
n=int(input())
p=[int(x) for x in input().rstrip().split()]

now_min=float('inf')
cnt=0
for i in range(n):
  if p[i]<=now_min:
    cnt+=1
    now_min=p[i]
  
print(cnt)
# Judge status: Accepted
A,B,K = map(int,input().split())

a = 0
b = 0

if A <= 10**12 and B <=10**12 and K <= 10**12:
    if A >= K :
        a = A-K
        b = B
    elif  (A + B) >=K:
        a = 0
        b = B-(K-A)
    elif  (A + B)  < K:
        a = 0
        b = 0
else :
    a = 0
    b = 0

print(a,b,end='')