Problem:


Score : 200 points

Problem Statement

In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.

It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.

Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.

Assume also that the depth of the snow cover is always at least 1 meter.

Constraints

1 \leq a < b < 499500(=1+2+3+...+999)

All values in input are integers.

There is no input that contradicts the assumption.

Input

Input is given from Standard Input in the following format:

a b

Output

If the depth of the snow cover is x meters, print x as an integer.

Sample Input 1

8 13

Sample Output 1

2

The heights of the two towers are 10 meters and 15 meters, respectively.
Thus, we can see that the depth of the snow cover is 2 meters.

Sample Input 2

54 65

Sample Output 2

1



Sample input:
8 13


Sample output:
2

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main() -> None:
    a, b = map(int, input().split())
    h = 0
    for i in range(1, 1000):
        if (h - a) == (h + i - b):
            print("{}".format(h - a))
            break
        else:
            h = h + i


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(b_height - b)

Submission status: Accepted

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

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

print(height_b - b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
int_a, int_b = map(int, input().split())

diff = int_b - int_a
high_b = sum(range(1, diff + 1))

print(high_b - int_b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
h = 0
for i in range(b-a):
    h += i
print(h-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:
class Solver(object):
    def __init__(self):
        self.a, self.b = list(map(int, input().split(" ")))

    def solve(self):
        last = self.b - self.a
        right_height = sum(range(1, last+1))
        snow_height = right_height - self.b
        print(snow_height)


if __name__ == "__main__":
    s = Solver()
    s.solve()

Submission status: Accepted

Solution code:
a,b=[int(i) for i in input().split()]
height=[1]
for i in range(1000):
    height.append(height[i]+i+2)
for i in range(1000):
    if height[i]>a and height[i+1]>b:
        if height[i]-a==height[i+1]-b:
            print(height[i]-a)
            break

Submission status: Accepted

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

Submission status: Accepted

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

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

print(answer)

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(sum(list(range(1,b-a+1)))-b)

Submission status: Accepted

Solution code:
#B-Stone MOnument
a,b=map(int,input().split())
N=b-a+1
S=0
for a in range(N):
    S=S+a
print(S-b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def add(x,y):
    return x + y


a,b = map(int,input().split())
x = b -a
sum = 1
next_x = 2
while True:
    result = add(sum,next_x)
    if result - sum == x:
        print(sum - a)
        break
    sum = result
    next_x += 1

Submission status: Accepted

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

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

Submission status: Accepted

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

c = b - a

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

print(east - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 05:38:56 2019

@author: shinjisu
"""


# ABC 200点問題
import math


def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def dmp(x):
    global debug
    if debug:
        print(x)


debug = True


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def prob096():  # Maximum Sum
    X = getIntList()
    K = getInt()
    dmp((X, K))
    total = sum(X) - max(X) + max(X)*2**K
    return total


def prob097():  # Exponential
    X = getInt()
    dmp(X)
    if X == 1:
        return 1
    for n in range(X, 0, -1):
        dmp(n)
        for b in range(2, int(math.sqrt(X))+1):
            a = n
            exp = True
            while a > 1:
                if a % b != 0:
                    exp = False
                    break
                a //= b
            if exp:
                break
        if exp:
            break
    return n


def prob098():  # Cut and Count
    N = getInt()
    S = input()
    dmp((N, S))
    maxChCount = 0
    for i in range(1, N):
        before = S[:i]
        after = S[i:]
        dmp((before, after))
        chCount = 0
        for j in range(26):
            ch = chr(ord('a')+j)
            if ch in before and ch in after:
                chCount += 1
        maxChCount = max(maxChCount, chCount)
    return maxChCount


def prob099():  # Stone Momument
    a, b = getIntList()
    height = 0
    for i in range(b-a+1):
        height += i
    height -= b
    return height

def prob000():  # 
    return 0


debug = False  # True False
print(prob099())

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
t = 0
ans = 0
T = 0
while 1:
    t += 1
    TT = T
    T += t
    if T - TT == b - a:
        ans = T - b
        break
print(ans)

Submission status: Accepted

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

diff = b - a

height_a = diff*((diff-1)/2)
print(int(height_a - a))

Submission status: Accepted

Solution code:
a,b = map(int,input().split(" "))
list = []
for i in range(999):
    if i == 0:
        list.append(1)
    else:
        list.append(list[i-1]+i+1)
#print(list)
#print(list[998])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("AC")
    else:print("WA")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A,B = map(int, lines.pop(0).split(' '))
    diff = B - A
    print(sum(range(1, diff+1)) - B)

#
# main
#

# 1. use list instead of stdin

#contents = '''\
#54 65\
#'''
#lines = contents.split('\n')
#
# 2. use stdin

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Submission status: Accepted

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

for j in range(999):
   o=l[j+1]-l[j]
   if(o==e):
       print(l[j]-a)
   else:
       continue

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = [(n+1)*(n+2)//2 for n in range(999)]
a,b = map(int,input().split())
dif = b-a
for i in range(999):
    if L[i+1] - L[i] == dif:
        print(L[i]-a)
        exit()

Submission status: Accepted

Solution code:
import sys
a, b = [int(i) for i in sys.stdin.readline().rstrip().split()]
len_a = (b - a - 1) * (b - a) // 2
print(len_a - a)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

print(x)

Submission status: Accepted

Solution code:
import sys
import math

# -*- coding: utf-8 -*-

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

d = b-a

ee = 0

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

print(ee-a)

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

x= b-a

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

print( ans )

Submission status: Accepted

Solution code:
""" AtCoder """

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

ans = 0

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

print(ans - a)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
west=east=0
for i in range(1,1000):
    west=east
    east+=i
    if west-a==east-b:
        print(west-a)
        break

Submission status: Accepted

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

    l = []
    for i in range(2, 1001):
        h = 0
        for j in range(1, i):
            h = h + j
        l.append(h)

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


def main2():
    a, b = map(int, input().split())
    x = b - a

    s = 0
    for i in range(1, x):
        s = s + i

    print(s - a)


if __name__ == '__main__':
    main2()

Submission status: Accepted

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

    l = []
    for i in range(2, 1001):
        h = 0
        for j in range(1, i):
            h = h + j
        l.append(h)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


a, b = LI()

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

print(ha - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2000)

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

c = b - a 

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

print(count(c)-b)

Submission status: Accepted

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

def main():
    na = list(map(int, input().split()))
    a, b = na[0], na[1]

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

    print(t)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
n = b - a
lst = [1]
for x in range(2,n):
    tmp = lst[-1]
    lst.append(tmp + x)

print(lst[-1] - a)

Submission status: Accepted

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

print(d[s-1]-b)

Submission status: Accepted

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

y = b - a - 1
w_hight = 0

for i in range(1, y + 1):
    w_hight += i

print(w_hight - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

t1, t2, s = 1, 1 + 2, 3
while not (t1 - a > 0 and t2 - b > 0 and t1 - a == t2 - b):
    t1, t2, s = t2, t2 + s, s + 1

x = t1 - a
print(x)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

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

print(t - a)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**6)

def sig(x):
    return 1 if x==1 else sig(x-1)+x


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

upper=int(sig(b-a))
print(upper-b)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(yuki))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

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

    print(left - a)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

l = 0
for i in range(1, 999):
    l += i
    r = l + i + 1
    if r - l == b - a:
        print(l - a)

Submission status: Accepted

Solution code:
a, b = (int(n) for n in input().split())
N = b - a
H = -a
for h in range(N):
    H += h 
print(H)

Submission status: Accepted

Solution code:
import numpy as np
a,b = map(int, input().split())
n = b - a
k = np.array(range(n+1))
sam = np.sum(k)
print(sam-b)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(n):
    return n  

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

print(sigma(f, 1, b-a) - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8
a, b= map(int, input().split())

diff = b-a
d = 0
for i in range(1, diff):
    d += int(i)
print(abs(d-a))

Submission status: Accepted

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

n = b-a

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

print(right_height - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(y-b)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b = li()
diff = b-a

sm = sum([i for i in range(1,diff+1)])
print(sm-b)

Submission status: Accepted

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

s = 0
for n in range(1000):
    if b-a == n:
        print(s-a)
        break
    s += n

Submission status: Accepted

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

Submission status: Accepted

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

diff = b-a
ans = sum(list(range(diff))) - a
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    h = 0
    old_h = 0
    for i in range(1, 1000):
        h += i

        if (h - old_h) == (b - a):
            print(h - b)
            exit()

        old_h = h

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

        if h > b:
            b_h = h - b
            if a_h == b_h:
                ans = b_h
                break
        if h > a:
            a_h = h - a

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
y = []
p = 0
#w = []
for i in range(1, 1000):
    p += i
    y.append(p)
    #w.append(1)
c = b - a
for i in range(1, 999):
    if y[i] - y[i - 1] == c:
        print(y[i] - b)
        break
"""z = []
for i in range(499500):
    z.append([])
for i in range(499500):
    z[i] = list(map(lambda k: k - i - 1, y))"""
"""for x in range(1, 499501):
    for i in range(1, 999):
        if y[i] == b + x and y[i - 1] == a + x:
            print(x)
            break
    else:  # 内側のforのelse節は内側ループが全部まわり切ったら実行される、つまり前の行のbreakで抜けた場合ここは実行されない
        continue  # 外側のforに対応するcontinue文、ここが実行されたら次の行のbreakには処理がいかず、外側のforの次のループにジャンプする
    break  # 外側のforを抜ける"""

"""for h in range(1, 499501):
    y = [y1 - w1 for (y1, w1) in zip(y, w)]
    x = 100 if a > 50 else 0
    k = min(y)
    for i in range(999):
        if i != 0:
            if b == y[i] and a == y[i - 1]:
                print(h)
                break
    else:  # 内側のforのelse節は内側ループが全部まわり切ったら実行される、つまり前の行のbreakで抜けた場合ここは実行されない
        continue  # 外側のforに対応するcontinue文、ここが実行されたら次の行のbreakには処理がいかず、外側のforの次のループにジャンプする
    break  # 外側のforを抜ける"""

Submission status: Accepted

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

for i in range(1, 1000):
    p += i
    y.append(p)
    
c = b - a
for i in range(1, 999):
    if y[i] - y[i - 1] == c:
        print(y[i] - b)
        break

Submission status: Accepted

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

Submission status: Accepted

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

dif = b - a
s = 0

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

ans = s - b
print(ans)

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8:


def main():
    a, b = map(int, raw_input().split())
    print(sum(range(b - a)) - a)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b = map(int, raw_input().split())
towers = [0] * 1000
for i in range(999):
	towers[i + 1] = towers[i] + 1 + i
diffs = [0] * 1000
for i in reversed(range(999)):
	diffs[i] = towers[i + 1] - towers[i]
target_idx = diffs.index(b - a)
print towers[target_idx] - a

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Stone Monument
print((lambda m: sum([i for i in range(m[1] - m[0])]) - m[0])(list(map(int, input().split()))))

Submission status: Accepted

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

Submission status: Accepted

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

d = b - a

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

print(m - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

c = b - a
d = c

while c > 0:
  c = c - 1
  d += c
  
print(d-b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b  = map(int, input().split())
n=b-a

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def run(a, b):
    h1 = 0
    h2 = 0
    for i in range(1, 1000):
        h1 += i-1
        h2 += i
        if (h1 - a) == (h2 - b):
            return h1 - a


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in l:
    if a < i and b < l[l.index(i) + 1]:
        if i - a == l[l.index(i) + 1] - b:
            print(i - a)
            break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(h[b-a]-b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s = 0

for i in range(1000):
    s = s + i
    if i == b - a:
        break

print(s - b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,east_tower_num+1):
    east_tower_high += i

print(east_tower_high - b)

Submission status: Accepted

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

diff = b - a

def func(x):
    ret = 0
    while x != 0:
        ret += x
        x -= 1
    return ret

print(func(diff) - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b = map(int, input().split())
h = [ 1 ]
for i in range(2, 1000):
    h += [ h[-1] + i ]
for h1, h2 in zip(h, h[1 :]):
    if h1 - a == h2 - b:
        print(h1 - a)
        break