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:
#!/usr/bin/env python

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = input().split()
a = int(a)
b = int(b)
c = b-a 
sum = 0
for x in range(0,c):
    sum += 2*x
sum += c
s = (sum - a - b)//2
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

sub = b - a

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

print(n-b)

Submission status: Accepted

Solution code:
x = list(map(int,input().split( )))
z = x[1]-x[0]
t = 0
for s in range(z+1):
    t += s
    
print(t-x[1])

Submission status: Accepted

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

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

print(count-b)

Submission status: Accepted

Solution code:
s= input().rstrip().split()
a = int(s[0])
b = int(s[1])

d = b - a

c = int((d+1)*(d/2))

print(c-b)

Submission status: Accepted

Solution code:

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

def main(nums):
	
	w = nums[0] 
	e = nums[1]
	
	return func(e-w) - e


nums = input().split(" ")
nums = [int(c) for c in nums]

print(main(nums))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

sub = b - a
num = 0
has_height_a = False
has_height_b = False
for i in range(1, sub+1):
    num += i
    
print(num - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

B = b - a

print(towers[B] - b)

Submission status: Accepted

Solution code:
import sys

a, b = tuple([int(x)for x in sys.stdin.readline().split()])
diff = max(a, b) - min(a, b)

c = 0
for i in range(1, 1000):
    if diff == i:
        print(c - a)
        break
    c += i

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
for I in range(1,1000):
	C=I*(I+1)/2
	if C>A:
		D=(I+1)*(I+2)/2
		if D>B and (C-A)==(D-B):
			break
print(int(C-A))

Submission status: Accepted

Solution code:
a, b = list(map(int,input().strip().split(' ')))
i=b-a-1
h_i=i*(i+1)/2
h=h_i-a
print('%d' %h)

Submission status: Accepted

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

Submission status: Accepted

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

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

res = total-b
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(r-b)

Submission status: Accepted

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

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

x = b-a
print(((x*(x-1))>>1) - a)

Submission status: Accepted

Solution code:
def summation(n):
    ans = 0
    for i in range(n+1):
        ans += i
        
    return ans


def main():
    a,b = map(int, input().split())
    
    n_plus1 = b-a
    
    ans = summation(n_plus1) - b
    
    print(ans)
    
    return 0

    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

def f(x):
    return x

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

height = sigma(f, 1, honsu)
print(height-b)

Submission status: Accepted

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

k = b - a - 1

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

print(a_i - a)

Submission status: Accepted

Solution code:
def height(x):
    sum = 0
    for i in range(x):
        sum += i+1
    return sum

line = input().split()
a = int(line[0])
b = int(line[1])

a_pos = b - a - 1
a_height = height(a_pos)

print(a_height - a)

Submission status: Accepted

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

n=b-a-1

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

print(h(n)-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:
fib = [0]*1000
for i in range(1, 1000):
    fib[i] = fib[i-1] + i
a, b = map(int, input().split())
dif = b-a
print(fib[b-a]-b)

Submission status: Accepted

Solution code:
a=list(map(int,input().split(' ')))
d=a[1]-a[0]
s=int(d*(d+1)/2)
print(s-a[1])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import accumulate


def main():
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    c = list(accumulate(range(1, 1000)))
    for i in range(len(c) - 1):
        if (c[i + 1] - c[i]) == (b - a):
            print(c[i] - a)
            return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans-b)

Submission status: Accepted

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

step = 2
towers = [1]
i = 1
while True:
    towers.append(towers[i-1] + step)
    
    if towers[i] >= 499500:
        break
    i += 1
    step += 1


depth = towers[(b-a)-1] - b
print(depth)

Submission status: Accepted

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



def createTriangularNumber(n):
    list_ = []
    list_.append(1)
    for k in range(2, n+1):
        list_.append(list_[-1] + k)
    return list_

triangular_number = createTriangularNumber(999)
diff = b - a
true_a = triangular_number[diff-2]
true_b = triangular_number[diff-1]
print(true_a - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://beta.atcoder.jp/contests/abc099/tasks/abc099_b
# B - Stone Monument

# B_Stone_Monument.py

height_west, height_east = map(int, input().strip().split(" "))

num_east = height_east - height_west

real_height_east = 0
for i in range(1, num_east+1):
    real_height_east += i

print(real_height_east - height_east)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sum(n):
    ans=0
    for i in range(n+1):
        ans+=i
    return ans

a,b=list(map(int,input().split()))
c=b-a
print(sum(c)-b)

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

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

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

l = b - a - 1
print(fib(l) - a)

Submission status: Accepted

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

Submission status: Accepted

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

s = b - a 
l = 0.5*s*(s+1)

print(int(l-b))

Submission status: Accepted

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

for i in range(2,1000):
    v = x[i-2] + i
    x.append(v)
#print(x)

for i in range(1,len(x)):
    if x[i-1]-a == x[i]-b:
        ans = x[i-1] - a
        break
print(ans)

Submission status: Accepted

Solution code:
line = input().split(' ')
a = int(line[0])
b = int(line[1])
n = b - a
h = int(n*(n+1)/2)
print(h-b)

Submission status: Accepted

Solution code:
# coding: utf-8

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

diff = b - a
b_height = diff * (diff + 1) / 2
snow_height = int(b_height - b)

print(snow_height)

Submission status: Accepted

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

Submission status: Accepted

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

d = b - a
w_high = (1 + d) * d / 2
# e_high = w_high - d

ans = int(w_high - b)

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
n = b-a #右の塔はｎ本目
hidari = n*(n-1) / 2 #右（ｎ－１本目）の塔の高さ
ans = hidari - a
print(int(ans))

Submission status: Accepted

Solution code:
N = input()
N = N.split(" ")
N = [int(i) for i in N]

sub = N[1] - N[0]
high = 0 
for i in range(sub):
    high += i
snow = high - N[0]
print(snow)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n = b - a - 1
h = 0

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

print(h-a)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

h = [0]
for i in range(1,1010):
    h.append(h[i-1] + i)

tmp_i = b - a - 1
print(-a + h[tmp_i])

Submission status: Accepted

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

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

Submission status: Accepted

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

paulnum=B-A
snow=(paulnum-1)*paulnum/2-A
print(int(snow))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = input().split()
a = int(l[0])
b = int(l[1])
# print(a, b)
num = 0
for x in range(1, b - a + 1):
    num += x
print(num - 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:
a,b = list(map(int,input().split()))

n = b-a
num = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 10 19:50:26 2018
ABC99B
@author: maezawa
"""

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

n = b - a

tn = sum([i for i in range(1, n+1)])
snow = tn - b
print(snow)

Submission status: Accepted

Solution code:
m, n = map(int, input().split())
array = [x for x in range(1,1000)]

tmp = abs(m-n)
print(sum(array[:tmp-1])-m)

Submission status: Accepted

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

total = [(n * (n+1)) // 2 for n in range(1, 1000)]

pos = 0
found = False
while not found:
    if total[pos] > a and total[pos] - a == total[pos+1] - b:
        found = True
    else:
        pos += 1

print(total[pos] - a)

Submission status: Accepted

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

Submission status: Accepted

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

N = abs(A-B)
N = N - 1 
S = 0.5*N*(N+1)
print(int(S-A))

Submission status: Accepted

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

c = b - a

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

print(real - a)

Submission status: Accepted

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

print(i-b)

Submission status: Accepted

Solution code:
# 1 3 6 10 15

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

sub = b - a

sum_num = 0
for i in range(sub):
    sum_num += i + 1

print(sum_num - b)

Submission status: Accepted

Solution code:
import bisect
a, b = map(int, input().split())
x = 0
li = []
for i in range(1, 1000):
    x += i
    li.append(x)
ids = bisect.bisect_left(li, a)-1
for i in range(ids, len(li)):
    x = abs(li[i]-a)
    y = abs(li[i+1]-b)
    if x == y:
        print(x)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = (int(e) for e in input().split())

n = b - a

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
if __name__ == "__main__":
    a, b = list(map(int, (input().split(' '))))
    buf_ls = []
    buf = 0
    buf2 = b - a
    for i in range(0, 1000):
        buf += i+1
        buf_ls.append(buf)
        if buf2 == (i+1):
            print(buf_ls[i] - b)
            sys.exit()

Submission status: Accepted

Solution code:
def main():
    a, b = map(int, input().split())
    b_pos = b - a
    h = height(b_pos) - b
    print(h)

def height(pos):
    return (1 + pos) * pos // 2

main()

Submission status: Accepted

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

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

answer = height - a
print(answer)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B):
    d = B - A
    ans = (d * (d - 1) // 2) - A
    return ans


def main():
    A, B = read_int_n()
    print(slv(A, B))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def triangle(n):
    return (n*(n+1))//2

#firsttriangles = []
#for i in range(1,1000):
#    firsttriangles.append(triangle(i))

ins = input().split(' ')
a = int(ins[0])
b = int(ins[1])

#for i in range(0,999):
#    if firsttriangles[i] > a:
#        print(abs(a-firsttriangles[i]))
#        break

print((triangle(b-a))-b)

Submission status: Accepted

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


input_line = input().split()

west_margin = int(input_line[0])
east_margin = int(input_line[1])

delta = east_margin - west_margin

west_height = delta2height(delta)
snow_height = west_height - west_margin

print(str(snow_height))

Submission status: Accepted

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

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:
a, b = [int(x) for x in input().split(" ")]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
d = b - a
tmp = 0
for i in range(1, d + 1):
    tmp += i
print(tmp - b)

Submission status: Accepted

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


print(x-b)

Submission status: Accepted

Solution code:
list1=[1]
for i in range(2,1000):
    list1.append(list1[i-2]+i)
    
#print(list1[0:5])

line=input()
line=line.rstrip().split(" ")
a=int(line[0])
b=int(line[1])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a,b = map(int,input().split())
temp = 1
for i in range(2,1000):
    temp2=temp
    temp += i
    if (temp2 - a == temp - b) and ((temp2-a)>=0):
        print(temp2-a)
        sys.exit()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = map(int, raw_input().split())
a = x[0]
b = x[1]

add = 0

for i in xrange(1, b-a+1):
	add += i

print add - b

Submission status: Accepted

Solution code:
#coding:utf-8

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

dif = b-a

heightList = [num for num in range(1,dif+1)]

total = sum(heightList)
print(total - b)

Submission status: Accepted

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

original_a = int(0.5 * (b - a) * (b - a - 1))

print(original_a - a)

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:
import math

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

n = b-a-1
m = math.floor(n * (n+1) / 2  - a)

print(m)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(int(sekisetu))

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from collections import Counter
from pprint import pprint as pp

YN = {True: 'Yes', False: 'No'}
ri = lambda: int(input())
ria = lambda: list(map(int, input().split()))
rian = lambda n: [ria() for _ in range(n)]
rs = lambda: input()
rsa = lambda: input().split()
rsn = lambda n: [rs() for _ in range(n)]

a,b = ria()

l = []
m = 0
for i in range(1000):
  m += i
  l.append(m)

print(l[b-a] - b)

Submission status: Accepted

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

c = b - a

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

print(count)

Submission status: Accepted

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

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

print(int(x))

Submission status: Accepted

Solution code:
import math
def fact(n):
    val = 1
    for i in range(2, n + 1):
        val += i
    return val

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

Submission status: Accepted

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

diff = b - a

sum = 0
for i in range(diff):
    sum = sum + i

print(sum - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dif = b -a 

a_length = 0
for i in range(1, dif):
    a_length += i

print(a_length - a)

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:
def main():
    A, B = map(int, input().split())

    d = B - A
    l = (d * (d + 1)) // 2
    print(l - B)

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(westTowerHeight - a)

Submission status: Accepted

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

Submission status: Accepted

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

diff = b - a
b_h = sum([n for n in range(1, diff+1)])

print(b_h - b)

Submission status: Accepted

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

Submission status: Accepted

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

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


ans = length - b
print(ans)

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

dif = b - a

height_west = dif * (dif - 1) // 2

thickness = height_west - a

print(thickness)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n = abs(a-b)
tree_1 = 0
tree_2 = 0
for i in range(1,n):
    tree_1 += i
for i in range(1,n+1):
    tree_2 += i

print(tree_1 - a)

Submission status: Accepted

Solution code:
a, b = map(int, raw_input().strip().split())
diff = b - a
print sum([i for i in xrange(1, diff)]) - a

Submission status: Accepted

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

sub = b - a

i = 0
cnt = 0

for i in range(sub + 1):
    cnt = cnt + i

print(cnt - b)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(x-b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

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

diff = b - a
sum = 0

for i in range(1, diff+1):
    sum += i

print(sum - b)

Submission status: Accepted

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

def length(x):
    count = 0
    for i in range(x):
        count += i + 1

    return count

print(length(b - a)-b)

Submission status: Accepted

Solution code:
def main():
    x, y = map(int,input().split())
    n = y - x - 1
    r = n * (n+1) / 2 - x

    print(int(r))

main()

Submission status: Accepted

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

c = b - a

sum = 0

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

answer = sum - a

print(answer)

Submission status: Accepted

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

import os
import sys

def main():
    li = input().split()
    x = int(li[0])
    y = int(li[1])
    xheight = height(y-x-1)
    print(xheight - x)

def height(x):
    return sum(range(1, x + 1))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,m  = map(int,input().split())
lis = [1]
for i in range(1000):
  lis.append(i+2+lis[i])
  if m-n == lis[i+1]-lis[i]:
    print(abs(m-lis[i+1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(y-b)

Submission status: Accepted

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

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

    diff = b - a
    w = xs[diff]
    ans = w - b
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

diff = b-a

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n = b - a

length = 0
for i in range(n):
    length += i

print(length - a)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B


if __name__ == '__main__':
    a, b = list(map(int, input().split()))
    n = b - a
    print(n * (n - 1) // 2 - a)

Submission status: Accepted

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

    x = int((0.5 * (b - a) * (b - a + 1))) - b

    print(x)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(s-b)

Submission status: Accepted

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

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

print(k - a)

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

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

n = b - a - 1

s = 0
while(n > 0):
    s += n
    n -= 1

print(s - a)

Submission status: Accepted

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

N = b-a-1

L = int(N*(N+1)/2) - a

print(L)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(s-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# your code goes here
a,b = map(int,input().split())

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

print(height-a)

Submission status: Accepted

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

Submission status: Accepted

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

c = b - a
tmp = 0
for i in range(c):
    tmp += i + 1
print(tmp - 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:
a, b = map(int, input().split())
# 1 ~ (b-a)の総和 - b
print(int((b-a) * (b-a + 1) / 2 - b))

Submission status: Accepted

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

Submission status: Accepted

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

k = a[1] -a[0]
al = 0

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

print(al - a[0])

Submission status: Accepted

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

diff=b-a+1
sum=0

for i in range(diff):
 sum+=i

print(sum-b)

Submission status: Accepted

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