Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        lines.append(input())
        tokens = lines[0].split(" ")
        n = int(tokens[0])
        q = int(tokens[1])
        lines.append(input())
        for i in range(q):
            lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
        print("lines=%s" % lines)
        tokens = lines[0].split(" ")
        n = int(tokens[0])
        q = int(tokens[1])

    s = lines[1]

    l = []
    r = []
    for i in range(q):
        tokens = lines[i+2].split(" ")
        l.append(int(tokens[0]))
        r.append(int(tokens[1]))

    return (n, q, s, l, r)

def solve(n, q, s, l, r):

#    result = []
    for i in range(q):
        b = l[i] - 1
        e = r[i] - 1
        count = 0
        ss = s[b:e+1]
        len_ss = len(ss)
        j = 0
        while j < len_ss:
#            print("ss=%s" % ss)
            if ss[j] == "A" and j + 1 < len_ss and ss[j+1] == "C":
                count = count + 1
                j = j + 2
            else:
                j = j + 1
        print(count)
#        result.append(count)
    
#    return result

def main():
    solve(*parse_input())
#    print("%d" % solve(*parse_input()))

if __name__ == '__main__':

    main()


Fixed submission:
# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    b = tokens[0]

    return (b,)


def solve(b):
    
    m = {
        "A": "T",
        "C": "G",
        "G": "C",
        "T": "A",
    }

    return m[b]

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    tokens = lines[0].split(" ")
    s = tokens[0]

    return (s,)


def solve(s):
    
    acgt = set(["A", "C", "G", "T"])

    count = 0
    count_set = set()
    for i, c in enumerate(s):
        if c in acgt:
            count = count + 1
        else:
            count_set.add(count)
            count = 0

    return max(count_set)

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()


Fixed submission:
# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    b = tokens[0]

    return (b,)


def solve(b):
    
    m = {
        "A": "T",
        "C": "G",
        "G": "C",
        "T": "A",
    }

    return m[b]

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()