peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from math import sqrt, ceil
def main():
    x = int(input())
    while True:
        for i1 in range(2, ceil(sqrt(x))):
            if x % i1 == 0:
                x += 1
                break
        else:
            break
    print(x)

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

ans = 10**10
x = 0
y = sum(a)
for i in range(len(a)-1):
  x += a[i]
  y -= a[i]
  d = abs(x-y)
  if d < ans:
    ans = d
print(ans)
# Judge status: Accepted
from random import *
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(365)]
for i in range(365):
    cand=0
    for j in range(26):
        if s[i][cand]<s[i][j]:
            cand=j
    print(cand+1)
    #print(randrange(1,26))
# Judge status: Wrong Answer
n=int(input())
a=[0]*n
def int1(x):
  return int(x)-1
a[:]=map(int1,input().split())
#print(a)
import numpy as np
l=np.argsort(a)
#print(l)
del a[0:l[0]]
r=0
z=0
m=len(a)
j0=0
for ii in range(max(a)):
  for jj in np.arange(j0,m):
    if a[jj]==ii:
      j0=jj+1
      r+=1
      break
    #print(a,r)
  if jj==m-1:
    #print(a)
    if r==0:
      print(-1)
    else:
      print(n-r)
    exit()
print(n-r)
# Judge status: Accepted
print(6 - sum([int(input()) for i in range(2)]))
# Judge status: Accepted
N,M=map(int,input().split())
C=[]
ans=0
cnt=0
for i in range(N):
  a,b=map(int,input().split())
  C.append((a,b))
C=sorted(C)
for i in range(N):
  if cnt+C[i][1]<=M:
    cnt+=C[i][1]
    ans+=C[i][1]*C[i][0]
  else:
    break
print((M-cnt)*C[i][0]+ans)
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
ans = 'Yes'
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == 'L':
            ans = 'No'
    else:
        if s[i] == 'R':
            ans = 'No'
print(ans)
# Judge status: Wrong Answer
from collections import Counter

N = int(input())
s = input()
d = Counter(s)
res = 1
for value in d.values():
  res *= value + 1
res -= 1
print(res)
# Judge status: Wrong Answer
from scipy.special import comb

_ = int(input())
a = sorted(list(map(int, input().split())))
ans, num, val = 0, a[-1], 0

for i in a[:-1]:
    num1 = comb(num, i)
    if num1 > val:
        val = num1
        ans = i
print(num, ans)
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
from bisect import bisect_right

N, M = mapint()
AB = []
for _ in range(N):
    a, b = mapint()
    AB.append((b, a))
AB.sort(reverse=True)

ans = 0

cnt = 0
for b, a in AB:
    if cnt>M-a:
        continue
    ans += b
    cnt += 1
print(ans)
# Judge status: Accepted
# E - Crested Ibis vs Monster
from collections import defaultdict


def main():
    H, N, *AB = map(int, open(0).read().split())
    dp = defaultdict(lambda: 1 << 30)  # dp[i] := min magic points to decrease monster's health by i
    dp[0] = 0
    for a, b in zip(*[iter(AB)] * 2):
        for i in range(H):
            if i not in dp:
                continue
            dp[i + a] = min(dp[i + a], dp[i] + b)
    ans = min(magic for health, magic in dp.items() if health >= H)
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])

prime = [1]
for i in range(2, math.ceil(g**0.5)+1):
  while g % i == 0:
    g /= i
    prime.append(i)
prime.append(g)
print(len(set(prime)))
# Judge status: Accepted
def main():
    n = int(input())
    b_list = list(map(int, input().split()))
    ans = b_list[0] + b_list[n - 2]

    for i in range(1, n - 1):
        ans += min(b_list[i - 1], b_list[i])

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import itertools

n, m, x = map(int, input().split())
A = []
for _ in range(n):
  A.append(list(map(int, input().split())))

c = [ (0, 1) for _ in range(n)]
min_price = float('inf')

for cc in itertools.product(*c):
  xx = [0] * m
  price = 0
  for i, ccc in enumerate(cc):
    if ccc==1:
      price += A[i][0]
      xx = [a +b for a, b in zip(xx, A[i][1:])]
  if min(xx) >= x:
    min_price = min(min_price, price)

if min_price==float('inf'):
  print(-1)
else:
  print(min_price)
