AtCoder Beginner Contest 048 - Between a and b ...

You are given nonnegative integers a and b (a ≤ b), and a positive integer x.
Among the integers between a and b, inclusive, how many are divisible by x?

-----Constraints-----
 - 0 ≤ a ≤ b ≤ 10^{18}
 - 1 ≤ x ≤ 10^{18}

-----Input-----
The input is given from Standard Input in the following format:
a b x

-----Output-----
Print the number of the integers between a and b, inclusive, that are divisible by x.

-----Sample Input-----
4 8 2

-----Sample Output-----
3

There are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.

Source: atcoder | Difficulty: EASY


Solutions:
(a, b, x) = map(int, input().split())
print(b // x - (a - 1) // x)


def generator(x, a):
	if x >= a:
		y = x
	else:
		tmp = a // x + 1
		if a % x == 0:
			tmp -= 1
		y = x * tmp
	return y

def main():
	(a, b, x) = map(int, input().split())
	minimum = generator(x, a)
	if minimum > b:
		count = 0
	else:
		count = (b - minimum) // x + 1
	if a == 0:
		count += 1
	print(count)

def __starting_point():
	main()
__starting_point()


import math
(a, b, x) = map(int, input().split())
print(b // x - (a - 1) // x)


(a, b, x) = map(int, input().split())
m = (a - 1) // x + 1
n = b // x
print(n - m + 1)


(A, B, X) = map(int, input().split())
(mA, mB) = ((A - 1) // X, B // X)
print(mB - mA)


(a, b, c) = map(int, input().split())
if a == 0:
	print(b // c + 1)
	return
print(b // c - (a - 1) // c)


(a, b, x) = map(int, input().split())
if a != 0:
	print(b // x - (a - 1) // x)
else:
	print(b // x + 1)


(A, B, X) = map(int, input().split())
print(B // X - (A - 1) // X)


(a, b, n) = list(map(int, input().split()))
print(b // n - ~-a // n)


(a, b, x) = map(int, input().split())
count = 0
start = 0
for i in range(x, 10 ** 18 + x + 1, x):
	if a <= i:
		start = count
		break
	count += 1
if a == 0:
	start = -1
print(b // x - start)


(a, b, x) = map(int, input().split())
print(b // x - a // x + (a % x == 0))


(a, b, x) = map(int, input().split())
st = -(-a // x)
ed = b // x
print(ed - st + 1)


(a, b, x) = map(int, input().split())
ans = 0
ans += b // x
ans -= (a - 1) // x
print(ans)


import math
from decimal import *
(a, b, x) = map(Decimal, input().split())
print(max(0, b // x - math.ceil(a / x) + 1))


[a, b, x] = [int(i) for i in input().split()]
print(b // x - (a - 1) // x)


(a, b, x) = map(int, input().split())
s = b // x
t = (a - 1) // x
print(s - t)


(A, B, X) = map(int, input().split())
print(B // X + 1 - ((A - 1) // X + 1 if A else 0))


(a, b, x) = map(int, input().split())
cnt = 0
if a % x == 0:
	cnt += 1
cnt += b // x - a // x
print(cnt)


(a, b, k) = [int(x) for x in input().split()]
res = b // k
res -= (a - 1) // k
print(res)


import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10 ** 9)

def si():
	return input()

def ii():
	return int(input())

def fi():
	return float(input())

def lstr():
	return input().split()

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

def lint_dec():
	return list([int(x) - 1 for x in input().split()])

def lnstr(n):
	return [input() for _ in range(n)]

def lnint(n):
	return [int(input()) for _ in range(n)]

def lint_list(n):
	return [lint() for _ in range(n)]
(a, b, x) = lint()
print(b // x - (a - 1) // x)


(a, b, x) = map(int, input().split())
cnt = b // x
cnt1 = (a - 1) // x
print(cnt - cnt1)


(a, b, x) = map(int, input().split())
cnt2 = b // x
cnt1 = (a - 1) // x
print(cnt2 - cnt1)


(a, b, x) = map(int, input().split())
fa = (a - 1) // x
fb = b // x
print(fb - fa)


(a, b, x) = map(int, input().split())
nb = b // x
na = (a - 1) // x
print(nb - na)


(a, b, x) = map(int, input().split())
B = b // x
A = (a - 1) // x
print(B - A)


(a, b, x) = list(map(int, input().split()))
ans = (b - a) // x
if (x - a % x) % x + b % x < x:
	ans += 1
print(ans)


(x, y, z) = map(int, input().split())
ans = y // z - x // z
if x % z == 0:
	ans += 1
print(ans)


(a, b, x) = map(int, input().split())
c = (a - 1) // x
d = b // x
print(d - c)


(a, b, c) = map(int, input().split())
r = 0
if a % c == 0:
	r = 1
print(b // c - a // c + r)


(a, b, x) = map(int, input().split())
ar = a % x
n = b - a + 1
if ar != 0:
	n -= x - ar
ans = n // x
if n % x >= 1:
	ans += 1
print(ans)


(a, b, x) = map(int, input().split())
r = b // x
l = (a - 1) // x
print(r - l)


(a, b, x) = map(int, input().split())
B = b // x
A = a // x
print(B - A + (a % x == 0))


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

def f(n, d):
	if n == -1:
		return 0
	return n // d + 1
print(f(b, x) - f(a - 1, x))


(a, b, c) = map(int, input().split())
print(b // c - (a - 1) // c)


lst = input().split()
a = int(lst[0])
b = int(lst[1])
x = int(lst[2])
if a % x != 0:
	a = x * (a // x + 1)
if b % x != 0:
	b = x * (b // x)
print((b - a) // x + 1)


a = list(map(int, input().split()))
print(a[1] // a[2] - (a[0] - 1) // a[2])


def main():
	(a, b, x) = list(map(int, input().split()))
	print(b // x - (a - 1) // x)

def __starting_point():
	main()
__starting_point()


def __starting_point():
	(a, b, x) = map(int, input().split())
	l = b // x
	r = (a - 1) // x
	print(l - r)
__starting_point()


(a, b, x) = list(map(int, input().split()))
a_x = a // x
b_x = b // x
if a % x == 0:
	print(b_x - a_x + 1)
else:
	print(b_x - a_x)


(a, b, x) = map(int, input().split())
mx = b // x
mn = (a - 1) // x
print(mx - mn)


import math
import collections
from itertools import product
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
(a, b, x) = mi()
if a % x != 0:
	A = x * (a // x + 1)
else:
	A = a
B = b - b % x
print((B - A) // x + 1)


(a, b, x) = map(int, input().split())
ans_a = (a - 1) // x
ans_b = b // x
print(ans_b - ans_a)


def LI():
	return list(map(int, input().split()))
(a, b, x) = LI()
ans = b // x - (a - 1) // x
print(ans)


(a, b, x) = map(int, input().split())
a_ = (a - 1) // x
b_ = b // x
print(b_ - a_)


(a, b, x) = list(map(int, input().strip().split(' ')))
print(b // x - (a - 1) // x)


(a, b, x) = map(int, input().split())
dum1 = (a - 1) // x
dum2 = b // x
print(dum2 - dum1)


(a, b, x) = map(int, input().split())
print(max(b // x - (a - 1) // x, 0))


(a, b, n) = map(int, input().split())
print(b // n - (a - 1) // n)


(a, b, x) = map(int, input().split())
res1 = (a - 1) // x
res2 = b // x
ans = res2 - res1
print(ans)


(a, b, x) = map(int, input().split())
ans = 0
n_a = a // x
n_b = b // x
if a % x == 0:
	ans += 1
ans += n_b - n_a
print(ans)


(A, B, X) = [int(x) for x in input().split()]
print(B // X - (A - 1) // X)


(x, y, d) = map(int, input().split())
ans = y // d - (x - 1) // d
print(ans)


s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
print(b // c - (a - 1) // c)


(a, b, x) = map(int, input().split())
b1 = b // x
a1 = (a - 1) // x
print(b1 - a1)


(a, b, x) = list(map(int, input().split()))
res = b // x - (a + x - 1) // x + 1
print(res)


(a, b, x) = tuple([int(x) for x in input().split(' ')])
if a % x == 0:
	print(b // x - a // x + 1)
else:
	print(b // x - a // x)


(a, b, x) = list(map(int, input().split()))
bb = b // x
aa = (a - 1) // x
print(bb - aa)


(a, b, x) = map(int, input().split())
t1 = (a - 1) // x
t2 = b // x
res = t2 - t1
print(res)


(a, b, x) = map(int, input().split())
l = a // x + 1
if a % x == 0:
	l -= 1
r = b // x
print(r - l + 1)


(a, b, x) = map(int, input().split())
aa = (a - 1) // x
ba = b // x
print(ba - aa)


(a, b, x) = map(int, input().split())
tmp1 = b // x
tmp2 = (a - 1) // x
print(tmp1 - tmp2)


(a, b, x) = map(int, input().split())
p = -(-a // x)
q = b // x
print(q - p + 1)


(a, b, x) = map(int, input().split())
ax = (a - 1) // x
bx = b // x
print(bx - ax)


import math
import sys
import os
from operator import mul
sys.setrecursionlimit(10 ** 7)

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

def I():
	return int(_S())

def LS():
	return list(_S().split())

def LI():
	return list(map(int, LS()))
if os.getenv('LOCAL'):
	inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0] + '.txt'
	sys.stdin = open(inputFile, 'r')
INF = float('inf')
(a, b, x) = LI()
ans = 0
if a > 0:
	a -= 1
else:
	ans += 1
ans += b // x - a // x
print(ans)


import re
import copy

def accept_input():
	(a, b, x) = list(map(int, input().split()))
	return (a, b, x)
(a, b, x) = accept_input()
print(b // x - (a - 1) // x)


(A, B, X) = map(int, input().split())
mn = -(-A // X)
mx = B // X
print(mx - mn + 1)


(a, b, x) = list(map(int, input().split()))
if a % x != 0:
	min_div = a + x - a % x
else:
	min_div = a
if b % x != 0:
	max_div = b - b % x
else:
	max_div = b
print(int(max((max_div - min_div + x) // x, 0)))


(a, b, x) = map(int, input().split())
cnt = 0
R = b // x
L = (a - 1) // x
print(R - L)


(a, b, x) = map(int, input().split())
u = b // x
l = (a - 1) // x + 1
print(u - l + 1)


(a, b, x) = list(map(int, input().split()))
if a == 0:
	mi = -1
elif a > 1:
	mi = (a - 1) // x
else:
	mi = 0
ma = b // x if b != 0 else 0
print(ma - mi)


(A, B, C) = list(map(int, input().split()))
print(B // C - (A - 1) // C)


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

def get(n):
	if n < 0:
		return 0
	else:
		return n // x + 1
print(get(b) - get(a - 1))


def answer(a: int, b: int, x: int) -> int:
	return b // x - (a - 1) // x

def main():
	(a, b, x) = map(int, input().split())
	print(answer(a, b, x))

def __starting_point():
	main()
__starting_point()


(a, b, x) = map(int, input().split())
n1 = (a - 1) // x
n2 = b // x
print(n2 - n1)


(a, b, c) = map(int, input().split())
if a % c == 0:
	print(b // c - a // c + 1)
else:
	print(b // c - a // c)


(a, b, x) = map(int, input().split())
ad = (a - 1) // x
bd = b // x
print(bd - ad)


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda : sys.stdin.readline().rstrip()
rs = lambda : sys.stdin.readline().split()
ri = lambda : int(sys.stdin.readline())
rm = lambda : list(map(int, sys.stdin.readline().split()))
rl = lambda : list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10 ** 9 + 7
(a, b, x) = rm()
print(b // x - (a - 1) // x)


(a, b, x) = map(int, input().split())
max = b // x
min = (a + x - 1) // x
print(max - min + 1)


(A, B, X) = map(int, input().split())
Bd = B // X
Ad = (A - 1) // X
print(Bd - Ad)


(a, b, x) = map(int, input().split())
c = 0
if a % x == 0:
	c = 1
print(b // x - a // x + c)


import sys
input = sys.stdin.read
(a, b, x) = map(int, input().split())
print(b // x - a // x if a % x != 0 else b // x - a // x + 1)


(a, b, x) = (int(T) for T in input().split())
print(b // x - a // x + (a % x == 0))


(a, b, x) = map(int, input().split())
bb = b // x
aa = a // x
ans = bb - aa
if a % x == 0:
	ans += 1
print(ans)


import sys
input = sys.stdin.readline
enum = enumerate
inf = 1001001001
import collections
import random

def linput(ty=int, cvt=list):
	return cvt(list(map(ty, input().split())))

def vinput(rep=1, ty=int, cvt=list):
	return cvt((ty(input().rstrip()) for _ in '*' * rep))

def gcd(a: int, b: int):
	while b:
		(a, b) = (b, a % b)
	return a

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

def dist(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def ran():
	vRan = [random.randint(1, 10), random.randint(0, 10), random.randint(1, 100)]
	return vRan

def bye(res):
	sT = 'No Yes'.split()
	print(sT[res])

def sol_n(a, b, c):
	res = 0
	cnt = 0
	while cnt < c:
		res += 1
		cnt += a
		if res % 7 == 0:
			cnt += b
	return res

def sol(a, b, c):
	res = 0
	L = -(-a // c)
	R = b // c
	res = R - L + 1
	return res

def deb():
	vI = ran()
	I = sol_n(*vI)
	J = sol(*vI)
	if 1:
		print((vI, I, J))

def main():
	vI = linput()
	print(sol(*vI))

def __starting_point():
	main()
__starting_point()


(a, b, x) = [int(x) for x in input().split()]
b_num = b // x
a_num = (a - 1) // x if a - 1 >= 0 else -1
print(b_num - a_num)


(a, b, x) = [int(_) for _ in input().split()]
print(b // x - (a - 1) // x)


def __starting_point():
	(a, b, x) = list(map(int, input().split()))
	c = b // x - a // x
	if a % x == 0:
		c = c + 1
	print(c)
__starting_point()


(a, b, c) = (int(_) for _ in input().split())
print(b // c - (a - 1) // c)


(a, b, x) = map(int, input().split())
num1 = -(a // -x)
num2 = b // x
print(num2 - num1 + 1)


(a, b, x) = map(int, input().split())
B = b // x
preA = (a - 1) // x
print(B - preA)


(a, b, x) = [int(i) for i in input().split()]
print(b // x - a // x + (a % x == 0))


import sys
input = sys.stdin.readline
(a, b, x) = map(int, input().split())
a_count = (a - 1) // x
b_count = b // x
print(b_count - a_count)


import math
(a, b, c) = [int(i) for i in input().split()]
print(b // c - (a - 1) // c)


(a, b, x) = [int(i) for i in input().split()]
bx = b // x
ab = (a - 1) // x
print(bx - ab)


(a, b, x) = map(int, input().split())
a1 = a // x
if a % x == 0:
	a1 -= 1
b1 = b // x
print(b1 - a1)


(a, b, x) = map(int, input().split())
nb = b // x
na_1 = (a - 1) // x
print(nb - na_1)


(a, b, x) = [int(n) for n in input().split()]
print(b // x - (a - 1) // x)


import math
(a, b, x) = map(int, input().split())
a_c = a // x if a % x == 0 else a // x + 1
b_f = b // x
print(b_f - a_c + 1)


(a, b, x) = map(int, input().split())
cb = b // x
ca = (a - 1) // x
c = cb - ca
print(c)


(a, b, x) = map(int, input().split())
bb = b // x
aa = a // x
print(bb - aa + (a % x == 0))


(a, b, x) = list(map(int, input().split()))
if a % x == 0:
	print(b // x - a // x + 1)
elif a % x is not 0:
	print(b // x - a // x)


(a, b, x) = [int(w) for w in input().split()]
print(b // x - (a + x - 1) // x + 1)


li = list(map(int, input().split()))
if li[0] - 1 < 0:
	print(li[1] // li[2] + 1)
else:
	print(li[1] // li[2] - (li[0] - 1) // li[2])


(a, b, x) = map(int, input().split())
br = b // x
ar = (a - 1) // x
print(br - ar)


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

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

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]
import string

def main():
	(a, b, x) = i_map()
	print(b // x - (a - 1) // x)

def __starting_point():
	main()
__starting_point()


(a, b, x) = map(int, input().split())
ta = (a - 1) // x
tb = b // x
ans = tb - ta
print(ans)


import sys
import re
import queue
import collections
import math
from decimal import *
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from typing import Callable
from decimal import Decimal, getcontext

def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def lcm(a, b):
	return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	(a, b, x) = i_map()
	c = math.ceil(Decimal(a) / Decimal(x))
	d = math.floor(Decimal(b) / Decimal(x))
	print(d - c + 1)

def __starting_point():
	main()
__starting_point()


(a, b, x) = map(int, input().split())
a_div = 0
b_div = b // x
if a != 0:
	a_div = (a - 1) // x
	count = b_div - a_div
else:
	count = b_div - a_div + 1
print(count)