Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = sorted(list(map(int, input().split())))
As_set = set(As)

i = 0
while i < N - 1:  
  j = i + 1
  while j < N:
    if As[j] % As[i] == 0:
      if As[j] in As_set:
        As_set.remove(As[j])
      As.pop(j)
      N -= 1
    else:
      j += 1
  i += 1
  
print(len(As_set))

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
M = max(A_list)+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
As = list(map(int, input().split()))
count = sorted(Counter(As).items(), key = lambda x: x[0])
divider = set()


ans = 0
for numi, c in count:
  if c > 1:
    divider.add(numi)
    continue
  flag = True
  for numj in divider:
    if numj ** (0.5) > numi:
      divider.add(numi)
      ans += 1
      break
    if numi % numj == 0:
      break
  else:
    divider.add(numi)
    ans += 1
  
print(ans)

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
M = max(A_list)+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
As = list(map(int, input().split()))
count = sorted(Counter(As).items(), key = lambda x: x[0])
divider = set()


ans = 0
for num, c in count:
  if c > 1:
    divider.add(num)
    continue
  for i in divider:
    if num % i == 0:
      break
  else:
    divider.add(num)
    ans += 1
  
print(ans)

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
M = max(A_list)+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
As = list(map(int, input().split()))
count = sorted(Counter(As).items(), key = lambda x: x[0])

ans = 0
for num, c in count:
  if c > 1:
    continue
  flag = True
  for i, c2 in count:
    if i == num:
      break
    if num % i == 0:
      flag = False
      break
  if flag:
    ans += 1
  
print(ans)

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
M = max(A_list)+1
cnt = [0 for _ in range(M)]

for i in A_list:
    if cnt[i] != 0:
        cnt[i] = 2
        continue
    for j in range(i, M, i): cnt[j] += 1

ans = 0
for k in A_list:
    if cnt[k] == 1: ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n, m = map(int, input().split())
dic = collections.defaultdict(lambda:[])
for _ in range(m):
  a, b = map(int, input().split())
  dic[a].append(b)
  dic[b].append(a)
  
ans = [None] * n
bfs = [(1,0)]
visited = set()
get = 0
while bfs and get < n:
  now, prev = bfs.pop(0)
  if now in visited:
    continue
  visited.add(now)
  get += 1
  if ans[now-1] == None:
    ans[now-1] = prev
  for next in dic[now]:
    if next not in visited:
      bfs.append((next, now))
      
print('Yes')  
for i in range(1, n):
  print(ans[i])

Fixed submission:
import collections

n, m = map(int, input().split())
dic = collections.defaultdict(lambda:[])
for _ in range(m):
  a, b = map(int, input().split())
  dic[a].append(b)
  dic[b].append(a)
  
ans = [None] * n
bfs = [(1,dic[1])]
visited = set()
get = 0
while bfs and get < n:
  now, nexts = bfs.pop(0)

  for i in nexts:
    if i in visited:
      continue
    ans[i-1] = now
    get += 1
    bfs.append((i,dic[i]))
    visited.add(i)
      
print('Yes')  
for i in range(1, n):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n, m = map(int, input().split())
dic = collections.defaultdict(lambda:[])
for _ in range(m):
  a, b = map(int, input().split())
  dic[a].append(b)
  dic[b].append(a)
  
ans = [None] * n
bfs = [(1,0)]
visited = set()
while bfs:
  now, prev = bfs.pop(0)
  if now in visited:
    continue
  visited.add(now)
  if ans[now-1] == None:
    ans[now-1] = prev
  bfs.extend([(i, now) for i in dic[now]])

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

Fixed submission:
import collections

n, m = map(int, input().split())
dic = collections.defaultdict(lambda:[])
for _ in range(m):
  a, b = map(int, input().split())
  dic[a].append(b)
  dic[b].append(a)
  
ans = [None] * n
bfs = [(1,dic[1])]
visited = set()
get = 0
while bfs and get < n:
  now, nexts = bfs.pop(0)

  for i in nexts:
    if i in visited:
      continue
    ans[i-1] = now
    get += 1
    bfs.append((i,dic[i]))
    visited.add(i)
      
