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



Sample input:
8 13


Sample output:
2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    a, b = list(map(int, input().split(" ")))
    diff = b - a
    b_height = 0
    for i in range(1, diff+1):
        b_height += i
    print(b_height - b)    

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
a, b = [int(num) for num in input().split()]
dif = b - a
hw = (dif-1)*dif/2
sol = hw - a
print(int(sol))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
a,b = map(int,input().split())
l = [(n*(n+1))//2 for n in range(1,1000)]
for i in range(len(l)-1):
  if l[i+1]-l[i] == b - a:
    print(l[i]-a)
    sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc099/tasks/abc099_b

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

num = 0
for i in range(1, 999):
    if b - a == i + 1:
        num = i
        break
ans = num * (num + 1) // 2 - a
print(ans)

Submission status: Accepted

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

print(int(0.5*(b-a)*(b-a-1)-a))

Submission status: Accepted

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

sub_AB = abs(A-B)

A_height = 0
for i in range(1, sub_AB):
    A_height += i

print(A_height - A)

Submission status: Accepted

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

c = b-a

pole = 0

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

print(pole-a)

Submission status: Accepted

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

sabun = b-a

high = 0

for i in range(sabun):
    high += i
    
print(high-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B
a, b = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
table = [1, ]
for i in range(2, 1000):
    table.append(table[i-2] + i)

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

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

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  a,b = map(int,input().split())
  print(int((b-a) * (b-a+1)/2 - b))
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
a, b = map(int, input().split()) # 入力が複数

n = 1
t = 0
for i in range(2, 1000):
    if (n - i) - a == n - b:
        t = n
        break
    n += i
ans = t - a
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n = b - a - 1

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = b-a
k = 1
l = 0
ans = -1
for i in range(2, 1000):
    l = k
    k += i
    if k-l == c:
        ans = k-b
        break

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
height_a = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sub - b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,(input().split()))
x = b - a #塔の高さの差分
result  = 0 
for i in range(x+1):
    result += i

print(result - b)

Submission status: Accepted

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

n = b-a

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

Submission status: Accepted

Solution code:
def Stone_Mounment(a , b):

    i = b - a

    return i * (i + 1) // 2 - b

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def factorial(n):
    if n == 1:
        return 1
    else:
        return n + factorial(n - 1)


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

diff = b - a

print(factorial(diff - 1) - a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
tmp=0

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

print(tmp-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans - b)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

n = b-a-1
x1 = n*(n+1)/2 - a
#x2 = (n+1)*(n+2)/2 - b

print( int(x1) )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 1
l = [1]
m = []

for i in range(2, 1000):
    cnt += i
    l.append(cnt)

for j in range(len(l) - 1):
    d = l[j + 1] - l [j]
    m.append(d)
n = m.index(b - a)
print(l[n] - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc099 b
a,b=map(int,input().split())
x=b-a
s=0
for i in range(x):
    s+=i
ans=s-a
print(ans)

Submission status: Accepted

Solution code:
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


a, b = readints()
#print(a, b)
sum = 0
x = []
for i in range(1, 1000):
    sum += i
    x.append(sum)
# print(x)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#pypyは内包表記使わない, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 1000000007

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
x = 1
y = 3
for i in range(10**5):
    if x-a == y-b:
        print(x-a)
        break
    else:
        x += i+2
        y += i+3

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from itertools import accumulate, tee


def pairwise(iterable):
    a, b = tee(iterable)
    next(b, None)
    return zip(a, b)


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

towers = list(accumulate(range(1, 1000)))

for p, n in pairwise(towers):
    if n - p == b - a:
        print(p - a)
        break

Submission status: Accepted

Solution code:
def kaijou(num):
    wa = 0
    for i in range(num, 0, -1):
        wa += i
    return wa
a, b = map(int, input().split())
dst = kaijou(b-a) - b
print(dst)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(i) for i in input().split()]
b=a[0]
c=a[1]
x=c-b
print(round((x+1)*x/2)-c)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
n=b-a
high=1
for i in range(2,n):
    high+=i

print(high-a)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

sa = y-x
tou = 0

for i in range(1,sa):
    tou += i
print(tou-x)

Submission status: Accepted

Solution code:
#ABC099

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

Submission status: Accepted

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

print(sum(a_l)-a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dif = b - a
org = sum([x for x in range(1,dif)])
print(org-a)

Submission status: Accepted

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

c = b - a

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

ans = x - a 

print(ans)

Submission status: Accepted

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

res=1
A=[res]
for i in range(2,1000):
    res+=i
    A.append(res)
    if A[i-2]-a==res-b:
        print(res-b)
        exit()

Submission status: Accepted

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

diff = b - a
alen = ((diff-1) * diff) // 2
print(alen - a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = (int(x) for x in input().split())
s = 0
d = b - a

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

print(s-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

a, b = na()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    c=b-a
    ct=0
    for i in range(c):
        ct+=i
    print(ct-a)
if __name__ == '__main__':
    do()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

a,b=LI()
x=b-a
ans=x*(x-1)//2-a

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H = [1]
for i in range(2, 1000):
    H.append(H[-1] + i)

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

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

Submission status: Accepted

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

print(sum(l)-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

diff = b - a
hight = 0
for k in range(diff):
    hight += k
print(hight - a)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
def gauss(n):
    ans = n * (n - 1) // 2
    return ans

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
res = 0
for i in range(1, y-x):
    res += i
    

print(res-x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    west_tower_height, east_tower_height = map(int, input().split(" "))
    east_tower_num = east_tower_height - west_tower_height
    print(east_tower_num * (east_tower_num + 1) // 2 - east_tower_height)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())

    print((B - A) * (B - A + 1) // 2 - B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())
    T = [i for i in range(1, 1000)]
    print(sum(T[:B - A]) - B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
h = b-a
tmp = [sum(range(1,i)) for i in range(1,h+2)]
print(tmp[-1] - b)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
lst = []
s = 0

for i in range(1, 1001):
    s += i
    lst.append(s)

for i in range(999):
    x = lst[i] - a
    y = lst[i+1] - b

    if x == y and x > 0 and y > 0:
        print(x)

Submission status: Accepted

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

d = b-a

arr = [0] * 1000
for i in range(1,len(arr)):
    arr[i] = arr[i-1] + i
print(arr[d]-b)

Submission status: Accepted

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

N = b - a

cnt = 0
for n in range(1, N+1):
    cnt += n
    
print(cnt - b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 10分くらい
# 999を99と間違って理解.よく読め！

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

wa=(x**2+x)//2
print(wa-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
ans1 = 0

for i in range(1, 1000):
    ans += i
    ans1 += i-1
    
    if(ans-ans1 == b-a):
        print(ans-b)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
def calc(n):
    return (n*(n+1))//2
ab = b -a
B = calc(ab)
ans = B - b
print(ans)

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0

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

print(count - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

_a, _b = map(int, input().split())
print(solve(_a, _b))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

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

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
tmp = b-a
while(tmp):
    ans += tmp
    tmp -= 1
print(ans-b)