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

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

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

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

print(d-b)

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

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

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

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

Solution (Python):
from itertools import accumulate
t = [n for n in accumulate(range(10000))]
 
a, b = map(int, input().split())
print(t[b - a] - b)

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

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


abc()

Solution (Python):
def delta2lower_height(arg_num):
    height = 0
    for i in range(1, arg_num):
        height += i
    return height


lower_margin, higher_margin = map(int, input().split())

delta = higher_margin - lower_margin

lower_height = delta2lower_height(delta)
snow_height = lower_height - lower_margin

print(snow_height)

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

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

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

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

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

Solution (Python):


a, b = map(int, input().split())
x = b-a
ab = [1]
for i in range(x-1):
    ab.append(ab[i]+i+2)
print(ab[x-1]-b)

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

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

a, b = list(map(int, sys.stdin.readline().split()))

i = b - a

s = 0
for j in range(1000):
    s += j
    if j == i:
        print(s - b)
        exit()

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

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

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

print(ans -a)

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

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

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

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

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

A = int((1/2)*c*(c-1))
B = int((1/2)*(c+1)*(c))

print(A-a)

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

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

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

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

for j in range(snowless[-1]):
    if a + j in snowless and b + j in snowless:
        ans = j

print(ans)

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

    n = b - a

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

    answer = L_east - b

    print(answer)

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

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

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

i = abs(b - a) 

hb = (i + 1) * (i // 2) if i % 2 == 0 else (i + 1) * (i // 2) + (i + 1) // 2
print(hb - b)

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

i = abs(b - a) 

hb = (i + 1) * (i // 2) if i % 2 == 0 else (i + 1) * (i // 2) + (i + 1) // 2
print(hb - b)

Solution (Python):

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
del data
print(sum(list(range(1,b-a+1)))-a-(b-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())
diff = b - a
print((1 + diff) * diff // 2 - b)

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

s = b-a

y = s*(s-1)/2 - a

print(int(y))

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

for i in range(d):
	B += (i + 1)

ans = B - b

print(ans)

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

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

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):
a, b = map(int, input().split())
total = 0
for i in range(1, b - a):
  total = total + i

print(total - a)

Solution (Python):
a, b = map(int, input().split())
num = []
for i in range(1, 999+1):
    num.append(i)
    
diff = b-a
index = [i for i in range(len(num)) if num[i]==diff][0]
true_b = sum(num[:index+1])
true_a = sum(num[:index])
print(true_a- a)

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

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

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

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

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

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

Solution (Python):

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


x1=1


y=1

for i in range(998):
  
  y+=1

  
  x2=x1+y

  
  if x2-x1==b-a:
    
    print(x1-a)
    break

  
  x1=x2

Solution (Python):

import sys


def solve(a: int, b: int):
    print(sum([i for i in range(b-a)]) - a)
    return



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

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
def MI(): return map(int, input().split())
def II(): return int(input())
def IS(): return input()
def LI(): return list(map(int, input().split()))

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

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

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

hight_tower = 0

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

print(hight_tower - a)

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

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

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

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

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

sabun = b - a
cnt = 0

while sabun > 0:
  cnt += sabun
  sabun -= 1

print(cnt - b)

Solution (Python):
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b = f()
    n = b- a
    print(sum(range(n+1)) - b)

solve()

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

Solution (Python):


import sys


s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    a, b = i2nn()
    d = b - a
    h = int(d * (d - 1) / 2)
    snow = h - a
    print(snow)

main()

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

sa = b - a

wa = (sa * (sa+1))//2

print (wa-b)

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

num = 0

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

print(num - b)

Solution (Python):

import sys


def solve(a: int, b: int):
    d = b - a
    ret = 0
    for i in range(d + 1):
        ret += i
    ret -= b
    print(ret)
    return


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

if __name__ == '__main__':
    main()

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





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

    sub = b - a
    ans = 0

    for i in range(sub):
        ans += i

    ans -= a
    print(ans)

if __name__ == '__main__':
    main()

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

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

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

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

print(ans-A)

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

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

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

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

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

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

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

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

tb_i = b - a

hb = 0
for i in range(1, tb_i+1):
    hb += i

print(hb-b)

Solution (Python):


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

    print(count - b)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):


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

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

if __name__ == "__main__":
    solve()

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

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

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

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

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

if __name__=='__main__':
    main()

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

sub = b-a

sin_a = 0

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

print(sin_a - a)

Solution (Python):
t=list(map(int,input().split()))
a=[i+1 for i in range(1,999)].index(t[1]-t[0])+1
print(int(0.5*(a+a**2)-t[0]))

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):
import sys
a,b = list(map(int, input().split()))
heights_a = 0
for i in range(1,b-a):
    heights_a += i
print(heights_a - a)

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


if __name__ == "__main__":
  main()

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

Solution (Python):

def read_input():
    a, b = map(int, input().split())
    return a, b


def submit():
    a, b = read_input()

    increment = b - a
    b_tall = sum(range(1, increment + 1))

    print(b_tall - b)

if __name__ == '__main__':
    submit()

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

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

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

Solution (Python):

import numpy as np
import math
import re

n = input()
n = re.split(" ",n)
a = int(n[0])
b = int(n[1])
x = b - a

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

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

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

c = list(range(1,999+1))

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

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

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

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

Solution (Python):
import sys
import math


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


def get_h(n):
    ret = 0
    for i in range(1, n+1):
        ret += i
    return ret
    

h = get_h(b-a)
print(h-b)

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

Solution (Python):
A,B = map(int,input().split())
C = sum(list(range(B-A)))
print(C-A)

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

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

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

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

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

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

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

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

Solution (Python):

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

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

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

Solution (Python):



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


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

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

Solution (Python):
import sys
import numpy as np

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(' ')]

