Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=np.zeros(100001,dtype='int32')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
s=np.zeros(100001,dtype='int32')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        for j in range(a[i],n+1):
            if s[j]>s[j-a[i]]+1:
                s[j]=s[j-a[i]]+1
print(s[n])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
s=np.zeros(100001,dtype='int32')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        for j in range(a[i],n+1):
            if s[j]>s[j-a[i]]+1:
                s[j]=s[j-a[i]]+1
print(s[n])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=np.zeros(100001,dtype='int32')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        for j in range(a[i],n+1):
            if s[j]>s[j-a[i]]+1:
                s[j]=s[j-a[i]]+1
print(s[n])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=np.zeros(100001,dtype='int32')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        for j in range(a[i],n+1):
            if s[j]>s[j-a[i]]+1:
                s[j]=s[j-a[i]]+1
print(s[n])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=np.zeros((100001),dtype='int16')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i]=i
for i in range(1,12):
    for j in range(n+1):
        if a[i]<=j:
            if s[j]>s[j-a[i]]+1:
                s[j]=s[j-a[i]]+1
print(s[n])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=np.zeros((100001,12),dtype='int16')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i][0]=i
for i in range(1,12):
    for j in range(n+1):
        s[j][i]=s[j][i-1]
        if a[i]<=j:
            if s[j][i]>s[j-a[i]][i]+1:
                s[j][i]=s[j-a[i]][i]+1
print(s[n][11])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=np.zeros((100001,12),dtype='int32')
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]

for i in range(n+1):
    s[i][0]=i
for i in range(1,12):
    for j in range(n+1):
        s[j][i]=s[j][i-1]
        if a[i]<=j:
            if s[j][i]>s[j-a[i]][i]+1:
                s[j][i]=s[j-a[i]][i]+1
print(s[n][11])


Fixed submission:
n=int(input())
s=[i for i in range(n+1)]
a=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(n+1):
    s[i]=i
for i in range(1,12):
    if a[i]<=n :
        k=a[i]
        for j in range(k,n+1):
            if s[j]>s[j-k]+1:
                s[j]=s[j-k]+1
print(s[n])