# Judge status: Accepted
n = int(input())
a = int(input())
mod500 = n//500
remain = n - mod500 * 500
if a>=remain:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = int(input())
robots = []
for _ in range(N):
    x, l = map(int, input().split())
    robots.append((x-l, x+l))

robots.sort(key=lambda x: x[1])  # 終端を昇順ソート
# print(robots)
rm = 0
rightest_point = robots[0][1] - 1
for i in range(1, N):
    if robots[i][0] + 1 > rightest_point:  # 被っていないから残せる
        rightest_point = robots[i][1] - 1
    else:
        rm += 1
print(N-rm)
# Judge status: Wrong Answer
N = int(input())
print(N-100000*(N//100000)+1+N-1000*(N//1000)+1*N-10*(N//10)+1)
# Judge status: Accepted
x = int(input())
num = 0
j = 1
while(j):
    ans = 1
    for i in range(2,1000):
        if (x+num)%i == 0 and x+num > i :
            ans = 0
            break
        elif x + num <= i:
            break
        else:
            pass
    if ans == 1:
        j = 0
    num +=1

print(x+num-1)
# Judge status: Wrong Answer
s=str(input())
if(s=="ABC"):
  print("ARC")
else:
  print("ARC")
# Judge status: Wrong Answer
S=str(input())
if S == "SUN":
    print("MON")
elif S=="MON":
    print("TUE")
elif S=="TUE":
    print("WED")
elif S=="WED":
    print("THU")
elif S=="FRI":
    print("SAT")
else:
    print("MON")
# Judge status: Wrong Answer
int_list = [int(input()) for i in range(2)]
if int_list[0] % 500 < int_list[1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b, n = map(int, input().split())
syou = n // b
if syou >= 1:
    n = b * syou - 1

print(int((a * n) / b) - a * int(n / b))
# Judge status: Wrong Answer
from math import sqrt
import numpy as np

N = int(input())
x = []
y = []
for i in range(N):
    temp = list(map(int, input().split()))
    x.append(temp[0])
    y.append(temp[1])

def dist(i, j):
    return sqrt((x[i]-x[j])**2 + (y[i] - y[j])**2)

NN = N*N
matrix = np.zeros((N, N))
for i in range(NN):
    iy = i%N
    ix = i//N
    if iy > ix:
        matrix[ix, iy] = dist(ix, iy)
        print(ix, iy)

avepath = np.sum(matrix)*(N-1)/N
print(avepath)
# Judge status: Accepted
a,b=map(int,input().split())
if a==b:
  print('Draw')
elif a==1:
  print('Alice')
elif b==1:
  print('Bob')
elif max(a,b)==a:
  print('Alice')
else:
  print('Bob')
# Judge status: Wrong Answer
x = int(input())
# 2回で5, 6 -> 11点
i, j = divmod(x, 11)
if j <= 5:
    ans = i * 2 + 1
else:
    ans = (i + 1) * 2
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
x, y = (m+1) // 2, m // 2
for i in range(x):
    print(1+i, 2*x-i)
for i in range(y):
    print(2*x+1+i, 2*x+1+2*y-i)
# Judge status: Wrong Answer
n=int(input())
k=0
while k <= n:
    k += 1000
print(k-n)
# Judge status: Accepted
w, a, b = [int(x) for x in input().split()]
if abs(a - b) <= w:
    res = 0
else:
    res = min(abs(a + w - b), abs(b + w - a))
print(res)
# 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] + a[i + 1] - x
        a[i + 1] -= max(0, a[i] + a[i + 1] - x)
print(ans)
# Judge status: Wrong Answer
n=input()
ns=set(n)
if len(ns)==2 or len(ns)==1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)
# Judge status: Wrong Answer
s = input()
reverse_s = s[::-1]
cnt = 0
for i, j in zip(s, reverse_s):
    if i != j:
        cnt += 1
print(cnt)
# Judge status: Accepted
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
b=[int(input()) for _ in range(N)]
flag=0
for i in range(3):
  if (A[0][i] in b)and(A[1][i] in b)and(A[2][i] in b):
    flag=1
  elif (A[i][0] in b)and(A[i][1] in b)and(A[i][2] in b):
    flag=1
if (A[0][0] in b)and(A[1][1] in b)and(A[2][2] in b):
  flag=1
elif (A[0][2] in b)and(A[1][1] in b)and(A[2][0] in b):
  flag=1
print("Yes" if flag==1 else "No")
# Judge status: Accepted
n, m = map(int, input().split())
PY = [list(map(int, input().split())) + [i] for i in range(m)]
PY = sorted(PY, key=lambda x: x[1])
PC = [1] * (n+1)

anss = []
for p, y, i in PY:
    anss.append((i, p, PC[p]))
    PC[p] += 1
anss = sorted(anss, key=lambda x: x[0])
for i, p, c in anss:
    print('{:06}{:06}'.format(p, c))
# Judge status: Accepted
# 03
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


N, M, K = LI()

for i in range(N+1):
    for j in range(M+1):
        if i*(M-j) + j*(N-i) == K:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
k,n=map(int,input().split())
a=input()
i=0
while True:
    if k<=n+(n-1)*i:print(i+1);break
    i+=1
# Judge status: Accepted
a = list(map(int,input().split()))
ans = ""
for i in range(a[1] - (a[0]-1),(a[0]-1)+a[1]+1):
    ans += str(i) + " "
print(ans)
# Judge status: Accepted
w, a, b = map(int, input().split())
if abs(b-a) > w:
    print(min(abs(a+w - b), abs(a-b-w)))
else:
    print(0)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    x = N * 800
    y = (N // 15) * 200
    print(x - y)
    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
max = 1
for i in range(1,7):
  if N < 2**i:
    break
  else:
    max = 2**i
print(max)
# Judge status: Accepted
if __name__ == '__main__':
	N = int(input())
	countlist = [0] * N
	queri = [int(a) for a in input().split()]
	for q in queri:
		countlist[q-1] += 1
	for v in countlist:
		print(v)
# Judge status: Accepted
import collections

def c2c(n):
    return n*(n-1)//2

N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
c_l = list(c.values())
d2 = sum([c2c(i) for i in c_l])
#print(d2)

for i in range(len(A)):
    print(d2-(c[A[i]]-1))
# Judge status: Accepted
N = int(input())

arr=[1]*N

s = ['' for i in range(N)]

if(N==1):
    print("a")
    exit()

def num2alpha(num):
    return chr(num+97)

def dfs(k,c):
    if(k==N):
        print("".join(s))
        return
    for i in range(c):
        s[k]=num2alpha(i)
        dfs(k+1,c)
    s[k]=num2alpha(c)
    dfs(k+1,c+1)

dfs(0,0)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    K = int(input())
    
    if K%2==0:
        return -1
    
    if K % 7:
        L = 9*K
    else:
        L = 9*K//7
    a = 1
    for i in range(1,L+1):
        a = (a * 10) % L
        if a == 1:
            return i
    return -1
ans =main()
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
print(m+(n<10)*100*(10-n))
# Judge status: Accepted
# coding: utf-8
# Your code here!s = input()
n, m = map(int, input().split())
x = []
y = []
for i in range(m):
    xi, yi = map(int, input().split())
    x.append(xi)
    y.append(yi)
boxes = [False]*n
boxes[0] = True
boxescnt = [1]*n
for i in range(m):
    if boxes[x[i]-1] == True:
        if boxescnt[x[i]-1] == 1:
            boxes[x[i]-1] = False
        boxes[y[i]-1] = True
    boxescnt[x[i]-1] -= 1
    boxescnt[y[i]-1] += 1
print(sum(boxes))
# Judge status: Accepted
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    w,a,b=INTM()
    if a>=b+w:
        ans=a-(b+w)
    elif b>=a+w:
        ans=b-(a+w)
    else:
        ans=0
        
    print(ans)
if __name__ == '__main__':
    do()
# Judge status: Accepted
#nは札枚数
n,y = map(int,input().split())

for i in range(n+1):
  for j in range(n-i+1):
    if i*10000 + j*5000 + (n-i-j)*1000 == y:
      print(i,j, n-i-j)
      exit()
print('-1 -1 -1')
# Judge status: Wrong Answer
def main():
    h1, m1, h2, m2, k = map(int, input().split())
    time = (h2 * 60 + m2 - 1) - (h1 * 60 + m1)
    cnt = time // k
    print(k * cnt)



if __name__ == "__main__":
    main()
# Judge status: Accepted
k,a,b = map(int, input().split())

if a+2>=b or a>=k:
    print(1+k)
    exit()

k-=a-1
sm=a
num=int(k/2)
sm += num*(b-a)

if k%2==1:
    sm+=1

print(sm)
# Judge status: Accepted
x = int(input())
if(x == 0):
  print(1)
else:
  print(0)
# Judge status: Accepted
N = int(input())
arr = [int(x) for x in input().split()]
found = False
for x in arr:
  if x == 0:
    found = True
if found:
  print(0)
  exit(0)
res = 1
MAX = 10 ** 18
for x in arr:
  res *= x
  if res > MAX:
    print(-1)
    exit(0)
print(res)
# Judge status: Accepted
C1 = input()
C2 = input()

print('YES' if C1 == C2[::-1] else 'NO')
# Judge status: Wrong Answer
n=int(input())
s=input()

from collections import Counter

c=Counter(s)

ans = 1
for i in list(c.values()):
    ans*=i

for i in range(n):
    for j in range(n):
        if i+2*j<n:
            if s[i]!=s[i+j] and s[i+j]!=s[i+2*j] and s[i]!=s[i+2*j]:
                ans-=1


print(ans)
# Judge status: Wrong Answer
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
abc=sorted([a,b,c])
print(abc[0]*abc[1])
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))
for _ in range(K):
  B=[0]*(N+1)
  for i in range(N):
    B[max(0,i-A[i])]+=1
    B[min(N,i+A[i]+1)]-=1
  for i in range(1,N):
    B[i]+=B[i-1]
  if A==B:
    break
  A=B[:]
print(*A[:-1])
# Judge status: Wrong Answer
# coding: utf-8

K = int(input())

def Is_runrun(n):
    n = str(n)
    return not(any([abs(int(i1)-int(i2)) <= 1 for i1, i2 in zip(n[:-1], n[1:])]))

if K <= 9:
    print(K)
else:
    K -= 9
    n = 10
    runruns = []
    while len(runruns) != K:
        if Is_runrun(n):
            runruns.append(n)
        n += 1
            
    print(runruns[-1])
# Judge status: Accepted

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

def check(x):
    cnt = 0
    for a in A:
        cnt += (a + x - 1) // x - 1
    return cnt <= K

left = 0
right = 10 ** 9
while right - left > 1:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid
print(right)
# Judge status: Accepted
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])
    a = x//500
    b = (x-(500*a))//5

    return str(1000*a+5*b)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
