Problem:


Score : 200 points

Problem Statement

You are given nonnegative integers a and b (a ≤ b), and a positive integer x.
Among the integers between a and b, inclusive, how many are divisible by x?

Constraints

0 ≤ a ≤ b ≤ 10^{18}

1 ≤ x ≤ 10^{18}

Input

The input is given from Standard Input in the following format:

a b x

Output

Print the number of the integers between a and b, inclusive, that are divisible by x.

Sample Input 1

4 8 2

Sample Output 1

3

There are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.

Sample Input 2

0 5 1

Sample Output 2

6

There are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.

Sample Input 3

9 9 2

Sample Output 3

0

There are no integer between 9 and 9, inclusive, that is divisible by 2.

Sample Input 4

1 1000000000000000000 3

Sample Output 4

333333333333333333

Watch out for integer overflows.



Sample input:
4 8 2


Sample output:
3

Submission status: Accepted

Solution code:
a, b, x = map(int,input().split())
ans =0
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())
if a==0:
    #0以上b以下でbで割り切れる個数
    if b%x==0:
        ans_b = b//x +1
    else:
        ans_b = b//x +1
    #0以上a未満でbで割り切れる個数
    if a%x==0:
        ans_a = a//x
    else:
        ans_a = a//x + 1
else:
    ans_b = b//x
    if a%x==0:
        ans_a = a//x -1
    else:
        ans_a = a//x

print(ans_b-ans_a)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def main():
    
    end, start, divisor = [int(i) for i in input().split()]
    a = start//divisor - (end-1)//divisor

    print(a)

main()

Submission status: Accepted

Solution code:
def main():
    
    end, start, divisor = [int(i) for i in input().split()]
    '''
    end = 1
    start = 1000 000 000 000 000 000
    divisor = 3
    '''

    if end % divisor == 0:
        a = start//divisor - end//divisor + 1
    else:
        a = start//divisor - end//divisor

    print(a)

main()

Submission status: Accepted

Solution code:
import math
a,b,c=[int(i) for i in input().split()]
print(b//c - (a-1)//c)

Submission status: Accepted

Solution code:
import math
from decimal import Decimal
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:
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())
mini = 0
m = a % c
if m == 0:
  mini = a/c
else:
  mini = (c-m + a)/c
maxi = 0
M = b % c
if M == 0:
  maxi = b//c
else:
  maxi = (b-M)//c
