qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
a, b, c = map(int, split(input()))
 
if (a < b < c):
    print("Yes")
else:
    print("No")

# Fixed code:
a, b, c = map(int, input(). split())
if a < b and b <c :
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c=map(int,input().split(" "))
if a<b:
    if b<c:
        print("Yes")
else:
    print("No")


# Fixed code:
l = input()
a,b,c = map(int,l.split())
if(a < b):
    if(b < c):
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Buggy code:
A,B,C = map(int,input().split())
if C > B and C > A:
    print("Yes")
print("No")



# Fixed code:
A,B,C = map(int,input().split())
if C > B and C > A and B > A:
    print("Yes")
else:
    print("No")
# Buggy code:
a, b, c = map(int, input().split())
if a < b and b < c: print("Yes")
else: print("No)

# Fixed code:
a, b, c = map(int,input().split())
if a<b and b<c:
 print("Yes")
else:
 print("No")
# Buggy code:
a, b, c  = map(int, input().spilit())

if a < b < c:
    print("Yes")
else:
    print("No")


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

if  a < b < c:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c = map(int,input().split())
if b <= a:
  print(No)
elif c <= b:
  print(No)
else:
  print(Yes)

# Fixed code:
a, b, c =  map(int, input().split())
if a < b < c:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c = map (int, input(),split())
if a < b < c:
    print("Yes")
else:
    print("No")

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

if a<b and b<c:
	print("Yes")
else:
	print("No")
# Buggy code:
a, b, c = map(int, input().split())

if (a < b and b < c):
    print "Yes"
else:
    print "No" 

# Fixed code:

a,b,c=map(int,input().split())
if a<b and b<c:
    print("Yes")
else:
    print("No")
# Buggy code:
a, b ,c = map(int, input().split())
if a < b and b < c:
    print('Yes')


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

if a < b and b < c: print('Yes')
else: print('No')
# Buggy code:
a, b, c = map(int, input().split())

if a < b amd b < c:
  print("Yes")
else:
  print("No")

# Fixed code:
a,b,c =map(int,input().split())
if a < b and b < c:
	print('Yes')
else:
	print('No')
# Buggy code:
num = list(map(int,input().split()))
if(num[0] < num[1] && num[1] < num[2] && num[0] < num[2]): print("Yes")
else: print("No")


# Fixed code:
num = list(map(int,input().split()))
if(num[0] < num[1] and num[1] < num[2] and num[0] < num[2]): print("Yes")
else: print("No")
# Buggy code:
a,b,c = map(int, raw_input().split()
if a<b and b<c:
    c='Yes'
else:
    c='No'
print c

# Fixed code:
a, b, c = map(int, input().split())
if(a < b and b < c):
    print("Yes")
else:
    print("No")
# Buggy code:
a, b, c = map(int, input().split())
if a < b and b < c:
   print("Yes")
else:
   prin("No")



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

if a < b < c:
    print('Yes')
else:
    print('No')
# Buggy code:
a,b,c=map(int,input().split())
if a<b<c: print("Yes")
elif: print("No")

# Fixed code:
a,b,c=map(int,input().split())
if a < b < c :
    print("Yes")
else:
    print("No")
# Buggy code:
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)

if a < b:
    if b < c: print('Yes')
else:
    print('No')
    
    


# Fixed code:
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)

if a < b and b < c:
    print('Yes')
else:
    print('No')
# Buggy code:
a = input()
b = a.split(' ')
c = int(b[0])
d = int(b[1])
e = int(b[2])
if c <= d <= e:
    print('Yes')
else:
    print('NO')

# Fixed code:
a = input()
b = a.split(' ')
c = int(b[0])
d = int(b[1])
e = int(b[2])
if c < d < e:
    print('Yes')
else:
    print('No')
# Buggy code:
a, b, c = map(int, input().split())
if a < b:
	if b < c:
		print('Yes')
		else:
			print('No')
else:
	print('No')

# Fixed code:
a,b,c = map(int, input().split())
if a < b and b < c:
	print("Yes")
else :
	print("No")
# Buggy code:
a, b, c = map(int, input().split())

if a < b < c:
    print("Yes")
else:
    print("NO")

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

if a < b < c:
    print('Yes')
    
else:
    print('No')
# Buggy code:
a, b, c = [int(i) for i in input().split()]
    if a < b < c:
        print ("Yes")
 
    else:
        print ("No")

# Fixed code:
a,b,c =[int(i) for i in input().split()]
print("Yes" if a<b<c else "No")
# Buggy code:
a,b,c = map(int, input().split())
if a < b < c:
    print("Yes")
