peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())
a = max(h,w)
b = a
count = 0
if h*w == n:
  print(h)
else:
 while b <= n:
   b += a
   count += 1
 print(count)
# Judge status: Wrong Answer
ac = input()
acc ='abcdefghijklmnopqrstuvwxyx'
print(acc[acc.index(ac) + 1])
# Judge status: Accepted
a, b, c, d = (int(i) for i in input().split())
if a > 0:
    if d > 0:
        print(max(a*c, a*d, b*c, b*d))
    else:
        print(max(a*c, a*d, b*c, b*d))
else:
    if d > 0:
        print(max(a*c, a*d, b*c, b*d))
    else:
        print(max(a*c, a*d, b*c, b*d))
# Judge status: Accepted
n = int(input())
total = 0
for j in range(1,n+1):
  x = j
  y = n//x
  total +=y*(y+1)*x//2
  
  
print(total)
# Judge status: Wrong Answer
a, b, c = map(int, input().split(' '))
print('{} {} {}'.format(b, c, a))
# Judge status: Wrong Answer
n=int(input())
arr=list(map(int,input().split()))
ss=0
s=0
for i in range(n):
    ss=ss+arr[i]**2
    s=s+arr[i]
ans=(s**2-ss)/2
print(int(ans%(10**9+7)))
# Judge status: Accepted
N = int(input())
ans = [0]*(N+1)
f = lambda x, y, z: x**2 + y**2 + z**2 + x*y + y*z + z*x
root_N = int(N**0.5)

for x in range(1, root_N+1):
    for y in range(1, root_N+1):
        for z in range(1, root_N+1):
            i = f(x, y, z)
            if i <= N:
                ans[f(x, y, z)] += 1

print('\n'.join(map(str, ans[1:])))
# Judge status: Accepted
x = int(input())
for i in range(100000):
  if i * 100 <= x <= i *105:
    print(1)
    exit()
print(0)
# Judge status: Accepted
n,m = map(int, input().split())
xy = []

for i in range(m):
  x,y = map(int, input().split())
  xy.append([x-1,y-1])

box = [1 for i in range(n)]

chk = [False for i in range(n)]
chk[0] = True
for i in range(m):
  x, y = xy[i][0],xy[i][1]
  if chk[x]:
    if box[x] >= 2:
      chk[y] = True 
    else:
      chk[y] = True
      chk[x] = False
  box[y] += 1
  box[x] -= 1
cnt = 0
for i in range(n):
  cnt += chk[i]
print (cnt)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print("Yes" if a < c < b else "No")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(max(0,a-c),max(b-(c-a),0))
# Judge status: Accepted
n = int(input().strip())
count = 0
for i in range(n):
  a,b = map(int,input().strip().split())
  if count == 3:
    print('Yes')
    exit(0)
  elif a == b:
    count += 1
  elif(a != b):
    count = 0
if count == 3:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
X,K,D = map(int, input().split())
X = abs(X)
if X - K*D > 0:
  print(X - K*D)
else:
  needCount = X//D
  limX = X - needCount * D
  remK = K - needCount
  minusX = limX - D
  if remK % 2 == 0:
    print(limX)
  else:
    print(abs(minusX))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())
for i in range(k):
    if a > b:
        b *= 2
    elif b > c:
        c *= 2
if a < b < c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a = list(map(int, input().split()))
count = 0
b = a[1] - a[0]

if a[1] == a[0]:
  for i in range(a[1]):
    if (i + 1) % a[2] == 0:
      count += 1
elif b < a[2]:
  count = 0
elif b != 0 and a[2] == 1:
  count = a[1]
else:
  for j in range(b):
    if (j + b + 1) % a[2] == 0:
      count += 1

print(count)
# Judge status: Accepted
import re
S = str(input())
T = str(input())
S = S.replace("?",".")

