Problem:


Score : 300 points

Problem Statement

Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:

1 \leq x,y,z

x^2 + y^2 + z^2 + xy + yz + zx = n

Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Constraints

All values in input are integers.

1 \leq N \leq 10^4

Input

Input is given from Standard Input in the following format:

N

Output

Print N lines. The i-th line should contain the value f(i).

Sample Input 1

20

Sample Output 1

0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

For n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.

For n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.

For n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.

For n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.



Sample input:
20


Sample output:
0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

def f(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x

def main():
    N = I()
    ans = 1
    X = 0
    Y = 0
    Z = 0
    XYZ = 0
    arr = []
    C = 6000
    dic = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 7: 0, 8: 0, 9: 0, 10: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 19: 0, 20: 0, 21: 0, 22: 0, 23: 0, 26: 0, 28: 0, 29: 0, 30: 0, 31: 0, 32: 0, 36: 0, 37: 0, 39: 0, 40: 0, 41: 0, 42: 0, 46: 0, 48: 0, 49: 0, 50: 0, 52: 0, 53: 0, 56: 0, 59: 0, 60: 0, 62: 0, 63: 0, 64: 0, 65: 0, 70: 0, 74: 0, 75: 0, 76: 0, 78: 0, 79: 0, 80: 0, 84: 0, 88: 0, 91: 0, 92: 0, 93: 0, 94: 0, 98: 0, 101: 0, 104: 0, 106: 0, 107: 0, 110: 0, 111: 0, 112: 0, 116: 0, 120: 0, 124: 0, 126: 0, 127: 0, 128: 0, 134: 0, 138: 0, 142: 0, 144: 0, 148: 0, 149: 0, 155: 0, 156: 0, 158: 0, 160: 0, 164: 0, 165: 0, 167: 0, 168: 0, 170: 0, 174: 0, 182: 0, 184: 0, 186: 0, 189: 0, 190: 0, 192: 0, 196: 0, 200: 0, 206: 0, 208: 0, 211: 0, 212: 0, 221: 0, 222: 0, 224: 0, 226: 0, 230: 0, 231: 0, 236: 0, 238: 0, 239: 0, 240: 0, 248: 0, 252: 0, 254: 0, 256: 0, 259: 0, 260: 0, 270: 0, 280: 0, 282: 0, 286: 0, 290: 0, 296: 0, 300: 0, 302: 0, 304: 0, 305: 0, 309: 0, 312: 0, 314: 0, 316: 0, 317: 0, 318: 0, 320: 0, 334: 0, 336: 0, 338: 0, 341: 0, 350: 0, 351: 0, 352: 0, 364: 0, 366: 0, 368: 0, 371: 0, 372: 0, 376: 0, 381: 0, 382: 0, 392: 0, 398: 0, 399: 0, 401: 0, 404: 0, 406: 0, 410: 0, 413: 0, 414: 0, 416: 0, 424: 0, 428: 0, 430: 0, 440: 0, 444: 0, 446: 0, 448: 0, 462: 0, 464: 0, 469: 0, 470: 0, 478: 0, 479: 0, 480: 0, 494: 0, 496: 0, 504: 0, 508: 0, 510: 0, 512: 0, 518: 0, 526: 0, 530: 0, 536: 0, 541: 0, 542: 0, 546: 0, 552: 0, 554: 0, 558: 0, 568: 0, 574: 0, 576: 0, 589: 0, 590: 0, 592: 0, 596: 0, 606: 0, 614: 0, 620: 0, 622: 0, 623: 0, 624: 0, 629: 0, 632: 0, 638: 0, 640: 0, 654: 0, 656: 0, 659: 0, 660: 0, 668: 0, 669: 0, 670: 0, 672: 0, 680: 0, 686: 0, 696: 0, 702: 0, 714: 0, 718: 0, 721: 0, 728: 0, 734: 0, 736: 0, 744: 0, 746: 0, 750: 0, 756: 0, 758: 0, 760: 0, 766: 0, 767: 0, 768: 0, 782: 0, 784: 0, 794: 0, 798: 0, 800: 0, 814: 0, 824: 0, 830: 0, 832: 0, 844: 0, 846: 0, 848: 0, 862: 0, 870: 0, 878: 0, 884: 0, 888: 0, 890: 0, 894: 0, 896: 0, 904: 0, 905: 0, 910: 0, 920: 0, 924: 0, 926: 0, 942: 0, 944: 0, 952: 0, 956: 0, 958: 0, 960: 0, 974: 0, 986: 0, 990: 0, 992: 0, 1001: 0, 1006: 0, 1008: 0, 1016: 0, 1022: 0, 1024: 0, 1031: 0, 1036: 0, 1038: 0, 1040: 0, 1047: 0, 1054: 0, 1070: 0, 1080: 0, 1082: 0, 1086: 0, 1094: 0, 1102: 0, 1106: 0, 1110: 0, 1115: 0, 1118: 0, 1120: 0, 1128: 0, 1134: 0, 1144: 0, 1150: 0, 1160: 0, 1166: 0, 1182: 0, 1184: 0, 1194: 0, 1198: 0, 1200: 0, 1208: 0, 1214: 0, 1216: 0, 1220: 0, 1230: 0, 1236: 0, 1246: 0, 1248: 0, 1256: 0, 1262: 0, 1264: 0, 1268: 0, 1272: 0, 1278: 0, 1280: 0, 1286: 0, 1294: 0, 1310: 0, 1326: 0, 1336: 0, 1342: 0, 1344: 0, 1352: 0, 1358: 0, 1364: 0, 1374: 0, 1390: 0, 1397: 0, 1400: 0, 1404: 0, 1406: 0, 1408: 0, 1409: 0, 1418: 0, 1422: 0, 1438: 0, 1439: 0, 1454: 0, 1456: 0, 1464: 0, 1470: 0, 1472: 0, 1484: 0, 1486: 0, 1488: 0, 1502: 0, 1504: 0, 1518: 0, 1524: 0, 1526: 0, 1528: 0, 1534: 0, 1550: 0, 1566: 0, 1568: 0, 1582: 0, 1586: 0, 1590: 0, 1592: 0, 1596: 0, 1598: 0, 1604: 0, 1614: 0, 1616: 0, 1624: 0, 1630: 0, 1640: 0, 1646: 0, 1652: 0, 1656: 0, 1662: 0, 1664: 0, 1678: 0, 1694: 0, 1696: 0, 1710: 0, 1712: 0, 1718: 0, 1720: 0, 1726: 0, 1742: 0, 1751: 0, 1758: 0, 1760: 0, 1774: 0, 1776: 0, 1784: 0, 1790: 0, 1792: 0, 1794: 0, 1806: 0, 1822: 0, 1838: 0, 1848: 0, 1850: 0, 1854: 0, 1856: 0, 1870: 0, 1876: 0, 1880: 0, 1886: 0, 1902: 0, 1912: 0, 1916: 0, 1918: 0, 1920: 0, 1934: 0, 1950: 0, 1966: 0, 1976: 0, 1982: 0, 1984: 0, 1991: 0, 1998: 0, 2014: 0, 2016: 0, 2030: 0, 2032: 0, 2040: 0, 2046: 0, 2048: 0, 2062: 0, 2072: 0, 2078: 0, 2094: 0, 2104: 0, 2110: 0, 2120: 0, 2126: 0, 2142: 0, 2144: 0, 2158: 0, 2164: 0, 2168: 0, 2174: 0, 2184: 0, 2190: 0, 2198: 0, 2206: 0, 2208: 0, 2210: 0, 2216: 0, 2222: 0, 2232: 0, 2238: 0, 2254: 0, 2262: 0, 2270: 0, 2272: 0, 2286: 0, 2296: 0, 2298: 0, 2302: 0, 2304: 0, 2318: 0, 2334: 0, 2350: 0, 2356: 0, 2360: 0, 2366: 0, 2368: 0, 2382: 0, 2384: 0, 2398: 0, 2414: 0, 2424: 0, 2430: 0, 2446: 0, 2456: 0, 2459: 0, 2462: 0, 2478: 0, 2480: 0, 2488: 0, 2492: 0, 2494: 0, 2496: 0, 2510: 0, 2516: 0, 2526: 0, 2528: 0, 2534: 0, 2542: 0, 2543: 0, 2552: 0, 2558: 0, 2560: 0, 2574: 0, 2590: 0, 2594: 0, 2606: 0, 2616: 0, 2622: 0, 2624: 0, 2636: 0, 2638: 0, 2640: 0, 2654: 0, 2670: 0, 2672: 0, 2676: 0, 2680: 0, 2686: 0, 2688: 0, 2702: 0, 2718: 0, 2720: 0, 2734: 0, 2744: 0, 2750: 0, 2766: 0, 2774: 0, 2782: 0, 2784: 0, 2798: 0, 2808: 0, 2814: 0, 2830: 0, 2846: 0, 2856: 0, 2862: 0, 2872: 0, 2878: 0, 2884: 0, 2894: 0, 2910: 0, 2912: 0, 2926: 0, 2936: 0, 2942: 0, 2944: 0, 2958: 0, 2974: 0, 2976: 0, 2984: 0, 2990: 0, 3000: 0, 3006: 0, 3022: 0, 3024: 0, 3032: 0, 3038: 0, 3040: 0, 3054: 0, 3064: 0, 3068: 0, 3070: 0, 3072: 0, 3086: 0, 3102: 0, 3110: 0, 3118: 0, 3128: 0, 3134: 0, 3136: 0, 3150: 0, 3166: 0, 3176: 0, 3182: 0, 3192: 0, 3198: 0, 3200: 0, 3206: 0, 3214: 0, 3230: 0, 3242: 0, 3246: 0, 3256: 0, 3262: 0, 3266: 0, 3278: 0, 3294: 0, 3296: 0, 3310: 0, 3320: 0, 3326: 0, 3328: 0, 3342: 0, 3358: 0, 3374: 0, 3376: 0, 3384: 0, 3390: 0, 3392: 0, 3406: 0, 3422: 0, 3438: 0, 3448: 0, 3454: 0, 3470: 0, 3480: 0, 3486: 0, 3502: 0, 3512: 0, 3518: 0, 3534: 0, 3536: 0, 3550: 0, 3552: 0, 3560: 0, 3566: 0, 3576: 0, 3582: 0, 3584: 0, 3598: 0, 3614: 0, 3616: 0, 3620: 0, 3630: 0, 3640: 0, 3646: 0, 3662: 0, 3678: 0, 3680: 0, 3694: 0, 3696: 0, 3704: 0, 3710: 0, 3726: 0, 3742: 0, 3758: 0, 3768: 0, 3774: 0, 3776: 0, 3790: 0, 3806: 0, 3808: 0, 3822: 0, 3824: 0, 3832: 0, 3838: 0, 3840: 0, 3854: 0, 3870: 0, 3886: 0, 3896: 0, 3902: 0, 3918: 0, 3926: 0, 3934: 0, 3944: 0, 3950: 0, 3960: 0, 3966: 0, 3968: 0, 3982: 0, 3998: 0, 4004: 0, 4014: 0, 4024: 0, 4026: 0, 4030: 0, 4032: 0, 4046: 0, 4062: 0, 4064: 0, 4078: 0, 4088: 0, 4094: 0, 4096: 0, 4110: 0, 4124: 0, 4126: 0, 4134: 0, 4142: 0, 4144: 0, 4152: 0, 4158: 0, 4160: 0, 4174: 0, 4188: 0, 4190: 0, 4206: 0, 4216: 0, 4222: 0, 4238: 0, 4254: 0, 4270: 0, 4280: 0, 4286: 0, 4302: 0, 4318: 0, 4320: 0, 4328: 0, 4334: 0, 4344: 0, 4350: 0, 4355: 0, 4366: 0, 4376: 0, 4382: 0, 4398: 0, 4408: 0, 4414: 0, 4424: 0, 4430: 0, 4440: 0, 4446: 0, 4460: 0, 4462: 0, 4472: 0, 4478: 0, 4480: 0, 4494: 0, 4510: 0, 4512: 0, 4526: 0, 4536: 0, 4542: 0, 4558: 0, 4574: 0, 4576: 0, 4590: 0, 4600: 0, 4606: 0, 4622: 0, 4638: 0, 4640: 0, 4654: 0, 4664: 0, 4670: 0, 4686: 0, 4702: 0, 4718: 0, 4728: 0, 4734: 0, 4736: 0, 4750: 0, 4766: 0, 4776: 0, 4782: 0, 4792: 0, 4798: 0, 4800: 0, 4814: 0, 4830: 0, 4832: 0, 4846: 0, 4856: 0, 4862: 0, 4864: 0, 4878: 0, 4880: 0, 4894: 0, 4910: 0, 4920: 0, 4926: 0, 4942: 0, 4944: 0, 4958: 0, 4974: 0, 4984: 0, 4990: 0, 4992: 0, 5006: 0, 5022: 0, 5024: 0, 5030: 0, 5038: 0, 5048: 0, 5054: 0, 5056: 0, 5070: 0, 5072: 0, 5086: 0, 5088: 0, 5102: 0, 5112: 0, 5118: 0, 5120: 0, 5134: 0, 5144: 0, 5150: 0, 5166: 0, 5176: 0, 5182: 0, 5198: 0, 5210: 0, 5214: 0, 5230: 0, 5240: 0, 5246: 0, 5262: 0, 5278: 0, 5294: 0, 5304: 0, 5310: 0, 5326: 0, 5342: 0, 5344: 0, 5358: 0, 5368: 0, 5374: 0, 5376: 0, 5390: 0, 5406: 0, 5408: 0, 5422: 0, 5432: 0, 5438: 0, 5454: 0, 5456: 0, 5470: 0, 5474: 0, 5486: 0, 5496: 0, 5502: 0, 5518: 0, 5534: 0, 5550: 0, 5560: 0, 5566: 0, 5582: 0, 5588: 0, 5594: 0, 5598: 0, 5600: 0, 5614: 0, 5616: 0, 5624: 0, 5630: 0, 5632: 0, 5636: 0, 5646: 0, 5662: 0, 5672: 0, 5678: 0, 5688: 0, 5694: 0, 5710: 0, 5726: 0, 5742: 0, 5752: 0, 5756: 0, 5758: 0, 5774: 0, 5790: 0, 5806: 0, 5816: 0, 5822: 0, 5824: 0, 5838: 0, 5854: 0, 5856: 0, 5870: 0, 5880: 0, 5886: 0, 5888: 0, 5894: 0, 5902: 0, 5909: 0, 5918: 0, 5934: 0, 5936: 0, 5944: 0, 5950: 0, 5952: 0, 5966: 0, 5969: 0, 5982: 0, 5998: 0, 6008: 0, 6014: 0, 6016: 0, 6030: 0, 6046: 0, 6062: 0, 6072: 0, 6078: 0, 6094: 0, 6096: 0, 6104: 0, 6110: 0, 6112: 0, 6126: 0, 6136: 0, 6142: 0, 6158: 0, 6174: 0, 6190: 0, 6200: 0, 6206: 0, 6222: 0, 6238: 0, 6254: 0, 6264: 0, 6270: 0, 6272: 0, 6286: 0, 6302: 0, 6318: 0, 6328: 0, 6334: 0, 6344: 0, 6350: 0, 6360: 0, 6366: 0, 6368: 0, 6382: 0, 6384: 0, 6392: 0, 6398: 0, 6414: 0, 6416: 0, 6430: 0, 6446: 0, 6456: 0, 6462: 0, 6464: 0, 6478: 0, 6494: 0, 6496: 0, 6510: 0, 6518: 0, 6520: 0, 6526: 0, 6542: 0, 6558: 0, 6560: 0, 6574: 0, 6584: 0, 6590: 0, 6606: 0, 6608: 0, 6622: 0, 6624: 0, 6638: 0, 6648: 0, 6654: 0, 6656: 0, 6670: 0, 6686: 0, 6702: 0, 6710: 0, 6712: 0, 6718: 0, 6734: 0, 6750: 0, 6766: 0, 6776: 0, 6782: 0, 6784: 0, 6794: 0, 6798: 0, 6814: 0, 6830: 0, 6840: 0, 6846: 0, 6848: 0, 6862: 0, 6872: 0, 6878: 0, 6880: 0, 6894: 0, 6904: 0, 6910: 0, 6926: 0, 6942: 0, 6958: 0, 6968: 0, 6974: 0, 6990: 0, 7004: 0, 7006: 0, 7022: 0, 7032: 0, 7038: 0, 7040: 0, 7054: 0, 7070: 0, 7086: 0, 7096: 0, 7102: 0, 7104: 0, 7118: 0, 7134: 0, 7136: 0, 7150: 0, 7160: 0, 7166: 0, 7168: 0, 7176: 0, 7182: 0, 7198: 0, 7214: 0, 7224: 0, 7230: 0, 7246: 0, 7262: 0, 7278: 0, 7288: 0, 7294: 0, 7310: 0, 7326: 0, 7342: 0, 7352: 0, 7358: 0, 7374: 0, 7390: 0, 7392: 0, 7400: 0, 7406: 0, 7416: 0, 7422: 0, 7424: 0, 7438: 0, 7454: 0, 7470: 0, 7480: 0, 7486: 0, 7502: 0, 7504: 0, 7518: 0, 7520: 0, 7526: 0, 7534: 0, 7544: 0, 7550: 0, 7566: 0, 7582: 0, 7598: 0, 7608: 0, 7614: 0, 7630: 0, 7646: 0, 7648: 0, 7662: 0, 7664: 0, 7672: 0, 7678: 0, 7680: 0, 7694: 0, 7710: 0, 7726: 0, 7736: 0, 7742: 0, 7758: 0, 7774: 0, 7790: 0, 7800: 0, 7806: 0, 7822: 0, 7838: 0, 7854: 0, 7864: 0, 7870: 0, 7886: 0, 7902: 0, 7904: 0, 7918: 0, 7928: 0, 7934: 0, 7936: 0, 7950: 0, 7964: 0, 7966: 0, 7982: 0, 7992: 0, 7998: 0, 8014: 0, 8030: 0, 8046: 0, 8056: 0, 8062: 0, 8064: 0, 8078: 0, 8094: 0, 8110: 0, 8120: 0, 8126: 0, 8128: 0, 8142: 0, 8158: 0, 8160: 0, 8174: 0, 8184: 0, 8190: 0, 8192: 0, 8206: 0, 8222: 0, 8238: 0, 8248: 0, 8254: 0, 8270: 0, 8286: 0, 8288: 0, 8302: 0, 8312: 0, 8318: 0, 8334: 0, 8350: 0, 8366: 0, 8376: 0, 8382: 0, 8398: 0, 8414: 0, 8416: 0, 8430: 0, 8440: 0, 8446: 0, 8462: 0, 8478: 0, 8480: 0, 8494: 0, 8504: 0, 8510: 0, 8526: 0, 8542: 0, 8558: 0, 8568: 0, 8574: 0, 8576: 0, 8590: 0, 8606: 0, 8622: 0, 8632: 0, 8638: 0, 8654: 0, 8656: 0, 8670: 0, 8672: 0, 8686: 0, 8696: 0, 8702: 0, 8718: 0, 8734: 0, 8736: 0, 8750: 0, 8760: 0, 8766: 0, 8782: 0, 8792: 0, 8798: 0, 8814: 0, 8824: 0, 8830: 0, 8832: 0, 8840: 0, 8846: 0, 8862: 0, 8864: 0, 8878: 0, 8888: 0, 8894: 0, 8910: 0, 8926: 0, 8928: 0, 8942: 0, 8952: 0, 8958: 0, 8974: 0, 8990: 0, 9006: 0, 9016: 0, 9022: 0, 9038: 0, 9048: 0, 9054: 0, 9070: 0, 9080: 0, 9086: 0, 9088: 0, 9102: 0, 9118: 0, 9134: 0, 9144: 0, 9150: 0, 9166: 0, 9182: 0, 9184: 0, 9192: 0, 9198: 0, 9208: 0, 9214: 0, 9216: 0, 9230: 0, 9246: 0, 9262: 0, 9272: 0, 9278: 0, 9294: 0, 9310: 0, 9326: 0, 9336: 0, 9342: 0, 9358: 0, 9374: 0, 9390: 0, 9400: 0, 9406: 0, 9422: 0, 9424: 0, 9438: 0, 9440: 0, 9454: 0, 9464: 0, 9470: 0, 9472: 0, 9486: 0, 9502: 0, 9518: 0, 9528: 0, 9534: 0, 9536: 0, 9550: 0, 9566: 0, 9582: 0, 9592: 0, 9598: 0, 9614: 0, 9630: 0, 9646: 0, 9656: 0, 9662: 0, 9678: 0, 9694: 0, 9696: 0, 9710: 0, 9720: 0, 9726: 0, 9742: 0, 9758: 0, 9774: 0, 9784: 0, 9790: 0, 9806: 0, 9822: 0, 9824: 0, 9836: 0, 9838: 0, 9848: 0, 9854: 0, 9870: 0, 9886: 0, 9902: 0, 9912: 0, 9918: 0, 9920: 0, 9934: 0, 9950: 0, 9952: 0, 9966: 0, 9968: 0, 9976: 0, 9982: 0, 9984: 0, 9998: 0}

    # print(len(dic))

    for n in range(1, N+1):
        flag = False
        if n in dic:
            print(0)
            continue

        for x in range(1, int(n ** 0.5)+1):
            for y in range(1, int(n ** 0.5)+1):
                for z in range(1, int(n ** 0.5)+1):
                    if f(x, y, z) == n:
                        flag = True
                        # X = max(X, x)
                        # Y = max(Y, y)
                        # Z = max(Z, z)
                        # print(n, x, y, z, x + y + z)
                        # if x + y + z >= 100:
                        #     arr.append([n, x, y, z])
                        c = len(set([x, y, z]))
                        if c == 1:
                            print(1)
                            # if n >= C:
                            #     dic[n] = 1
                        elif c == 2:
                            print(3)
                            # if n >= C:
                            #     dic[n] = 3
                        else:
                            print(6)
                            # if n >= C:
                            #     dic[n] = 6
                        # print(n, x, y, z, c)
                    if flag:
                        break
                if flag:
                    break
            if flag:
                break
        if flag == False:
            dic[n] = 0
            print(0)

    # print(X, Y, Z)
    # print(arr)
    # print(dic)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

