Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
A = []
for i in range(N):
    j = Y.index(X[i])
    A.append((Y[:j] + Y[j+1:])[(N-1)//2])
print('\n'.join(map(str, A)))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
l, r = Y[N//2-1], Y[N//2]
A = []
for i in range(N):
    if X[i] <= l:
        A.append(r)
    else:
        A.append(l)
print('\n'.join(map(str, A)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
A = []
for i in range(N):
    j = Y.index(X[i])
    A.append((Y[:j] + Y[j+1:])[(N-1)//2])
print('\n'.join(map(str, A)))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
l, r = Y[N//2-1], Y[N//2]
A = []
for i in range(N):
    if X[i] <= l:
        A.append(r)
    else:
        A.append(l)
print('\n'.join(map(str, A)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(sorted(X[:i] + X[i+1:])[(N-1)//2])
print('\n'.join(map(str, A)))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
l, r = Y[N//2-1], Y[N//2]
A = []
for i in range(N):
    if X[i] <= l:
        A.append(r)
    else:
        A.append(l)
print('\n'.join(map(str, A)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(sorted(X[:i] + X[i+1:])[(N-1)//2])
print('\n'.join(map(str, A)))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
l, r = Y[N//2-1], Y[N//2]
A = []
for i in range(N):
    if X[i] <= l:
        A.append(r)
    else:
        A.append(l)
print('\n'.join(map(str, A)))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
N = int(input())
names = {}
for _ in range(N):
    S = input()
    if S[0] in 'MARCH':
        if S[0] not in names:
            names[S[0]] = 1
        else:
            names[S[0]] += 1
comb = len(names)
if comb <= 2:
    print(0)
elif comb == 3:
    ret = 1
    for v in names.values():
        ret *= v
    print(ret)
elif comb == 4:
    tmp = 1
    for v in names.values():
        tmp *= v
    ret = 0
    for v in names.values():
        ret += tmp // v
    print(ret)
else:
    ret = 0
    for comb in combinations('MARCH', 3):
        tmp = 1
        for c in comb:
            tmp *= names[c]
        ret += comb
    print(ret)

Fixed submission:
from itertools import combinations
N = int(input())
names = {}
for _ in range(N):
    S = input()
    if S[0] in 'MARCH':
        if S[0] not in names:
            names[S[0]] = 1
        else:
            names[S[0]] += 1
comb = len(names)
if comb <= 2:
    print(0)
elif comb == 3:
    ret = 1
    for v in names.values():
        ret *= v
    print(ret)
elif comb == 4:
    tmp = 1
    for v in names.values():
        tmp *= v
    ret = 0
    for v in names.values():
        ret += tmp // v
    print(ret)
else:
    ret = 0
    for comb in combinations('MARCH', 3):
        tmp = 1
        for c in comb:
            tmp *= names[c]
        ret += tmp
    print(ret)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations
N = int(input())
names = {}
for _ in range(N):
    S = input()
    if S[0] in 'MARCH':
        if S[0] not in names:
            names[S[0]] = 1
        else:
            names[S[0]] += 1
comb = len(names)
if comb <= 2:
    print(0)
elif comb == 3:
    ret = 1
    for v in names.values():
        ret *= v
    print(ret)
elif comb == 4:
    tmp = 1
    for v in names.values():
        tmp *= v
    ret = 0
    for v in names.values():
        ret += tmp // v
    print(ret)
else:
    ret = 0
    for comb in combinations('MARCH', 3):
        tmp = 1
        for c in comb:
            tmp *= c
        ret += comb
    print(ret)

Fixed submission:
from itertools import combinations
N = int(input())
names = {}
for _ in range(N):
    S = input()
    if S[0] in 'MARCH':
        if S[0] not in names:
            names[S[0]] = 1
        else:
            names[S[0]] += 1
comb = len(names)
if comb <= 2:
    print(0)
elif comb == 3:
    ret = 1
    for v in names.values():
        ret *= v
    print(ret)
elif comb == 4:
    tmp = 1
    for v in names.values():
        tmp *= v
    ret = 0
    for v in names.values():
        ret += tmp // v
    print(ret)
else:
    ret = 0
    for comb in combinations('MARCH', 3):
        tmp = 1
        for c in comb:
            tmp *= names[c]
        ret += tmp
    print(ret)
Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

def res(a, b, c, A, memo):
    if memo[a][b]:
        return None
    else:
        memo[a][b] = True
    if c < 0:
        return None
    if a+b+c == N:
        A.append([a, b, c])
        return None
    if a+b+c < N:
        return None
    res(a+1, b, c-10, A, memo)
    res(a, b+1, c-5, A, memo)
    return A

has_visit = [[False for i in range(Y//5000+2)] for j in range(Y//10000+2)]
A = res(0, 0, Y//1000, [], has_visit)
result = A[0] if A else [-1, -1, -1]
print(' '.join(map(str, result)))

Fixed submission:
N, Y = map(int, input().split())

def main(Y):
    for i in range(Y//5000+1):
        b = i
        c = Y//1000 - 5*i
        if b//2 + b%2 + c <= N <= b + c:
            for j in range(b//2+1):
                if j + (b - 2*j) + c == N:
                    return (j, b - 2*j, c)
    return (-1, -1, -1)

result = main(Y)
print(' '.join(map(str, result)))

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

def res(a, b, c, A, memo):
    if memo[a][b]:
        return None
    else:
        memo[a][b] = True
    if c < 0:
        return None
    if a+b+c == N:
        A.append([a, b, c])
        return None
    if a+b+c < N:
        return None
    res(a+1, b, c-10, A, memo)
    res(a, b+1, c-5, A, memo)
    return A

has_visit = [[False for i in range(Y//5000+2)] for j in range(Y//10000+2)]
A = res(0, 0, Y//1000, [], has_visit)
result = A[0] if A else [-1, -1, -1]
print(' '.join(map(str, result)))

Fixed submission:
N, Y = map(int, input().split())

def main(Y):
    for i in range(Y//5000+1):
        b = i
        c = Y//1000 - 5*i
        if b//2 + b%2 + c <= N <= b + c:
            for j in range(b//2+1):
                if j + (b - 2*j) + c == N:
                    return (j, b - 2*j, c)
    return (-1, -1, -1)

result = main(Y)
print(' '.join(map(str, result)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# A.sort(reverse=True)
# B.sort(reverse=True)
# C.sort(reverse=True)
# C.append(-1)
a_count = [0 for i in range(N)]
b_count = [0 for i in range(N)]
# i, j = 0, 0
# while i < N:
#     if B[i] >= C[j]:
#         b_count[i] = j
#         i += 1
#     else:
#         j += 1
for i in range(N):
    for j in range(N):
        if B[i] < C[j]:
            b_count[i] += 1
for i in range(N):
    for j in range(N):
        if A[i] < B[j]:
            a_count[i] += b_count[j]
print(sum(a_count))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
c_cnt = [1 for i in range(N)]

def count(A, B, b_cnt):
    B.append(-1)
    a_cnt = [0 for i in range(N)]
    i, j = 0, 0
    while i < N:
        if A[i] < B[j]:
            a_cnt[i] += b_cnt[j]
            j += 1
        else:
            i += 1
            if 1 <= i < N:
                a_cnt[i] = a_cnt[i-1]
    return a_cnt

b_cnt = count(B, C, c_cnt)
a_cnt = count(A, B, b_cnt)
print(sum(a_cnt))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# A.sort(reverse=True)
# B.sort(reverse=True)
# C.sort(reverse=True)
# C.append(-1)
a_count = [0 for i in range(N)]
b_count = [0 for i in range(N)]
# i, j = 0, 0
# while i < N:
#     if B[i] >= C[j]:
#         b_count[i] = j
#         i += 1
#     else:
#         j += 1
for i in range(N):
    for j in range(N):
        if B[i] < C[j]:
            b_count[i] += 1
for i in range(N):
    for j in range(N):
        if A[i] < B[j]:
            a_count[i] += b_count[j]
print(sum(a_count))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
c_cnt = [1 for i in range(N)]

def count(A, B, b_cnt):
    B.append(-1)
    a_cnt = [0 for i in range(N)]
    i, j = 0, 0
    while i < N:
        if A[i] < B[j]:
            a_cnt[i] += b_cnt[j]
            j += 1
        else:
            i += 1
            if 1 <= i < N:
                a_cnt[i] = a_cnt[i-1]
    return a_cnt

b_cnt = count(B, C, c_cnt)
a_cnt = count(A, B, b_cnt)
print(sum(a_cnt))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
x1, x2, x3 = 0, 0, 0
for k, v in c.items():
    if v >= 4:
        if k > maxval1:
            x1 = k
    if v >= 2:
        if k > maxval1:
            x1, x2 = k, x1
        elif k > maxval2:
            x2 = k
        else:
            pass
print(max(x1*x1, x2*x3))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
x1, x2, x3 = 0, 0, 0
for k, v in c.items():
    if v >= 4:
        if k > x1:
            x1 = k
    if v >= 2:
        if k > x2:
            x2, x3 = k, x2
        elif k > x3:
            x3 = k
print(max(x1*x1, x2*x3))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
d = {}
for _ in range(M):
    a, b = map(int, input().split())
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
for i in d[1]:
    if N in d[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
d = {}
for _ in range(M):
    a, b = map(int, input().split())
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
if 1 not in d:
    print('IMPOSSIBLE')
else:
    for i in d[1]:
        if i in d:
            if N in d[i]:
                print('POSSIBLE')
                break
    else:
        print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
B = []
for a in A:
    B.append(a)
    B.reverse()
print(' '.join(map(str, B)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if N%2 == 0:
    I = [i for i in range(N-1, 0, -2)] + [i for i in range(0, N, 2)]
else:
    I = [i for i in range(N-1, -1, -2)] + [i for i in range(1, N, 2)]
for i in I:
    print(A[i], end=' ')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
color = [False] * 8
over3200 = 0
for a in A:
    for i in range(8):
        if 400*i =< a < 400*(i+1):
            color[i] = True
            break
    else:
        over3200 += 1
if sum(color):
    print(sum(color), end=' ')
    print(sum(color) + over3200)
else:
    print(1, end=' ')
    print(over3200)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
color = [False] * 8
over3200 = 0
for a in A:
    for i in range(8):
        if a < 400*(i+1):
            color[i] = True
            break
    else:
        over3200 += 1
if sum(color):
    print(sum(color), end=' ')
    print(sum(color) + over3200)
else:
    print(1, end=' ')
    print(over3200)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p1, p2, p5 = 1, 1, 1
for _ in range(N):
    s = int(input())
    if s%10 == 0:
        pass
    elif s%5 == 0:
        p5 *= s
    elif s%2 == 0:
        p2 *= s
    else:
        p1 *= s
print(p1 * (max(p2, p3)))

Fixed submission:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
sums = sum(S)
if sums % 10 != 0:
    print(sums)
else:
    S.sort()
    for s in S:
        if s % 10 != 0:
            print(sums - s)
            break
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
from sys import setrecursionlimit; setrecursionlimit(10**9)
S = input()

def res(S, A, B):
    if not S:
        B.append(sum(list(map(int, A))))
        return None
    A += [S[0]]
    res(S[1:], A, B)
    A.pop()
    A[-1] += S[0]
    res(S[1:], A, B)
    return B

B = res(S[1:], [S[0]], [])
print(sum(B))

Fixed submission:
from sys import setrecursionlimit; setrecursionlimit(10**9)
S = input()

def res(S, A, B):
    if not S:
        B.append(sum(list(map(int, A))))
        return None
    A += [S[0]]
    res(S[1:], A, B)
    A.pop()
    A[-1] += S[0]
    res(S[1:], A, B)
    return B

if len(S) == 1:
    print(int(S))
else:
    B = res(S[1:], [S[0]], [])
    print(sum(B))

Buggy python submission (verdict: Runtime Error):
S = input()

def res(S, A, B):
    if not S:
        B.append(sum(list(map(int, A))))
        return None
    A += [S[0]]
    res(S[1:], A, B)
    A.pop()
    A[-1] += S[0]
    res(S[1:], A, B)
    return B

B = res(S[1:], [S[0]], [])
print(sum(B))

Fixed submission:
from sys import setrecursionlimit; setrecursionlimit(10**9)
S = input()

def res(S, A, B):
    if not S:
        B.append(sum(list(map(int, A))))
        return None
    A += [S[0]]
    res(S[1:], A, B)
    A.pop()
    A[-1] += S[0]
    res(S[1:], A, B)
    return B

if len(S) == 1:
    print(int(S))
else:
    B = res(S[1:], [S[0]], [])
    print(sum(B))
Buggy python submission (verdict: Runtime Error):
def search(prev, start, stop):
    global nodes, edges
    for neigh in nodes[start]:
        if neigh==prev:
            continue
        if neigh==stop:
            return [stop,start]
        res=search(start,neigh,stop)
        if res!=False:
            res.append(start)
            return res
    return False

def size(prev, curr):
    su=1
    global nodes, edges
    for neigh in nodes[curr]:
        if neigh==prev:
            continue
        su+=size(curr,neigh)
    return su

n=int(input())
nodes=[[] for i in range (n)]
edges=[]
for i in range(n-1):
    line=input().split()
    a=int(line[0])-1
    b=int(line[1])-1
    edges.append([a,b])
    nodes[b].append(a)
    nodes[a].append(b)

res=search(-1,n-1,0)

fennec=(len(res)-1)//2
snuke=fennec+1
snuke=res[snuke]
fennec=res[fennec]
fennecsize=size(snuke,fennec)
snukesize=size(fennec,snuke)

if fennecsize>snukesize:
    print ("Fennec")
else:
    print("Snuke")


Fixed submission:
import sys
sys.setrecursionlimit(10000000)
def search(prev, start, stop):
    global nodes, edges
    for neigh in nodes[start]:
        if neigh==prev:
            continue
        if neigh==stop:
            return [stop,start]
        res=search(start,neigh,stop)
        if res!=False:
            res.append(start)
            return res
    return False

def size(prev, curr):
    su=1
    global nodes, edges
    for neigh in nodes[curr]:
        if neigh==prev:
            continue
        su+=size(curr,neigh)
    return su

n=int(input())
nodes=[[] for i in range (n)]
edges=[]
for i in range(n-1):
    line=input().split()
    a=int(line[0])-1
    b=int(line[1])-1
    edges.append([a,b])
    nodes[b].append(a)
    nodes[a].append(b)

res=search(-1,n-1,0)

fennec=(len(res)-1)//2
snuke=fennec+1
snuke=res[snuke]
fennec=res[fennec]
fennecsize=size(snuke,fennec)
snukesize=size(fennec,snuke)

if fennecsize>snukesize:
    print ("Fennec")
else:
    print("Snuke")
Buggy python submission (verdict: Runtime Error):

line1=input().split()
n=int(line1[0])
a=int(line1[1])
nums=input().split()
for i in range(n):
    nums[i]=int(nums[i])-a

works={}

print (works)
s=0
for x in nums:

    if x>=0:
        for i in range(50*n,-50*n, -1):
            try:
                works[i]+=works[i-x]
            except:
                try:
                    works[i]=works[i-x]
                except:
                    pass
    else:
        for i in range (-50*n,50*n):
            try:
                works[i+x]+=works[i]
            except:
                try:
                    works[i+x]=works[i]
                except:
                    pass

print (works[0]-1)


Fixed submission:

line1=input().split()
n=int(line1[0])
a=int(line1[1])
nums=input().split()
for i in range(n):
    nums[i]=int(nums[i])-a

works={}

works[0]=1
s=0
for x in nums:

    if x>=0:
        for i in range(50*(n+1),-50*(n+1), -1):
            try:
                works[i]+=works[i-x]
            except:
                try:
                    works[i]=works[i-x]
                except:
                    pass
    else:
        for i in range (-50*(n+1),50*(n+1)):
            try:
                works[i+x]+=works[i]
            except:
                try:
                    works[i+x]=works[i]
                except:
                    pass

print (works[0]-1)
Buggy python submission (verdict: Runtime Error):
import math as m
from functools import reduce
 
n=int(input())
l=[]
def f(a,b):
    return int(a*b/m.gcd(a,b))
for i in range(n):
    l.add(int(input()))
print(reduce(f,l))

Fixed submission:

a=input()
if a[0]==a[2]:
    print("Yes")
else:print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

compare_str = S[K - 1]
result_str = ''
for s in list(S):
    if compare_str == s:
	result_str += s
    else:
	result_str += '*'
print(result_str)

Fixed submission:
N = int(input())
S = input()
K = int(input())

compare_str = S[K - 1]
result_str = ''
for s in list(S):
  if compare_str == s:
    result_str += s
  else:
    result_str += '*'
print(result_str)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

num_of_white = 0
num_of_black = 0

for i in range(1, N):
  if S[idx] == '.':
    num_of_white += 1

result = num_of_white

for i in range(1, N):
  if S[i-1] == '#':
    num_of_black += 1
  if S[i] == '.':
    num_of_white -= 1
  
  if result > (num_of_black + num_of_white):
    result = num_of_black + num_of_white

print(result)

Fixed submission:
N = int(input())
S = input()

num_of_white = 0
num_of_black = 0

for i in range(1, N):
  if S[i] == '.':
    num_of_white += 1

result = num_of_white

for i in range(1, N):
  if S[i-1] == '#':
    num_of_black += 1
  if S[i] == '.':
    num_of_white -= 1
  
  if result > (num_of_black + num_of_white):
    result = num_of_black + num_of_white

print(result)
Buggy python submission (verdict: Runtime Error):
import re
# イテレーションのため
input()
S = input()
K = int(input())

print(re.sub(r'[^%s]' %S[K] , '*', S))

Fixed submission:
import re
# イテレーションのため
input()
S = input()
K = int(input())

print(re.sub(r'[^%s]' %S[K - 1] , '*', S))
Buggy python submission (verdict: Runtime Error):
H, W = list(map(int, input()))
h, w = list(map(int, input()))

total = H * W
black = h * W + H * w - h * w
white = total - black
print(white)

Fixed submission:
H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))

total = H * W
black = h * W + H * w - h * w
white = total - black
print(white)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M, C = list(map(int, input().split()))
Bs = list(map(int, input().split()))

def is_correct(As):
  return np.inner(As, Bs) + C > 0

As = list(map(int, input().split()))
n = 0
while As:
  if is_correct(As):
    n += 1
  try:
	As = list(map(int, input().split()))
  except:
    break
  
print(n)

Fixed submission:
import numpy as np
N, M, C = list(map(int, input().split()))
Bs = list(map(int, input().split()))

def is_correct(As):
  return np.inner(As, Bs) + C > 0

As = list(map(int, input().split()))
n = 0
while As:
  if is_correct(As):
    n += 1
  try:
    As = list(map(int, input().split()))
  except:
    break
  
print(n)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s.replace(","," ")

Fixed submission:
s = input().replace(","," ")
print(s)

Buggy python submission (verdict: Runtime Error):
s = input()
prin(s.replace(","," ")

Fixed submission:
s = input().replace(","," ")
print(s)

Buggy python submission (verdict: Runtime Error):
s = str(input())
print(s.replace(',',' ')

Fixed submission:
s = input().replace(","," ")
print(s)

Buggy python submission (verdict: Runtime Error):
a = input()
print(a.replace(',',' ')

Fixed submission:
s = input().replace(","," ")
print(s)
Buggy python submission (verdict: Runtime Error):
c = str(inout())
if c = 'a' or 'e' or 'i' or 'o' or 'u' :
  print('vowel')
else :
  print('consonant')

Fixed submission:
C = ["a","e","i","o","u"]
print("vowel" if input() in C else "consonant")
Buggy python submission (verdict: Runtime Error):
a, b, h = map(int(input).sprit())

print((a + b) * h / 2)

Fixed submission:
a,b,h=map(int,open(0))
 
print((a+b)*h//2)
Buggy python submission (verdict: Runtime Error):
n, k, x, y = int(input())

if n > k :
  print(k*x+(n-k)*y)
else:
  print(n*x)


Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
 
if n <= k :
  print(n * x)
else :
  print(k * x + (n - k) * y)
Buggy python submission (verdict: Runtime Error):
a = int(input())
if a == 17 :
  print('YES')
else :
  print('NO')

Fixed submission:
if input() in ('5 5 7', '5 7 5', '7 5 5') :
  print('YES')
else :
  print('NO')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())

if (a < b):
  return True if a < c and c < b else False

if (a > b):
  return True if b < c and c < a else False

Fixed submission:
a,b,c = map(int, input().split())

if a < b :
  ans = 'Yes' if a < c and c < b else 'No'

if a > b :
  ans =  'Yes' if b < c and c < a else 'No'

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

r = s.count('R')

if (r > s // 2):
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
s = input()

r = s.count('R')
b = len(s) - r

if (r > b):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
str = input()
ans = ''
tmp = ''
for s in str:
  if (s in ['A', 'T', 'G', 'C']):
    tmp += s
    if (len(tmp) > len(ans):
        ans = tmp
  else:
    tmp = ''

print(ans)
    

Fixed submission:
str = list(input())

tmp = ''
ans = ''
for s in str:
  if (s in ['A', 'T', 'G', 'C']):
    tmp += s
    if (len(tmp) > len(ans)):
      ans = tmp
  else:
    tmp = ''

print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
str = input()
q = int(q)
for i in range(q):
  s,e = map(int,input().split())
  tmp = str[s-1:e]
  ans = tmp.count('AC')
  print(ans)

Fixed submission:
n,q = map(int,input().split())
str = input()
q = int(q)
dic = {}

for j in range(len(str)):
  if (j > 0):
    if (str[j-1] == 'A' and str[j] == 'C'):
      dic[j] = dic[j-1] + 1
    else:
      dic[j] = dic[j-1]
  else:
    dic[j] = 0

for i in range(q):
  s,e = map(int,input().split())
  ans = dic[e-1] - dic[s-1]
  print(ans)

Buggy python submission (verdict: Runtime Error):
n,q = int(input().split(' '))
str = input()
for i in range(q):
  s,e = int(input().split(' '))
  tmp = s[s-1:e]
  ans = tmp.count('AC')
  print(ans)

Fixed submission:
n,q = map(int,input().split())
str = input()
q = int(q)
dic = {}

for j in range(len(str)):
  if (j > 0):
    if (str[j-1] == 'A' and str[j] == 'C'):
      dic[j] = dic[j-1] + 1
    else:
      dic[j] = dic[j-1]
  else:
    dic[j] = 0

for i in range(q):
  s,e = map(int,input().split())
  ans = dic[e-1] - dic[s-1]
  print(ans)