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):
import sys
def readQuestion():
    line = sys.stdin.readline()
    sline = line.rstrip()
    [rline,r1line]=sline.split(" ")
    a=int(rline)
    b=int(r1line)
    return a,b 

def solve(a,b):
    x=[]
    y=0
    high=0
    z=0
    u=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    high = b-a
    z=high-1
    u=x[z]-b
    return u

def main():
    x,y = readQuestion()
    answer = solve(x, y)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
def main2():
    strbuf = input("");
    strbufs = strbuf.split();
    buf = [];
    for i in range(2):
        buf.append(int(strbufs[i]));
    sa = buf[1] - buf[0];
    takasa = sa * (sa + 1) / 2;
    result = takasa - buf[1];
    print(int(result));


if __name__ == '__main__':
    main2()

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

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

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

print(sum-b)

Solution (Python):
x = map(int,raw_input().split())
a = x[0]
b = x[1]
c = 0
t = b - a
for i in range(1,t+1):
  c += i
print(c-b)

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

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

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

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

ans = listA[b - a] - b
print(ans)

Solution (Python):


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

B = b - a
A = B - 1

x = ((1 + A) * A) / 2 - 0.5 * (a + b - B)

print(int(x))

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

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

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

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

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

Solution (Python):
a, b = [int(x) for x in raw_input().split()]
ib = b - a
fb = ib * (ib+1) / 2
print fb - b

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

Solution (Python):


import math
import os
import random
import re
import sys

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

if __name__ == '__main__':
    nk = raw_input().split()
    a = int(nk[0])
    b = int(nk[1])
    
    result = solution(a,b)

    print result

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

Solution (Python):

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

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

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

Solution (Python):


line = input().split()

west_leave = int(line[0])
east_leave = int(line[1])
for tower in range(1000):
    west_tower = (tower * (tower+1))/2
    east_tower = ((tower+1) * (tower+2))/2
    if( (west_tower - west_leave) == (east_tower - east_leave) ):
        print (int(west_tower - west_leave))

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

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

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

Solution (Python):
a, b = input().split()
a = int(a)
b = int(b)
for i in range(1000):
    if (i * (i + 1) / 2 - a == (i + 2) * (i + 1) / 2 - b):
        print(int(i * (i + 1) / 2 - a))
        exit(0)

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

print(k-a)

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

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

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

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

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

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

t1 = 0
for i in range(1,1000):
    t1 += i
    if t1>a and t1+(i+1)>b and (t1-a)==(t1+i+1-b):break

print(t1-a)

Solution (Python):
def sum(i):
    sum = 0
    for j in range(i):
        sum += j+1
    return sum

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

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

Solution (Python):
def height(n):
  if n % 2 == 0:
    h = n * (n + 1) // 2
  else:
    h = height(n + 1) - (n + 1)
  return h

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

Solution (Python):
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x): stderr.write(reduce(add,repr(x)).strip("()\',")+'\n')

a, b = f()
n = b - a
print(int(1/2*n*(n+1))-b)

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

Solution (Python):


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

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

Solution (Python):
def solve(a, b):
    for i in range(1, 1000):
        c = (i-1)*i/2 - a
        d = i*(i+1)/2 - b
        if c == d:
            return c
    return -1

assert solve(8, 13) == 2
assert solve(54, 65) == 1
a, b = map(int, raw_input().split())
print solve(a, b)

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

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

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

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

sa = b - a
cost = 0
for i in range(1000):
    cost += i
    if sa == i:
        break

print(cost - b)

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

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

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

sa = b - a
east = (1 + sa) * sa / 2
snow = int(east - b)
print(snow)

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

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

b_height = 0
gap = b - a

for i in range(gap + 1):
    b_height += i
    if i == gap:
        break

print(b_height - b)

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


d = b - a


l = ( 1 + d ) * d // 2

print( l - b )

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

main()

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

for i in range(1,1000):
    h.append(i*(1+i)//2)
for i in range(1,1000):
    if h[i]-h[i-1]==b-a:
        print(h[i]-b)
        break

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

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

print(num-a)

Solution (Python):
from math import *

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

Solution (Python):
if __name__=="__main__":
    a,b=map(int,raw_input().split())
    s=(b-a)*(b-a+1)//2
    print s-b

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

Solution (Python):






data = list(map(int,input().split()))
data_diff = data[0] - data[1]





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





differences = []
idx = -1
for i in range(len(trees)-1):
    diff = trees[i] - trees[i+1]
    if diff == data_diff:
        idx = i
        break
print(trees[idx] - data[0])

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

Solution (Python):
tall=[int(i) for i in input().split()]
dist=tall[1]-tall[0]

left=0
for i in range(dist):
  left+=i
print(left-tall[0])

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

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

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

d = b - a

t = 0
for i in range(d + 1):
    t += i
    
x = t -b

print(x)

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

Solution (Python):

def f():
  
  
  
  a,b = (int(i) for i in input().split()) 
  s = b-a
  bh=s*(s+1)//2
  print(bh-b)
f()

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());print(sum(i for i in range(b-a))-a)

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

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

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

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

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



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

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

