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: Wrong Answer

Solution code:
while True:
    n, x = input().split()
    n = int(n)
    x = int(x)
    if n == x:
        break


    count = 0
    for i in range(1,n-1):
        for j in range(i+1, n):
            """
            # ?????????????????¨???????????????????????????????????§k???x-(i+j)??§?¨?????????????
            # ?????????k????????????(j+1???n)?????????????????????OK???
            for k in range(j+1, n+1):
                if (i+j+k) == x:
                    #print(i, j, k)
                    count += 1
            """
            k = x - (i+j)
            if k < j+1: # k????°???????????????????????????´??????j??????????????§?¢?????????????????????????????????§break??????
                break
            if k <= n:
                count += 1
    print(count)

Submission status: Wrong Answer

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

    s = 1
    m = s+1
    while True:
        for e in range(m+1,n+1):
            result = s+m+e
            if result == x:
                a += 1
        m += 1
        if m == n-1:
            s += 1
            m = s+1
        if s+m+e == e*3-3:
            break
    print(a)

Submission status: Wrong Answer

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 += (x -3*i -1)//2 - max(0,(x -2*i -1 -n))
    s.append(str(c))
print('\n'.join(s))

Submission status: Wrong Answer

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,(x -3*i -1)//2) - max(0,(x -2*i -1 -n))
    s.append(str(c))
print('\n'.join(s))

Submission status: Wrong Answer

Solution code:
'''
ITP-1_7-B
 ????????????????????°
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
????????????????????????????????????????????????????????°????????????????????????????????????
'''
n, x = map(int, input().split())

while True:

    # EndCheck
    if n == x == 0:
        break

    ansCnt = 0
    for cnt1 in range(1,n+1):
        for cnt2 in range(cnt1+1,n+1):
            for cnt3 in range(cnt2+1,n+1):
                if cnt1 + cnt2 + cnt3 == x:
                    ansCnt += 1
                    break
    print(ansCnt)
    break

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3

import sys


def subset_sum(numbers, target, partial=[]):
    s = sum(partial)

    if s == target:
        if len(partial) != 3:
            return None
        print(*partial)

    if s >= target:
        return None

    for i in range(len(numbers)):
        n = numbers[i]
        remaining = numbers[i+1:]
        if len(partial) == 3:
            break
        subset_sum(remaining, target, partial + [n])


def program_runner():
    while True:
        lst = [int(num) for num in sys.stdin.readline().split()]
        if lst[0] == lst[1] == 0:
            break
        num_list = [num for num in range(1, lst[0]+1)]
        subset_sum(num_list, lst[1])


def main():
    program_runner()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3

import sys


def subset_sum(numbers, target, partial=[]):
    s = sum(partial)
    count = 0

    if s == target:
        if len(partial) != 3:
            return None
        print(*partial)
        print('count:', count)
        count += 1

    if s >= target:
        return None

    for i in range(len(numbers)):
        n = numbers[i]
        remaining = numbers[i+1:]
        if len(partial) == 3:
            break
        subset_sum(remaining, target, partial + [n])


def program_runner():
    while True:
        lst = [int(num) for num in sys.stdin.readline().split()]
        if lst[0] == lst[1] == 0:
            break
        num_list = [num for num in range(1, lst[0]+1)]
        subset_sum(num_list, lst[1])


def main():
    print(program_runner())


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:



while True:
	N, x = map(int,input().split())
	if N == 0 and x == 0:
		break
	
	ctr = 0
	
	for i in range(1, N+1):
		for j in range(i+1, N+1):
			k = x - i -j
			if k <= N and i != k and j != k:
				ctr += 1

Submission status: Wrong Answer

Solution code:
cnt = 0
while 1:
    n,x = map(int,input().split())
    if n == 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)

Submission status: Wrong Answer

Solution code:




while True:
	N, x = map(int,input().split())
	if N == 0 and x == 0:
		break
	
	n = x // 3
	ctr = 0
	
	for i in range(1, n):
		for j in range(i+1, n+1):
			k = x - i -j
			if k <= N and i != k and j != k:
				ctr += 1
				print("{} {} {}".format(i, j, k))
	
	print(ctr)

Submission status: Wrong Answer

Solution code:





while True:
	N, x = map(int,input().split())
	if N == 0 and x == 0:
		break
	
	n = x // 3
	ctr = 0
	
	for i in range(1, n):
		for j in range(i+1, n+1):
			k = x - i -j
			if k <= N and i != k and j != k:
				ctr += 1
				#print("{} {} {}".format(i, j, k))
	
	print(ctr)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools

n, x = map(int, input().split())
i = 0
l = range(1, n+1)
for elem in itertools.combinations(l, 3):
    if sum(elem) == x:
        i += 1
print(str(i))

Submission status: Wrong Answer

Solution code:
n, x = [int(temp) for temp in input().split()]
cen  = x // 3
for temp in range(1,cen):
    pass
print(temp)

Submission status: Wrong Answer

Solution code:
array = []
num = 0
while True :
    n = input()
    if n == "0 0":
        break
    array.append(n.split())
for i in range(len(array)):
    n = int(array[i][0])
    x = int(array[i][1])
    yeah = x
    for i2 in range(n):
        yeah -=n-i2
        yeah -=n-(i2+1)
        if yeah > 0 and yeah <= n and n-(i2+1) > 0:
            num +=1
        yeah = x
print(num)

Submission status: Wrong Answer

Solution code:
inp = []
count = -1
while 1:
    count += 1
    inp.append(input())
    if inp[count] == "0 0":
        break
array = [[i2 for i2 in inp[i].split()]for i in range(len(inp)-1)]
for i in range(len(array)):
    count = 0
    n = int(array[i][0])
    x = int(array[i][1])
    for i2 in range(1,int(n/2)+1):
        for i3 in range(2,n):
            if i2 == i3:
                continue
            num = x - i2 - i3
            if num <= n and num > i3:
                count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
n,x = map(int,input().split())
count=0

for a in range(n):
    for b in range(n):
        for c in range(n):
            if a<b<c and a+b+c==x-3:
                count+=1

print(count)

Submission status: Wrong Answer

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

import sys
import os


def input_to_list():
    return list(map(int, input().split()))

while True:
    lst = input_to_list()
    if lst[0] == lst[1] == 0:
        break
    else:
        n = lst[0]
        x = lst[1]
        c = 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:
                        c += 1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
while(1):
    n, x = map(int, input().split())

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

    count = 0
    for i in range(1, n-1):
        if i*3 > x:
            break
        for j in range(i, n):
            if i+2*j < x:
                break
            if x-i-j <= n:
                count += 1

    print(count)

Submission status: Wrong Answer

Solution code:
while(1):
    n, x = map(int, input().split())

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

    count = 0
    for i in range(1, n-1):
        if i*3 > x:
            break
        for j in range(i+1, n):
            if i+2*j < x:
                break
            if x-i-j <= n:
                count += 1

    print(count)

Submission status: Wrong Answer

Solution code:
while True:
    n,x = map(int,raw_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):
            for k in range(i+2,n):
                if i+j+k == x:
                    count += 1
    print('{0}'.format(count))

Submission status: Wrong Answer

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:
                            a.append([i, j, k])
    
    for i in range(len(a)):
        for j in range(2):
            if a[i][j] > a[i][j+1]:
                t = a[i][j]
                a[i][j] = a[i][j+1]
                a[i][j+1] = t
                
    t = 0
    c = 0
    for i in a:
        if t != i:
            t = i
            c += 1
    print(c)

Submission status: Wrong Answer

