Problem:


How many ways?

  Write a program which identifies the number of combinations of three integers which satisfy the following conditions:

  
You should select three distinct integers from 1 to n.

  
A total sum of the three integers is x.

  For example, there are two combinations for n = 5 and x = 9.

1 + 3 + 5 = 9

2 + 3 + 4 = 9

Input

  The input consists of multiple datasets. For each dataset, two integers n and x are given in a line.

  The input ends with two zeros for n and x respectively. Your program should not process for these terminal symbols.

Constraints

  
3 ≤ n ≤ 100

  
0 ≤ x ≤ 300

Output

  For each dataset, print the number of combinations in a line.

Sample Input

5 9
0 0

Sample Output

2

Note

      解説      

	


Sample input:
5 9
0 0


Sample output:
2

Submission status: Runtime Error

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

    count = 0
    for a int 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)

Submission status: Runtime Error

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

    count = 0 
    for a int 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)

Submission status: Runtime Error

Solution code:
while True:
    n,x = map(int,raw_input().split())
    if n==0 and x==0:
        break
    ct = 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:
                   ct += 1
    print ct
~

Submission status: Runtime Error

Solution code:

n = int(input())

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

print(count)

Submission status: Runtime Error

Solution code:

n = input()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
for i in range(1,n-1):
    for j in range(i+1,n):
        for k in range(j+1,n+1):
            if i+j+k==x:ans+=1
print ans

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
for i in range(1,n-1):
    for j in range(i+1,n):
        for k in range(j+1,n+1):
            if i+j+k==x:ans+=1
print ans

Submission status: Runtime Error

Solution code:
while True:
    (n, x) = [int(i) for i in input().split()]
    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 x - (i + j + k) == 0:
                    count += 1
                if x - (i + j + k) < 0:
                    break
    print(count)

Submission status: Runtime Error

Solution code:
while True:
n = [int(i) for i in input().split()]
count = 0
for a in range(1,4):
    for b in range(a+1,5):
        for c in range(b+1, 6):
            if a + b + c == 9:
                count += 1
print(count)

Submission status: Runtime Error

Solution 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)
~

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = [int(i) for i in input().split()]
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 == 9:
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
(n, x) = [int(i) for i in input().split()]
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 n = x = 0:
                break
            elif a + b + c == 9:
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
n, x = [int(i) for i in input().split]
if n!=0 and x!=0:
  s = [(i,j,k) for i in range(n) for j in range(n) for k in range(n) if i!=j and j!=k]
  print (len(s))

Submission status: Runtime Error

Solution code:
# 12-Structured_Program_II-How_many_ways.py

# ????????????????????°
# 1 ?????? n ?????§?????°?????????????????????????????§???????????°?????????????????????????¨???? x ??¨??????
# ????????????????????°????±???????????????°?????????????????????????????????
# ????????°???1 ?????? 5 ?????§?????°???????????????????????§????????????????¨???? 9 ??¨???????????????????????????

# 1 + 3 + 5 = 9
# 2 + 3 + 4 = 9
# ??????????????????????????????

# Input
# ?????°??????????????????????????\?????¨???????????????????????????
# ???????????????????????§??????????????§??????????????? n???x ??? 1 ???????????????????????????

# n???x ?????¨?????? 0 ?????¨?????\?????????????????¨????????????
# n ??? 3 ??\??? 100?????\?????¨????????????

# Output
# ????????????????????????????????????????????????????????°????????????????????????????????????

# Sample Input
# 5 9
# 0 0
# Sample Output
# 2

result = []
n=[]
x=[]

while 1:
	temp = input().split() 
	if temp[0]=="0" and temp[1]=="0":
		break;
	else:
		n.append( int( temp[0] ))
		x.append( int( temp[1] ))

for i in range( len(n) ):
	count =0
	for n1 in range(1,n[i]+1-2):
		for n2 in range(n1+1, n[i]+1-1):
			for n3 in range(n2+1, n[i]+1):
				sum = n1+n2+n3
				if sum == x[i]:
					count+=1
	result.append(count)

for i in range( len(result)-1 ):
	print("{0} ".format(result[i]),end="")

print("{0}".format(result[i+1]))

Submission status: Runtime Error

Solution code:
# 12-Structured_Program_II-How_many_ways.py

# ????????????????????°
# 1 ?????? n ?????§?????°?????????????????????????????§???????????°?????????????????????????¨???? x ??¨??????
# ????????????????????°????±???????????????°?????????????????????????????????
# ????????°???1 ?????? 5 ?????§?????°???????????????????????§????????????????¨???? 9 ??¨???????????????????????????