t = b-a

s = (t*(t+1))//2
print(s - b)

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

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

while c > i:
    d = d+i
    i += 1
ans = d-a
print(ans)

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

d = b - a

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

print(h-a)

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

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

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

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

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

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

print(height-b)

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

c = b - a

d = 0

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

print(d - a)

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

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

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

dif = b-a
left_length = sum(range(1,dif))
print(left_length-a)

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

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

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

Solution (Python):
listA=list(map(int,input().split()))
a=listA[0]
b=listA[1]
snow=[1]
for i in range(1,999):
    snow.append(0)
    snow[i]=snow[i-1]+i+1
for j in range(1,1000):
    if(b-a==j):
        print(snow[j-1]-b)
        break;

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

Solution (Python):
tower = [0]

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

a, b = map(int, input().split())
t = tower[b - a]
print(t - b)

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

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

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

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

Solution (Python):


if __name__ == '__main__':

    a,b = list(map(int,input().split()))
    tower = []
    for i in range(1000):
        if i == 0:
            tower.append(1)
        else:
            tower.append(tower[i-1]+i+1)
    d = []
    for i in range(999):
        d.append(tower[i+1]-tower[i])
    for i in range(999):
        if b-a == d[i]:
            print(tower[i]-a)

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

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

Solution (Python):
from sys import stdin
a,b = map(int,stdin.readline().split())
x = b - a
print (x * (x+1) ) /2 - b

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

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

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

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

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

n = b - a

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

print(N - b)

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

a = int(n[1]) -int(n[0])

b = a-1
c = 0

while b > 0:
    c += b
    b = b - 1


d = c - int(n[0])

print(str(d))

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

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

depth=(b-a)*(b-a+1)/2-b

print(int(depth))

Solution (Python):

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

Solution (Python):
if __name__ == "__main__":
    w,e = map(int, input().split())
    wtower = 0
    for i in range(1,e-w):
        wtower +=i
    print(wtower-w)

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

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

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

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

def height(n):
    sum = 0
    for i in range(n+1):
        sum += i
    return sum
    




    
d = height(b-a)
print(d-b)

Solution (Python):
towers = [(0,0)]
for i in range (999):
    b = towers[-1][0] + (i + 1)
    towers.append((b, i))

towers.pop(0)

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

bi = b - a - 1
print(towers[bi][0] - b)

Solution (Python):

a_b = input().split()
a = int(a_b[0])
b = int(a_b[1])
n = b - a

h = (n - 1) * n / 2 - a

print(int(h))

Solution (Python):
a,b=map(int,input().split())
x=1
y=1
for i in range(2,1000):
    x+=i
    y=x-i
    if x-b==y-a:
        print(x-b)
        exit()

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

Solution (Python):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

a, b = read_line(int, int)

d = b - a
s = 1
for i in range(2, 1000):
    s += i

    if d == i:
        print(s - b)
        break

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

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

Solution (Python):
aaaa = input()

a = (int)(aaaa.split()[0])
b = (int)(aaaa.split()[1])
n = b - a

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

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

Solution (Python):

a,b=map(int,input().split())
dif=b-a
height_west=sum(x for x in range(dif))
height_snow=height_west-a
print(height_snow)

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

Solution (Python):
a, b = tuple(map(int, input().split()))
nums = list(range(1, 1000))

print(sum(nums[:(b - a)]) - b)

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

for i in range(c + 1):
    hantei = hantei + i
print(hantei - b)

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

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

a = int(s[0])
b=int(s[1])
c = b - a

K=c*(c+1)/2-b
print(int(K))

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

A, B = map(int, input().split())
diff = B - A
left_idx = diff - 2

talls = []
t = 0
for i in range(999):
    t += (i + 1)
    talls.append(t)

t = talls[left_idx]
print(t - A)

Solution (Python):
inp = input()
a,b = inp.split(" ")
a = int(a)
b = int(b)
diff = b-a

