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: Wrong Answer

Solution code:
s=list(map(int,input().split()))
list=[]
for i in range(1,1000):
  list.append((i*(i+1))//2)
for j in range(998):
  if list[j]<s[0]<=list[j+1]:
    print(list[j+1]-s[0])
    break

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
list=[]
for i in range(1,1000):
  list.append((i*(i+1))//2)
for j in range(998):
  if list[j]<=s[0]<list[j+1]:
    print(list[j+1]-s[0])
    break

Submission status: Wrong Answer

Solution code:
def bb099up(n):
    tou = 0
    for i in range(1, 1000):
        tou += i
        if tou > n:
            return tou

def bb099():
    a,b = list(map(int, input().split()))
    print(bb099up(a)-a)

bb099()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
d = 0
for i in range(0,999):
  c = 0
  for j in range(0,i):
    c += j
  if a <= c and  b > c:
    d = c
    break
print(d-a)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
d = 0
for i in range(1,999):
  c = 0
  for j in range(1,i):
    c += j
  if a <= c and  b > c:
    d = c
    break
print(d-a)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
d = 0
for i in range(1,999):
  c = 0
  for j in range(1,i):
    c += j
  if a < c and  b > c:
    d = c
    break
print(d-a)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
t = b - a
n = [1]
x = 1

for i in range(2,999):
  x = i + x
  n.append(x)

else:
  for j in range(0,len(n)-1):
    if n[j+1] - n[j] == t:
      break
print(n[j] - a)

Submission status: Wrong Answer

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

def height(k):
    return (1 + k)*k // 2

ans = 0
for i in range(1, 998):
    A = height(i) - a
    B = height(i+1) - b
    if A == B:
        ans = A
        break
print(A)

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, M, = map(int, input().split())

c = 0
index = 1
while c < N:
    c += index
    index += 1

if c - N == 0:
    print(index)
else:
    print(c - N)

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, M, = map(int, input().split())

c = 0
index = 1
while c < N:
    c += index
    index += 1

print(c - N)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
a_tower = 1
index = 2
while 1:
    if a_tower > a:
        break
    a_tower += index
    index += 1
print(a_tower - a)

Submission status: Wrong Answer

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

print(y%a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())	
q=[range(1,i) for i in range(2,1000)]
print(q)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
l = []
for i in range(1, 1000):
	l.append(i*(i+1)//2)
key = 0
for i in range(len(l)-1):
	for j in range(1, 1000):
		if a+j == l[i] and b+j == l[i+1]:
			print(j)
			key = 1
			break
	if key == 1:
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in nums[1:]:
    if i - (i-1) == df:
        print(i - b)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(x)
    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: Wrong Answer

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(a - (1 + x) * x // 2)
    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: Wrong Answer

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

temp = list(range(1, 1000))

t = []

for i in range(len(temp)):
  t.append(sum(temp[:i+1]))

for i in t:
  if i > a:
    print(i-a)
    exit()

Submission status: Wrong Answer

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: Wrong Answer

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

delta = b - a

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

print(b)

Submission status: Wrong Answer

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

for i in range(len(list)):
    if a <= list[i] < b <= list[i + 1]:
        print(list[i + 1] - b)
        exit()

Submission status: Wrong Answer

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

for i in range(len(list)):
    if a < list[i] < b <= list[i + 1]:
        print(list[i + 1] - b)
        exit()

Submission status: Wrong Answer

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 and nextH >= b:
        print(height - a)
        exit()

Submission status: Wrong Answer

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 and nextH > b:
        print(height - a)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
tower = []
for i in range(999):
        if i == 0:
                tower.append(1)
        else:
                tower.append(tower[i-1] + (i + 1))

a,b = map(lambda x:int(x) ,input().split())
for i in range(1,1000):
        a += 1
        b += 1
        if a in tower and b in tower:
                print(i)
                break

Submission status: Wrong Answer

Solution code:
tower = []
for i in range(999):
        if i == 0:
                tower.append(1)
        else:
                tower.append(tower[i-1] + (i + 1))


a,b = map(lambda x:int(x) ,input().split())
for i in range(0,999):
        if a in tower and b in tower:
                print(i)
                break
        a += 1
        b += 1

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
t = [n for n in accumulate(range(10000))]

a, b = map(int, input().split())
print(t[b - a - 1] - b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

input_line = input().split()

higher_margin = int(input_line[0])
lower_margin = int(input_line[1])

delta = higher_margin - lower_margin

lower_height = delta2lower_height(delta)
snow_height = lower_height - lower_margin

print(str(snow_height))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans -a)

Submission status: Wrong Answer

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

print(ans -a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a_num = 1
b_num = 1

for i in range(2,998):
    if a_num <= a <= a_num + i:
        a_num += i
        break
    a_num += i

for i in range(2,998):
    if b_num <= b <= b_num + i:
        b_num += i
        break
    b_num += i

print(a_num - a)

Submission status: Wrong Answer

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

a_num = 0
b_num = 0

for i in range(1,998):
    if a_num <= a <= a_num + i:
        a_num += i
        break
    a_num += i

for i in range(1,998):
    if b_num <= b <= b_num + i:
        b_num += i
        break
    b_num += i

print(a_num - a)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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)

for i in range(499500):
    if a+i in f and b+i in f:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = b-a

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

print(int(y))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = [0]
for i in range(1, 1000):
    c.append(c[i-1]+i)
    print(c[i-1], end=' ')
    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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

print(atreelist[0]-a)

Submission status: Wrong Answer

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

for i in range(1,1000):
	if a<A(i):
		Key=i
		break

print(int(A(Key)-a))

Submission status: Wrong Answer

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

a, b = map(int, input().split())
x = [0]*999
x[0] = 1


for i in range(998):
    x[i+1] = i+2 + x[i]

for j in range(999):
    if x[j]>a :
        print(abs(a - x[j]))
        exit()

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
tmp=[]
a=0
for i in range(1,1000):
    a+=i
    tmp.append(a)
for i in range(1,1000):
    if (A+i) in tmp and (B+i) in tmp:
        print(i)
        break

Submission status: Wrong Answer

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

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

x = 1
y = 3

for i in range(2, 1000):
    if a <= x and b <= y:
        print(x-a)
        break
    
    x = x + i
    y = y + (i+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1, 999+1):
    print(i, calc(i))

print(calc(b - a) - b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
lists = []
tmp = 0
for i in range(1,1000):
    tmp += i
    lists.append(tmp)
for i in range(len(lists)):
    for j in range(len(lists)):
        if lists[i] - a == lists[j] - b and lists[i] - a > 0 and lists[j] - b > 0:
            print(lists[i] - a)

Submission status: Wrong Answer

Solution code:
def calc(val):
  for i in range(999):
    if val < i:
      return i - val
    val -= i    

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

Submission status: Wrong Answer

Solution code:
def calc(val):
  for i in range(999):
    if val < i:
      return i - val
    val -= i    

if __name__ == '__main__':
  input = input().split(' ')
  a = calc(int(input[0]))
  print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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())
print(sigma(b)-sigma(a))

Submission status: Wrong Answer

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())
print(sigma(b-a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
m = list(range(1, 1000))
towers = [sum(m[:i]) for i in m]
c = 0
while True:
    if (a+c) in towers and (b+c) in towers:
        print(c)
        break
    c += 1

Submission status: Wrong Answer

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

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


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

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

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

#jの変数はしようできないので注意
#xor は(a ^ b)でいける

a = []
sum = 0
for i in range(1,1000):
    sum+=i
    a.append(sum)
for i in range(1000):
    if x+i in a and y+i in a:break
print(i)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

y = b - a - 1
w_hight = 0

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

print(w_hight - a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
A = list(range(1, 1000))
print(A)
for i in range(1 ,999):
    A[i] += A[i-1]
import numpy as np 
A = np.array(A)
res = 1
while True:
    A = A - 1
    if a in A and b in A:
        break
    else:
        res += 1
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = b-a

for i in range(499500):
    if(a<=n*i<=b):
        print(n*i-a)

Submission status: Wrong Answer

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

n = b-a

for i in range(499500):
    if(a<n*i<b):
        print(n*i-a)

Submission status: Wrong Answer

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

n = b-a

for i in range(999):
    if(a<n*i<b):
        print(n*i-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
    
if __name__ == '__main__':
  a,b = map(int, input().split(' '))
  
  sum = 0
  for n in range(999):
    sum += n
    if a < sum:
      print(sum - b)
      break

Submission status: Wrong Answer

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

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

print (d)
print(abs(d-a))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
    
if __name__ == '__main__':
  a,b = map(int, input().split(' '))
  
  numl = []
  sum = 0
  for n in range(999):
    sum += n
    if a < sum:
      print(sum - a)
      break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=eval('-'+input().replace(' ','+'))
s=0
for i in range(n+1):
  s+=i
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def getinputdata():

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

    flg = True

    try:
        while flg:

            data = input()

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

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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