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

Solution (Python):
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))

Solution (Python):
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)

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

Solution (Python):
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)

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

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

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

print(r-b)

Solution (Python):


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

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

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
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)

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

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

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

Solution (Python):
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()

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

Solution (Python):
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)

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

Solution (Python):





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)

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

Solution (Python):
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)

Solution (Python):


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)

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

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

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

print(int(l-b))

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

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


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

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

Solution (Python):


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)

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

Solution (Python):

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

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


ans = int(w_high - b)

print(ans)

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

Solution (Python):
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)

Solution (Python):
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)

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

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

n = b - a - 1
h = 0

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

print(h-a)

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

Solution (Python):
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)

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

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

Solution (Python):
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])

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

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

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

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

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

Solution (Python):
l = input().split()
a = int(l[0])
b = int(l[1])

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

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

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

n = b-a
num = 0

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

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

Solution (Python):
(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)

Solution (Python):

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

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

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

Solution (Python):
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)

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

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

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

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

c = b - a

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

print(real - a)

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

print(i-b)

Solution (Python):


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)

Solution (Python):
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

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

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

n = b - a

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

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

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

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

print(ans)

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

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

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

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

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

Solution (Python):
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()

Solution (Python):
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()

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

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

answer = height - a
print(answer)

Solution (Python):

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

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

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

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





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






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

Solution (Python):
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))

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

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

Solution (Python):
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)

Solution (Python):
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

Solution (Python):

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

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


print(x-b)

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


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

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

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

Solution (Python):
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()

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

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

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

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

Solution (Python):
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

Solution (Python):


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

dif = b-a

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

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

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

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

print(original_a - a)

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

Solution (Python):
import math

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

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

print(m)

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

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

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

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

print(int(sekisetu))

Solution (Python):
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)

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

c = b - a

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

print(count)

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

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

print(int(x))

Solution (Python):
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)

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

diff = b - a

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

print(sum - a)

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

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

Solution (Python):
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)

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

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

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

main()

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

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

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

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

print(westTowerHeight - a)

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

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

Solution (Python):
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)

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

Solution (Python):
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)

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

dif = b - a

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

thickness = height_west - a

print(thickness)

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

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

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

Solution (Python):
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)

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

Solution (Python):
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)

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

Solution (Python):
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)

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

Solution (Python):
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)

Solution (Python):
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)

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

    print(int(r))

main()

Solution (Python):
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)

Solution (Python):


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

Solution (Python):
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]))

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

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

Solution (Python):
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

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

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

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

print(y-b)

Solution (Python):
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()

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


diff = b-a

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

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

Solution (Python):


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

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

Solution (Python):
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)

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

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

n = b - a

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

print(length - a)

Solution (Python):





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

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

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

    print(x)


if __name__ == "__main__":
    main()

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

print(s-b)

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

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

print(k - a)

Solution (Python):


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

n = b - a - 1

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

print(s - a)

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

N = b-a-1

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

print(L)

Solution (Python):
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)

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

Solution (Python):
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)

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

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

Solution (Python):

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

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

print(height-a)

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

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

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

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

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

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

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

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

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

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

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

print(al - a[0])

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

diff=b-a+1
sum=0

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

print(sum-b)

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

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

c = b - a

d = (c - 1) * c / 2

print(int(d - a))

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

if __name__ == "__main__":
    print(main())

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

right_tower_height = 0

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

print(right_tower_height - b)

Solution (Python):



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

if __name__=="__main__":
    solve()

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

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

diff_height = (b - a)

snow_height = int(((diff_height - 1) * diff_height) / 2  - a)
print(snow_height)

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

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

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

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

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

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

c = b - a
count = sum(range(c + 1)) - b

print(count)

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

Solution (Python):


import math
import sys
import itertools
import numpy as np

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

k = b-a

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

Solution (Python):
def abc099_b():
    a, b = map(int, input().split())
    x = sum([i for i in range(b-a)])
    return x-a


print(abc099_b())

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

dif = b - a

n = dif - 1

h_m = n * (n+1) / 2

print(int(h_m - a))

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

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

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

Solution (Python):

A, B = input().split(" ")
A =int(A)
B = int(B)

n = B - A
print(int(0.5 * n * (n+1)-B))

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

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

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

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

Solution (Python):

def inpl(): return map(int, input().split())
A, B = inpl()
D = B - A
S = D*(D-1)//2
print(S-A)

Solution (Python):
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a,b = Is()
print((b-a-1)*(b-a)//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())
d = b-a
m = d*(d-1)//2
print(m-a)

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

n = b - a
tall_b = sum(range(n + 1))

print(tall_b - b)

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

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())
num=b-a
tower=sum(i for i in range(num))
print(tower-a)

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

N = b - a

sum = N * (N + 1) // 2

print(sum - b)

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

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

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

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

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

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

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

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

d = B - A

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

print(x - A)

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

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

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

    print(s-a)


if __name__ == '__main__':
    main()

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

d = B - A
t = sum(list(range(d)))
print(t - A)

Solution (Python):




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

    a_height = sum(range(1, b - a))

    print(a_height - a)


if __name__ == '__main__':
    main()

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

print(p-b)

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

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

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

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

dif = b - a
total = dif * (dif - 1) // 2

print(total - a)

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

Solution (Python):

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

n = b - a

h = (n ** 2 + n) / 2 - b

h = int(h)

print(h)

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,raw_input().split())
dif = b-a
ans = 0
for x in range(dif):
  ans += x
print ans-a

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

Solution (Python):

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

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

Solution (Python):


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

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

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

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

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

c=b-a

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

print(h-b)

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

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

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

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

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