# 1 + 3 + 5 = 9
# 2 + 3 + 4 = 9
# ??????????????????????????????

# Input
# ?????°??????????????????????????\?????¨???????????????????????????
# ???????????????????????§??????????????§??????????????? n???x ??? 1 ???????????????????????????

# n???x ?????¨?????? 0 ?????¨?????\?????????????????¨????????????
# n ??? 3 ??\??? 100?????\?????¨????????????

# Output
# ????????????????????????????????????????????????????????°????????????????????????????????????

# Sample Input
# 5 9
# 0 0
# Sample Output
# 2

result = []
n=[]
x=[]

while 1:
	temp = input().split() 
	if temp[0]=="0" and temp[1]=="0":
		break;
	else:
		n.append( int( temp[0] ))
		x.append( int( temp[1] ))

for i in range( len(n) ):
	count =0
	for n1 in range(1,n[i]+1-2):
		for n2 in range(n1+1, n[i]+1-1):
			for n3 in range(n2+1, n[i]+1):
				sum = n1+n2+n3
				if sum == x[i]:
					count+=1
	result.append(count)

for i in range( len(result)-1 ):
	print("{0} ".format(result[i]), end="")

print(result[i+1])

Submission status: Runtime Error

Solution code:
# 12-Structured_Program_II-How_many_ways.py

# ????????????????????°
# 1 ?????? n ?????§?????°?????????????????????????????§???????????°?????????????????????????¨???? x ??¨??????
# ????????????????????°????±???????????????°?????????????????????????????????
# ????????°???1 ?????? 5 ?????§?????°???????????????????????§????????????????¨???? 9 ??¨???????????????????????????

# 1 + 3 + 5 = 9
# 2 + 3 + 4 = 9
# ??????????????????????????????

# Input
# ?????°??????????????????????????\?????¨???????????????????????????
# ???????????????????????§??????????????§??????????????? n???x ??? 1 ???????????????????????????

# n???x ?????¨?????? 0 ?????¨?????\?????????????????¨????????????
# n ??? 3 ??\??? 100?????\?????¨????????????

# Output
# ????????????????????????????????????????????????????????°????????????????????????????????????

# Sample Input
# 5 9
# 0 0
# Sample Output
# 2

import numpy as np

result = []
# n=[]
# x=[]
n = np.zeros(10000000, dtype=int)
x = np.zeros(10000000, dtype=int)
j=0

while 1:
	temp = input().split() 
	if temp[0]=="0" and temp[1]=="0":
		break;
	else:
		# n.append( int( temp[0] ))
		# x.append( int( temp[1] ))
		n[j]=int( temp[0] )
		x[j]=int( temp[1] )
		j+=1

for i in range( len(n) ):
	count =0
	for n1 in range(1,n[i]+1-2):
		for n2 in range(n1+1, n[i]+1-1):
			for n3 in range(n2+1, n[i]+1):
				sum = n1+n2+n3
				if sum == x[i]:
					count+=1
	result.append(count)

# for i in range( len(result)-1 ):
for i in range( j-1 ):
	print("{0} ".format(result[i]), end="")

print(result[i+1])

Submission status: Runtime Error

Solution code:
# 13-Structured_Program_II-Spreadsheet.py

# ??¨?¨????
# ??¨?¨??????????????°???????????????°???????????????????????????
# ??¨????????°r??¨?????°c???r ?? c ???????´????????????¨?????????????????§???
# ????????¨??????????¨?????????\????????°????????¨???????????????????????°?????????????????????????????????

# Input
# ???????????????r??¨c????????????????????§?????????????????????
# ?¶????r??????????????????c????????´??°????????????????????§?????????????????????

# Output
# (r+1) ?? (c+1) ?????°????????¨???????????????????????????
# ???????????£???????????´??°????????????????????§????????£??????????????????????????????????????¨??????????????????????¨?????????????????????????????????¨??????????????????????¨?????????????????????????????????¨??¨??????????¨????????????\??????????????????

# Constraints
# 1 ??? r, c ??? 100
# 0 ??? ????´? ??? 100
# Sample Input
# 4 5
# 1 1 3 4 5
# 2 2 2 4 5
# 3 3 0 1 1
# 2 3 4 4 6
# Sample Output
# 1 1 3 4 5 14
# 2 2 2 4 5 15
# 3 3 0 1 1 8
# 2 3 4 4 6 19
# 8 9 9 13 17 56

