I've been getting this error while I try to run my code. If you know, how I can change it, tell me please! Two-three steps...
Failed test #2 of 11. Runtime error
Error:
Traceback (most recent call last):
File "jailed_code", line 30, in <module>
for j in num:
File "jailed_code", line 5, in aP
a = [1]*n
MemoryError
def aP(n):
a = [1]*n
y = -1
v = n
while v > 0:
v -= 1
x = a[v] + 1
while y >= 2 * x:
a[v] = x
y -= x
v += 1
w = v + 1
while x <= y:
a[v] = x
a[w] = y
yield a[:w + 1]
x += 1
y -= 1
a[v] = x + y
y = a[v] - 1
yield a[:w]
lst = []
res = []
input = input().split(' ')
for i in input:
num = aP(int(i))
for j in num:
if len(j) == 3:
lst.append(j)
res.append(len(lst))
lst = []
res = str(res).replace(',', '')
print(res[1:-1])