peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
D=set()
S=set()
for i in range(N):
    if A[i] in S:
        D.add(A[i])
    else:
        S.add(A[i])
M=max(S)
X=[1 for i in range(M+1)]
for a in S:
    if a in D:
        X[a]=0
    for i in range(2*a,M+1,a):
        X[i]=0
ans=0
for i in range(N):
    if X[A[i]]==1:
        ans+=1
print(ans)
# Judge status: Wrong Answer
N = int(input())
x = 800 * N
y = 0

for i in range(N):
	if i % 15 == 0:
  		y += 200
print (x - y)
# Judge status: Accepted
import math
s=input()
ans=1000000000
for i in range(len(s)-2):
    ans=min(ans,abs(int(s[i]+s[i+1]+s[i+2])-753))
print(ans)
# Judge status: Accepted
s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())
if u == s:
  a -= 1
if u == t:
  b -= 1
print(a,b)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
count = 0

while all(a%2 == 0 for a in A):
   A = [a/2 for a in A ]
   count += 1

print(count)
# Judge status: Accepted
s,c = map(int, input().split())

if s*2 >= c:
    print(c//2)
else:
    ans = s
    rem = c-s*2
    ans += rem//4
    print(ans)
# Judge status: Wrong Answer
s = input()
D = {}
for c in s:
    if c in D.keys():
        D[c] += 1
    else:
        D[c] = 1
for i in range(1,len(s)+1):
    D[s[len(s)-i]] -= 1
    for k in D.values():
        if k % 1:
            break
    else:
        ans = len(s)-i
        break  
print(ans)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline

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

b=[0]*n

for i in range(n-1,-1,-1):
    if sum(b[i:n:i+1]) %2 ^ a[i]:
        b[i] = 1 


print(sum(b))
print(" ".join([str(k+1)  for k,v in enumerate(b)  if v== 1]))
# Judge status: Accepted
N, M = map(int, input().split())

L = list()
R = list()
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

maxL = max(L)
minR = min(R)

num = 0 
for j in range(maxL,minR+1):
    num +=1

print(num)
# Judge status: Accepted
n=int(input())
m=[];M=[]
for i in range(n):
    a,s=map(int,input().split())
    m.append(a);M.append(s)
m.sort();M.sort()
if n%2:
    print(M[n//2]-m[n//2]+1)
else:
    print(M[n//2]+M[n//2-1]-m[n//2]-m[n//2-1]+1)
# Judge status: Accepted
N = int(input())
A = sorted(map(int, input().split()), reverse=True)
if N % 2:
    print(sum(A[: N // 2]) + sum(A[1 : N // 2 + 1]))
else:
    print(sum(A[: N // 2 - 1]) + sum(A[1 : N // 2]) + A[N // 2 - 1])
# Judge status: Accepted
N,M = map(int,input().split())
"""
mat = [[0]*M for _ in range(N)]
dx = [-1,0,1,-1,0,1,-1,0,1]
dy = [1,1,1,0,0,0,-1,-1,-1]
for i in range(N):
    for j in range(M):
        for k in range(9):
            if 0 <= i+dy[k] <= (N-1) and 0 <= j+dx[k] <= (M-1):
                mat[i+dy[k]][j+dx[k]] += 1
print(mat)
"""
if N == M == 1:
    print(1)
elif N == 1 or M == 1:
    print(N*M-2)
else:
    print(N*M-2*(N+M-2))
# Judge status: Accepted
N,K = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(N)]

ab.sort()
count = 0
for i in range(N):
    count+=ab[i][1]
    if count >= K:
        print(ab[i][0])
        exit()
# Judge status: Accepted
a,b,c = map(int, input().split())
if b >= a*c:
  print(c)
elif b < a*c:
  print(b//a)
# Judge status: Wrong Answer
x = int(input())

index = 0
for i in range(1,x+1):
  if i*(i+1) < (x-index):
    index+=i
  else:
    ans = x-index
    break
#  print(i,index)
print(ans)
# Judge status: Wrong Answer
n,k = map(int, input().split())
l = list(map(int, input().split()))
l1 = sorted(l, reverse= False)
sum = sum(l1[0:3])
print(sum)
# Judge status: Accepted
import math
n=int(input())
ans=1
for i in range(n):
  a=int(input())
  ans=a*ans//math.gcd(a,ans)
print(ans)
# Judge status: Wrong Answer
import collections
X, N = map(int, input().split())
list = list(map(int, input().split()))

c = collections.Counter(list)
res1=-1000
res2=-1000

for i in range (0, 100):
  if(c[X+i]==0):
    res1=X+i
    if(c[X-i]==0):
      res2=X-i
    break

if(abs(X-res1)<abs(X-res2)):
  print(res1)
else:
  print(res2)
# Judge status: Wrong Answer
s = input()

n = len(s)

for i in range(1,n):
    ss = s[:-i]
    if len(ss)% 2 ==0:
        if ss[:(n-i)//2] == ss[(n-i)//2:]:
            print(len(ss))
# Judge status: Wrong Answer
l=[]
for i in range(5):l.append(int(input()))
k=int(input())
c=0
for i in l:
    for j in l:
        if abs(i-j)>k: c+=1
print('yay!' if c==0 else ':(')
# Judge status: Accepted
import sys

import numba as nb

input = sys.stdin.readline


@nb.njit("i8(i8)")
def solve(n):
    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    ans = 0
    for i, v in enumerate(table):
        ans += i * v
    return ans


def main():
    N = int(input())

    ans = solve(N)

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))
 
l = [1]
for i in range(n):
    l.append(a[l[i] - 1])
 
p = l.index(l[n])
 
if k <= n:
    print(l[k])
else:
    x = (k - n + 1) % (n - p)
    if x == 0:
        print(l[n - 1])
    else:
        print(l[x + p - 1])
# Judge status: Wrong Answer
S = input()
T = input()
if S in T:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, K = map(int,input().split())
list_ai = map(int,input().split())
print(((N-1)//(K-1))+1)
# Judge status: Wrong Answer
a, b = input().split()
an, bn = int(a), int(b)

ab = a * bn
ba = b * an

if ab >= ba:
  print(ab)
else:
  print(ba)
# Judge status: Accepted
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0]*(w+1) for _ in range(n)]
for i in range(n):
    for j in range(w+1):
        if j >= wv[i][0]:
            dp[i][j] = max(dp[i-1][j], wv[i][1] + dp[i-1][j-wv[i][0]])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[-1][-1])
# Judge status: Accepted
n=int(input())
L=list(map(int,input().split()))
if max(L)<(sum(L)-max(L)) :
    ans ="Yes"
else:
    ans ="No"
print(ans)
# Judge status: Wrong Answer
H, A=map(int,input().split())
cnt =0

while H > 0:
    H -= A
    cnt += 1

print(cnt)
# Judge status: Wrong Answer
import math
L, R, D = map(int, input().split())

if math.floor(R / D) - math.ceil(L / D) + 1 > 0:
    print(math.floor(R / D) - math.floor(L / D))
else:
    if R % D == 0 or L % D == 0:
        print(1)
    else:
        print(0)
# Judge status: Accepted
from itertools import accumulate
N = int(input())
As = list(map(int, input().split()))

accR = reversed(list(accumulate(reversed(As))))
num = 1
MAX = 10 ** 13
ans = 0
for a, limit in zip(As, accR):
    tmp = min(num, limit)
    if a > tmp:
        print(-1)
        exit()
    ans += tmp
    num = (tmp - a) * 2
    if num >= MAX:
        num = MAX
print(ans)
# Judge status: Accepted
n = int(input())
n = n % 10
if n in [2,4,5,7,9]:
  print("hon")
elif n in [0,1,6,8]:
  print("pon")
else:
  print("bon")
# Judge status: Accepted
s=input()
q=int(input())
que=[list(map(str,input().split())) for i in range(q)]
count=0
for i in que:
  if i[0]=="1":
    count+=1
ans=[[],[]]
ak=count
for i in que:
  if i[0]=="1":
    count-=1
  else:
    if i[1]=="1":
      ans[count%2].append(i[2])
    else:
      ans[(count+1)%2].append(i[2])
if ak%2==0:
  print("".join(reversed(ans[0]))+s+"".join(ans[1]))
else:
  print("".join(reversed(ans[0]))+"".join(reversed(list(s)))+"".join(ans[1]))
# Judge status: Wrong Answer
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
if N<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:
            print(t)
            count+=1

    print(count)
# Judge status: Wrong Answer
n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]

large = 10**9 +7
count = [0]*(n+1)
itr = 0
count[0] = 1

if m >0 and a[0] != 1 :
    count[1] = 1
else:
    count[1] = 0
    itr = 1
if n >=2:
    for i in range(2,n+1):
        if m > 0 and itr<len(a) and a[itr] == i:
            itr +=1
            continue
        else:
            count[i] = (count[i-1] + count[i-2])%large

print(count[n])
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 1:
  print(0)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
if b <= c or d <= a:
    print(0)
elif  a <= c:
    if b <= d:
        print(b - c)
    else:
        print(d - c)
else:
    if b <= d:
        print(b - a)
    else:
        print(d - a)
# Judge status: Accepted
x,a,b = map(int, input().split())
print("A") if abs(x-a) < abs(x-b) else print("B")
# Judge status: Accepted
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())

ok = 0
for i in range(n - m + 1):
    for j in range(n - m + 1):
        from_n = [l[j:j+m] for l in A[i:i+m]]
        ok += from_n == B
print('Yes' if ok > 0 else 'No')
# Judge status: Accepted
a,b,k = map(int,(input().split()))
ans = []
for i in range(a,min(a+k,b)):
    ans.append(i)
for i in range(max(b+1-k,a),b+1):
    ans.append(i)
ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)
# Judge status: Accepted
n = int(input())

total = 0

remain = 0
c = 0
for i in range(n):
    m = int(input())
    if i > c + 1:
        remain = 0
    all_ = remain + m
    total += all_//2
    if all_ % 2 != 0 and all_//2 > 0:
        remain = all_ % 2
        c = i
print(total)
# Judge status: Accepted
T=input()

res = ""
for i in range(len(T)) :
    if (T[i] != "?") :
        res += T[i]
        continue
    res += "D"

    # if (i != 0) :
    #     if (T[i-1] == "P") :
    #         res += "D"
    #     else :
    #         res += "D"

print(res)
# Judge status: Wrong Answer
N, K, Q = map(int, input().split())
A = [int(input())-1 for _ in range(Q)]
Point = [K]*N
print(A)
for i in range(Q):
    Point[A[i]] += 1
    for j in range(N):
        Point[j] -= 1

for p in Point:
    if p>0:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n = int(input())
x = [int(t) for t in input().split()]
d = sorted(x)
m1 = d[n//2-1]
m2 = d[n//2]

for i in range(n):
    if m1 < x[i]:
        print(m1)
    else:
        print(m2)
# Judge status: Accepted
S = input()
for i in range(len(S)):
    for j in range(i,len(S)+1):
        if S[:i]+S[j:] == "keyence":
            print("YES")
            exit()
for k in range(len(S)):
    if S[i::i+8] == "keyence":
        print("YES")
        exit()
print("NO")
# Judge status: Accepted
n, a, b = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod) :
    ans1 = 1
    ans2 = 1
    for i in range(r) :
        ans1 = (ans1 * (n-i)) % mod
        ans2 = (ans2 * (i+1)) % mod
    return ans1 * pow(ans2, mod-2, mod)

ans = pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) - 1
print(ans%mod)
# Judge status: Accepted
resd = {}
def A(h):
    if h == 1:
        return 1
    else:
        if h in resd:
            return resd[h]
        else:
            resd[int(h/2)] = A(int(h/2))*2+1
            return resd[int(h/2)]

H = int(input().strip())
print(A(H))
# Judge status: Wrong Answer
N = int(input())
C = 0
D = 0
E = 0
F = 0
S = ''

for i in range(N):
    S = input()
    if S == 'AC':
        C += 1
    elif S == 'WA':
        D += 1
    elif S == 'TLE':
        E += 1
    elif S == 'RE':
        F += 1
print('AC × '+ str(C))
print('WA × '+ str(D))
print('TLE × '+ str(E))
print('RE × '+ str(F))
# Judge status: Accepted
N,M=map(int,input().split())
if (N==M):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, M = map(int, input().split())

# 左パート
l, r = 1, N // 2
while M and l < r :
  print(l, r)
  l += 1
  r -= 1
  M -= 1
  
# 右パート
l, r = N // 2 + 2 - N % 2, N
while M :
  print(l, r)
  l += 1
  r -= 1
  M -= 1
# Judge status: Wrong Answer
S = input()
print("2017" + S[4:])
# Judge status: Accepted
N,K=map(int,input().split())
H=[int(input()) for _ in range(N)]
H.sort()
import numpy as np
H=np.array(H)
print((H[K-1:]-H[:-K+1]).min())
# Judge status: Wrong Answer
s=input()
r_s=s[::-1]
a=0
b=0
n=len(s)
for i in range(n):
    if s[i]=="A":
        a=i
        break
for j in range(n):
    if r_s[j]=="Z":
        z=j
        break
print(len(s[a:-z]))
# Judge status: Accepted
import sys
X=int(input())

if not ( 1 <= X <= 10**9 ): sys.exit()
res=0
count=0
for I in range(1,X+1):
    count += 1
    res += count
    if res >= X:
        print(count)
        sys.exit()
# Judge status: Wrong Answer
import math
N = int(input())

if math.ceil(N / 1.08) * 1.08 == N:
  print(math.ceil(N / 1.08))
else:
  print(':(')
# Judge status: Accepted
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
ab = np.array([LI() for _ in range(N)])
cd = np.array([LI() for _ in range(M)])
for x in ab:
    print(np.argmin(np.sum(np.abs(cd-x),axis=1))+1)
# Judge status: Accepted
import math


length_hour, length_min, hour, minute = map(int, input().split(' '))
total_min = hour * 60 + minute

hx = math.sin((total_min / (12 * 60)) * (2 * math.pi)) * length_hour
hy = math.cos((total_min / (12 * 60)) * (2 * math.pi)) * length_hour
mx = math.sin((minute / 60) * (2 * math.pi)) * length_min
my = math.cos((minute / 60) * (2 * math.pi)) * length_min

distance = math.sqrt((hx - mx) ** 2 + (hy - my) ** 2)

print(f"{distance}")
# Judge status: Accepted
import math
n,m = map(int,input().split())
diff = abs(n-m)
count1 = 1
count2 = 1
a = 1

if diff >= 2:
    print(0)
elif diff == 1:
    ans = math.factorial(max(n,m))
    print(ans*(ans//max(n,m))%(10**9+7))
else:
    ans = math.factorial(n)
    print(ans*ans*2%(10**9+7))
# Judge status: Accepted
n = int(input())
L = list(input() for _ in range(n))
D = dict.fromkeys(set(L),0)

for l in L:
  D[l] += 1

m = max(D.values())
SD = sorted(D.items(), key=lambda x:x[0])

for k, v in SD:
  if v == m:
    print(k)
# Judge status: Wrong Answer
m,K,D = input().split()
m = int(m)
K = int(K)
D = int(D)
min = 0;
if m < 0:
  m * -1
a = (m - m % D) / D
if a > K:
  min = m - D*K
else:
  K -= (m - m % D) / D
  if K % 2 == 0:
    min = m % D
  else:
    min = (m % D - D) * -1
print(min)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

if a[0] != 0: print(-1); exit()

s = [0] * (n+2)
for i in range(n+1)[::-1]:
    s[i] = s[i+1]+a[i]

x = 1
ans = 0
for i in range(n+1):
    ans += x
    x -= a[i]
    if (x <= 0 and i != n) or x < 0: print(-1); exit()
    if x == s[i]: continue
    if x*2 > s[i+1]: x = s[i+1]
    else: x *= 2

print(ans)
# Judge status: Wrong Answer
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
  print("bad")
else:
  print("good")
# Judge status: Accepted
H,A = map(int,input().split())

if(H%A > 0):
  print(H//A+1)
else:
  print(H//A)
# Judge status: Wrong Answer
N=int(input())
S=input()
if N%2==0 and all(a==b for a,v in zip(S,S[N:])):
       print("Yes")
else:
       print("No")
# Judge status: Accepted
n, m = map(int, input().split())

if n*2 < m:
    c = m - (n*2)
    ans = int(c/4) + n
else:
    ans = int(m/2)

print(ans)
# Judge status: Accepted
N, M, K = map(int, input().split())
A = [0] + [int(i) for i in input().split()]
B = [0] + [int(i) for i in input().split()]

N += 1
M += 1
for i in range(1, N) :
  A[i] += A[i - 1]
for i in range(1, M) :
  B[i] += B[i - 1]

ret = 0
a = N - 1
b = 0
while b < M :
  while a >= 0 and A[a] + B[b] > K :
    a -= 1
  if a >= 0 and A[a] + B[b] <= K :
    ret = max(ret, a + b)
  b += 1
  
print(ret)
# Judge status: Accepted
n = int(input())

res = "No"
for cake in range(0, int(n/4) + 1):
    for dornut in range(0, int(n/7) + 1):
        if 4 * cake + 7 * dornut == n:
            res = "Yes"
            break
    else:
        continue
    break

print(res)
# Judge status: Accepted
N, M = (int(i) for i in input().split())  

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors
  
div = make_divisors(M)

for d in div:
    if int(M/d) >= N:
        print(d)
        break
# Judge status: Accepted
A,B,X = map(int,input().split())
print('YES' if A <= X <= A+B else 'NO')
# Judge status: Wrong Answer
n=int(input())
s=input()
hiee=""
ans=""
for i in range(len(s)):
    hiee=ord(s[i])
    if (hiee+n >90):
        print("0")
        hiee-=24
    ans+=chr(hiee+n)
print(ans)
# Judge status: Accepted
x = int(input())

root = int(x**(0.2))

flag = 0
for i in range(root - 400, root + 400):
    for j in range(-100, root + 400):
        if i!=j:
            if x%(i-j) == 0:
                if i**5-j**5 == x:
                    print(i, j)
                    flag = 1
                    break
    if flag:
        break
# Judge status: Accepted
s = list(input())
t = list(input())
ls, lt = len(s), len(t)
ans = lt
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if s[i + j] == t[j]:
            cnt += 1
    ans = min(ans, lt - cnt)
print(ans)
# Judge status: Accepted
x = int(input())
bekis = [1]
for i in range(2,35):
    for j in range(2,15):
        v = i**j
        if v > x: break
        bekis.append(v)

bekis.sort()
print(bekis[-1])
# Judge status: Wrong Answer
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if a+b<c:
  print("NO")
if a>c:
  print("NO")
else:
  print("YES")
# Judge status: Accepted
n = list(map(int, list(input())))
i = -1
ans = "Good"
for i1 in n:
    if i == i1:
        ans = "Bad"
        break
    else:
        i = i1 + 0
print(ans)
# Judge status: Wrong Answer
n=int(input())
s=0
for i in range(1,1+n):
    s+=i/2*(n//i)*(n//i+1)
print(s)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

answer = 0
m = 0
for i in range(n):
  if i == 0:
    answer += 1
    m = p[i]
  elif p[i] <= m:
    answer += 1
    min = p[i]

print(answer)
# Judge status: Accepted
n = int(input())
v = list(map(float, input().split()))

ans = v[:]

for i in range(n - 1):
    ans = sorted(ans)
    s = (ans[0] + ans[1]) / 2
    ans.pop(0)
    ans[0] = s

print(ans[0])
# Judge status: Accepted
import math
X = int(input())
ruto = math.ceil(math.sqrt(2*X))+1
kari = ruto**2+ruto
ans=1
for i in range(ruto-1, 0, -1):
    if i**2+i < 2*X:
        ans = i+1
        break
    kari = i**2+i
print(ans)
# Judge status: Accepted
a = list(input())
op = ['-'] * 3
for i in range(2**3):
    ans = int(a[0])
    for j in range(3):
        if 1 & (i>>j):
            ans += int(a[3-j])
            op[2-j] = '+'
        else:
            ans -= int(a[3-j])
            op[2-j] = '-'
    if ans == 7:
        break
print(a[0] + op[0] + a[1] + op[1] + a[2] + op[2] +a[3] + "=7")
# Judge status: Accepted
D = int(input())
if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
elif D == 22:
    print('Christmas Eve Eve Eve')
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))

if all(a<b for a,b in zip(P,P[1:])):
    print('YES')
    exit()

for i in range(N-1):
    for j in range(i+1, N):
        P[i],P[j] = P[j],P[i]
        if all(a<b for a,b in zip(P,P[1:])):
            print('YES')
            exit()
        P[i],P[j] = P[j],P[i]
print('NO')
# Judge status: Accepted
def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()
# Judge status: Accepted
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

def judge(x):
    k = 0
    for a in A:
        v = a // x
        if a % x == 0:
            v -= 1
        k += v
    return k <= K

low = 1
high = max(A)

A.sort()

while low < high - 1:
    mid = (low + high) // 2
    if judge(mid):
        high = mid
    else:
        low = mid

if judge(low):
    print(low)
else:
    print(high)
# Judge status: Wrong Answer
import fractions
n = int(input())
a = list(map(int, input().split()))
lgm = a[0]
for i in range(1, n):
    lgm = lgm * a[i] // fractions.gcd(lgm, a[i])
mod = 10**9 + 7
ans = 0
for i in range(n):
    ans += (lgm // a[i]) % mod
print(ans)
# Judge status: Accepted
sd = input()
t = input()

anss = []
for tpos in range(len(sd) - len(t) + 1):
    check = True
    for i in range(len(t)):
        if t[i] != sd[(i + tpos)] and sd[(i + tpos)] != '?':
            check = False
            break
    if check == True:
        cand = sd[:tpos] + t + sd[(tpos + len(t)):]
        anss.append(cand.replace('?', 'a'))

if len(anss) == 0:
    print('UNRESTORABLE')
else:
    print(sorted(anss)[0])
# Judge status: Accepted
import heapq


N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range (N)]

AB.sort()
ans = 0 
q = []
heapq.heapify(q)
idx = 0
for i in range(1,M+1):
    while idx<N and AB[idx][0]<=i:
        heapq.heappush(q, -AB[idx][1])
        idx += 1
    if q:
        p = -heapq.heappop(q)
        ans += p
print(ans)
# Judge status: Wrong Answer
import math

def read_ints():
    return[int(i) for i in input().split()]

def main():
    n, k = read_ints()
    print(math.ceil(n / k))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n,r=map(int, input().split())
if n < 10:
  print(r + 100 * (10-n))
else:
  print(r)
# Judge status: Accepted
w = input()

if w.endswith('s'):
  w = w + "es"
  print(w)
elif not(w.endswith('s')):
  w = w + "s"
  print(w)
# Judge status: Wrong Answer
def main():
  n,*h=map(int,open(0).read().split())
  search=[i for i,j in enumerate(h) if j==max(h)]
  
  ans=0
  for p in search:
    count=0
    while(p+1<n):
      if h[p]>=h[p+1]:
        count+=1
        p+=1
      else:
        break
    ans=max(ans,count)
  
  print(ans)
  
if __name__=="__main__":
  main()
# Judge status: Accepted
import statistics
from fractions import *
import math

def cntTwo(n):
    i = 0
    while n % 2 == 0:
        i += 1
        n //= 2
    return i

lcm = lambda a, b: a * b // gcd(a, b)

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

l = set(map(int,input().split()))
l = list(l)
l = [i//2 for i in l]
lc = 1
gc =1
two = cntTwo(l[0])
for i in l:
    if cntTwo(i)!=two:
        print(0)
        exit()
    lc = lc*i//gcd(lc,i)
    

print((m//lc +1)//2)
# Judge status: Accepted
s = input()

print(s[:3] + "8" + s[4:])
# Judge status: Accepted
N, K = map(int, input().split())
okashi_map = {}

for num in range(N):
    okashi_map[num+1] = 0

for _ in range(K):
    okashi = input()
    sunuke_list = list(map(int, input().split()))
    for sunuke in sunuke_list:
        okashi_map[sunuke] += 1

find_keys = [k for k, v in okashi_map.items() if v == 0]

print(len(find_keys))
# Judge status: Accepted
a,b = map(int,input().split())

if a>=10 or b>=10:
    print(-1)
else:
    print(a*b)
# Judge status: Accepted
s = input()

count = 0

for i in range(len(s) // 2):
    if s[i] != s[-i -1]:
        count += 1
print(count)
# Judge status: Accepted
a = list(input().split(" "))
animal = int(a[0])
foot = int(a[1])
 
saisyo = 2 * animal
saidai = 4 * animal
 
if (foot % 2 == 0) and (saisyo <= foot <= saidai):
	print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
import math

n, m = map(int, input().split())
h = list(map(int, input().split()))
ma = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    ma[a - 1] = max(ma[a-1],h[b - 1])
    ma[b - 1] = max(ma[b-1] ,h[a - 1])
cnt = 0
print(ma)
print(h)
for i in range(n):
    if h[i] > ma[i]:
        cnt += 1
print(cnt)
# Judge status: Accepted
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 1
for i in range(2,N+1):
    if i in a:
        dp[i] = 0
        continue
    dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])
# Judge status: Wrong Answer
a=input()
if a==1:
    a=0
else:
    a=1

print(a)