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

Submission status: Accepted

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

c = b-a

print(f(c)-b)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

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

print(int(bt - b))

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 = map(int, raw_input().split())
c = b - a
x = 1 + c
y = x * c
f = y / 2
print f - b

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 = [int(x) for x in input().split()]

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

Submission status: Accepted

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

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

print(An-a)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b=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())
diff = b - a

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=map(int,input().split())
n=b-a
g=0
for i in range(1,n):
    g+=i
print(g-a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

j = 0
l = []

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def asa(N) :
    li = [0] * 1001
    li[0] = 0
    for i in range(1001) :
        li[i] = li[i-1] + i
    return li[N]
import sys
input = sys.stdin.readline
a,b = [int(i) for i in input().split()]
k = asa(b-a)
print(k-b)

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())
for i in range(1,1000):
  if b-a == i:
    print(sum(range(i))-a)

Submission status: Accepted

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

# Bの本来の高さ
B_true = (B - A) * (B - A + 1) // 2
answer = B_true - B

print(answer)

Submission status: Accepted

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

n = b - a
h = 0

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

Submission status: Accepted

Solution code:
a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき

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

print(int(m-a))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

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

print(f(c) - M)

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
lst = [0] * 999
lst[0] = 1
for i in range(998):
    lst[i + 1] = lst[i] + (i + 2)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(height-n)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

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

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


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

Submission status: Accepted

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

print(length_b - b)

Submission status: Accepted

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

res = b-a

n = res-1

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

print(int(sum)-a)

Submission status: Accepted

Solution code:
MOD=10**9+7
cnt=0; #sum=0
#h=Hash.new(0)

def gs(): return input()
def gi(): return int(input())
def gsmi(): return [int(n) for n in input().split()]
# min,max,sum,sorted
def desc(ar): return sorted(ar,reverse=True)
def printend(s): print(s);import sys;sys.exit()
###
a,b=gsmi()
diff=b-a
l = sum(range(1,diff-1+1))
print(l-a)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

point = b-a
print(L[point]-b)

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

n = b - a - 1

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

Submission status: Accepted

Solution code:

##Just for prctice
a,b=map(int,input().split())

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

"""
8 13

2

54 65

1
"""

Submission status: Accepted

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

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

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

delta = b - a

print(tower(delta) - b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

c = b - a
d = 0

print(sum(range(c+1)) - 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+1):
    d += i
print(d - b)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

result = 0


#b-aを行う事によって、隣接する棟の感覚を割り出す事が可能である。rangeの仕様でbの一つ前のaで棟が完成する。なので-aするとぱーぺき
for i in  range(1,b-a):
    result += i
print(result-a)

Submission status: Accepted

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

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

Submission status: Accepted

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


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

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

    main(a, b)

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

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


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

Submission status: Accepted

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

t = b - a

test = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b = map(int,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(" ")))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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


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

examB()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

c = b - a

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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

print(height - a)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin
import fractions

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 099: B – Stone Monument
a, b = [int(s) for s in input().split()]

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

Submission status: Accepted

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

Submission status: Accepted

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

sub = b - a

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

l = []

value = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=map(int,input().split())
print((b-a)*(b-a-1)//2-a)

Submission status: Accepted

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

Submission status: Accepted

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

diff=b-a

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

Submission status: Accepted

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

Submission status: Accepted

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

solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-08 02:12:52(JST)
## internal modules
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 

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



if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

#f(n) = n*(n+1)/2
#n*(n+1)/2 - ans = a
#(n+1)*(n+2)/2 - ans = b
#{(n+1)*(n) + (n+1)*(2)}/2 - ans = b
# a + ans + n + 1 - ans = b
# a + n + 1 = b
# n = b - a - 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#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())
p=0
for i in range(1,b-a+1):
  p +=i
print(p-b)

Submission status: Accepted

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

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

Submission status: Accepted

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


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

c = b-a

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

print(cnt-a)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

# output
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(summary-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(length -b)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
n=b-a-1 # 埋まりかかった塔の番号
print(n*(n+1)//2-a)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sumK(b-a)-b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a_height - a)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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