Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.


-----Input-----

The only line contains three space-separated integers k, a and b (1 ≤ k ≤ 10^18; - 10^18 ≤ a ≤ b ≤ 10^18).


-----Output-----

Print the required number.


-----Examples-----
Input
1 1 10

Output
10

Input
2 -4 4

Output
5

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics


Solutions:
def solver(n, k):
	return n // k
(k, a, b) = map(int, input().strip().split())
if k == 1:
	print(b - a + 1)
elif a == 0:
	print(solver(b, k) + 1)
elif a > 0:
	print(solver(b, k) - solver(a - 1, k))
else:
	print(solver(b, k) + solver(-a, k) + 1)


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


ints = lambda : map(int, input().split())
rd = lambda : input()
import math
(k, a, b) = ints()
l = a // k if a % k == 0 else a // k + 1
r = b // k
print(int(r - l + 1))


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


(k, a, b) = map(int, input().split())
add = int(2 * 10 ** 18) // k * k
a += add
b += add
print(b // k - (a - 1) // k)


from functools import reduce
from operator import *
from math import *
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)
(k, a, b) = map(int, input().split())
print(b // k - (a - 1) // k)


(k, a, b) = map(int, input().split())
if a > 0:
	print(b // k - (a - 1) // k)
elif a == 0:
	print(b // k + 1)
elif b < 0:
	a = -a
	b = -b
	print(a // k - (b - 1) // k)
elif b == 0:
	print(-a // k + 1)
else:
	print(b // k + -a // k + 1)


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


def delimost(k, a, b):
	return b // k - (a - 1) // k
(K, A, B) = [int(j) for j in input().split()]
print(delimost(K, A, B))


import sys
(k, a, b) = [int(x) for x in sys.stdin.readline().split(' ')]

def f(n):
	return n // k
res = 0
if a == 0 and b == 0:
	res = 1
elif a < 0 and b == 0:
	res = f(-a) + 1
elif a < 0 and b < 0:
	res = f(-a) - f(-b - 1)
elif a < 0 and b > 0:
	res = f(-a) + 1 + f(b)
elif a == 0 and b > 0:
	res = f(b) + 1
elif a > 0 and b > 0:
	res = f(b) - f(a - 1)
print(res)


(k, l, r) = [int(x) for x in input().split()]
if l <= 0 and r <= 0:
	(l, r) = (-r, -l)
if l == 0:
	print(r // k + 1)
elif l < 0:
	print(r // k + 1 + -l // k)
else:
	print(r // k - (l - 1) // k)


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


(k, a, b) = map(int, input().split())
a = ((a - 1) // k + 1) * k
b -= b % k
print(max(0, (b - a + 1) // k + (k != 1)))


(k, a, b) = map(int, input().split())
fa = a // k * k
if fa < a:
	fa += k
fb = b // k * k
if fb > b:
	fb -= k
r = (fb - fa) // k + 1
print(r)


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


(k, a, b) = map(int, input().split())
floor_a = a // k
floor_b = b // k
ans = floor_b - floor_a
if a % k == 0:
	ans += 1
print(ans)


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


(n, l, h) = input().split()
n = int(n)
l = int(l)
h = int(h)
if l > 0 and h > 0:
	print(h // n - (l - 1) // n)
else:
	print(h // n + abs(l) // n + 1)


(k, a, b) = map(int, input().split())
start = a if a % k == 0 else a + abs(a) % k if a < 0 else k * (a // k + 1)
end = b if b % k == 0 else b - b % k if b > 0 else k * (b // k)
print(0 if start > end else (end - start) // k + 1)


def main():
	(k, a, b) = map(int, input().split())
	print(b // k - a // k + (not a % k))
main()


(k, a, b) = map(int, input().split())
below_a = a // k
below_b = b // k
ans = below_b - below_a
if a % k == 0:
	ans += 1
print(ans)


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


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


(k, a, b) = input().split()
(k, a, b) = (int(k), int(a), int(b))
if a > 0:
	k1 = 0
	if a % k == 0:
		k1 += 1
	print(b // k - a // k + k1)
elif a == 0:
	print(b // k + 1)
elif a < 0 and b >= 0:
	print(abs(a) // k + b // k + 1)
else:
	(a, b) = (abs(b), abs(a))
	k1 = 0
	if a % k == 0:
		k1 += 1
	print(b // k - a // k + k1)


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


s = input()
l = []
for a in range(0, len(s) - 1):
	if s[a:a + 1] == ' ':
		l.append(a)
a = int(s[0:l[0]])
b = int(s[l[0] + 1:l[1]])
c = int(s[l[1] + 1:len(s)])
d = c // a * a
if b % a == 0:
	e = b // 1
else:
	e = (b // a + 1) * a
print((d - e) // a + 1)


(k, a, b) = map(int, input().strip().split())
m = 0
if k == 1:
	m = b - a + 1
else:
	if a % k != 0:
		a += k - a % k
	if b % k != 0:
		b -= b % k
	m = (b - a) // k
	if a % k < b % k or a % k == 0:
		m += 1
print(m)


def f(a, b, k):
	if a == 0:
		res = b // k + 1
	else:
		res = b // k - (a - 1) // k
	return res
(k, a, b) = [int(i) for i in input().split()]
if b <= 0:
	res = f(-b, -a, k)
elif a < 0:
	res = f(1, -a, k) + f(0, b, k)
else:
	res = f(a, b, k)
print(res)


(k, a, b) = map(int, input().split())
kk = k * 2000000000000000000
a += kk
b += kk
a -= 1
print(b // k - a // k)


def solver(start, end, k):
	return end // k - (start - 1) // k
(k, a, b) = map(int, input().strip().split(' '))
ans = 0
if a == 0 and b == 0:
	ans = 1
elif a == 0 and b != 0:
	ans = solver(1, b, k) + 1
elif a != 0 and b == 0:
	ans = solver(1, -a, k) + 1
elif a < 0 and b < 0:
	ans = solver(-b, -a, k)
elif a < 0 and b > 0:
	ans = solver(1, -a, k) + solver(1, b, k) + 1
else:
	ans = solver(a, b, k)
print(ans)


(k, a, b) = [int(x) for x in input().split()]
ans = 0
if a <= 0 and b <= 0:
	a = -a
	b = -b
	(a, b) = (b, a)
if a <= 0 and b >= 0:
	a = -a
	ans = b // k + a // k + 1
else:
	ans = b // k - (a - 1) // k
print(ans)


(k, a, b) = map(int, input().split())
m = b // k
if a > 0:
	x = a // k
	m -= x
	if a % k == 0:
		m += 1
else:
	m += abs(a) // k
	m += 1
print(m)


(k, a, b) = map(int, input().split())
a += k * 10 ** 18
b += k * 10 ** 18
print(b // k - (a - 1) // k)


3
(k, a, b) = list(map(int, input().split()))
print(b // k - (a - 1) // k)


inp = input().split()
k = int(inp[0])
a = int(inp[1])
b = int(inp[2])
ans = 0
if a > b:
	c = a
	a = b
	b = c
if a > 0 and b > 0:
	ans = b // k - (a - 1) // k
elif a < 0 and b < 0:
	ans = 0 - ((a - 1) // k - b // k)
elif a < 0:
	ans = (0 - a) // k + b // k + 1
else:
	ans = b // k + 1
print(ans)


(k, a, b) = map(int, input().split())
(qa, ra) = divmod(a, k)
(qb, rb) = divmod(b, k)
ka = a + (0 if ra == 0 else k - ra)
kb = b - rb
if ka <= kb:
	print((kb - ka) // k + 1)
else:
	print(0)


(k, a, b) = list(map(int, input().split()))
if a % k != 0:
	n1 = a + k - a % k
else:
	n1 = a
n2 = b - b % k
n = (n2 - n1) // k + 1
print(n)


(k, a, b) = map(int, input().split())
i = a // k
j = b // k
z = j - i
if a % k == 0:
	z += 1
print(z)


s = input()
m = s.split(' ')
k = int(m[0])
a = int(m[1])
b = int(m[2])
ost = a % k
if ost == 0:
	f2 = a
else:
	f2 = a + (k - ost)
ans = (b - f2) // k + 1
print(ans)


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


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


from bisect import insort, bisect_right, bisect_left
from sys import stdout, stdin, setrecursionlimit
from heapq import heappush, heappop, heapify
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from string import *
from queue import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

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

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

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

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def getPrimes(N=10 ** 5):
	SN = int(sqrt(N))
	sieve = [i for i in range(N + 1)]
	sieve[1] = 0
	for i in sieve:
		if i > SN:
			break
		if i == 0:
			continue
		for j in range(2 * i, N + 1, i):
			sieve[j] = 0
	prime = [i for i in range(N + 1) if sieve[i] != 0]
	return prime

def primeFactor(n, prime=getPrimes()):
	lst = []
	mx = int(sqrt(n)) + 1
	for i in prime:
		if i > mx:
			break
		while n % i == 0:
			lst.append(i)
			n //= i
	if n > 1:
		lst.append(n)
	return lst
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
(k, a, b) = zzz()
print(b // k - (a - 1) // k)


print((lambda x: x[2] // x[0] - (x[1] - 1) // x[0])(list(map(int, input().split()))))


(k, a, b) = map(int, input().split())
ans = 0
if a < 0 and b <= 0:
	(a, b) = (abs(b), abs(a))
if a > 0 and a % k:
	a = a + k - a % k
	if a <= b:
		ans += (b - a) // k + 1
elif a >= 0:
	ans += (b - a) // k + 1
elif a < 0 and abs(a) % k:
	a = abs(a) - abs(a) % k
	ans += a // k + 1
	ans += b // k
elif a < 0:
	ans += abs(a) // k + 1
	ans += b // k
print(ans)


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


from math import floor

def seal(a, b):
	return (a + b - 1) // b
(k, a, b) = map(int, input().split())
ans = abs(b) // k + abs(a) // k
if a < 0 and b >= 0:
	values = b - a + 1
	print(ans + 1)
else:
	(a, b) = (abs(a), abs(b))
	(a, b) = (min(a, b), max(a, b))
	lower = seal(a, k)
	upper = int(b // k)
	print(upper - lower + 1)


import sys
input = sys.stdin.readline

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

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

def main():
	(k, a, b) = map(int, input().split())
	if a and b:
		f = a / abs(a) == b / abs(b)
		a = abs(a)
		b = abs(b)
		if a > b:
			(a, b) = (b, a)
		if f:
			print(b // k - (a - 1) // k)
		else:
			print(b // k + a // k + 1)
	else:
		a = abs(a)
		b = abs(b)
		if a == 0 and b == 0:
			print(1)
		else:
			print(a // k + b // k + 1)
	return
main()


(k, a, b) = map(int, input().split())
if a % k == 0:
	f = a
elif a < 0:
	f = a + -a % k
else:
	f = a - a % k + k
d = k
nth = b - b % k
print((nth - f) // d + 1)


(k, a, b) = map(int, input().split())
ans = (b - a) // k
if a % k == 0 or b % k == 0 or (b - a) % k + a % k >= k:
	ans += 1
print(ans)


from decimal import *
(k, a, b) = map(Decimal, input().strip().split(' '))
if b <= 0:
	(a, b) = (-b, -a)
small = (a / k).quantize(Decimal('1.'), rounding=ROUND_DOWN)
large = (b / k).quantize(Decimal('1.'), rounding=ROUND_DOWN)
if a % k == 0 or (a <= 0 and b >= 0):
	offset = Decimal(1)
else:
	offset = Decimal(0)
print(large - small + offset)


(k, a, b) = map(int, input().split())
a_mod = k - a % k
if a % k:
	a += a_mod
b -= b % k
print((b - a) // k + 1)


import sys
(k, a, b) = map(int, sys.stdin.readline().rsplit())
m = a % k
c = 0
if m == 0 or k <= m + abs(b - a) % k:
	c += 1
c += abs(b - a) // k
print(c)


import math
import random
import sys
import functools

def solve(k, a, b):
	return b // k - (a - 1) // k

def p(*args, **kwargs):
	return print(*args, file=sys.stderr, **kwargs)

def main():
	[k, a, b] = [int(i) for i in input().strip().split()]
	result = solve(k, a, b)
	print(result)
main()


inD = str(input()).split()
inD = [int(val) for val in inD]
k = inD[0]
a = inD[1]
b = inD[2]
N = 0
a = a - k if a % k == 0 else a - a % k
b = b - b % k
N = (b - a) // k
print(N)


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

def Do(a, b):
	suma = 0
	if a < 0:
		if b == 0:
			print(-a // k + 1)
		if b > 0:
			suma = 1
			a = -a
			if a % k == 0:
				if b % k == 0:
					suma += b // k + a // k
					print(suma)
				else:
					suma += b // k + a // k
					print(suma)
			elif b % k == 0:
				suma += b // k + a // k
				print(suma)
			else:
				suma += b // k + a // k
				print(suma)
		if b < 0:
			el = a
			a = -b
			b = -el
			if a % k == 0:
				if b % k == 0:
					suma = 1
					suma += b // k - a // k
					print(suma)
				else:
					suma = 1
					suma += b // k - a // k
					print(suma)
			elif b % k == 0:
				suma += b // k - a // k
				print(suma)
			else:
				suma += b // k - a // k
				print(suma)
	elif a % k == 0:
		if b % k == 0:
			suma = 1
			suma += b // k - a // k
			print(suma)
		else:
			suma = 1
			suma += b // k - a // k
			print(suma)
	elif b % k == 0:
		suma += b // k - a // k
		print(suma)
	else:
		suma += b // k - a // k
		print(suma)
if a == b:
	if a % k == 0:
		print(1)
	else:
		print(0)
else:
	Do(a, b)


(k, a, b) = map(int, input().split())
ans = 0
if b < 0:
	a *= -1
	b *= -1
	(b, a) = (a, b)
if a > 0 and b >= 0:
	ans += b // k - (a - 1) // k
else:
	ans += b // k
	ans += 1
	ans += -a // k
print(ans)


(k, a, b) = map(int, input().split())
if a <= 0 and b >= 0:
	res = abs(a) // k + b // k + 1
	print(res)
else:
	(a, b) = (abs(a), abs(b))
	(a, b) = (max(a, b), min(a, b) - 1)
	res = a // k - b // k
	print(res)


(k, a, b) = input().split(' ')
k = int(k)
a = int(a)
b = int(b)
if a % k != 0:
	a = a + k - a % k
print(max(0, 1 + (b - a) // k))


(n, a, b) = list(map(int, input().split()))
if a >= 0 and b >= 0:
	print(b // n - (a - 1) // n)
elif a < 0 and b < 0:
	print(-a // n - (-b - 1) // n)
else:
	print(b // n + -a // n + 1)


import math
x = [int(i) for i in input().split()]
f = x[2] // x[0]
l = x[1] // x[0] + 1 if x[1] % x[0] != 0 else x[1] // x[0]
print(f - l + 1)


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


s = input()
ast = [int(i) for i in s.split(' ')]
(k, a, b) = (ast[0], ast[1], ast[2])
s1 = (a - 1) // k
s2 = b // k
print(s2 - s1)


(k, a, b) = input().split()
k = int(k)
a = int(a)
b = int(b)
if a > 0:
	if a % k == 0:
		a -= 1
	o = int(b // k - a // k)
else:
	o = int(abs(a) // k + b // k) + 1
print(o)


L = [int(s) for s in input().split()]
(k, a, b) = (L[0], L[1], L[2])
if (b - a) % k == 0:
	if a % k == 0:
		print((b - a + k) // k)
	else:
		print((b - a) // k)
elif a % k == 0:
	print(b // k - a // k + 1)
elif b % k == 0:
	print(b // k - a // k)
else:
	print(b // k - a // k)


import math
inp = [int(i) for i in input().split()]
factor = inp[2] // inp[0]
limit = inp[1] // inp[0] + 1 if inp[1] % inp[0] != 0 else inp[1] // inp[0]
print(factor - limit + 1)


(k, a, b) = map(int, input().split())
if b < 0:
	a = -a
	b = -b
	(a, b) = (b, a)
	print(b // k - (a - 1) // k)
	exit(0)
if b > 0:
	add = 0
	if a == 0:
		add = 1
		a = 1
	if a > 0:
		print(b // k - (a - 1) // k + add)
		exit(0)
	add = 1
	a = -a
	print(b // k + a // k + add)
	exit(0)
print(-a // k + 1)


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


cin = lambda : map(int, input().split())

def solve():
	(k, a, b) = cin()
	print(b // k - (a - 1) // k)
solve()


(k, a, b) = map(int, input().split())
if a >= 0 and b >= 0 or (a < 0 and b < 0):
	if a < 0 and b < 0:
		temp = -b
		b = -a
		a = temp
	c = b // k - a // k
	if a % k == 0:
		c += 1
elif a < 0 and b >= 0:
	a = -a
	c = a // k + b // k + 1
print(c)


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


(k, l, r) = map(int, input().split())
p = l // k
if l % k > 0:
	p += 1
l = p * k
o = (r - l) // k + 1
if l > r:
	o = 0
print(o)


import os, sys
from io import BytesIO, IOBase

def main():
	(k, a, b) = map(int, input().split())
	print(b // k - (a - 1) // k)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math

def main():
	(k, a, b) = map(int, input().split())
	low = (a + k - 1) // k
	big = b // k
	ans = big - low + 1
	print(int(ans))
main()


from math import ceil, floor
(k, a, b) = tuple(map(int, input().split()))
x = (b - a) // k
if b % k < a % k or a % k == 0:
	x += 1
print(x)