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

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
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

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

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

#C
def C():
    n = II()
    dp = [inf for i in range(n + 1)]
    ans = [1]
    x = 6
    while x <= n:
        ans.append(x)
        x = x * 6
    x = 9
    while x <= n:
        ans.append(x)
        x = x * 9
    ans.sort()
    for i in ans:
        dp[i] = 1
    for i in range(1, n + 1):
        if not i in ans:
            a = bisect.bisect_left(ans, i)
            for k in range(a):
                dp[i] = min(dp[i - ans[k]] + 1, dp[i])
    print(dp[n])
    return

#D
def D():
    n, c = LI()
    D = LIR(c)
    C = LIR_(n)
    CL = list(itertools.permutations(range(c), 3))
    ans = inf
    amari0 = [0 for i in range(30)]
    amari1 = amari0[::1]
    amari2 = amari0[::1]
    for y in range(n):
        for x in range(n):
            amari = (x + y) % 3
            if amari == 0:
                amari0[C[y][x]] += 1
            if amari == 1:
                amari1[C[y][x]] += 1
            if amari == 2:
                amari2[C[y][x]] += 1
    for c0, c1, c2 in CL:
        ansb = 0
        for i in range(c):
            ansb += D[i][c0] * amari0[i]
            ansb += D[i][c1] * amari1[i]
            ansb += D[i][c2] * amari2[i]
        ans = min(ans, ansb)
    print(ans)
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(500000)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
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()
c = 0
l = []
# a_num = 0
# b_num = 0
sa = b - a
for i in range(1, 1000):
    c += i
    l.append(c)
# print(l[sa - 1] - b)
print(l[sa - 2] - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b = (int(_) for _ in input().split())
    orig_a = 0
    for i in range(b-a):
        orig_a +=i
    print(orig_a - a)
    
if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

x = b-a
hi = 0
for i in range(1,1000):
    if i == x:
        break
    hi += i

print(hi - a)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1000):
  b+=i
  c.append(b)