print("No")

# Fixed code:
a,b,c=map(int,input().split())
if(a<b<c):
 print("Yes")
else:
 print("No")
# Buggy code:
a,b,c=map(int,raw_input().split())
if(a<b and b<c) :
	print 'Yes'
else
	print 'No'

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

if a < b and b < c :
    print('Yes')
else:
    print('No')
# Buggy code:
a, b, c = map(int, input().split())
if a > b > c:
    print("Yes")
else:
    print("No")

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

if a < b:
    if b < c:
        print("Yes")
    
    else:
        print("No")
else:
    print("No")
# Buggy code:
a,b,c = map(int,input().split())

if(a<b && b<c):
    print("Yes")
else:
    print("No")

# Fixed code:
a,b,c=list(map(int,input().split()))
if a<b<c:
	print("Yes")
else:
	print("No")
# Buggy code:
a,b,c=map(int,input().split())
if a < b:
  if b < c:
    print("Yes")
else:
  print("No")

# Fixed code:
i = input()
a,b,c = map(int, i.split())
if a<b and b<c:
    print('Yes')
else:
    print('No')
# Buggy code:
def funcs(a, b, c):
    x = int(a)
    y = int(b)
    z = int(c)

    if x < y < z:
        print("Yes")
    else:
        print("No")


tmp = input()

a, b = tmp.split(" ")

funcs(a, b)



# Fixed code:
def funcs(a, b, c):
    x = int(a)
    y = int(b)
    z = int(c)

    if x < y < z:
        print("Yes")
    else:
        print("No")


tmp = input()

a, b, c = tmp.split(" ")

funcs(a, b, c)
# Buggy code:
num = input().split();
a = int(num[0]);
b = int(num[1]);
c = int(num[2]);

if a < b && b < c:
  print('Yes');
else :
  print('No');

# Fixed code:
num = input().split()

a = int(num[0])
b = int(num[1])
c = int(num[2])

if a < b < c:
  print('Yes')
else:
  print('No')
# Buggy code:
a,b,c = map(int, input(),split())

if a < b < c:
    print("Yes")
else:
    print("No")

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

if a<b and b<c:
    print('Yes')
    
else:
    print('No')
# Buggy code:
d = input()
a, b, c = map(d.split())

if (a < b) and (b < c):
    print("Yes")
else:
    print("No")


# Fixed code:
a, b, c= map(int,input().split())
if a < b and b < c:
    print('Yes')
else:
    print('No')
# Buggy code:
in_str = input().split(" ")

a = int(in_str[0])
b = int(in_str[1])
c = int(in_str[2])

if a < b:
    if b < c:
        print("Yes")
else:
    print("No")

# Fixed code:
l = input().split()
a = int(l[0])
b = int(l[1])
c = int(l[2])

if a < b < c:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c = map (int, input(),split())
if a < b and < c:
    print("Yes")
else:
    print("No")

# Fixed code:
a,b,c = map(int,input().split())
print("Yes") if a < b and b < c else print("No")
# Buggy code:
while True:
	a=0
	num=list(map(int,input().split()))
	if num[0]==0 and n[1]==0:
		break
	else:
		for i in range(1,num[0]+1):
			for j in range(i+1,num[0]+1):
				for k in range(j+1,num[0]+1):
					if i+j+k==num[1]:
						a+=1
						print(i,j,k)
					
			


# Fixed code:
while True:
	a=0
	num=list(map(int,input().split()))
	if num[0]==0 and num[1]==0:
		break
	else:
		for i in range(1,num[0]+1):
			for j in range(i+1,num[0]+1):
				for k in range(j+1,num[0]+1):
					if i+j+k==num[1]:
						a+=1
		print(a)
# Buggy code:
while 1:
 n,x=map(int,input().split())
 if n+x==0:break
 for i in range(3,n+1):
  for j in range(2,x-i):
   if x-i-j<j<i:
    c+=1
 print(c)

# Fixed code:
while 1:
 n,x=map(int,input().split())
 if n+x==0:break
 c=0
 for i in range(3,n+1):
  for j in range(2,x-i):
   if x-i-j<j<i:
    c+=1
 print(c)
# Buggy code:
while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0
    for s in range(1, n???+ 1):
        for m in range(s + 1, n):
            for e in range(m + 1, n + 1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)

# Fixed code:
while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0
    for s in range(1, n+1):
        for m in range(s+1, n):
            for e in range(m+1, n+1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)
