Problem:
 Score : 200 points    Problem Statement In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.  It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.  Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.  Assume also that the depth of the snow cover is always at least 1 meter.      Constraints  1 \leq a < b < 499500(=1+2+3+...+999)  All values in input are integers.  There is no input that contradicts the assumption.         Input Input is given from Standard Input in the following format:  a  b       Output If the depth of the snow cover is x meters, print x as an integer.        Sample Input 1 8 13      Sample Output 1 2  The heights of the two towers are 10 meters and 15 meters, respectively.
Thus, we can see that the depth of the snow cover is 2 meters.       Sample Input 2 54 65      Sample Output 2 1

Solution (Python):
a,b=map(int,input().split())
total=0
for i in range(b-a+1):
  total+=i
print(total-b)

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

    h = 0
    old_h = 0
    for i in range(1, 1000):
        h += i

        if (h - old_h) == (b - a):
            print(h - b)
            exit()

        old_h = h

if __name__ == "__main__":
    main()

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

    h = 0
    ans = 0
    for i in range(1, 1000):
        h += i

        if h > b:
            b_h = h - b
            if a_h == b_h:
                ans = b_h
                break
        if h > a:
            a_h = h - a

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
a, b = map(int, input().split())
y = []
p = 0

for i in range(1, 1000):
    p += i
    y.append(p)
    
c = b - a
for i in range(1, 999):
    if y[i] - y[i - 1] == c:
        print(y[i] - b)
        break
"""z = []
for i in range(499500):
    z.append([])
for i in range(499500):
    z[i] = list(map(lambda k: k - i - 1, y))"""
"""for x in range(1, 499501):
    for i in range(1, 999):
        if y[i] == b + x and y[i - 1] == a + x:
            print(x)
            break
    else:  
        continue  
    break  

"""for h in range(1, 499501):
    y = [y1 - w1 for (y1, w1) in zip(y, w)]
    x = 100 if a > 50 else 0
    k = min(y)
    for i in range(999):
        if i != 0:
            if b == y[i] and a == y[i - 1]:
                print(h)
                break
    else:  
        continue  
    break

Solution (Python):
a, b = map(int, input().split())
y = []
p = 0

for i in range(1, 1000):
    p += i
    y.append(p)
    
c = b - a
for i in range(1, 999):
    if y[i] - y[i - 1] == c:
        print(y[i] - b)
        break

Solution (Python):
a,b=map(int,input().split())
c=b-a
sum=0
for i in range(c+1):
    sum=sum+i
print(sum-b)

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

dif = b - a
s = 0

for i in range(1,dif+1):
	s += i

ans = s - b
print(ans)

Solution (Python):



def main():
    a, b = map(int, raw_input().split())
    print(sum(range(b - a)) - a)


if __name__ == "__main__":
    main()

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

print (b - a) * (b - a + 1) / 2 - b

Solution (Python):
a, b = map(int, raw_input().split())
towers = [0] * 1000
for i in range(999):
	towers[i + 1] = towers[i] + 1 + i
diffs = [0] * 1000
for i in reversed(range(999)):
	diffs[i] = towers[i + 1] - towers[i]
target_idx = diffs.index(b - a)
print towers[target_idx] - a

Solution (Python):
a, b = map(int, raw_input().split())
towers = [0] * 1000
for i in range(999):
	towers[i + 1] = towers[i] + 1 + i
diffs = [0] * 1000
for i in reversed(range(999)):
	diffs[i] = towers[i + 1] - towers[i]
target_idx = diffs.index(b - a)
print towers[target_idx] - a

Solution (Python):
a,b=(int(i) for i in input().split(' '))
n=b-a
s=0
for i in range(n):
  s+=i
print(s-a)

Solution (Python):
a, b = map(int, input().split())
d = b - a
print(sum(list(range(d))) - a)

Solution (Python):

print((lambda m: sum([i for i in range(m[1] - m[0])]) - m[0])(list(map(int, input().split()))))

Solution (Python):
a, b = map(int,input().split())
c = b-a
ha = c*(c-1)//2
print(ha-a)

