peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N, D = map(int, input().split())
d = []
i = 1
while len(d) <= N:
    d += [i]*(D*2+1)
    i += 1
print(len(set(d)))
# Judge status: Wrong Answer
A, B, X = map(int, input().split())

if X < A:
  print("No")
elif X - A <= B:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input().strip()
ans = "keyence"
idx = 0
if s[:7] == ans:
    print("YES")
    exit()
for i in range(len(s) - 1):
    for j in range(i + 1, len(s), 1):
        if s[:i] + s[j:] == ans:
            print("YES")
            exit()
print("NO")
# Judge status: Wrong Answer
A, B, T = map(int, input().split())

print(int((T+0.5)/A * B))
# Judge status: Accepted
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
B=[]
for i in range(N):
  B.append([A[i][0]-A[i][1],A[i][0]+A[i][1]])
C=sorted(B, key=lambda x: x[1])
cnt=0
r=-1*10**9
for i in range(N):
  if r<=C[i][0]:
    cnt+=1
    r=C[i][1]
print(cnt)
# Judge status: Accepted
x, y =map(int, input().split())
a = "No"
if y % 2 == 0:
  if x*2 <= y and y <= x*4:
    a = "Yes"
print(a)
# Judge status: Wrong Answer
from math import floor
from functools import reduce
from itertools import product

def resolve():
  A, B, N = map(int, input().split(" "))

  maximam = 0
  for n in range(1, N+1):
    result = (floor(A*n/B) - A * floor(n/B))
    if maximam < result :
      maximam = result

  print(result)

if __name__ == "__main__":
  resolve()