print('Yes')  
for i in range(1, n):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
x = int(input())

quarter = int(x ** 0.25)
for B in range(-quarter, quarter+1):
  A = int((B**5 + x) ** 0.2)
  if A % 1 == 0:
    print(A, B)
    break

Fixed submission:
x = int(input())

q = 0
while abs(x) > q**4:
  q += 1

deta = False
for A in range(-q, q+1):
  if deta:
    break
  for B in range(-q, q+1):
    if A**5 - B**5 == x:
      print(A,B)
      deta = True
      break
Buggy python submission (verdict: Runtime Error):
import collections

input()
p = list(map(int, input().split()))
map1 = collections.defualtdict(lambda:0)
map2 = collections.defaultdict(lambda:0)

for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map2[i]
print(i)

Fixed submission:
import collections
 
input()
p = list(map(int, input().split()))
map1 = collections.defaultdict(lambda:0)
map2 = collections.defaultdict(lambda:0)
 
for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map1[i] * map2[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
participant = list(map(int, input().split()))
hashSet = collections.defaultdict(lambda:set())
for i,v in enumerate(participant):
  hashSet[v].add(i)
  
ans = 0
for i,v in enumerate(participant):
  for key, s in hashSet.items():
    if i+v+key in s:
      ans += 1

print(ans)

Fixed submission:
import collections
 
input()
p = list(map(int, input().split()))
map1 = collections.defaultdict(lambda:0)
map2 = collections.defaultdict(lambda:0)
 
for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map1[i] * map2[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
participant = list(map(int, input().split()))

ans = 0
for i in range(len(participant)-1):
  for j in range(i+1, len(participant)):
    if j - i == participant[i] + participant[j]:
      ans += 1

print(ans)

Fixed submission:
import collections
 
input()
p = list(map(int, input().split()))
map1 = collections.defaultdict(lambda:0)
map2 = collections.defaultdict(lambda:0)
 
for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map1[i] * map2[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
participant = list(map(int, input().split()))

ans = 0
for i in range(len(participant)-1):
  for j in range(i+1, len(participant)):
    if j - i == participant[i] + participant[j]:
      ans += 1

print(ans)

Fixed submission:
import collections
 
input()
p = list(map(int, input().split()))
map1 = collections.defaultdict(lambda:0)
map2 = collections.defaultdict(lambda:0)
 
for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map1[i] * map2[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = input()
l = input().split()
A, B = l[0], l[1]

i = 0
while i * k <= B:
  if A<= i*k <= B:
    print('OK')

print('NG')

Fixed submission:
k = int(input())
l = input().split()
A, B = int(l[0]), int(l[1])

i = 0
while i * k <= B:
  if A <= i*k <= B:
    print('OK')
    break
  i += 1
else:
  print('NG')
Buggy python submission (verdict: Runtime Error):
pi =　3.14159265359
r = int(input())
print(r*2*pi)

Fixed submission:
pi = 3.1415926536
r = int(input())
print(2*pi*r)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

k = int(input())
comb = list(itertools.combinations_with_replacement([i for i in range(1,k+1)], 3))
ans = 0
for a,b,c in comb:
  n = a
  while n > 0:
    if a%n == 0 and b%n == 0 and c%n == 0:
      if len(set([a,b,c])) == 3:
        ans += 6 * n
      elif len(set([a,b,c])) == 2:
        ans += 3 * n
      else:
        ans += n
      break
    n -= 1

print(ans)

Fixed submission:
import itertools

k = int(input())
comb = list(itertools.combinations_with_replacement([i for i in range(1,k+1)], 3))
ans = 0
for a,b,c in comb:
  permutation = len(set([a,b,c]))
  r = b % a
  while r > 0:
    b = a
    a = r
    r = b % a
    
  r = c % a
  while r > 0:
    c = a
    a = r
    r = c % a
    
  if permutation == 3:
    ans += 6 * a
  elif permutation == 2:
    ans += 3 * a
  else:
    ans += a
    
print(ans)
Buggy python submission (verdict: Runtime Error):
if S == 'AAA' or S == 'BBB':
  print('No')
else:
  print('Yes')

Fixed submission:
S = input()
if S == 'AAA' or S == 'BBB':
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
array = map(int,input().split())
array.sort()
if array[0] != array[2] and (array[0] == array[1] or array[1] == array[2]):
  print('Yes')
else:
  print('No')

Fixed submission:
array = list(map(int,input().split()))
array.sort()
if array[0] != array[2] and (array[0] == array[1] or array[1] == array[2]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
s,t = input().split()
a,b = map(int, input().split())
u = input()

dic = {s: a, t: b}
dic[u] -= 1
print(dic[s] + ' ' + dic[t])

Fixed submission:
s,t = input().split()
a,b = map(int, input().split())
u = input()
 
dic = {s: a, t: b}
dic[u] -= 1
print(str(dic[s]) + ' ' + str(dic[t]))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
for _ in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 1

print(a,b)

Fixed submission:
a,b,k = map(int,input().split())

if k >= a:
  k -= a
  a = 0
else:
  a -= k
  k = 0

if k >= b:
  b = 0
else:
  b -= k

print(a,b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

ans = ""
for i in range(n):
  ascii = ord(s[i]) + n
  if ascii > ord('Z'):
    ascii -= ord('A')
  ans += char(ascii)

print(ans)

Fixed submission:
n = int(input())
s = input()

ans = ""
for c in s:
  ascii = ord(c) + n
  if ascii > ord('Z'):
    ascii -= 26
  ans += chr(ascii)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())
ar = list(map(int, input().split()))
ans = 0
for i,v in enumerate(ar):
  if v <= k:
    ans+= 1
print(ans)

Fixed submission:
n,k = map(int, input().split())
ar = list(map(int, input().split()))
ans = 0
for i,v in enumerate(ar):
  if v >= k:
    ans+= 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())
ar = list(map(int, input().split()))
ans = 0
for i in ar:
  if i <= k:
    ans+= 1
print(ans)

Fixed submission:
n,k = map(int, input().split())
ar = list(map(int, input().split()))
ans = 0
for i,v in enumerate(ar):
  if v >= k:
    ans+= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(min(a*n, b)

Fixed submission:
n,a,b = map(int,input().split())
print(min(a*n, b))
Buggy python submission (verdict: Runtime Error):
array = list(map(int, input().split())).sort()
print(array[0]+array[1])

Fixed submission:
array = sorted(list(map(int, input().split())))
print(array[0]+array[1])
Buggy python submission (verdict: Runtime Error):
n = input()
ws = list(map(int, input().split()))
ans = float('inf')
s = 0
whole = sum(ws)

for i in range(n-1):
  s += ws[i]
  ans = min(ans, abs(whole- 2*s))

print(ans)

Fixed submission:
n = int(input())
ws = list(map(int, input().split()))
ans = float('inf')
s = 0
whole = sum(ws)

for i in range(n-1):
  s += ws[i]
  ans = min(ans, abs(whole- 2*s))

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
s[k] = s[k].lower()

Fixed submission:
n, k = map(int, input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
a,b,t = map(int, input().split())
print(b*((t+0.5)//a)

Fixed submission:
a,b,t = map(int, input().split())
print(b* int((t+0.5)//a) )
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = sorted(map(int, input().split()))
surplus = [i%arr[0] == 0 for i in arr]
r = arr[0]
while not all([i%r == 0 for i in arr]):
  arr = [i % r for i in arr[1:]]
  arr.append(r)
  r = arr[0]
print(arr[-2])

Fixed submission:
from fractions import gcd

N = int(input())
arr = list(map(int, input().split()))

left = [0 for _ in range(N+1)]
right = [0 for _ in range(N+1)]

for i in range(N):
  left[i+1] = gcd(left[i],arr[i])
  right[-i-2] = gcd(right[-i-1], arr[-i-1])

ans = 1
for i in range(N):
  result = gcd(left[i], right[i+1])
  ans = max(ans, result)

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print(min(c, b//a)

Fixed submission:
a,b,c = map(int, input().split())
print(min(c, b//a))
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())

for i in range(min(a,b),-1,-1):
  if a%i == 0 and b%i == 0:
    k-=1
    if k==0:
      print(i)

Fixed submission:
a,b,k = map(int, input().split())
 
for i in range(min(a,b),0,-1):
  if a%i == 0 and b%i == 0:
    k-=1
    if k==0:
      print(i)
      break
Buggy python submission (verdict: Runtime Error):
ab,bc,ca = map(int,input().split())
print(ab * ac // 2)

Fixed submission:
ab,bc,ca = map(int,input().split())
print(ab * bc // 2)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N, M = map(int, input().split())

dic = collections.defaultdict(lambda:[])
pairs = []

for _ in range(M):
  P, Y = map(int, input().split())
  pairs.append((P, Y))
  dic[P].append(Y)

for key in dic:
  dic[key].sort()

while pairs:
  P, Y = pairs.pop(0)
  print(str(P).zfill(6) + str(dic[P].index(Y)+1).zfill(6))


Fixed submission:
from bisect import bisect_right

N, M = map(int, input().split())

Ps, Ys, vals = [], [], {}
for i in range(M):
  P, Y = map(int, input().split())
  Ps.append(P)
  Ys.append(Y)

  if P not in vals:
    vals[P] = []
  vals[P].append(Y)

for P in vals:
  vals[P].sort()

for i in range(M):
  pref = str(Ps[i]).zfill(6)
  city = str(bisect_right(vals[Ps[i]], Ys[i])).zfill(6)
  print(pref + city)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N, M = map(int, input().split())

dic = collections.defaultdict(lambda:[])
pairs = []

for _ in range(M):
  P, Y = map(int, input().split())
  pairs.append((P, Y))
  dic[P].append(Y)

for key in dic:
  dic[key].sort()
  dic[key] = {v:i+1 for i,v in enumerate(dic[key])}

while pairs:
  P, Y = pairs.pop(0)
  print(str(P).zfill(6) + str(dic[P][Y]).zfill(6))

Fixed submission:
from bisect import bisect_right

N, M = map(int, input().split())

Ps, Ys, vals = [], [], {}
for i in range(M):
  P, Y = map(int, input().split())
  Ps.append(P)
  Ys.append(Y)

  if P not in vals:
    vals[P] = []
  vals[P].append(Y)

for P in vals:
  vals[P].sort()

for i in range(M):
  pref = str(Ps[i]).zfill(6)
  city = str(bisect_right(vals[Ps[i]], Ys[i])).zfill(6)
  print(pref + city)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(max(a+b, a-b, a*b)

Fixed submission:
a,b = map(int, input().split())
print(max(a+b, a-b, a*b))
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int, input().split())
arr = list(map(int,input().split()))
i = 0
while arr[i] < x:
  i += 1

print(min(len(arr)-i, i)

Fixed submission:
n,m,x = map(int, input().split())
arr = list(map(int,input().split()))
i = 0
while arr[i] < x:
  i += 1

print(min(len(arr)-i, i))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())
for i in range(a,b+1):
  if i < a+k or i > b-k:
    print(i)

Fixed submission:
a,b,k = map(int, input().split())

for i in range(a,a+k):
  if i > b:
    break
  print(i)
for i in range(max(b-k+1,a+k),b+1):
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())
for i in range(a,b+1):
  if i < a+k or i > b-k:
    print(i)

Fixed submission:
a,b,k = map(int, input().split())

for i in range(a,a+k):
  if i > b:
    break
  print(i)
for i in range(max(b-k+1,a+k),b+1):
  print(i)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s.count('1')

Fixed submission:
s = input()
print(s.count('1'))
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
print(min(n*a,b)

Fixed submission:
n,a,b = map(int, input().split())
print(min(n*a,b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
n = N
fN = 0
while n > 9:
  fN += n%10
  n //= 10
if N % fN == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
n = N
fN = 0
while n >= 10:
  fN += n%10
  n //= 10
fN += n
  
if N % fN == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
dic = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
x,y = input().split()
it dic[x] > dic[y]:
  print('>')
elif dic[x] < dic[y]:
  print('<')
else:
  print('=')

Fixed submission:
dic = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
x,y = input().split()
if dic[x] > dic[y]:
  print('>')
elif dic[x] < dic[y]:
  print('<')
else:
  print('=')
Buggy python submission (verdict: Runtime Error):
x,t = map(int, input().split())
if x > t:
  print(x-t)
else:
  print(0

Fixed submission:
x,t = map(int, input().split())
if x > t:
  print(x-t)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = input()
ptint('ABC'+n)

Fixed submission:
n = input()
print('ABC'+n)
Buggy python submission (verdict: Runtime Error):
seta = set(1,3,5,7,8,10,12)
setb = set(4,6,9,11)
setc = set(2)

a,b = map(int, input().split())

if (a in seta and b in seta) or (a in setb and b in setb) or (a in setc and b in setc):
  print('Yes')
else:
  print('No')

Fixed submission:
seta = set([1,3,5,7,8,10,12])
setb = set([4,6,9,11])
setc = set([2])
 
a,b = map(int, input().split())
 
if (a in seta and b in seta) or (a in setb and b in setb) or (a in setc and b in setc):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
for i in range(1,N+1):
  ans *= i
print(ans % (10**9 +7))

Fixed submission:
N = int(input())
ans = 1
for i in range(1,N+1):
  ans *= i
  if ans > 10**9 + 7:
    ans %= 10**9 + 7
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
print(max(a*b, c*d)

Fixed submission:
a,b,c,d = map(int, input().split())
print(max(a*b, c*d))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

k, s = map(int, input().split())
A = [i for i in range(k+1)]
ans = 0
for x,y,z in itertools.combinations_with_replacement(A, 3):
  if x+y+z == s:
    n = 0
    if len(set([x,y,z])) == 1:
      n = 1
    elif len(set([x,y,z])) == 2:
      n = 3
    elif len(set([x,y,z])) == 3:
      n = 6
    ans += n
print(ans)

Fixed submission:
k,s = map(int, input().split())

ans = 0
for right in range(max(s-k, 0), min(s+1, 2*k+1)):
  lower = max(0, right-k)
  upper = min(k, right)
  if right % 2 != 0:
    ans += upper - lower + 1
  else:
    ans += upper - lower + 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
d = collections.deque()

N, K = map(int, input().split())
A = [int(i) for i in input().split()]
for _ in range(K):
    d.append(A[_])


for i in range(K,N):
    sum_1 = sum(d)
    d.popleft()
    d.append(A[i])
    sum_2 = sum(d)
    if sum_1 < sum_2: print('Yes')
    else: print('No')

Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
for i in range(K,N):
    a = A[i-K]
    b = A[i]
    if a<b: print('Yes')
    else: print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
record = [0] * 1000000

b = 1
for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(b,N+1):
            sum = i**2 + j**2 + k**2 + i*j + i*k +j*k
            if sum >= N: break
            if i==j==k: record[sum] += 1
            else: record[sum] += 3
        b += 1

for num in record[1:N+1]:
    print(num)

Fixed submission:

n = int(input())

ans = [0 for _ in range(n+1)]
x = 1
y = 1
z = 1

while True:
    f = x * x + y * y + z * z + x * y + y * z + z * x
    if f > n:
        if z > 1:
            y += 1
            z = 1
        elif y > 1:
            x += 1
            y = 1
        else:
            break
    else:
        ans[f] += 1
        z += 1

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

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
record = [0] * 1000000

for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            sum = i**2 + j**2 + k**2 + i*j + i*k +j*k
            if sum >= N: break
            # print("i,j,k:", i,j,k)
            # print(sum)
            # if i==j==k: record[sum] += 1
            # else: record[sum] += 3
            record[sum] += 1

for num in record[1:N+1]:
    print(num)


Fixed submission:

n = int(input())

ans = [0 for _ in range(n+1)]
x = 1
y = 1
z = 1

while True:
    f = x * x + y * y + z * z + x * y + y * z + z * x
    if f > n:
        if z > 1:
            y += 1
            z = 1
        elif y > 1:
            x += 1
            y = 1
        else:
            break
    else:
        ans[f] += 1
        z += 1

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