Solution (Python):
a, b = map(int, input().split())
print(sum(range(b-a))-a)

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

d = b - a

m = 0
for i in range(d):
    m = m + i

print(m - a)

Solution (Python):
a, b = map(int, input().split())
print((b-a)*(b-a+1)//2-b)

Solution (Python):
a, b = map(int, input().split())
print(sum(range(b-a+1))-b)

Solution (Python):
a,b=map (int,input ().split ())
s=0
for i in range (b-a-1) :
  s+=i+1
print (s-a)

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

c = b - a
d = c

while c > 0:
  c = c - 1
  d += c
  
print(d-b)

Solution (Python):
a,b=map(int,input().split())
c=b-a
ans=int(c*(c+1)/2-b)
print(ans)

Solution (Python):


a,b  = map(int, input().split())
n=b-a

print(int(n*(n+1)/2-b))

Solution (Python):
a,b, = map(int,input().split())
nums=[1]
for i in range(1, 999):
  nums.append(nums[i-1]+i+1)

print(nums[b-a-1]-b)

Solution (Python):
a,b = (int(_) for _ in input().split())

sum = 0
for i in range(1,b-a):
    sum += i
    
print(sum-a)

Solution (Python):
a, b = [int(x) for x in input().split()]
n = b - a
wa = sum(range(n+1))
print(wa - b)

Solution (Python):
a,b = map(int,input().split())
x = 0
for i in range(b-a+1):
    x += i
print(x - b)

Solution (Python):
def run(a, b):
    h1 = 0
    h2 = 0
    for i in range(1, 1000):
        h1 += i-1
        h2 += i
        if (h1 - a) == (h2 - b):
            return h1 - a


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


if __name__ == '__main__':
    main()

Solution (Python):
a,b = map(int,input().split())
n = b-a
d = 0
for i in range(1,n):
  d += i
print(d-a)

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

c = b-a
cnt = 0
for i in range(c-1):
    cnt += i+1
print(cnt-a)

Solution (Python):
a,b = map(int, input().split())
l = [1]
for x in range(2, 1000):
    l.append(l[x-2]+x)

for i in l:
    if a < i and b < l[l.index(i) + 1]:
        if i - a == l[l.index(i) + 1] - b:
            print(i - a)
            break

Solution (Python):
a, b = map(int, input().split())
c = list(range(1, b-a))
print(sum(c)-a)

Solution (Python):
a,b =map(int,input().split())
s = b-a
s = int(s*(s+1)/2-b)
print(s)

Solution (Python):
a,b = map(int, input().split())
n = b - a
ans = sum(range(1,n+1)) - b
print(ans)

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

h = [0]
for i in range(1, 1000):
    h.append(i+h[i-1])

print(h[b-a]-b)

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

long = 0        
for i in range(b-a+1):
    long += i
    
print(long - b)

Solution (Python):
a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))

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

s = 0

for i in range(1000):
    s = s + i
    if i == b - a:
        break

print(s - b)

