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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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


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


st = input().split()

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

isplus = 0

if a % x == 0:
    isplus = 1

bx = b // x
ax = a // x

print(int(bx - ax + isplus))

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

Submission status: Accepted

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

def func(n):
    if n == -1:
        return 0

    else:
        return n // x + 1

print(func(b) - func(a - 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:
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
ind_min = max(0,1+(a-1)//x)
ind_max = b//x + 1
ans = ind_max - ind_min
print(ans)

Submission status: Accepted

Solution code:
def divide(num,d):
    return num // d

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

Submission status: Accepted

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

if a == b:
  if a%x == 0:
    print(1)
  else:
    print(0)
    
  exit(0)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,x= map(int, input().split())
res=b//x
res=res-a//x
if a%x==0:
  res=res+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:
a,b,x=map(int,input().split())
if a % x == 0:
    print(b//x - a//x +1)
else:print(b//x-a//x)

Submission status: Accepted

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

def func(n):
    if n > -1:
        return n//x+1 #+1は0の分
    else:
        return 0

print(func(b) - func(a-1))

Submission status: Accepted

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

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

print(bnum - anum)

Submission status: Accepted

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

Submission status: Accepted

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

l = (a + x - 1) // x
r = b // x
ans = max(0, r - l + 1)
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


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

    return n // x + 1


def main():
    a, b, x = li_input()

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


main()

Submission status: Accepted

Solution code:
a, b, x = list(map(int, input().split()))
ans = max((b//x)-((a-1)//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:
a, b, x = map(int, input().split())
def cal(n, x):
    if n== -1:
        return 0
    else:
        return n // x + 1
print(cal(b, x) - cal(a-1, x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

def f(x, y):
    r = y//x + 1
    return r
    
ans = f(x, b) - f(x, a-1)

print(ans)

Submission status: Accepted

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

A=a//x
B=b//x
C=0
if a%x==0:
    C+=1
print(B-A+C)

Submission status: Accepted

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

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    start = -(-a // x)
    end = b // x
    #print(start, end)
    if start <= end:
        ans = end - start + 1
    else:
        ans = 0
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def abc(n,x):
    if(n==-1):
        return 0
    else:
        return n//x+1
a,b,x = map(int,input().split())
print(abc(b,x)-abc(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:
from math import floor
a,b,x = map(int, input().split())
if a == 0:
    na = -1
elif a < x:
    na = 0
else:
    if a % x == 0:
        na = a//x-1
    else:
        na = a//x
nb = b//x
print(nb-na)

Submission status: Accepted

Solution code:

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

    ans=(b - a+1)//x
    amari = (b-a+1)%x

    if amari ==0:
        print(ans)
        exit()
    if a%x ==0:
        ans+=1
    elif amari > x- (a%x):
        ans+=1

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

f=0

if b%c==0 and a%c==0:
    f+=1

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

Submission status: Accepted

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

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

last = b - (b % x)

if first == last:
    ans = 1
else:
    ans = (last - first - 1) // x + 2
print(ans)

Submission status: Accepted

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

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

print(f_n(b,z)-f_n(a-1,z))

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:
from math import floor, ceil
a, b, x = list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input().split()
a=int(s[0])
b=int(s[1])
c=int(s[2])
print(b//c-(a-1)//c)

Submission status: Accepted

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

start = a
end = b + 1
if a % x != 0:
    start += x - a % x
ans = len(range(start, end, x))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from decimal import Decimal
a, b, x = map(Decimal, input().split())
bx = (b/x)
aq, amod = divmod(a, x)
if a==0 or amod==0:
    print(int(bx-aq)+1)
else:
    print(int(bx-aq))

Submission status: Accepted

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

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

# これじゃ全然間に合わない…
# ans = 0
# for i in range(a, b+1):
#     if i % x == 0:
#         ans += 1
# print(ans)

all_num = b // x
lower_num = (a - 1) // x
print(all_num - lower_num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x=map(int,raw_input().split())
print b/x - (a-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:
a,b,x = [int(i) for i in input().split(' ')]
ans = b//x - a//x
if a%x==0:
    ans +=1
    """
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())
b1 = b // x
a1 = a // x
if a % x == 0:
    a1 -= 1
print(b1 - a1)

Submission status: Accepted

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

def f(n, x):
    if n >= 0:
        return (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())
print(b//x-~-a//x)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(zenbu - ika)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
val = [int(x) for x in input().split()]
res = (val[1]//val[2]-(val[0]-1)//val[2])
print(res)

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())
ansa=int((a-1)//x)+1
ansb=int(b//x)+1
ans=ansb-ansa
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

a,b,x = stdin.readline().rstrip().split()
count = 0
a_int = int(a)
b_int = int(b)
x_int = int(x)
count = (b_int // x_int) - ((a_int-1) // x_int)

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b, x = map(int, raw_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:
    s = a//x
else:
    s = a//x+1

t = b//x

print(t-s+1)

Submission status: Accepted

Solution code:
from collections import Counter


def getinputdata():
    # 配列初期化
    array_result = []

    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if (data != ""):

                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

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

# print(a, b, x)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil, floor
a, b, x = [int(elem) for elem in input().split(' ')]

lower_bound = a // x + min(1, a % x)
upper_bound = b // x
print(upper_bound - lower_bound + 1)

Submission status: Accepted

Solution code:
a, b, x = list(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())

k,l = a//x,b//x

if a%x==0: k-=1

print(l-k)

Submission status: Accepted

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

d = a//c
e = a%c
f = b//c

if e == 0:
    print(f-d+1)
else:
    print(f-d)

Submission status: Accepted

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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

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

    # See:
    # https://atcoder.jp/img/arc064/editorial.pdf
    fb = (b // x) + 1
    fa = ((a - 1) // x) + 1

    if a == 0:
        print(fb)
    else:
        print(fb - fa)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 048 B

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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());print(b//x-a//x+(a%x==0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

c = func(b, x) - func(a-1, x)
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
def f(n,x):
  #0以上n以下の整数のうち、xで割り切れるものの個数
  if n>=0:
    return n//x + 1
  elif n==-1:
    return 0
a,b,x = [int(i) for i in input().split()]
print(f(b,x)-f(a-1,x))

Submission status: Accepted

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

print(b_cnt - a_cnt)

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:
from math import ceil
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 == 0:
   n_a = 0
   ans += 1
else:
   n_a = (a-1)//x

n_b = b//x

ans += n_b-n_a
print(ans)

Submission status: Accepted

Solution code:

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

u = b // x
l = (a + x - 1) // x

print(u - l + 1)

Submission status: Accepted

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

    ans = 0
    if a == 0:
        # 割り切れる
        n_a = 0
        ans += 1
    else:
        # a未満で割り切れるものを除外する
        n_a = (a - 1) // x
    n_b = b // x
    ans += n_b - n_a

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input().split()
a = int(S[0])
b = int(S[1])
x = int(S[2])
def func(n, x): 
    ans=0
    if n>=0:
        ans+=(n//x)+1
    else:
        ans=0
    return int(ans)

answer = func(b, x) - func(a-1, x)
print(answer)

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, raw_input().split())

i = a
count = 0
count_b = 0
count_a = 0

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


print count_b - count_a

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 python

a,b,x=list( int(i) for i in input().split() )
count=0

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

Submission status: Accepted

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

total = b // x

if a == 0:
  print(total + 1)
elif a >= x:
  ex = (a-1) // x
  print(total - ex)
else:
  print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,x=[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())
if a==0:
    sum = b//x+1
else:
    sum = b//x-(a-1)//x

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    A,B,C = map(int, input().split())
    result = B // C
    result -= A // C
    if (A % C == 0):
        result += 1
    print (result)

Submission status: Accepted

Solution code:
import sys

for inputline in [inputline.strip() for inputline in sys.stdin]:
	a, b, x = map(int, inputline.split())
	print (b/x)-((a-1)/x)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
a, b, 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.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


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


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


def read_str():
    return input()


def solve(a, b, x):
    if a > 0:
        return solve(0, b, x) - solve(0, a - 1, x)
    return b // x + 1


def main():
    a, b, x = read_int_list()
    res = solve(a, b, x)
    print(res)


main()

Submission status: Accepted

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

n = b / x
m = a / x
if a % x == 0:
	print n - m + 1
else:
	print n - m

Submission status: Accepted

Solution code:
from collections import defaultdict


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 = list(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:
import math

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

aan = math.floor(a // x)
ban = math.floor(b // x)

ans = ban - aan
if a % x == 0:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

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

Submission status: Accepted

Solution code:
import sys
import math
from functools import reduce

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def f(n1, n2):
    if n1 >= 0:
        return n1//n2+1
    else:
        return 0

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

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B, X = list(map(int, input().split()))
C = (A//X+(1 if A%X else 0))*X
if B < C:
	print(0)
else:
	print(1+(B-C)//X)

Submission status: Accepted

Solution code:
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

qa = a // x
qb = b // x
ra = a % x
rb = b % x
res = qb - qa
if ra == 0:
    res += 1

print(res)

Submission status: Accepted

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

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

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

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:
# -*- coding:utf-8 -*-
import math
import sys
a, b, x = map(int,input().split())
"""
if a == b:
    if a%x == 0:
        print(1)
    else:
        print(0)
    sys.exit()
"""
if a%x == 0:
    ans= b // x - a // x + 1
else:    
    ans= b // x - a // x

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(counter)

Submission status: Accepted

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