Problem p03315 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding:utf-8 -*- 
S = list(input())
Ans=0
for i in S:
    if i=="+":
        Ans = Ans+1
    else:
        Ans = Ans-1
print(Ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []
def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]
for i in range(0,16):
    for j in range(1,151):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()

for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=0
A = list(set(A))
A.sort() 
K=int(input())
for i in range(K):
    print(A[i+1])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

K = int(input())

def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []

def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]
for i in range(0,16):
    for j in range(1,151):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()
for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=0

A = list(set(A))
A.sort()
for i in range(K):
    print(A[i+1])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

K = int(input())

def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []

def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]
for i in range(0,16):
    for j in range(1,151):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()
l=len(A)
for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=0
            break;

A = list(set(A))
A.sort()
for i in range(K):
    print(A[i+1])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

K = int(input())

def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []

def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]
for i in range(0,16):
    for j in range(1,150):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()
l=len(A)
for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=0
            break;

A = list(set(A))
A.sort()
for i in range(K):
    print(A[i+1])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

K = int(input())

def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []
F=0
N=0
d=0

def func(F,d,N):
    for i in range(1,10):
        print(N+i*(10**d))
        F=F+1
        if F==K:
            exit()

    N=N+9*(10**d)
    d=d+1
    return F,d,N 


while True:
    F,d,N=func(F,d,N)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#要素の計算に注意！
N,K = map(int,input().split(" "))
A = list(map(int, input().split(" ")))

F=0
for i in A:
    if i==1:
        X=F 
        Y=N-(F+1)
        break;
    F=F+1

P=(X+Y)/(K-1)
if (X+Y)%(K-1)>0:
    print(P+1)
else:
    print(P)