# Buggy code:
while True:
    n, x = map(int,input().split())
    if(n==0, x==0):
        break
    nlist = []
    for i in range(1,n+1):
        nlist.append(i)
    count = 0
    for i1 in range(n-2):
        for i2 in range(i1+1,n-1):
            for i3 in range(i2+1,n):
                y = nlist[i1]+nlist[i2]+nlist[i3]
                if(y == x):
                    count += 1
    print(count)


# Fixed code:
while True:
    n, x = map(int,input().split())
    if(n==0 and x==0):
        break
    nlist = []
    for i in range(1,n+1):
        nlist.append(i)
    count = 0
    for i1 in range(n-2):
        for i2 in range(i1+1,n-1):
            for i3 in range(i2+1,n):
                y = nlist[i1]+nlist[i2]+nlist[i3]
                if(y == x):
                    count += 1
            
    print(count)
# Buggy code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    cnt = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if (i + j + k) == x:
                    cnt += 1
                elif (i + j + K) > x:
                    break
    print cnt

# Fixed code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    cnt = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if (i + j + k) == x:
                    cnt += 1
                elif (i + j + k) > x:
                    break
    print(cnt)
# Buggy code:
n = 0
while 1:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    else:
        for i in range(1, a+1):
            for j in range(1, i):
                for k in range(1, j):
                    if i + j + k = b:
                        n += 1
        print(n)
        


# Fixed code:
n = 0
while 1:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    else:
        for i in range(1, a+1):
            for j in range(1, i):
                for k in range(1, j):
                    if i + j + k == b:
                        n += 1
        print(n)
    n = 0
# Buggy code:
while 1:
    n,x = map(int,input().split())
    count == 0
    if n == 0 and x == 0:
        break

    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if i + j + k == x:
                    count += 1
    print(count)

# Fixed code:
while(True):
    n,x=map(int,input().split())
    
    if n == 0 and x==0:
        break
    
    count = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if i+j+k == x:
                    count += 1
    
    print(count)
# Buggy code:
while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0): break
    c = 0
    for i in range(1,num[0]+1):
        for j in range(1,num[0]+1):
            if j <= i:
                continue
            k = num[1]-(i+j)
            if k > j and k <= num[1]:
                c+= 1
    print(c)


# Fixed code:
while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0): break
    c = 0
    for i in range(1,num[0]+1):
        for j in range(i+1,num[0]+1):
            if j <= i:
                continue
            k = num[1]-(i+j)
            if k > j and k <= num[0]:
                c+= 1
    print(c)
# Buggy code:
def solve(n,x):
    count = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            k = x - i -j
            if j < b and b <= n:
                count += 1
    return count//6

while True:
    n,x = map(int,input().split())
    if n == x == 0:
        break;
    print(solve(n,x))

# Fixed code:
def solve(n,x):
    count = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            k = x - i - j
            if j < k and k <= n:
                count += 1
    return count

while True:
    n,x = map(int,input().split())
    if n == x == 0:
        break;
    print(solve(n,x))
# Buggy code:
while True:
 n, x = map(int(input().split()))
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n):
  for b in range(1, n):
   for c in range(1, n):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)

# Fixed code:
while True:
 n, x = map(int, input().split())
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n + 1):
  for b in range(a + 1, n + 1):
   for c in range(b + 1, n + 1):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)
# Buggy code:
ele_and_tar = []
rs = []
flag1 = 1
flag2 = 0
while flag1:
    data = [int(x) for x in input().split()]
    if data == [0,0]:
        flag1 = 0
    else:
        ele_and_tar.append(data)
        
for i in range(len(ele_and_tar)):
    rs.append(0)
for math in ele_and_tar:
    for i in range(1,math[0]+1):
        for j in range(i+1,math[0]+1):
            for k in range(j+1,math[0]+1):
                if (i + j + k) == math[1]:
                    rs[flag2] = rs[flag2] + 1
    flag2 = flag2 + 1


# Fixed code:
ele_and_tar = []
rs = []
flag1 = 1
flag2 = 0
while flag1:
    data = [int(x) for x in input().split()]
    if data == [0,0]:
        flag1 = 0
    else:
        ele_and_tar.append(data)
        
for i in range(len(ele_and_tar)):
    rs.append(0)
for math in ele_and_tar:
    for i in range(1,math[0]+1):
        for j in range(i+1,math[0]+1):
            for k in range(j+1,math[0]+1):
                if (i + j + k) == math[1]:
                    rs[flag2] = rs[flag2] + 1
    flag2 = flag2 + 1
    
for out in rs:
    print(out)
# Buggy code:
#!/usr/local/env python3

import sys


