Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
kind,kona = map(int,input().split())

grum = []
sum_grum=0

for i in range(kind):
    grum.append(input())
for j in range(kind):
    sum_grum = sum_grum+int(grum[j])

kona = kona - sum_grum
minimun = int(min(grum))

if kona>=minimun:
    kona_sec = kona//minimun

print(kind+kona_sec)


Fixed submission:
order= input().strip()
count = 0
for i in range (3):
    if order[i]=='o':
        count=count+100

print(700+count)

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

grum = []
sum_grum=0

for i in range(kind):
    grum.append(input())
for j in range(kind):
    sum_grum = sum_grum+int(grum[j])

kona = kona - sum_grum
minimun = int(min(grum))

if kona>=minimun:
    kona_sec = kona//minimun

print(kind+kona_sec)


Fixed submission:
order= input().strip()
count = 0
for i in range (3):
    if order[i]=='o':
        count=count+100

print(700+count)
Buggy python submission (verdict: Runtime Error):
,B,C = map(int,input().split())

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x>=B-x:
    print(B-x)
else:
    print(x)


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

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x>=B-x:
    print(B-x)
else:
    print(x)

Buggy python submission (verdict: Runtime Error):
A,,B,C = map(int,input().split())

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x+1>=B-x:
    print(B-x)
else:
    print(x+1)


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

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x>=B-x:
    print(B-x)
else:
    print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: 
    cou = s.oount(str) - t.count(str) 
    ans = max(cou, ans)

print(ans)
    

    