res = int(maxi) - int(mini) + 1
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:
def main():
    a,b,x=map(int,input().split())
    print(b//x - (a-1)//x)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans=0
if a!=b:
    A = (a-1)//x
    B = b//x

    ans = B - A
elif a==0 and b==0:
    ans=1
    
elif a==x and b==x:
    ans=1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b, x = map(int, input().split())
    r = (b // x) + 1
    if b > 0:
        r -= ((a - 1) // x) + 1
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

# 0以上b以下で、xで割り切れる数の個数
temp1 = b // x + 1

# 0以上a-1以下で、xで割り切れる数の個数
# a==0の時だけ例外処理
if a == 0:
    temp2 = 0
else:
    temp2 = (a - 1) // x + 1

print(temp1 - temp2)

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

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

Submission status: Accepted

Solution code:
a, b, x = 4, 8, 3
a, b, x = 0, 5, 1
a, b, x = 9, 9, 2
a, b, x = 1, 1000000000000000000, 3

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


def calculate(a, b, x):
    s1 = (a - 1) // x

    if s1 < 0:
        s1 = 0
    else:
        s1 += 1
    s2 = b // x + 1

    print(s2 - s1)


calculate(a, b, x)

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

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

print(b-a)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    a,b,x = getList()
    fb = b // x
    fa = (a-1) // x
    print(fb - fa)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

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

bcnt = b // x
acnt = (a-1) // x
print(bcnt-acnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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:
x,y,d=map(int,input().split())
ans=y//d-(x-1)//d
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
def LI():
    return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

a,b,x = LI()

print(max(b//x-(a-1)//x,0))

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
print(b // x - max(0, a - 1) // x +
      (1 if a == 0 else 0))  # aが0のときどうすりゃいいのか直感ではまったくわからんのだが

Submission status: Accepted

Solution code:
import math
a,b,x = map(int,input().split())
b_ans = b//x
a_ans = a//x
a_amari = a%x
print(b_ans-(a_ans+(a_amari>0))+1)

Submission status: Accepted

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

# a = p*x + r, b = q*x + s
p = a // x
r = a % x
q = b // x
s = b % x

res = q - p

if r == 0:
  res += 1

print(res)

Submission status: Accepted

Solution code:
# coding: utf-8

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


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

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

Submission status: Accepted

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

res = 0
d_min = a // x
d = (b- d_min * x) // x
res = d + (1 if d_min * x == a else 0)

print(res)

Submission status: Accepted

Solution code:
s = input().split()

a = int(s[0])
b = int(s[1])
x = int(s[2])

def bet_ween(p, q):
    if p < 0:
        return 0
    else:
        return (p // q) + 1


fa = bet_ween(a-1, x)
fb = bet_ween(b, x)
answer = fb - fa
print(int(answer))

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:
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+(a%x==0))

Submission status: Accepted

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

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

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

	c=a+x*ans

	if b//x*x==-(-c//x)*x:
		ans+=1

	print(ans)






if __name__ == "__main__":
	main()

Submission status: Accepted

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

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

if b == 0:
    pb = 1
else:
    pb = b // x + 1

print(pb - pa)


# 0 1 2 3 4 5
# ^

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque


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

if __name__ == "__main__":
    run()

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

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

    return None

if __name__ == '__main__':
    main()

Submission status: Accepted

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

a-=1
p=a//x
p*=x

q=b//x
q+=1
q*=x

print((q-p)//x -1)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# from pprint import pprint
# import math
# import collections

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

_a = a // x + 1
_b = b // x + 1

if a % x == 0:
    _c = 1
else:
    _c = 0

ans = _b - _a + _c

# print(_a, _b, _c, ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

a, b, x = nm()
d_min = x - (a % x)
if d_min == x: 
    d_min = 0
d_max = b % x
min = a + d_min
max = b - d_max
if min > max: 
    ans = 0
else:
    ans = ((max - min) // x + 1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n_lt_a = a // x + 1
n_lt_b = b // x + 1

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

Submission status: Accepted

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

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

cl=b//x

print(cl-fl)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__=='__main__':
    a,b,x=readinput()
    ans=main(a,b,x)
    print(ans)

Submission status: Accepted

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

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:
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	a, b, x = LI()
	if a%x == 0:
		y = 1
	else:
		y = 0
	print(b//x - a//x + y)

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

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

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

print(max - min)

Submission status: Accepted

Solution code:
a, b, x = map(int, input().split())
print(b // x + 1 if a == 0 else b // x - (a - 1) // 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:
#!/usr/bin/env python3
import sys


def solve(a: int, b: int, x: int):
    ans = b // x
    if a > 0:
        ans -= (a - 1) // x
    else:
        ans += 1
    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    solve(a, b, x)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

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


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))


a, b, x = LI()
acnt = (a - 1) // x if a > 0 else -1
bcnt = b // x if b != 0 else 1
ans = bcnt - acnt if not(a == b == 0) else 1
print(ans)

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))


a, b, x = LI()
acnt = (a - 1) // x
bcnt = b // x
ans = bcnt - acnt
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from decimal import * 
a, b, x = map(str, input().split())
a = Decimal(a)
b = Decimal(b)
x = Decimal(x)

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

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

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

c = a//x
d = b//x

if a%x == 0:
  print(d-c+1)
else:
  print(d-c)

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


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


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

Submission status: Accepted

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

Submission status: Accepted

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

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)'''

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = B - A
print(ans)

Submission status: Accepted

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


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


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

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

s = (a-1)//x
if a == 0: s = -1
p = b//x

print(p - s)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
a, b, x = LI()


def main():
    if a % x == 0:
        v = a
    else:
        v = (a // x + 1) * x
    if v > b:
        ans = 0
    else:
        ans = (b - v) // x + 1
    print(ans)


if __name__ == "__main__":
    main()

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-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:
def resolve():
    a, b, x = [int(i) for i in input().split()]
    print((b // x) - ((a - 1) // x))


resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/14
# Filename: main 
# Author: acto_mini

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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


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


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

Submission status: Accepted

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

def calc(N, X):
    if N < 0:
        return 0
    return N // X + 1

P = calc(A-1, X)
Q = calc(B, X)

print(Q-P)

Submission status: Accepted

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

P, r = divmod(A, X)
if r:
    P += 1

Q, r = divmod(B, X)

#print(P, Q)
print(max(0, Q-P+1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from decimal import *
import math
#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]
if(a != 0):
    print(b // x - (a-1) // x)
else:
    print(b // x + 1)
'''
n = math.floor(Decimal(b-a+1) / Decimal(x))

p = (b-a+1) % x
if(p > 0):
    l = a % x
    if(l <= p-1):
        n += 1
print(n)
'''

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

#print(Decimal(goal))
print(Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  ) 
#answer = ((goal - start) / x ) + 1
#print('{}'.format(int(answer)))
'''
'''
#AC code
def count_even(t, x):
    return int( Decimal(t)/ Decimal(x) )

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

Submission status: Accepted

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

# In[8]:


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


# In[9]:


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


# In[ ]:

Submission status: Accepted

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

Submission status: Accepted

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

aa = (a-1) // x + 1

bb = b // x

print(bb - aa + 1)

Submission status: Accepted

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

if a%x != 0:
    aa = a + (x - a % x)
else: aa = a

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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:
nums = [int(e) for e in input().split()]
def f(n, x):
    if n >=0:
        return int(n//x)+1
    elif n==-1:
        return 0

print(f(nums[1], nums[2])-f(nums[0]-1, nums[2]))

Submission status: Accepted

Solution code:
import numpy as np
import math
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

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

Submission status: Accepted

Solution code:
import math as m
from decimal import *
a,b,x = map(int,input().split())
tot = b-a+1
rem = a%x
getcontext().prec = 100
if rem > 0:
  tot-=x-rem
print(m.ceil(Decimal(tot)/Decimal(x)))

Submission status: Accepted

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

Submission status: Accepted

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