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

Submission status: Accepted

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

Submission status: Accepted

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

p = a//x
r = a%x
q = b//x
s = b%x

if r == 0:
    print(q - p + 1)
else:
    print(q - p)

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:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


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


print(main())

Submission status: Accepted

Solution code:
def main():
    a, b, x = map(int, input().split())
    ans = (b // x) - (a // x)
    if a % x == 0:
        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, 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:
from math import *
a, b, x = map(int, raw_input().split())
print (b / x + 1) - ((a - 1) / x + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC048B

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

Submission status: Accepted

Solution code:
s = input().split(" ")
x=int(s[0])
z=int(s[2])
y=int(s[1])//int(s[2])
if x%z==0:
    x=x//z
else:
    x=x//z+1
print(y-x+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: UTF-8

import math


if __name__ == "__main__":
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	x = data[2]
	if a%x == 0:
		print((b-a)//x+1)
	else:
		if x > b:
			print("0")
		else: 
			if x < a:
				print((data[1]-(a+(x-a%x)))//data[2]+1)
			else:
				print((data[1]-data[2])//data[2]+1)

Submission status: Accepted

Solution code:
import sys

def f(num,div):
 if num==-1:
  return 0
 return num/div+1

A,B,D = map(int, raw_input().split())

num1=f(A-1,D)
num2=f(B,D)

print num2-num1

Submission status: Accepted

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

B=(b//x)*x
if B>=A:
    print((B-A)//x+1)
else:
    print(0)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from decimal import Decimal
# round=lambda x:(x*2+1)//2
a,b,c=[int(i) for i in input().split()]
num1=(Decimal(b)/Decimal(c))
if(a%c==0):
    num2=int(Decimal(a)/Decimal(c))-1
else:
    num2=int(Decimal(a)/Decimal(c))

print(int(num1-num2))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
n,m,x = map(int,stdin.readline().split())
print m/x - (n-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())
 
def count(num1, num2):
  return num1 // num2
 
c = count(b, x)
d = count(a-1, x)
 
ans = c-d
print(ans)

Submission status: Accepted

Solution code:
# problem B
import math as math

nums = list(map(int, input().split()))

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

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

ans = x2 - x1
print(ans)

Submission status: Accepted

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


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


print(ans)

Submission status: Accepted

Solution code:
import sys

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

if a == 0 and b == 0:
    print(1)
    sys.exit()

elif a == 0 or b == 0:
    print(c + 1)
    sys.exit()

print(c - d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        a, b, x = line.rstrip("\n").split(" ", 3)
        a = int(a)
        b = int(b)
        x = int(x)

        start_index, start_reminder = divmod(a, x)
        end_index, end_reminder = divmod(b, x)

        result = end_index - start_index
        if a == 0 or start_reminder == 0:
            result += 1
        print result

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
a,b,x=map(long,raw_input().split())
c=int(a/x)
if(a%x!=0):
    c=c+1
e=int(b/x)
print e-c+1

Submission status: Accepted

Solution code:
# coding: utf-8
"""Between a and b ...

@author: Liz
@modified: 12-04-2016

"""

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


def solve():

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

print(solve())

Submission status: Accepted

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

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


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = list(map(int, input().split()))
a1 =  int(a // c)  
if a % c == 0:
    r = 1
else :
    r = 0

b1 = int(b // c)
v = int(b1 - a1 +r)

print(v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ini=map(int, raw_input().split())

if ini[0]%ini[2]==0:
	print ini[1]/ini[2]-ini[0]/ini[2]+1
else:
	print ini[1]/ini[2]-ini[0]/ini[2]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math;
a,b,x = map(long, raw_input().split());
if(a%x == 0):
    a-=1;
A = long(math.ceil(a/x));
B = long(b//x);
print(B-A);

Submission status: Accepted

Solution code:
import math
st = input().split()
a = int(st[0])
b = int(st[1])
x = int(st[2])

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

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

l = list(map(int, input().split()))
num = 0;

num = (l[1]//l[2]) - ((l[0]-1)//l[2])
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#coding:utf-8
import math
import string
import time
import fractions


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

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

Submission status: Accepted

Solution code:
# get line input split by space
def getLnInput():
    return input().split()


def main():
    a, b, x = list(map(int, getLnInput()))
    print(b // x - (a - 1) // x)
    return


main()

Submission status: Accepted

Solution code:

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

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

r = b // x
l = a // x

ans += r - l

print(ans)

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

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

print ans

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python2
# -*- coding: utf-8 -*-

import sys

def rl(proc=None):
    if proc is not None:
        return proc(sys.stdin.readline())
    else:
        return sys.stdin.readline().rstrip()

def srl(proc=None):
    if proc is not None:
        return map(proc, rl().split())
    else:
        return rl().split()

def main():
    a, b, x = srl(int)
    s = a / x * x
    if s < a:
        s += x
    if s > b:
        print 0
        return
    print (b - s) / x + 1


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a, b, c = [int(w) for w in raw_input().split()]
print b // c - (a - 1) // c

Submission status: Runtime Error

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

    print((b - a) // x)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(a:b):
  if i%2==0:
    s+=1
  
print(s)

Submission status: Runtime Error

Solution code:
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")

	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1

	return n[head_zeros:]

def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

def bigint_plus(a, b):
	a = str(a)
	b = str(b)

	d = max([len(a), len(b)])
	a = '0' * (d - len(a)) + a
	b = '0' * (d - len(b)) + b

	ans = ""
	carry = 0
	for i in range(d):
		s = int(a[-i-1]) + int(b[-i-1]) + carry
		carry = s // 10
		ans = str(s % 10) + ans
	else:
		if carry:
			ans = str(carry) + ans

	return ans

def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

a, b, x = [n for n in input().split(" ")]
c1 = bigint_divide(b, x)
if int(a) == 0:
  c2 = 0
else:
  c2 = bigint_divide(bigint_minus(a, 1), x)

if int(a) == 0:
  print(bigint_plus(bigint_minus(c1, c2), 1))
else:
  print(bigint_minus(c1, c2))

Submission status: Runtime Error

Solution code:
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")

	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1

	return n[head_zeros:]

def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

def bigint_plus(a, b):
	a = str(a)
	b = str(b)

	d = max([len(a), len(b)])
	a = '0' * (d - len(a)) + a
	b = '0' * (d - len(b)) + b

	ans = ""
	carry = 0
	for i in range(d):
		s = int(a[-i-1]) + int(b[-i-1]) + carry
		carry = s // 10
		ans = str(s % 10) + ans
	else:
		if carry:
			ans = str(carry) + ans

	return ans

def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

a, b, x = [n for n in input().split(" ")]
c1 = bigint_divide(b, x)
if int(a) == 0:
  c2 = 0
else:
  c2 = bigint_divide(bigint_minus(a, 1), x)

print(bigint_plus(bigint_minus(c1, c2), 1))

Submission status: Runtime Error

Solution code:
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")

	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1

	return n[head_zeros:]

def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

a, b, x = [n for n in input().split(" ")]
c1 = bigint_divide(b, x)
c2 = bigint_divide(bigint_minus(a, 1), x)
print(bigint_minus(c1, c2))

Submission status: Runtime Error

Solution code:
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")

	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1

	return n[head_zeros:]

def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

a, b, x = [n for n in input().split(" ")]
c1 = bigint_divide(b, x, 1)
c2 = bigint_divide(bigint_minus(a, 1), x, 1)
print(bigint_minus(c1, c2))

Submission status: Runtime Error

Solution code:
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")

	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1

	return n[head_zeros:]

def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

a, b, x = [n for n in input().split(" ")]
c1 = bigint_divide(b, x, 1)
c2 = bigint_divide(bigint_minus(a, 1), x, 1)
print(bigint_minus(c1, c2)

Submission status: Runtime Error

Solution code:
3 4 240
60 90 120
80 150 80 150

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l = input().replace(' ','')
print(l[0]+l[7]+l[-7])

Submission status: Runtime Error

Solution code:
import numpy as np
a, b, x = map(int, input().split())
A = np.arange(a,b+1)
print(np.sum(A % x == 0))

Submission status: Runtime Error

Solution code:
#coding: utf-8

N, X = (int(x) for x in input().split())
A = [int(x) for x in input().split()]

ret = 0
for i in range(N-1):
    if A[i] + A[i+1] > X:
        tmp = A[i] + A[i+1] - X
        ret += tmp
        A[i+1] -= min(A[i+1], tmp)


print(ret)

Submission status: Runtime Error

Solution code:
a,b,x = list(map(int,input_[0].split()))

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

    ans=B-A

print(ans)

Submission status: Runtime Error

Solution code:
import sys
def I_dont_know_what_to_do():
    a = long(input())
    b = long(input())
    c = int(input())

    if a < b:
        n = a
        a = b
        b = n

    s = (a - b + 2 - a % c - b % c) / c
    print(s)


I_dont_know_what_to_do()

Submission status: Runtime Error

Solution code:
def I_dont_know_what_to_do():
    a = long long int(input())
    b = long long int(input())
    c = int(input())

    if (a - b < 0)
        n = a
        a = b
        b = n

    s = (a - b + 2 - a % c - b % c) / c
    print(s)


I_dont_know_what_to_do()

Submission status: Runtime Error

Solution code:
# coding: utf-8

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

n = b - a - 1
# coding: utf-8

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

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

Submission status: Runtime Error

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__":

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

print(b//a+1)

Submission status: Runtime Error

Solution code:
a,b,x=map(int,input().split())
L=list(range(a,b+1))
L_2=[]
for i in L:
    if i % x != 0:
        continue
    L_2.append(i)
print(len(L_2))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ax = a // x
bx = math.ceil(b // x)

tar = ax - bx + 1
print(tar)

Submission status: Runtime Error

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

Submission status: Runtime Error

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


#切り捨て除算！！！！！！！

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import numpy as np
a,b,x = map(int,input().split())
Cnt = 0

A = np.array(range(a,b+1))
A = A%x
print(np.count_nonzero(A==0))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,x = map(int,input().split())
Rb = range(0,b+1,x)
Mb = max(Rb)//x
Ra = range(0,a,x)
Ma = max(Ra)//x

print(Mb - Ma)

Submission status: Runtime Error

Solution code:
a,b,x= map(int, input().split())
xb = b//x
xa = a//x
if a % x ==0:
    tx = 1

print(int(xb-xa+tx))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,x=map(int,input().split())
count=0
lst=[0]*(b+1)

for i in range(0,b+1):
    lst[i]=i//x
print(lst[b]-lst[a-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,x=map(int,input().split())
ans=0
if x==1:
  ans=b-(a-1)
else:
  for minnum in range(a,b+1):
 
    if minnum%x==0:
      #print(minnum)
      break
  
  for maxnum in reversed(range(a,b+1)):
    if maxnum%x==0:
      #print(maxnum)
      #print('pass')
      break
  if minnum==b:
    ans=0
  else:
    ans=maxnum//minnum
  #print('pass')
  #print(maxnum,minnum)

print(ans)
#print(ans)

Submission status: Runtime Error

Solution code:
print(n-m)

Submission status: Runtime Error

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: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    x = [int(i) for i in input().split()]
    a = x[0] // x[2]
    b = x[1] // x[1]
    
    print(b-a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 0
for i in range(a,b+1):
  if i % x==0 :ans. +=1
    
print(ans)

Submission status: Runtime Error

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

r = 0

for i in xrange(a, b+1):
    if i % x ==0:
        r += 1

print(r)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
a, b, x = [int(x) for x in input().split()]
B = 1 + b // x
if a == 0:
    print(B)(
elif a % x == 0:
    A = 1 + a // x
    print(B - A + 1)
else:
    A = 1 + a // x
    print(B - A)

Submission status: Runtime Error

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


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

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

if begin > end:
    print(0)
else:
    print((end - begin) // x + 1)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,x=map(int,input().split())
n=b-a+1
l=[0]*(n+1)
init=a
for i in range(1,n+1):
    if init%x==0:
        l[i]=l[i-1]+1
    else:
        l[i]=l[i-1]
    init+=1

print(l[-1]-l[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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