My following code returns me the run time error in spoj during submission. Can anybody tell me how to remove this error. here is the link of the question http://www.spoj.com/problems/SERVS/

```
import numpy as np
import sys
x = sys.argv[0]
input = open('1.in')
lines = input.readline()
z = []
for line in input:
lst = line.strip().split(' ')
z.append(int(lst[0]))
size = len(z)
M = np.zeros((len(z),len(z)))
for i in range(size-1, -1, -1):
for j in range(size-1, i-1, -1):
if i == size-1:
M[i,j] = z[i]
else:
if j > i:
M[i,j] = M[i+1,j] + [j-i]
elif j == i:
M[i,j] = z[i] + M[j+1, (j+1):].min()
cost = int(M[j, j:].min())
print cost
```