from numpy import * 
# import numpy as np

# r,c = map( int,input().split() )

# data = np.zeros((r,c))

# for i in range(r):
# 	data[i] = np.array( input().split() )

# data=data.astype("int")
# print("data",data)

# for i in range( r ):
# 	for j in range(c):
# 		print("{0} ".format(data[i][j]), end="")
# 	print( np.sum(data[i]) )

# for j in range(c):
# 	print("{0} ".format( np.sum(data, axis=0)[j] ), end="" )

# print( np.sum(data) )

Submission status: Runtime Error

Solution code:
# 13-Structured_Program_II-Spreadsheet.py

# ??¨?¨????
# ??¨?¨??????????????°???????????????°???????????????????????????
# ??¨????????°r??¨?????°c???r ?? c ???????´????????????¨?????????????????§???
# ????????¨??????????¨?????????\????????°????????¨???????????????????????°?????????????????????????????????

# Input
# ???????????????r??¨c????????????????????§?????????????????????
# ?¶????r??????????????????c????????´??°????????????????????§?????????????????????

# Output
# (r+1) ?? (c+1) ?????°????????¨???????????????????????????
# ???????????£???????????´??°????????????????????§????????£??????????????????????????????????????¨??????????????????????¨?????????????????????????????????¨??????????????????????¨?????????????????????????????????¨??¨??????????¨????????????\??????????????????

# Constraints
# 1 ??? r, c ??? 100
# 0 ??? ????´? ??? 100
# Sample Input
# 4 5
# 1 1 3 4 5
# 2 2 2 4 5
# 3 3 0 1 1
# 2 3 4 4 6
# Sample Output
# 1 1 3 4 5 14
# 2 2 2 4 5 15
# 3 3 0 1 1 8
# 2 3 4 4 6 19
# 8 9 9 13 17 56


r,c = map( int,input().split() )

data = []
csum = [0]*c

for i in range(r):
	data.append(  list(map( int,input().split() ))  )

# print(data)

for i in range( r ):
	for j in range(c):
		print("{0} ".format(data[i][j]), end="")
		csum[j] +=data[i][j]
	print( sum(data[i]) )

for j in range(c):
	print("{0} ".format( csum[j] ), end="" )

print( sum(csum) )



# ??? Aizu??§numpy ??????????????£??????
#---------------------------------------------------------------
# import numpy as np

# r,c = map( int,input().split() )

# data = np.zeros((r,c))

# for i in range(r):
# 	data[i] = np.array( input().split() )

# data=data.astype("int")
# print("data",data)

# for i in range( r ):
# 	for j in range(c):
# 		print("{0} ".format(data[i][j]), end="")
# 	print( np.sum(data[i]) )

# for j in range(c):
# 	print("{0} ".format( np.sum(data, axis=0)[j] ), end="" )

# print( np.sum(data) )
#---------------------------------------------------------------

Submission status: Runtime Error

Solution code:
# 13-Structured_Program_II-Spreadsheet.py

# ??¨?¨????
# ??¨?¨??????????????°???????????????°???????????????????????????
# ??¨????????°r??¨?????°c???r ?? c ???????´????????????¨?????????????????§???
# ????????¨??????????¨?????????\????????°????????¨???????????????????????°?????????????????????????????????

# Input
# ???????????????r??¨c????????????????????§?????????????????????
# ?¶????r??????????????????c????????´??°????????????????????§?????????????????????

# Output
# (r+1) ?? (c+1) ?????°????????¨???????????????????????????
# ???????????£???????????´??°????????????????????§????????£??????????????????????????????????????¨??????????????????????¨?????????????????????????????????¨??????????????????????¨?????????????????????????????????¨??¨??????????¨????????????\??????????????????

# Constraints
# 1 ??? r, c ??? 100
# 0 ??? ????´? ??? 100
# Sample Input
# 4 5
# 1 1 3 4 5
# 2 2 2 4 5
# 3 3 0 1 1
# 2 3 4 4 6
# Sample Output
# 1 1 3 4 5 14
# 2 2 2 4 5 15
# 3 3 0 1 1 8
# 2 3 4 4 6 19
# 8 9 9 13 17 56

# ??? Aizu??§numpy ??????????????£??????
#---------------------------------------------------------------
# import numpy as np

# r,c = map( int,input().split() )

# data = np.zeros((r,c))

# for i in range(r):
# 	data[i] = np.array( input().split() )

# data=data.astype("int")
# print("data",data)

