Buggy python submission (verdict: Time Limit Exceeded):

import itertools
import math

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    
    for i in range(1, n+1):
        ans = 0
        cnt = 0
        for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
            if x > 0 and y > 0 and z > 0:
                #ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans = (x + y + z)**2 - (x*y + y*z + z*x)
                if ans == i:
                    cnt = cnt + 1
        
        print(cnt)
                    
    
if __name__ == "__main__":
    main()


Fixed submission:

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    l = [0] * 10001
    
    for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
        fn = 0
        if x > 0 and y > 0 and z > 0:
            fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if fn <= n:
                l[fn] += 1
    
    for i in range(1, n+1):
        print(l[i])
                    
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

import itertools
import math

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = int(math.sqrt(n))
    
    for i in range(1, n+1):
        ans = 0
        cnt = 0
        for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
            if x > 0 and y > 0 and z > 0:
                #ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans = (x + y + z)**2 - (x*y + y*z + z*x)
                if ans == i:
                    cnt = cnt + 1
        
        print(cnt)
                    
    
if __name__ == "__main__":
    main()


Fixed submission:

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    l = [0] * 10001
    
    for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
        fn = 0
        if x > 0 and y > 0 and z > 0:
            fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if fn <= n:
                l[fn] += 1
    
    for i in range(1, n+1):
        print(l[i])
                    
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    
    for i in range(1, n+1):
        ans = 0
        cnt = 0
        for x, y, z in itertools.product(range(n), range(n), range(n)):
            if x > 0 and y > 0 and z > 0:
                #ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans = (x + y + z)**2 - (x*y + y*z + z*x)
                if ans == i:
                    cnt = cnt + 1
        
        print(cnt)
                    
    
if __name__ == "__main__":
    main()


Fixed submission:

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    l = [0] * 10001
    
    for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
        fn = 0
        if x > 0 and y > 0 and z > 0:
            fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if fn <= n:
                l[fn] += 1
    
    for i in range(1, n+1):
        print(l[i])
                    
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    
    for i in range(1, n+1):
        ans = 0
        cnt = 0
        for x, y, z in itertools.product(range(n), range(n), range(n)):
            if x > 0 and y > 0 and z > 0:
                ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if ans == i:
                    cnt = cnt + 1
        
        print(cnt)
                    
    
if __name__ == "__main__":
    main()


Fixed submission:

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    l = [0] * 10001
    
    for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
        fn = 0
        if x > 0 and y > 0 and z > 0:
            fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if fn <= n:
                l[fn] += 1
    
    for i in range(1, n+1):
        print(l[i])
                    
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):


def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    
    for i in range(1, n+1):
        ans = 0
        cnt = 0

        for x in range(1, n+1):
            for y in range(1, n+1):
                for z in range(1, n+1):
                    ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                    if ans == i:
                        cnt = cnt + 1
        print(cnt)
                    
    
if __name__ == "__main__":
    main()


Fixed submission:

import itertools

def main():
    
    input_lines_n = input()
    n = int(input_lines_n)
    xyz_max = 100
    l = [0] * 10001
    
    for x, y, z in itertools.product(range(xyz_max), range(xyz_max), range(xyz_max)):
        fn = 0
        if x > 0 and y > 0 and z > 0:
            fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if fn <= n:
                l[fn] += 1
    
    for i in range(1, n+1):
        print(l[i])
                    
    
if __name__ == "__main__":
    main()