Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
import sympy
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)

print(len(sympy.factorint(tmp)) + 1)


Fixed submission:
import sys
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)
for i in range(1, int(tmp ** 0.5) + 1):
    if tmp % i == 0:
        glst.append(i)
        if i != tmp // i:
            glst.append(tmp // i)

glst.sort()
cnt = 0
for i in range(1, len(glst) + 1):
    cntF = True
    for j in range(i + 1, len(glst) + 1):
        if gcd(glst[-i], glst[-j]) != 1:
            cntF = False
            break

    if cntF:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)
for i in range(1, (tmp // 2) + 1):
    if tmp % i == 0:
        glst.append(i)
glst.append(tmp)
cnt = 0
for i in range(1, len(glst) + 1):
    cntF = True
    for j in range(i + 1, len(glst) + 1):
        if gcd(glst[-i], glst[-j]) != 1:
            cntF = False
            break

    if cntF:
        cnt += 1

print(cnt)

Fixed submission:
import sys
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)
for i in range(1, int(tmp ** 0.5) + 1):
    if tmp % i == 0:
        glst.append(i)
        if i != tmp // i:
            glst.append(tmp // i)

glst.sort()
cnt = 0
for i in range(1, len(glst) + 1):
    cntF = True
    for j in range(i + 1, len(glst) + 1):
        if gcd(glst[-i], glst[-j]) != 1:
            cntF = False
            break

    if cntF:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)
for i in range(1, (tmp // 2) + 1):
    if tmp % i == 0:
        glst.append(i)
glst.append(tmp)
cnt = 0
for i in range(1, len(glst) + 1):
    cntF = True
    for j in range(i + 1, len(glst) + 1):
        if gcd(glst[-i], glst[-j]) != 1:
            cntF = False
            break

    if cntF:
        cnt += 1

print(cnt)

Fixed submission:
import sys
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)
for i in range(1, int(tmp ** 0.5) + 1):
    if tmp % i == 0:
        glst.append(i)
        if i != tmp // i:
            glst.append(tmp // i)

glst.sort()
cnt = 0
for i in range(1, len(glst) + 1):
    cntF = True
    for j in range(i + 1, len(glst) + 1):
        if gcd(glst[-i], glst[-j]) != 1:
            cntF = False
            break

    if cntF:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
INF = 10 ** 18
N, M = map(int, input().split())
dp = [[INF for _ in range(1 << N)] for _ in range(M + 1)]
cost = [0] * M
bit = [0] * M
for i in range(M):
    cost[i], b = map(int, input().split())
    c = list(map(int, input().split()))
    d = 0
    for j in range(len(c)):
        d |= 1 << (c[j] - 1)
    bit[i] = d

dp[0][0] = 0
for i in range(M):
    for j in range(1 << N):
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])
        to = bit[i] | j
        dp[i + 1][to] = min(dp[i + 1][to], dp[i][j] + cost[i])

ans = dp[M][(1 << N) - 1]
if ans == INF:
    print(-1)
else:
    print(ans)


Fixed submission:
INF = 10 ** 18
N, M = map(int, input().split())
dp = [[INF for _ in range(1 << N)] for _ in range(M + 1)]
cost = [0] * M
bit = [0] * M
for i in range(M):
    cost[i], b = map(int, input().split())
    c = list(map(int, input().split()))
    d = 0
    for j in range(len(c)):
        d |= 1 << (c[j] - 1)
    bit[i] = d

dp[0][0] = 0
for i in range(M):
    for j in range(1 << N):
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])
        to = bit[i] | j
        dp[i + 1][to] = min(dp[i + 1][to], dp[i][j] + cost[i])

ans = dp[M][(1 << N) - 1]
if ans == INF:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
lCnt = S.count('L')
rCnt = S.count('R')
tmp = ''
if lCnt < rCnt:
    tmp = 'L'
else:
    tmp = 'R'

sindex = 0
eindex = 0
secnt = 0
anslst = [list([0] * 3) for i in range(N)]

for i in range(N):
    if sindex == 0:
        if S[i] == tmp:
            sindex = i
        else:
            complex
    else:
        if S[i] != tmp:
            eindex = i - 1
            anslst[i][0] = sindex
            anslst[i][1] = eindex
            anslst[i][2] = eindex - sindex + 1
            sindex = 0
            eindex = 0
if sindex != 0:
    eindex = N - 1
    anslst[N - 1][0] = sindex
    anslst[N - 1][1] = eindex
    anslst[N - 1][2] = eindex - sindex + 1
anslst.sort(key=lambda x: x[2], reverse=True)

if tmp == 'R':
    tmp = 'L'
