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):
def answer(a: int, b: int) -> int:
    return sum(range(1, b - a + 1)) - b


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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b = Input()
    towers = [1] * 999
    for i in range(1, 999):
        towers[i] = towers[i-1] + i + 1
    n = b - a
    ans = 0
    for i in range(998):
        if towers[i+1] - towers[i] == n:
            ans = towers[i] - a
    print(ans)


main()

Solution (Python):

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

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


X = b-a
print(tou[X-1] - b)

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

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

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

print(sum(i for i in range(1, d)) - a)

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

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

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

diff = b - a

x = 1
y = 3
i = 3

while True:
  if y - x == diff:
    break
  
  x = y
  y = y + i
  i = i + 1

print(y - b)

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

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

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

def su(p):
  c = 0
  for i in range(p+1):
    c += i
  return c

l = m - n

print(su(l-1) - n)

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 = map(int, input().split())
d = B-A
s = sum([x for x in range(1, d)])
print(s-A)

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

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

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

n = b - a - 1
an = (n*(n+1))//2
print(an-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())
c = b - a
ans = 0
for i in range(c):
  ans += i
  
print(ans - a)

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

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

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

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

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

print(d-a)

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())
diff = b - a
towers = [0] * diff
for i in range(1, diff):
    towers[i] = towers[i - 1] + i
