Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    '''
    doc
    '''
    pattern_sum = 0
    a_list = input().split()
    while a_list[0]!='0' or a_list[1]!='0':
        for i in range(1,int(a_list[0])-1):
            for j in range(i+1,int(a_list[0])):
                for k in range(j+1,int(a_list[0])+1):
                    if i+j+k == int(a_list[1]):
                        pattern_sum+=1

        print(pattern_sum)
        a_list = input().split()

Fixed submission:
if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = [int(f) for f in raw_input().split()]

Buggy python submission (verdict: Runtime Error):
pattern_sum = 0
a_list = input().split()
while a_list[0]!='0' or a_list[1]!='0':
    for i in range(1,int(a_list[0])-1):
        for j in range(i+1,int(a_list[0])):
            for k in range(j+1,int(a_list[0])+1):
                if i+j+k == int(a_list[1]):
                    pattern_sum+=1
    print(pattern_sum)
    a_list = input().split()

Fixed submission:
if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = [int(f) for f in raw_input().split()]

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = raw_input().split()

Fixed submission:
if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = [int(f) for f in raw_input().split()]

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = raw_input().split()

Fixed submission:
if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = [int(f) for f in raw_input().split()]