Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def main():
    ans = [0]*(n+1)
    for x in range(1, n+1):
        for y in range(1, n+1):
            for z in range(1, n+1):
                fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if fn > n:
                    break
                else:
                    ans[fn] += 1

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()

Fixed submission:
n = int(input())

def main():
    ans = [0]*(n+1)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if fn > n:
                    break
                else:
                    ans[fn] += 1

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def cal(i):
    count = 0
    x=1
    y=1
    z=1
    tmpx=1
    tmpy=1
    tmpz=1
    while(True):
        ycount=0
        while(True):
            zcount=0
            while(True):
                ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if (ans == i):
                    if ((100*x +10*y + z) % 111 == 0):
                        count+=1
                    else:
                        count+=3
                elif (ans > i):
                    break
                z += 1
                zcount+=1

            tmpz+=1
            z=tmpz
            if (zcount == 0):
                break
            y += 1
            ycount+=1

        tmpy+=1
        y = tmpy
        tmpz = tmpy
        z = tmpz
        if (ycount == 0):
            break
        x += 1

    return count

def main():
    for i in range(1, N+1):
        print(cal(i))

if __name__ == '__main__':
    main()

Fixed submission:
n = int(input())

def main():
    ans = [0]*(n+1)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if fn > n:
                    break
                else:
                    ans[fn] += 1

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def cal(i):
    flagx = True
    count = 0
    x=1
    y=1
    z=1
    while(flagx):
        flagy = True
        while(flagy):
            flagz = True
            while(flagz):
                ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if (ans == i):
                    count+=1
                elif (ans > i):
                    flagz = False
                    z -= 1
                z += 1
            y += 1
            if (z == 1):
                flagy = False
            else:
                z = 1
        x += 1
        if (y == 2):
            flagx = False
        else:
            y = 1

    return count

def main():
    for i in range(1, N+1):
        print(cal(i))

if __name__ == '__main__':
    main()

Fixed submission:
n = int(input())

def main():
    ans = [0]*(n+1)
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if fn > n:
                    break
                else:
                    ans[fn] += 1

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()