print(towers[-1] - a)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
print((b-a) * (b-a+1)//2 - b)

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

Solution (Python):
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b = [int(num) for num in lines.pop(0).split(" ")]
dif = b - a
height = dif * (dif - 1)  // 2
print(height - a)

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

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

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

Solution (Python):
m,n = map(int,input().split())

h = sum([i for i in range(1,n-m+1)])
print(h-n)

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

bt = sum([i for i in range(1,m-n+1)])
print(bt-m)

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

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

print(real_b - b)

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


h = 0
p = 1
li = []

for i in range(999):
    h +=p
    p +=1
    li.append(h)

for i in range(len(li)):
    for k in range(len(li)):
        if (a[0]-li[i])==(a[1]-li[k]) and k == i+1:
            print(abs(a[0]-li[i]))

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

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

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

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

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

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

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

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


if __name__ == "__main__":
    main()

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

for n in range(0, 1000):
    west = ((n*(n-1))/2)-a
    east = ((n*(n+1))/2)-b

    if west == east:
        print(int(east))
        exit()

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

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

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

print(ans-b)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    x = b - a
    y = x * (x - 1) // 2

    print(y - a)


if __name__ == '__main__':
    main()

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

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

print(d-a)

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

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

print(s - b)

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


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

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(c*(c+1)//2 - B)

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 = map(int,input().split())

print((b-a)*(b-a+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
c=0

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

print(c-b)

Solution (Python):
from itertools import accumulate
import sys
a,b=map(int,input().split())
n = 500000
l=[]
for i in range(n):
    l.append(i)
    tmp = sum(l)
    if abs(abs(a+tmp) - abs(b+tmp)) == i:
        print(tmp -b)
        sys.exit()

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

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

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

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

Solution (Python):
ab = list(map(lambda x: int(x), input().split(" ")))
a = ab[0]
b = ab[1]

n = b - a - 1

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

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

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

tower_height = 0
tower_height_list = []
for i in range(1,999+1):
    tower_height += i
    tower_height_list.append(tower_height)
    i += 1

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

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

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

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

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

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

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

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

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

d = b - a

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

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

c = b-a
res = sum(i for i in range(c))
print(res-a)

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

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

ans = s - a
print(ans)

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

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

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

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

ans = sum - a
print(ans)

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



def main():
    a, b = [int(i) for i in input().strip().split()]
    towers = [0] * 1000
    dif = b - a
    for i in range(1, 1000):
        towers[i] = i + towers[i - 1]
    for i in range(1, 999):
        if towers[i + 1] - towers[i] == dif:
            ans = towers[i + 1] - b
            print(ans)
            break
    return


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):


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

tmp = 1
for i in range(2, 1000):
    if i == (b-a):
        
        print(tmp-a)
    tmp += i

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

Solution (Python):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    a, b = nm()
    print(sum(range(1, b - a)) - a)


if __name__ == '__main__':
    main()

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

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

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

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

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

print(tall - a)

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

Solution (Python):
A,B = map(int,input().split())
ls = []
a = 0
for i in range(1,1000):
    a += i
    ls.append(a)
sa = B-A
ans = ls[sa-1] - B
print(ans)

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

a, b = LI()


def main():
    f = lambda x: x * (x + 1) // 2
    ans = f(b - a - 1) - a
    print(ans)


if __name__ == "__main__":
    main()

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

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())
n = b-a-1
h = 0
for i in range(1, n+1):
    h += i

print(h-a)

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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

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

num = tmp*(tmp+1)//2

ans = num-b

print(ans)

Solution (Python):









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

n = b - a

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

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

M = sum(range(b-a))

print(M - a)

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

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

Solution (Python):
a,b = (int(T) for T in input().split())
Left = 0
Right = 1
for Leng in range(1,1000):
    Left += Leng
    Right += Leng+1
    if (Right-Left)==(b-a):
        print(Left-a)
        break

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

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


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

Solution (Python):
a, b = list(map(lambda x : int(x), input().split(" ")))
print(int((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())
t = b-a
print(t*(t+1)//2-b)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B = map(int, readline().split())
    ans = (B-A)*(B-A+1)//2-B
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
a,b=(int(i) for i in input().strip().split(" "))
n=b-a
k=(n*(n+1))//2
print(k-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())

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

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

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

N = b - a - 1

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

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

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd


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

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

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

c = b-a

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

print(int(x-b))

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

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

height = []
p = 1
for i in range(999):
    height.append(p)
    p += 1

c = b - a
sum_num = 0

for i in range(c):
    sum_num += height[i]

answer = sum_num - b

print(answer)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    a, b = LI()

    d = b - a

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

if __name__ == '__main__':
    resolve()

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

Solution (Python):

def main():
    a,b = map(int, input().split())
    sum = 0
    
    for height in range(1,1000):
        sum += height
        if b-a == height:
            print(sum-b)
            break;
        
if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

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

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

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

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

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

Solution (Python):
n=list(map(int, input().split()))
ans=0
diff=n[1]-n[0]
for i in range(diff):
  ans=i+ans
yuki=ans-n[0]
print(yuki)

Solution (Python):

import sys


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  
    b = int(next(tokens))  
    print(solve(a, b))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

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

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

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

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

a_height = 0
b_height = 0
sa = abs(a - b)

for i in range(1, sa):
    a_height += i
    


    



print(a_height - a)

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

for i in range(1, 1000):
    if abs(b-a)==i:
        print(int((i-1)*i/2) - a)
        break

Solution (Python):
import itertools

n, m = map(int, input().split())
l = list(itertools.accumulate(range(1, 1000)))
print(l[m-n-1]-m)

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

Solution (Python):
MM = input().split()
a = int(MM[0])
b = int(MM[1])
ans = (b -a )*(b-a+1)*0.5 -b
print(int(ans))

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

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

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

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

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

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

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

Solution (Python):

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

height = (1 + diff) * diff // 2

print(height - b)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

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

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

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

Solution (Python):
tower = [0]*(999)
tower[0]=1
for i in range(1,999,1):
    tower[i]=tower[i-1]+(i+1)

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

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

Solution (Python):


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


h_b = sum(range(1, b - a + 1))

print(h_b - b)

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

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

for n in range(1,b-a+1):
  T+=n

print(T-b)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    a, b = il()
    t = [0] * 1000
    t[0] = 1
    for n in range(2, 1000):
        t[n-1] = t[n-2] + n
    for n in range(1000):
        if t[n] - a == t[n+1] - b:
            print(t[n]-a)
            exit()


if __name__ == '__main__':
    main()

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


if __name__ == "__main__":
    solve()

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b = i_map()

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

if __name__ == '__main__':
    main()

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

Solution (Python):
sumA=0
diff={}
for i in range(1,1000):
  sumA+=i
  diff[i]=sumA

a,b=[int(i) for i in input().split()]
print(diff[b-a]-b)

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

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

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

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

Tcum = [0] * (1000)
for i in range(999):
    Tcum[i+1] = Tcum[i] + (i+1)

print(Tcum[b-a]-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
ans = n * (n + 1) // 2 - b
print(ans)

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

for n in range(999):
  if n*(n+1)/2 - a == (n+1)*(n+2)/2 - b:
    print(int(n*(n+1)/2 - a))

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

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

print(k - a)

Solution (Python):

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

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

if __name__ == '__main__':
	main()

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

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

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

if not (1 <= a <= b <= 499500):
    sys.exit()

b_hight = 0
for I in range(1,(b - a + 1)):
    b_hight += I

print(b_hight - b)

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

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

if __name__ == '__main__':
    main()

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

dif=b-a
sum=0

for i in range(1,dif):
    sum+=i
    
print(sum-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(int((B - A )*( B - A +1)/2 - B ))

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

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

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

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

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

Solution (Python):
height=[]
for i in range(1,1000):
    height.append((1+i)*i//2)

a,b=map(int,input().split())
for i in range(998):
    if height[i+1]-height[i]==b-a:
        print(height[i]-a)

Solution (Python):
def actual(a, b):
    towers = [1]
    for x in range(2, 999 + 1):
        towers.append(towers[-1] + x)

    for i in range(len(towers)):
        west_tower_height = towers[i]
        east_tower_height = towers[i + 1]

        assert east_tower_height > west_tower_height

        diff = east_tower_height - west_tower_height

        if diff == (b - a):
            return east_tower_height - b

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


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


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

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