Problem p02802 (python)

Fixed submission:
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_by_types(*value_types, delim=" "):
    return tuple(
        [t(x) for t, x in zip(value_types, input().rstrip("\n").split(delim))])


def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0

    from collections import defaultdict
    ac_cache = defaultdict(int)
    wa_cache = defaultdict(int)
    ac_count = 0
    wa_count = 0
    wa = 0
    for i in range(m):

        p, result = get_next_by_types(int, str)

        if ac_cache[p] == 0:
            if result == 'AC':

                ac_cache[p] = 1
                ac_count += 1
                wa_count += wa_cache[p]
                wa = 0
            else:
                wa_cache[p] += 1
    print(ac_count, wa_count)


if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Buggy submission (verdict: Runtime Error):
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])
def solve(maze, start_r, start_c):
    
    distances = {}
    offsets = [(-1,0),(1,0),(0,-1),(0,1)]
    
    distances[start_r, start_c] = 0
    candidates = [(start_r, start_c)]
    
    while candidates:
        r, c= candidates.pop(0)
        
        for offset_r, offset_c in offsets:
            move_r, move_c = r + offset_r, c + offset_c
            if not (move_r, move_c) in distances and maze[move_r, move_c] == ".":
                distances[move_r, move_c] = distances[r, c] + 1
                candidates.append((move_r, move_c))
    
    return max(distances.values())
    

def main():
    h, w = get_next_ints()
    from collections import defaultdict
    maze = defaultdict(str)
    for r in range(h):
        line = get_next_str()
        for c in range(w):
            maze[r,c] = line[c]
    
    results = []
    for r in range(h):
        for c in range(w):
            result = solve(maze, r, c)
            results.append(result)
    
    print(max(results))
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Buggy submission (verdict: Runtime Error):
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def get_next_by_types(*value_types,delim=" "):
    """標準入力をスペースで分割し、それぞれを任意のタイプにcastします
    row, col, text = get_next_by_types(int, int ,str)
    """
    return tuple([t(x) for t, x in zip(value_types,input().rstrip("\n").split(delim))])

def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0
    
    ac_found = False
    wa = 0
    prev_p = -1
    for i in range(m):
        
        p, result = get_next_by_types()
        if p != prev_p:
            prev_p = p
            if ac_found:
                ac_count += 1
                wa_count += wa
            ac_found = False
            wa = 0
        if not ac_found:
            if result == 'AC':
                ac_found = True
            else:
                wa += 1
    if ac_found:
        ac_count += 1
        wa_count += wa
    print(ac_count, wa_count)
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Buggy submission (verdict: Runtime Error):
def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0
    
    ac_found = False
    wa = 0
    prev_p = -1
    for i in range(m):
        
        p, result = input().rstrip("\n").split(" ")
        if p != prev_p:
            prev_p = p
            if ac_found:
                ac_count += 1
                wa_count += wa
            ac_found = False
            wa = 0
        if not ac_found:
            if result == 'AC':
                ac_found = True
            else:
                wa += 1
    if ac_found:
        ac_count += 1
        wa_count += wa
    print(ac_count, wa_count)
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())

Buggy submission (verdict: Runtime Error):

def get_next_by_types(*value_types,delim=" "):
    """標準入力をスペースで分割し、それぞれを任意のタイプにcastします
    row, col, text = get_next_by_types(int, int ,str)
    """
    return tuple([t(x) for t, x in zip(value_types,input().rstrip("\n").split(delim))])

def main():
    n, m = get_next_ints()
    ac_count = 0
    wa_count = 0
    
    ac_found = False
    wa = 0
    prev_p = -1
    for i in range(m):
        
        p, result = get_next_by_types(int, str)
        if p != prev_p:
            prev_p = p
            if ac_found:
                ac_count += 1
                wa_count += wa
            ac_found = False
            wa = 0
        if not ac_found:
            if result == 'AC':
                ac_found = True
            else:
                wa += 1
    if ac_found:
        ac_count += 1
        wa_count += wa
    print(ac_count, wa_count)
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())