На Python:
n = int(input())
num = []
s_num =[]
s = 0
a = 1
while n>0:
s += a**2
num.append(a)
s_num.append(a**2)
a += 2
n -= 1
print(s)
print(*num)
print(*s_num)
На Python:
n = int(input())
num = []
s_num =[]
s = 0
a = 1
while n>0:
s += a**2
num.append(a)
s_num.append(a**2)
a += 2
n -= 1
print(s)
print(*num)
print(*s_num)