import itertools

N = int(input())

ans = [0]*N

x = []


i=1
while 1:
    if (i+1)*(i+1)+2>=N:
        break
    i+=1
i+=1

for inputI in range(i):
    x.append(inputI+1)


S = list(itertools.combinations_with_replacement(x, 3))


for s in S:
    sum = (s[0]+s[1])*(s[0]+s[2])+pow(s[1],2)+pow(s[2],2)

    if sum <= N:
        if s.count(s[0])==3:
            ans[sum-1]=1
        elif s.count(s[0])==2 or s.count(s[1])==2:
            ans[sum-1]=3
        else:
            ans[sum-1]=6


for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())

lis = [0] * (10**5)

for i in range(1, 65):
    for j in range(1, 65):
        for k in range(1, 65):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= 10**4 + 1:
                if len(set(tmp)) == 1:
                    lis[t-1] = 1
                elif len(set(tmp)) == 2:
                    lis[t-1] = 3
                elif len(set(tmp)) == 3:
                    lis[t-1] = 6

for i in range(n):
    print(lis[i])

Submission status: Wrong Answer

Solution code:
import time
import itertools
import collections


N = int(input())
start = time.time()
def function(x,y,z):
    return pow(x,2) + pow(y,2) + pow(z,2) + (x * y) + (x * z ) + (y * z)

