Problem:


Score : 200 points

Problem Statement

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

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

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

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

Constraints

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

All values in input are integers.

There is no input that contradicts the assumption.

Input

Input is given from Standard Input in the following format:

a b

Output

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

Sample Input 1

8 13

Sample Output 1

2

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

Sample Input 2

54 65

Sample Output 2

1



Sample input:
8 13


Sample output:
2

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    delta = B - A
    left_height = sum(range(1, delta))
    print(left_height - A)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for t_a in range(1, 1000):
    h_a = sum([t_part for t_part in range(t_a + 1)])
    s_a = h_a - a
    if s_a >= 1:
        t_b = t_a + 1
        h_b = sum([t_part for t_part in range(t_b + 1)])
        s_b = h_b - b
        if s_b >= 1:
            if s_a == s_b:
                print(s_a)
                exit()

Submission status: Accepted

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

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

print(val - a)

Submission status: Accepted

Solution code:
import sys

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

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

print(val - a)

Submission status: Accepted

Solution code:
import sys

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

val = 0
for i in range(1, sys.maxsize):
    if i == b - a:
        break

    val += i

print(val - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Asum(n):
    ans = 0
    while n != 0:
        ans += n
        n-=1
    return ans

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

high_tower = Asum(b-a)

print(high_tower - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sa=abs(a-b)
mi=min(a,b)

no3=sum(i for i in range(1,sa))
print(no3-mi)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())
atoz = [chr(i) for i in range(97,97+26)]

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

Submission status: Accepted

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

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:
headData = [ int(n) for n in input().split()]
a = headData[0]
b = headData[1]
diff = b-a
lowerTowerHeight = sum(range(1, diff))
print(lowerTowerHeight-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = list(map(int,input().split()))
for i in range(B-A):
    A -= i
print(abs(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

dif = b-a
pos = dif - 2

print(A[pos] - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    
   
print(ans)

Submission status: Accepted

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

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

print(h-a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Stone Monument
https://abc099.contest.atcoder.jp/tasks/abc099_b

"""
import sys
from sys import stdin
input = stdin.readline



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


def main(args):
    a, b = map(int, input().split())
    ans = solve(a, b)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

def m(x):
    return x*(x+1)/2

print(int(m(b-a-1)-a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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] - b)

Submission status: Accepted

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

k = b-a-1

ans = 0

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

print(ans)

Submission status: Accepted

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

d = b-a

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def solve(a, b):
    pass


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

diff = b-a

west = sum([i for i in range(diff+1)])

print(west-b)

Submission status: Accepted

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

Submission status: Accepted

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

S = N[1] - N[0]
r=0
for s in range(S):
    r += (s+1)

print(-(N[1]- r))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
a, b, n = 1, 3, 3

for _ in range(1000):
    if B - A == b - a:
        print(a - A)
        break
    a = b
    b += n
    n += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate
a, b = map(int, input().split())
tower = list(accumulate(range(1, 1000)))
ans = tower[b - a - 1] - b
print(ans)

Submission status: Accepted

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

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

print(s - 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:
#encoding utf-8

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

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

Submission status: Accepted

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

import numpy as np
momunents = list(np.cumsum([i for i in range(1, 1000)]))
for i in range(999):
    if momunents[i] - a == momunents[i+1] - b:
        print(momunents[i] - a)
        break

Submission status: Accepted

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

n = b-a

bt = n*(n+1)//2



print(bt-b)

Submission status: Accepted

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

Submission status: Accepted

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

c = b - a

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

e = d - a

print(e)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

dif = b - a

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
diff = b - a
print(sum([x for x in range(diff)]) - 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:
def getinputdata():

    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])

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

for i in range(1,999):
    
    if arr[i]-arr[i-1]==b-a:
        
        print(arr[i]-b)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(d - a)

Submission status: Accepted

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

Submission status: Accepted

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

t = b - a 
res = (t * t / 2.0) + (t / 2.0) - b 

print(int(res))

Submission status: Accepted

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

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

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

    snow_hight = east_tree_hight - b
    print(snow_hight)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
https://abc099.contest.atcoder.jp/tasks/abc099_b
"""
[a,b]=[int(i) for i in input().split()]
c=0
for i in range(b-a):
    c=c+i
print(c-a)

Submission status: Accepted

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

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

# 計算で全部出せるとfor文回さなくて済む
ans = (b - a - 1) * (b - a) // 2 - a
print(ans)

Submission status: Accepted

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

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

# 本来の各柱の高さリスト
columns = [(i ** 2 + i) // 2 for i in range(1, 1000)]

for i in range(998):
    ab = columns[i+1] - columns[i]
    # 本来の柱と今見えている柱で差が一致する所を探す
    if ab == b - a:
        print(columns[i] - a)
        exit()

Submission status: Accepted

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

c = b - a

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

print(cnt - b)

Submission status: Accepted

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

diff = b - a

print(sum(range(diff)) - a)

Submission status: Accepted

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

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

Submission status: Accepted

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

index = b - a


height = 0
for i in range(index+1):
    height += i

print(height - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8

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

ha = 0
hb = 1

for i in range(1,1000):
    j = i + 1
    
    ha += i
    hb += j

    #while ha > a and hb > b:
    if (ha - a) == (hb - b):
        ans = ha - a
        break
    else:
        continue

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k = input()

s = k.index(" ")

a = int(k[0:s])

n = int(k[s+1:len(k)+1]) - a
t = 1
for i in range(2,n):
    t += i
print(t-a)

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:

def main():
    a, b = [int(i) for i in input().split(' ')]


    print(sum(range(1, b - a + 1)) - b)
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#B - Stone Monument
a,b=map(int,input().split())
d=b-a
b0=d*(d+1)/2
snow=b0-b
print(int(snow))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = input().split()

a = int(l[0])
b = int(l[1])

n = b - a

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

print(h-b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a, b = map(int, input().split(' '))
    sa = b - a
    wa = 0
    for i in range(1, sa):
        wa += i
    print(wa - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = 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())
x = int((b - a) * (b - a + 1) / 2 - b)
print(x)

Submission status: Accepted

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

towers = [1]
for i in range(1000):
    towers.append(towers[i]+(i+2))
    if towers[i+1]-towers[i] == dif:
        print(str(towers[i]-a))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

difference_a_b = b - a
print(poll_height(difference_a_b) - b)

Submission status: Accepted

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

df = b - a 

def sumPole(d) :
    psum = 0
    for i in range(0, d + 1) :
        psum += i
        
    return psum

print(int((sumPole(df) + sumPole(df - 1) - a - b) / 2))

Submission status: Accepted

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

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

print(A-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a, b = map(int, input().split())
    diff = b - a
    ans = sum(range(diff)) - a
    print(ans)

Submission status: Accepted

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

a_height = get_height(a_index)
b_height = get_height(b_index)
snow_height = b_height - b
print(int(snow_height))

Submission status: Accepted

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

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

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:
a,b = map(int, input().split())
#a,bの高さを求める
#b-aがbが何本目だったか示してる～
point_b = b-a
#bの本来の長さを出す
true_length_b = 0
for i in range (1,point_b+1):
        true_length_b += i
length_snow = true_length_b - b
print(length_snow)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
 
#the longer pole is the n-th pole from the west
n = b-a
 
height = 0
for i in range(1,n+1):
 height += i
 
snow = height - b
print("{}".format(snow))

Submission status: Accepted

Solution code:
Data = input()

import re

Shift = re.split(" ",Data)
LenA = int(Shift[0])
LenB = int(Shift[1])

Delta = LenB - LenA
Mount = 0
Ctr = 0
while True:
    Ctr += 1
    Mount += Ctr
    if Ctr == Delta:
        break
print(Mount - LenB)

Submission status: Accepted

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

#the longer pole is the n-th pole from the west
n = b-a

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

snow = height - b
print("{}".format(snow))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input().split()
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)

Submission status: Accepted

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

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

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

print("{}".format(sum-b))

Submission status: Accepted

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

x = b - a

for i in range(1, x):
    x += i;
print(x-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
w,e=[int(i) for i in str(input()).split()]
n=e-w-1
print(int(n*(n+1)/2-w))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

list=[0]

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

print(list[b-a]-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=input().split()
a=int(x[0])
b=int(x[1])
n=b-a
z=0;
for i in range(n):
    z+=i
print(z-a)

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:
# -*- coding:utf-8 -*-
if __name__ == "__main__":
    a, b = map(int, input().split())
    #等差数列の公式を使う．
    rightLength = (b-a)*(b-a+1)/2
    ans = int(rightLength - b)
    print(ans)

Submission status: Accepted

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

t = 0
pt = 0
for i in range(1000):
    t += i
    if a < pt and b < t:
        if (pt-a) == (t-b):
            print(pt-a)
            break
    pt = t

Submission status: Accepted

Solution code:
list = []
c = 1
for i in range(2, 1001):
	list.append(c)
	c += i
a, b = map(int,raw_input().split())
c = b - a
for i in range(1, 999):
	if list[i]-list[i-1] == c:
		ans = list[i] - b
print ans

Submission status: Accepted

Solution code:

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


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

c = int(func(b-a-1))

print(c-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k=input().split()
a=int(k[0])
b=int(k[1])
n=0
for i in range(b-a):
    n+=i
print(n-a)

Submission status: Accepted

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

Submission status: Accepted

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

a = int(a)
b = int(b) 

diff = b - a
height_a = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def readQuestion():
    line = sys.stdin.readline()
    sline = line.rstrip()
    [rline,r1line]=sline.split(" ")
    a=int(rline)
    b=int(r1line)
    return a,b 

def solve(a,b):
    x=[]
    y=0
    high=0
    z=0
    u=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    high = b-a
    z=high-1
    u=x[z]-b
    return u
# 全体
def main():
    x,y = readQuestion()
    answer = solve(x, y)
    print(answer)

# mainを呼び出す
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main2():
    strbuf = input("");
    strbufs = strbuf.split();
    buf = [];
    for i in range(2):
        buf.append(int(strbufs[i]));
    sa = buf[1] - buf[0];
    takasa = sa * (sa + 1) / 2;
    result = takasa - buf[1];
    print(int(result));


if __name__ == '__main__':
    main2()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = listA[b - a] - b
print(ans)

Submission status: Accepted

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

B = b - a
A = B - 1

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

print(int(x))


# ans x
#
# a wo n honme
# b wo m honme tosuruto
#
# a+x = b+x+m
# m = a-b
# n = a-b-1
#
# a = 1+2+...+n - x
# b = 1+2+...+n+m - x
#
# a+b = 2(1+2+...+n) +m-2x
# 2x = -a-b+m+2(1+2+...+n)
# x = (1+2+...+n)-1/2a-1/2b+1/2m

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/bin/python

import math
import os
import random
import re
import sys

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

if __name__ == '__main__':
    nk = raw_input().split()
    a = int(nk[0])
    b = int(nk[1])
    
    result = solution(a,b)

    print result