else:
    tmp = 'R'

for i in range(K):
    S = S[0:anslst[i][0]] + (tmp * anslst[i][2]) + S[anslst[i][1] + 1:]

ans = 0
if K == 1:
    for i in range(N - 1):
        if S[i] == tmp:
            if S[i] == S[i + 1]:
                ans += 1
else:
    for i in range(1, N - 1):
        if S[i] == tmp:
            if S[i] == S[i + 1]:
                ans += 1
    ans += anslst[0][2]

print(ans)

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

if S[0] == 'R':
    tmp = 'RL'
else:
    tmp = 'LR'
cnt = 0
ans = 0
for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        ans += 1
    if S[i:i + 2] == tmp:
        cnt += 1

if cnt > M:
    ans += 2 * M
else:
    ans += 2 * cnt

if N == ans:
    ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
A, B = map(int, input().split())
tmp = A
ans = 1
if B == 1:
    print(0)
    sys.exit()

while True:
    if A < B:
        A += tmp - 1
        ans += 1
    else:
        break

print(ans)w

Fixed submission:
import sys
A, B = map(int, input().split())
tmp = A
ans = 1
if B == 1:
    print(0)
    sys.exit()

while True:
    if A < B:
        A += tmp - 1
        ans += 1
    else:
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0

for i in range(1, N):
    ans += i

print(ans)

Fixed submission:
N = int(input())
print((N * (N - 1)) // 2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0

for i in range(1, N):
    ans += i

print(ans)

Fixed submission:
N = int(input())
print((N * (N - 1)) // 2)
Buggy python submission (verdict: Runtime Error):
from heapq import heappush, heappop N = int(input()) vLst = list(map(int, input().split())) v = [] for i in range(N): heappush(v, vLst[i]) ans = 0 for i in range(N - 1): tmp1 = heappop(v) tmp2 = heappop(v) ans = float((tmp1 + tmp2) / 2) heappush(v, ans) print(v[0])


Fixed submission:
from heapq import heappush, heappop

N = int(input())
vLst = list(map(int, input().split()))
v = []
for i in range(N):
    heappush(v, vLst[i])

ans = 0
for i in range(N - 1):
    tmp1 = heappop(v)
    tmp2 = heappop(v)
    ans = float((tmp1 + tmp2) / 2)
    heappush(v, ans)

print(v[0])
Buggy python submission (verdict: Runtime Error):
inf = 2019
L, R = map(int, input().split())
ans = 2018

for i in range(L, R):
    for j in range(i + 1, R + 1):
        tmp = int((i%inf * j%inf) % inf)
        ans = min(ans, tmp)
    if ans == 0:
        break

print(ans)

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

tmp1 = N * A
ans = min(tmp1, B)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math

def combnations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

INF = 10 ** 9 + 7
N, K = map(int, input().split())
for i in range(1, K + 1):
    if N - K + 1 < i:
        print(0)
        complex
    ans = (combnations(N - K + 1, i) % INF) * (combnations(K - 1, i - 1) % INF)
    print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
import math

def combnations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

INF = 10 ** 9 + 7
N, K = map(int, input().split())
for i in range(1, K + 1):
    if N - K + 1 < i:
        print(0)
        continue
    ans = combnations(N - K + 1, i) * combnations(K - 1, i - 1)
    ans %= INF
    print(ans)
Buggy python submission (verdict: Runtime Error):
X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)A

Fixed submission:
X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)
Buggy python submission (verdict: Time Limit Exceeded):
INF = (10 ** 9) + 7
N, M = map(int, input().split())
aLst = [0] * M

for i in range(M):
    aLst[i] = int(input())
ansLst = [0] * (N + 1)
ans = 0
ansLst[0] = 1
for i in range(1, N + 1):
    if aLst.count(i) == 1:
        continue
    tmp = ansLst[i - 1]
    if i > 1:
        tmp += ansLst[i - 2]
    ansLst[i] = tmp % INF


print(ansLst[N])


Fixed submission:
INF = (10 ** 9) + 7
N, M = map(int, input().split())

aLst = set(int(input()) for _ in range(M))
ansLst = [0] * (N + 1)
ansLst[0] = 1

for i in range(1, N + 1):
    if i in aLst:
        continue
    tmp = ansLst[i - 1]
    if i > 1:
        tmp += ansLst[i - 2]
    ansLst[i] = tmp % INF


print(ansLst[N])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
l = [[0] * W for _ in range(H)]
r = [[0] * W for _ in range(H)]
u = [[0] * W for _ in range(H)]
d = [[0] * W for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] != '#':
            if j != 0:
                r[i][j] = r[i][j - 1] + 1
            else:
                r[i][j] = 1

