Buggy python submission (verdict: Time Limit Exceeded):
import itertools
S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
    B = set([i for i, v in enumerate(S[:(N + 1) // 2 + 1]) if v == '1'])
    before = 1
    for i in range(2, N + 1):
        print(before, i)
        if i - 1 in B and i < max(B) + 2:
            before = i
else:
    print(-1)


Fixed submission:
S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
    before = 1
    for i in range(2, N + 1):
        print(before, i)
        if S[i - 1] == '1' and i < (N + 1) // 2 + 2:
            before = i
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
    B = set([i for i, v in enumerate(S[:(N + 1) // 2 + 1]) if v == '1'])
    before = 1
    for i in range(2, N + 1):
        print(before, i)
        if i - 1 in B and i < max(B) + 2:
            before = i
else:
    print(-1)


Fixed submission:
S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
    before = 1
    for i in range(2, N + 1):
        print(before, i)
        if S[i - 1] == '1' and i < (N + 1) // 2 + 2:
            before = i
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
import itertools
S = input()
N = len(S)
S = '0' + S
A = [[int(i), len(list(v))] for i, v in itertools.groupby(S)]
if A[0][0] == A[-1][0] == 0 and A[1][0] == A[-2][0] == A[0][1] == A[-1][1] == 1:
    if len(A) == 3:
        #一直線
        for i in range(1, N):
            print(i, i + 1)
        exit()
    elif len(A) == 5 and A[1][1] == A[-2][1]:
        #脚の長さの最大値がA[1][1]のstar graph
        M = A[1][1]
        Q, R = N // M, N % M
        #Q本の長さMの脚、1本の長さRの脚
        a = [[N] for _ in range(Q + 1)]
        for i in range(1, N):
            a[i % (Q + 1)] += [i]
        for b in a:
            for c, d in zip(b, b[1:]):
                print(c, d)
        exit()
print(-1)


Fixed submission:
S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
    before = 1
    for i in range(2, N + 1):
        print(before, i)
        if S[i - 1] == '1' and i < (N + 1) // 2 + 2:
            before = i
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
import itertools
S = input()
N = len(S)
S = '0' + S
A = [[int(i), len(list(v))] for i, v in itertools.groupby(S)]
if A[0][0] == A[-1][0] == 0 and A[1][0] == A[-2][0] == A[0][1] == A[-1][1] == 1:
    if len(A) == 3:
        #一直線
        for i in range(1, N):
            print(i, i + 1)
        exit()
    elif len(A) == 5 and A[1][1] == A[-2][1]:
        #脚の長さの最大値がA[1][1]+1のstar graph
        M = A[1][1] + 1
        Q, R = N // M, N % M
        #Q本の長さMの脚、1本の長さRの脚
        a = [[N] for _ in range(Q + 1)]
        for i in range(1, N):
            a[i % (Q + 1)] += [i]
        for b in a:
            for c, d in zip(b, b[1:]):
                print(c, d)
        exit()
print(-1)


Fixed submission:
S = input()
N = len(S)
S = '0' + S
if S[:2] == '01' and S == S[::-1]:
    before = 1
    for i in range(2, N + 1):
        print(before, i)
        if S[i - 1] == '1' and i < (N + 1) // 2 + 2:
            before = i
else:
    print(-1)