Fixed submission:
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.count(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.oount(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(ans)
    

    


Fixed submission:
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.count(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0

for str in s:#strは単語を表している。ループの回数としてはn回（sの配列数）
    count = s.oount(str)-t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(ans,count)　

print(ans)
    


Fixed submission:
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.count(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
C1 = list(map(str,input().split()))
C2 = list(map(str,input().split()))
C3 = list(map(str,input().split()))

C = C1[0]+C2[1]+C3[2]

print(C)


Fixed submission:
c1 = str(input())
c2 = str(input())
c3 = str(input())

c1_list = list(c1)
c2_list = list(c2)
c3_list = list(c3)

c = c1_list[0] + c2_list[1]+ c3_list[2]

print(c)
Buggy python submission (verdict: Runtime Error):
 N= int(input())
ans =0
if N<=2:
    print('0')
else:
    ans=N//3
    print(ans)

Fixed submission:
N = int(input())
ans =0
if N<=2:
    print('0')
else:
    ans=N//3
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
a = input()

if n == a || n%500<=a:
    print('Yes')
else:
    print('No')

    

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

if (n == a) or(n%500<=a):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a%b == 0:
    print("-1")

else:
    print(X)

    

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

if a%b == 0:
    print("-1")

else:
    print(a)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
 for j in range(B+1):
  reX = X - A*i - B*j;
  if 0<= reX <= C:
   count+=1
   
print(count)

Fixed submission:
X = input()
A = input()
B = input()
X = int(X)
A = int(A)
B = int(B)

reX = X - A;
print(reX%B)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
 for j in range(B+1):
  reX = X - A*i - B*j;
  if 0<= reX <= C:
   count+=1
print(count)


Fixed submission:
X = input()
A = input()
B = input()
X = int(X)
A = int(A)
B = int(B)

reX = X - A;
print(reX%B)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1);
 for j in range(B+1);
  reX = X - A*i - B*j;
  if 0<= reX <= X
  count++;

print(count)


Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
        for j in range(B+1):
                reX = (X - 500*i - 100*j)//50
                if 0 <= reX <= C:
                        count+=1
   
   
print(count)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
calc = a * b;
if calc%2==0:
    print("Even")
else:
    print("Odd")
    

Fixed submission:
a, b = map(int, input().split())
calc = a*b;
if calc%2==0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
N = input()
if(N[0] = N[1] = N[2] or  N[1] = N[2] = N[3]):
    print('Yes')
else:
    print('No')
    

Fixed submission:
N = input()
if(N[0] == N[1] == N[2] or  N[1] == N[2] == N[3]):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = input()
if(N[0] = N[1] = N[2] or  N[1] = N[2] = N[3]):
    print('Yes')
else:
    print('No')
    

Fixed submission:
N = input()
if(N[0] == N[1] == N[2] or  N[1] == N[2] == N[3]):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))

X1 = [0] * (N+2)
X2 = [0] * (N+2)

for i in range(N):
    X1[i+1] = math.gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = math.gcd(X2[i+1], A[i-1])

ans = 1
for i in range(N):
    G = math.gcd(X1[i], X2[i+2])
    if ans < G:
        ans = G
print(ans)

Fixed submission:
A,B,T = map(int, input().split())
print(T // A * B)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))

X1 = [0] * (N+2)
X2 = [0] * (N+2)

for i in range(N):
    X1[i+1] = math.gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = math.gcd(X2[i+1], A[i-1])

ans = 1
for i in range(N):
    G = math.gcd(X1[i], X2[i+2])
    if ans < G:
        ans = G
print(ans)

Fixed submission:
from fractions import *
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
b = [0] * (n+2)
c = [0] * (n+2)

for i in range(1, n+1):
    b[i] = gcd(b[i-1], a[i])
for i in range(n,0,-1):
    c[i] = gcd(c[i+1], a[i])

ans = 1
for i in range(1, n+1):
    if ans < gcd(b[i-1], c[i+1]):
        ans = gcd(b[i-1], c[i+1])
print(ans)

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

X1 = [0] * (N+2)
X2 = [0] * (N+2)

for i in range(N):
    X1[i+1] = math.gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = math.gcd(X2[i+1], A[i-1])

ans = 1
for i in range(N):
    gcd = math.gcd(X1[i], X2[i+2])
    if ans < gcd:
        ans = gcd
print(ans)


Fixed submission:
from fractions import *
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
b = [0] * (n+2)
c = [0] * (n+2)

for i in range(1, n+1):
    b[i] = gcd(b[i-1], a[i])
for i in range(n,0,-1):
    c[i] = gcd(c[i+1], a[i])

ans = 1
for i in range(1, n+1):
    if ans < gcd(b[i-1], c[i+1]):
        ans = gcd(b[i-1], c[i+1])
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

ATCG = ['A','T','C','G']
ans = []
pre = 0
for s in S:
    if s in ATCG:
        pre += 1
    else:
        ans.append(pre)
        pre = 0

print(max(ans))

Fixed submission:
S = list(input())
   
ans = []
pre = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        pre += 1
    else:
        ans.append(pre)
        pre = 0

ans.append(pre)
print(max(ans))

Buggy python submission (verdict: Runtime Error):
S = list(input())
   
ans = []
pre = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G'or s == 'T':
        pre += 1
    else:
        ans.append(pre)
        pre = 0

print(max(ans))


Fixed submission:
S = list(input())
   
ans = []
pre = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        pre += 1
    else:
        ans.append(pre)
        pre = 0

ans.append(pre)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
l = [list(map(int, input().split())) for _ in range(Q)]

ans = []
for i in range(Q):
    R = S[l[i][0]-1 : l[i][1]]
    print(R.count("AC"))

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

t = [0] * (N + 1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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

#print(N,Q)
#print(S)
#print(l)

ans = []
for i in range(Q):
    #print(l[i][1])
    #print(S[l[i][0] - 1], S[l[i][1] - 1])
    #print(S[l[i][0]-1 : l[i][1]])
    R = S[l[i][0]-1 : l[i][1]]
    #print(R)
    ans.append(R.count("AC"))
#print(ans)
for A in ans:
    print(A)

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

t = [0] * (N + 1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

risuto = []
for i in range(1, int(min(A, B) / 2) + 1):
    if (A % i == 0 & B % i == 0):
        risuto.append(i)
        
if (risuto == []):
    print("1")
else:
    print(risuto[K-1])

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

if A > B:
    A, B = B, A

d = []
for i in range(1,A+1):
	if (A % i == 0 and B % i == 0):
		d.append(i)
	
d.reverse()
print(d[K-1])

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

risuto = []
for i in range(1, int(min(A, B) / 2) + 1):
    if (A % i == 0 & B % i == 0):
        risuto.append(i)
        
if (risuto == []):
    print("1")
else:
    print(risuto[K-1])

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

if A > B:
    A, B = B, A

d = []
for i in range(1,A+1):
	if (A % i == 0 and B % i == 0):
		d.append(i)
	
d.reverse()
print(d[K-1])
Buggy python submission (verdict: Runtime Error):
from math import gcd
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans = gcd(ans, A[i])

print(ans)

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

ans = 0
for i in range(N):
    ans = gcd(ans, A[i])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))

if N < M:
    cost = []
    for i in range(M-1):
        cost.append(abs(X[i] - X[i+1]))
    for i in range(N-1):
        cost.remove(max(cost))
    
    print(sum(cost))
else:
    print(0)

Fixed submission:
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))

