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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
def main():
    high = 0
    snow = 0
    a,b= map(int, input().split())
    for i in range(1,b+1):
        high += i
        if a < high < b:
            snow =  high - a
            break
    print(snow)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
count=0
A=[]
B=[]
for i in range(1000):
  count+=i
  if 0<=count-a<=a:
    A.append(count-a)
  if 0<=count-b<=b:
    B.append(count-b)

for i in A:
  if i in B:
    print(i)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1,1000):
  num.append(num[-1]+i)
  
  if num[-1]>=a:
    ans=num[-1]-a
    break
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
c = abs(b - a)
x = 0
while(a % c != 0):
  x += 1
  a += 1
print(x)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
c = abs(b - a)
x = 0
while(a % c != 0):
  a += 1
  x += 1
print(x)

Submission status: Wrong Answer

Solution code:
towers = {}
h = 0
for i in range(1,1000):
    h += i 
    towers[h] = True 

a,b = map(int,input().split())
snow = 1
while(1):
    if a + snow in towers.keys() and b + snow in towers.keys():
        print(snow)
        break
    snow += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    vec = [False] * 499501
    s = 0
    for i in range(1, 1000):
        s += i
        vec[s] = True

    for h in range(1, 499500):
        if vec[h + a] and vec[h + b]:
            print(h)
            break

    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a,b = (int(T) for T in input().split())
Count = 1
X = 0
while X<a:
    X += Count
    Count += 1
print(X-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = 0
for i in range(1, 1000):
    x += i
    if x > a:
        print(x - a)
        exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    a,b = map(int, input().split())
    sum = 0
    
    for height in range(1,999):
        sum += height
        if b-a == height:
            print(sum-b)
            break;
        
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b = map(int, input().split())
    sum = 0
    
    for height in range(1,999):
        sum += height
        if a < sum and sum < b:
          print(sum-a)
          break;
        
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for i in range(1, 999):
  h += i
  if i == d:
    print(h - b)
    exit()

Submission status: Wrong Answer

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

for i in range(1, 999):
  h += i
  
  if h >= a:
    print(h - a)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
MM = input().split()
a = int(MM[0])
b = int(MM[1])
list1=[]
total = 0
for i in range(1,1000):
  aa = total + i
  list1.append(aa)
  total = aa

for i in range(0,998):
  
  for j in range(999):
    if list1[i] == a + j and list1[i+1] == b + j:
      print(j)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

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

    count = 0
    for i in range(1,1000):
        count += i
        if a < count:
            print(count-a)
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

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

    count = 0
    for i in range(1,1000):
        count += i
        if a <= count:
            print(count-a)
            break

if __name__ == '__main__':
    main()

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())
x = 0
for i in range(1000000):
    x += i
    if x > a:
        x 
        break

print(x-a)

Submission status: Wrong Answer

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