for i in range(len(S)-len(T),-1,-1):
  if re.match(S[i:i+len(T)],T):
    S = S.replace('.','a')
    print(S[:i]+T+S[i+len(T):])
    exit()

print('UNRESTORABLE')
# Judge status: Accepted
S = input()
ans = 0
tmp = ''
pre = ''
for i in S:
    tmp += i
    if pre != tmp:
        pre = tmp
        tmp = ''
        ans += 1
print(ans)
# Judge status: Wrong Answer
import math
import decimal


a, b, h, m = map(int, input().split())

angle_m = m * 60
angle_h = h * 30 + m / 2

angle = abs(angle_h - angle_m)
angle = math.radians(min(angle, 360 - angle))

ans2 = pow(b * math.cos(decimal.Decimal(f'{angle}')) - a, 2) + pow(b * math.sin(decimal.Decimal(f'{angle}')), 2)
ans = decimal.Decimal(f'{ans2}').sqrt()
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
X = list(map(int, input().split()))

Xp = [0]+[+x for x in X if x>=0]
Xm = [0]+[-x for x in reversed(X) if x< 0]

Np = len(Xp)-1
Nm = len(Xm)-1

ans = 10**10
for np in range(min(Np, K), max(0, K-Nm)-1, -1):
    nm = K-np
    time = min(Xp[np], Xm[nm]) + Xp[np] + Xm[nm]
    ans = min(ans, time)

print(ans)
# Judge status: Accepted
N = int(input())
a = sorted(map(int,input().split()))
print(sum(a[N:3*N:2]))
# Judge status: Accepted
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)


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

K = int(input())
queue = deque(range(1, 10))
for _ in range(K):
    i = queue.popleft()
    if i % 10 >= 1:
        queue.append(i * 10 + (i % 10) - 1)
    queue.append(i * 10 + i % 10)
    if i % 10 <= 8:
        queue.append(i * 10 + (i % 10) + 1)
print(i)
# Judge status: Accepted
x,a,b = map(int,input().split())
if abs(x-a)<abs(x-b):
    print("A")
else:
    print("B")
# Judge status: Accepted
#!/usr/bin/env python3

# from numba import njit

# input = stdin.readline



# @njit
def solve(n,a,b):
  res = 0

  for i in range(n):
    res += (-a[i]-res) % b[i]

  return res



def main():
  N = int(input())
  a = [0]*N
  b = [0]*N
  for i in range(N):
    a[i],b[i] = map(int,input().split())
  print(solve(N,a[::-1],b[::-1]))
  return

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
import math

a,b = [int(x) for x in input().split()]

print(math.ceil(a*b/2))
# Judge status: Accepted
X, K, D = map(int, input().split())

X = abs(X)

if X == 0:
  if K % 2 == 0:
    print(0)
  else:
    print(D)

elif X - K*D >= 0:
  print(X - K*D)
    
elif X - K*D < 0:
  a = X // D
  b = a + 1
  if (K - a) % 2 == 0:
    print(X % D)
  else:
    print(D - X % D)
# Judge status: Wrong Answer
N = input()[-1]

if int(N) == (2 or 4 or 5 or 7 or 9):
  print("hon")
elif int(N) == (0 or 1 or 6 or 8):
  print("pon")
else:
  print("bon")
# Judge status: Accepted
S = str(input())

S = S[:-1]
count = len(S)

