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):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


def A():
    n = I()
    if n < 1000:
        print("ABC")
    else:
        print("ABD")
    return


def B():
    a,b = LI()
    n = b-a
    c = (n*(n+1))//2
    print(c-b)
    return


def C():
    n = I()
    ans = float("inf")
    for i in range(n+1):
        m = 0
        k = i
        while k > 0:
            m += k%6
            k //= 6
        k = n-i
        while k > 0:
            m += k%9
            k //= 9
        ans = min(ans,m)
    print(ans)

def D():
    n,C = LI()
    f = LIR(C)
    c = LIR(n)
    d = [defaultdict(int) for i in range(3)]
    for i in range(n):
        for j in range(n):
            d[(i+j+2)%3][c[i][j]-1] += 1
    ans = float("inf")
    for i in range(C):
        for j in range(C):
            if i != j:
                for k in range(C):
                    if k != i and k != j:
                        m = 0
                        for a in d[0].keys():
                            m += d[0][a]*f[a][i]
                        for a in d[1].keys():
                            m += d[1][a]*f[a][j]
                        for a in d[2].keys():
                            m += d[2][a]*f[a][k]
                        ans = min(ans,m)
    print(ans)



def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    B()

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())
tmp_list = [0]*1000
tmp_list[0] = 1
for i in range(1,len(tmp_list)-1):
    tmp_list[i] = tmp_list[i-1]+i+1
tmp_list.pop(-1)
res_w = tmp_list[b-a-2]
res_e = tmp_list[b-a-1]
print(res_w-a)

Solution (Python):


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

c = b - a
height = 0

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

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

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

Solution (Python):
a,b=map(int,input().split())
x=b-a
l=0
for i in range(x+1):
    l+=i