Solution (Python):
a,b=map(int,input().split())
print((b-a)*(b-a-1)//2-a)

Solution (Python):
a,b=map(int,input().split())
sum=0
for i in range(1000):
    sum=sum+i
    if i==b-a:
        break
print(sum-b)

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

diff = b - a
ans = sum([i for i in range(1, diff)]) - a
print(ans)

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

d = b - a
print(sum([i for i in range(d-1, 0, -1)]) - a)

Solution (Python):
a,b = map(int, input().split())
n = b - a
ans = 0
for i in range(1,n):
    ans += i
print(ans-a)

Solution (Python):
a,b=map(int, input().split())
print(int((b-a)*(b-a+1)/2-b))

Solution (Python):
a,b = map(int,input().split())
east_tower_num = b-a
east_tower_high = 0

for i in range(1,east_tower_num+1):
    east_tower_high += i

print(east_tower_high - b)

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

diff = b - a

def func(x):
    ret = 0
    while x != 0:
        ret += x
        x -= 1
    return ret

print(func(diff) - b)

Solution (Python):
a,b=map(int,input().split())
n=b-a
print(int(n*(n+1)/2-b))

Solution (Python):
a,b=map(int, input().split())
print(int((b-a)*(b-a+1)/2-b))

Solution (Python):

a, b = map(int, input().split())
h = [ 1 ]
for i in range(2, 1000):
    h += [ h[-1] + i ]
for h1, h2 in zip(h, h[1 :]):
    if h1 - a == h2 - b:
        print(h1 - a)
        break

Solution (Python):
a, b = map(int, input().split())
print(round((b-a)*(b-a+1)/2-b))

Solution (Python):
a,b = map(int,input().split())
r = b-a
num = 0
for i in range(r+1):
    num +=i
print(num-b)

Solution (Python):
a,b = map(int,input().split())
print(int(1/2*(a**2-a-2*a*b-b+b**2)))

Solution (Python):
a,b = map(int,input().split())
h = ((b-a-1)*(b-a)//2)-a
print(h)

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

def main():
    delta = B - A
    left_height = sum(range(1, delta))
    print(left_height - A)

if __name__ == "__main__":
    main()

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

for t_a in range(1, 1000):
    h_a = sum([t_part for t_part in range(t_a + 1)])
    s_a = h_a - a
    if s_a >= 1:
        t_b = t_a + 1
        h_b = sum([t_part for t_part in range(t_b + 1)])
        s_b = h_b - b
        if s_b >= 1:
            if s_a == s_b:
                print(s_a)
                exit()

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

val = 0
for i in range(1, b - a):
    val += i

print(val - a)

Solution (Python):
import sys

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

val = 0
for i in range(1, b - a):
    val += i

print(val - a)

Solution (Python):
import sys

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

val = 0
for i in range(1, sys.maxsize):
    if i == b - a:
        break

    val += i

print(val - a)

Solution (Python):
a,b = map(int, input().split())
delta = b-a
sum=0
index=0
while index<b-a:
    sum+=index
    index+=1
print(sum-a)

Solution (Python):
def Asum(n):
    ans = 0
    while n != 0:
        ans += n
        n-=1
    return ans

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

high_tower = Asum(b-a)

print(high_tower - b)

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

Solution (Python):
a,b=map(int,input().split( ))
n=b-a-1
ans=n*(n+1)//2
print(ans-a)

Solution (Python):
a,b = map(int,input().split())
k = b-a
h = 0
for i in range(1,k):
    h += i
print(h-a)

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

sa=abs(a-b)
mi=min(a,b)

no3=sum(i for i in range(1,sa))
print(no3-mi)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())
atoz = [chr(i) for i in range(97,97+26)]

a,b = inpl()
print((b-a)*(b-a+1)//2-b)

Solution (Python):
a,b=map(int,input().split())
n=b-a-1
h=n*(n+1)/2
print(int(h-a))

Solution (Python):
a,b = map(int, input().split())
ans = 0
for i in range(b-a+1):
    ans += i
print(ans-b)

Solution (Python):
headData = [ int(n) for n in input().split()]
a = headData[0]
b = headData[1]
diff = b-a
lowerTowerHeight = sum(range(1, diff))
print(lowerTowerHeight-a)

Solution (Python):
a,b = map(int,input().split())
c=0
for i in range(1,b-a+1):
    c +=i
print(c-b)

Solution (Python):
A,B = list(map(int,input().split()))
for i in range(B-A):
    A -= i
print(abs(A))

Solution (Python):
a, b = map(int, raw_input().split())
d = b - a
monument = d * (d + 1) / 2
print monument - b

Solution (Python):
a, b = (int(i) for i in input().split())
c = b - a
d = 0
for i in range(c):
  d += i
x = d - a
print(x)

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

A = [1]
for i in range(2,1000):
    tmp = A[-1] + i
    A.append(tmp)

dif = b-a
pos = dif - 2

print(A[pos] - a)

Solution (Python):
a, b = map(int, input().split())
t = b-a
print(int(t*(t+1)/2)-b)

Solution (Python):
a,b = list(map(int,input().split(" ")))
c = b - a
print(sum(list(range(1,c+1)))-b)

Solution (Python):

a,b=map(int,input().split())
an=0
ans=0
for i in range(1,999):
    an+=i
    if an-a==an+i+1-b:
        ans=an-a
        break

    
   
print(ans)

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

num = b - a
h = 0
for i in range(num):
    h += i

print(h-a)

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

print(sum([x for x in range(b-a)]) - a)

Solution (Python):

"""
B - Stone Monument
https://abc099.contest.atcoder.jp/tasks/abc099_b

"""
import sys
from sys import stdin
input = stdin.readline



def solve(a, b):
    diff = b - a
    return (1 + diff) * diff // 2 - b


def main(args):
    a, b = map(int, input().split())
    ans = solve(a, b)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

def m(x):
    return x*(x+1)/2

print(int(m(b-a-1)-a))

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

Solution (Python):
a,b=map(int,input().split())
N=b-a
print(sum(list(range(1,N+1)))-b)

Solution (Python):
a,b = map(int,input().split())
h = 0
H = []
for i in range(1,1000) :
    h += i
    H.append(h)

print(H[b-a-1]-b)

Solution (Python):
a, b =map(int,input().split())
n=b-a
total=0
while n>0:
    total+=n
    n-=1
print (total-b)

Solution (Python):
a, b = map(int, input().split())
ans = 0
for i in range(1, b - a):
    ans += i
print(ans - a)

Solution (Python):
a,b = map(int, input().split())
ans = (b - a) * (b - a + 1) // 2 - b
print(ans)

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




n = b - a
x = n * (n - 1) // 2 - a
print(x)

Solution (Python):
a, b = map(int,input().split())
n = (b - a - 1)
sum = 0
for i in range(1, n+1):
    sum += i
print(sum - a)

Solution (Python):
a, b = map(int, input().split())
print(round((b-a)*(b-a+1)/2-b))

Solution (Python):
a,b=(int(i) for i in input().split())
c = b - a
zako = 0
for d in range(c):
    zako += d + 1
print(zako-b)

Solution (Python):
x, y = map(int, input().split())
a = y-x
b = (1+a)*a/2

print(int(b-y))

Solution (Python):
a, b = map(int, input().split())
diff = b - a
l = []
sum = 0
for i in range(1, diff + 1):
    sum += i
    l.append(sum)
print(l[-1] - b)

Solution (Python):
a, b = map(int, input().split())
l = [0]
for i in range(1, 1000):
  l.append(l[-1] + i)
print(l[b - a] - b)

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

k = b-a-1

ans = 0

for i in range(k):
    ans += i+1
ans -= a

print(ans)

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

d = b-a

print((d+1)*d//2 - b)

Solution (Python):


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]


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


def solve(a, b):
    pass


def main():
    a, b = map(int, input().split())
    ans = 0
    for i in range(b - a):
        ans += i
    print(ans - a)

if __name__ == '__main__':
    main()

Solution (Python):
a,b = map(int,input().split())
d = b-a
b_len = d*(d+1)//2
print(b_len - b)

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

diff = b-a

west = sum([i for i in range(diff+1)])

print(west-b)

Solution (Python):
a, b = map(int, input().split())
print(int((0.5)*(b-a)*(b-a+1)-b))

Solution (Python):
N = list(map(int, input().split()))

S = N[1] - N[0]
r=0
for s in range(S):
    r += (s+1)

print(-(N[1]- r))

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

Solution (Python):
A, B = map(int, input().split())
a, b, n = 1, 3, 3

for _ in range(1000):
    if B - A == b - a:
        print(a - A)
        break
    a = b
    b += n
    n += 1

Solution (Python):
a, b = map(int, input().split())
s = b - a
t = (s * (s + 1)) // 2
print(t - b)

Solution (Python):
x = input().split()
a = int(x[0])
b = int(x[1])
c = sum([a for a in range(b-a+1)])
print(c-b)

Solution (Python):
from itertools import accumulate
a, b = map(int, input().split())
tower = list(accumulate(range(1, 1000)))
ans = tower[b - a - 1] - b
print(ans)

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

s = 0
for i in range(b - a):
    s += i

print(s - a)

Solution (Python):
a,b=map(int,input().split())
print((b-a)*(b-a-1)//2-a)

Solution (Python):
a, b = map(int, input().split())
print(((b - a) * ((b - a) + 1) // 2) - b)

Solution (Python):


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

x = b-a
deep = (1+x)*x/2-b
print(int(deep))

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

import numpy as np
momunents = list(np.cumsum([i for i in range(1, 1000)]))
for i in range(999):
    if momunents[i] - a == momunents[i+1] - b:
        print(momunents[i] - a)
        break

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

n = b-a

bt = n*(n+1)//2



print(bt-b)

Solution (Python):
a,b=map(int,input().split())
print(sum(range(1,b-a))-a)

Solution (Python):
a, b = map(int, input().split())
d = b - a
print(d * (d + 1) // 2 - b)

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

c = b - a

d= 0
for i in range(c):
  d = d + i

e = d - a

print(e)

Solution (Python):
a, b = map(int, input().split())
N = (b - a) * (1 + b - a) / 2 - b
print(int(N))

Solution (Python):
import sys

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

dif = b - a

print(int((1+dif)*dif/2-b))

Solution (Python):
a, b = [int(m) for m in input().split(" ")]

height_sub = b - a
print(int((height_sub + 1)*height_sub/2 - b))

Solution (Python):
a, b = list(map(int, input().split()))
diff = b - a
print(sum([x for x in range(diff)]) - a)

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

print(int((b - a) * (b - a + 1) / 2 - b))

Solution (Python):
def getinputdata():

    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

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

arr=[]
mysum=0
for i in range(1,1000):
    
    mysum+=i
    arr.append(mysum)

for i in range(1,999):
    
    if arr[i]-arr[i-1]==b-a:
        
        print(arr[i]-b)
        break

Solution (Python):
a,b = map(int, input().split())
i = b-a-1
print(sum(range(1, i+1)) - a)

Solution (Python):
a, b = map(int, input().split())
d = b - a
print(int((d*(d+1)/2)-b))

Solution (Python):
a,b = map(int,input().split())
sa = abs(a-b)
sum = 0
for i in range(sa):
    sum += i
print(sum - a)

Solution (Python):
a,b = map(int,input().rstrip().split())
sa = b-a

sum =0
for i in range(sa):
    sum+=i
print(sum - a)

Solution (Python):
a,b = map(int, input().split())
c = b-a
d = 0

for i in range(1,c):
    d = i + d

print(d - a)

Solution (Python):
a,b=map(int,input().split())
print(sum([i for i in range(1,b-a)])-a)

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

t = b - a 
res = (t * t / 2.0) + (t / 2.0) - b 

print(int(res))

Solution (Python):


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

    east_tree_hight = 0
    for i in range(1, b-a+1):
        east_tree_hight += i

    snow_hight = east_tree_hight - b
    print(snow_hight)


if __name__ == '__main__':
    main()

Solution (Python):
a, b = map(int, input().split())
c = b - a
ah = 0
for i in range(c - 1):
	ah += i + 1
print(ah - a)

Solution (Python):
a, b = list(map(int, input().split()))
answer = (b - a) * (b - a + 1) / 2 - b
print(int(answer))

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

print(int((b-a-1)*(b-a)/2-a))

Solution (Python):
a, b = map(int, input().split())
n = b - a
print(int((n * (n + 1)) / 2 - b))

Solution (Python):
a, b = list(map(int, input().split()))
n = b - a
x = n*(n+1) // 2 - b
print(x)

Solution (Python):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
s = int(((b-a)*((b-a)+1))/2 - b)
print(s)

Solution (Python):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
X = b - a 
s = int((X*(X+1))/2 - b)
print(s)

Solution (Python):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
num = 0
for i in range(1,b-a+1):
	num += i
print(num-b)

Solution (Python):
n=input().split(" ")
a=int(n[0])
b=int(n[1])
c=b-a
print (int(((c*(c+1))/2)-b))

Solution (Python):
a, b = map(int, input().split(" "))
N = b - a
l = 0
for i in range(1, N+1):
  l += i
print(l- b)

Solution (Python):
"""
https://abc099.contest.atcoder.jp/tasks/abc099_b
"""
[a,b]=[int(i) for i in input().split()]
c=0
for i in range(b-a):
    c=c+i
print(c-a)

Solution (Python):


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


ans = (b - a - 1) * (b - a) // 2 - a
print(ans)

Solution (Python):


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


columns = [(i ** 2 + i) // 2 for i in range(1, 1000)]

for i in range(998):
    ab = columns[i+1] - columns[i]
    
    if ab == b - a:
        print(columns[i] - a)
        exit()

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

c = b - a

cnt = 0
for i in range(1,c +1):
    cnt += i

print(cnt - b)

Solution (Python):
a, b = map(int, input().split())
print(int((b-a)*(b-a-1)/2 - a))

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

diff = b - a

print(sum(range(diff)) - a)

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

i=-a
for j in range(b-a):
    i=i+j
print(i)

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

index = b - a


height = 0
for i in range(index+1):
    height += i

print(height - b)

Solution (Python):
a,b=map(int, input().split(' '))
temp=0
for c in range(1,b-a+1):
    temp=temp+c
print(temp-b)

Solution (Python):
N= input().split()
a = int(N[0])
b = int(N[1])
c = b -a
p = 0
for i in range(0,c):
    p = i + p
    
print(p - a)

Solution (Python):


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

ha = 0
hb = 1

for i in range(1,1000):
    j = i + 1
    
    ha += i
    hb += j

    
    if (ha - a) == (hb - b):
        ans = ha - a
        break
    else:
        continue

print(ans)

Solution (Python):
a, b = (int(i) for i in input().split())
c = b - a
alen = 0
for ccc in range(0,c):
    alen = alen + ccc  
ans = alen - a
print(ans)

Solution (Python):
print((lambda a:(((a[1]-a[0]) * (a[1]-a[0]+1)) // 2) - a[1])(list(map(int, input().split()))))

Solution (Python):
a, b = map(int, input().split())
print(sum(range(b-a))-a)

Solution (Python):
a, b = map(int, input().split())
print(sum(range(b-a))-a)

Solution (Python):
a, b = map(int, raw_input().split())
t = b - a
print((t-1)*t//2 - a)

Solution (Python):
k = input()

s = k.index(" ")

a = int(k[0:s])

n = int(k[s+1:len(k)+1]) - a
t = 1
for i in range(2,n):
    t += i
print(t-a)

Solution (Python):
a,b=map(int,input().split())
c=b-a
d=c*(c+1)/2
print(int(d-b))

Solution (Python):

def main():
    a, b = [int(i) for i in input().split(' ')]


    print(sum(range(1, b - a + 1)) - b)
    

if __name__ == '__main__':
    main()

Solution (Python):

a,b=map(int,input().split())
d=b-a
b0=d*(d+1)/2
snow=b0-b
print(int(snow))

Solution (Python):
a, b = map(int, input().split())
x = b - a
z = x * (x - 1) // 2
print(z - a)

Solution (Python):
a, b = map(int, input().split())
print(sum(range(b-a))-a)

Solution (Python):
a, b = input().split(' ')
a, b = int(a), int(b)
diff = b - a
a_orig = sum([i for i in range(1, diff)])
snow = a_orig - a
print(snow)

Solution (Python):
l = input().split()

a = int(l[0])
b = int(l[1])

n = b - a

h = n * (n + 1) // 2

print(h-b)

Solution (Python):
a,b = map(int,input().split())
c = b-a
h = -a
for i in range(c):
	h = h + i
print(h)

Solution (Python):
if __name__ == '__main__':
    a, b = map(int, input().split(' '))
    sa = b - a
    wa = 0
    for i in range(1, sa):
        wa += i
    print(wa - a)

Solution (Python):
a,b = map(int,input().split())
c = [1]
n = 1
for i in range(2,1000):
    c.append(n + i)
    n += i
print(c[b-a-2]-a)

Solution (Python):
a, b = map(int, input().split())
diff = b-a
b_true = 0
for i in (range(1,diff+1)):
    b_true += i
print(b_true-b)

Solution (Python):
A, B = map(int, input().split())
d = B - A

h = 0
for i in range(1, d):
    h += i

print(h - A)

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

Solution (Python):
reader = list(map(int, input().split()))
a = reader[0]
b = reader[1]
dif = b - a

towers = [1]
for i in range(1000):
    towers.append(towers[i]+(i+2))
    if towers[i+1]-towers[i] == dif:
        print(str(towers[i]-a))

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

d = b-a
trueH = 0
for i in range(d):
    trueH += i+1
print(trueH-b)

Solution (Python):
a, b = map(int, raw_input().split())
print (int((b-a)*(b-a-1)/2)-a)

Solution (Python):
a, b = map(int, raw_input().split())
out = (b-a)*(b-a+1)/2 - b
print out

Solution (Python):
a, b = map(int, input().split())
t = b-a
b_true=0
for i in range(t+1):
    b_true += i
print(b_true-b)

Solution (Python):
def poll_height(n):
    rtn = 0
    for i in range(n):
        rtn += i+1
    return rtn

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

difference_a_b = b - a
print(poll_height(difference_a_b) - b)

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

df = b - a 

def sumPole(d) :
    psum = 0
    for i in range(0, d + 1) :
        psum += i
        
    return psum

print(int((sumPole(df) + sumPole(df - 1) - a - b) / 2))

Solution (Python):
a,b=map(int,input().split())
diff=b-a
length=(1+diff)*diff/2
print(int(length-b))

Solution (Python):
a,b = map(int,input().split())
ans = 0
for i in range(b-a):
	ans += i
print(ans-a)

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

A = 0
for i in range(c):
    A += i

print(A-a)

Solution (Python):
a,b = map(int,input().split())
print(int((b-a)*(b-a+1)/2-b))

Solution (Python):
a,b=map(int, input().split())
index=b-a
hight=0
for i in range(index):
	hight=hight+i+1
print(hight-b)

Solution (Python):
a, b = map(int,input().split())
d = b-a
print(d*(d-1)//2 - a)

Solution (Python):
if __name__ == '__main__':
    a, b = map(int, input().split())
    diff = b - a
    ans = sum(range(diff)) - a
    print(ans)

Solution (Python):
a, b = map(int, input().split())
b_index = b-a
a_index = b_index - 1
get_height = lambda n: n*(n+1)/2

a_height = get_height(a_index)
b_height = get_height(b_index)
snow_height = b_height - b
print(int(snow_height))

Solution (Python):
x = input().split()
a = int(x[0])
b = int(x[1])

n = b - a
sumk = sum(range(1, n + 1))
print(sumk - b)

Solution (Python):
a,b = map(int, input().split())
c = b-a
print(c*(c-1)//2 - a)

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


point_b = b-a

true_length_b = 0
for i in range (1,point_b+1):
        true_length_b += i
length_snow = true_length_b - b
print(length_snow)

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

n = b-a
 
height = 0
for i in range(1,n+1):
 height += i
 
snow = height - b
print("{}".format(snow))

Solution (Python):
Data = input()

import re

Shift = re.split(" ",Data)
LenA = int(Shift[0])
LenB = int(Shift[1])

Delta = LenB - LenA
Mount = 0
Ctr = 0
while True:
    Ctr += 1
    Mount += Ctr
    if Ctr == Delta:
        break
print(Mount - LenB)

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


n = b-a

height = 0
for i in range(1,n+1):
 height += i

snow = height - b
print("{}".format(snow))

Solution (Python):



a, b = map(int, input().split())
n = b - a
print(n * (n + 1) // 2 - b)

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

Solution (Python):
a,b = map(int,input().split())
diff = b - a
low = 0
while diff > 0:
    diff -= 1
    low += diff
print(low - a)

Solution (Python):
a, b = map(int, input().split())
n = b - a
m = sum(range(1, n+1))
print(m - b)

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

Solution (Python):
a,b = [int(i) for i in input().split()]
n = b-a-1
print(int(n*(n+1)/2-a))

Solution (Python):
s=input().split()
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)

Solution (Python):


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

sum = 0
for i in range(1,(b-a)+1):
    sum += i

print("{}".format(sum-b))

Solution (Python):
input_line = list(map(int, input().split()))
a = input_line[0]
b = input_line[1]

x = b - a

for i in range(1, x):
    x += i;
print(x-b)

Solution (Python):
a, b = tuple(map(int, input().split()))
x = sum(range(1, b - a)) - a
print(x)

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

Solution (Python):
a,b=map(int, input().split())
print(int(((b-a)*(b-a+1))/2-b))

Solution (Python):
a, b  = map(int,  input().split())
c = 0
i = 1
while i < b - a :
    c = c + i
    i = i + 1
d = c - a
print(d)

Solution (Python):
ab = [int(i) for i in input().split()]
a, b = ab[0], ab[1]

dif = b - a
ans = int((1 + dif) * dif / 2 - b)
print(ans)

Solution (Python):
w,e=[int(i) for i in str(input()).split()]
n=e-w-1
print(int(n*(n+1)/2-w))

Solution (Python):
a, b =map(int, input().split())
snow = (b-a)*(b-a+1)/2 - b
print(int(snow))

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

print( ((b-a) * (b-a) - b - a) // 2)

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

list=[0]

sum=0
for i in range(0, 1000):
    list.append(list[i]+i+1)

print(list[b-a]-b)

Solution (Python):
a,b = map(int, input().split())
t = 0
for i in range(b-a+1):
    t += i
print(t-b)

Solution (Python):
a, b = map(int, input().split())
print(int((b - a) * (b - a + 1) / 2 - b))

Solution (Python):
a,b=map(int,input().split())
print(((b-a)*(b-a-1))//2-a)

Solution (Python):
x=input().split()
a=int(x[0])
b=int(x[1])
n=b-a
z=0;
for i in range(n):
    z+=i
print(z-a)

Solution (Python):
a, b = map(int, input().split())
print(sum(list(range(1, b - a + 1))) - b)

Solution (Python):

if __name__ == "__main__":
    a, b = map(int, input().split())
    
    rightLength = (b-a)*(b-a+1)/2
    ans = int(rightLength - b)
    print(ans)

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

t = 0
pt = 0
for i in range(1000):
    t += i
    if a < pt and b < t:
        if (pt-a) == (t-b):
            print(pt-a)
            break
    pt = t

Solution (Python):
list = []
c = 1
for i in range(2, 1001):
	list.append(c)
	c += i
a, b = map(int,raw_input().split())
c = b - a
for i in range(1, 999):
	if list[i]-list[i-1] == c:
		ans = list[i] - b
print ans

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

t = 0
pt = 0
for i in range(1000):
    t += i
    if a < pt and b < t:
        if (pt-a) == (t-b):
            print(pt-a)
            break
    pt = t

Solution (Python):

def func(n):
    return n * (n+1) / 2


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

c = int(func(b-a-1))

print(c-a)

Solution (Python):
a,b=map(int,input().split())
s=0
for i in range(b-a):
    s+=i+1
print(s-b)

Solution (Python):
k=input().split()
a=int(k[0])
b=int(k[1])
n=0
for i in range(b-a):
    n+=i
print(n-a)

Solution (Python):
a, b = map(int, input().split())
print((1 + (b - a)) * (b - a) // 2 - b)

Solution (Python):
a , b = input().split()

a = int(a)
b = int(b) 

diff = b - a
height_a = 0

for i in range(diff):
    height_a += i
    
print(height_a - a)

Solution (Python):
a, b = map(int, input().split())
ans = 0
for i in range(1, b - a + 1):
    ans += i
ans -= b
print(ans)

Solution (Python):
a,b = [int(i) for i in input().split()]
hb = int((b-a)*(b-a+1)/2)
print(hb-b)

Solution (Python):
a,b=map(int,input().split())
i=b-a+1
num=0
j=1
while j<i:
  num = num+j
  j += 1
print(num-b)