L = [X[i+1] - X[i] for i in range(M-1)]
L = sorted(L, reverse=True)

del L[:N-1]
print(sum(L))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])

print(min(H[i+K-1] - H[i] for i in range(N-2)))

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])

ans = 10**9
for i in range(N-2):
    diff = H[i+K-1] - H[i]
    if diff < ans:
        ans = diff
print(ans)

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])

ans = 10**9
for i in range(N-K+1):
    diff = H[i+2] - H[i]
    if diff < ans:
        ans = diff
print(ans)

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

ans = 10**9
for v in combinations(H, K):
    diff = max(v) - min(v)
    if diff < ans:
        ans = diff
    
print(ans)

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+2] - h[i])
print(min(m))

Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N - K + 1):
    m.append(h[i+2] - h[i])
print(min(m))



Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))
Buggy python submission (verdict: Runtime Error):
N,T = map(int, input().split())

C = []
for i in range(3):
    c,t = map(int, input().split())
    if t > T:
        pass
    else:
        C.append(c)

if C == []:
    print("TLE")
else:
    print(min(C))

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

C = []
for i in range(N):
    c,t = map(int, input().split())
    if t > T:
        pass
    else:
        C.append(c)

if C == []:
    print("TLE")
else:
    print(min(C))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

kami = []
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.append(A)
    else:
        kami.remove(A)
    
print(len(kami))

Fixed submission:
N = int(input())

kami = set([])
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.add(A)
    else:
        kami.remove(A)

print(len(kami))

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

ans_list = []
ans_cnt = 0
for i in range(N):
    A = int(input())
    if A in ans_list:
        ans_list.remove(A)
        ans_cnt -= 1
    else:
        ans_list.append(A)
        ans_cnt += 1
        
print(ans_cnt)


Fixed submission:
N = int(input())

kami = set([])
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.add(A)
    else:
        kami.remove(A)

print(len(kami))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]

ans_list = []
ans_cnt = 0
for i in range(N):
    if A[i] in ans_list:
        ans_list.remove(A[i])
        ans_cnt -= 1
    else:
        ans_list.append(A[i])
        ans_cnt += 1
        
print(ans_cnt)

Fixed submission:
N = int(input())

kami = set([])
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.add(A)
    else:
        kami.remove(A)

print(len(kami))

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

kami = []
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.append(A)
    else:
        kami.remove(A)

print(len(kami))

Fixed submission:
N = int(input())

kami = set([])
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.add(A)
    else:
        kami.remove(A)

print(len(kami))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]

kami = []
for i in range(N):
    if A[i] not in kami:
        kami.append(A[i])
    else:
        kami.remove(A[i])

print(len(kami))

Fixed submission:
N = int(input())

kami = set([])
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.add(A)
    else:
        kami.remove(A)

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

nums = [0 for _ in range(N)]

for i in range(N):
    nums[i] = nums[i] + A.count(A[i])
    nums[i] = nums[i] + A.count(A[i] +1)
    nums[i] = nums[i] + A.count(A[i] -1)
    
print(max(nums))   

Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

l = []
for X in A:
    l += [X-1, X, X+1]

c = collections.Counter(l)
print(c.most_common()[0][1])
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
T = [int(input()) for i in range(N)]

LCM = 1
for i in range(N):
    lcm = (T[i] * LCM) // (math.gcd(T[i], LCM))
    LCM = lcm

print(LCM)


Fixed submission:
import fractions

N = int(input())
T = [int(input()) for i in range(N)]

LCM = 1
for i in range(N):
    lcm = (T[i] * LCM) // (fractions.gcd(T[i], LCM))
    LCM = lcm

