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: Wrong Answer

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

Submission status: Wrong Answer

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

ans = (upper - lower + 1)

print(ans)

Submission status: Wrong Answer

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

ans = int(upper - lower + 1)

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

if b >= 10**18:
    b -= x
ans = (b - a) // x + 1
if a == b:
    ans = 0

print(ans)

Submission status: Wrong Answer

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

ans = (b - a) // x + 1
if b >= 10**18:
    b -= x

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

Submission status: Wrong Answer

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

ans = (b - a) // x + 1
if b <= 10**18:
    b -= x

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(goal) - Decimal(start) / Decimal(x)) + Decimal(1)  ) 
#answer = ((goal - start) / x ) + 1
#print('{}'.format(int(answer)))

Submission status: Wrong Answer

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

n = b//x+1
if a>1:
  m = a//x
elif a==1:
  m=1
elif a==0:
  m=0
ans = n-m

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

Submission status: Wrong Answer

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

n = b//x+1
if a>0:
	m = a//x+1
else:
  m=0
ans = n-m

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

Submission status: Wrong Answer

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

n = b//x
if a>0:
	m = a//x
else:
  m=1
ans = n-m

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

Submission status: Wrong Answer

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

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

print(high-low+1)

Submission status: Wrong Answer

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 // x + 1
    
  return m - n
  