# Judge status: Accepted
i = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる

A = i[0]
B = i[1]
C = i[2]

K = int(input())
count = 0

for i in range(K):
  if B<=A:
    B = B*2
    count = count + 1
  if B>A:
    break
    

for i in range(K-count):
  if C<=B:
    C = C*2
  if C>B:
    print("Yes")
    break

if A>=B:
  print("No")
elif B>=C:
  print("No")
# Judge status: Accepted
n,k=map(int,input().split())
s=list(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print("".join(s))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
if len(set(A)) == N:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N = int(input())
AB = []
for _ in range(N):
    AB.append(list(map(int, input().split())))
if N % 2 == 1:
    idx = N // 2
    ans = AB[idx][1] - AB[idx][0] + 1
else:
    idx1 = (N-1) // 2
    idx2 = (N-1) //2 + 1
    lower_bound = AB[idx1][0] + AB[idx2][0]
    upper_bbound = AB[idx1][1] + AB[idx2][1]
    diff = upper_bbound - lower_bound + 1
    ans = diff
print(ans)
# Judge status: Wrong Answer
import math

R = int(input())

print(R**2*math.pi)
# Judge status: Accepted
n, m = map(int,input().split())
a = list(map(int,input().split()))

t = sum(a)
a.sort(reverse=True)
for i in range(m):
    if a[i] < t * 1/(4*m):
        print("No")
        exit()

print("Yes")
# Judge status: Accepted
s = input()

ans = 0
for c in s:
    ans += ord(c) - ord('0')

ans = max(ans, ord(s[0])-ord('0')-1 + (len(s)-1)*9)
print(ans)
# Judge status: Wrong Answer
n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

before=0
roop=0
cnt={}
nxt=1
mp = []
for i in range(1, k+1):
    mp.append(nxt)
    if nxt not in cnt:
        cnt[nxt] = i
        nxt = a[nxt]
    else:
        roop = i - cnt[nxt]
        before = cnt[nxt]-1
        break
    roop=1
    before=0

print(mp[before + (k-before)%roop])
# Judge status: Accepted
kuziNum=int(input())
nyuuryokuNum=0
prizeDictionary={}

while kuziNum > nyuuryokuNum:
  nextPrize =input()
  if nextPrize not in prizeDictionary :
    prizeDictionary[nextPrize]=nextPrize
  nyuuryokuNum+=1

print(str(len(prizeDictionary.keys())))
# Judge status: Wrong Answer
five = int(input())
one_hundred = int(input())
fifty = int(input())
total = int(input())
count = 0
x = total//50
if 0<= x <=fifty:
  if 0 <= x//2 <= one_hundred:
    if 0 <= x//10 <= five:
      count = ( 1 + (x//2 + 1) + (x//10 + 1))
    else:
      count = ( 1 + (x//2 + 1) + five)
  else:
    count = (1 + one_hundred + five)
else:
  count = (fifty + one_hundred + five)
print(count)
# Judge status: Accepted
import re
A,B=map(int,input().split())
S=input()

m = re.match(r'^(\d+)\-(\d+)$', S)

if m:
    if len(m.groups()[0]) == A and len(m.groups()[1]) == B:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Wrong Answer
N = input()

s = str(N)
if s.count("7")>0:
	print(True)
else:
	print(False)
# Judge status: Accepted
n = int(input())
string = input()
Rcount = string.count('R')
fixRcount = string.count('R', Rcount, n)
print(fixRcount)
# Judge status: Accepted
import sys

A, B, C, D = list(map(int, input().split()))

while True:
    C -= B
    if C <= 0:
        print("Yes")
        sys.exit()
    A -= D
    if A <= 0:
        print("No")
        sys.exit()
# Judge status: Accepted
a, b, c = map(int, input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = int(input())

x1 = y1 = 0
x2, y2 = 10**9, 1
x3 = (10**9 - s % 10**9) % 10**9
y3 = (s + x3) // 10 ** 9

print(x1, y1, x2, y2, x3, y3)
# Judge status: Wrong Answer

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

x=a*b
c=0
for i in range(1,10):
    for j in range(1,10):
        
        if (j*i==x):
            c=c+1
if (c==0):
    print('-1')
if (c!=0):
    print(x)
# Judge status: Wrong Answer
a,b,k=list(map(int,input().split()))
l=[]
v=[]
for i in range(a,b+1):
    l.append(i)
for i in range(k):
    if i>=len(l):
        break
    v.append(l[i])
l.reverse()
for i in range(k-1,-1,-1):
    if i>=len(l):
        continue
    v.append(l[i])
s=set(v)
for i in s:
    print(i)
# Judge status: Wrong Answer
a, b=map(int, input().split())
if a and b <=9:
  print(a*b)
else:
  print(-1)
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, a, b = map(int, input().split())
if a > b:
    print(0)
    sys.exit(0)
if n == 1 and a != b:
    print(0)
    sys.exit(0)
print((a + b * (n - 1)) - (b + a * (n - 1)) + 1)
# Judge status: Wrong Answer
n,k=map(int,input().split())
s=input()
l=[0]
c=0
for i in range(1,n):
    if(s[i]=='C'):
        if(s[i-1]=='A'):
            c+=1
    l.append(c)
print(l)
for q in range(k):
    x,y=map(int,input().split())
    print(l[y-1]-l[x-1])
# Judge status: Wrong Answer
N=int(input())
d={}
k=[]
for x in range(N):
  S,P=input().split()
  if S not in k:
    k.append(S)
    d[S]=[]
  d[S].append([P,x+1])
k.sort()
for y in k:
  d[y].sort(reverse=True)
  for z in range(len(d[y])):
    print(d[y][z][1])
# Judge status: Accepted
w,a,b=map(int,input().split())
x=min(a,b)
y=max(a,b)
print(y-x-w if y-x>w else 0)
# Judge status: Wrong Answer
N,M=map(int,input().split())
A=list(map(int,input().split()))
for i in range(M):
  B=sorted(A)
  B[-1]=B[-1]//2
  A=B
print(B)  
print(sum(B))
# Judge status: Accepted
N = int(input())
a = sorted(list(map(int,input().split())))
A = [a[i] for i in range(N,3 * N)]

ans = 0

for i in range(0,N):
  ans += A[i * 2]
  
print(ans)
# Judge status: Accepted
n = int(input())
print((n//2)*(n//2+(n%2)))
# Judge status: Accepted
import heapq
n,h= map(int,input().split())
bl = []
heapq.heapify(bl)
maxa = -1
for i in range(n):
    a,b=map(int,input().split())
    maxa=max(maxa,a)
    heapq.heappush(bl,-b)
count=0
while len(bl)>0:
    if -bl[0]>maxa:
        h-=-heapq.heappop(bl)
        count+=1
        if h<=0:break
    else:break
if h<=0:print(count)
else:print(count + h//maxa + (1 if h%maxa>0 else 0))
# Judge status: Accepted
a,b,c,d=map(int,input().split())
# 絶対値を出したいときはabs関数を使う！
if abs(a-b)<=d and abs(b-c)<=d or abs(a-c)<=d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
dic = {}

for _ in range(N):
  inp = input()
  if inp not in dic:
    dic[inp] = 1
  else:
    dic[inp] = dic[inp] + 1

num = max(dic.values())
ans = []
for i in dic:
  if dic[i] == num:
    ans.append(i)
    
ans.sort()
for i in ans:
  print(i)
# Judge status: Wrong Answer
N,R=map(int,input().split())
if N>=10:
    print(R)
else:
    print(100*(10-N))
# Judge status: Accepted
sum=0
N,K=input().split(" ")

array=input().split(" ")
for i in range(int(N)):
  n=int(array[i])
  array[i]=n

array.sort()

for j in range(int(K)):
  sum=sum+array[j]
print(sum)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

print("Yes" if (a < c < b) else "No")
# Judge status: Wrong Answer
import sys
import collections

N = int(input())
S = [str(input()) for i in range(N)]
# S_jadge1 = [s for s in S if s.islower()]
# S_jadge2 = [s for s in S if 1 <= len(s) <= 10]
# if len(S) != len(S_jadge1):
#     sys.exit()
# if len(S) != len(S_jadge2):
#     sys.exit()
if not 1 <= N <= 2*10*5:
    sys.exit()

# if not S.islower():
#     print("error:lower")
#     sys.exit()

c = collections.Counter(S)
max_val = max(c.values())
A = [key for key, value in c.items() if value == max_val]
print('\n'.join(A))
# print(c.items())
# Judge status: Accepted
h, w = map(int, input().split())
if h == 1 or w == 1:
  print(1)
else:
  if w % 2 == 0:
      a = (w//2) * 2
      if h % 2 == 0:
          count = a * (h//2)
      else:
          count = a * (h//2)
          count += a // 2
  else:
      a = (w//2) * 2 + 1
      if h % 2 == 0:
          count = a * (h//2)
      else:
          count = a * (h//2)
          count += a//2+1

  print(count)
# Judge status: Wrong Answer
x=input()
if x==0:
    print("1")
else:
    print("0")
# Judge status: Accepted
import fractions
n = int(input())
a = list(map(int, input().split()))

a.sort()

mini = a.pop(0)
ans = 10**9+1
for i in range(n-1):
  temp = fractions.gcd(mini, a[i])
  if temp < ans:
    ans = temp
  
print(ans)
# Judge status: Accepted
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
L = [0]
R = [0]
M = []
maximum = 0
for n in range(N):
    L.append(gcd(A[n], L[-1]))
    R.append(gcd(A[-n-1], R[-1]))
R.reverse()
for n in range(N):
    M.append(gcd(L[n], R[n+1]))
for n in range(N):
    maximum = max(maximum, M[n])
print(maximum)
# Judge status: Wrong Answer
from math import gcd
r = range(1, int(input()) + 1)
print(sum(gcd(gcd(a, b), c)) for a in r for b in r for c in r)
# Judge status: Accepted
a, b, k = [int(w) for w in input().split()]

ak = a + k
bk = b - k + 1

for i in range(a, min(ak, b+1)):
    print(i)
for i in range(max(ak, bk), b + 1):
    print(i)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=a
for i,j in enumerate(a,1):
  b[j-1]=i
print(*b)
# Judge status: Accepted
a,b = map(lambda x:int(x) % 2, raw_input().split()) 
print 'Odd' if (a == b == 1) else 'Even'