while S[:len(S)//2] != S[len(S)//2:]:
  S = S[:-1]
  count -= 1

print(count)
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
# Judge status: Accepted
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
elif h%2!=0 and w%2!=0:
    print(h*w//2+1)
else:
    print(h*w//2)
# Judge status: Wrong Answer
import sys
X = list(sys.stdin.readline().strip())
N = len(X)

def solve2():
    trailing = 0
    i = N-1
    while i >= 0 and X[i] == 'S':
        trailing += 1
        i -= 1
    return trailing * 2

print(solve2())
# Judge status: Accepted
N = int(input())
Nmod = N % 10

if Nmod == 3:
    print('bon')
elif Nmod <= 1 or Nmod == 6 or Nmod == 8:
    print('pon')
else:
    print('hon')
# Judge status: Wrong Answer
N = int(input())
P = list(map(int,input().split()))
mi = 10*7
b = [0]*N
for i in range(N):
    if mi > P[i]:
        b[i] += 1
        mi=P[i]
print(sum(b))
# Judge status: Accepted
n = int(input())
a =list(map(int, input().split()))
l =[0] * (n+1)

for i in range(0,n-1):
    l[a[i]] +=1
    
for i in range(1,n+1):
    print(l[i])
# 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
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=[list(map(int,input().split())) for _ in range(M)]
B.sort(key=lambda x:-x[1])
i,j=0,0
while i<=N-1:
  for l in range(B[j][0]):
    if A[i]>=B[j][1]:
      print(sum(A))
      exit()
    A[i]=B[j][1]
    i+=1
    if i==N:
      print(sum(A))
      exit()
  j+=1
  if j==M:
    print(sum(A))
    exit()
print(sum(A))
# Judge status: Accepted
import math
def yakusuu(a):
  x=[]
  b=math.ceil(math.sqrt(a))
  for i in  range(1,b+1):
    if a%i==0:
      x.append((i,int(a/i)))
  return(x)
N=int(input())
oddlist=[i for i in range(1,N+1,2)]
ans=[]
for i in oddlist:
  x=yakusuu(i)
  if len(x)==4:
    ans.append(i)
print(len(ans))
# Judge status: Accepted
n = int(input())
w = [input()]
for i in range(n-1):
    tmp = input()
    if w[i][-1] == tmp[0]:
        flg = tmp in w
        if flg == False:
            w.append(tmp)
        else:
            print('No')
            exit()
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
import math
s = input()
n = math.ceil(len(s)/2)
hitachi = ""
for i in range(n):
  hitachi += "hi"
if hitachi in s:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N, M = map(int, input().split())
PY = []
for _ in range(M):
    PY.append(tuple(map(int, input().split())))

PY.sort(key=lambda x:x[1])
#print(PY)

prefecture=[[] for _ in range(N)]
for el in PY:
    p, y = el
    prefecture[p-1].append(y)
#print(prefecture)

for j, p in enumerate(prefecture):
    for i, city in enumerate(p):
        print(str(j+1).zfill(6) + str(i+1).zfill(6))
# Judge status: Accepted
import math

K = int(input())

CACHE = {}
def gcd_with_memo(i, j):
    if j > i:
        i, j = j, i
    key = str(i) + ":" + str(j)
    if CACHE.get(key):
        return CACHE[key]
    else:
        CACHE[key] = math.gcd(i, j)
        return CACHE[key]

total = 0
r = range(1, K + 1)
for i in r:
    for j in r:
        for k in r:
            total += gcd_with_memo(gcd_with_memo(i, j), k)

print(total)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.append(0)
money = 1000
kabu = 0
for i in range(N):
    if A[i] <= A[i+1]:
        kabu = money//A[i]
        money -= kabu*A[i]
    else:
        money += kabu*A[i]
        kabu = 0
print(money)
# Judge status: Accepted
# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

def main():
	N = int(input())
	L = []
	for i in range(N):
		D1, D2 = getlist()
		if D1 == D2:
			L.append(1)
		else:
			L.append(0)

	for i in range(N - 2):
		if L[i] + L[i + 1] + L[i + 2] == 3:
			print("Yes")
			return

	print("No")




if __name__ == '__main__':
	main()
# Judge status: Wrong Answer
X, Y = map(int,input().split())

if (2*X-Y)/3 % 3 != 0 or (2*Y-X)/3 % 3 != 0:
    print(0)
    exit()

n = int((2*Y-X)/3)
m = int((2*X-Y)/3)

mod = 10**9+7


def comb(n, r, mod):
    x=y=1
    for i in range(r):
        x *= n; y *= r
        x %= mod; y %= mod
        n -= 1; r -= 1
    return x * pow(y, mod - 2, mod) % mod

print(comb(n+m, n, mod))
# Judge status: Wrong Answer
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
  for j in range(3):
    if A[i][j] in b:
      A[i][j] = 0
  
for i in range(3):
  if A[i][0] + A[i][1] + A[i][2] == 0 or A[0][i] + A[1][i] + A[2][i] == 0 or A[0][0]+A[1][1]+A[2][2] ==0 or A[2][0]+A[1][1]+A[0][2] ==0:
    print('Yes')
    break
  
  else:
    print('No')
    break
# Judge status: Accepted
n, k = map(int,input().split())
d = set(map(int,input().split()))

for i in range(n, 100000):
    for j in str(i):
        if int(j) in d:break 
    else:
        print(i)
        exit()
# Judge status: Accepted
s=input()
n=len(s)+1
a,b=[0]*n,[0]*n
temp=0
for i,val in enumerate(s):
    if val=="<": temp+=1
    else: temp=0
    a[i+1]=temp
temp=0
for i,val in enumerate(s[::-1]):
    if val==">": temp+=1
    else: temp=0
    b[n-i-2]=temp
ans=0
for i,j in zip(a,b): ans+=max(i,j)
print(ans)
# Judge status: Wrong Answer
def is_kaibun(n):
    ns = [int(v) for v in str(n)]

    i = 0
    j = len(ns) - 1
    while i < j:
        if ns[i] != ns[j]:
            return False
        i += 1
        j -= 1

    return True


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

count = 0
for i in range(A, B):
    if is_kaibun(i):
        count += 1

print(count)
# Judge status: Accepted
import sys
input = sys.stdin.readline().strip
c=list(input().strip())
b=["a","i","u","e","o"]
flg=True
for i in c:
    if i not in b:
        flg=False
print("vowel" if flg else "consonant")
# Judge status: Accepted
import numpy as np
n,m = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(n)]

ab = np.array(ab)
ab = sorted(ab, key = lambda x: x[0])

ch = m+0
ans = 0
ax = 0
while ch > 0:
    t_ab = ab[ax]
    if t_ab[1] <= ch:
        num = t_ab[1]
    else:
        num = ch
    ans += t_ab[0]*num
    ax += 1
    ch -= num

print(ans)
# Judge status: Wrong Answer
import re
S = input()
num = len(S)
S = re.sub('[^A|^C|^G|^T]+', ' ', S).split(' ')
print(len(max(S)))
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

cnt = 0
while b <= a:
    cnt += 1
    b *= 2
while c <= b:
    cnt += 1
    c *= 2

if cnt <= k:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
X, Y = map(int, input().split())

for turu in range(1, X + 1, 1):
    kame = X - turu
    legs = kame * 4 + turu * 2
    if legs == Y:
        print("Yes")
        break
else:
    print("No")
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())

N,K,X,Y = I(),I(),I(),I()
print(min(K,N)*X + (max(K,N)-K)*Y)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))
    x = int(input())
    bc = [list(map(int, input().split())) for _ in [0]*x]
    ans = [0]*100001
    for i in a:
        ans[i] += 1
    ans2 = sum(a)
    for b, c in bc:
        ans2 += (c-b)*ans[b]
        ans[c] += ans[b]
        ans[b] = 0
        print(ans2)