print(x-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
sum = 1
for i in range(2,999):
	if a > sum:
		sum += i
	else:
		break
print(sum-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# check
east = 3
add = 3
while b > east:
    east += add
    add += 1

print(abs(east - b))

Submission status: Wrong Answer

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

for i in range(1, 499501):
    if (a + i) in bar_heights and (b + i) in bar_heights:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import bisect

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

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

i = bisect.bisect_left(towers, a)
print(towers[i] - 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:
a, b = map(int, input().split())

s = 0
for i in range(1, 1000):
    s += i
    if a < s:
        print(s - a)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

temp = 0
x,y = 999,999

for i in range(1,1000):
    temp += i
    if temp - a > 0:
        x = min(temp-a, x)

print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
k=0
for i in range(1,max(a,b)):
    k+=i
    if k-a>0 or k-b>0:
        break
print(abs(min(a,b)-k))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def fu(n):
    if n<0:
        return (n*(-1))
    return n
a,b = map(int,input().split())
l = [fu(a-sum(range(1,i+1))) for i in range(1,1000)]
print(min(l))

Submission status: Wrong Answer

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

diff1 = abs(m - a)
diff2 = abs((m + i) - b)

if diff1 == diff2:
    print(diff1)

Submission status: Wrong Answer

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

diff = abs(m - a)
print(diff)

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 x in range(1, 1000):
    sm += x
    if sm > a:
        print(sm-a)
        break

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b = map(int,input().split())
li = []
for i in range(1,1001):
    li.append((1/2)*i*(i+1))
for i in range(len(li)):
    if li[i]>=a and li[i]<=b:
        check = i
        break
print(int(li[check]-a))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b = map(int,input().split())
li = []
for i in range(1,1000):
    li.append((1/2)*i*(i+1))
for i in range(len(li)):
    if li[i]>a and li[i]<=b:
        check = i
        break
print(int(li[check]-a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
icase=0
if icase==0:
    import sys
    a,b=map(int,input().split())
    for i in range(1,999):
        isum=(i*(i+1))//2-a
        for j in range(i,1000):
            jsum=(j*(j+1))//2-b
            if jsum==isum and 1<=jsum:
                print(jsum)
                sys.exit()

Submission status: Wrong Answer

Solution code:
icase=0
if icase==0:
    import sys
    a,b=map(int,input().split())
    for i in range(1,999):
        isum=i*(i+1)//2
        for j in range(i,1000):
            if j*(j+1)//2-isum==b-a and 1<=j*(j+1)//2-b:
                print(j*(j+1)//2-b)
                sys.exit()

Submission status: Wrong Answer

Solution code:
icase=0
if icase==0:
    import sys
    a,b=map(int,input().split())
    for i in range(1,1000):
        isum=i*(i+1)//2
        for j in range(i,1000):
            if j*(j+1)//2-isum==b-a and 1<=j*(j+1)//2-b:
                print(j*(j+1)//2-b)
                sys.exit()

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
H=[0]*1000

i=1
while i<=999:
    H[i]=i+H[i-1]
    i+=1

ans=0
while True:
    if (A+ans in H)and(B+ans in H):
        break
    else:
        ans+=1
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for j in range(5*(10**6)):
    if ((a+j) in A) and ((b+j) in A):
        print(j)
        exit()

Submission status: Wrong Answer

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

for j in range(10**6):
    if ((a+j) in A) and ((b+j) in A):
        print(j)
        exit()

Submission status: Wrong Answer

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

for i in range(10*6):
    if (a+i) in A and (b+i) in A:
        print(i)
        exit()

Submission status: Wrong Answer

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

print(0.5*(b-a)*(b-a-1)-a)

Submission status: Wrong Answer

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

ans = (b-a)*(b-a-1)*0.5-a

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  a,b = map(int,input().split())
  Snow = [0] * 1000
  Snow[1] = 1
  for i in range(2,1000):
    Snow[i] = Snow[i-1] + i
  for i in range(2,1000):
    if a <= Snow[i] <= b:
      print(Snow[i] - a)
      exit()
  #print(Snow)
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

for i in range(999):
  height_a += i
  if a < height_a:
    break
  
for i in range(999):
  height_b += i
  if b < height_b:
    break

print(height_a - a)

Submission status: Wrong Answer

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

for i in range(999):
  height_a += i
  if a < height_a:
    break
  
for i in range(999):
  height_b += i
  if b < height_b:
    break

print(height_b - b)

Submission status: Wrong Answer

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

sub = 0
for i in range(1, 1000):
    sub += i
    if sub > a:
        print(sub - a)
        break

Submission status: Wrong Answer

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

i = 1
while True:
  if s.count(a + i) == 1:
    print(i)
    exit()
  i += 1

Submission status: Wrong Answer

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

i = 0
while True:
  if s.count(a + i) == 1:
    print(i)
    exit()
  i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,(input().split()))
i = 1
result = 0
#雪の高さX
#1 3 6 10
left = 0
right =0
while True:
    result = result + i
    i += 1
    if result > a:
        left = result
        break 

while True:
    result = result + i
    i += 1
    if result > b:
        right = result
        break 



print(left - a)
#print(right)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in S:
    if a < i and i <= b:
        print(i-a)
        break

Submission status: Wrong Answer

Solution code:
#ABC099

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

Submission status: Wrong Answer

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

for i in range(499500):
    x += i
    a_count += 1
    if a <= x:
        break

print(x - a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

a, b = na()

s = 0
i = 1
ans = 0
while s <= a:
    s += i
    i += 1

print(s - a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
n=999
l=[1]*n
for i in range(1,n):
    l[i]=l[i-1]+(i+1)
for j in range(n):
    if l[j-1]<=a<=l[j]:
        print(l[j]-a)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l= [1]
x = 0
for i in range(1,100):
    x = l[i-1] + i+1
    l.append(x)

for j in range(len(l)-1):
    if l[j+1] - l[j] == b-a:
        print(l[j] - a)
        break

Submission status: Wrong Answer

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

for i in range(100):
  a += 1
  b += 1
  if a in l and b in l:
    print(ans)
    break
  else:
    ans += 1

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
l = [i*(i+1)//2 for i in range(1,101)]
ans = 0
#print(l)
for i in range(100):
  ans += 1
  if b - a - ans in l:
    print(ans)
    break

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
l = [i*(i+1)//2 for i in range(1,101)]
ans = 0

for i in range(100):
  a += 1
  b += 1
  ans += 1
  if a in l and b in l:
    print(ans)
    break

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
l = [i*(i+1)//2 for i in range(1,101)]
ans = 1

for i in range(100):
  a += 1
  b += 1
  if a in l and b in l:
    print(ans)
    break
  else:
    ans += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import sys

# import itertools
# import numpy as np

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

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

print(bt - b)

Submission status: Wrong Answer

Solution code:
a, b = map(int, raw_input().split())
ans = 1
for i in range(a):
    ans = ans * 100
if b == 100:
    print ans * 101
else:
    print ans * b

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def snow(x):
  n = 1
  while n / 2 * (n + 1) < x:
    n += 1
  return round(n / 2 * (n + 1)) - x

if a == 1:
  A = 3
else:
  A = a
while snow(b + snow(A)) != 0 or snow(a+snow(A)) != 0:
  A += 1

print(snow(A))

Submission status: Wrong Answer

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

def snow(x):
  n = 1
  while n / 2 * (n + 1) < x:
    n += 1
  return round(n / 2 * (n + 1)) - x

while snow(b+snow(a)) != 0:
  a += 1

print(snow(a))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
if b != 100:
    print(b * (100 ** a))
else:
    print((b+1) * (100 ** a))

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


b1 = 0
c = b - a

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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=[int(s) for s in input().split()]
x=B-A
y=x*(x-1)//2
print(A+y)

Submission status: Wrong Answer

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

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


for k in range(999):
    if S[k] <= A and A <= S[k +1]:
        print(S[k+1]- A)

Submission status: Wrong Answer

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

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


for k in range(999):
    if S[k] < A and A < S[k +1]:
        print(S[k+1]- A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
ls = [1]
for i in range(999):
    ls.append(ls[i]+i+2)
for i in range(len(ls)):
    if ls[i] > a:
        print(abs(ls[i+1]-b))
        break

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
ls = [1]
for i in range(999):
    ls.append(ls[i]+i+2)
for i in range(len(ls)):
    if ls[i] > a:
        print(abs(ls[i+1]-a))
        break

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
ls = [1]
for i in range(999):
    ls.append(ls[i]+i+2)
for i in range(len(ls)):
    if ls[i] > a:
        print(abs(ls[i]-a))
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a,b = inpl()
s = [(i+1)*i//2 for i in range(1,1000)]
# print(s[:10])
for i in range(1,10**6):
    if a+i in s and b+i in s:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
#coding:utf-8

a, b = 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())
count1=0
count2=0
ans1 = 0
ans2 = 0
for i in range(1000):
    count1+=i
    if a<=count1:
        ans1 += count1
        break
for j in range(1000):
    count2+=j
    if b<=count2:
        ans2+=count2
        break
if ans1-a == ans2-b:
    print(ans1-a)
else:
    if ans1>ans2:
        print(ans1)
    else:
        print(ans2)

Submission status: Wrong Answer

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


for i in range(5):
    a1 = a+i
    if a1%5==0:
        ans1 += i
for j in range(5):
    b1 = b+j
    if b1%5==0:
        ans2 += j
if ans1==ans2:
    print(ans1)
else:
    if ans1>ans2:
        print(ans1)
    else:
        print(ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

height = 0
i = 1
while True:
    height += i
    if a < height:
        break
    i += 1

print(height - a)

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(999):
  if list[j]<=s[0]<list[j+1]:
    print(list[j+1]-s[0])
    break