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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


a, b, div = [int(i) for i in input().split()]

if a % div == 0:
    d = a // div - 1
else:
    d = a // div

print((b // div) - d)

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 + 1) - ((a-1) // x + 1))

Submission status: Accepted

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

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

Submission status: Accepted

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

c = (a-1)//x
d = b//x

print(d - c)

Submission status: Accepted

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

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

Submission status: Accepted

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

left = (a-1)//x
right = b//x

print(right - left)

Submission status: Accepted

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

left = (a-1)//x if a != 0 else -1
right = b//x

print(right - left)

Submission status: Accepted

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

Submission status: Accepted

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

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())
A = (a - 1) // x
B = b // x
print(B - A)

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
ans = b // x + 1 - (a-1) // x - 1
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%x!=0:
    a=a+(x-a%x)
if b%x!=0:
    b=b-b%x
if a<=b:
    print((b-a)//x+1)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Submission status: Accepted

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

if a < 0:
    print(b//x+1)
else:
    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())
print(b//x - ((a-1)//x))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        a, b, x = map(int, input().split())
        fa = (a - 1) // x + 1 if a - 1 >= 0 else 0
        fb = b // x + 1 if b >= 0 else 0
        print(fb - fa)


# Run main
if __name__ == '__main__':
    AtCoder().main()

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 %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())

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

Submission status: Accepted

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


def f(x, y):
    return x // y + 1


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

Submission status: Accepted

Solution code:
def f(n, d):
    if n == -1:
        return 0
    return n // d +1




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


print(f(b,x)-f(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())
answer = (b // x + 1) - ((a - 1) // x + 1)
print(answer)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, M, Q = map(int, input().split())
# L = [int(v) for v in input().split()]
# L = [int(input()) for _ in range(Q)]
# S = input().strip()

if N == M:
    if N % Q == 0:
        print(1)
    else:
        print(0)
    exit()

p = (M // Q) + 1
s = (N // Q)

print(p - s - (0 if N % Q == 0 else 1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(bx-ax)

Submission status: Accepted

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

def f(n):
    if n == -1:
        return 0
    else:
        return n//x + 1

print(f(b) - f(a-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from decimal import *

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

import math
print(math.floor(b/x)-math.ceil(a/x)+1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x= map(int,input().split())
result=0
num = a
# for _ in range(a,b+1,x):
#     if num % x == 0 :
#         result+=1
#     num+=x

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
ans = b // x - a // x
print(ans if a % x != 0 else ans + 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())
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(a)
# print(b)
# print(x)

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

def f(n):
    if n == -1:
        return 0
    else:
        return (n // x) + 1

# print(int((a -1) / x) + 1)
# print(int(b / x))

# print(f(b))
# print(f(a - 1))
print(f(b) - f(a - 1))

Submission status: Accepted

Solution code:
import math

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

top = b//c
bottom = (a-1)//c
print(top - bottom)

Submission status: Accepted

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

if a == 0:
    min_ = 0
else:
    min_ = (a - 1) // x + 1
max_ = b // x + 1
#print(min_, max_)
print(max_ - min_)

Submission status: Accepted

Solution code:
a,b,x = map(int,input().split())
if a == 0:
    print(b//x + 1)
elif 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)//x - (a-1+x)//x )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
a,b,x = map(int, input().split())

a1 = (a-1) // x 
b1 = b // x


c = b1 - a1 

print(c)

Submission status: Accepted

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

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

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

def quotient(n, x):
  if n == -1:
    return 0
  elif n == 0:
    return 1
  else:
    return n // x + 1

a = quotient(a - 1, x)
b = quotient(b, x)

ans = b - a
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

mod = 10 ** 9 + 7

a, b, x = na()
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())
def f(n,x):
    if n == -1:
        return 0
    else:
        return n//x + 1

print(f(b,x)-f(a-1,x))

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
print((b // x + 1) if a == 0 else (b // x + 1) - ((a-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())
print(int(b//x - (a-1)//x))

Submission status: Accepted

Solution code:
# ABC 048 B Between a and b ...

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

kb = b // x + 1
ka = (a-1) // x + 1
ans = kb - ka
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a, b, x = map(int, input().split())

count_b = b // x + 1
if a == 0:
    count_a = 0
else:
    count_a = (a - 1) // x + 1

print(count_b - count_a)

Submission status: Accepted

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

if __name__ == '__main__':
    print(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:
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(b//x-a//x+1 if a%x == 0 else b//x-a//x)

Submission status: Accepted

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

low = (a - 1) // x
high = b // x

ans = high - low 
print(ans)

Submission status: Accepted

Solution code:
# ABC 48 B

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

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

    print(bb - aa)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

dn_min=(a//x+1 if a%x!=0 else a//x)
dn_max=b//x

print(dn_max-dn_min+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//x
#if b%x == 0:ans +=1
if a%x == 0:ans +=1
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())
a_count = (a-1) // x
b_count = b // x
print(b_count - a_count)

Submission status: Accepted

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

if a%x==0:
    k=a//x
else:
    k=a//x+1

l=b//x

print(l-k+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
s=str(input())
s=s.split(' ')
a=eval(s[0])
b=eval(s[1])
x=eval(s[2])
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())
a_x = (a-1) // x
b_x = b // x
print(b_x - a_x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
a,b,x = [int(i) for i in input().split()]
ans = b//x-a//x
if a%x == 0:
    ans +=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

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, n = map(int, input().split())
print((b // n) - ((a - 1) // n))

Submission status: Accepted

Solution code:
import sys
import bisect
input = sys.stdin.readline
 
def main():
    a,b,x = map(int,input().split())
    ans=(b//x)-(a//x)
    if(a%x==0):
        ans+=1
    print(ans)
    
main()

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(i) for i in input().split()]

total = 0
if x > b:
    if a == 0:
        total += 1
else:
    q = a // x
    r = a % x
    if r == 0:
        total += 1
    next_ = x * (q + 1)

    if next_ <= b:
        total += 1
        total += ((b - next_) // x)

print(total)

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 = 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())
a = (a - 1) // x
b //= x
print(b-a)

Submission status: Accepted

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

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())
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:
import sys
import copy

fline = input().rstrip().split(' ')
a, b, x = int(fline[0]), int(fline[1]), int(fline[2])

y = (a-1)//x
z = b//x
print(z-y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC48, B - between a and b
def f(n, x):
    if n == -1:
        return(0)
    else:
        return(n // x + 1)

a, b, x = [int(el) for el in input().split(' ')]
print(f(b, x) - f(a-1, x))

Submission status: Accepted

Solution code:
import math
import decimal
a, b, x = map(int, input().split())
A = decimal.Decimal(a)
B = decimal.Decimal(b)
X = decimal.Decimal(x)

n = math.ceil(A/X)
m = math.floor(B/X)
print(m-n+1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def f(n, y):
    if n>=0: 
        return n//x + 1
    elif n==-1:
        return 0

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

count=f(b, x)-f(a-1,x)
        
print(count)

Submission status: Accepted

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

ans = b//x - a//x
if a % x == 0:
    ans += 1
print(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, c = map(int, input().split())

ans = b // c
ans -= (a - 1) // c
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())
out = (b // x) - ((a + (x - 1)) // x) + 1
print(out)

Submission status: Accepted

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

a -= 1
qa, ra = divmod(a, x)
qb, rb = divmod(b, x)
print(qb-qa)

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:

li=list(map(int,input().split()))	
min=li[0]//li[2]
max=li[1]//li[2]
count=max-min
if li[0]%li[2]==0:
  count+=1
print(count)

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 math
from decimal import Decimal
a, b, x = map(int, input().split())
a, b, x = Decimal(a), Decimal(b), Decimal(x)

min_bai = math.ceil(a/x)  # xの倍数で最小
max_bai = math.floor(b/x)  # xの倍数で最大
x_bai = max_bai - min_bai + 1

# print(min_bai)  # debug
# print(max_bai)  # debug
print(x_bai)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Between a and b ...

a, b, x = map(int, input().split())
c = a // x
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())
print(b//x+(-a//x)+1)

Submission status: Accepted

Solution code:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from decimal import Decimal

a,b,x = II()

p = x*(math.ceil(Decimal(a)/Decimal(x)))
q = x*(math.floor(Decimal(b)/Decimal(x)))

if p>b or q<a or p>q:
  print(0)
else:
  print((q-p)//x+1)

Submission status: Accepted

Solution code:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from decimal import Decimal

a,b,x = II()

p = x*(math.ceil(Decimal(a)/Decimal(x)))
q = x*(math.floor(Decimal(b)/Decimal(x)))

if p>b or q<a or p>q:
  print(0)
else:
  print((q-p)//x+1)

Submission status: Accepted

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


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
abx = list(map(int, input().split(' ')))
a, b, x = abx[0], abx[1], abx[2]
to_a = 0
to_b = 0

if b >= 0:
    to_b = (b // x) + 1
else:
    to_b = 0

if a - 1 >= 0:
    to_a = ((a - 1) // x) + 1
else:
    to_a = 0

res = to_b - to_a
print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(a: int, b: int, x: int):
    print(b // x - (a-1) // x)
    return


# Generated by 1.1.4 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:
x,y,z = map(int,input().split())
if x == 0:
  print(y//z+1)
else :
  print(y//z-(x-1)//z)

Submission status: Accepted

Solution code:
def solve():
    a, b, x = read()
    result = think(a, b, x)
    write(result)


def read():
    return read_int(3)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a, b, x):
    result = b // x - a // x
    if a % x == 0:
        result += 1
    return result


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial



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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(a: int, b: int, x: int):
    A = (a - 1) // x
    B = b // x
    ret = B - A
    print(ret)
    return


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:
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)

#h,w
def main():
	a,b,x = map(int,input().split())
	min_x = a//x + (1 if a%x!=0  else 0)
	max_x = b//x 
	print(max_x-min_x+1)



def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

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//x
if a%x == 0:
  ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x = map(int,input().split())
import math
def func(n):
    if n >=0:
        return n//x+1
    if n ==-1:
        return 0
print(func(b)-func(a-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:
#ABC048b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

Submission status: Accepted

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

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, c = map(int, input().split())
print(b // c - (a-1) // c)

Submission status: Accepted

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

import sys

sys.setrecursionlimit(10**7)

# Override `input` function because `stdin.readline()` is 10x faster than built-in `input()`
input = sys.stdin.readline


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h(typ) if m > 1 else typ(input()) for _ in range(n)]


def main():
    a, b, x = read_h()
    ans = b // x - a // x + int(a % x == 0)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
  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:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = LS()
    print(s[0][0]+s[1][0]+s[2][0])
    return

#B
def B():
    a, b, x = LI()
    print(b // x - (a - 1) // x)
    
    return

#C
def C():
    return

#D
def D():
    return


#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

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())
if a % x == 0:
    low = a // x
else:
    low = a // x + 1
high = b // x

# print(low)
# print(high)
print(high-low+1)