def main():
    while True:
        count = 0
        n, r = map(int, sys.stdin.readline().split())
        if n == r == 0:
            break
        for n1 in range(1, n-1):
            for n2 in range(n1+1, n):
                for n3 in range(n2+1, n+1):
                    print('n1: %d, n2: %d, n3: %d' % (n1, n2, n3))
                    if n1 + n2 + n3 == r:
                        count += 1
                        print('count: %d' % count)
        print(count)


if __name__ == '__main__':
    main()

# Fixed code:
#!/usr/local/env python3

import sys


def main():
    while True:
        count = 0
        n, r = map(int, sys.stdin.readline().split())
        if n == r == 0:
            break
        for n1 in range(1, n-1):
            for n2 in range(n1+1, n):
                for n3 in range(n2+1, n+1):
                    if n1 + n2 + n3 == r:
                        count += 1
        print(count)


if __name__ == '__main__':
    main()
# Buggy code:
n, x = map(int, input().split())
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1, n):
            if i+j+k == x:
                cnt += 1
print(cnt)


# Fixed code:
while 1:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    cnt = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1, n+1):
                if i+j+k == x:
                    cnt += 1
    print(cnt)
# Buggy code:
def a():
    data_set=[]
    while True:
        s=input().split()
        data_set.append(s)
        if ["0","0"] in data_set:
            break
    data_set=data_set[:-1]
    import itertools
    for i in data_set:
        count=0
        n=int(i[0])
        x=int(i[1])
        num=list(itertools.combinations(range(1,n+1),3))
        for j in num:
            if sum(j)==x:
                count+=1
        print(count)



# Fixed code:
def a():
    data_set=[]
    while True:
        s=input().split()
        data_set.append(s)
        if ["0","0"] in data_set:
            break
    data_set=data_set[:-1]
    import itertools
    for i in data_set:
        count=0
        n=int(i[0])
        x=int(i[1])
        num=list(itertools.combinations(range(1,n+1),3))
        for j in num:
            if sum(j)==x:
                count+=1
        print(count)
a()
# Buggy code:
#coding:utf-8
#1_7_B 2015.4.5
while True:
    n,x = map(int,input().split())
    if n == x == 0:
        break
    count = 0
    
    for i in range(1 , n + 1):
        for j in range(1 , n + 1):
            if (x - i - j) < n and i < j < (x - i -j):
                count += 1
    print(count)

# Fixed code:
#coding:utf-8
#1_7_B 2015.4.5
while True:
    n,x = map(int,input().split())
    if n == x == 0:
        break
    count = 0
    
    for i in range(1 , n + 1):
        for j in range(1 , n + 1):
            if i < j < (x - i - j) <= n:
                count += 1
    print(count)
# Buggy code:
while True:
    n, x = [int(i) for i in input().split()]


    if n == x == 0:
        break

    count = 0
    for s in range(1, n - 1):
        for m in range(s+1, n):
            for e in range(m+1, n+1):
                if n < x:
                    break
                if x == sum([s, m, e]):
                    count += 1

    print(count)

# Fixed code:
while True:
    n, x = [int(i) for i in input().split()]


    if n == x == 0:
        break

    count = 0
    for s in range(1, n - 1):
        for m in range(s+1, n):
            for e in range(m+1, n+1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)
# Buggy code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0: break
    count = 0
    for i in range(1,n - 1):
        for j in range(i + 1 ,n):
            if i + j + j + 1: break
            for k in range(j + 1 ,n + 1):
                if i + j + k == x: 
                    count += 1
                    break 
    print(count)

# Fixed code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0: break
    count = 0
    for i in range(1,n - 1):
        for j in range(i + 1 ,n):
            if i + j + j + 1 > x: break
            for k in range(j + 1 ,n + 1):
                if i + j + k == x:
                    count += 1
                    break
    print(count)
# Buggy code:
while True:
    (n , x) = [int (i) for i in input().split()]
    if n == x == 0:
        break

    count = 0
    for a in range(1, n + 1 = 2):
        for b in range(a + 1, n + 1 - 1):
            for c in range(b + 1, n + 1 ):
                if (a + b + c) == x:
                    count += 1
    print(count)

# Fixed code:
while True:
    (n , x) = [int (i) for i in input().split()]
    if n == x == 0:
        break

    count = 0
    for a in range(1, n + 1 - 2):
        for b in range(a + 1, n + 1 - 1):
            for c in range(b + 1, n + 1 ):
                if (a + b + c) == x:
                    count += 1
    print(count)
# Buggy code:
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:break
    for i in range(1,n+1):
        for j in range(1,i):
            for k in range(1,j):
                if i+j+k==x :a=a+1
    print(a)