main()
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A>B:
  print('Alice')
elif A==B:
      print('Draw')
else:
  print('Bob')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif a != b != c:
    print(3)
else:
    print(2)
# Judge status: Accepted
N = int(input())

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

def norm(n, prev_list):
	out_list = []
	for line in prev_list:
		for i in range(len(set(line))+1):
			new_line = line + alphabet[i]
			out_list.append(new_line)
	return out_list

init_line = ['a']

for _ in range(N-1):
	init_line = norm(1, init_line)
for line in init_line:
	print(line)
# Judge status: Accepted
n,m=map(int,input().split())

oddflag=True
for i in range(1,m+1):
	mid=(1+n)//2
	if oddflag:
		oddflag = False
		print(i//2 + 1 , n - i//2)
	else:
		oddflag = True
		print(mid + i//2, mid - i//2)
# Judge status: Wrong Answer
s = input()

n = len(s)
for i in range(n-1, 1, -1):
    if i % 2 == 0:
        if s[:i//2] == s[i//2:i]:
            print(i)
# Judge status: Accepted
x = input() #sys.stdin.readlineは最後が改行
n = len(x)

tama = 0
cnt = 0
for i in range(n):
    if x[i] =='S':
        tama+=1
    elif x[i] =='T' and tama>0:
        cnt += 2
        tama-=1
print(n-cnt)
# Judge status: Accepted
A, B, C, K = map(int, input().split())

if K % 2 == 1:
    print(B-A)
elif K % 2 == 0:
    print(A-B)
else:
    print('Unfair')
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))

tmp = 0
ans = 0

for i in range(n-1):
    if(h[i]-h[i+1]>=0):
        tmp += 1
        ans = max(ans, tmp)
        #print(ans)
    else:
        tmp = 0
        #print(ans)

print(ans)
# Judge status: Accepted
x = int(input())
print(10 - x // 200)
# Judge status: Wrong Answer
A, B = input().split()
print(B, A)
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))