p = list(itertools.combinations_with_replacement(range(1,50),3))
a = []

for p_in in p:
    reslut = function(p_in[0],p_in[1],p_in[2])
    if (p_in[0] == p_in[1] == p_in[2]):
        a.append(reslut)
    elif (p_in[0] == p_in[1] or p_in[1] == p_in[2] or p_in[2] == p_in[0]):
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
    else:
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)

dict = collections.Counter(a)

for n in range(1,N + 1):
    print(dict[n])


elapsed_time = time.time() - start

Submission status: Wrong Answer

Solution code:
N = int(input())
 
for n in range(1,N+1):
  ans = 0
  check = False
  for x in range(1,min(n,42)):
    for y in range(x,min(n,42)):
      for z in range(y,min(n,42)):
        if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
          if x == y and y == x and z == x:
            ans += 1
          elif x == y  or z == x or y == z:
            ans += 3
          elif x != y and y != z and z != x:
            ans += 6
  print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
def g(x,y,z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x
ans = []
def f(n):
    #sum = 0
    rn = int(math.sqrt(n))
    
    for i in range(1,rn+1):
        #print(i,end='')
        for j in range(1,rn+1):
            for k in range(1,rn+1):
                #print(i,j,k)
                if g(i,j,k) == n:
                    if (i == j and j==k):
                        #sum += 1
                        print(1)
                        return
                    elif (i == j and j != k) or (i == k and j != k) or (i != j and j == k):
                        #sum += 3
                        print(3)
                        return
                    else:#elif i != j and i != k and j != k:
                        #sum += 6
                        print(6)
                        return
                elif g(i,j,k) > n:
                    break
    print(0)
                

    

for i in range(1,n+1):
    f(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
L=[0]*N
for x in range(1,200):
    for y in range(x,200):
        for z in range(y,200):
            f=x**2+y**2+z**2+x*y+y*z+z*x
            if f<=N:
                if x==y==z:
                    L[f-1]+=1
                    #print(f,x,y,z)
                else:
                    L[f-1]+=3
                    #print(f,x,y,z)
for i in range(N):
    print(L[i])

Submission status: Wrong Answer

Solution code:
import time
import itertools
import collections


N = int(input())
start = time.time()
def function(x,y,z):
    return pow(x,2) + pow(y,2) + pow(z,2) + (x * y) + (x * z ) + (y * z)

p = list(itertools.combinations_with_replacement(range(1,50),3))
a = []

for p_in in p:
    reslut = function(p_in[0],p_in[1],p_in[2])
    if (p_in[0] == p_in[1] == p_in[2]):
        a.append(reslut)
    elif (p_in[0] == p_in[1] or p_in[1] == p_in[2] or p_in[2] == p_in[0]):
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
    else:
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)
        a.append(reslut)


print(collections.Counter(a))
dict = collections.Counter(a)

for n in range(1,N + 1):
    print(dict[n])


elapsed_time = time.time() - start

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(1, n+1):
    cnt = 0
    for x in range(1, 33):
        for y in range(1, 33):
            for z in range(1, 33):
                
                if i == ((x+y+z)**2 - z*(x+y) - (x*y)):
                    cnt += 1

    print(cnt)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
Heihou_1 = np.array([(3*i)**2-(3*i) for i in range(1,N//1000 +30)])
#Heihou_3 = [i**2 for i in range(4,N+1) if i%3 != 0]
n_list = np.array([])
for i in range(1,N//1000 +40):
    for j in range(1,N//1000 +40):
        n_list = np.append(n_list,3*(i)**2 + 2*i*j + j**2)


#print(Heihou_1[-1])
#print(n_list[-1])

for i in range(1,N+1):
    if np.any(Heihou_1 == i):
        print(1)
        Heihou_1 = Heihou_1[1:-1]
    elif np.any(n_list==i):
        print(3)
        n_list = n_list[1:-1]
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())

x, y, z = 1,1,1
ans_dict = {}

for x in range(1,110):
    for y in range(1,110-x):
        for z in range(1,110-x-y):
            ans = (x + y)**2 + (y + z)**2 + (z + x)**2
            if ans in ans_dict:
                ans_dict[ans] += 1
            else:
                ans_dict[ans] = 1

for n in range(1, N+1):
    if 2*n in ans_dict:
        print(ans_dict[2*n])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())

import math

for i in range(1, n+1):
  ans = 0
  if i >= 6:
    for x in range(int(math.sqrt(i//6)), i):
      for y in range(1, x+1):
        res = 4*i-3*x*x-3*y*y-2*x*y
        if (x+y)%2==0 and res%4==0 and res>=x+y and math.sqrt(res)==int(math.sqrt(res)):
            z = (int(math.sqrt(res))-(x+y))//2
            if 1<=z<=y<=x:
              if x==y and y==z :
                ans += 1
              elif x!=y and y!=z and z!=x:
                ans += 6
              else:
                ans += 3
            
  print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import combinations_with_replacement

n = int(input())

for i in range(1, n+1):
    ans = 0
    for v in combinations_with_replacement(range(1, 35), 3):        
        x, y, z = v

        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
            if x == y == z:
                ans += 1
            else:
                ans += 3
            break

    print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    x , y , z = 1,1,1
    anwlist = []
    for i in range(N):
        n = i+1

        while True: # X
            while True: # Y
                while True: # Z
                    calc = x**2 +  y**2 + z**2 + x*y + y*z + z*x
                    if calc > n:
                        break
                    elif calc == n:
                        anwlist.append([x,y,z])
                        break
                    elif calc < n:
                        z += 1

                y += 1
                z = 1
                calc = x**2 +  y**2 + z**2 + x*y + y*z + z*x
                if calc > n:
                    break 

            x += 1
            y,z = x, x
            calc = x**2 +  y**2 + z**2 + x*y + y*z + z*x
            if calc > n:
                print(len(anwlist))
                x, y, z = 1,1,1
                anwlist = []
                break
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    if n == 1:
        print(0)
        sys.exit()
    r = [0]*100000000
    for i1 in range(1,33):
        for i2 in range(1,33):
            for i3 in range(1,33):
                t = pow(i1, 2) + pow(i2, 2) + pow(i3, 2) + i1*i2 + i2*i3 + i1*i3
                t = int(t)
                r[t] += 1
    for i1 in range(1, n+1):
        print(int(r[i1]))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
lst=[0]*10100
for i in range(1, 42):
  for j in range(1, i+1):
    for k in range(1, j+1):
      temp=i**2+j**2+k**2+i*j+j*k+k*i
      if i==j and j==k:
        lst[temp]+=1
      elif i==j and j!=k:
         lst[temp]+=3
      elif j==k and k!=i:
         lst[temp]+=3
      elif k==i and i!=j:
         lst[temp]+=3
      elif i!=j and j!=k and k!=i:
         lst[temp]+=6
for p in range(1, n+1):
  print(lst[p])

Submission status: Wrong Answer

Solution code:
N = int(input())
 
for n in range(1,N+1):
  ans = 0
  check = False
  for x in range(1,min(n,42)):
    for y in range(x,min(n,42)):
      for z in range(y,min(n,42)):
        if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
          if x == y and y == x and z == x:
            ans += 1
          elif x == y  or z == x or y == z:
            ans += 3
          elif x != y and y != z and z != x:
            ans += 6
          check = True
          break
      if check:
        break
    if check:
      break
  print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for i in range(n):
    for x in range(n):
        for y in range(n):
            for z in range(n):
                if n==x*x+y*y+z*z+x*y+y*z+z*x:
                    count+=1
for i in range(n):
    print(count)

Submission status: Wrong Answer

Solution code:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################
n = int(input())
arr = list()
e = list()
ans = []
temp1 = 0
for i in range(1,n+1):
	temp2 = 0
	for j in range(1,n+1):
		temp3 = 0
		for k in range(1,n+1):
			if i == j == k: kk = 1
			elif i!=j and j!= k: kk = 6
			elif i==j or j== k: kk = 3
			e.append(kk)
			arr.append(i*i + j*j + k*k + i*j + j*k + k*i)
			temp3 = i*i + j*j + k*k + i*j + j*k + k*i
			#print(temp3, i+j+k)
			if temp3 > n:break
		temp2 = i*i + j*j + 1 + i*j + j + i
		if temp2 > n: break
	temp1 = i*i + 1 + 1 + i + 1 + i
	if temp1 > n:
		break
	


#print(arr)
#print(e)
for i in range(1,n+1):
	f = 1
	for j in range(len(arr)):
		if arr[j] == i:
			ans.append(e[j])
			f = 0
			break
	if f: ans.append(0)
for i in ans:
	print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
lst=[0]*10100
for i in range(1, 42):
  for j in range(1, i+1):
    for k in range(1, j+1):
      temp=i**2+j**2+k**2+i*j+j*k+k*i
      if i==j and j==k:
        lst[temp]+=1
      elif i==j and j!=k:
         lst[temp]+=3
      elif j==k and k!=i:
         lst[temp]+=3
      elif k==i and i!=j:
         lst[temp]+=3
      elif i!=j and j!=k:
         lst[temp]+=6
for p in range(1, n+1):
  print(lst[p])

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
# limit = int(n**0.5)
for i in range(n):
    cnt = 0
    for x in range(1,n):
        for y in range(1,n):
            b = x + y
            c = x**2+y**2+x*y-i
            buf = b**2-4*c
            if buf >= 0:
                ans = [-b + math.sqrt(buf), -b - math.sqrt(buf)]
                for z in ans:
                    if z.is_integer() and z > 0:
                        cnt += 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
from math import sqrt
import sys
input=sys.stdin.readline
n=int(input())
sq=[]
x=int(sqrt(n))+1
for i in range(2,x):
    sq.append(i*i)
x=len(sq)
for i in range(1,n+1):
    val=2*i
    lol=0
    for j in range(x):
        if(j>val):
            break
        left=val-sq[j]
        ii=j
        jj=x-1
        
        while ii<=jj:
            #print(ii,jj)
            if(sq[ii]+sq[jj]>left):
                jj-=1
            elif(sq[ii]+sq[jj]<left):
                ii+=1
            else:
                li=[ii,jj,j]
                li.sort()
                a,b,c=li
                va,vb,vc=int(sqrt(sq[a])),int(sqrt(sq[b])),int(sqrt(sq[c]))
                #print(va,vb,vc)
                xx=(vc+va-vb)//2
                yy=va-xx
                zz=vb-yy
                
                #print(xx,yy,zz)
                if((vc+va-vb)%2!=0):
                    lol=0
                elif(xx<=0 or yy<=0 or zz<=0 or xx+yy!=va or yy+zz!=vb or xx+zz!=vc):
                    lol=0    
                elif(a==b and a==c):
                    lol=1
                elif(a==b or b==c):
                    lol=3
                else:
                    lol=6
                break
        if(lol):
            #print(sq[ii],sq[jj],sq[j],2*i)
            break
    print(lol)

Submission status: Wrong Answer

Solution code:
N = int(input())

for n in range(1, N+1):
    s = n//5
    cnt = 0
    flag = 0
    f2 = 0
    for x in range(1, s+1):
        for y in range(x, s+1):
            for z in range(y, s+1):
                siki = x**2 + y**2 + z**2 + x*y + y*z + z*x

                if siki == n:
                    # print('ans = ', siki)
                    if (x==y)and(y==z):
                        cnt += 1
                    elif (x!=y)and(y!=z):
                        cnt += 6
                    else:
                        cnt += 3
                # elif siki > n:
                    flag = 1
                    break
                elif siki > n:
                    f2 += 1
                    # print('fs= ', f2)
                    # print('x,y,z= ',x,y,z)
                    break

            if flag or f2==2:
                break
        if flag or f2==2:
            break
    print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())

numbers = []
for i in range(1, 100):
    numbers.append(i)

result = []
for i in range(len(numbers)):
  for j in range(i, len(numbers)):
    for k in range(j, len(numbers)):
      result.append([numbers[i], numbers[j], numbers[k]])

ns = {}
for i in range(10000):
    ns[i+1] = 0

for i in result:
    count = 3
    if i[0] == i[1]:
        count -= 1
    if i[0] == i[2]:
        count -= 1
    if i[1] == i[2]:
        count -= 1

    junretsu = 0
    if count == 3:
        junretsu = 6
    elif count == 2:
        junretsu = 3
    else:
        junretsu = 1

    ns[i[0]**2 + i[1]**2 + i[2]**2 + i[0]*i[1] + i[1]*i[2] + i[2]*i[0]] = junretsu

for i in range(N):
    print(ns.get(i+1))