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

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

Submission status: Accepted

Solution code:
import sys

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    a,b,x=map(int, readline().rstrip().split())
    print(b//x - (a-1)//x)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b,x=map(int, readline().rstrip().split())
    if a%x==0:
        f=a
    else:
        f=a-a%x+x
        if f > b:
            print(0)
            return
    if b%x==0:
        t=b
    else:
        t=b-b%x
        if t<a:
            print(0)
            return
    print((t-f)//x+1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

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
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if a % x != 0 :
    aa = a//x+1
else :
    aa = a//x


bb = b //x

print(bb - aa  + 1 )

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

Submission status: Accepted

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

print(tmp)

Submission status: Accepted

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

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))

def ssplit():
    return list(input().split())


import math
a,b,c = cin()
print(b//c - a//c+(a%c==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())

ans=0

if A!=B:
    ans+=1*(A%X==0)
    ans+=(B-A+A%X)//X
else:
    ans+=1*(A%X==0)

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

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

Submission status: Accepted

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

#import math

a,b,x=map(int,input().split())
#max_num=math.floor(b/x)
#min_num=math.ceil(a/x)
#print(max_num-min_num+1)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

a_div = a // x
b_div = b // x

if a % x == 0:
    print(b_div-a_div+1)
else:
    print(b_div - a_div)

Submission status: Accepted

Solution code:
import sys
import math
import bisect

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

def main():
    a, b, x = map(int, input().split())
    ans = query(b, x)
    if a > 0:
        ans -= query(a - 1, x)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

total_b = b//x
total_a = (a-1)//x

print(total_b - total_a)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b, x = map(int, input().split())
print(b//x-(a-1)//x)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
a, b, x = MAP()


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

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(n):
    count = 0
    if n == -1:
        return 0
    else:
        count = n//x + 1 #切り捨て除算　あまりを求める時のチップスtip
        # n以下の整数でxで割り切れるものは，整数nの中にxが何個入るか？という問題に置き換えられる．
        return count

ans = f(b)-f(a-1)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, x = map(int, input().split())
print(b // x - a // x + (1 if a % x == 0 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:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


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


def floor(a,b):
    return a//b


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    a,b,x = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = floor(b,x)-ceil(a,x)+1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

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:
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    a, b, x = map(int, input().split())
    hoge = b // x
    huga = (a-1) // x
    print(hoge-huga)
    return 0

if __name__ == "__main__":
    solve()

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())
aw=a//x
bw=b//x
ans=bw-aw

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(b-a+1)

Submission status: Accepted

Solution code:
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, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

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

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
# オーバーフロー
# cnt = len([_ for _ in range(a, b + 1, x)])
print(b // x - (a - 1) // x if a - 1 >= 0 else b // x - a // x + 1)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
ans = 0
ans += B // C
ans -= (A-1) // C
print(ans)

Submission status: Accepted

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

xa = -(-a // x)
xb = b // x
print(xb - xa + 1)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

left = (x-a%x)%x

if left +n*x<(b-a+1):
    n+=1
print(n)

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:
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


a, b, x = readnums()

s = a + x - a % x if a % x else a
if s > b:
    ans = 0
else:
    ans = b // x - s // x + 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, x  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

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

Submission status: Accepted

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

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

#b -= a - 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2020/05/03
# AtCoder Beginner Contest 048 - B

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

# Calc
wk_v1 = (a - 1) // x
wk_v2 = b // x
ans = wk_v2 - wk_v1

# Output
print(ans)

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if '__main__' == __name__:
    resolve()

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:
import sys
input = sys.stdin.readline


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

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

if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Submission status: Accepted

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

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

Submission status: Accepted

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

# 0~a-1でいくつあるか
if a == 0:
    count_a = 0
else:
    count_a = (a-1) // x + 1


# 0~bでいくつあるか
count_b = b // x + 1

print(count_b - count_a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if a == 0:
  print(bb+1)
else:
  print(bb-aa)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def sol(x,m):
	if x<=0:
		return 0
	else:
		return x//m

a,b,n = map(int,input().split())
if a==0:
	print(sol(b,n)+1)
# elif a==1:
# 	print(sol(b,n))
else:
	print(sol(b,n)-sol(a-1,n))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
tx =0
xb = b//x
xa = a//x
if a % x ==0:
    tx = 1

print(int(xb-xa+tx))

Submission status: Accepted

Solution code:
A, B, x = map(int,input().split())
b_d = B//x+1
a_d = A//x
if A!=0 and A%x!=0:
   a_d+=1
print(b_d - a_d)

Submission status: Accepted

Solution code:
A,B,X=map(int,input().split())
print((B//X)-(A-1)//X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    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())
ans = 0
if a==0:
    a=1
    ans += 1
ans += b//x - (a-1)//x
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(B-A+1)

Submission status: Accepted

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

ansb = b//x

print(ansb-ansa)

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

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b, x = map(int, input().split())
    print(b // x + 1 - max(0, (a - 1) // x + 1))


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

Submission status: Accepted

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

print(B - A)

Submission status: Accepted

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

a_divmod = divmod(a, x)
if a_divmod[1] != 0:
    print(b//x - a_divmod[0])
else:
    print(b//x - a_divmod[0] + 1)

Submission status: Accepted

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

def calc(n):
    if n > -1 :
        cnt = n // x  + 1
    else:
        cnt = 0
    return int(cnt)
    
cnt_a = calc(a-1)
cnt_b = calc(b)

ans = cnt_b - cnt_a
print(int(ans))

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
_input = list(map(int, input().split(" ")))
a = _input[0]
b = _input[1]
x = _input[2]

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

print(result)

Submission status: Accepted

Solution code:
import math  # noqa
import bisect  # noqa
import queue  # noqa


# if __name__ == '__main__':
#     a, b, x = map(int, input().split())

#     L = b - a + 1
#     res = L // x
#     if L % x != 0:
#         if a % x == 0 or b % x == 0:
#             res += 1
#         else:
#             c = b - b % x
#             if a <= c:
#                 L = c - a + 1
#                 res = L // x
#                 if L % x != 0:
#                     if a % x == 0 or c % x == 0:
#                         res += 1
#     print(res)


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


if __name__ == '__main__':
    a, b, x = map(int, input().split())

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

Submission status: Accepted

Solution code:
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    a, b, x = map(int, input().split())

    L = b - a + 1
    res = L // x
    if L % x != 0:
        if a % x == 0 or b % x == 0:
            res += 1
        else:
            c = b - b % x
            if a <= c:
                L = c - a + 1
                res = L // x
                if L % x != 0:
                    if a % x == 0 or c % x == 0:
                        res += 1
    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:
def resolve():
	a, b, x = map(int, input().split())
	print(b // x - (a-1) // x)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(b-a)

Submission status: Accepted

Solution code:
def solve(a, b, x):
    def f(n):
        if n == -1:
            return 0
        return n // x + 1
    
    print(f(b) - f(a - 1))



T = list(map(int, input().split()))
solve(T[0], T[1], T[2])

Submission status: Accepted

Solution code:
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-BetweenAandB.py
#

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
a, b, x = map(int,input().split())
def fnc(n,x):
    if n == -1:
        return 0
    return n//x+1
print(fnc(b,x) - fnc((a-1),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:
def count(n, x):
  if n == -1:
    return 0
  return n//x+1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


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


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

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

print(n-m)

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
m1 = a % x
m2 = b % x
if a == b:
  if a % x == 0:
    print(1)
  else:
    print(0)
  exit()
if m1 != 0:
  a = (a//x)*x + x
if m2 != 0:
  b = (b//x)*x

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

Submission status: Accepted

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

cnt_a = (a-1) // x
cnt_b = b // x

print(cnt_b-cnt_a)

Submission status: Accepted

Solution code:
nim, mike, kite = map(int, input().split())
print((mike // kite) - ((nim - 1) // kite))

Submission status: Accepted

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

print(r-l + 1)

Submission status: Accepted

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

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

Submission status: Accepted

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

else:
  print((b//x)+1)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

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

main()

Submission status: Accepted

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

if a == b and a % x != 0:
  result = 0
  print(result)
  exit()
elif a == b and a % x == 0:
  result = 1
  print(result)
  exit()
else:
  B = divmod(b, x)
  A = divmod(a, x)
  result = B[0] - A[0]
  if A[1] == 0: result += 1
  print(result)