dp = []

for i, h in enumerate(H) :
  if (i==0) :
    dp.append(0)
    continue
  
  if (i==1) :
    dp.append(abs(H[0]-H[1]))
    continue
  
  one = abs(dp[i-2] + (H[i]-H[i-1]))
  two = abs(H[i]-H[i-2])
  
  if (one < two):
    dp.append(dp[i-1] + one)
  else :
    dp.append(dp[i-2] + two)

print(dp[-1])
# Judge status: Wrong Answer
a, b, c, d=input()
print('Yes' if a==b==c else 'No')
# Judge status: Wrong Answer
n, h = map(int, input().split())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))

l = sorted(l, reverse=True, key=lambda x: x[1])
l = sorted(l, reverse=True, key=lambda x: x[0])
c = 0
for i in range(1, n):
  if l[i][1] > l[0][0]:
    h -= l[i][1]
    c += 1
    if h <= 0:
      print(c)
      exit()

while h > l[0][1]:
  h -= l[0][0]
  c += 1

print(c+1)
# Judge status: Accepted
a,b,c = [int(x) for x in input().split()]

if (a==b and c!= a) or (a==c and a!=b) or (b == c and a!=b):print('Yes')
else:print('No')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans, mod = 0, 0

for i in range(N):

    if mod > A[i]:
        ans += A[i]
        A[i] = 0
    else:
        ans += mod
        A[i] -= mod
        mod = 0

    if B[i] > A[i]:
        ans += A[i]
        mod = B[i] - A[i]
    else:
        ans += B[i]
        mod = 0

ans += min(mod, A[i])

print(ans)
# Judge status: Wrong Answer
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
d = list(map(int, input().split()))
M = 998244353
from collections import Counter
c = Counter(d)
if d[0]!=0 or c[0]>=2:
    ans = 0
else:
    m = max(c.keys())
    ans = 1
    for i in range(1,m+1):
        if i not in c:
            ans = 0
            break
        ans *= pow(c[i-1], c[i], M)
print(ans)
# Judge status: Wrong Answer
n = int(input())
m = input()
m = m.split()
a = int(max(m))
l = map((lambda x: int(x)), m)
b = int(sum(l))
if a >= b - a:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n,m,K=map(int,input().split());print("YNeos"[all(k*(m-l)-K+l*(n-k)for k in range(n+1)for l in range(m+1))::2])
# Judge status: Wrong Answer
import math

k = int(input())