oria = 0
for i in range(diff):
    oria +=i

print(oria -a)

Solution (Python):
import numpy as np
a, b = input().split(" ")
a = int(a)
b = int(b)

c = b - a
s = sum(list(np.arange(c)))
print(s - a)

Solution (Python):
i1, i2 = map(int, input().split())

iMargin = i2 - i1
iSum = 0

for i in range(1, iMargin):
    iSum = iSum + i

print (iSum - i1)

Solution (Python):


a,b = map(int, raw_input().split())
diff=b-a
trueHeight=diff*(diff+1)/2
ret=trueHeight-b
print ret

Solution (Python):
A = input().split(" ")
a = int(A[1])-int(A[0])
c = 1
m = 1
while a != m:
    m += 1
    c += m
print(c-int(A[1]))

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

print(li[(b-a)-2] - a)

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

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=0

A=1
B=2

alt=b-a
for i in range(1,b-a):
    X+=i

print(X-a)

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

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

Solution (Python):



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

n = b - a

sum = (n * n + n) / 2

output = sum - b

print output

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

c=b-a
d=sum(range(1,c+1))

ans=d-b

print(ans)

Solution (Python):
a,b = [int(x) for x in input().split()]
for i in range(999):
    j = i+1
    h1 = int(((i*(i+1))/2))-a
    h2 = int(((j*(j+1))/2))-b
    if h1 == h2:
        print(h1)
        break

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

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

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

print('{}'.format(sum(range(1,b - a + 1)) - b))

Solution (Python):


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

d = b - a
n = 1
for i in range(2, d):
	n += i

print n - a

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

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

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

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

for idx in range(1,len(tower_list)-1):
    if tower_list[idx]>a and tower_list[idx+1]>b:
        x_west=tower_list[idx]-a
        x_east=tower_list[idx+1]-b
        if x_east==x_west:
            print(x_east)

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

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

print(sumn-b)

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

c = b - a

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

Solution (Python):
def sum(n):
    return n*(n+1)/2

def main():
    A, B = map(int, raw_input().split())
    n = B - A
    lefttower = sum(n-1)
    print(lefttower - A)

if __name__ == '__main__':
    main()

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

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

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

print(ans)

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

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

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

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

Solution (Python):
A, B = map(int, raw_input().split())

N = B - A

no = 0

for i in range(N-1):
    no = no + i+1

print(no-A)

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

sub = b-a

print arr[sub-1]-b

Solution (Python):
A,B = map(int,input().split())
Dif = B - A
Larger = int((1+Dif)*Dif/2)
DepthSnow = Larger - B
print(DepthSnow)

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(10000)


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


def to_bin(x):
    return bin(x)[2:]



dp = None

def main():
    a, b = [int(_) for _ in input().split()]
    diff = b - a

    tower = 0
    ts = []
    for add in range(1, 1000):
        tower += add
        ts.append(tower)

    print(ts[diff-2] - a)

main()

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

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

Solution (Python):
import re
st_in = input()
tmp_in = re.split(" ",st_in)

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

i_sum = 1
for i in range(2,1000):
    i_sum += i
    if i_sum > b and i_sum - i > a:
        if i_sum - b == i_sum - i - a:
            print(i_sum-b)
            break

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

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

for i in range(1, a_b):
    nl += i

print(nl - a)

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

import numpy as np

east_num = b-a

tmp = np.arange(1,b-a+1)

east_hight = sum(tmp)

snow= east_hight-b

print(snow)

Solution (Python):
ai,bi = map(int,input().split())
c = bi - ai
sum = 0
for i in range(1,1000):
    sum += i
    if (sum - (sum - i)) == c:
        ans = sum - bi
        break
    
print(ans)

Solution (Python):
A,B = map(int,input().split())
B_num = B-A
B_length = 0
for i in range(1,B_num+1):
    B_length = B_length + i

print(B_length-B)

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

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

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

c = b-a
hight = 0

for i in range(c):
    hight += i+1

print(hight-b)

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

count = b - a - 2

height = 1
up = 1
for i in range(count):
    up += 1
    height += up

print(str(height - a))

Solution (Python):


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

diff = b - a

while True:
    b = b - diff

    if diff == 1:
        break
    diff -= 1
print(abs(b))

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

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

print(s - a)

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

length = b - a
result = 0

for j in range(length):
  result += j
  
print(result + length - b)

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

diff = b - a

h = 1
for i in range(2, 1000):
    h += i
    if i == diff:
        print(h - b)
        exit()

