Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = P[:X] + Q[:Y]
S.sort(reverse=True)

S_wa = []
wa = 0
for s in S[::-1]:
    wa += s
    S_wa.append(wa)
# print(S_wa)
big = S_wa[-1]
ans = S_wa[-1]

R_wa = []
wa = 0
for r in R:
    wa += r
    R_wa.append(wa)
# print(R_wa)

for i in range(len(R_wa)):
    ans = max(ans, big + R_wa[i] - S_wa[i])
print(ans)


Fixed submission:
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = P[:X] + Q[:Y]
S.sort(reverse=True)

S_wa = []
wa = 0
for s in S[::-1]:
    wa += s
    S_wa.append(wa)
# print(S_wa)
big = S_wa[-1]
ans = S_wa[-1]

R_wa = []
wa = 0
for r in R:
    wa += r
    R_wa.append(wa)
# print(R_wa)

kazu = min(len(R_wa), len(S_wa))

for i in range(kazu):
    ans = max(ans, big + R_wa[i] - S_wa[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = P[:X] + Q[:Y]
# print(S)

S_wa = []
wa = 0
for s in S[::-1]:
    wa += s
    S_wa.append(wa)
# print(S_wa)
big = S_wa[-1]
ans = S_wa[-1]

R_wa = []
wa = 0
for r in R:
    wa += r
    R_wa.append(wa)
# print(R_wa)

for i in range(len(R_wa)):
    ans = max(ans, big + R_wa[i] - S_wa[i])
print(ans)

Fixed submission:
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = P[:X] + Q[:Y]
S.sort(reverse=True)

S_wa = []
wa = 0
for s in S[::-1]:
    wa += s
    S_wa.append(wa)
# print(S_wa)
big = S_wa[-1]
ans = S_wa[-1]

R_wa = []
wa = 0
for r in R:
    wa += r
    R_wa.append(wa)
# print(R_wa)

kazu = min(len(R_wa), len(S_wa))

for i in range(kazu):
    ans = max(ans, big + R_wa[i] - S_wa[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
a, b = map(int, input().split())
print(gcd(a,b))

Fixed submission:
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

a, b = map(int, input().split())
print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
N, S = int(input()), list(input())

S_set = set(S)
ans = 0
for num in range(0, 1000):
    n0, n1, n2 = list(str(num).zfill(3))
    if n0 in S_set and n1 in S_set and n2 in S_set:
        idx0 = S.idx(n0)
        idx2 = N - S[::-1].idx(n2) - 1
        if idx0 < idx2:
            if n1 in S[idx0 + 1: idx2]:
                ans += 1
print(ans)

Fixed submission:
def canMakeNumber(k, s):
    k = str(k).zfill(3)
    dic = {0: False, 1: False, 2: False}
    rep = False
    for t in s:
        if dic[0] is False:
            if t == k[0]:
                dic[0] = True
        else:
            if dic[1] is False:
                if t == k[1]:
                    dic[1] = True
            else:
                if dic[2] is False:
                    if t == k[2]:
                        dic[2] = True
                else:
                    continue
    if dic[0] == dic[1] == dic[2] == True:
        rep = True
    return rep


N = int(input())
S = input()
ans = 0
for i in range(0, 1000):
    if canMakeNumber(i, str(S)):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def canMakeNumber(k, s):
    k = str(k).zfill(3)
    dic = {0: False, 1: False, 2: False}
    rep = False
    for t in s:
        if dic[0] is False:
            if t == k[0]:
                dic[0] = True
        else:
            if dic[1] is False:
                if t == k[1]:
                    dic[1] = True
            else:
                if dic[2] is False:
                    if t == k[2]:
                        dic[2] = True
                else:
                    continue
    if dic[0] == dic[1] == dic[2] == True:
        rep = True
    return rep


N = int(input())
S = input()
ans = 0
for i in range(0, 1000):
    if canMakeNumber(i, str(S)):
        ans += 1
print(ans)


Fixed submission:
def canMakeNumber(k, s):
    k = str(k).zfill(3)
    dic = {0: False, 1: False, 2: False}
    rep = False
    for t in s:
        if dic[0] is False:
            if t == k[0]:
                dic[0] = True
        else:
            if dic[1] is False:
                if t == k[1]:
                    dic[1] = True
            else:
                if dic[2] is False:
                    if t == k[2]:
                        dic[2] = True
                else:
                    continue
    if dic[0] == dic[1] == dic[2] == True:
        rep = True
    return rep


N = int(input())
S = input()
ans = 0
for i in range(0, 1000):
    if canMakeNumber(i, str(S)):
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h, w, k = map(int, input().split())
SS = [list(input()) for _ in range(h)]
num = 1
ans = [[0] * w for _ in range(h)]

for i in range(h):
    S = SS[i]

    if S != ['.'] * w:
        for j in range(w):
            s = S[j]
            if s == '#':
                ans[i][j] = num
                if j != w - 1:
                    if '#' in S[j + 1:]:
                        num += 1
            else:
                ans[i][j] = num
        num += 1
    else:
        if i != h - 1:
            for j in range(w):
                ans[i][j] = ans[i + 1][j]
        else:
            for j in range(w):
                ans[i][j] = ans[i - 1][j]
        continue
flag = False
while True:
    if flag is True:
        break
    alll = []
    for i in range(h):
        alll += ans[i]
    if 0 not in alll:
        flag = True
    for i in range(h):
        S = SS[i]
        if S == ['.'] * w:
            if i != h - 1:
                for j in range(w):
                    ans[i][j] = ans[i + 1][j]
            else:
                for j in range(w):
                    ans[i][j] = ans[i - 1][j]


for a in ans:
    a = list(map(str, a))
    print(' '.join(a))


Fixed submission:
h, w, k = map(int, input().split())
SS = [list(input()) for _ in range(h)]
num = 1
ans = [[0] * w for _ in range(h)]

for i in range(h):
    S = SS[i]

    if S != ['.'] * w:
        for j in range(w):
            s = S[j]
            if s == '#':
                ans[i][j] = num
                if j != w - 1:
                    if '#' in S[j + 1:]:
                        num += 1
            else:
                ans[i][j] = num
        num += 1

cnt = 1

for num, a in enumerate(ans):
    if a == [0] * w:
        cnt += 1
        continue
    else:
        for i in range(cnt):
            a = list(map(str, a))
            print(' '.join(a))
        cnt = 1

cnt1 = 0
if cnt != 1:
    p = []
    ans = ans[::-1]
    for i in range(h):
        b = ans[i]
        if b == [0] * w:
            cnt1 += 1
        else:
            for j in range(cnt1):
                b = list(map(str, b))
                print(' '.join(b))
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
# n ^ m (繰り返し二乗法) (mod p)
def power_mod(n, m, p):
    if m == 0:
        return 1
    if m % 2 == 0:
        d = power_mod(n, m // 2, p)
        return (d * d) % p
    else:
        return (n * power_mod(n, m - 1, p)) % p


# a ^ (p-2) ≡ a^(-1) (mod p)
def gyakugenn(a, p):
    return power_mod(a, p - 2, p)


# nCk (mod p)
# n!/(n-k)!k!
def mod_comb(n, k, p):
    rep = 1
    for i in range(1, n + 1):
        rep = rep * i % p
    for i in range(1, k + 1):
        rep = rep * gyakugenn(i, p) % p
    for i in range(1, n - k + 1):
        rep = rep * gyakugenn(i, p) % p
    return rep


X, Y = map(int, input().split())
x = (2 * Y - X) / 3
y = (2 * X - Y) / 3

if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0:
    print(0)
    exit()
else:
    x = int(x)
    y = int(y)

if x < 0 or y < 0:
    print(0)
    exit()

if x < y:
    x, y = y, x

p = 10 ** 9 + 7
print(mod_comb(x + y, y, p))


Fixed submission:

def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0], w[1]]


def mod_inv(a, m):
    x = extgcd(a, m)[0]
    return (m+x % m) % m


def mod_e(n, p):
    res = 0
    while n >= p:
        res += n//p
        n = n//p
    return res


def mod_fact(n, p):
    if n == 0:
        return 1

    res = mod_fact(n//p, p)

    if n//p % 2 != 0:
        return res*(p-fact[n % p]) % p
    return res*fact[n % p] % p


# nCk mod p
def mod_comb(n, k, p):
    if n < 0 or k < 0 or n < k:
        return 0
    e1 = mod_e(n, p)
    e2 = mod_e(k, p)
    e3 = mod_e(n-k, p)
    #pで割り切れる場合
    if e1 > e2 + e3:
        return 0

    #pで割り切れない場合
    a1 = mod_fact(n, p)
    a2 = mod_fact(k, p)
    a3 = mod_fact(n-k, p)
    return a1 * mod_inv(a2*a3 % p, p) % p

X, Y = map(int, input().split())
x = (2 * Y - X) / 3
y = (2 * X - Y) / 3

# print(x, y)

if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0:
    print(0)
    exit()
else:
    x = int(x)
    y = int(y)

if x < 0 or y < 0:
    print(0)
    exit()
# print(x,y)
if x < y:
    x, y = y, x

#pは素数とする
p = 10**9+7

#fact[i] : i! modp (0<= i <p) O(p)
#上だとO(p)なのでnまでにして O(n)にする
fact = [1]
k = 1
for i in range(1, 10**6+100):
    k = k*i % p
    fact.append(k)

#10000C4000 mod 10**9+7
print(mod_comb(x + y, y, p))
Buggy python submission (verdict: Runtime Error):
print(a)

Fixed submission:
S = input()
K = int(input())
n = len(S)

if len(set(S)) == 1:
    print(n * K // 2)
    exit()

SS = S[:] + S[:]
S = list(S)
SS = list(SS)
ans0 = 0
ans1 = 0

c = 0
cnt = 1
for i in range(1, n):
    if S[i - 1] == S[i]:
        cnt += 1
        if i == n-1:
            c += cnt // 2
    else:
        if cnt >= 2:
            c += cnt // 2
        cnt = 1
ans0 = c
c = 0
cnt = 1
m = len(SS)
for i in range(1, m):
    if SS[i - 1] == SS[i]:
        cnt += 1
        if i == m - 1:
            c += cnt // 2
    else:
        if cnt >= 2:
            c += cnt // 2
        cnt = 1

ans1 = c


num = ans1 - ans0
print(ans0 + (K-1) * num)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
ans = [0] * n
for num, a in enumerate(A):
    ban = a + 1
    ans[ban - 2] = num + 1
ans = list(map(str, ans))
print(' '.join(ans))


Fixed submission:
n, k = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
for h in H:
    if h >= k:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 0:
    a = n // 2
else:
    a = n // 2 + 1

print(a/n)


Fixed submission:
n, k = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
for h in H:
    if h >= k:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
j=["Sunny","Cloudy","Rainy"]
j=j+j
print(j[j.index(s)+1]

Fixed submission:
s=input()
j=["Sunny","Cloudy","Rainy"]
j=j+j
print(j[j.index(s)+1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

big = 0

for i in range(M):
    A.sort(reverse=True)
    A[0] = A[0] // 2
    # print(A)
print(sum(A))


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] *= - 1

heapq.heapify(A)

for i in range(M):
    big = (heapq.heappop(A) * -1) // 2
    heapq.heappush(A, big * -1)

print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


num = int(N // 2 + 1)
cnt = {}
for i in range(1, N + 1):
    cnt[i] = 0
A.reverse()
B = []

for i, a in enumerate(A):
    i = N - i
    if i >= num:
        if a == 1:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)
    else:
        if cnt[i] != a:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)

print(len(B))
B = list(map(str, B))
print(' '.join(B))


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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


num = int(N // 2 + 1)
cnt = {}
for i in range(1, N + 1):
    cnt[i] = 0
A.reverse()
B = []

for i, a in enumerate(A):
    i = N - i
    if i >= num:
        if a == 1:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)
    else:
        if cnt[i] != a:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)

print(len(B))
B = list(map(str, B))
print(' '.join(B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]

XY.sort(key=lambda x: x[0])

PQ = {}

for i in range(N):
    x0, y0 = XY[i]
    for j in range(N):
        if i == j:
            continue
        x1, y1 = XY[j]
        p, q = x0 - x1, y0 - y1
        key = str(p) + ',' + str(q)
        if key in PQ:
            PQ[key] += 1
        else:
            PQ[key] = 1
ansL = PQ.values()
print(N - max(list(ansL)))


Fixed submission:
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
    print(1)
    exit()

XY.sort(key=lambda x: x[0])

PQ = {}

for i in range(N):
    x0, y0 = XY[i]
    for j in range(N):
        if i == j:
            continue
        x1, y1 = XY[j]
        p, q = x0 - x1, y0 - y1
        key = str(p) + ',' + str(q)
        if key in PQ:
            PQ[key] += 1
        else:
            PQ[key] = 1
ansL = PQ.values()
print(N - max(list(ansL)))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

B = [0] * (N + 1)
B[0] = 1
if 1 not in A:
    B[1] = 1
else:
    B[1] = 0
mod = 10**9 + 7

for i in range(2, N + 1):
    if i != 2 and i - 1 in A and i - 2 in A:
        print(0)
        exit()
    elif i - 2 in A:
        B[i] = B[i - 1]
    elif i - 1 in A:
        B[i] = B[i - 2]
    else:
        B[i] = B[i - 1] + B[i - 2]
    B[i] %= mod
print(B[N] % mod)


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


def binary_search(l, value):
    low = 0
    high = len(l) - 1
    while low <= high:
        mid = (low + high) // 2
        if l[mid] == value:
            return True
        elif l[mid] < value:
            low = mid + 1
        else:
            high = mid - 1
    return False


N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

A.append(10**6)
A.append(10**6)
B = [0] * (N + 1)
B[0] = 1
if binary_search(A, 1) is True:
    B[1] = 0
else:
    B[1] = 1
mod = 10**9 + 7

for i in range(2, N + 1):
    if i != 2 and binary_search(A, i - 1) is True and binary_search(
            A, i - 2) is True:
        print(0)
        exit()
    elif binary_search(A, i - 2) is True:
        B[i] = B[i - 1]
    elif binary_search(A, i - 1) is True:
        B[i] = B[i - 2]
    else:
        B[i] = B[i - 1] + B[i - 2]
    B[i] %= mod
print(B[N] % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
B = [0] * (N + 1)
B[0] = 1
if 1 not in A:
    B[1] = 1
else:
    B[1] = 0

for i in range(2, N + 1):
    if i != 2 and i - 1 in A and i - 2 in A:
        print(0)
        exit()
    elif i - 2 in A:
        B[i] = B[i - 1]
    elif i - 1 in A:
        B[i] = B[i - 2]
    else:
        B[i] = B[i - 1] + B[i - 2]
mod = 10**9 + 7
print(B[N] % mod)


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


def binary_search(l, value):
    low = 0
    high = len(l) - 1
    while low <= high:
        mid = (low + high) // 2
        if l[mid] == value:
            return True
        elif l[mid] < value:
            low = mid + 1
        else:
            high = mid - 1
    return False


N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

A.append(10**6)
A.append(10**6)
B = [0] * (N + 1)
B[0] = 1
if binary_search(A, 1) is True:
    B[1] = 0
else:
    B[1] = 1
mod = 10**9 + 7

for i in range(2, N + 1):
    if i != 2 and binary_search(A, i - 1) is True and binary_search(
            A, i - 2) is True:
        print(0)
        exit()
    elif binary_search(A, i - 2) is True:
        B[i] = B[i - 1]
    elif binary_search(A, i - 1) is True:
        B[i] = B[i - 2]
    else:
        B[i] = B[i - 1] + B[i - 2]
    B[i] %= mod
print(B[N] % mod)
Buggy python submission (verdict: Runtime Error):
from collections import deque

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]
C = list(map(int, input().split()))
score = sum(C) - max(C)
C.sort(reverse=True)
C = deque(C)
con = [[] for _ in range(N + 1)]
ans = [0 for i in range(N + 1)]

for ab in AB:
    a, b = ab
    con[a].append(b)
    con[b].append(a)


def dfs(x):
    if len(C) == 0:
        return
    if ans[x] == 0:
        ans[x] = C[0]
        C.popleft()
        for c in con[x]:
            dfs(c)


dfs(1)
ans = list(map(str, ans))
print(score)
print(' '.join(ans[1:]))


Fixed submission:
import sys
from collections import deque
sys.setrecursionlimit(10**9)

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]
C = list(map(int, input().split()))

score = sum(C) - max(C)
C.sort(reverse=True)
C = deque(C)
con = [[] for _ in range(N + 1)]
ans = [0 for i in range(N + 1)]

for ab in AB:
    a, b = ab
    con[a].append(b)
    con[b].append(a)


def dfs(x):
    if len(C) == 0:
        return
    if ans[x] == 0:
        ans[x] = C[0]
        C.popleft()
        for c in con[x]:
            dfs(c)


dfs(1)
ans = list(map(str, ans))
print(score)
print(' '.join(ans[1:]))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

ans = set(list(range(1, N + 1)))
for lr in LR:
    l, r = lr
    ans = ans & set(list(range(l, r + 1)))
print(len(list(ans)))


Fixed submission:
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

A, B = 1, N
for lr in LR:
    L, R = lr
    if R < A or B < L:
        print(0)
        exit()

    if A <= L <= R <= B:
        A, B = L, R
    elif L <= A <= R <= B:
        B = R
    elif A <= L <= B <= R:
        A = L
print(B - A + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

ans = set(list(range(1, N + 1)))
for lr in LR:
    l, r = lr
    ans = ans & set(list(range(l, r + 1)))
print(len(list(ans)))

Fixed submission:
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

A, B = 1, N
for lr in LR:
    L, R = lr
    if R < A or B < L:
        print(0)
        exit()

    if A <= L <= R <= B:
        A, B = L, R
    elif L <= A <= R <= B:
        B = R
    elif A <= L <= B <= R:
        A = L
print(B - A + 1)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

r, g, b = int(N // R), int(N // G), int(N // B)

ans = 0
for i in range(r + 1):
    if i * R > N:
        break
    for j in range(g + 1):
        if (N - (i * R + j * G)) % B == 0 and (N - (i * R + j * G)) >= 0:
            ans += 1
print(ans)


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

r, g, b = int(N // R), int(N // G), int(N // B)

ans = 0
for i in range(r + 1):
    if i * R > N:
        break
    for j in range(g + 1):
        if (N - (i * R + j * G)) % B == 0 and (N - (i * R + j * G)) >= 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
B = [A[0]]

for i in range(1, N):
    B.append(gcd(B[i - 1], A[i]))

ans = 0
for i in range(N):
    if i != 0:
        ans0 = B[i - 1]
    else:
        ans0 = A[1]
    for j in range(i + 1, N):
        ans0 = gcd(ans0, A[j])
    ans = max(ans, ans0)
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
B, C = [A[0]], [A[N - 1]]

for i in range(1, N):
    B.append(gcd(B[i - 1], A[i]))

AA = list(reversed(A))
for i in range(1, N):
    C.append(gcd(C[i - 1], AA[i]))
C.reverse()
ans = 0
for i in range(1, N - 1):
    ans = max(ans, gcd(B[i - 1], C[i + 1]))
ans = max(ans, B[N - 2], C[1])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = len(S)
ans_list = []
for i in range(n):
    for j in range(i + 1, n):
        T = S[i: j + 1]
        U = T.replace("A","").replace("C","").replace("G","").replace("T","")
        if U == "":
            ans_list.append(len(T))
print(max(ans_list))

Fixed submission:
S = input()
S = S.replace('A', '*').replace('T', '*').replace('C', '*').replace('G', '*')

ans, count = 0, 0
for s in S:
    if s == '*':
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
S = S.replace('AC', 'ac')

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

for lr in LR:
    l, s = lr[0], lr[1]
    string = S[l - 1:s]
    print(string.count('ac'))


Fixed submission:
N, Q = map(int, input().split())
S = input()
S = S.replace('AC', 'ac')
ans = [0] * N
LR = [list(map(int, input().split())) for _ in range(Q)]

flag = False
count = 0
for num, s in enumerate(S):
    if flag is False:
        if s == 'a':
            flag = True
            ans[num] = count
            continue
        else:
            ans[num] = count
    else:
        if s == 'c':
            count += 2
            ans[num] = count
            flag = False
            continue
        else:
            ans[num] = count
            flag = False

for lr in LR:
    l, s = lr[0], lr[1]
    print((ans[s - 1] - ans[l - 1]) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

ans = A
for i in range(A + 1, B + 1):
    ans = ans ^ i
print(ans)


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


def F(C):
    num = (C + 1) // 2
    if C % 2 == 0:
        if num % 2 == 0:
            return C
        else:
            return 1 ^ C
    else:
        if num % 2 == 0:
            return 0
        else:
            return 1


print(F(A - 1) ^ F(B))

print()