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())
x=b-a
l=sum([i for i in range(1,x+1)])
print(l-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

tb_i = b - a

hb = 0
for i in range(1, tb_i+1):
    hb += i

print(hb-b)

Submission status: Accepted

Solution code:


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

    print(count - b)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__=='__main__':
    main()

Submission status: Accepted

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

sub = b-a

sin_a = 0

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

print(sin_a - a)

Submission status: Accepted

Solution code:
t=list(map(int,input().split()))
a=[i+1 for i in range(1,999)].index(t[1]-t[0])+1
print(int(0.5*(a+a**2)-t[0]))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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


def submit():
    a, b = read_input()

    increment = b - a
    b_tall = sum(range(1, increment + 1))

    print(b_tall - b)

if __name__ == '__main__':
    submit()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import numpy as np
import math
import re

n = input()
n = re.split(" ",n)
a = int(n[0])
b = int(n[1])
x = b - a

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

Submission status: Accepted

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

Submission status: Accepted

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

c = list(range(1,999+1))

print(sum(c[:b-a])-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math


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


def get_h(n):
    ret = 0
    for i in range(1, n+1):
        ret += i
    return ret
    

h = get_h(b-a)
print(h-b)

Submission status: Accepted

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

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:
A,B = map(int,input().split())
C = sum(list(range(B-A)))
print(C-A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
[a,b] = list(map(int,input().split()))
d = b-a
print(d*(d+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:
a,b = map(int,input().split())
n = b - a
cnt = 0
for i in range(n):
    cnt += i
print(cnt - a)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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


for i in range(1, 1000):
    if (i+1)*(i+2) - (i+1)*i == 2*(b-a):
        x = int(i*(i+1)/2-a)
        print(x)
        break

Submission status: Accepted

Solution code:
import sys
import numpy as np

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(' ')]

a, b = readIntN()
l = b - a
ret = (l * (l + 1) // 2) - b
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

n = B - A
lsum = sum(range(n))
rsum = lsum + n

print((sum([lsum, rsum]) - sum([A, B])) // 2)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
	main()

Submission status: Accepted

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

l = [1]
for i in range(2, 1000):
    l.append(l[i-2] + i)
    
diff = b - a

print(l[diff-1] - b)

Submission status: Accepted

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

dif = b - a #aとbの高さの差 = 柱bの前の柱との差

#前の柱との差を入れると高さを返す関数
def hgt(x):
  return round( (x+1)*x / 2 )

print(hgt(b-a)-b)

Submission status: Accepted

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

for i in range(1, calc):
    a_hight += i

print(a_hight - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2019/04/18
# AtCoder Beginner Contest 099 - B

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

# Search stick
od = b - a
sth = 0
for i in range(1, od):
    sth += i

# Measure snow
ans = sth - a

# Output
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


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


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:
import sys
a,b = map(int,input().split())
c = b-a
sum = 0
for i in range(1,1000):
    #print(sum,'\t')
    if i == c:
        #print('\n')
        print(sum - a)
        sys.exit(0)
    sum += i

Submission status: Accepted

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

for i in range(bo):
    sum += (i + 1)

print(sum - b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding= utf_8
a, b = map(int, input().split())
x = 0

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

print(x - b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
height = []
cnt = 0
for i in range(1,1000):
    cnt += i
    height.append(cnt)
for i in range(999):
    if height[i]-a == height[i+1]-b:
        print(height[i]-a)
        break
    else:
        continue

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = b-a

ans = (d-1)*d//2 - a


print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

a, b = MAP()

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

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


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


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

a, b = MAP()

for x in range(2, 1000):
    if b - a == x:
        print(int((x - 1) * x / 2 - a))

Submission status: Accepted

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

def calc(n):
    count = 0
    for i in range(1, n+1):
        count += i
    return count

print(calc(b - a) - b)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)
a, b = map(int, input().split())

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

print(calc(b - a) - b)

Submission status: Accepted

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

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

print(sum-b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sigma(num):
  ret=0
  for i in range(num+1):
    ret+=i
  return ret

n,m=map(int,input().split())
a=sigma(m-n)
print(a-m)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
diff = b - a
#ans = (1+2+....+diff) - b

print(sum(list(range(1, diff + 1))) - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate as acc
a=[i for i in range(1000)]
a=list(acc(a))

A,B=map(int,input().split())
print(a[B-A]-B)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(t - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def sum(n):
    s=0
    for i in range(n+1):
        s+=i
    return s

x=b-a
d=sum(x)
ans=d-b
print(ans)

Submission status: Accepted

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

d = b - a

s = 0

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

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, raw_input().split())
diff = b - a
hgt = sum(i for i in range(diff+1))
print hgt - b

Submission status: Accepted

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

Submission status: Accepted

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

left = 0
right = 1

for i in range(1,1000):
    left += i
    right += (i + 1)

    if a - left == b - right:
        print(left - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

h = [0] * 999
t = 0
for i in range(1, 1000):
    t += i
    h[i-1] = t

import bisect

x = 1
while True:
    i = bisect.bisect_left(h, a+x)
    if h[i] == a+x and h[i+1] == b+x:
        break
    x += 1

print(x)

Submission status: Accepted

Solution code:
from sys import stdin
a,b=[int(x) for x in stdin.readline().rstrip().split()]
dif=b-a
height=sum(range(1,dif+1))
print(height-b)

Submission status: Accepted

Solution code:
#coding: utf-8
l = [i for i in range(1, 1000)]
L = [sum(l[:i+1]) for i in range(len(l))]
L_sa = [L[i+1] - L[i] for i in range(len(L)-1)]
a, b = map(int, input().split())
for i in range(len(L_sa)):
    if b-a == L_sa[i]:
        print(L[i] - a)

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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    if n < 1000:
        print("ABC")
    else:
        print("ABD")
    return

#B
def B():
    a,b = LI()
    n = b-a
    c = (n*(n+1))//2
    print(c-b)
    return

#C
def C():
    n = I()
    ans = float("inf")
    for i in range(n+1):
        m = 0
        k = i
        while k > 0:
            m += k%6
            k //= 6
        k = n-i
        while k > 0:
            m += k%9
            k //= 9
        ans = min(ans,m)
    print(ans)
#D
def D():
    n,C = LI()
    f = LIR(C)
    c = LIR(n)
    d = [defaultdict(int) for i in range(3)]
    for i in range(n):
        for j in range(n):
            d[(i+j+2)%3][c[i][j]-1] += 1
    ans = float("inf")
    for i in range(C):
        for j in range(C):
            if i != j:
                for k in range(C):
                    if k != i and k != j:
                        m = 0
                        for a in d[0].keys():
                            m += d[0][a]*f[a][i]
                        for a in d[1].keys():
                            m += d[1][a]*f[a][j]
                        for a in d[2].keys():
                            m += d[2][a]*f[a][k]
                        ans = min(ans,m)
    print(ans)


#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    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())
tmp_list = [0]*1000
tmp_list[0] = 1
for i in range(1,len(tmp_list)-1):
    tmp_list[i] = tmp_list[i-1]+i+1
tmp_list.pop(-1)
res_w = tmp_list[b-a-2]
res_e = tmp_list[b-a-1]
print(res_w-a)

Submission status: Accepted

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

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

c = b - a
height = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
C=B-A
print(sum(x for x in range(1,C+1))-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());n=b-a;n=round(n*(n+1)/2);print(n-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
a, b = [int(x) for x in stdin.readline().rstrip().split()]
diff = b-a
print(sum([i for i in range(diff)])-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def read():
    return raw_input()


def write(message):
    import sys
    print message
    sys.stdout.flush()


if __name__ == '__main__':
    a, b = map(int, read().split())
    n = b - a
    h_b = (n * (n + 1)) / 2
    write(h_b - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

tower = 0

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

print(tower - b)

Submission status: Accepted

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

total = 0
for i in range(1, d):
    total += i
print(total - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve(string):
    a, b = map(int, string.split())
    n = b - a
    return str(n * (n + 1) // 2 - b)


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def stone_monument(a: int, b: int) -> int:
    n = b - a
    return n * (n + 1) // 2 - b


if __name__ == "__main__":
    a, b = map(int, input().split())
    ans = stone_monument(a, b)
    print(ans)

Submission status: Accepted

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

cnt = 0
for i in range(1,B-A):
  cnt += i
print(cnt-A)

Submission status: Accepted

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

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

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())
sa = b-a
print(sum([i for i in range(sa+1)])-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:
# coding: utf-8
a, b = map(int, input().split())
print(((b - a) ** 2 - (a + b)) // 2)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


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


a, b = map(int, input().split())
diff = b-a
height = sigma(b-a)
print(height-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc099/tasks/abc099_b
a, b = [int(x) for x in input().split()]
print(((b - a) + 1) * (b - a) // 2 - b)

Submission status: Accepted

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

answer = x - a
print(answer)

Submission status: Accepted

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

last = b - a
b_height = sum([i+1 for i in range(last)])

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

print(d-b)

Submission status: Accepted

Solution code:
nums=list(map(int,input().split()))
n=nums[1]-nums[0]
height=0

for i in range(n):
    height+=(i+1)
print(height-nums[1])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
  input = sys.stdin.readline
  a, b = map(int, input().split())
  diff = b - a
  ah = sum([i for i in range(1, diff)])
  print(ah-a)


if __name__ == '__main__':
  main()

Submission status: Accepted

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

yuki=0
while 1:
    if(length-sa -yuki==a and length -yuki==b):
        print(yuki)
        break
    
    yuki+=1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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