Buggy python submission (verdict: Runtime Error):
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])


def calc_puddle(map, l, r):
    ans = 0
    top = map[l]
    before = map[l]
    for i in range(l + 1, r + 1):
        be_ans = ans
        if map[i] == before:
           ans += top - map[i]
        elif map[i] < before:
            ans += top - map[i] - 0.5
            before = map[i]
        else:
            ans += top - map[i] + 0.5
            before = map[i]
        #print(ans - be_ans)
    return int(ans)


cross_section = list(input())
map = [0]
y = 0
for c in cross_section:
    if c == "/":
        y += 1
        map.append(y)
    elif c == "\\":
        y += -1
        map.append(y)
    else:
        map.append(y)
max_right = len(map) - 1
#print(map)
#print(len(map))

left = 0
right = 1
ans = []
while left < max_right:
    #print(left, right)
    if map[left] <= map[right]:
        left = right
        right += 1
        if right == max_right:
            left = max_right
    else:
        right += 1
        if map[left] == map[right]:
            ans.append(calc_puddle(map, left, right))
        elif right == max_right:
            left += 1
            right = left + 1
            if right == max_right:
                left = max_right

print(sum(ans))
ans.insert(0, len(ans))
print_list_split_whitespace(ans)


Fixed submission:
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
    
s = list(input())
st1 = []
st2 = []

for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area

a = 0
k = len(st2)
ls = [k]
for _, s in st2:
    a += s
    ls.append(s)

print(a)
print_list_split_whitespace(ls)

Buggy python submission (verdict: Time Limit Exceeded):
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])


def calc_puddle(map, l, r):
    ans = 0
    top = map[l]
    before = map[l]
    for i in range(l + 1, r + 1):
        be_ans = ans
        if map[i] == before:
           ans += top - map[i]
        elif map[i] < before:
            ans += top - map[i] - 0.5
            before = map[i]
        else:
            ans += top - map[i] + 0.5
            before = map[i]
        #print(ans - be_ans)
    return int(ans)


cross_section = list(input())
map = [0]
y = 0
for c in cross_section:
    if c == "/":
        y += 1
        map.append(y)
    elif c == "\\":
        y += -1
        map.append(y)
    else:
        map.append(y)
max_right = len(map) - 1
#print(map)
#print(len(map))

left = 0
right = 1
ans = []
while left < max_right:
    #print(left, right)
    if map[left] <= map[right]:
        left = right
        right += 1
        if right == max_right:
            left = max_right
    elif right == max_right:
        break
    else:
        right += 1
        if map[left] == map[right]:
            ans.append(calc_puddle(map, left, right))
        elif right == max_right:
            left += 1
            right = left + 1
            if right == max_right:
                left = max_right

print(sum(ans))
ans.insert(0, len(ans))
print_list_split_whitespace(ans)


Fixed submission:
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
    
s = list(input())
st1 = []
st2 = []

for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area

a = 0
k = len(st2)
ls = [k]
for _, s in st2:
    a += s
    ls.append(s)

print(a)
print_list_split_whitespace(ls)