dp = [0 for _ in range(300)]
dp[1] = 1
for i in range(2,300):
	x = 2
	y = 0
	for j in range(1,i):
		y += math.gcd(j,i)
	for j in range(1,i):
		for l in range(1,i):
			y += math.gcd(j,l)
	dp[i] = x+y+dp[i-1]
print(dp[200])
# Judge status: Accepted
n=int(input())
x,y=(1,1)
m=10**12+1
for i in range(1, int(n**0.5)+1):
    x+=1
    if n%x==0: y=n//x
    if n==x*y and m>x+y-2:
        m=x+y-2

if m==10**12+1:
    m=n-1
print(m)
# Judge status: Accepted
S = input()[::-1]
dp = [0]*2019
dp[0] = 1

tmp = 0
for i in range(len(S)):
    tmp += int(S[i])*pow(10, i, 2019)
    tmp %= 2019
    dp[tmp] += 1
ans = 0
for i in dp:
    if i >= 2:
        ans += i*(i-1)//2
print(ans)
# Judge status: Accepted
a,b=input().split()
count=0
for i in range(int(a),int(b)+1):
  if str(i)==str(i)[::-1]:
    count+=1
print(count)
# Judge status: Wrong Answer
N = list(map(int, input().split()))

print(N[0]//N[1] +1)
# Judge status: Accepted
S = input()

lst = [1 if S[0]=='<' else -1]
for i in range(1, len(S)):
    if S[i] == S[i - 1]:
        lst[-1] += 1 if S[i]=='<' else -1
    else:
        lst.append(-1 if S[i]=='>' else 1)
        
ans = [0]

for i in range(len(lst)):
    if lst[i] > 0:
        ans += list(range(1,lst[i]+1))
    else:
        ans[-1] = max(ans[-1], -lst[i])
        ans += list(range(-lst[i]-1,-1, -1))

print(sum(ans))
# Judge status: Wrong Answer
w, h, n = map(int,input().split())
a_1 = 0
a_2 = w
a_3 = 0
a_4 = h
for i in range(n):
    x, y, a = map(int,input().split())
    if a == 1:
        a_1 = max(a_1,x)
    elif a == 2:
        a_2 = min(a_2,x)
    elif a == 3:
        a_3 = max(a_3,y)
    else:
        a_4 = min(a_4,y)

if a_1 < a_2:
    if a_3 < a_4:
        print((a_2-a_1)*(a_4-a_3))

else:
    print(0)
# Judge status: Wrong Answer
n,k=map(int,input().split())
kakuritu=0
for i in range(1,n+1):
  if i>=k:
    kakuritu+=1/n
  else:
    kaisu=k//i
    count=0
    while kaisu>1:
      kaisu=kaisu/2
      count+=1
    kakuritu+=0.5**count/n
print(kakuritu)
# Judge status: Wrong Answer
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))

print(math.gcd(abs(min(x)-X),abs(max(x)-X)))
# Judge status: Wrong Answer
import math
n,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]


def get_1_index(a):
    for i,j in enumerate(a):
        if j==1:
            return i


index=get_1_index(a)

mae=index
usiro=n-index-1

print(math.ceil(mae/(k-1))+math.ceil(usiro/(k-1)))
# Judge status: Accepted
n = int(input())

c = [[0 for _ in range(10)] for __ in range(10)]
for i in range(1, n+1):
    str_i = str(i)
    head = int(str_i[0])
    tail = int(str_i[-1])
    c[head][tail] += 1

cnt = 0
for i in range(10):
    for j in range(10):
        cnt += c[i][j] * c[j][i]

print(cnt)
# Judge status: Accepted
k = int(input())
e = k // 2
o = k - e
print(e * o)
# Judge status: Wrong Answer
n = int(input())

s = {}
i = 0
while n > i:
    s_tmp = input()
    if s.get(s_tmp):
        s[s_tmp] += 1
    else:
        s.setdefault(s_tmp, 1)
    i += 1
    