# Judge status: Accepted
N, M = map(int, input().split())
if N >= M // 2:
  print(M//2)
else:
  amari_c = M - 2 * N
  ans = N + amari_c // 4
  print(ans)
# Judge status: Accepted
from collections import Counter

n = int(input())
A = Counter(list(map(int, input().split())))
A = sorted(A.most_common(), reverse=True)
rods = []
for a in A:
    if a[1] >= 4:
        rods.append(a[0])
        rods.append(a[0])
        break
    if a[1] >= 2:
        rods.append(a[0])
    if len(rods) == 2:
        break
if len(rods) >= 2:
    ans = rods[0]*rods[1]
else:
    ans = 0
print(ans)
# Judge status: Wrong Answer
c = int(eval(input().replace(" ","+")))
print("Impossible"*(c%6==2 or c%6==4) or "Possible")
# Judge status: Accepted
h=int(input())
w=int(input())
n=int(input())

if n%max(h,w) != 0:
  print(n//max(h,w)+1)
else:
  print(n//max(h,w))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = sum(b)
for i in range(1,n):
    if a[i]-1==a[i-1]:
        ans+=c[i-1]
print(ans)
# Judge status: Accepted
import math

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

ans = 0
for n in range(1,N+1):
  ans += ((0.5) ** max(math.ceil(math.log2(K/n)), 0))/N
print(ans)
# Judge status: Accepted
*abcd, = map(str, input())

a = [""]*len(abcd)
ans = []

def rec(i: int, a: list) -> None:
    if i == len(abcd)-1:
        statement = "".join(_abcd+_a for _abcd, _a in zip(abcd, a))
        if eval(statement) == 7:
            global ans
            ans.append(statement)

        return

    a[i] = "-"
    rec(i+1, a)
    a[i] = "+"
    rec(i+1, a)

rec(0, a)
print(ans[0]+"=7")
# Judge status: Accepted
A,B=map(int,input().split())
print((A+B)%24)
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
S=input()

nowA=0
nowB=0

for s in S:
    if s=='c':
        print('No')
    elif s=='a':
        if nowA+nowB<A+B:
            nowA+=1
            print('Yes')
        else:
            print('No')
    else:
        if nowA+nowB<A+B and nowB<=B:
            nowB+=1
            print('Yes')
            nowB+=1
        else:
            print('No')
# Judge status: Accepted
a,b = map(int, input().split())

if a <= b:    
    print("{}".format(str(a)*b))
else:
    print("{}".format(str(b)*a))
# Judge status: Accepted
A,B = map(int, input().split())
A = 15 if A == 1 else A
B = 15 if B == 1 else B

if A == B:
    print('Draw')
elif A < B:
    print('Bob')
elif A > B:
    print('Alice')
# Judge status: Accepted
N = int(input())
sum = 0

for i in range(N + 1):
    if i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        sum += i

print(sum)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a == b:
  print('Draw')
elif b == 1 or a < b:
  print('Bob')
elif a == b:
  print('Draw')
else:
  print('Alice')
# Judge status: Wrong Answer
s = input().rstrip()

if s[-1]==s:
  s += 'es'
else:
  s += 's'
  
print(s)
# Judge status: Wrong Answer
C = input()
S = "abcdefghijklmnopqrstuvwxyg"

for i in range(26):
  if C == S[i]:
    print(S[i+1])
    break
# Judge status: Accepted
N = int(input())
A = set()
for i in range(N):
    n = int(input())
    if not (n in A):
        A.add(n)
    else:
        A.remove(n)
print(len(A))
# Judge status: Accepted
c = [list(map(int, input().split())) for _ in range(3)]
if c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1] and c[0][1] - c[0][2] == c[1][1] - c[1][2] == c[2][1] - \
        c[2][2] and c[0][0] - c[1][0] == c[0][1] - c[1][1] == c[0][2] - c[1][2] and c[1][0] - c[2][0] == c[1][1] - c[2][
    1] == c[1][2] - c[2][2]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# coding: utf-8

num = int(input())
ok = 0
for i in range(9):
    for j in range(9):
        if num == i * j:
            print("Yes")
            ok += 1
            exit()
if ok == 0:
    print("No")
# Judge status: Accepted
from math import gcd

K = int(input())

sum_ = 0

for i in range(1, K + 1):
    for j in range(1, K + 1):
        g1 = gcd(i, j)
        for k in range(1, K + 1):
            sum_ += gcd(g1, k)

print(sum_)
# Judge status: Accepted
a, b, c = map(int, input().split())
if a == b and b == c:
    if a % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    count = 0
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2
        count += 1
    print(count)
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = 10**6

ans = [INF] * N
ans[0] = 0
ans[1] = abs(H[1] - H[0])

for i in range(N):
	for j in range(K+1):
		if i + j <= N-1:
			ans[i+j] = min(ans[i+j], ans[i] + abs(H[i+j] - H[i]))
print(ans[N-1])
# Judge status: Wrong Answer
M = 10**9 + 7
n, a, b = map(int, input().split())
r = pow(2, n, M) - 1
f = c = 1
for i in range(b):
  f = f * (i + 1) % M
  c = c * (n - i) % M
  if i + 1 == a:
    r = (r - c * pow(f, M - 2, M)) % M
print((r - c * pow(f, M - 2, M) % M))
# Judge status: Wrong Answer
import collections

n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
a=sorted(a.items(),reverse=True)
#print(a)

tm=0

for i in range(n):
    if a[i][1]>=2:
        if tm==0:
            tm=a[i][0]
        else:
            print(tm*a[i][0])
            exit()

print("0")
# Judge status: Accepted
N, K = map(int, input().split())
H = list(map(int, input().split()))
if K >= N:
    print(0)
else:
    H.sort()
    print(sum(H[:N-K]))
# Judge status: Accepted
s = input()
t = input()
l0 = len(s)
l1 = len(t)
ans = 10**9
for i in range(l0 - l1 + 1):
  x = 0
  for j in range(l1):
    if s[i + j] != t[j]:
      x += 1
  ans = min(ans, x)
print(ans)
# Judge status: Accepted
w,a,b = map(int,input().split())
if a+w < b:
    print(b-a-w)
elif b+w < a:
    print(a-b-w)
else:
    print(0)
# Judge status: Accepted
N, M = map(int, input().split())
XY_list = [[] for i in range(N)]
ans_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  XY_list[X - 1].append((Y, i))
for j, k in enumerate(XY_list):
  k.sort()
  for l, (y, m) in enumerate(k):
    ans_list[m] = str(j + 1).zfill(6) + str(l + 1).zfill(6)
print(*ans_list, sep = "\n")
# Judge status: Accepted
D, T, S = map(int,input().split())

if D / S <= T:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, n = map(int, input().split())

x = b-1 if n >= b-1 else n

print((a*x)//b - a*(x//b))
# Judge status: Accepted
if __name__ == "__main__":
    N = int(input())

    print((N - 1) * N // 2)
# Judge status: Accepted
if __name__ == '__main__':
    a = input()
    b = input()
    ans =""
    for i in range(len(a)):
        ans += a[i]
        if  i<len(b):
            ans +=b[i]
    print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

if N % 2 == 1:
    for i in range(M):
        j = N - i
        print(f'{i + 1} {j}')
else:
    for i in range(M):
        j = N - i
        if i < M / 2:
            print(f'{i + 1} {j}')
        else:
            print(f'{i + 1} {j - 1}')
# Judge status: Wrong Answer
n,q = map(int,input().split())
s=input()
c=0
AC=[0]*(n)
for i in range(n):
    if 'AC' ==s[i-1]+s[i]:
        c+=1
    AC[i]=c

print(AC)
for i in range(q):
    l,r=map(int,input().split())
    print(AC[r-1]-AC[l-1])
# Judge status: Wrong Answer
list = [1,2,3,4,5]
if print(list[0]):
  print(1)
elif print(list[1]):
  print(2)
elif print(list[2]):
  print(3)
elif print(list[3]):
  print(4)
elif print(list[4]):
  print(5)
# Judge status: Accepted
print(['No', 'Yes'][0 if len(set(input())) < 3 else 1])
# Judge status: Accepted
A, B, C = map(int, input().split(" "))
print(max(C - A + B, 0))
# Judge status: Accepted
a,b,c = map(int,input().split())
yoyuu = a-b
nokori = c- yoyuu

if nokori < 0:
  print(0)
else:
  print(nokori)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    s = input().strip()
    l = len(s) // 2
    ans = 0
    for i in range(l):
        if s[i] != s[-i-1]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import re
S = input()
T = input()
if not re.match(r"^.*("+"\?"*(len(T)-1)+")",S):
  print("UNRESTORABLE")
else:
  startN=re.match(r"^.*("+"\?"*(len(T)-1)+")",S).span(1)[0]
  S=S[:startN-1]+T[1:]+S[startN+len(T)-1:]
  S=S.replace("?","a")
  print(S)
# Judge status: Accepted
# coding: utf-8

input_ = input()

count = 0

for i in range(3):
    if int(input_[-(i + 1)]) == 1:
        count += 1

print(count)
# Judge status: Accepted
n = input()
l = len(n)
n = int(n)

res = 1000
for i in range(l-2):
  c = n // (10 ** i)
  c %= 1000
  res = min(res,abs(c-753))
  #print(i,c)
print(res)
# Judge status: Accepted
n = int(input())
s = input()

if n%2 == 1:
    print('No')
    exit()

ans = 'Yes'
for i in range(n//2):
    if s[i] != s[n//2+i]:
        ans = 'No'

print(ans)
# Judge status: Accepted
n_s = list(input().rstrip())
n_t = list(input().rstrip())
cnt = 0
for i in range(len(n_s)):
    if n_s[i] != n_t[i]:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print((a*b)/2)
# Judge status: Wrong Answer
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

L = [0]*(N+2)
R = [0]*(N+2)
for i in range(N):
  L[i+1] = gcd(L[i], A[i])
for i in range(N, 0, -1):
  R[i] = gcd(R[i+1], A[i-1])
ans = 0
for i in range(1, N):
  ans = max(ans, gcd(L[i-1], R[i+1]))
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if abs(b-a) == abs(c-b):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
o = input()
e = input()
s = ''
for i in range(len(o + e)):
  if i % 2 == 0:
    s += o[i // 2]
  else:
    s += e[i // 2]
print(s)
# Judge status: Accepted
def main():
    N = int(input())
    S = ""
    while N:
        if N % 2:
            N -= 1
            S = "1" + S
        else:
            S = "0" + S
        N //= -2
    print(S if S else "0")
    return


main()
# Judge status: Wrong Answer
s = input()
a = (len(s))
if (s[a-1])=="e":
    print(s,"s", sep="")
else:
    print(s,"es", sep="")
# Judge status: Accepted
N, K, *P = map(int, open(0).read().split())

P.sort()

print(sum(P[:K]))
# Judge status: Accepted
k = int(input())
s = input()
i = ""
if len(s) <= k:
    print(s)
else:
    for j in range(k):
        i = i + s[j]
    print(i+"...")
# Judge status: Wrong Answer
N = int(input())
l = []
for _ in range(N):
    A, B = map(int, input().split())
    l.append((A, B))

t = N//2
tl = sorted(l)
tr = sorted(l, key=lambda x:-x[1])

if N%2:
    print(tr[t][1]-tl[t][0]+1)
else:
    # a1, a2 = tl[t][0], tr[t][1]
    a3, a4 = tl[t-1][0], tr[t-1][1]
    print((a4-a3+1)*(a4-a3)//2)
# Judge status: Accepted
n,s = open(0).read().split()

imp_close = 0
imp_open = 0

for char in s:
    if char == '(':
        imp_open += 1
    else:
        if imp_open:
            imp_open -= 1
        else:
            imp_close += 1

print('('*imp_close + s + ')'*imp_open)
# Judge status: Wrong Answer
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

l,r,d=nm()

print((r-l+1)//d)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(n)]
for i in range(n):
       ans[a[i]-1] = str(i+1)

print(" ".join(ans))
# Judge status: Accepted
def saiki(i,cost,score_list):
    if i == N:
        if min(score_list) >= X:
            ans.append(cost)
    else:
        temp = [score_list[j]+book_lists[i][j+1] for j in range(M)]
        saiki(i+1,cost,score_list)
        saiki(i+1,cost+book_lists[i][0],temp)
 
N,M,X = map(int,input().split())
book_lists = [list(map(int, input().split())) for _ in range(N)]
ans=[]
saiki(0,0,[0]*M)
print(min(ans) if len(ans)!=0 else -1)
# Judge status: Accepted
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
sum_com = 0
distinct_a = sorted(list(set(a)), reverse=True)
comfort = {i: 0 for i in distinct_a}
comfort[a[0]] = 1
max_com = 0

for ai in a[1:]:
    sum_com += distinct_a[max_com]
    if distinct_a[max_com] == ai:
        comfort[distinct_a[max_com]] += 1
    else:
        comfort[distinct_a[max_com]] -= 1
        comfort[ai] += 2
        if comfort[distinct_a[max_com]] == 0:
            max_com += 1

print(sum_com)
# Judge status: Accepted
s = input()[::-1]
while s:
  start = len(s)
  for t in ['maerd', 'remaerd', 'esare', 'resare']:
    if t == s[:len(t)]:
      s = s[len(t):]
  if start == len(s):
    break
print("YNEOS"[len(s)>0::2])
# Judge status: Accepted
import math
a,b,x = map(int,input().split())
if x > a*a*b/2:
    tan = 2*(a*a*b - x)/(a*a*a)
elif x <= a*a*b/2:
    tan = a*b*b/(2*x)
print(math.degrees(math.atan(tan)))
# Judge status: Accepted
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    a = list(map(int, input().split()))

    ans = 0
    n = 1
    for i in range(N):
        if a[i] != n:
            ans += 1
        else:
            n += 1
    if ans == N:
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
lst = []
for _ in range(n):
    x, y = map(int, input().split())
    lst.append([x+y, x, y])

lst.sort()
print(lst[-1][0] - lst[0][0])
# Judge status: Accepted
N = int(input())

x = int(N * 100 / 108)

if x * 108 // 100 == N:
  print(x)
elif (x+1) * 108 // 100 == N:
  print(x+1)
else:
  print(':(')
# Judge status: Wrong Answer
a,b,c,k = map(int,input().split())


def function(a,b,c,k):
    count =0
    if a>=k:
        return a
    else:
        count =a

        k =k-a
        a=0

        while(k>0):
            if b>0:
                b-=1

            elif c>0:
                c-=1
                count-=1



            k-=1

        return count
print(function(a,b,c,k))
# Judge status: Accepted
n=input()
print("Yes") if "7" in n else print("No")
# Judge status: Accepted
n = int(input())
ans = 0

for i in range(1, n+1):
  ans += (n-1)//i

print(ans)
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a >= b:
    if v <= w:
        print("NO")
    else:
        print("YES" if abs(v-w)*t >= abs(a-b) else "NO")
else:
    if v <= w:
        print("NO")
    else:
        print("YES" if abs(v-w)*t >= abs(a-b) else "NO")
# Judge status: Wrong Answer
S = input("S=ABC" or "S=ARC")
if S == "ABC" : 
  print("ARC")
if S == "ARC" :
  print("ABC")
# Judge status: Accepted
n=int(input())
a=int(input())
print('Yes' if n%500<=a else 'No')
# Judge status: Accepted
A, B = map(int, input().split())
print(A*B)
# Judge status: Accepted
# coding: utf-8
import math

num = int(input())
print(num * math.pi * 2)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

for i in range(1,n):
    nmb_cnt = 0
    idx_cnt = 0
    for j in a:
        if j == i:
            del a[idx_cnt]
            nmb_cnt += 1
        else:
            idx_cnt += 1
    print(nmb_cnt)

print(0)
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = 0
if a == b == c:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        pass
    else:
        ans = -1
else:
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        ans += 1
        a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
print(ans)
# Judge status: Accepted
n=int(input())
#a,b=map(int,input().split())
xl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
l2d=[]
for i in range(n):
    l2d.append([i,xl[i]])

xlsort=sorted(xl)
v1=xlsort[n//2-1]
v2=xlsort[n//2]

l2d.sort(key=lambda x: x[1])
dic={}
for i in range(n):
    dic[l2d[i][0]]=i
thre=n//2
for i in range(n):
    if dic[i]<thre:
        print(v2)
    else:
        print(v1)
# Judge status: Accepted
n = int(input())
list1 = list(map(int, input().split()))
great = 9999999
for i in range(n - 1):
  temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:])))
  if temp < great:
    great = temp
print(great)
# Judge status: Accepted
from functools import reduce
n = int(input())
S = [input() for _ in range(n)]
ans = ""
for i in range(26):
  now = chr(ord("a")+i)
  t = float("inf")
  for j in S:
    t = min(t, j.count(now))
  ans += now*t
print(ans)
# Judge status: Accepted
inputs = []
while True:
  try:
    inputs.append(input())
  except EOFError:
    break

# print(inputs)

people = eval(inputs[0].split(" ")[0])
snack = eval(inputs[0].split(" ")[1])

having_snacks = [[eval(i) for i in a.split(" ")] for a in inputs[2::2]]
having_snacks = set(sum(having_snacks, []))

print(people - len(having_snacks))
# Judge status: Accepted
from sys import stdin


def main():
    N, *S = [i.strip() for i in stdin.readlines()]
    N = int(N)
    judge = ["AC", "WA", "TLE", "RE"]
    mul = " x "
    C = [0] * len(judge)
    for Si in S:
        C[judge.index(Si)] += 1
    print("\n".join((judge[i] + mul + str(C[i]) for i in range(len(judge)))))
    return


main()
# Judge status: Accepted
N = int(input())
B = list(map(int, input().split()))

sum = B[0]
for i in range(1, N - 1):
	sum += min(B[i - 1], B[i])
sum += B[N - 2]

print(sum)
# Judge status: Wrong Answer
import math
ans=0
k=int(input())
for i in range(k):
  for j in range(k):
    gcd_ij=math.gcd(i+1,j+1)
    for k in range(k):
      ans+=math.gcd(gcd_ij,k+1)
print(ans)
# Judge status: Accepted
S = input()
T = input()
 
T = T[:-1]
if S == T:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
X=-1
T=True
for i in L:
  if i!=X:
    X=i
  else:
    T=False
if T==True:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
    x[i], y[i] = map(int, input().split())

res = 0
for i in range(n):
    for j in range(i, n-1):
        res = max(res, abs(x[i] - x[j]) + abs(y[i] - y[j]))

print(res)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def solve():
    w = list(input())
    s = set(w)
    for i in s:
        if len([x for x in w if x == i]) % 2 == 1:
            print('No')
            exit()
    print('Yes')

if __name__ == "__main__":
    solve()
# Judge status: Accepted
X, Y, Z = map(int, input().split())

ans = (X - Z) // (Y + Z)
print(ans)
# Judge status: Accepted
S = input()
print(min(S.count('1'), S.count('0')) * 2)
# Judge status: Wrong Answer
s = input()

a = int(s[0]+s[1])
b = int(s[2]+s[3])

if a > 12 and 1 <= b <= 12:
    print('YYMM')
elif 1 <= a <= 12 and b > 12:
    print('MMYY')
elif 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
else:
    print('NA')
# Judge status: Accepted
N, K = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(N)]
l.sort(key=lambda x: x[0])

cnt = 0
for x in l:
  cnt += x[1]
  if cnt >= K:
    print(x[0])
    break
# Judge status: Wrong Answer
n = int(input())
c = input()
ans = 0
c1 = len(c)//2 if len(c)%2 == 0 else len(c)//2 +1
cnt_w = 0
cnt_r = 0
for i in range(c1):
  if c[i]=='W':
    cnt_w += 1
for i in range(c1,len(c)):
  if c[i]=='R':
    cnt_r += 1

ans = cnt_w if cnt_w <= cnt_r else cnt_r

print(ans)
# Judge status: Accepted
a,b,x=map(int,input().split());print(b//x-(a-1)//x)
# Judge status: Wrong Answer
N = int(input())
B = list(map(int, input().split())) 

A = [0] * N

B.append(B[-1])

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

print(sum(A))
# Judge status: Accepted
s=input()
if int(s[5:7])<=4:print("Heisei")
else:print("TBD")
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n = int(input())
cheep_1 = min(q * 4, 2 * h, s)
if 2 * cheep_1 <= d:
    print(cheep_1 * n)
else:
    n1 = n % 2
    print(n // 2 * d + n1 * cheep_1)
# Judge status: Wrong Answer
def ac_or_wa(n, m):
    if n == m:
        return "AC"
    elif n > m:
        return "WA"


n, m = map(int, input().split())
print(ac_or_wa(n, m))
# Judge status: Accepted
a=[int(input()) for _ in range(5)]
ans=sum(a)
b=10
for i in range(5):
    if a[i]%10!=0:
        ans+=10-a[i]%10
        b=min(b,a[i]%10)
print(ans-10+b)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
mo = 10 ** 9 + 7
def hanaya(n, x):
    if x == 1:
        return n
    else:
        return ((hanaya(n, x-1))*((n-x+1)/x))%mo

ans = (pow(2, N) - 1 ) % mo
print(int(ans))
# Judge status: Wrong Answer
a,b=map(int,input().split())

if a<=9 and b<=9:
    print(a*b)
else:
    print()
# Judge status: Accepted
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)
# Judge status: Accepted

import collections


def solve(L):
    oneSideLength = L/3
    return oneSideLength ** 3


L = int(input().strip())
print(solve(L))
# Judge status: Wrong Answer
D = [int(_) for _ in input().split()]

def solve(D):
    N = D[0]
    M = D[1]
    K = D[2]
    
    for l in range(N+1):
        for k in range(M+1):
            if M * k + N * l - 2 * k * l == K:
                return "Yes"

    return "No"

print(solve(D))
# Judge status: Accepted
f=lambda:map(int,input().split())
n,m=f()
lt=sorted(list(f()) for _ in range(n))[::-1]
from heapq import *
q,s=[],0
for i in range(m):
  while lt and lt[-1][0]<i+2: a,b=lt.pop(); heappush(q,-b)
  if q: s-=heappop(q)
print(s)
# Judge status: Wrong Answer
S = input()
T = input()
d = {}
for s, t in zip(T, S):
    if s in d:
        if t != d[s]:
            print("No")
            break
    else:
        d[s] = t
else:
    print("Yes")
# Judge status: Wrong Answer
H,N=map(int,input().split())
A=[0]*N
B=[0]*N
for i in range(N):
  A[i],B[i]= map(int,input().split())

DP=[0]*(H+1)
DP[0]=0

for i in range(1,H+1):
  mini=100000
  for j in range(N):
    if i-A[j]>=0:
      mini=min(mini, DP[i-A[j]]+B[j])
  if mini<100000:
    DP[i]=mini
  else:
    DP[i]=DP[i-1]
  
print(DP)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = []
for i in range(m):
    a.append(input().split())
haba = a[0]
for i in a:
    if int(haba[0]) < int(i[0]) < int(haba[1]):
        haba[0] = i[0]
    if int(haba[0]) < int(i[1]) < int(haba[1]):
        haba[1] = i[1]
if n < int(haba[0]):
    ans = 0
elif int(haba[0]) <= n <= int(haba[1]):
    ans = n - int(haba[0]) + 1
else:
    ans = int(haba[1]) - int(haba[0]) + 1
print(ans)
# Judge status: Wrong Answer
#coding:utf-8
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
ans = 0
for it in c.items():
    if it[0] < it[1]:
        ans += (it[1]-it[0])
    else:
        ans += it[0]
print (ans)