print(LCM)

Buggy python submission (verdict: Runtime Error):
import fractions

N = int(input())
T = [int(input()) for i in range(N)]

LCM = []
for i in range(N-1):
    lcm = T[i] * T[i+1] // fractions.gcd(T[i], T[i+1])
    LCM.append(lcm)

print(LCM[-1])

Fixed submission:
import fractions

N = int(input())
T = [int(input()) for i in range(N)]

LCM = 1
for i in range(N):
    lcm = (T[i] * LCM) // (fractions.gcd(T[i], LCM))
    LCM = lcm

print(LCM)

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
T = [int(input()) for i in range(N)]

LCM = []
for i in range(N-1):
    lcm = T[i] * T[i+1] // math.gcd(T[i], T[i+1])
    LCM.append(lcm)

print(LCM[-1])


Fixed submission:
import fractions

N = int(input())
T = [int(input()) for i in range(N)]

LCM = 1
for i in range(N):
    lcm = (T[i] * LCM) // (fractions.gcd(T[i], LCM))
    LCM = lcm

print(LCM)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

index_A = [n+1 for n, v in enumerate(S) if v == "A"]
index_Z = [n+1 for n, v in enumerate(S) if v == "Z"]

ans = 0
for i in range(len(index_A)):
    for j in range(len(index_Z)):
        if ans < index_Z[j] - index_A[i]:
            ans = index_Z[j] - index_A[i]
            
print(ans+1)


Fixed submission:
S = input()

index_A = []
index_Z = []
for i in range(len(S)):
    if S[i] == "A" and len(index_A) == 0:
        index_A.append(i+1)
    if S[i] == "Z":
        index_Z.append(i+1)
            
print(max(index_Z) - index_A[0] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
    
ans = 0
for i in range(K+1):
    for j in range(K+1):
        for f in range(K+1):
            if i + j + f == S:
                ans += 1
print(ans)

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

ans = 0
for X in range(K+1):
    for Y in range(K+1):
        Z = S - X - Y
        if 0 <= Z and Z <= K:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
if A = 5 and B = 5 and C = 7:
  print("YES")
  
elif A = 5 and B = 7 and C = 5:
  print("YES")
  
elif A = 7 and B = 5 and C = 5:
  print("YES")
  
else:
  print("NO")
  
  
  
  

Fixed submission:
line = input().split()

cnt5 = line.count("5")
cnt7 = line.count("7")

if cnt5 == 2 and cnt7 == 1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
s=input()
n = len(s)
check = []
check.append(s)
while True:
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            print(0)
            break
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-2])
        check.pop(0)

Fixed submission:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True

s=input()
n = len(s)
check = []
check.append(s)
while True:
    if not check:
        print(0)
        break
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            check.pop(0)
            continue
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
lr = []
for i in range(q):
    lr.append([int(i) for i in input().split()])
    
acpos = []
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        acpos.append(i)

for i in range(q):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    s_q = s[l-1:r]
    retSum = 0
    for j in range(len(acpos)):
        if l <= acpos[j] and r > acpos[j]:
            retSum +=1
        if r <= acpos[j]:
            break
    print(retSum)

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = []
for i in range(q):
    lr.append([int(i) for i in input().split()])
    
acnum = []
acsum = 0
acnum.append(acsum)
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        acsum +=1
    acnum.append(acsum)
for i in range(q):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    retSum = 0
    print(acnum[r] - acnum[l])

Buggy python submission (verdict: Time Limit Exceeded):
def findAC(s):
    retSum = 0
    for i in range(len(s)-1):
        if s[i] == "A" and s[i+1] == "C":
            retSum+=1
    return retSum

n,q = map(int,input().split())
s = input()
lr = []
for i in range(q):
    lr.append([int(i) for i in input().split()])
for i in range(q):
    l = lr[i][0]
    r = lr[i][1]
    s_q = s[l-1:r]
    print(findAC(s_q))

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = []
for i in range(q):
    lr.append([int(i) for i in input().split()])
    
acnum = []
acsum = 0
acnum.append(acsum)
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        acsum +=1
    acnum.append(acsum)
for i in range(q):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    retSum = 0
    print(acnum[r] - acnum[l])