Problem:


Score : 200 points

Problem Statement

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

Constraints

0 ≤ a ≤ b ≤ 10^{18}

1 ≤ x ≤ 10^{18}

Input

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

a b x

Output

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

Sample Input 1

4 8 2

Sample Output 1

3

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

Sample Input 2

0 5 1

Sample Output 2

6

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

Sample Input 3

9 9 2

Sample Output 3

0

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

Sample Input 4

1 1000000000000000000 3

Sample Output 4

333333333333333333

Watch out for integer overflows.



Sample input:
4 8 2


Sample output:
3

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

    print(res)
    
main()

Submission status: Wrong Answer

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

cnt = 0
for i in range(1, int(1e18)):
  if a <= x*i and x*i <= b:
    cnt += 1
  elif b <= x*i:
    break
    
print(cnt)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

#a<=n<=b

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

cnt = int(f(b) - f(a-1))

print(cnt)

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
a,b,x = map(int,input().split())
c = 0
print(sum([1 for i in range(4,8+1) if i % x == 0]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,s,d=map(int,input().split())
l=-(-a)//d
u=s//d
print(u-l+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

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

ini = math.ceil(a / x)
end = b // x
print(end - ini + 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[2],x[0])),x[1]+1):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = (x[1]-b)//x[2] + 1
if(x[0]==0):
    c += 1
print(c)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[2],x[0])),x[1]+1):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = (x[1]-b)//x[2] + 1
print(c)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[0],x[2])),x[1]):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = ((x[1]-b)//x[2]) + 1
if x[0]==x[1]==x[2]:
    print(1)
else:
    print(c)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[0],x[2])),x[1]):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = ((x[1]-b)//x[2]) + 1
if a==b==c:
    print(1)
else:
    print(c)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[0],x[2])),x[1]):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = ((x[1]-b)//x[2]) + 1
print(c)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[0],x[2])),x[1]):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = (x[1]-b)//x[2] + 1
print(c)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(min(x[1],max(x[0],x[2])),x[1]+1):
    if i % x[2] ==0:
        a = 1
        b=i        
        break
c = (x[1]-b)//x[2] + 1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    a, b, x = Scanner.map_int()
    if a == 0 and b == 0:
        print(0)
        return
    print(b // x - (max(0, (a - 1)) // x) + (a == 0))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    a, b, x = Scanner.map_int()
    if a == 0 and b == 0:
        print(0)
        return
    print(b // x - (max(0, (a - 1)) // x))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    a, b, x = Scanner.map_int()
    if a == 0 and b == 0:
        print(0)
        return
    print(b // x - ((a - 1) // x))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

k-=k2
if k<=0:
  print(0)
else:
  print(k//x+1)

Submission status: Wrong Answer

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

k-=k2
if k<=0:
  print(0)
else:
  print(k//x+1)

Submission status: Wrong Answer

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

k-=k2
if k<0:
  print(0)
else:
  print(k//x+1)

Submission status: Wrong Answer

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

k-=k2
if k<0:
  print(0)
else:
  print(k//x+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#print(a)
#print(b)

amari = a%x
a2 = amari
b2 = b-(a-amari)

#print(a2)
#print(b2)

print((b2-a2)//x+1)

Submission status: Wrong Answer

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

#print(a)
#print(b)

amari = a%x
a2 = amari
b2 = b-(a-amari)

#print(a2)
#print(b2)

print((b2-a2)//x)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()

p=ceil(a/x)
q=b//x

print(q-p+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()

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

p=ceil(a/x)
q=b//x

if q-p+1<0:
    print(0)
    exit()
print(q-p+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()

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

p=ceil(a/x)
q=floor(b/x)
if q-p+1<0:
    print(0)
    exit()
print(q-p+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()

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

p=ceil(a/x)
q=floor(b/x)
if q-p+1<0:
    print(0)
    exit()
print(p,q,q-p+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()

p=ceil(a/x)
q=floor(b/x)
if q-p+1<0:
    print(0)
    exit()
print(q-p+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
#ABC048-B
a,b,x=mii()

p=ceil(a/x)
q=floor(b/x)
print(q-p+1)

Submission status: Wrong Answer

Solution code:
def main(a, b, x):
    if x > b:
        return 0
    elif x == b:
        return 1

    minimum, maximum = None, None

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

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

    if minimum != None or maximum != None:
        if minimum != None and maximum != None:
            # 普通の / 除算だと3で割ったときに大きくずれる。
            return (maximum - minimum) // x + 1
        else:
            return 1
    else:
        return 0


def main_b(a, b, x):
    """解説を読んだ。単純なことだった。
    """
    def count(n):
        if n == -1:
            return 0
        else:
            return n // x + 1

    return count(b) - count(a)


if __name__ == "__main__":
    a, b, x = [int(x) for x in input().split()]
    print(main_b(a, b, x))

Submission status: Wrong Answer

Solution code:
def main(a, b, x):
    if x > b:
        return 0
    elif x == b:
        return 1

    minimum, maximum = None, None

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

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

    if minimum != None or maximum != None:
        if minimum != None and maximum != None:
            # 普通の / 除算だと3で割ったときに大きくずれる。
            return (maximum - minimum) // x + 1
        else:
            return 1
    else:
        return 0


if __name__ == "__main__":
    a, b, x = [int(x) for x in input().split()]
    print(main(a, b, x))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def f(n, x):
    ans = 0
    if (0 <= n):
        ans = n // x
    return ans


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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