max_k_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

for i in max_k_list:
    print(i)
# Judge status: Accepted
N = int(input()) 
l = list(map(int,input().split())) 

a = 1
n = 0
for i in range(N): 
    if l[i]==a:
        a = a+1
    else:
        n += 1
if a==1:
    print("-1") 
else:
    print(n)
# Judge status: Accepted
n, a, b = map(int, input().split())

result = 0
for i in range(1, n + 1):
    number = i
    sum_of_digits = 0
    while number > 0:
        sum_of_digits += (number % 10)
        number //= 10
    if a <= sum_of_digits <= b:
        result += i

print(result)
# Judge status: Accepted
s = input()

s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')

if s == '':
    print('YES')
else:
    print('NO')
# Judge status: Accepted
_ = input()
a = [int(e) for e in input().split(" ")]
b = [int(e) for e in input().split(" ")]
c = [int(e) for e in input().split(" ")]
res = 0
for i,j in enumerate(a):
  res += b[j-1]
  if i != 0 and j - a[i-1] == 1:
    res += c[j-2]
print(res)
# Judge status: Accepted
x, a, b=map(int, input().split())

if b-a<=0:
    print("delicious")
elif x-(b-a)>=0:
    print("safe")
else:
    print("dangerous")
# Judge status: Wrong Answer
import numpy as np
n,m,x = map(int, input().split())

#A = np.zeros((n, m))
CA = np.zeros((n,m+1))

for i in range(n):
    CA[i]=list(map(int, input().split()))
    # C[i],A[i]=T[0],T[1:]
#print(A,C)

min_cost = 9999999999999999

for i in range(2**n):
    T = np.zeros((m+1))
    for j in range(n):
        if i&(2**j) > 0:
            T += CA[j]
    if all(T[1:] >= x):
        min_cost = min(min_cost,T[0])        

print(min_cost)
# Judge status: Accepted
S = input()
L = len(S)

ans = None
for i in range(1,L):
  if (L - i) % 2 != 0:
    continue
  ns = S[:-i]
  h = (L - i) // 2
  m = ns[:h] + ns[:h]
  if ns == m:
    ans = ns
    break
    
print(len(ans))
# Judge status: Accepted
from itertools import chain
import sys

A, B, K = map(int, input().split())
diff = B - A

if diff == 0:
    print(A)
    sys.exit()

if K > diff:
    K = diff

ans = [x for x in chain(range(A, A + K), range(B - K + 1, B + 1))]
ans = sorted(list(set(ans)))

print('\n'.join(map(str, ans)))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
P=[0]*N
for i in range(N-1):
    P[A[i]-1]+=1
for i in range(N):
    print(P[i])
# Judge status: Wrong Answer
import math
N = int(input())
d = math.factorial(N)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
a=max(a,b)
b=min(a,b)
MOD = pow(10,9) + 7

X=1
Y=1

for i in range(1,a+1):
    X=X*(n+1-i)%MOD
    Y=Y*i%MOD
    if i==b:
        b_Y=Y
a_Y=Y
def calc(X,Y,MOD):
    return X*pow(Y,MOD-2,MOD)


ans=pow(2,n,MOD)%MOD-1-calc(X,a_Y,MOD)-calc(X,b_Y,MOD)

print(ans%MOD)
# Judge status: Accepted
"""
累積GCD
"""

import sys
sys.setrecursionlimit(10**6)

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

from math import gcd

L = [0] * n
R = [0] * n

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

ans = 0
for i in range(n):
    ans = max(ans, gcd(L[i], R[i]))

print(ans)
# Judge status: Accepted
N,M,K=list(map(int, input().split()))

def sea():
    for i in range(M+1):
        for j in range(N+1):
            if N*i+M*j-2*i*j == K:
                return 'Yes'
    return 'No'

print(sea())
# Judge status: Accepted
a = input()
b = a.islower()

if b == True:
  print("a")
else:
  print("A")