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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
ans = 1
for i in range(999):
    for j in range(999):
        x = i * (i - 1) // 2
        y = j * (j - 1) // 2
        if x - a == y - b and x - a > 1:
            ans = x - a
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(999):
    for j in range(999):
        x = i*(i-1)//2
        y = j*(j-1)//2
        if x-a == y-b and x-a>0:
            ans = x-a
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a_height = get_height(a_index)
b_height = get_height(b_index)
snow_height = b_height - b
print(snow_height)

Submission status: Wrong Answer

Solution code:
import numpy as np

k, l=map(int, input().split())
n = np.zeros(999)
for i in range(1000):
    if i != 0:
        n[i-1] = i


def snowh(k, l):
    for i in range(1000):
        if l-k == n[i-1]:
            return n[i-2]*(n[i-2]+1)*0.5 - k
        
print(snowh(k, l))

Submission status: Wrong Answer

Solution code:
import numpy as np

k, l=[int(i) for i in input().split()]
n = np.zeros(999)
for i in range(1000):
    if i != 0:
        n[i-1] = i


def snowh(k, l):
    for i in range(1000):
        if l-k == n[i-1]:
            return n[i-2]*(n[i-2]+1)*0.5 - k
        
print(snowh(k, l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def prog(x):
    if x == 0:
        return 0
    elif x == 1:
        return 1
    else:
        return x + prog(x-1)

def ans(a, b):
    for i in range(1, 999):
        ansA = prog(i-1) - a
        ansB = prog(i) - b
        if ansA == ansB:
            return ansA

def main():    
    # argStr = input()
    # x = argStr.split(" ")
    argv = sys.argv
    argc = len(argv)
    if argc == 2:
        argA = int(argv[0])
        argB = int(argv[s1])
        print(ans(argA, argB))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=input().split()
a=int(x[0])
b=int(x[1])
n=b-a
y=a%n
print(n-y)

Submission status: Wrong Answer

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

t = 0
T = []
ta = 0
tb = 0
for i in range(1000):
    t += i
    T.append(t)

for i in range(len(T)-1):
    if a < T[i] and b < T[i+1]:
        print(T[i]-a)
        break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main2():
    strbuf = input("");
    strbufs = strbuf.split();
    buf = [];
    for i in range(2):
        buf.append(int(strbufs[i]));
    sa = buf[1] - buf[0];
    takasa = sa * (sa + 1) / 2;
    result = takasa - buf[1];
    print(result);


if __name__ == '__main__':
    main2()

Submission status: Wrong Answer

Solution code:
import sys
def readQuestion():
    line = sys.stdin.readline()
    sline = line.rstrip()
    [rline,r1line]=sline.split(" ")
    a=int(rline)
    b=int(r1line)
    return a,b 

def solve(a,b):
    x=[]
    y=0
    high=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    for xz in x:
        if xz <= b:
            high=xz
            d=high-a
    return d
# 全体
def main():
    x,y = readQuestion()
    answer = solve(x, y)
    print(answer)

# mainを呼び出す
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# ANSHUL GAUTAM
# IIIT-D
 
a,b = map(int, input().split())
L = []
N = 0
for i in range(1,1001):
	N += 1
	z = N*(N+1)//2
	L.append(z)
m = 0
n = 0
if(a in L and b in L):
	print(0)
else:
	for i in range(len(L)):
		if(L[i] > a):
			break
		m += 1

	for i in range(len(L)):
		if(L[i] > b):
			break
		n += 1

	j = 0
	for i in range(min(L[m],L[n])):
		zz1 = L[m]-j
		zz2 = L[n]-j
		if(zz1 == a and zz2 == b):
			break
		j += 1
	print(j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

t1 = 0
for i in range(1,1000):
    t1 += i
    if t1>a and t1+(i+1)>b:break

print(t1-a)

Submission status: Wrong Answer

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

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

print(t1-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
x=[int(i*(i+1)/2) for i in range(1,1000)]
A=[abs(a-x[i]) for i in range(999)]
B=[abs(b-x[i]) for i in range(999)]
c=list(set(A)&set(B))
c.sort()
if c[0]==0:
    print(c[1])
else:
    print(c[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
x=[int(i*(i+1)/2) for i in range(1,1000)]
A=[abs(a-x[i]) for i in range(999)]
B=[abs(b-x[i]) for i in range(999)]
c=set(A)&set(B)
print(min(c))

Submission status: Wrong Answer

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

print(a-num)

Submission status: Wrong Answer

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

print(a-num)

Submission status: Wrong Answer

Solution code:
tall=[int(i) for i in input().split()]
dist=tall[1]-tall[0]

left=0
for i in range(dist):
  left+=i
print(left-tall[0],end=" ")
print(left+dist-tall[1])

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
l = []
t = 0
i = 1
while t + i<= 499500:
  t += i
  l.append(t)
  i += 1

def f():
  for i in range(1, 1000):
    for j in range(len(l)-1):
      if l[j] - i == a and l[j+1] - i == b:
        return i

print(f())

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
l = []
t = 0
i = 1
while t + i<= 499500:
  t += i
  l.append(t)
  i += 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
lst=list(map(int,input().split()))
a=lst[0]
b=lst[1]
q=0
for i in range(1,1000):
    if q==0:
        for j in range(1,1000):
            if q==0:
                if a+i==j*(j+1)/2:
                    for k in range(j+1,1000):
                        if b+i==k*(k+1)/2:
                            print(i)
                            q==1
                            break
    else:
        break

Submission status: Wrong Answer

Solution code:
lst=list(map(int,input().split()))
a=lst[0]
b=lst[1]
q=0
for i in range(1,1000):
    if q==0:
        for j in range(1,1000):
            if q==0:
                if a+i==j*(j+1)/2:
                    for k in range(j+1,1000):
                        if b+i==k*(k+1)/2:
                            print(i)
                            q==1
                            break
                        else:
                            break 
    else:
        break

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

k = 1
b -= 1
while k<1000 and b>=0:
    a -= k
    k += 1
    b -= k

print(-b)

Submission status: Wrong Answer

Solution code:

ret_list = []
sum = 0
for x in range(1, 1000):
    sum += x

    ret_list.append(sum)

line = input()
num_line = line.split()
a = int(num_line[0])
b = int(num_line[1])

x = 0

for x in range(1, 1000):
    try:
        ret = ret_list.index(a + x)
        #print(ret)
    except:
        continue
    if (b+x) == ret_list[ret+1]:
        print(x)
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
#-^- cofing:utf-8 -^-

val_a,val_b = map(int, input().split())

tower_tall = 0

for fib in range(1,499500):
    tower_tall += fib
    if tower_tall > val_a:
        # print("TowerTall:" + str(tower_tall))
        print(tower_tall - val_a)
        break
    elif tower_tall == val_a and tower_tall <= val_b:
        # print("TowerTall:" + str(tower_tall))
        print(val_b - tower_tall)
        break

Submission status: Wrong Answer

Solution code:
lst=list(map(int,input().split()))
a=lst[0]
b=lst[1]
q=0
for i in range(1,1000):
    if q==0:
        for j in range(1,1000):
            if q==0:
                if a+i==j*(j+1)/2:
                    for k in range(j+1,1000):
                        if b+i==k*(k+1)/2:
                            print(i)
                            q==1
                            break
                        else:
                            break

Submission status: Wrong Answer

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

while a > ans:
    ans = ans + i
    i += 1
ans2 = ans + (i)

while (ans-a) == (ans2-b):
    if (ans-a) == (ans2-b):
        print(ans-a)
        break
    else:
        ans = ans-(i-1)
        ans2 = ans2-i

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a%5 == 0:
   Y = 1000 - b
   print(Y % 5)
elif b%5 == 0:
   Y = 1000 - a
   print(Y % 5)
else:
     Y = 1000 - a
     print(Y % 5)

Submission status: Wrong Answer

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

h = 0
i = 0
while h <= b and i < 1000:
    i += 1
    h += i

print(h-b)

Submission status: Wrong Answer

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

h = 0
i = 0
while h <= b and i < 1000:
    i += 1
    h += i

print(b-h)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

b -= 1
k = 1
while a>=0 or b>=0:
    a -= k
    k += 1
    b -= k

print(-a)

Submission status: Wrong Answer

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

while a > ans:
    ans = ans + i
    i += 1
ans2 = ans + (i)

print(ans-a)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

k = 1
while a>=0 or b>=0:
    a -= k
    k += 1
    b -= k

print(-a)

Submission status: Wrong Answer

Solution code:
lst=list(map(int,input().split()))
a=lst[0]
b=lst[1]
q=0
for i in range(1,1000):
    if q==0:
        for j in range(1,1000):
            if q==0:
                if a+i==j*(j+1)/2:
                    for k in range(j+1,1000):
                        if b+i==k*(k+1)/2:
                            print(i)
                            q==1
                            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

h = 0
i = 0
while h < b and i < 1000:
    i += 1
    h += i

print(h-b)

Submission status: Wrong Answer

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

h = 0
i = 0
while h < a and i < 1000:
    i += 1
    h += i

print(h-b)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a%5 == 0 or b%5 == 0:
    print('1')
else:
    Y = 1000 - a
    print(Y % 5)

Submission status: Wrong Answer

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

h = 0
i = 0
while h < a and i < 1000:
    i += 1
    h += i

if i > 999:
    print(h-b)
else:
    print(h-a)

Submission status: Wrong Answer

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

h = 0
i = 0
while h < a and i < 1000:
    i += 1
    h += i

print(h-a)

Submission status: Wrong Answer

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

h = 0
i = 0
while h < a:
    i += 1
    h += i

print(h-a)

Submission status: Wrong Answer

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

a = 0
tower = []
for i in range(1, 1000):
    a = i+a
    tower.append(a)
    
ans = 0
for i in range(499500):
    A += 1
    B += 1
    ans += 1
    if A in tower and B in tower:
        print(ans)
        break

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split( ))
ans = 1
i = 2

while a > ans:
    ans = ans + i
    i += 1

print(ans-a)

Submission status: Wrong Answer

Solution code:
#-^- cofing:utf-8 -^-

val_a,val_b = map(int, input().split())

tower_tall = 0

for fib in range(499500):
    tower_tall += fib
    if(tower_tall > val_a):
        break

print(tower_tall - val_a)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split( ))
ans = 1
i = 2

while a > ans:
    ans = ans + i
    i += 1
    print(ans)

print(ans-a)

Submission status: Wrong Answer

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

a = 0
tower = []
for i in range(1, 1000):
    a = i+a
    tower.append(a)
    
ans = 0
for i in range(499500):
    A += 1
    B += 1
    ans += 1
    if A in tower and B in tower:
        break
print(ans)

Submission status: Wrong Answer

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

a = 0
tower = []
for i in range(1, 1000):
    a = i+a
    tower.append(a)
    
ans = 0
for i in range(999):
    A += 1
    B += 1
    ans += 1
    if A in tower and B in tower:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
#coding : utf-8

if __name__ == '__main__':

    a,b = list(map(int,input().split()))
    tower = []
    for i in range(1000):
        if i == 0:
            tower.append(1)
        else:
            tower.append(tower[i-1]+i+1)
    d = []
    for i in range(999):
        d.append(tower[i+1]-tower[i])
    for i in range(999):
        if a-b == d[i]:
            print(tower[i]-a)

Submission status: Wrong Answer

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

a = 0
tower = []
for i in range(1, 1000):
    a = i+a
    tower.append(a)
    
ans = 0
while(True):
    A += 1
    B += 1
    ans += 1
    if A in tower and B in tower:
        break
print(ans)

Submission status: Wrong Answer

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

fib=[0]
for i in range(1000):
    if i != 0:
        fib.append(fib[i-1]+i)

n = 1
for i in range(1000):
    if a < fib[i] and fib[i] < b:
        n = fib[i] - a
        
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = 0
an = 0
while True:
    an = (n * (n+1))/2

    if an > a:
        print an - a
        break
    else:
        n+=1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*
a_b = input().split()
a = int(a_b[0])
b = int(a_b[1])
n = b - a

h = (n - 1) * n / 2 - a

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

if a==b:
    print(a)
else:
    k = 1
    while a>=0:
        a -= k
        k += 1

    print(-a)

Submission status: Wrong Answer

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

fib=[0]
for i in range(1000):
    if i != 0:
        fib.append(fib[i-1]+i)

n = 0
for i in range(1000):
    if a < fib[i] and fib[i] < b:
        n = fib[i] - a
        
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(depth)

Submission status: Wrong Answer

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

fib=[0]
for i in range(999):
    if i != 0:
        fib.append(fib[i-1]+i)

n = 0
for i in range(999):
    if a < fib[i] and fib[i] < b:
        n = fib[i] - a
        
print(n)

Submission status: Wrong Answer

Solution code:
A, B = input().split()
a = int(A)
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

k = 1
while a>=0:
    a -= k
    k += 1

print(-a)

Submission status: Wrong Answer

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

fib=[0]
for i in range(999):
    if i != 0:
        fib.append(fib[i-1]+i)

n = 0
for i in range(999):
    if a <= fib[i] and fib[i] <= b:
        n = fib[i] - a
        
print(n)

Submission status: Wrong Answer

Solution code:
#Stone Monument
a,b = map(int, input().split())
M = []
ans = []
for i in range(1,1000,1):
	n = 1/2*i*(i+1)
	M.append(n)
for i in range(0,999,1):
	for j in range(0,1000,1):
		if (a + j == M[i]) and (b + j == M[i+1]):
			if j <= i:
				print(j)
				exit()
			else:
				continue

Submission status: Wrong Answer

Solution code:
A, B = input().split()
a = int(A)
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
a, b = map(int,input().split())
n = (b - a)
print(math.factorial(n - 1))

Submission status: Wrong Answer

Solution code:
#Stone Monument
a,b = map(int, input().split())
M = []
ans = []
for i in range(1,1000,1):
	n = 1/2*i*(i+1)
	M.append(n)
for i in range(0,999,1):
	for j in range(0,1000,1):
		if (a + j == M[i]) and (b + j == M[i+1]):
			print(j)
			exit()

Submission status: Wrong Answer

Solution code:
A, B = input().split()
a = int(A)
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
A, B = input().split()
a = int(A)
ans = 0

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

print(ans)

Submission status: Wrong Answer

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

aa = 0
bb = 0
for i in range(20):
    aa += (i + 1) 
    bb += ((i + 1) + 1) 
    if abs(aa - bb) == c:
        print(aa - b)

Submission status: Wrong Answer

Solution code:
#Stone Monument
a,b = map(int, input().split())
M = []
ans = []
for i in range(1,1000,1):
	n = 1/2*i*(i+1)
	M.append(n)
for i in range(0,999,1):
	for j in range(0,999,1):
		if (a + j == M[i]) and (b + j == M[i+1]):
			print(j)
			exit()

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a%5 == 0 and b%5 == 0:
    print('1')
else:
    Y = a % 5
    print(5 - Y)

Submission status: Wrong Answer

Solution code:
A, B = input().split()
a = int(A)
b = int(B)
sa = b - a
ans = 0

for i in range(1, sa - 1):
    ans += i

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

ret_list = []
for x in range(1, 1000):
    sum = 0
    for i in range(0, x+1):
        sum += i

    ret_list.append(sum)

line = input()
num_line = line.split()
a = int(num_line[0])
b = int(num_line[1])

delta = b - a

for x in range(1, 999):
    if (a + x) in ret_list:
        if (b+x) in ret_list:
            print(x)
            sys.exit()

Submission status: Wrong Answer

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

towers.pop(0)

(a, b) = [int(i) for i in input().rstrip().split(' ')]

bi = 0
for i in range(999):
    if towers[i] > b:
        bi = i
        break
print(towers[bi] - b)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
diff=0
c=0
d=0
g=0
f=0
for i in range(1,1000):
    num=(i*(i+1))//2
    if(num>=a and g==0):
        c=num
        g=1
    if(num>=b and f==0):
        d=num
        f=1
    if(c!=0 and d!=0):
        break
if(c-a<d-b):
    print(c-a)
else:
    print(d-b)

Submission status: Wrong Answer

Solution code:
import sys

ret_list = []
for x in range(1, 1000):
    sum = 0
    for i in range(0, x+1):
        sum += i

    ret_list.append(sum)

line = input()
num_line = line.split()
a = int(num_line[0])
b = int(num_line[1])

delta = b - a

for x in range(0, 999):
    if (a + x) in ret_list:
        if (b+x) in ret_list:
            print(x)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = input().split(" ")
a = int(a)
b = int(b)

c = b - a
s = sum(list(np.arange(c)))
print(a - s)

Submission status: Wrong Answer

Solution code:
listA=list(map(int,input().split()))
a=listA[0]
b=listA[1]
snow=[1]
for i in range(1,999):
    snow.append(0)
    snow[i]=snow[i-1]+i+1
for j in range(1,999):
    if(b-a==j):
        print(snow[j-1]-b)
        break;

Submission status: Wrong Answer

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

for i in range(1, a_b):
    nl += i

print(a, nl)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#Stone Monument
a,b = map(int, input().split())
M = []
for i in range(1,1000,1):
	n = 1/2*i*(i+1)
	M.append(n)
for i in range(0,999,1):
	for j in range(0,999,1):
		if (M[i] - j == a) and (M[i+1] - j == b):
			print(j)
			exit()

Submission status: Wrong Answer

Solution code:
def is_tapi(n):
    start = int(n ** 0.5) // 2
    for i in range(start, 1000):
        if i * (i - 1) // 2 == n:
            return True
        elif i * (i - 1) // 2 > n:
            return False
    return False


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

for x in range(0, 1000000):
    if is_tapi(a + x) and is_tapi(b + x):
        print(x)
        break

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
diff=0
c=0
d=0
g=0
f=0
for i in range(1,1000):
    num=(i*(i+1))//2
    if(num>=a and g==0):
        c=num
        g=1
    if(num>=b and f==0):
        d=num
        f=1
    if(c!=0 and d!=0):
        break
print(c-a)

Submission status: Wrong Answer

Solution code:
def is_tapi(n):
    start = int(n ** 0.5) // 2
    for i in range(start, 1000):
        if i * (i - 1) // 2 == n:
            return True
    return False


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

for x in range(0, 1000000):
    if is_tapi(a + x) and is_tapi(b + x):
        print(x)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = tuple(map(int, input().split()))
nums = list(range(1, 999))

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a%5 == 0 or b%5 == 0:
    print('1')
elif a%5 == 2 or b%5 ==2:
    print('3')
elif a%5 == 4 or b%5 ==4:
    print('1')
elif a%5 == 3 or b%5 ==3:
    print('2')
elif a%5 == 1 or b%5 ==1:
    print('4')

Submission status: Wrong Answer

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

length = b - a
count = length - 1

for j in range(length):
  a -= count
  if a <= 0:
    print(1 - a)
    break
  else:
    count -= 1

Submission status: Wrong Answer

Solution code:
def is_tapi(n):
    for i in range(1000):
        if i * (i - 1) // 2 == n:
            return True
    return False


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

for x in range(0, 1000000):
    if is_tapi(a + x) and is_tapi(b + x):
        print(x)
        break

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
diff=0
c=0
d=0
g=0
for i in range(1,1000):
    num=(i*(i+1))//2
    if(num>=a and num<=b and g==0):
        c=num
        g=1
    if(num>=b):
        d=num
        break
print(c-a)

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

a, b = read_line(int, int)

d = b - a
s = 1
for i in range(2, 999):
    s += i

    if d == i:
        print(s - b)
        break

Submission status: Wrong Answer

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

length = b - a
count = length - 1

for j in range(length):
  a -= count
  print(a)
  if a <= 0:
    break
  else:
    count -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a%5 == 0 or b%5 == 0:
    print('1')
elif a%5 == 2 or b%5 ==2:
    print('3')
elif a%5 == 4 or b%5 ==4:
    print('1')
elif a%5 == 3 or b%5 ==3:
    print('2')

Submission status: Wrong Answer

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

height = 1
up = 1

while (a+1) >= height:
    up += 1
    height += up

height -= up

print(str(abs(a - height)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sa = abs(b-a)
tmp1 = 0
for i in range(1,999):
    tmp2 = int(i*(i+1)/2)
    if tmp2 - tmp1 == sa:
        print(tmp1 - a)
        break
    tmp1 = tmp2

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
diff=0
c=0
d=0
g=0
for i in range(1,99+1):
    num=(i*(i+1))//2
    if(num>=a and num<=b and g==0):
        c=num
        g=1
    if(num>=b):
        d=num
        break
print(c-a)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

diff = b - a

while True:
    b = b - diff
    #print(b)
    diff -= 1
    #print(diff)
    if b <= 1:
        break
print(diff)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
diff=0
c=0
d=0
for i in range(1,99+1):
    num=(i*(i+1))//2
    if(num>=a and num<=b):
        c=num
    if(num>=b):
        d=num
        break
print(c-a)

Submission status: Wrong Answer

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

length = b - a
count = length - 1

for j in range(length):
  a -= count
  if a < 0:
    print(1 - a)
    break
  else:
    count -= 1

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

k = 1
while a>0:
    a -= k
    k += 1

print(-a)

Submission status: Wrong Answer

Solution code:
N = input()
N = N.split(" ")
N = [int(i) for i in N]

sub = N[1] - N[0]
high = 0 
for i in range(sub):
    high += i

print(high)

snow = high - N[0]
print(snow)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a%5 == 0 or b%5 == 0:
    print('1')
else:
    print(a % 5 - 1)

Submission status: Wrong Answer

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

print(ans - a)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split( )))
z = x[1]-x[0]
t = 0
for s in range(z+2):
    t += s
    
print(t-x[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tmp = 1

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

Submission status: Wrong Answer

Solution code:
listA=list(map(int,input().split()))
a=listA[0]
b=listA[1]
snow=[1]
for i in range(1,999):
    snow.append(0)
    snow[i]=snow[i-1]+i+1
for i in range(1,999):
    if(b-a==i):
        print(snow[i-1]-b)
        break;

Submission status: Wrong Answer

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