print(l-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())
print((b - a) * (b - a + 1) // 2 - b)

Solution (Python):
A,B=map(int,input().split())
C=B-A
print(sum(x for x in range(1,C+1))-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());n=b-a;n=round(n*(n+1)/2);print(n-b)

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

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

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

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

print(ans)

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

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

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

Solution (Python):
from sys import stdin
a, b = [int(x) for x in stdin.readline().rstrip().split()]
diff = b-a
print(sum([i for i in range(diff)])-a)

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

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

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

Solution (Python):
a,b=map(int,input().split(' '))
print(sum([i+1 for i in range((b-a))])-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())
n=b-a
print(n*(n+1)//2-b)

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())
num = b - a
print(int(num*(num+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())
num = 0
for i in range(b-a):
    num += i + 1
print(num - b)

Solution (Python):
def read():
    return raw_input()


def write(message):
    import sys
    print message
    sys.stdout.flush()


if __name__ == '__main__':
    a, b = map(int, read().split())
    n = b - a
    h_b = (n * (n + 1)) / 2
    write(h_b - b)

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

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

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

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

tower = 0

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

print(tower - b)

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

total = 0
for i in range(1, d):
    total += i
print(total - a)

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

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

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

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

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

Solution (Python):
a,b=map(int,input().split())
c=b-a
d=0
for i in range(c):
    d=d+i
print(d-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(sum(list(range(1, b - a + 1))) - b)

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

print(sum(range(b-a)) - a)

Solution (Python):
def solve(string):
    a, b = map(int, string.split())
    n = b - a
    return str(n * (n + 1) // 2 - b)


if __name__ == '__main__':
    print(solve(input()))

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

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

ans = 0
for i in range(x + 1):
    ans += i

print(ans - 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(int((b-a)*(b-a+1)/2-b))

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

Solution (Python):
def stone_monument(a: int, b: int) -> int:
    n = b - a
    return n * (n + 1) // 2 - b


if __name__ == "__main__":
    a, b = map(int, input().split())
    ans = stone_monument(a, b)
    print(ans)

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

cnt = 0
for i in range(1,B-A):
  cnt += i
print(cnt-A)

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

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

Solution (Python):
a,b=map(int,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())
sa = b-a
print(sum([i for i in range(sa+1)])-b)

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

Solution (Python):

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

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


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


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

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

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

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,input().split())
print((b-a+1)*(b-a)//2-b)

Solution (Python):

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

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

answer = x - a
print(answer)

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

last = b - a
b_height = sum([i+1 for i in range(last)])

print(b_height-b)

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

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

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

print(d-b)

Solution (Python):
nums=list(map(int,input().split()))
n=nums[1]-nums[0]
height=0

for i in range(n):
    height+=(i+1)
print(height-nums[1])

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((b-a)*(b-a+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())
print(int(((1/2)*(b - a - 1)*(b - a))-(a)))

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

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


if __name__ == "__main__":
    main()

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

Solution (Python):
import sys

def main():
  input = sys.stdin.readline
  a, b = map(int, input().split())
  diff = b - a
  ah = sum([i for i in range(1, diff)])
  print(ah-a)


if __name__ == '__main__':
  main()

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

yuki=0
while 1:
    if(length-sa -yuki==a and length -yuki==b):
        print(yuki)
        break
    
    yuki+=1

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

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

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(range(b-a))-a)

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

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

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

Solution (Python):
def main() -> None:
    a, b = map(int, input().split())
    h = 0
    for i in range(1, 1000):
        if (h - a) == (h + i - b):
            print("{}".format(h - a))
            break
        else:
            h = h + i


if __name__ == '__main__':
    main()

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

print(b_height - b)

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

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

print(height_b - b)

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

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

Solution (Python):
int_a, int_b = map(int, input().split())

diff = int_b - int_a
high_b = sum(range(1, diff + 1))

print(high_b - int_b)

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

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

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, input().split())
print(((b - a - 1) * (b - a)) // 2 - a)

Solution (Python):
class Solver(object):
    def __init__(self):
        self.a, self.b = list(map(int, input().split(" ")))

    def solve(self):
        last = self.b - self.a
        right_height = sum(range(1, last+1))
        snow_height = right_height - self.b
        print(snow_height)


if __name__ == "__main__":
    s = Solver()
    s.solve()

Solution (Python):
a,b=[int(i) for i in input().split()]
height=[1]
for i in range(1000):
    height.append(height[i]+i+2)
for i in range(1000):
    if height[i]>a and height[i+1]>b:
        if height[i]-a==height[i+1]-b:
            print(height[i]-a)
            break

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(int((b-a)*(b-a-1)/2 - a))

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

answer = (b-a-1)*(b-a)//2 - a

print(answer)

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())
print(sum(list(range(1,b-a+1)))-b)

Solution (Python):

a,b=map(int,input().split())
N=b-a+1
S=0
for a in range(N):
    S=S+a
print(S-b)

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

Solution (Python):
def add(x,y):
    return x + y


a,b = map(int,input().split())
x = b -a
sum = 1
next_x = 2
while True:
    result = add(sum,next_x)
    if result - sum == x:
        print(sum - a)
        break
    sum = result
    next_x += 1

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

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

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

c = b - a

east = (1 + c) * c // 2

print(east - b)

Solution (Python):

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

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

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

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

Solution (Python):


"""
Created on Mon Feb 11 05:38:56 2019

@author: shinjisu
"""



import math


def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def dmp(x):
    global debug
    if debug:
        print(x)


debug = True


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def prob096():  
    X = getIntList()
    K = getInt()
    dmp((X, K))
    total = sum(X) - max(X) + max(X)*2**K
    return total


def prob097():  
    X = getInt()
    dmp(X)
    if X == 1:
        return 1
    for n in range(X, 0, -1):
        dmp(n)
        for b in range(2, int(math.sqrt(X))+1):
            a = n
            exp = True
            while a > 1:
                if a % b != 0:
                    exp = False
                    break
                a //= b
            if exp:
                break
        if exp:
            break
    return n


def prob098():  
    N = getInt()
    S = input()
    dmp((N, S))
    maxChCount = 0
    for i in range(1, N):
        before = S[:i]
        after = S[i:]
        dmp((before, after))
        chCount = 0
        for j in range(26):
            ch = chr(ord('a')+j)
            if ch in before and ch in after:
                chCount += 1
        maxChCount = max(maxChCount, chCount)
    return maxChCount


def prob099():  
    a, b = getIntList()
    height = 0
    for i in range(b-a+1):
        height += i
    height -= b
    return height

def prob000():  
    return 0


debug = False  
print(prob099())

Solution (Python):
a, b = map(int,input().split())
t = 0
ans = 0
T = 0
while 1:
    t += 1
    TT = T
    T += t
    if T - TT == b - a:
        ans = T - b
        break
print(ans)

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

diff = b - a

height_a = diff*((diff-1)/2)
print(int(height_a - a))

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



for i in range(998):
    if list[i+1] - list[i] == b - a:
        
        print(list[i]-a)
        break

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

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

Solution (Python):
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("AC")
    else:print("WA")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


x,y= (int(i) for i in input().split())      









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

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

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

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

Solution (Python):

import sys



def solve(lines):
    A,B = map(int, lines.pop(0).split(' '))
    diff = B - A
    print(sum(range(1, diff+1)) - B)














lines = [x.strip() for x in sys.stdin.readlines()]




solve(lines)

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

for j in range(999):
   o=l[j+1]-l[j]
   if(o==e):
       print(l[j]-a)
   else:
       continue

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

Solution (Python):
L = [(n+1)*(n+2)//2 for n in range(999)]
a,b = map(int,input().split())
dif = b-a
for i in range(999):
    if L[i+1] - L[i] == dif:
        print(L[i]-a)
        exit()

Solution (Python):
import sys
a, b = [int(i) for i in sys.stdin.readline().rstrip().split()]
len_a = (b - a - 1) * (b - a) // 2
print(len_a - a)

Solution (Python):
import sys
input = sys.stdin.readline

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

print(x)

Solution (Python):
import sys
import math



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

d = b-a

ee = 0

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

print(ee-a)

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


main()

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

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

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

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

n = abs(b-a)-1
print(n*(n+1)//2-min(a,b))

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

Solution (Python):

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

x= b-a

ans = x * ( x+1 ) // 2 - b

print( ans )

Solution (Python):
""" AtCoder """

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

ans = 0

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

print(ans - a)

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

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

    l = []
    for i in range(2, 1001):
        h = 0
        for j in range(1, i):
            h = h + j
        l.append(h)

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


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

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

    print(s - a)


if __name__ == '__main__':
    main2()

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

    l = []
    for i in range(2, 1001):
        h = 0
        for j in range(1, i):
            h = h + j
        l.append(h)

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):


import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


a, b = LI()

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

print(ha - a)

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

Solution (Python):
import sys
sys.setrecursionlimit(2000)

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

c = b - a 

def count(n):
  if n ==1:
    return 1
  else:
    return count(n-1)+n

print(count(c)-b)

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

Solution (Python):


def main():
    na = list(map(int, input().split()))
    a, b = na[0], na[1]

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

    print(t)


if __name__ == '__main__':
    main()

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

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

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

print(lst[-1] - a)

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

print(d[s-1]-b)

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

y = b - a - 1
w_hight = 0

for i in range(1, y + 1):
    w_hight += i

print(w_hight - a)

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

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

Solution (Python):
a, b = map(int, input().split())
for n in range(1, 1000):
    h1 = n*(n+1)//2
    h2 = (n+1)*(n+2)//2
    if h1 - a == h2 - b:
        print(h1-a)
        break

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

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

t1, t2, s = 1, 1 + 2, 3
while not (t1 - a > 0 and t2 - b > 0 and t1 - a == t2 - b):
    t1, t2, s = t2, t2 + s, s + 1

x = t1 - a
print(x)

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

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())
print((b-a)*(b-a+1)// 2 - b)

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

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

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

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

Solution (Python):

import sys
input = sys.stdin.readline

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

Solution (Python):

import sys
input = sys.stdin.readline

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

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

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

print(t - a)

Solution (Python):
import sys

sys.setrecursionlimit(10**6)

def sig(x):
    return 1 if x==1 else sig(x-1)+x


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

upper=int(sig(b-a))
print(upper-b)

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

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

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

print(int(yuki))

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

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

Solution (Python):



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

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

    print(left - a)


if __name__ == "__main__":
    main()

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

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

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

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

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

l = 0
for i in range(1, 999):
    l += i
    r = l + i + 1
    if r - l == b - a:
        print(l - a)

Solution (Python):
a, b = (int(n) for n in input().split())
N = b - a
H = -a
for h in range(N):
    H += h 
print(H)

Solution (Python):
import numpy as np
a,b = map(int, input().split())
n = b - a
k = np.array(range(n+1))
sam = np.sum(k)
print(sam-b)

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


if __name__ == '__main__':
    main()

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

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())
d = b - a
print(-~d * d // 2 - b)

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

def f(n):
    return n  

def sigma(func, frm, to):
    result = 0
    for i in range(frm, to+1):
        result += func(i) 
    return result

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

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

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(n*(n+1)//2 - b)

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

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

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

Solution (Python):

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

diff = b-a
d = 0
for i in range(1, diff):
    d += int(i)
print(abs(d-a))

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

n = b-a

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

print(right_height - b)

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

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

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

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

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

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

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

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

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

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

print(y-b)

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

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

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

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

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

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b = li()
diff = b-a

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

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

s = 0
for n in range(1000):
    if b-a == n:
        print(s-a)
        break
    s += n

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

diff = b-a
ans = sum(list(range(diff))) - a
print(ans)