# for i in range( r ):
# 	for j in range(c):
# 		print("{0} ".format(data[i][j]), end="")
# 	print( np.sum(data[i]) )

# for j in range(c):
# 	print("{0} ".format( np.sum(data, axis=0)[j] ), end="" )

# print( np.sum(data) )
#---------------------------------------------------------------


r,c = map( int,input().split() )

data = []
csum = [0]*c

for i in range(r):
	data.append(  list(map( int,input().split() ))  )

# print(data)

# for i in range( r ):
# 	for j in range(c):
# 		print("{0} ".format(data[i][j]), end="")
# 		csum[j] +=data[i][j]
# 	print( sum(data[i]) )

# for j in range(c):
# 	print("{0} ".format( csum[j] ), end="" )

# print( sum(csum) )

Submission status: Runtime Error

Solution code:
while 1:
    n,x=map(int,input().split())
    if n == 0 and x == 0: break
    print(len([1 for a in range(1,n+1), for b in range(a+1,n+1), for c in range(b+1,n+1), a + b + c == x]))

Submission status: Runtime Error

Solution code:
while True:
	k=map(int,raw_input().split(" "))
	ct=0
	a=0
	b=0
	c=0	
	max=k[0]
	sum=k[1]
	a=max+1
	
	while True:
		a-=1
		b=a-1
		c=sum-a-b
		if not a>b>c:
			print ct
			break
		while a>b>c:
			if a>b>c>0:
				ct+=1
			b-=1
			c+=1

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, x = [int(i) i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(n):
    for b in range(a):
        for c in range(b):
             a + b + c == x
             return

Submission status: Runtime Error

Solution code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    print([1 if sum(i) == x else 0 for i in input.combinations(range(1, n + 1), 3)])

Submission status: Runtime Error

Solution code:
n, x = [int(i) i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(n):
    for b in range(a):
        for c in range(b):
             a + b + c == x
             return
print()

Submission status: Runtime Error

Solution code:
n, x = [int(i) i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(n+1):
    for b in range(a):
        for c in range(b):
             a + b + c == x
             return
print()

Submission status: Runtime Error

Solution code:
n, x = [int(i) i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(n+1):
    for b in range(a+1):
        for c in range(b+1):
             a + b + c == x
             return
print()

Submission status: Runtime Error

Solution code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    print([1 if sum(n, x) == x else 0 for i in input.combinations(range(1, n + 1), 3)])

Submission status: Runtime Error

Solution code:
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    else:3 <= n < 100
    print([1 if sum(n, x) == x else 0 for i in input.combinations(range(1, n + 1), 3)])

Submission status: Runtime Error

Solution code:
n, x = [int(i) i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(n+1):
    for b in range(a+1):
        for c in range(b+1):
             if a == b == c or a == b or a == c or b == c:
             None
             elif a + b + c == x:
             return
             else:
             None
print()

Submission status: Runtime Error

Solution code:
n, x = [int(i) i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(n+1):
    for b in range(a+1):
        for c in range(b+1):
             if a == b == c or a == b or a == c or b == c:
             None
             if a + b + c == x:
             return
             else:
             None
print()

Submission status: Runtime Error

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

3 <= n <= 100

if n == x == 0:
    break

for a in range(n+1):
    for b in range(a+1):
        for c in range(b+1):
             if a == b == c or a == b or a == c or b == c:
             None
             if a + b + c == x:
             return
             else:
             None
print()

Submission status: Runtime Error

Solution code:
while True:
    (n, x) = [int(i) for i in input().split()]
    n = 3 < 100
    if n == x == 0:
        break
    print([1 if sum(n, x) == x else 0 for i in input.combinations(range(1, n + 1), 3)])

Submission status: Runtime Error

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

3 <= n <= 100

if n == x == 0:
    break

for a in range(1, n+1):
    for b in range(1, a+1):
        for c in range(1, b+1):
             if a == b == c or a == b or a == c or b == c:
             None
             if a + b + c == x:
             return
             else:
             None
print()

Submission status: Runtime Error

Solution code:
while True:
    import itertools
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    print([1 if sum(n, x) == x else 0 for i in itertools.combinations(range(1, n + 1), 3)])

Submission status: Runtime Error

Solution code:
while True:
n = [int(i) for i in input().split()]

if n == x == 0:
    break

3 <= n <= 100

total = n < n
total2 = total < n
total3 = total2 < n

for i in range(total):
    for a in range(total2):
        for c in range(total3):
            
    if i + a + c:
        return 'x'
    else:
        print('None')

print()

Submission status: Runtime Error

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

3 <= n <= 100

if n == x == 0:
    break

for a in range(1, n+1):
    for b in range(1, a):
        for c in range(1, b-1):
             if a == b == c or a == b or a == c or b == c:
             None
             if a + b + c == x:
             return
             else:
             None
print()

Submission status: Runtime Error

Solution code:
import itertools
while True:
    (n, x) = [int(i) for i in input().split()]
    if n == x == 0:
        break
    print([1 if sum() == x else 0 for i in itertools.combinations(range(1, n + 1), 3)])

Submission status: Runtime Error

Solution code:
while True:
n = [int(i) for i in input().split()]

if n == x == 0:
    break

3 <= n <= 100

total = n < n
total2 = 'total' < n
total3 = 'total2' < n

for i in range('total'):
    for a in range('total2'):
        for c in range('total3'):
            
    if i + a + c:
        return 'x'
    else:
        print('None')

print()

Submission status: Runtime Error

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

3 <= n <= 100

if n == x == 0:
    break

for a in range(1, n+1):
    for b in range(1, a):
        for c in range(1, b-1):
             if a == b == c or a == b or a == c or b == c:
               None
             if a + b + c == x:
               return
             else:
               None
print()

Submission status: Runtime Error

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


if n == x == 0:
    break
    
count = 0
for s in range(1, n // 2 + 1):
    for e in range(n, n // 2 +1, - 1):
        m = x - s - e
        if m != s and m != e and m <= n and m > s:
            count += 1
            
    print(count)

Submission status: Runtime Error

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


if n == x == 0:
    break
    
count = 0
for s in range(1, n // 2 + 1):
    for e in range(n, n // 2 +1, - 1):
        m = x - s - e
        if m != s and m != e and m <= n and m > s and m < e:
            count += 1
            
    print(count)

Submission status: Runtime Error

Solution 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 // 2 + 1):
        for e in range(n, n // 2, -1):
            m = x - s - e
            if m != s and m != e and m > s and m < e and m <= n:
                count += 1
                
    print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m, l = [int(i) for i in input().split()]

A = [input(range(n))]
B = [input(range(m))]
C = [[0] * 1 for n in range(n)]


for ni in range(n):
    A.append([int(i) for i in input().split()])
    C[n][m] = sum([A[n][l] * B[l][m] for m in range(l)])


for mi in range(m):
    B.append([int(i) for i in input().split()])

print(" ".join([str(v) for v in C]))

Submission status: Runtime Error

Solution code:
while True:
    a = input().split(' ')
    b = 0
    s = []
    c = [number+1 for number in range(int(a[0]))]
    for i in c:
        for e in c:
            for f in c:
                if i + e + f == int(a[1]) and not (i*e*f in s):
                    if not (i==e or e==f or f==i):
                        print(i,e,f)
                        b += 1
    print(b)

Submission status: Runtime Error

Solution code:
while True:
    a = input().split(' ')
    b = 0
    s = []
    c = [number+1 for number in range(int(a[0]))]
    for i in c:
        for e in c:
            for f in c:
                if i + e + f == int(a[1]) and not (i*e*f in s):
                    if not (i==e or e==f or f==i):
                        s.append(i*e*f)
                        b += 1
    print(b)

Submission status: Runtime Error

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

import itertools:

while True:
 n, x = map(int, input().split())
 if n==0 and x==0: break
 count = 0
 for a, b, c in itertools.permutations(range(n), 3):
  if a+b+c==x: count += 1
 print count

Submission status: Runtime Error

Solution code:
while 1:
 n, x = map(int, input().split())
 if n == 0 and x == 0:
  break
 counter = 0
 for a in range(3, n+1):
  for b in range(2, n-1):
   for c in range(1, n-2):
    if a > b > c and a+b+c == x
     counter += 1
 print(counter)

Submission status: Runtime Error

Solution code:
while 1:
 n, x = map(int, input().split())
 if n == 0 and x == 0:
  break
 counter = 0
 for a in range(3, n+1):
  for b in range(2, n-1):
   if b > a:
    break
   for c in range(1, n-2):
    if c > b:
     break
    if a+b+c == x
     counter += 1
 print(counter)

Submission status: Runtime Error

Solution code:
while 1:
 n, x = map(int, input().split())
 counter = 0
 if n == 0 and x == 0:
  break
 # y + (y-1) + (y-2) = x 
 y = (x+3) // 3
 for a in range(y, n+1):
  for b in range(2, a):
  if (x-a-b) > 0 and (x-a-b) < b:
   counter += 1
 print(counter)

Submission status: Runtime Error

Solution code:
r,c = map(int,raw_input().split())
matrix = [0 for i in range(r)]
for i in range(r):
    matrix[i] = map(int,raw_input().split())
    a = 0

    for j in range(c):
        a += matrix[i][j]
    matrix[i].append(a)
    for j in range(c+ 1):
        print matrix[i][j],

Submission status: Runtime Error

Solution code:
r,c=list(map(int,input().split()))
l=[]
for i in range(r):
	a=list(map(int,input().split()))
	a.append(sum(a))
	l.append(a)
b=[]
for i in range(c+1):
	c=0
	for j in range(r):
		c+=l[j][i]
	b.append(c)
l.append(b)

for i in l:
	print(" ".join(map(str,i)))

Submission status: Runtime Error

Solution code:
r,c=list(map(int,input().split()))
l=[]
for i in range(r):
	a=list(map(int,input().split()))
	a.append(sum(a))
	l.append(a)
b=[]
for i in range(c+1):
	c=0
	for j in range(r):
		c+=l[j][i]
	b.append(c)
l.append(b)

for i in l:
	print(" ".join(list(map(str,i))))

Submission status: Runtime Error

Solution code:
s = []
while True:
    n, x = map(int, input().strip().split())
    if n == x == 0:
        break
    c = 0
    for i in range(1,x/3):
        c += max(0, (i+1-x)//2+n)
    s.append(str(c))
print('\n'.join(s))

Submission status: Runtime Error

Solution code:
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

while True:
	[m, f, r] = list(map(int, fin.readline().split()))

	if m == -1 and f == -1 and r == -1:
		break

	sum_mf = m + f
	if m == -1 or f == -1:
		print("F")
	elif sum_mf >= 80:
		print("A")
	elif sum_mf >= 65:
		print("B")
	elif sum_mf >= 50:
		print("C")
	elif sum_mf >= 30:
		if r >= 50:
			print("C")
		else:
			print("D")
	else:
		print("F")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
while(1):
	n, x = map(int, input().split())
	t = 0
	if n == x == 0:
		break
	for i in range(1, n+1):
		for j in range(i+1, n+1):
			for k in range(k+1, n+1):
				if i+j+k == x:
					if i != j and j != k and k != i:
						t += 1
						print(i, j, k)
	print(t)

Submission status: Runtime Error

Solution code:
while(1):
	n, x = map(int, input().split())
	t = 0
	if n == x == 0:
		break
	for i in range(1, n+1):
		for j in range(i+1, n+1):
			for k in range(k+1, n+1):
				if i+j+k == x:
					if i != j and j != k and k != i:
						t += 1
						#print(i, j, k)
	print(t)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Here your code !

def func():
    data=[]
    while(True):
        try:
            line=[ int(item) for item in input().rstrip().split(" ") ]
            if(line == [0,0]):
                break
            data.append(line)
        except EOFError:
            break
        except:
            return inputError()
    
    left=1
    numbers=3
    [print(len(sumcombination(left,line[0],numbers,line[1]))) for line in data]

def sumcombination(left,right,numbers,total):
    result=[]
    if(numbers==1):
        if( (left <= total) and (right >= total) ):
            result=[total]
        return(result)
    
    for i in range(left,right+1):
        if( numbers == 2):
            if(i >= total-i):
                break
            elif( (i != total-i) and (left <= total-i) and (right >= total-i) ):
                result.append([i,total-i])
        elif( ( len( range(i,right+1) ) < numbers ) or ( sum( range(i+1,i+numbers) ) > total-i ) ):
            break
        elif( sum( range(right-numbers+2,right+1) ) < total-i ):
            continue
        else:
            sub = sumcombination(i+1,right,numbers-1,total-i)
            if(len(sub)>0):
                [items.insert(0,i) for items in sub]
                result.extend(sub)

    return(result)

def inputError():
    print("input error")
    return -1

func()

Submission status: Runtime Error

Solution code:
while 1:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    a =[]
    for i in range(1, n + 1):
        for j in range(2, n + 1):
            for k in range(3, n + 1):
                if i + j + k == x:
                    if i != j:
                        if j != k:
                            if i != k:
                                a.append([i, j, k])
    b = []
    for i in a:
        b.append(sorted(i))

    c = []
    c = sorted(b)

    cnt = 1
    t = c[0]
    for i in c:
        if t != i:
            cnt += 1
            t = i
    print(cnt)