Buggy python submission (verdict: Runtime Error):
e,a = map(int,input().split())
cnt =0
if e==0 and a==0:
    break
else:
    for i in range(1,e+1):
        for j in range(i+1,e+1):
            for k in range(j+1,e+1):
                if i+j+k ==9:
                    cnt +=1
print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
e,a = map(int,input().split())
cnt =0
while True:
    if e==0 and a==0:
        break
    else:
        for i in range(1,e+1):
            for j in range(i+1,e+1):
                for k in range(j+1,e+1):
                    if i+j+k ==9:
                        cnt +=1
print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
e,a = map(int,input().split())
cnt =0
while True:
    if e==0 and a==0:
        break
    else:
        for i in range(1,e+1):
            for j in range(i+1,e+1):
                for k in range(j+1,e+1):
                    if i+j+k ==a:
                        cnt +=1
print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
e,a = map(int,input().split())
cnt =0
while True:
    if e==0 and a==0:
        break
    else:
        for i in range(1,a):
            for j in range(i+1,a):
                for k in range(j+1,a):
                    if i+j+k ==a:
                        cnt +=1
print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
e,a = map(int,input().split())
cnt = 0
while True:
    if e ==0 and a ==0:
        break
    else:
        for i in range(1,a+1):
            for j in range(1,a+1):
                if i<j:
                    continue
                else:
                    X = a - (i + j)
                    if X > 0:
                        cnt +=1
print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
e,a = map(int,input().split())
cnt = 0
while True:
    if e ==0 and a ==0:
        break
    for i in range(1,a+1):
        for j in range(1,a+1):
            if j<=i:
                continue
            
            X = a - (i + j)
            if X > j and X <=a:
                cnt +=1
print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
e,a = map(int,input().split())
cnt = 0
while True:
    if e ==0 and a ==0:
        break
    for i in range(1,a+1):
        for j in range(1,a+1):
            if j<=i:
                continue
            
            X = a - (i + j)
            if X > j and X <=a:
                cnt +=1
    print(cnt)


Fixed submission:
while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)