Problem p03069 (python)

Fixed submission:
N = int(input())
S = input()                                                      
list_S = list(S)
N1 = 0
list_X =[]
X = list_S.count('.')
list_X.append(X)
    
for color in list_S:
    if list_S[N1] == '.':
        X -= 1
        list_X.append(X)
        N1 +=1
    else:
        X += 1
        list_X.append(X)
        N1 +=1

X = list_S.count('#') 
list_X.append(X)

X_MIN = min(list_X)
print(X_MIN)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()                                                      
list_S = list(S)
N1 = 0
X1 = 0
X2 = 0
list_X = []

for color in list_S:
    if color == '.':
            N1 +=1
    else:
        list_S1 = list_S[N1:]
        list_S2 = list_S[:N1]
        X1 = list_S1.count('.')
        X2 = list_S2.count('#')
        X = X1 + X2
        list_X.append(X)
        N1 +=1

X_MIN = min(list_X)
print(X_MIN)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()                                                      
list_S = list(S)
N1 = 0
X1 = 0
X2 = 0
X1MIN = 0
X2MIN = 0
list_X = []

for color in list_S:
    if color == '.':
            N1 +=1
    else:
        list_S1 = list_S[N1:]
        list_S2 = list_S[:N1]
        X1 = list_S1.count('.')
        X2 = list_S2.count('#')
        X = X1 + X2
        list_X.append(X)
        N1 +=1

X_MIN = min(list_X1)
print(X_MIN)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()                                                                                                                                                                                                                                                                                                                                                                                                                                            
list_S = list(S)
N1 = 0
for color in list_S:
    if color == '.':
            N1 +=1
    else:
        list_S1 = list_S[N1:]
        X1 = list_S1.count('#')
        X2 = list_S1.count('.')
        break

if X1 > X2:
    print(X2)
else:
    print(X1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list_S = list(S)
N1 = 0
X = list_S.count('.')
for N in list_S:
    if list_S[N1] == '.':
            N1 +=1
    else:
        list_S1 = list_S[N1:]
        X1 = list_S1.count('#')
        X2 = list_S1.count('.')
        break

if X1 > X2:
    print(X2)
else:
    print(X1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list_S = list(S)
N1 = 0
X = list_S.count('.')
for N in list_S:
    if list_S[N1] == '.':
            N1 +=1
    else:
        list_S1 = list_S[N1:]
        X1 = list_S1.count('#')
        X2 = list_S1.count('.')
        break

if X1 > X2:
    print(X2)
else:
    print(X1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list_S = list(S)
N1 = 0
X = list_S.count('.')
for N in list_S:
    if list_S[N1] == '.':
            N1 +=1
    else:
        print(N1)
        list_S1 = list_S[N1:]
        X1 = list_S1.count('#')
        X2 = list_S1.count('.')
        break

if X1 > X2:
    print(X2)
else:
    print(X1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list_S = list(S)
N1 = 0
X = list_S.count('.')
for N in list_S:
    if list_S[N1] == '.':
            N1 += 1
    else:
        list_SS = list_S[N1:]
        X1 = list_SS.count('#')
        X2 = list_SS.count('.')
        break
if X1 > X2:
    print(X2)
else:
    print(X1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
list_S = list(S)
N1 = 0
X = list_S.count('.')

if num == X:
    print('0')
else:
    for N in list_S:
        if list_S[N1] == '.':
            N1 += 1
        else:
            list_SS = list_S[N1:]
            X1 = list_SS.count('.')
            print(X1)
            break

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
list_S = list(S)
N1 = 0
X = list_S.count('.')

if num == X:
    print('0')
else:
    for N in list_S:
        if list_S[N1] == '.':
            N1 += 1
        else:
            list_SS = list_S[N1:]
            X1 = list_SS.count('.')
            print(X1)
            break