print(count(a, b, x))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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:
	if x%z==0 or y%z==0:
		print(((y-x)//z)+1)
	else:
		print((y-x)//z)

Submission status: Wrong Answer

Solution code:
x,y,z=list(map(int, input().split()))
ans=0
if x==y:
	if x%z==0:
		print(1)
	else:
		print(0)
elif (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:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, x = map(int, input().split())
    count = culc(b, x) - culc(a, x)
    if a % 2 == 0 and b % 2 == 0:
        count += 1
    print(count)

def culc(num, x):
    if num == 0:
        return -1
    else:
        return num // x + 1

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,x = map(int,input().split())
div,mod = divmod(b-a,x) #1,1
if mod == 0 and a%x == 0:#
  print(div+1)
elif a%x < mod:
  print(div-1)
else:
  print(div)

Submission status: Wrong Answer

Solution code:
a,b,x = map(int,input().split())
div,mod = divmod(b-a,x) #1,1
if mod == 0 and a%x == 0:#
  print(div+1)
else:
  print(div)

Submission status: Wrong Answer

Solution code:
a,b,x = map(int,input().split())
div,mod = divmod(b-a,x) #2,0
if a%x <= mod:
  print(div+1)
#elif a%x > mod:
#  print(div-1)
else:
  print(div)

Submission status: Wrong Answer

Solution code:
a,b,x = map(int,input().split())
div,mod = divmod(b-a,x) #2,0
if a%x == mod:
  print(div+1)
else:
  print(div)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


a_x = a // x 
b_x = b // x

ans = abs(a_x - b_x)

mi = b
if a < b:
    mi = a

    if mi % x == 0:
        ans += 1

    
print(ans)

Submission status: Wrong Answer

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

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


a_x = a // x 
b_x = b // x

ans = abs(a_x - b_x)

mi = b
if a < b:
    mi = a

    if mi % x == 0 and mi != 0:
        ans += 1

    
print(ans)

Submission status: Wrong Answer

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

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

if a == 0:
    ans += 1

print(ans)

Submission status: Wrong Answer

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

#from decimal import Decimal
 
#a = Decimal(str(a))
#b = Decimal(str(b))
#x = Decimal(str(x)) 

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
#a = Decimal(str(a))
#b = Decimal(str(b))
#x = Decimal(str(x)) 

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 


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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 

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

Submission status: Wrong Answer

Solution code:
import math

a,b,x = map(int,input().split())
 
print(math.floor(b/x)-math.floor((a-1)/x))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(math.floor(b/x)-math.floor(a/x))

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(a)
b = Decimal(b)
x = Decimal(x) 

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(str(a))
b = Decimal(str(b))
x = Decimal(str(x)) 

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

Submission status: Wrong Answer

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

from decimal import Decimal
 
a = Decimal(a)
b = Decimal(b)
x = Decimal(x) 

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

r = (b+x-a) // x

print(r)

Submission status: Wrong Answer

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

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

print(r)

Submission status: Wrong Answer

Solution code:

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

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

if a % x == b % x == 0:
    r += 1

print(r)

Submission status: Wrong Answer

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

r = b // x - a // x

if a % x == b % x == 0:
    r += 1

print(r)

Submission status: Wrong Answer

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

r = int((b-a)/x)
if a % x == 0 or b % x == 0:
    r += 1

print(r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

max_i = b//x

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,X = map(int , input().split() )

"""
単純にループでやると計算量がオーバーしそうなので、工夫する。
具体的には、下記の計算を実施する。

1.AをXで割って余りを求める。
2.この余りを足した値を、「最初の余りがでない値(以下、C)」として保持する
3.(B-C)/Xに1を足した値が答え。

また、下記の点に注意！！！
1.B<=Xの場合は、答えは0
2.X==1の時は、0の値も含めて回答する。
"""


if B < X:
  ans = 0
elif X == 1:
  ans = (B-A)+1
elif B == X:
  ans = 1
else:
  
  ## 1.最初のあまりでない値、Cを取得する
  if A%X > 0:
    C = (X-A%X) + A  
  else:
    C = A
  
  ## 2.Cの値に基づいて答えを取得
  if A <= C and C <= B:
    ans = 1 + (B-C)//X
  else:
    ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,X = map(int , input().split() )

"""
単純にループでやると計算量がオーバーしそうなので、工夫する。
具体的には、下記の計算を実施する。

1.AをXで割って余りを求める。
2.この余りを足した値を、「最初の余りがでない値(以下、C)」として保持する
3.(B-C)/Xに1を足した値が答え。

また、下記の点に注意！！！
1.B<=Xの場合は、答えは0
2.X==1の時は、0の値も含めて回答する。
"""


if B < X:
  ans = 0
elif X == 1:
  ans = (B-A)+1
else:
  
  if A%X > 0:
    C = (X-A%X) + A  
  else:
    C = A
  
  if A <= C and C <= B:
    ans = 1 + (B-C)//X
  else:
    ans = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

p = 0
y = int(b//x) + 1

i = 1
#for i in range(1,y):
while x*i <= b:
    if a <= x*i:
        p = x*i
        break
    i += 1

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

Submission status: Wrong Answer

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

p = 0
y = int(b//x) + 1

for i in range(1,y):
    if a <= x*i:
        p = x*i
        break

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

Submission status: Wrong Answer

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

p = 0
y = int(b//x) + 1

for i in range(1,y):
    if a <= x*i:
        p = x*i
        break

if p != 0:
    t = b-p
    s = t//x
    ans = s + 1
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

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

p = 0

for i in range(1,b//x+1):
    if a <= x*i:
        p = x*i
        break

if p != 0:
    t = b-p
    s = t//x
    ans = s + 1
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

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

p = 0

for i in range(1,b//x+1):
    if a < x*i:
        p = x*i
        break

if p != 0:
    t = b-p
    s = t//x
    ans = s + 1
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

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

p = 0

for i in range(1,b//x):
    if a < x*i:
        p = x*i
        break

if p != 0:
    t = b-p
    s = t//x
    ans = s + 1
    print(t,s)

    print(ans)
else:
    print(0)

Submission status: Wrong Answer

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

ans = 0
p = a
while p <= b:
    if p%x == 0:
        break
    p += 1

ans = ((b-p)/x) + 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b, x = MAP()
cnt = 0
#for i in range(a, b+1):
#    if not i % x:
#        cnt += 1
#print(cnt)
c = b - a
ans = c // x
if b % x == 0:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
#ABC048

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

Submission status: Wrong Answer

Solution code:
#ABC048

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

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
for i in range(a,b):
    if i % c == 0:
        k = i
        print(1 + (b - k) // c)
        break
    else:
        continue
else:
    print(0)

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
cnt = 0
for i in range(a,b):
    if i % c == 0:
        cnt = i
        break
    else:
        continue
print(1 + (b - cnt) // c)

Submission status: Wrong Answer

Solution code:
a,b,x=map(int, input().split())
c=(b-a)//x
cnt=0
if a%x==0:
    cnt+=1
    if a+x*(c+1)<=b:
        cnt+=c+1
    else:
        cnt+=c
elif a+x<=b:
    for n in range(a+1,a+x):
        if n%x==0:
            cnt+=1
            buf=(b-n)//x
            if n+x*c<=b:
                cnt+=c
            else:
                cnt+=(c-1)
print(cnt)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

start = a if a % x == 0 else a // x + x
ans = max(0, b - start) // x + 1

print(ans)

Submission status: Wrong Answer

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

while b % x != 0:
    b -= 1

while a % x != 0:
    a -= 1

ans += int((b/x) - (a/x))
print(ans)

Submission status: Wrong Answer

Solution code:
import math
A, B, X = [int(s) for s in input().split()]

def main():
    a = math.ceil(A / X)
    b = math.floor(B / X)
    print(b - a + 1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,x = map(int,input().split())
number_a = []
number_b = []

for i in range(a-1):
  if i%x == 0:
    number_a.append(i)
for i in range(b):
  if i%x == 0:
    number_b.append(i)

print(len(number_b)-len(number_a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

end = 0
begin = 0
if b%c == 0:
    end = b//c + 1
else:
    end = b//c

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

Submission status: Wrong Answer

Solution code:
# ABC048B
#import
import math

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

# c = math.floor((b/x)) - (math.ceil(a/x)-1)
c = (b//x) - ((a//x)-1)

if c <= 0:
    print(0)
else:
    print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

r = a % c == 0 or b % c == 0 if 1 else 0
ans = b//c-a//c + r

print(ans)

Submission status: Wrong Answer

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

if a < c:
    r = 1
else:
    r = a % c == 0 or b % c == 0 if 1 else 0
ans = (b-a)//c + r

print(ans)

Submission status: Wrong Answer

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

r = a % c == 0 or b % c == 0 if 1 else 0
ans = (b-a)//c + r

print(ans)

Submission status: Wrong Answer

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

r = a % c == 0 if 1 else 0
ans = (b-a)//c + r

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, x = map(int, input().split())
nums = [i if i%x == 0 else 0 for i in range(a, b+1)]
print(len(set(nums))-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

p=a+(x-(a%x))
q=b-(b%x)
ans =1+(q-p)//x 
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,x=map(int,input().split())
p=0
q=0
for i in range(a,b+1):
  if i % x==0:
    p=i
    break
for j in range(b,a,-1):
  if i % x==0:
    q=j
    break

ans =1+(q-p)//x if p+q!=0 else 0
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,x=map(int,input().split())
p=0
q=0
for i in range(a,b+1):
  if i % x==0:
    p=i
    break
for j in range(b,a,-1):
  if i % x==0:
    q=j
    break
print(1+(q-p)//x)

Submission status: Wrong Answer

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

if (a - 1) < 0:
    count_a = 0
else:
    count_a = (a - 1) // 2 + 1

count_b = b // x + 1

print(count_b - count_a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import ceil

def solve(a, b, x):
    return b // x - ceil(a / x) + 1

_a, _b ,_x = map(int, input().split())
print(solve(_a, _b, _x))

Submission status: Wrong Answer

Solution code:
a,b,x = map(int, input().split())
cnt=0
i=int((a+x-1)/x)+x
if x==1:
    print(b+1)
elif a<=i<=b:
    while i<=b:
        i+=x
        cnt+=1
    print(cnt)
elif i<a:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

result += ((b - a) // x)

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

r = 0
#b = max(a, (b // x) * x)
b_a = b - a
r = b_a // x
if a % x == 0:
  r += 1

print(int(r))

Submission status: Wrong Answer

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

r = 0
b = max(a, (b // x) * x)
b_a = b - a
r = b_a // x
if a % x == 0:
  r += 1

print(int(r))

Submission status: Wrong Answer

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

r = 0
b_a = b - a +1
r = b_a // x
r += 1

print(int(r))

Submission status: Wrong Answer

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

r = 0
b_a = b - a
r = b_a // x
r += 1

print(int(r))

Submission status: Wrong Answer

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

r = 0
if ((a // x) + 1) * x > b:
    r = 0
else:
  if a % x == 0:
    a_t = a
  else:
    a_t = ((a // x) + 1) * x
  a_b = b - a_t
  if a_b == 0:
    print(1)
  else:
    r = (a_b // x) + 1
print(int(r))

Submission status: Wrong Answer

Solution code:
import math

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

if b > a:
    N = int(b/x) - math.ceil(a/x) + 1

    print(int(N))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import math

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

if b > a:
    N = int(b/x) - math.ceil(a/x) + 1

    print(int(N))
else:
    print(0)

Submission status: Wrong Answer

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

if b > a:
    N = int(b/x) - int(a/x) + 1

    print(int(N))
else:
    print(0)

Submission status: Wrong Answer

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

N = int(b/x) - int(a/x) + 1

print(int(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,x=INTM()
    if a>=1:
        cta=a//x
    else:
        cta=0
    ctb=b//x
    print(ctb-cta)
if __name__ == '__main__':
    do()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if a > x or b < x:
    print("0")
else:
    print(b//x-a//x)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
i,j,n=map(int,input().split())
i_num=i/n
j_num=j/n
cnt=j_num-i_num
#print(cnt)
if i_num % n==0:
  cnt+=1
print(int(cnt))

Submission status: Wrong Answer

Solution code:
i,j,n=map(int,input().split())
i_num=i//n
j_num=j//n
cnt=j_num-i_num
#print(cnt)
if i_num % n==0:
  cnt+=1
print(int(cnt))

Submission status: Wrong Answer

Solution code:
i,j,n=map(int,input().split())
i_num=i//n
j_num=j//n
cnt=j_num-i_num
#print(cnt)
if i_num % n==0:
  cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
i,j,n=map(int,input().split())
i_num=i/n
j_num=j/n
cnt=j_num-i_num
#print(cnt)
if i_num % n==0:
  cnt+=1
print(cnt)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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