Problem:


Score : 200 points

Problem Statement

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 1

4 8 2

Sample Output 1

3

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

Sample Input 2

0 5 1

Sample Output 2

6

There are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.

Sample Input 3

9 9 2

Sample Output 3

0

There are no integer between 9 and 9, inclusive, that is divisible by 2.

Sample Input 4

1 1000000000000000000 3

Sample Output 4

333333333333333333

Watch out for integer overflows.



Sample input:
4 8 2


Sample output:
3

Submission status: Time Limit Exceeded

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

c=0
d=a

for i in range(a,b+1):
    if d%x==0:
        c=c+1
    d=d+1
    
print(c)

Submission status: Time Limit Exceeded

Solution code:
x = input().split(" ")
a = int(x[0])
b = int(x[1])
c = int(x[2])
count = 0
for i in range(a,b+1):
    if (0 == i % c):
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, x = map(int, input().split())
count = 0
for n in range(a, b+1):
    if n % x == 0:
        count += 1
        n += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, c = map(int, input() .split())
e = []
for i in range(a, b+1):
    d = i % c
    if d == 0:
        e.append(i)
print(len(e))

Submission status: Time Limit Exceeded

Solution code:

a,b,x = map(int,input().split())
count = 0
for i in range(a,b+1):
    if i % x == 0:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
a,b,x=map(int,input().split())
print(sum(y%x==0 for y in range(a,b+1)))

Submission status: Time Limit Exceeded

Solution code:
a, b, x = [int(n) for n in input().split()]

res = 0
for n in range(a, b + 1):
    if n % x == 0:
        res += 1
print(res)

Submission status: Time Limit Exceeded

Solution code:
a, b, x = map(int,input().split())
N = 0
for i in range(a, b+1):
    if i % x == 0:
        N = N + 1
print(N)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf-8 -*-

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

count = 0

for i in range(a, b+1):
    if i % x == 0:
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, c = map(int, input().split())

count = 0
for i in range(a, b+1):
    if i % c == 0:
        count = count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, x = input().split()
a = int(a)
b = int(b)
x = int(x)
count = 0
for i in range(a,b+1):
      if i%x == 0:
            count = count + 1
      else:
            count = count
print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, x = list(map(int, input().split()))
print(sum([c%x==0 for c in range(a,b+1)]))

Submission status: Time Limit Exceeded

Solution code:
import sys
A,B,D = map(int, raw_input().split())

while A%D!=0:
 A=A+1
num=0
while A<=B:
 num=num+1
 A=A+D
print num

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(a, b + 1):
    if i % x == 0:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

i = input().split()
a = int(i[0])
b = int(i[1])
x = int(i[2])

c = a
while True:
    if c%x==0:
        ans = len(range(c, b+1, x))
        break
    elif c==b:
        ans=0
        break
    else:
        c+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,x = list(map(int,input().split()))
i = a
count = 0
while i <= b:
	if i % x == 0 :
		count += 1
		i += 1
	else :
		i += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
t=raw_input().split(" ")
a=int(t[0])
b=int(t[1])
b=b*1L
x=int(t[2])
c=0*1L
i=a
while 1:
    if i%x==0:
        c=c+1
    i=i+1
    if i>b:
        break
print c

Submission status: Time Limit Exceeded

Solution code:
s, e, d = map(int, input().strip().split())
cnt = sum(1 for i in range(s, e+1) if i%d==0)
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math

i = input().split()
a = int(i[0])
b = int(i[1])
x = int(i[2])

c = b-a+1
ans=0
for j in range(a, b+1):
    if j%x==0:
        ans = len(range(j, b+1, x))
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a, b, x = tuple(int(x) for x in input().split())

y = -1
for i in range(a, b + 1):
    if i % x == 0:
        y = i
        break

if y == -1:
    ans = 0
else:
    ans = (b - y) // x + 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
count=0
a,b,c=[int(i) for i in input().split()]
for i in range(a,b+1):
    if(i%c==0): count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
i = [int(x) for x in input().split()]
c =0
for x in range(i[0],i[1]+1):
    if x%i[2] == 0:
        c+=1
print(c)

Submission status: Time Limit Exceeded

Solution code:
a, b, x = name = list(map(int, input().split()))
oks = [i for i in range(a, b + 1)
       if i % x == 0]

print(len(oks))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