Solution (Python):
from sys import stdin, stdout


a, b = map(int, stdin.readline().split())
prev, cur = 1, 3
ind = 3

while True:
    if a - prev == b - cur and b < cur:
        stdout.write(str(cur - b))
        break
    
    prev = cur
    cur += ind
    ind += 1

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

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

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

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


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


h = get_height(b - a)

print(h - b)

Solution (Python):
num = input().split()
n = int(num[1]) - int(num[0])

print(int(n*(n+1)/2 - int(num[1])))

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


    sa = b - a

    lst =[0]

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

    print(lst[sa] - b)



if __name__ == "__main__":
        main()

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

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

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

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

print(sum-a)

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

c = b -a 
d = int(c*(c+1)/2)
e = d - b

print(e)

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

for i in range(999):
    if a - tower[i] == b - tower[i+1]:
        print(int(abs(tower[i]-a)))
        break

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

Solution (Python):


import os
import sys
import math
import numpy as np


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

def main():
    a, b = list(map(int, input().split()))
    left = func(b-a-1)
    print(left - a)



if __name__ == '__main__':
    main()

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

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

R=int(0.5*(b-a-1)*(b-a)-a)

print(R)

Solution (Python):
a, b = map(int, input().split())
SUM_1 = 0
SUM_2 = 1
i = 0
array = [x for x in range(1000)]
array.pop(0)

while True:
    SUM_1 = SUM_1 + array[i]
    SUM_2 = SUM_2 + array[i+1]

    if SUM_1 - a == SUM_2 - b:
        print(SUM_1 - a)
        break
    
    i += 1

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

n=b-a

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

print(sum-b)

Solution (Python):
leng=[]
diff=[]
for i in range(1,1000):
	h=i*(i+1)//2
	leng.append(h)
for i in range(0,len(leng)-1):
	diff.append(leng[i+1]-leng[i])
a,b=map(int,input().split())
d=abs(a-b)


try:
	pos=diff.index(d)
except:
	ans=1


ans=leng[pos]-a
print(ans)

Solution (Python):

ab = list(int(i) for i in input().split())

s = 0
devide = ab[1] - ab[0]

for i in range(devide):
    s += i

ans = s - ab[0]
print(ans)

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

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

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

t = [1,]

for i in range(1000):
    t.append((i+2)+ t[i])

for j in range(len(t)):
    if t[j] - a == t[j+1] - b:
        print(t[j] - a)
        break

Solution (Python):
a,b=map(int, input().split())
c=list(range(1,1000))
c2=[sum(c[:i+1]) for i in range(len(c))]
d=b-a
print(c2[d-2]-a)

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

c = b-a

d = c*(c-1)/2 -a
print(int(d))

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

sa = abs(b-a)
tmp1 = 0
for i in range(1,1000):
    tmp2 = int(i*(i+1)/2)
    if tmp2 - tmp1 == sa:
        print(tmp1 - a)
        sys.exit()
    tmp1 = tmp2
print(1)

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

tmp = 1
tmp_1 = 0

for i in range(1, 999):
    tmp_1 = tmp + i + 1
    if tmp > a and tmp_1 > b:
        if tmp - a == tmp_1 - b:
            print(tmp - a)
            exit()

    tmp = tmp_1

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

h = N*(N+1)/2 - a

print(int(h))

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

Solution (Python):


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

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

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

Solution (Python):
a, b = input().split()
a = int(a)
b = int(b)
c = b-a 
sum = 0
for x in range(0,c):
    sum += 2*x
sum += c
s = (sum - a - b)//2
print(s)

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

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

Solution (Python):
def calc(n):
    if n == 1:
        return 1
    else:
        return n + calc(n-1)


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

sub = b - a

n = 1
for i in range(2, sub+1):
    n += i

print(n-b)

Solution (Python):
x = list(map(int,input().split( )))
z = x[1]-x[0]
t = 0
for s in range(z+1):
    t += s
    
print(t-x[1])

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

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

print(count-b)

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

d = b - a

c = int((d+1)*(d/2))

print(c-b)

Solution (Python):

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

def main(nums):
	
	w = nums[0] 
	e = nums[1]
	
	return func(e-w) - e


nums = input().split(" ")
nums = [int(c) for c in nums]

print(main(nums))

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

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

print(ans)

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

sub = b - a
num = 0
has_height_a = False
has_height_b = False
for i in range(1, sub+1):
    num += i
    
print(num - b)

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

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

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

B = b - a

print(towers[B] - b)