Buggy python submission (verdict: Runtime Error):
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

s = input()

K = []
for k in range(1, len(s)):
    if s[k] != s[k-1]:
        K.append(max(len(s)-k, k))
    else:
        continue

ans = 0
if min(K) == 0:
    if all(v == "1" for v in s):
        ans = len(s)
else:
    ans = min(K)
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)

Buggy python submission (verdict: Runtime Error):
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

s = input()

K = []
for k in range(1, len(s)):
    if s[k] != s[k-1]:
        K.append(max(len(s)-k, k))
    else:
        continue

ans = 0
if min(K) == 0:
    if all(v == "1" for v in s):
        ans = len(K)
else:
    ans = min(K)
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)

Buggy python submission (verdict: Runtime Error):
s=input()
l=[]

p=s[0]
seq=1

for c in s[1:]:
  if c==p:
    seq+=1
  else:
    l.append(seq)
    seq=1
    p=c
ans=float("inf")

d1=min([a+b for a,b in zip(l[0::2],l[1::2])])
d2=min([a+b for a, b in zip(l[1::2],l[2::2])])
print(min(d1,d2))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)

Buggy python submission (verdict: Runtime Error):
s=input()
l=[]

p=s[0]
seq=1

for c in s[1:]
  if c==p:
    seq+=1
  else:
    l.append(seq)
    seq=1
    p=c
ans=float("inf")

d1=min([a+b for a,b in zip(l[0::2],l[1::2])])
d2=min([a+b for a, b in zip(l[1::2],l[2::2])])
print(min(d1,d2))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)

Buggy python submission (verdict: Runtime Error):
s=input()
l=[]

p=s[0]
seq=1

for c in s[1:]
  if c==p:
    seq+=1
  else:
    l.append(seq)
    seq=1
    prev=c
ans=float("inf")

d1=min([a+b for a,b in zip(l[0::2],l[1::2])])
d2=min([a+b for a, b in zip(l[1::2],l[2::2])])
print(min(d1,d2))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)