for i in range(H):
    for j in reversed(range(W)):
        if S[i][j] != '#':
            if j != W - 1:
                l[i][j] = l[i][j + 1] + 1
            else:
                l[i][j] = 1

for i in range(W):
    for j in range(H):
        if S[j][i] != '#':
            if j != 0:
                d[j][i] = d[j - 1][i] + 1
            else:
                d[j][i] = 1

for i in range(W):
    for j in reversed(range(H)):
        if S[j][i] != '#':
            if j != H - 1:
                u[j][i] = u[j + 1][i] + 1
            else:
                u[j][i] = 1

for i in range(H):
    for j in range(W):
        tmp = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3
        ans = max(ans, tmp)

print(ans)

Fixed submission:
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
l = [[0] * W for _ in range(H)]
r = [[0] * W for _ in range(H)]
u = [[0] * W for _ in range(H)]
d = [[0] * W for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] != '#':
            if j != 0:
                r[i][j] = r[i][j - 1] + 1
            else:
                r[i][j] = 1

for i in range(H):
    for j in reversed(range(W)):
        if S[i][j] != '#':
            if j != W - 1:
                l[i][j] = l[i][j + 1] + 1
            else:
                l[i][j] = 1

for i in range(W):
    for j in range(H):
        if S[j][i] != '#':
            if j != 0:
                d[j][i] = d[j - 1][i] + 1
            else:
                d[j][i] = 1

for i in range(W):
    for j in reversed(range(H)):
        if S[j][i] != '#':
            if j != H - 1:
                u[j][i] = u[j + 1][i] + 1
            else:
                u[j][i] = 1

for i in range(H):
    for j in range(W):
        tmp = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3
        ans = max(ans, tmp)

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
if int(S[2:]) >= 1 and int(S[2:]) <= 12:
    if int(S[:2]) <= 12 and int(S[:2]) >= 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif int(S[2:]) >= 13:
    if int(S[:2]) >= 1 and int(S[:2]) <= 12:
        print('MMYY')
    else:
        print('NA')
elif int(S[2:]) == 0:
    if int(S[:2]) >= 1 and int(S[:2] <= 12):
        print('MMYY')
    else:
        print('NA')
else:
    print('NA')

Fixed submission:
S = input()
if int(S[2:]) >= 1 and int(S[2:]) <= 12:
    if int(S[:2]) <= 12 and int(S[:2]) >= 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif int(S[2:]) >= 13:
    if int(S[:2]) >= 1 and int(S[:2]) <= 12:
        print('MMYY')
    else:
        print('NA')
else:
    if int(S[2:]) == 0:
        if int(S[:2]) >= 1 and int(S[:2]) <= 12:
            print('MMYY')
        else:
            print('NA')
    else:
        print('NA')

Buggy python submission (verdict: Runtime Error):
S = input()
if int(S[2:]) >= 1 and int(S[2:]) <= 12:
    if int(S[:2]) <= 12 and int(S[:2]) >= 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif int(S[2:]) >= 13:
    if int(S[:2]) >= 1 and int(S[:2]) <= 12:
        print('MMYY')
    else:
        print('NA')
else:
    if int(S[:2]) >= 1 and int(S[:2] <= 12):
        print('MMYY')
    else:
        print('NA')

Fixed submission:
S = input()
if int(S[2:]) >= 1 and int(S[2:]) <= 12:
    if int(S[:2]) <= 12 and int(S[:2]) >= 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif int(S[2:]) >= 13:
    if int(S[:2]) >= 1 and int(S[:2]) <= 12:
        print('MMYY')
    else:
        print('NA')
else:
    if int(S[2:]) == 0:
        if int(S[:2]) >= 1 and int(S[:2]) <= 12:
            print('MMYY')
        else:
            print('NA')
    else:
        print('NA')
Buggy python submission (verdict: Runtime Error):
N = int(input())

def dfs(v, u, w):
    if w % 2 == 0:
        iro[v] = 0
    else:
        iro[v] = 1
    for i in ki[v]:
        if i[1] == u: continue
        dfs(i[1], v, w + i[0])
    return