Solution code:
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    sum=0
    for i in range(x//3,n+1):
        if (x-i)%2==0:
            
            sum+=((x-i)/2)-1
        else:
            
            sum+=(x-i-1)/2
    print(sum)

Submission status: Wrong Answer

Solution code:
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    sum=0
    for i in range(x//3+1,n):
        if (x-i)%2==0:
            sum+=(x-i)/2-1
        elif(x-i)%2==1:
            sum+=(x-i-1)/2
        elif 2*i<x:
            sum-=1
    print(int(sum))

Submission status: Wrong Answer

Solution code:
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    sum=0
    for i in range(x//3+1,n+1):
        print(i)
        if (x-i)%2==0:
            sum+=(x-i)/2-1
        elif(x-i)%2==1:
            sum+=(x-i-1)/2
        if 2*i<x:
            sum-=1
    print(int(sum))

Submission status: Wrong Answer

Solution code:
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    sum=0
    for i in range(x//3+1,n+1):
        if (x-i)%2==0:
            sum+=(x-i)/2-1
        elif(x-i)%2==1:
            sum+=(x-i-1)/2
        if 2*i<x:
            sum-=1
    print(int(sum))

Submission status: Wrong Answer

Solution code:
while True:
    s = input().split(" ")
    n = int(s[0])
    x = int(s[1])
    if n == 0 and x == 0:
        break
    cnt = 0
    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:
                    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split(" "))

num = 0
for i in range(1, n-1):
    for j in range(i+1, n):
        c = x - i - j
        if c<=n and c > j:
            num += 1
print(num)

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split(" "))

num = 0
for i in range(1, n-1):
    for j in range(i+1, n):
        c = x - i - j
        if c<=n and c > j:
            num += 1
if num != 0:
    print(num)

Submission status: Wrong Answer

Solution code:
n,x = map(int,input().split())
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
m=0

while True:
    n, x = list(map(int,input().split()))
    
    if n==0 and x==0:
        break
    else:
        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:
                        m+=1

print(m)

Submission status: Wrong Answer

Solution code:
m=0

while True:
    n, x = list(map(int,input().split()))
    
    if n==0 and x==0:
        break
    else:
        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:
                        m+=1

print(m)

Submission status: Wrong Answer

Solution code:
while True:
    n,x = list(map(int, input().split()))
    if n == x == 0:
        break

    num_set = []
    for i in range(1,n+1):
        for j in range(1,n+1):
            for k in range(1,n+1):
                if i + j + k == x:
                    li = [i,j,k]
                    sorted_list = sorted(li)
                    if not sorted_list in num_set:
                        num_set.append(sorted_list)

    print(len(num_set))

Submission status: Wrong Answer

Solution code:
while True:
    n,x = list(map(int, input().split()))
    if n == x == 0:
        break

    num_set = []
    for i in range(1,(n+1)//3):
        for j in range(1,(n+1)//2):
            for k in range(1,n+1):
                if i < j < k and i+j+k ==x:
                    li = [i,j,k]
                    if not li in num_set:
                        num_set.append(li)
    print(len(num_set))

Submission status: Wrong Answer

Solution code:
import itertools
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    a=[i for i in range(1,n+1)]
    b=[]
    for i in range(1,n+1):
        b+=list(itertools.combinations(a,i))
    c=[]
    count=0
    for i in b:
        c=sum(i)
        if c==x:
            count+=1
    print(count)

Submission status: Wrong Answer

Solution code:
while True:
    n, x = map(int,input().split())
    count=0
    if n == x == 0:
        break
    else:
        for s in range(1,n+1):
            num1 = s

            for j in (1,n+1):
                if num1 == j:
                    break
                else:
                    num2 = j
                    if x < num1+num2:
                        break

                for k in (1,n+1):
                    if num1 == k:
                        break
                    elif num2 == k:
                        break
                    elif num1+num2+k == x:
                        count+=1
                    else:
                        pass
    print(count)

Submission status: Wrong Answer

Solution code:
import itertools
n,x = list(map(int,input().split()))
li = list(itertools.combinations([i+1 for i in range(n)],3))
ret = 0
for i in range(len(li)):
    if sum(li[i]) == x: ret+= 1
print(ret)

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split())
while 1:
    if n == 0 and x == 0:
        break
    s = set()
    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\
                and i != j != k:
                    s_e = sorted(str(i) + str(j) + str(k))
                    s_e = "".join(s_e)
                    s.add(s_e)
    print(len(s))
    n, x = map(int, input().split())

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split())
while 1:
    if n == 0 and x == 0:
        break
    s = []
    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\
                and i != j != k:
                    sort = sorted([i, j, k])
                    if sort not in s:
                        s.append(sort)
    print(len(s))
    n, x = map(int, input().split())

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split())
cnt = 0
sort_list = []
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            if i + j + k == x\
            and i != j != k\
            and i != j and i != k and j != k:
                sort = sorted([i, j, k])
                if sort not in sort_list:
                    sort_list.append(sort)
                    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
ret = []
while True:
   n, x = map(int, raw_input().split())
   num_arr = [i for i in range(1, n+1)]
   if (n, x) == (0, 0): 
       break   

   for i in range(len(num_arr)):
       for j in range(i + 1, len(num_arr)):
           for k in range(j + 1, len(num_arr)):
               work = num_arr[i] + num_arr[j] + num_arr[k]
               if x == work:
                   ret += [str(work)]
print len(ret)

Submission status: Wrong Answer

Solution code:
s = []
while True:
    cnt = 0
    n, x = list(map(int, input().split()))
    if n == 0 and x == 0:
        break
    else:
        for i in range(1, n + 1):
            for j in range(1, n + 1):
                if i == j:
                    continue
                else:
                    for k in range(1, n + 1):
                        if i == k or j == k:
                            continue
                        else:
                            if i + j + k == x:
                                cnt += 1
        s.append(cnt)
for l in range(len(s)):
    print(s[l])

Submission status: Wrong Answer

Solution code:
ret = []
while True:
   n, x = map(int, raw_input().split())
   num_arr = [i for i in range(1, n+1)]
   if (n, x) == (0, 0):
       break
   
   cnt = 0
   for i in range(n, 0, -1):
       if x - i  <= 0:
           break
       #print "i : %d" % i
       for j in range(i -1, 0, -1):
           if x - i - j <= 0:
               continue
           if 0 <= x - i - j < j:
               cnt += 1
               #print "%d %d" % (i, j)
print cnt

Submission status: Wrong Answer

Solution code:
def counter(n, x):
    count = 0
    for i in range(n-2):
        for j in range(1, n-1):
            for k in range(2, n):
                if i + j + k == x:
                    count += 1
    return count

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

Submission status: Wrong Answer

Solution code:
def counter(n, x):
    count = 0
    for i in range(n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                if i + j + k == x:
                    count += 1
    return count

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

Submission status: Wrong Answer

Solution code:
def counter(n, x):
    count = 0
    for i in range(n-1):
        for j in range(i+1, n):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    count += 1
    return count

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

Submission status: Wrong Answer

Solution code:
def counter(n, x):
    count = 0
    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:
                    count += 1
                    print("{0} {1} {2}".format(i, j ,k))
    return count

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

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split())

while n != 0 and x != 0:
	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)
	n, x = map(int, input().split())

