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())
s = [0] * 1002
for i in range(1002):
    s[i] = s[i - 1] + i
    if (s[i - 1] - a == s[i] - b):
        print(s[i - 1] - a)
        break

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

j = 0
l = []

for i in range(1,1000):
    j +=i
    l.append(j)


print( l[abs(b - a - 1)] - b)

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

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

for i in range(1, 1000):
    if height[i]-height[i-1] == b-a:
        print(height[i]-b)
        exit()

Solution (Python):
def asa(N) :
    li = [0] * 1001
    li[0] = 0
    for i in range(1001) :
        li[i] = li[i-1] + i
    return li[N]
import sys
input = sys.stdin.readline
a,b = [int(i) for i in input().split()]
k = asa(b-a)
print(k-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())
for i in range(1,1000):
  if b-a == i:
    print(sum(range(i))-a)

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


B_true = (B - A) * (B - A + 1) // 2
answer = B_true - B

print(answer)

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

n = b - a
h = 0

for i in range(n+1):
    h += i
print(h-b)

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

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

print(int(m-a))

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

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

for i in range(1, 1000):
    tower[i] = tower[i-1] + (i + 1)
    diff_a = tower[i-1] - a
    diff_b = tower[i] - b
    if (diff_a == diff_b) and diff_a > 0 and diff_b > 0:
        print(diff_a)
        break

Solution (Python):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, M, = map(int, input().split())







c = M - N
def f(n):
     return (1 + n) * n // 2

print(f(c) - M)

Solution (Python):

a,b = map(int,input().split())
d = b - a
wa = 0

for i in range(1,d+1):
    wa += i
print(wa - b)

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

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

Solution (Python):

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

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

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())
lst = [0] * 999
lst[0] = 1
for i in range(998):
    lst[i + 1] = lst[i] + (i + 2)

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

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

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

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

Solution (Python):
from itertools import accumulate
from operator import add
l=list(range(1,1000))
A,B=map(int,input().split())
lst=list(accumulate(l,add))
print(lst[B-A-1]-B)

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

print(height-n)

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

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

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

delta_h = b - a
h_2 = cumsum(delta_h)
print(h_2 - b)

Solution (Python):
import sys

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

def main():
    i = b - a - 1
    return (1 + i) * i // 2 - a

if __name__ == '__main__':
    ans = main()
    print(ans)

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

for i in range(1, 1000):
    c += i
    lst.append(c)


for i in range(999):
    if lst[i]>a and lst[i+1]>b and lst[i]-a==lst[i+1]-b:
        print(lst[i]-a)
        break

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

print(length_b - b)

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

res = b-a

n = res-1

sum = 0.5*(n)*(n+1)

print(int(sum)-a)

Solution (Python):
MOD=10**9+7
cnt=0; 


def gs(): return input()
def gi(): return int(input())
def gsmi(): return [int(n) for n in input().split()]

def desc(ar): return sorted(ar,reverse=True)
def printend(s): print(s);import sys;sys.exit()

a,b=gsmi()
diff=b-a
l = sum(range(1,diff-1+1))
print(l-a)

Solution (Python):
a,b=map(int,input().split())
num=0
nums=[]
for i in range(1,1000):
    num+=i
    nums.append(num)
for i in range(998):
    if nums[i]-a==nums[i+1]-b:
        print(nums[i]-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())

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

Solution (Python):
import sys
input = sys.stdin.readline
a, b = [int(x) for x in input().split()]
c = b - a
h = 0
for i in range(1, c+1):
    h += i
print(h - b)

Solution (Python):
a,b = map(int,input().split())
L = []
tmp = 0
for i in range(10000):
    tmp += i
    L.append(tmp)

