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

r = b // x
l = a // x

if a % x == 0:
    print(r-l+1)
else:
    print(r-l)

Submission status: Accepted

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

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

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 solve(a,b,x):
  ans =  b//x - (a-1)//x
  # print(ans)
  return ans
print(solve(a,b,x))

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

    ans = n_b - n_a

    print(ans)

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:
    m = a // x
else:
    m = a // x + 1

if b < m*x:
    ans = 0
else:
    ans = (b - m*x) // x + 1

print(ans)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


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


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    a, b, x = MI()
    n = b // x
    m = (a-1) // x
    print(n - m)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

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()))
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,k = map(int,input().split())
temp =(a - 1 )//k
if a == 0:
  temp = -1
print(b//k - temp)

Submission status: Accepted

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

down = a//x
if down*x == a:
  down -= 1

up = b//x
#print(up,down)
print(up - down)

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    q, r = divmod(a, x)
    A = x * q + x * (r != 0)
    q, r = divmod(b, x)
    B = x * q

    if B < A:
        print(0)
    else:
        print((B - A) // x + 1)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

#a<=n<=b

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

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
start=a
if (a%x!=0):
    start=a+x-a%x
print(len(range(start, b+1, x)))

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt = int(f(b) - f(a-1))

print(cnt)

Submission status: Accepted

Solution code:
x = [int(e) for e in input().split()]
a = x[0]
b = x[1]
c = x[2]
ans = 0
ans = (b//c) - (a-1)//c 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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())
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:
# ABC 048: B – Between a and b ...
a, b, x = map(int, input().split())
print(b // x - (a - 1) // x)

Submission status: Accepted

Solution code:
# ABC 048: B – Between a and b ...
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())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import numpy as np
import collections

#n = int(input())
a, b, x = list(map(int, input().split()))
#a = list(map(int, input().split()))
low = a//x
higth = b//x
ans = higth-low
if a%x==0:
    ans += 1
print(ans)

Submission status: Accepted

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

idx1 = 0
while x * idx1 < a:
    idx1 += 1

a = x * idx1

print(((b - (x * idx1)) // x) + 1)

Submission status: Accepted

Solution code:
a,b,x = map(int, input().split())
b_ = b // x
a_ = a // x
a_a = a % x

if a_a == 0:
    print(b_ - a_ + 1)
else:
    print(b_ - a_)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,s,d=map(int,input().split())
l=1+ (a-1)//d if a>=1 else 0 
u=s//d+1
print(u-l)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a, b, x = [int(x) for x in 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:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
import sys

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

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

print("{}".format(cnt))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    x = [int(i) for i in input().split()]
    a = (x[0]-1) // x[2]
    b = x[1] // x[2]

    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:
x = list(map(int,input().split()))
a = 0
if x[0]%x[2]==0:
    b = x[0]
else:
     b = ((x[0] // x[2])+1)*x[2]
c = (x[1]-b)//x[2] + 1

print(c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    a, b, x = Scanner.map_int()

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


if __name__ == "__main__":
    main()

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())
print(b//x + (-a//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:
p=0;q=0;r=0
a,b,x=map(int,input().split())
p=int(b//x+1)
q=int((a-1)//x+1)
r=int(p-q)
print(int(r))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print((b1-a1)//x+1)

Submission status: Accepted

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

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 = list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

if a%x==0:
    ax = a//x-1
else:
    ax = a//x

bx = b//x

print(bx-ax)

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

Submission status: Accepted

Solution code:
a,b,x = [int(x) for x in 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())
C=A//X
D=B//X
if A%X==0:
	print(D-C+1)
else:
	print(D-C)

Submission status: Accepted

Solution code:
A,B,X=map(int,input().split())
C=A//X
D=B//X
if A%X==0 and B%X==0:
	print(D-C+1)
elif A%X!=0 and B%X==0:
	print(D-C)
elif A%X==0 and B%X!=0:
	print(D-C+1)
else:
	print(D-C)

Submission status: Accepted

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

min_ = a//x + (1 if a%x!=0 else 0)
max_ = b//x

print(max_-min_+1)

Submission status: Accepted

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


tmp1 = a // x
if a % x != 0:
    tmp1 = tmp1 + 1

tmp2 = b // x

print(tmp2 - tmp1 + 1)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main(a, b, x):
    if x > b:
        return 0
    elif x == b:
        return 1

    minimum, maximum = None, None

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

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

    if minimum != None or maximum != None:
        if minimum != None and maximum != None:
            # 普通の / 除算だと3で割ったときに大きくずれる。
            return (maximum - minimum) // x + 1
        else:
            return 1
    else:
        return 0


def main_b(a, b, x):
    """解説を読んだ。単純なことだった。
    """
    def count(n):
        if n == -1:
            return 0
        else:
            return n // x + 1

    return count(b) - count(a-1)


if __name__ == "__main__":
    a, b, x = [int(x) for x in input().split()]
    print(main_b(a, b, x))

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Sun Mar 22 17:06:57 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

a, b, x = na()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt=0

R=b//x
L=(a-1)//x

print(R-L)

Submission status: Accepted

Solution code:
def f(n, x):
    ans = 0
    if (0 <= n):
        ans = n // x + 1
    return ans


if __name__ == "__main__":
    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())
br = b//x
ar = (a-1)//x
print(br-ar)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#048_B
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(int(b//x)-int((a-1)//x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a_cnt=a//x
b_cnt=b//x

print(b_cnt-a_cnt+1 if a%x==0 else b_cnt-a_cnt)

Submission status: Accepted

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

Submission status: Accepted

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

a1 = (a // x) * x
b1 = (b // x) * x

ans = (b1 - a1) // x
if a1 == a:
    ans = ans + 1

print(ans)

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

ans = upper - lower

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
a, b, x = map(int, input().split())
upper = b // x
lower = (a-1)//x

ans = upper - lower

print(ans)

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,x=MI()
    ans=b//x-(a-1)//x
    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=map(int,input().split())
if a<=b<x:
  if a==0:
    print(1)
  else:
    print(0)
else:
  s=(a-1)//x
  t=b//x
  print(t-s)

Submission status: Accepted

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

a_ = a//x
b_ = b//x

if a%x == 0:
    print(b_ - a_ + 1)
else:
    print(b_- a_)

Submission status: Accepted

Solution code:
#abc064 b
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:
  ans += 1
print(ans)

Submission status: Accepted

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

end = 0
if b % c == 0:
    end = b//c
else:
    end = b//c

begin =  0
if a % c == 0:
    begin = a//c - 1
else:
    begin = a//c
print(end - begin)

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:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

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


resolve()

Submission status: Accepted

Solution code:
#B - Between a and b ...
a,b,x = map(int, input().split())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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 - a) // x + 1)
else:
  print((b - a + a % x) // x)

Submission status: Accepted

Solution code:
from decimal import *
#exp = Decimal(10**23)
#rint((Decimal(11)*exp)/Decimal(10))

## coding: UTF-8
s = input().split()
t = [int(p) for p in s]
#print(t)

a = t[0]
b = t[1]
x = t[2]

'''
start = a
goal = b
while True:
    if(start % x == 0):
        break
    else:
        start += 1
#print(start)
while True:
    if(goal % x == 0):
        break
    else:
        goal -= 1
#start = Decimal(3)
#goal = Decimal(999999999999999999)

#print(Decimal(goal))
print(Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  ) 
#answer = ((goal - start) / x ) + 1
#print('{}'.format(int(answer)))
'''

def count_even(t, x):
    return int( Decimal(t)/ Decimal(x) )

if( a == 0):
    answer = count_even(b, x) + 1
else:
    answer = count_even(b, x) - count_even(a-1, x)
print(answer)

Submission status: Accepted

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

n = b//x
m = (a-1)//x

ans = n-m

print("{}".format(ans))

Submission status: Accepted

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

a,b,x = map(int,readline().split())
import math
low = (a+x-1)//x
high = b//x

print(high-low+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter
def input():
    return sys.stdin.readline()[:-1]


def main():

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y,z=list(map(int, input().split()))
ans=0

if (y-x)//z==0:
	if x%z > y%z:
		ans=ans+1
	if x%z==0 or y%z==0:
		print(1)
	else:
		print(ans)
else:
	ans=((y//z)-((x-1)//z))
	if x==0:
		ans=ans
	print(ans)

Submission status: Accepted

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

if x*(b//x)<a:
  print(0)
elif x*(a//x)<a and x*(a//x+1)<a:
  print(0)
else:
  if x*(a//x)<a:
    min_n=a//x+1
  else:
    min_n=a//x
  
  max_n=b//x
  print(max_n-min_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())
max_div = b // x * x
min_div = -(-a // x) * x
if a <= min_div <= max_div <= b:
    print(-(-(max_div - min_div + 1) // x))
else:
    print(0)

Submission status: Accepted

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

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

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())
def count(c):
  if c==0:
    return 0
  return c//x
print(count(b)-count(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+1)-((a-1)//x+1))

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    resolve()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc048/tasks/abc048_b

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

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

elif a == 1:
    print(b // x)

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

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    readline=stdin.readline
    a,b,x=map(int,readline().split())
    if a==0:
        print(b//x+1)
    elif a==1:
        print(b//x)
    else:
        c=a-1
        print(b//x-c//x)
if __name__=="__main__":
    main()