Buggy python submission (verdict: Time Limit Exceeded):
def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

indexs = [i for i, x in enumerate(S) if x == "#"]
if len(indexs) == 0:
    print(0)
else:
    answer = 10000000
    change_white = 0
    for i in indexs:
        x = change_white + get_cost_change_black(S[i:])
        if x < answer:
            answer = x
        change_white = change_white + 1
        if change_white >= x:
            break
    print(answer)


Fixed submission:
def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

indexs = [i for i, x in enumerate(S) if x == "#"]
if len(indexs) == 0:
    print(0)
else:
    answer = 10000000000
    change_white = 0
    change_black = get_cost_change_black(S[indexs[0]:])
    for i, ind in enumerate(indexs):
        x = change_white + change_black
        if x < answer:
            answer = x
        change_white = change_white + 1
        if i == len(indexs) - 1:
            if change_white < answer:
                answer = change_white
            break
        change_black = change_black - (indexs[i+1] - indexs[i] - 1)
    print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

indexs = [i for i, x in enumerate(S) if x == "#"]
if len(indexs) == 0:
    print(0)
else:
    answer = 10000000
    change_white = 0
    for i in indexs:
        x = change_white + get_cost_change_black(S[i:])
        if x < answer:
            answer = x
        change_white = change_white + 1
    print(answer)


Fixed submission:
def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

indexs = [i for i, x in enumerate(S) if x == "#"]
if len(indexs) == 0:
    print(0)
else:
    answer = 10000000000
    change_white = 0
    change_black = get_cost_change_black(S[indexs[0]:])
    for i, ind in enumerate(indexs):
        x = change_white + change_black
        if x < answer:
            answer = x
        change_white = change_white + 1
        if i == len(indexs) - 1:
            if change_white < answer:
                answer = change_white
            break
        change_black = change_black - (indexs[i+1] - indexs[i] - 1)
    print(answer)

Buggy python submission (verdict: Runtime Error):
def get_min_cost(S):
    if len(S) == 0:
        return 0
    if len(S) == 1:
        return 0
    return min(1 + get_min_cost(S[1:]), get_cost_change_black(S))

def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

if '#' in S:
    answer = get_min_cost(S[S.index('#'):])
    print(answer)
else:
    print(0)


Fixed submission:
def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

indexs = [i for i, x in enumerate(S) if x == "#"]
if len(indexs) == 0:
    print(0)
else:
    answer = 10000000000
    change_white = 0
    change_black = get_cost_change_black(S[indexs[0]:])
    for i, ind in enumerate(indexs):
        x = change_white + change_black
        if x < answer:
            answer = x
        change_white = change_white + 1
        if i == len(indexs) - 1:
            if change_white < answer:
                answer = change_white
            break
        change_black = change_black - (indexs[i+1] - indexs[i] - 1)
    print(answer)