print((b//x)-((a-1)//x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main() -> None:
    a, b, x = map(int, input().split())

    print (b // x - (a - 1) // x)


# region fastio

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, **kwargs):
        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")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def input_int():
    return(int(input()))

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

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


def run():
    a, b, x = input_int_map()
    result = count_num(b, x) - count_num(a - 1, x)
    print(result)

def count_num(num, x):

    if num < 0:
        return 0

    return num // x + 1

run()

# 2 4 3

# 3 4 3

# 2 6 3

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if a == 0:
  print(b // x + 1)
  exit()

print(b // x - (a-1) // x)

Submission status: Accepted

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

l = a//x + 1
if a % x == 0:
  l -= 1

r = b//x

print((r - l) + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
a,b,x = map(int,input().split())

if b >= 0:
  bb = b//x+1
else:
  bb = 0
  
if a >= 0:
  a = a - 1
  aa = a//x+1
else:
  aa = 0
print(bb-aa)

Submission status: Accepted

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

ans = b//x -(a-1) //x
print(ans)

Submission status: Accepted

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

ans = b//x -(a-1) //x
print(ans)

Submission status: Accepted

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

print(b//x-(a-1)//x)

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
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 decimal import Decimal, getcontext
# input = sys.stdin.readline 
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 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b, x = i_map()

    print(b//x - a//x + (1 if a%x == 0 else 0))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if a % x == 0:
  print((b//x)-(a//x)+1)
else:
  print((b//x)-(a//x))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a, b, x = map(int, input().split())
    l = b // x
    r = (a-1) // x
    print(l - r)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

ans = (b // x) - ((a-1) // x) 
if ans < 0:
    ans = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import collections
from sys import exit
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = b // x - (a - 1) // x

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, x = 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))

#bを割ったときの個数からaを割ったときの個数を引く

Submission status: Accepted

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

def divided_num(n):
    return n//x + 1

print(divided_num(b)-divided_num(a)+(1 if a%x==0 else 0))

Submission status: Accepted

Solution code:
def LI():
    return list(map(int, input().split()))


a, b, x = LI()
ans = b//x-(a-1)//x
print(ans)

Submission status: Accepted

Solution code:
import sys
# sys.setrecursionlimit(100000)


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


def input_int():
    return int(input())


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


def main():
    a, b, x = input_int_list()
    ans = (b // x) - (a // x)
    if a % x == 0:
        ans += 1
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import bisect
a, b, x = map(int, input().split())
rem = 1 if a%x == 0 else 0
print(b//x - a//x +rem)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
import copy

def accept_input():
    a,b,x = map(int,input().split())
    return a,b,x

a,b,x = accept_input()
print(b // x - (a - 1) // x)
"""
if a%x == 0 and a != b:
    print(b//x - a//x +1)
elif a%x == 0 and a == b:
    print(0)
else:
    print(b//x - a//x)
"""

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if  a % x == 0:
        print(b // x - a // x + 1)
else:
        print(b // x - a // x)

Submission status: Accepted

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

res1=(a-1)//x
res2=b//x
ans=res2-res1
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(a: int, b: int, x: int):
    p = a // x
    q = b // x
    ans = q - p
    if a % x == 0:
        ans += 1
    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    solve(a, b, x)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
enum = enumerate
inf = 1001001001

import collections
import random

def linput(ty=int, cvt=list):
	return cvt(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)

#vD = [chr(ord("a")+i) for i in range(26)]

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])
	#exit(0)

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):
	#a,b,c = linput()
	### 3 6 9 12 15
	### 1 2 3 4  5
	
	res = 0
	L = -(-a//c)
	R = (b//c)
	res = R-L+1
	
	return res

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

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

if __name__ == "__main__":
	#for _ in "*"*1000:
	#	deb()
	main()

Submission status: Accepted

Solution code:
a, b, x = 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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math;
from decimal import *;

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

print(max(0, (b//x) - math.ceil(a/x) + 1))

Submission status: Accepted

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

print(b // x - (a - 1) // x)

Submission status: Accepted

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

if a % x == 0:
    print(b // x - a // x + 1)
else:
	print(b // x - a // x)

Submission status: Accepted

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

bd = b // x
ad = (a-1) // x
print(bd - ad)

Submission status: Accepted

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

if a == 0:
    ans = b // x + 1
else:
    ans = b // x - (a-1) // x
print(ans)

Submission status: Accepted

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

c = b - a + a % x
if a % x != 0:
    print(c // x)
else:
    print(c // x + 1)

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

a,b,x=mint()
print(b//x-(a-1)//x)

Submission status: Accepted

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

Submission status: Accepted

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

ans = (b-a)//x

if (x-a % x) % x+(b % x) < x:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
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 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)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
import math
from decimal import Decimal
(a,b,x)=map(Decimal, input().split(" "))
print(math.floor(b/x)-math.floor((a-1)/x))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a,b,x=map(int, input().split())
from decimal import Decimal, DecimalException, getcontext
getcontext().prec = 100
from math import floor
tmp1 = floor(Decimal(b)/Decimal(x))
tmp2 = floor(Decimal(a-1)/Decimal(x))
print(tmp1 - tmp2)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    def f(n):
        return n // x + 1

    a, b, x = map(int, input().split())
    print(f(b) - f(a - 1))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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: 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)

Submission status: Accepted

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

Submission status: Accepted

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

bb = b // x
aa = (a - 1) // x

print(bb - aa)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    # n = int(input())
    a, b, x = map(int, input().split())
    c = b//x - a//x
    if a%x == 0:
        c = c+1
    print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = b // x - (a - 1) // x

print(ans)

Submission status: Accepted

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

print(b // x - (a - 1) // x)

Submission status: Accepted

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

ans = b//x - (a-1)//x

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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




if __name__ == "__main__":
    main()

Submission status: Accepted

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

cnt = 0
if a % x == 0:
  cnt += 1

#if b % x == 0:
#  cnt += 1
  
cnt += (b//x - a//x)

print(cnt)

Submission status: Accepted

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

ans = b // x - (a - 1) // x
print(ans)

Submission status: Accepted

Solution code:
# ABC048
a, b, x = map(int, input().split())

print(b//x - a//x + (a % x == 0))

Submission status: Accepted

Solution code:
def generator(x, a): # 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)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x = map(int,input().split())
if a%x == 0:
    min = a//x - 1
else:
    min = a//x
max = b//x
print(max-min)

Submission status: Accepted

Solution code:
# cook your dish here

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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split(' '))
answer = b//x - (a-1)//x
print(answer)

Submission status: Accepted

Solution code:
a,b,x = 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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x=map(int,input().split())
def cntr(n,x):
    if n>=0:
        return n//x+1
    else:
        return 0
print(cntr(b,x)-cntr(a-1,x) if a!=0 else cntr(b,x)-cntr(-1,x))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

A=a//x

B=b//x
 
print(B-A+1 if a%x==0  else B-A)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
b_ans = b // x
a_ans = (a - 1) // x
print(b_ans - a_ans)

Submission status: Accepted

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

Submission status: Accepted

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