# Fixed code:
while True:
    n,x=map(int,input().split())
    cnt=0
    if n==0 and x==0:
        break
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if i+j+k==x:
                    cnt+=1
    print(cnt)
# Buggy code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
count = 0
for a in range(1,n+1):
    for b in range(a+1,n+1):
        for c in range(b+1, n+1):
            if a + b + c == x:
                count += 1
print(count)

# Fixed code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    count = 0
    for a in range(1,n+1):
        for b in range(a+1,n+1):
            for c in range(b+1, n+1):
                if a + b + c == x:
                    count += 1
    print(count)
# Buggy code:
while True:
    n, x = map(int, input().split())

    if(n == 0 and x == 0):
        break

    ot = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                print(i, j, k)
                if i + j + k == x:
                    ot += 1

    print(ot)



# Fixed code:
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    ans=0
    for i in range(1,n+1):
        for j in range(1,i):
            for k in range(1,j):
                if x==i+j+k:
                    ans=ans+1
    print(ans)
# Buggy code:
while(True):
	a,b=list(map(int,input().split()))
	if a==0 and b==0:
		break
	c=0
	for i in range(a):
		for j in range(i):
			for k in range(j):
				if i+j+k==b:
					c+=1
	print(c)

# Fixed code:
while(True):
	a,b=list(map(int,input().split()))
	if a==0 and b==0:
		break
	c=0
	for i in range(1,a+1):
		for j in range(1,i):
			for k in range(1,j):
				if i+j+k==b:
					c+=1
	print(c)
# Buggy code:
x=1
y=1
list=[]
while x>0:
    if x ==0 and y == 0:
        break
    x,y = map(int,input().split())
    list.append([x,y])

for L in list:
    ans = 0
    for i in range(1,L[0]-1):
        for j in range(i+1,L[0]):
            for k in range(j+1,L[0]+1):
                if L[1]== i + j+ k:
                    ans += 1
                else:
                    pass
    print(ans)

# Fixed code:
x=1
y=1
list=[]
while x>0:
    if x ==0 and y == 0:
        break
    x,y = map(int,input().split())
    list.append([x,y])

list.remove([0,0])

for L in list:
    ans = 0
    for i in range(1,L[0]-1):
        for j in range(i+1,L[0]):
            for k in range(j+1,L[0]+1):
                if L[1]== i + j+ k:
                    ans += 1
                else:
                    pass
    print(ans)
# Buggy code:
while True :
    num = 0
    n,x = map(int,input().split())
    if(n==0 and x==0): break
    for i in range (1,n) :
        for j in range(1,i):
            s = x - j - i
            if(j<i and i<s):
                num += 1
    print(num)


# Fixed code:
while True :
    num = 0
    n,x = map(int,input().split())
    if(n==0 and x==0): break
    for i in range (1,n) :
        for j in range(1,i):
            s = x - j - i
            if(s<=n and j<i and i<s):
                num += 1
    print(num)
# Buggy code:
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        break
    l = [i+j+k for i in range(n) for j in range(n) for k in range(n)]
    print(l.count(x-3))

# Fixed code:
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        break
    l = [i+j+k for i in range(n-2) for j in range(i+1,n-1) for k in range(j+1,n)]
    print(l.count(x-3))
# Buggy code:
while True:
 n,x=map(int,input().split())
 if n==x==0: break
 
 count=0

 for i in range(n-2):
  for k in range(i+1,n-1):
   for j in range(k+1,n):
     if i+k+j==x :
       count = count +1


 print('count')
       

# Fixed code:
while 1:
    n, x = map(int, input().split())
    if n==0 and x==0: break
    count = 0
    for i in range(n, 2, -1):
        for j in range(i-1, 1, -1):
            for k in range(j-1, 0, -1):
                if i+j+k==x:
                    count+=1
    print(count)
# Buggy code:
(n, x) =  [int(i) for i in input().split()]
if n == x == 0:
    break
 
count = 0
for a in range(1, n+1):
    for b in range(a+1, n+1):
        for c in range(b+1, n+1):
            if (a + b + c) == x:
                count += 1
            elif (a + b + c) > x:
                break
print(count)

# Fixed code:
while True:
    (n, x) =  [int(i) for i in input().split()]
    if n == x == 0:
        break

    count = 0
    for a in range(1, n+1):
        for b in range(a+1, n+1):
            for c in range(b+1, n+1):
                if (a + b + c) == x:
                    count += 1
                elif (a + b + c) > x:
                    break
    print(count)