ki = [[] for _ in range(N)]
for i in range(N - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    ki[u].append((w, v))
    ki[v].append((w, u))

iro = [0] * N
dfs(0, 0, 0)
for i in iro:
    print(i)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

N = int(input())
d = [[] for _ in range(N)]
iro = [0] * (N)

def dfs(n, v, k):
    for i in d[n]:
        if k % 2 != 0:
            iro[n] = 1
        if v == i[0]:
            continue
        dfs(i[0], n, k + i[1])

for i in range(N - 1):
    u, v, w = map(int, input().split())
    v -= 1
    u -= 1
    d[u].append((v, w))
    d[v].append((u, w))

dfs(0, 0, 0)
for i in iro:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        tmp = int((R * i) + (G * j))
        if N >= tmp and (N - tmp) % B == 0:
            ans += 1
print(ans)


Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        tmp = int((R * i) + (G * j))
        if N >= tmp and (N - tmp) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        tmp = int((R * i) + (G * j))
        if N >= tmp and (N - tmp) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        tmp = int((R * i) + (G * j))
        if N >= tmp and (N - tmp) % B == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N = int(input())
aLst = list(map(int, input().split()))

ansLst = []
for i in range(len(aLst)):
    ans = 0
    for j in range(len(aLst)):
        if i != j:
            ans = fractions.gcd(ans, aLst[j])
    ansLst.append(ans)
ansLst.sort(reverse=True)
print(ansLst[0])


Fixed submission:
import fractions
N = int(input())
aLst = list(map(int, input().split()))

lans = 0
llst = [0] * (N + 1)
rans = 0
rlst = [0] * (N + 1)

for i in range(N):
    lans = fractions.gcd(lans, aLst[i])
    llst[i + 1] = lans

for i in range(N - 1, -1, -1):
    rans = fractions.gcd(rans, aLst[i])
    rlst[i] = rans

ansMax = 0
for i in range(N):
    ansMax = max(ansMax, fractions.gcd(llst[i], rlst[i + 1]))

print(ansMax)

Buggy python submission (verdict: Time Limit Exceeded):
def yuk(a, b):
    ans = int(a / b)
    amari = a % b
    if amari != 0:
        ans = yuk(b, amari)
    else:
        ans = b
    return ans

N = int(input())
aLst = list(map(int, input().split()))

ansLst = []
for i in range(len(aLst)):
    ans = 0
    for j in range(len(aLst)):
        if i != j:
            ans = yuk(ans, aLst[j])
    ansLst.append(ans)
ansLst.sort(reverse=True)
print(ansLst[0])

Fixed submission:
import fractions
N = int(input())
aLst = list(map(int, input().split()))

lans = 0
llst = [0] * (N + 1)
rans = 0
rlst = [0] * (N + 1)

for i in range(N):
    lans = fractions.gcd(lans, aLst[i])
    llst[i + 1] = lans

for i in range(N - 1, -1, -1):
    rans = fractions.gcd(rans, aLst[i])
    rlst[i] = rans

ansMax = 0
for i in range(N):
    ansMax = max(ansMax, fractions.gcd(llst[i], rlst[i + 1]))

print(ansMax)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
aLst = list(map(int, input().split()))

ansLst = []
for i in range(len(aLst)):
    ans = 0
    for j in range(len(aLst)):
        if i != j:
            ans = math.gcd(ans, aLst[j])
    ansLst.append(ans)
ansLst.sort(reverse=True)
print(ansLst[0])

Fixed submission:
import fractions
N = int(input())
aLst = list(map(int, input().split()))

lans = 0
llst = [0] * (N + 1)
rans = 0
rlst = [0] * (N + 1)

for i in range(N):
    lans = fractions.gcd(lans, aLst[i])
    llst[i + 1] = lans

for i in range(N - 1, -1, -1):
    rans = fractions.gcd(rans, aLst[i])
    rlst[i] = rans

ansMax = 0
for i in range(N):
    ansMax = max(ansMax, fractions.gcd(llst[i], rlst[i + 1]))

print(ansMax)
Buggy python submission (verdict: Time Limit Exceeded):
inList = []
startCnt = int(input())
goalCnt = 0
for i in range(5):
    inList.append(int(input()))
endCnt = startCnt
stausList = [0] * 5
cnt = 0
stausList[0] = startCnt
while goalCnt < endCnt:
    if inList[4] >= stausList[4]:
        goalCnt += stausList[4]
        stausList[4] = 0
    else:
        goalCnt += inList[4]
        stausList[4] -= inList[4]

    if stausList[4] == 0:
        if inList[3] >= stausList[3]:
            stausList[4] = stausList[3]
            stausList[3] = 0
        else:
            stausList[4] = inList[3]
            stausList[3] -= inList[3]
    else:
        if inList[3] >= abs(stausList[4] - stausList[3]):
            stausList[4] += abs(stausList[4] - stausList[3])
            stausList[3] -= abs(stausList[4] - stausList[3])
        else:
            stausList[4] += abs(stausList[4] - inList[3])
            stausList[3] -= abs(stausList[4] - inList[3])

    if stausList[3] == 0:
        if inList[2] >= stausList[2]:
            stausList[3] = stausList[2]
            stausList[2] = 0
        else:
            stausList[3] = inList[2]
            stausList[2] -= inList[2]
    else:
        if inList[2] >= abs(stausList[3] - stausList[2]):
            stausList[3] += abs(stausList[3] - stausList[2])
            stausList[2] -= abs(stausList[3] - stausList[2])
        else:
            stausList[3] += abs(stausList[3] - inList[2])
            stausList[2] -= abs(stausList[3] - inList[2])

    if stausList[2] == 0:
        if inList[1] >= stausList[1]:
            stausList[2] = stausList[1]
            stausList[1] = 0
        else:
            stausList[2] = inList[1]
            stausList[1] -= inList[1]
    else:
        if inList[1] >= abs(stausList[2] - stausList[1]):
            stausList[2] += abs(stausList[2] - stausList[1])
            stausList[1] -= abs(stausList[2] - stausList[1])
        else:
            stausList[2] += abs(stausList[2] - inList[1])
            stausList[1] -= abs(stausList[2] - inList[1])

    if stausList[1] == 0:
        if inList[0] >= stausList[0]:
            stausList[1] = stausList[0]
            stausList[0] = 0
        else:
            stausList[1] = inList[0]
            stausList[0] -= inList[0]
    else:
        if inList[0] >= abs(stausList[1] - stausList[0]):
            stausList[1] += abs(stausList[1] - stausList[0])
            stausList[0] -= abs(stausList[1] - stausList[0])
        else:
            stausList[1] += abs(stausList[1] - inList[0])
            stausList[0] -= abs(stausList[1] - inList[0])
    cnt += 1
print(cnt)

Fixed submission:
inList = []
startCnt = int(input())
goalCnt = 0
minLst = 1000000000000000
for i in range(5):
    A = int(input())
    inList.append(A)
    minLst = min(minLst, A)
ans = (-(-startCnt // minLst)) + 4
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

tmpList = []
for i in range(X):
    for j in range(Y):
        tmpList.append(a[i] + b[j])

tmpList.sort(reverse=True)
ansLst = []
for i in range(min(K, len(tmpList))):
    for j in c:
        ansLst.append(tmpList[i] + j)

ansLst.sort(reverse=True)

for i in range(K):
    print(ansLst[i])


Fixed submission:
X, Y, Z, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

tmpList = []
for i in range(X):
    for j in range(Y):
        tmpList.append(a[i] + b[j])

tmpList.sort(reverse=True)
ansLst = []
for i in range(min(K, len(tmpList))):
    for j in c:
        ansLst.append(tmpList[i] + j)

ansLst.sort(reverse=True)

for i in range(K):
    print(ansLst[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
anslst = []
for i in range(Q):
    l1, l2 = map(int,input().split())
    compStr = S[l1 - 1:l2]
    anslst.append(compStr.count('AC'))

for i in anslst:
    print(i)


Fixed submission:
N, Q = map(int, input().split())
S = input()
mLst = [0] * N
for i in range(N - 1):
    if S[i: i + 2] == 'AC':
        mLst[i + 1] = mLst[i] + 1
    else:
        mLst[i + 1] = mLst[i]

lLst = [list(map(int, input().split())) for i in range(Q)]

for i in range(Q):
    print(mLst[lLst[i][1] - 1] - mLst[lLst[i][0] - 1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
anslst = []
for i in range(Q):
    l1, l2 = map(int,input().split())
    compStr = S[l1 - 1:l2]
    anslst.append(compStr.count('AC'))

for i in anslst:
    print(i)


Fixed submission:
N, Q = map(int, input().split())
S = input()
mLst = [0] * N
for i in range(N - 1):
    if S[i: i + 2] == 'AC':
        mLst[i + 1] = mLst[i] + 1
    else:
        mLst[i + 1] = mLst[i]

lLst = [list(map(int, input().split())) for i in range(Q)]

for i in range(Q):
    print(mLst[lLst[i][1] - 1] - mLst[lLst[i][0] - 1])

Buggy python submission (verdict: Runtime Error):
8 3
ACACTACG
3 7
2 3
1 8

Fixed submission:
N, Q = map(int, input().split())
S = input()
mLst = [0] * N
for i in range(N - 1):
    if S[i: i + 2] == 'AC':
        mLst[i + 1] = mLst[i] + 1
    else:
        mLst[i + 1] = mLst[i]

lLst = [list(map(int, input().split())) for i in range(Q)]

for i in range(Q):
    print(mLst[lLst[i][1] - 1] - mLst[lLst[i][0] - 1])