Submission status: Wrong Answer

Solution code:
I = input().split()
n = int(I[0])
x = int(I[1])
cnt = 0

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:
                cnt += 1
                continue

print(cnt)

Submission status: Wrong Answer

Solution code:
n = 0
x = 0
cnt = 0

while True:
    
    I = input().split()
    n = int(I[0])
    x = int(I[1])
    if n == 0 and x == 0:
        break
    
    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:
                    cnt += 1
                    continue
    print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools
n,x=map(int,input().split())
s=list(range(1,n+1))
l=list(itertools.combinations(s,3))
c=0
for i in l:
    if sum(i) == x:
         c+=1
print(c)

Submission status: Wrong Answer

Solution code:
while 1:
    n, x = map(int,raw_input().split())
    if n == x == 0:
        break
    sum = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            k = x - i - j
            if k > j & k <= n:
                sum += 1
    print sum

Submission status: Wrong Answer

Solution code:
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
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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 ( i==j or i==k or j==k): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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 or k > M-3): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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 or k > N-3): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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 or k > 0): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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 or (k > 0 and k < N)): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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 or k < j or k > N): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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):
   k = M - i - j
   if ( i==j or i==k or j==k or k < j or k > N): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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):
   k = M - i - j
   if ( k <= j or k > N): pass
   elif (i + j + k == M): ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
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):
   k = M - i - j
   if ( k > N): pass
   elif  k <= j : break
   else: ans += 1
 N,M = map(int, input().split())
print(ans)

Submission status: Wrong Answer

Solution code:
(n, x), c = map(int, input().split()), 0
for i in range(1,n-1):
    for j in range(i,n):
        for k in range(j, n+1):
            s = i + j + k
            if s == x:
                c += 1
            if s > x:
                break
        if s > x:
            break
    if s > x:
        break
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
while True :
    n, x = map(int, input().split())
    if (n == x == 0) :
        break

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

Submission status: Wrong Answer

Solution code:
while True :
    n, x = map(int, input().split())
    if (n == x == 0) :
        break

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

Submission status: Wrong Answer

Solution code:
while True :
    n, x = map(int, input().split())
    if (n == x == 0) :
        break

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

Submission status: Wrong Answer

Solution code:
while True :
    n, x = map(int, input().split())
    if (n == x == 0) :
        break

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

Submission status: Wrong Answer

Solution code:
while True :
    n, x = map(int, 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) :
                Sum = a + b + c
                if (Sum == x) :
                    count += 1
    print(count)