else:
  print(c[a[1]-a[0]-1]-a[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

Solution code:
import sys

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

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

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

    print(sum - b)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(xb - b)

Submission status: Accepted

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

towers = [sum(range(1, n)) for n in range(2, 1001)]
diffs = [0] * 998
for i in range(998):
    diffs[i] = towers[i + 1] - towers[i]
i = diffs.index(b - a)
print(towers[i] - a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum([i for i in range(1000) if i <= (b-a)])-b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = b - a
j = 0

for i in range(1,1000):
    k = j
    j += i
    if j - k == d:
        print(j - b)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	a, b = map(int, input().split(" "))
	
	takasa = []
	takasa.append(0)
	sa = []
	sa.append(0)
	for i in range(1, 1000):
		tmp = takasa[i-1] + i
		takasa.append(tmp)
	
	tmp = b - a
	
	print(takasa[tmp]-b)
	
	
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import re
import math
import fractions

def main():
    A,B=map(int,input().split())
    index=B-A-1
    total=0
    for a in range(0,index+1):
        total+=a+1
    print(total-B)
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#A,B,C=map(int,input().split())
#n=int(input())
# global n,A,s,memo,mx,mn,L,B

Submission status: Accepted

Solution code:
# coding: utf-8
height = [int(x) for x in input().split()]
s = height[1] - height[0]
count = 0
for x in range(s):
    count += x
print(count - height[0])

Submission status: Accepted

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

delta = b - a

high_east = (1 + delta) * delta // 2
snow = high_east - b

print(snow)

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

a, b = nl()

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())
h = 0

for i in range(b - a):

    h += (i+1)

print (h - b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = list(map(int,input().split()))
c = []
sum = 1
am = 0
bm = 0
for i in range(998) :
    am =sum - a 
    sum = sum + i+2
    bm =sum - b
    if am == bm :
        print(am)
        break

Submission status: Accepted

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

Submission status: Accepted

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

height=0
for h in range(1, 999):
    height += h
    nextH = height + h + 1

    if height < a:
        continue

    if height - a == nextH - b:
        print(height - a)
        exit()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

a, b = map(int,input().split())
c = b - a
for i in range(1,999):
  d = sum(range(1,i+2)) - sum(range(1,i+1))
  if d == c:
    e = sum(range(1,i+1)) - a
print(e)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(d-b)

Submission status: Accepted

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

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

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())
ans = ((B - A) * (B - A -1)) / 2 - A
print(int(ans))

Submission status: Accepted

Solution code:
from itertools import accumulate
t = [n for n in accumulate(range(10000))]
 
a, b = map(int, input().split())
print(t[b - a] - b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def abc():
    a, b = map(int, input().split())
    diff = b - a
    h = sum([x for x in range(1, diff+1)])
    print(h - b)


abc()

Submission status: Accepted

Solution code:
def delta2lower_height(arg_num):
    height = 0
    for i in range(1, arg_num):
        height += i
    return height


lower_margin, higher_margin = map(int, input().split())

delta = higher_margin - lower_margin

lower_height = delta2lower_height(delta)
snow_height = lower_height - lower_margin

print(snow_height)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

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

i = b - a

s = 0
for j in range(1000):
    s += j
    if j == i:
        print(s - b)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans -a)

Submission status: Accepted

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

Submission status: Accepted

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

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

A = int((1/2)*c*(c-1))
B = int((1/2)*(c+1)*(c))

print(A-a)

Submission status: Accepted

Solution code:
a, b = list(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())
l=[]
c=0
for i in range(1,1000):
    c=c+i
    l.append(c)
print(l[b-a-1]-b)

Submission status: Accepted

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

for j in range(snowless[-1]):
    if a + j in snowless and b + j in snowless:
        ans = j

print(ans)

Submission status: Accepted

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

    n = b - a

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

    answer = L_east - b

    print(answer)

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

Submission status: Accepted

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

i = abs(b - a) #東側の塔が西から何番目か

hb = (i + 1) * (i // 2) if i % 2 == 0 else (i + 1) * (i // 2) + (i + 1) // 2
print(hb - b)

Submission status: Accepted

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

i = abs(b - a) #東側の塔が西から何番目か

hb = (i + 1) * (i // 2) if i % 2 == 0 else (i + 1) * (i // 2) + (i + 1) // 2
print(hb - b)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
a, b = map(int, input().split())
c = b - a
h = 0
for i in range(1, c):
    h += i
print(h - a)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

s = b-a

y = s*(s-1)/2 - a

print(int(y))

Submission status: Accepted

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

for i in range(d):
	B += (i + 1)

ans = B - b

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(total - a)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
num = []
for i in range(1, 999+1):
    num.append(i)
    
diff = b-a
index = [i for i in range(len(num)) if num[i]==diff][0]
true_b = sum(num[:index+1])
true_a = sum(num[:index])
print(true_a- a)

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

Submission status: Accepted

Solution code:
a, b = [ int(v) for v in 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
l=[i+1 for i in range(n)]
print(sum(l)-b)

Submission status: Accepted

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

Submission status: Accepted

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

# 柱の高さ（1本目）
x1=1

# 高低差（0本目との差は1なので1から）
y=1

for i in range(998):
  # 高低差を+1
  y+=1

  # 2本目の高さを求める
  x2=x1+y

  # 2本の高低差が一致した場合
  if x2-x1==b-a:
    # 足りない長さが積雪量（x2-bでも可）
    print(x1-a)
    break

  # 次の比較のために1本目の柱の高さを更新
  x1=x2

Submission status: Accepted

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


def solve(a: int, b: int):
    print(sum([i for i in range(b-a)]) - a)
    return


# Generated by 1.1.4 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(i) for i in input().split()]

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

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:
def MI(): return map(int, input().split())
def II(): return int(input())
def IS(): return input()
def LI(): return list(map(int, input().split()))

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

Submission status: Accepted

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

hight_tower = 0

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

print(hight_tower - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sabun = b - a
cnt = 0

while sabun > 0:
  cnt += sabun
  sabun -= 1

print(cnt - b)

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

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

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b = f()
    n = b- a
    print(sum(range(n+1)) - b)

solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ContestName
# URL
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    a, b = i2nn()
    d = b - a
    h = int(d * (d - 1) / 2)
    snow = h - a
    print(snow)

main()

Submission status: Accepted

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

sa = b - a

wa = (sa * (sa+1))//2

print (wa-b)

Submission status: Accepted

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

num = 0

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

print(num - b)

Submission status: Accepted

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


def solve(a: int, b: int):
    d = b - a
    ret = 0
    for i in range(d + 1):
        ret += i
    ret -= b
    print(ret)
    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:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    a, b = intin()

    sub = b - a
    ans = 0

    for i in range(sub):
        ans += i

    ans -= a
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans-A)

Submission status: Accepted

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

Submission status: Accepted

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