a, b = readIntN()
l = b - a
ret = (l * (l + 1) // 2) - b
print(ret)

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

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

n = B - A
lsum = sum(range(n))
rsum = lsum + n

print((sum([lsum, rsum]) - sum([A, B])) // 2)

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

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

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

l = [1]
for i in range(2, 1000):
    l.append(l[i-2] + i)
    
diff = b - a

print(l[diff-1] - b)

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

dif = b - a 


def hgt(x):
  return round( (x+1)*x / 2 )

print(hgt(b-a)-b)

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

for i in range(1, calc):
    a_hight += i

print(a_hight - a)

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

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

Solution (Python):




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


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


ans = sth - a


print(ans)

Solution (Python):

import sys
INF = float("inf")


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


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


if __name__ == '__main__':
    main()

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

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

for i in range(bo):
    sum += (i + 1)

print(sum - 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())
x = 0

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

print(x - b)

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

Solution (Python):
a,b = map(int, input().split())
height = []
cnt = 0
for i in range(1,1000):
    cnt += i
    height.append(cnt)
for i in range(999):
    if height[i]-a == height[i+1]-b:
        print(height[i]-a)
        break
    else:
        continue

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

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

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

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

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

d = b-a

ans = (d-1)*d//2 - a


print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

a, b = MAP()

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

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


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

a, b = MAP()

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

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

def calc(n):
    count = 0
    for i in range(1, n+1):
        count += i
    return count

print(calc(b - a) - b)

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

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

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

Solution (Python):
def sigma(num):
  ret=0
  for i in range(num+1):
    ret+=i
  return ret

n,m=map(int,input().split())
a=sigma(m-n)
print(a-m)

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

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

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


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

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

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

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

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

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

Solution (Python):
from itertools import accumulate as acc
a=[i for i in range(1000)]
a=list(acc(a))

A,B=map(int,input().split())
print(a[B-A]-B)

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

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

print(t - a)

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

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

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

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

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

x=b-a
d=sum(x)
ans=d-b
print(ans)

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

d = b - a

s = 0

for i in range(d+1):
  s += i
  
ans = s - b

print(ans)

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

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

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

left = 0
right = 1

for i in range(1,1000):
    left += i
    right += (i + 1)

    if a - left == b - right:
        print(left - a)

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

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

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

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

h = [0] * 999
t = 0
for i in range(1, 1000):
    t += i
    h[i-1] = t

import bisect

x = 1
while True:
    i = bisect.bisect_left(h, a+x)
    if h[i] == a+x and h[i+1] == b+x:
        break
    x += 1

print(x)

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

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

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

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

Solution (Python):

l = [i for i in range(1, 1000)]
L = [sum(l[:i+1]) for i in range(len(l))]
L_sa = [L[i+1] - L[i] for i in range(len(L)-1)]
a, b = map(int, input().split())
for i in range(len(L_sa)):
    if b-a == L_sa[i]:
        print(L[i] - a)

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