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:
def hoge(a,x):
  if a == 0:
    return 0
  else:
    return a//x

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

ans = hoge(b,x) - hoge(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
import math

def resolve():
        input = sys.stdin.readline
        a,b,x=map(int,input().rstrip().split())

        ax=(a-1)//x
        bx=b//x

        ans=bx-ax
        ans=math.floor(ans)
        print(ans)
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """4 8 2"""
        output = """3"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """0 5 1"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """9 9 2"""
        output = """0"""
        self.assertIO(input, output)
    def test_入力例_4(self):
        input = """1 1000000000000000000 3"""
        output = """333333333333333333"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

na = (a-1)//x
nb = b//x
print(nb-na)

Submission status: Accepted

Solution code:

"""
https://atcoder.jp/contests/abc048/tasks/abc048_b
"""

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

"""
ans = 0

for i in range(a,b+1):
    if i % x == 0:
        ans += 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:
#48-B
a,b,x=map(int,input().split())
b_count=b//x
a_count=(a-1)//x
print(b_count-a_count)

Submission status: Accepted

Solution code:
import sys, math

def input():
    return sys.stdin.readline()[:-1]

def main():
    a, b, x = map(int,input().split())
    t = a//x
    s = b//x
    if a%x == 0:
        print(s-t+1)
    else:
        print(s-t)

if __name__ == '__main__':
    main()

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

if a % x == 0:
    answer = b // x - a // x + 1
else:
    answer = b // x - a // x

print(answer)

Submission status: Accepted

Solution code:
import sys
a, b, x = [int(i) for i in sys.stdin.readline().split()]
print(b // x - (a - 1) // x)

Submission status: Accepted

Solution code:
def f(a,x):
  if a < 0:
    return 0
  else:
    return a//x + 1

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

Submission status: Accepted

Solution code:
a,b,c = [int(i) for i in input().split()]
 
print(b//c - (a-1)//c if a > 0 else b//c + 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())

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

Submission status: Accepted

Solution code:
import sys

a, b, x = map(int, sys.stdin.readline().split())

def main():
    ans = b // x - (a - 1) // x
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

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

if a % x == 0:
    y1 = a
elif a < x:
    y1 = x
else:
    y1 = a + (x - a % x)

y2 = b - b % x

ans = (y2 - y1) // x + 1
print(ans)

Submission status: Accepted

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

y1 = b - b % x
if a % x == 0:
    y2 = a
else:
    y2 = a - a % x + x

ans = (y1-y2)//x + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from decimal import *
a,b,n=map(int,input().split())
print(math.floor(Decimal(b)/Decimal(n))-math.ceil(Decimal(a)/Decimal(n))+1)

Submission status: Accepted

Solution code:
from decimal import Decimal
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()]

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

r = b // x
l = (a-1) // x

print(r-l)

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

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

Submission status: Accepted

Solution code:
a,b,x = map(int, input().split( ))
ax = a//x
if ax*x<a:
    ax+=1
bx= b//x

print(bx-ax+1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

main()

Submission status: Accepted

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

i = b // x
j = (a-1)// x

print(i-j)

Submission status: Accepted

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

Submission status: Accepted

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

total = b // x
til_a = (a-1) // x

print(total - til_a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x = [int(i) for i in input().split()]
if a == b:
  print(0 if a%x != 0 else 1)
  quit()
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 == 0:
    print(b // x + 1)
else:
    print(b // x - (a - 1) // x)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Submission status: Accepted

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


def solve(a: int, b: int, x: int):
    # N以下のxで割れる個数をもとめたい
    def counter(n):
        return n//x
    
    if a == 0:
        print(counter(b)+1)
        return 
    
    print(counter(b)-counter(a-1))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x = map(int,input().split())
ans = 0
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 - 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:
from sys import stdin

a,b,x = [int(x) for x in stdin.readline().rstrip().split()]
point = 0

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

print(point)

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

m = b//x
print(m-n)

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b,x=map(int,input().split())
    print(b//x-(a-1)//x)
resolve()

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

Submission status: Accepted

Solution code:
import math
from string import ascii_lowercase
 
line = input()
a, b, d = [int(x) for x in line.split()]
if (a == 0): 
	ans = b // d + 1
else:
	ans = b // d - (a - 1) // d
print(ans)

Submission status: Accepted

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

n = (a + x - 1) // x * x
print((b - n) // x + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
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
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B,X=MI()
    print(B//X - (A-1)//X)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def w(p, c):
  return p // c

A,B,X = map(int, input().split())
print(w(B,X)-w(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,c = map(int,input().split())
ac = max(0,a//c if a % c else a//c-1)
bc = b//c if b % c else b//c
zero = 1 if a == 0 else 0
# print(bc,ac,zero)
print(bc-ac+zero)

Submission status: Accepted

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

start = 0
end = b
if a > x:
    if a % x == 0:
        start = a
    else:
        start = x * (a // x + 1)
else:
    start = x

if start > end:
    result = 0
else:
    result = (end - start) // x + 1
if a == 0:
    result += 1
print(result)

Submission status: Accepted

Solution code:
a,b,x = map(int,input().split())
if a%x==0 or a==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())

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

ans1 = a//x
ans2 = b//x

#print(ans1)
#print(ans2)

if a%x == 0:
	print(ans2-ans1+1)
else:
	print(ans2-ans1)

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split(' '))
if a != 0 and b != 0:
    s = b // x
    t = (a-1) // x
elif a == 0 and b != 0:
    s = b // x + 1
    t = 0
elif a == 0 and b == 0:
    s = 1
    t = 0

print(s-t)

Submission status: Accepted

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

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

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:
def func(n,d):
    return n//d

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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 if A else 0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x = map(int, input().split())
#切り捨て
a_num = (a-1) //x
b_num = b // x

ans =b_num-a_num
print(ans)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
def solve():
    A, B, X = list(map(int, input().split()))
    # print(A, B, X)

    c = B // X - (A - 1) // X

    return c


if __name__ == '__main__':
    res = solve()
    print(res)

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

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())
def f(p):
    q = p//x
    return q
ans = f(b) - f(a-1)
print(ans)

Submission status: Accepted

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

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:
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
A,B,X = map(int,input().split())

print(B//X - (A-1)//X)

Submission status: Accepted

Solution code:
def examB():
    a, b , x = LI()
    ans = b//x - (a-1)//x
    print(ans)


import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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())
range_of = (b - a)
del_num = x - (a % x) if a % x != 0 else 0
# print(range_of, del_num)
print((range_of - del_num) // 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((b-a)//x+1 if a%x == 0 else (b//x-a//x))

Submission status: Accepted

Solution code:
# BC 048: B – Between a and b ...
a, b, x = [int(s) for s in input().split()]
print(b // x - (a - 1) // x)

Submission status: Accepted

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

def calc(a,x):
  if a < 0:
    return 0
  else:
    return a//x+1

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int,input().split()))
a=A[0]
b=A[1]
x=A[2]
a = (a-1) // x
b = b // x
s = b-a
print(s)

Submission status: Accepted

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

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

q_a, mod_a = divmod(a, x)

ans = b//x - q_a

if mod_a == 0:
  ans = 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())
ans = max(0, 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())

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

print(f(b,x) - f(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().rstrip("\n").split())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
#b以下で小さくかつbに最も近いxの倍数 x*i (x*i=0を含める)
i = b // x
#aより小さくかつaに最も近いxの倍数 x*j (x*j=0を含める)
j = (a-1) // x
print(i-j)

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

Submission status: Accepted

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

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

if a == 0:
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

a,b,x=map(lambda x: int(x), 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//x) + 1)

Submission status: Accepted

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

if a==b:
    if a%x==0:
        print(1)
    else:
        print(0)
else:
    """
    min_dev = 0
    for i in range(a,b+1):
        if i%x==0:
            min_dev = i
            break
    """
    if a==0:
        min_dev=0
    else:
        min_dev = math.ceil(a/x)

    """
    max_dev = 0
    for i in range(a,b+1)[::-1]:
        if i%x==0:
            max_dev = i
            break
    """
    max_dev = int(b//x)
    print(max_dev-min_dev+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:
def main():
    a, b, x = map(int, input().split())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if a%x == 0:
    print(m2-m1+1)
else:
    print(m2-m1)

Submission status: Accepted

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

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

Submission status: Accepted

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

if a == b == 0:
    print(1)
    sys.exit()

if x > b:
    if a != 0:
        print(0)
        sys.exit()
    else:
        print(1)
        sys.exit()

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

Submission status: Accepted

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

hoge = b // x
fuga = a // x

if a == 0 or a % x == 0:
    hoge += 1

print(hoge - fuga)

Submission status: Accepted

Solution code:
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


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

    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(n-m)

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

Submission status: Accepted

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


def main():
    a, b, x = map(int, input().split())
    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()))
print(b//x-(a-1)//x)
#0 100000000000000000 1

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b,x=map(int,input().split())

small=a//x
large=b//x

if a%x==0:
    print(large-small+1)
else:
    print(large-small)

Submission status: Accepted

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

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

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())
if A % X != 0:
    A += X - A % X
B -= B % X

if A > B:
    print(0)
else:
    ans = (B - A) // X + 1
    print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
A, B, X = [int(_) for _ in stdin.readline().rstrip().split()]
print(B//X - (A-1)//X)

Submission status: Accepted

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

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

cnt = 0
ans1 = 0 if a == 0 else ((a - 1) // x + 1)
ans2 = b // x + 1
print(ans2 - ans1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def start_from(a, x):
  while a % x != 0:
    a += x - a % x
  return a

def ends_with(b, x):
    while b % x != 0:
        b -= b % x
    return b

def main():
  a, b, x = map(int, raw_input().split())
  start = start_from(a, x) / x
  end = ends_with(b, x) / x
  print(end-start+1)


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


print(ans)

Submission status: Accepted

Solution code:
a,b,x=map(int,input().split())
a+=(-a)%x
b-=a%x
print((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:
import math
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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b, x = list(map(int, input().rstrip('\n').split()))
    print(b // x - (a - 1) // x)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

f1 = (a - 1) // x
f2 = b // x
print(f2 - f1)

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
"""
    a~b間のxで割り切れる数は何個？
    1~b間のxで割り切れる数から1~a間のxで割り切れる数
"""
ans_b = b//x
ans_a = (a-1)//x
print(ans_b - ans_a)

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
"""
    a~b間のxで割り切れる数は何個？
    1~b間のxで割り切れる数から1~a間のxで割り切れる数
"""
ans = (b//x) - (a-1)//x
print(ans)

Submission status: Accepted

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

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

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