Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = 0
while not (n == 0 and m == 0):
 for i in range(N):
  for j in range(N):
   for k in range(N):
    if ( i==j or i==k or j==k):
    elif(i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())

Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(N):
  for j in range(N):
   for k in range(N):
    if ( i==j or i==k or j==k):
    elif(i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())

Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(N):
  for j in range(N):
   for k in range(N):
    if ( i==j or i==k or j==k):
    elif (i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(N):
  for j in range(N):
   for k in range(N):
    if ( i==j or i==k or j==k): pass
    elif (i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(N):
  for j in range(N):
   k = M - i - j
   if ( i==j or i==k or j==k): pass
   elif (i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(1, N+1):
   k = M - i - j
   if ( i==j or i==k or j==k): pass
   elif (i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i, N+1):
   k = M - i - j
   if ( i==j or i==k or j==k): pass
   elif (i + j + k == M): ans += 1
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
while not (N == 0 and M == 0):
 for i in range(1, N+1):
  for j in range(i+1, N+1):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 print(ans)
 ans = 0
 N,M = map(int, input().split())