point = b-a
print(L[point]-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 - 1

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

Solution (Python):


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

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

"""
8 13

2

54 65

1
"""

Solution (Python):


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

def tower(i):
    h = 0
    for i in range(1, i+1):
        h += i
    return h

delta = b - a

print(tower(delta) - b)

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

diff = b-a
tall = diff*(diff+1)/2
print(int(tall-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())
tower = [1]*999
for i in range(1,999):
    tower[i] = i + 1 + tower[i-1]
print(tower[b-a-1]-b)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

c = b - a
d = 0

print(sum(range(c+1)) - b)

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

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

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

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

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

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

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

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

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

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

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

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

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

result = 0



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

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

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

Solution (Python):

import sys


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

if __name__ == '__main__':
    main()

Solution (Python):
A,B=[int(s) for s in input().split()]
x=B-A
y=x*(x-1)//2
print(y-A)

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

Solution (Python):
def main(a: int, b: int):
    print(int((b - a) * (b - a + 1) / 2 - b))


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

    main(a, b)

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

d = b - a

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

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

H = [ i for i in range(1,1000) ]
S = []
for i in H:
    X = sum(H[0:i])
    S.append(X)



for j in range(999):
    if (S[j-1] - A)==(S[j] - B):
         print(S[j-1]- A)

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

t = b - a

test = 0

for i in range(t):
	test = test + i
	
print(test-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())
diff = b - a
east = ((1 + diff) * diff) // 2
print(east - b)

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

n = b - a
snow = sum(range(n + 1)) - b
print(snow)

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

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

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

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

ans = b_real -b
print(int(ans))

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

Solution (Python):
def examB():
    A, B = LI()
    IL = [0]*1000
    for i in range(999):
        IL[i+1] = IL[i]+(i+1)
    ans = IL[B-A] - B
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Solution (Python):

import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

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

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

c = b - a

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

Solution (Python):
a, b = map(int, input().split())
Y = []
Y.append(1)
for i in range(998):
    Y.append(Y[-1] + i + 2)
for i in range(998):
    l = Y[i]
    r = Y[i + 1]
    if l - a == r - b:
        print(l - a)
        exit()

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

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

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

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

n = b-a

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

print(ans-a)

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

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

print(height - a)

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

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

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

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

for i in range(len(ls)-1):
    if (ls[i+1] - ls[i]) == t:
        print(ls[i]-a)

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

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

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


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

if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
import fractions

a,b = [int(x) for x in stdin.readline().rstrip().split()]

dp = [0]*999
dp[0] = 1

for i in range(1,999):
    dp[i] = dp[i-1] + i+1
    if b-a == dp[i]-dp[i-1]:
        print(dp[i]-b)
        exit()

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

Solution (Python):

a, b = [int(s) for s in input().split()]

difference = b - a
print(sum(range(difference + 1)) - b)

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

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

sub = b - a

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

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

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

print(ans)

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

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

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

l = []

value = 0

for i in range(999):
  value += i+1
  l.append(value)
  
print(l[b-a-2]-a)

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

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

diff=b-a

height=0
for i in range(diff):
  height+=i
  
print(height-a)

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

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

solve()

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

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

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

print(cnt-a)

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

Solution (Python):



import sys













def main():
    a, b = (int(x) for x in sys.stdin.readline().split())
    diff = b - a
    altitude = (1 + diff - 1) * (diff - 1) // 2 - a
    print(altitude)



if __name__ == "__main__":
    
    main()

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

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

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

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


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

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


if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
n = [int(i) for i in input().split()]
s = 0
for i in range(n[1]-n[0]):
  s+=i
print(s-n[0])

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

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

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

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

Solution (Python):
a, b = (int(x) for x in 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 = map(int,input().split())

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

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

c = b-a

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

print(cnt-a)

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

Solution (Python):



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


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


print(int(ans))

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

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

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

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

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

print(summary-a)

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())
c=int(b-a)
A,B=0,0
for i in range(c):
    A+=i
    B+=i+1
print(abs(A-a))

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

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

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

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

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

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

def sumK(num):
    return(num*(num+1)//2)

print(sumK(b-a)-b)

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

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

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

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

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

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

print(j - 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())
for i in range(1,1000):
    if b == a+i+1:
        print(i*(i+1)//2-a)
        exit()

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

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

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

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

tower_height = [sum(list(range(1, x))) for x in range(2, 1001)]

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

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

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

Solution (Python):
def resolve():
  a, b = map(int, input().split())
  num_b = b - a
  height_b = 0
  for i in range(num_b + 1):
    height_b += i
  print(height_b - b)
  return

if __name__ == "__main__":
    resolve()

Solution (Python):
a,b = map(int, input().split())
c = b - a
i = 1
count = 0
while True:
  count += i
  if i == c:    
    break
  i += 1
print(count-b)

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())
tower = []
tmp = 0

for i in range(1, 1000):
    tmp += i
    tower.append(tmp)
    
count = b - a

print(tower[count - 1] - b)

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

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

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(1, abs(b - a) + 1):
        t += i
    print(t - b)


if __name__ == '__main__':
    slove()

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

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    tour = [(i * (i + 1)) // 2 for i in range(1, 1000)]
    a, b = map(int, input().split())
    v = 0
    for i, j in zip(tour[:-1], tour[1:]):
        if i < a or j < b:
            continue
        if i - a == j - b:
            v = i - a
            break
    print(v)


if __name__ == "__main__":
    main()

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

c=b-a
print(l[c-2]-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())

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

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

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

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

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

print(l[c-1] -b)

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

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

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

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

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

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

counter = 1
while True:
    val_a = 0.5 * counter * (counter + 1) - a
    val_b = 0.5 * (counter + 1) * (counter + 2) - b
    if val_a == val_b:
        counter = int(val_a)
        break
    counter += 1
print(counter)

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

Solution (Python):
def bb099up(a,b):
    tou = 0
    for i in range(1, 1000):
        tou += i
        if tou > a:
            snow = tou - a
            if snow+b == tou+i+1:
                return snow

def bb099():
    a,b = list(map(int, input().split()))
    print(bb099up(a, b))

bb099()

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

for i in range(1, 999):
    west_tower = 0
    for n in range(1, i + 1):
        west_tower += n
    east_tower = west_tower + (i + 1)
    if west_tower - a == east_tower - b:
        print(west_tower - a)
        break
    else:
        pass

Solution (Python):
a, b = map(int, input().split())
print(int((b-a)*(b-a+1)/2-b))
'''
(b-a)まで足す  
(b-a)(b-a+1)/2 高い方の木の高さ
(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):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b=map(int,input().split())
    n=b-a
    print(n*(n-1)//2-a)
resolve()

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

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

Solution (Python):
I = input().split()
S = int(I[1]) - int(I[0])
print (int(S * (S + 1) / 2) - int(I[1]))

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

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

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

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

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

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

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

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

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

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

x, y = 1, 3
while True:
    ax = x - a
    by = y - b
    if ax == by and ax >= 0 and by >= 0:
        break
    x, y = y, y + (y - x) + 1
print(ax)

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

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

Solution (Python):
def h(k):
    return (1 + k)*k // 2

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

ans = 1
for i in range(1, 999):
    x = h(i) - a
    y = h(i+1) - b
    if x == y:
        ans = x
        break
print(ans)

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

def S(i):
  return i*(i+1) //2

print(S(b - a) - b)

Solution (Python):

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

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

print(  int(tmp-a))

Solution (Python):

def main():
    A, B = tuple(map(int, input().split()))
    ans = sum(range(1, B - A)) - A
    print(ans)


if __name__ == "__main__":
    main()