Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = 0
C = 0

for i in range(list(A)):
  c += A[i]
  
for i in range(list(A)):
  if A[i] >= 1/(4*M):
    B += 1

if B >= M:
  print('Yes')
else:
  print('No')
    

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = 0
C = 0

for i in range(len(A)):
  C += A[i]
  
for i in range(len(A)):
  if A[i] >= C/(4*M):
    B += 1

if B >= M:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = 0

for i in range(list(A)):
  if A[i] >= 1/(4*M):
    B += 1

if B >= M:
  print('Yes')
else B < M:
  print('No')
    

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
B = 0
C = 0

for i in range(len(A)):
  C += A[i]
  
for i in range(len(A)):
  if A[i] >= C/(4*M):
    B += 1

if B >= M:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x = input(int())
a = x//500
b = (x%500)//5
h = a*1000+b*5
print(h)


Fixed submission:
x = int(input())
a = x//500
b = (x%500)//5
h = a*1000+b*5
print(h)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int,input().split())
if A == B and B != C:
    print('Yes')
elif C == B and C != A:
    print('Yes')
elif A == C and C != B:
    print('Yes')
else('No')


Fixed submission:

A, B, C = map(int,input().split())
if A == B and B != C:
  print('Yes')
elif C == B and C != A:
  print('Yes')
elif A == C and C != B:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
A, B, C = map(int,input().split())
if A = B and B != C:
    print('Yes')
elif C = B and C != A:
    print('Yes')
elif A = C and C != B:
    print('Yes')
else('No')

Fixed submission:

A, B, C = map(int,input().split())
if A == B and B != C:
  print('Yes')
elif C == B and C != A:
  print('Yes')
elif A == C and C != B:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
H, N = map(int,input().split())
A = list(map(int,input().split())
T = 0
for i in range(N):
  T += A[i]
if H - T <=0:
  print('Yes')
else:
  print('No')

Fixed submission:
H, N = map(int,input().split())
A = list(map(int,input().split()))
T = 0
for i in range(N):
  T += A[i]
if H-T <=0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
hug = 0
if len(S) % 2 == 0:
  for i in range(len(S/2)):
    if not S[i] == S[-i-1]:
      hug += 1
    else:
      pass
else:
  for i in range(int((len(S)+1)/2)):
    if not S[i] ==S[-i-1]:
      hug += 1
    else:
      pass
print(hug)
  

Fixed submission:
S = input()
hug = 0
if len(S) % 2 == 0:
  for i in range(int(len(S)/2)):
    if not S[i] == S[-i-1]:
      hug += 1
    else:
      pass
else:
  for i in range(int((len(S)+1)/2)):
    if not S[i] ==S[-i-1]:
      hug += 1
    else:
      pass
print(hug)

Buggy python submission (verdict: Runtime Error):
S = input()
hug = 0
if len(S) % 2 == 0:
  for i in range(len(S/2)):
    if not S[i] == S[-i-1]:
      hug += 1
    else:
      pass
else:
  for i in range(len((S+1)/2)):
    if not S[i] ==S[-i-1]:
      hug += 1
    else:
      pass
print(hug)
  

Fixed submission:
S = input()
hug = 0
if len(S) % 2 == 0:
  for i in range(int(len(S)/2)):
    if not S[i] == S[-i-1]:
      hug += 1
    else:
      pass
else:
  for i in range(int((len(S)+1)/2)):
    if not S[i] ==S[-i-1]:
      hug += 1
    else:
      pass
print(hug)
Buggy python submission (verdict: Runtime Error):
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if S[i] % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break
        
      
    


Fixed submission:
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if i % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break

Buggy python submission (verdict: Runtime Error):
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if S[i] % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break
        
      
    

Fixed submission:
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if i % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break
Buggy python submission (verdict: Runtime Error):
import numpy


def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    n = int(input())
    a_list = li()
    b_list = li()
    # i0_list = []
    # for a, b in zip(a_list[:n], b_list):
    #     i0_list.append(min(a, b))
    # i1_list = []
    # for a, b in zip(a_list[1:], b_list):
    #     i1_list.append(min(a, b))
    # i0_cum = numpy.cumsum(i0_list).tolist()
    # tmp = [0]
    # tmp.extend(i0_cum)
    # i0_cum = tmp
    # i1_cum = numpy.cumsum(i1_list[::-1]).tolist()
    # tmp = [0]
    # tmp.extend(i1_cum)
    # i1_cum = tmp[::-1]
    #
    # print(i0_cum)
    # print(i1_cum)
    # max_val = 0
    # for i0, i1 in zip(i0_cum, i1_cum):
    #     if i0 + i1 > max_val:
    #         max_val = i0 + i1
    # print(max_val)

    monster = 0
    for index in range(len(b_list)):
        monster_add = min(a_list[index], b_list[index])
        monster = monster + monster_add
        a_list[index] = a_list[index] - monster_add
        b_list[index] = b_list[index] - monster_add

        monster_add = min(a_list[index + 1], b_list[index])
        monster = monster + monster_add
        a_list[index] = a_list[index + 1] - monster_add
        b_list[index] = b_list[index] - monster_add
    print(monster)

# 尺取り的に全部求められる？
# iの場合とi+1の場合を全て計算して累積和を使えばいけそう


Fixed submission:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    n = int(input())
    a_list = li()
    b_list = li()

    monster = 0
    for index in range(n):
        monster_add = min(a_list[index], b_list[index])
        monster = monster + monster_add
        a_list[index] = a_list[index] - monster_add
        b_list[index] = b_list[index] - monster_add

        monster_add = min(a_list[index + 1], b_list[index])
        monster = monster + monster_add
        a_list[index + 1] = a_list[index + 1] - monster_add
        b_list[index] = b_list[index] - monster_add
    print(monster)
Buggy python submission (verdict: Runtime Error):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    while bound_x <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
    print(bound)


Fixed submission:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    bound = bound + 1
    while bound_x + l_list[index] <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
        if index >= len(l_list):
            break

    print(bound)
Buggy python submission (verdict: Runtime Error):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, m] = li()
    broken = [int(input()) for _ in range(m)]

    pattern = [0] * (n + 1)
    pattern[0] = 1
    pattern[1] = 1 if broken[0] != 1 else 0
    for i in range(2, n + 1):
        if broken.count(i) == 0:
            pattern[i] = (pattern[i - 2] + pattern[i - 1]) % (10 ** 9 + 7)
        else:
            pattern[i] = 0
    print(pattern[-1])


Fixed submission:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, m] = li()
    broken = [int(input()) for _ in range(m)]
    mod = 10 ** 9 + 7

    pattern = [0] * (n + 1)
    pattern[0] = 1
    broken_index = 0
    checking = broken[broken_index] if len(broken) > broken_index else -1
    if checking != 1:
        pattern[1] = 1
    else:
        pattern[1] = 0
        broken_index = broken_index + 1
        checking = broken[broken_index] if len(broken) > broken_index else -1

    for i in range(2, n + 1):
        if checking != i:
            pattern[i] = (pattern[i - 2] + pattern[i - 1]) % mod
        else:
            pattern[i] = 0
            broken_index = broken_index + 1
            checking = broken[broken_index] if len(broken) > broken_index else -1
    print(pattern[n])
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    [n, m] = list(map(int, input().split()))
    a = list(map(int, input().split()))
    bc = [list(map(int, input().split())) for _ in range(m)]

    a.sort()
    bc.sort(key=lambda x: x[1], reverse=True)

    index = 0
    for b, c in bc:
        if c <= a[index]:
            break
        for _ in range(b):
            if c > a[index]:
                a[index] = c
                index = index + 1
            else:
                break

    # print(a)
    print(sum(a))


Fixed submission:
if __name__ == '__main__':
    [n, m] = list(map(int, input().split()))
    a = list(map(int, input().split()))
    bc = [list(map(int, input().split())) for _ in range(m)]

    a.sort()
    bc.sort(key=lambda x: x[1], reverse=True)

    index = 0
    for b, c in bc:
        if index >= len(a) or c <= a[index]:
            break
        for _ in range(b):
            if index < len(a) and c > a[index]:
                a[index] = c
                index = index + 1
            else:
                break

    # print(a)
    print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N = int(input())
a_list = list(map(int, input().split()))
max_gcd_a = reduce(gcd, a_list[1:], a_list[1])
for idx in range(1, N):
    gcd_1 = reduce(gcd, a_list[1:idx], a_list[0])
    gcd_a = reduce(gcd, a_list[idx + 1:], gcd_1)
    if max_gcd_a < gcd_a:
        max_gcd_a = gcd_a

print(max_gcd_a)

# どれか１つを除いた時の最大公約数で最大のもの


Fixed submission:
from functools import reduce


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N = int(input())
a_list = list(map(int, input().split()))
gcd_list = [a_list[-1]]
for idx in range(N - 2, 0, -1):
    gcd_list.append(gcd(gcd_list[N - 2 - idx], a_list[idx]))
max_gcd_a = gcd_list[-1]
gcd_list.append(1)
gcd_list.reverse()

for idx in range(1, N):
    if idx != 1:
        left_gcd = gcd(left_gcd, a_list[idx - 1])
    else:
        left_gcd = a_list[0]
    if idx < N - 1:
        right_gcd = gcd_list[idx + 1]
    else:
        right_gcd = left_gcd

    gcd_a = gcd(left_gcd, right_gcd)
    if max_gcd_a < gcd_a:
        max_gcd_a = gcd_a

print(max_gcd_a)

# どれか１つを除いた時の最大公約数で最大のもの
Buggy python submission (verdict: Time Limit Exceeded):
def ii():
    return list(map(int, input().split()))


[N, Q] = ii()
S = input()
Q_list = [ii() for _ in range(Q)]

for q in Q_list:
    sub_s = S[q[0] - 1:q[1]]
    print(sub_s.count("AC"))


Fixed submission:
from bisect import bisect_left, bisect_right


def ii():
    return list(map(int, input().split()))


[N, Q] = ii()
S = input()
Q_list = [ii() for _ in range(Q)]

AC_idx = []
try:
    start_idx = 0
    while True:
        found_idx = S.index("AC", start_idx)
        AC_idx.append(found_idx)
        start_idx = found_idx + 1
except ValueError as e:
    pass

for q in Q_list:
    left_idx = bisect_left(AC_idx, q[0] - 1)
    right_idx = bisect_right(AC_idx, q[1] - 2)
    print(right_idx - left_idx)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
b_list = list(map(int, input().split()))

generate_seq = []


def is_ok(b):
    len_b = len(b)
    if len_b == 1 and b[0] == 1:
        generate_seq.append(1)
        return True

    processing = []
    for idx in range(len_b):
        if b[idx] != idx + 1:
            processing.append(False)
        else:
            b_tmp = b[:]
            del b_tmp[idx]
            tmp = is_ok(b_tmp)
            if tmp:
                generate_seq.append(idx + 1)
                return True
    return False


result = is_ok(b_list)
if result:
    print('\n'.join(list(map(str, generate_seq))))
else:
    print(-1)


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

generate_seq = []


def is_ok(b):
    len_b = len(b)
    if len_b == 1 and b[0] == 1:
        generate_seq.append(1)
        return True

    for idx, val in enumerate(b):
        if idx + 1 < val:
            return False

    processing = []
    for idx in range(len_b):
        if b[idx] != idx + 1:
            processing.append(False)
        else:
            b_tmp = b[:]
            del b_tmp[idx]
            tmp = is_ok(b_tmp)
            if tmp:
                generate_seq.append(idx + 1)
                return True
    return False


result = is_ok(b_list)
if result:
    print('\n'.join(list(map(str, generate_seq))))
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
b_list = list(map(int, input().split()))

generate_seq = []


def is_ok(b):
    len_b = len(b)
    if len_b == 1 and b[0] == 1:
        generate_seq.append(1)
        return True

    processing = []
    for idx in range(len_b):
        if b[idx] != idx + 1:
            processing.append(False)
        else:
            b_tmp = b[:]
            del b_tmp[idx]
            processing.append(is_ok(b_tmp))
    if any(processing):
        generate_seq.append(processing.index(True) + 1)
        return True
    return False


result = is_ok(b_list)
if result:
    print('\n'.join(list(map(str, generate_seq))))
else:
    print(-1)


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

generate_seq = []


def is_ok(b):
    len_b = len(b)
    if len_b == 1 and b[0] == 1:
        generate_seq.append(1)
        return True

    for idx, val in enumerate(b):
        if idx + 1 < val:
            return False

    processing = []
    for idx in range(len_b):
        if b[idx] != idx + 1:
            processing.append(False)
        else:
            b_tmp = b[:]
            del b_tmp[idx]
            tmp = is_ok(b_tmp)
            if tmp:
                generate_seq.append(idx + 1)
                return True
    return False


result = is_ok(b_list)
if result:
    print('\n'.join(list(map(str, generate_seq))))
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
[A, B] = list(map(int, input().split(' ')))

answer = 0
for n in range(A, B + 1):
    answer = answer ^ n

print(answer)

Fixed submission:
# [A, B] = list(map(int, input().split(' ')))
#
# answer = 0
# for n in range(A, B + 1):
#     answer = answer ^ n
#
# print(answer)


[A, B] = list(map(int, input().split(' ')))

answer = 0

A1_digit = len(bin(A - 1)) - 2
Abit_list = []
Amin_bit = 1 if 1 <= (A - 1) % 4 <= 2 else 0
Abit_list.append(Amin_bit)

for i in range(2, A1_digit + 1):
    rem = (A - 1) % 2 ** i
    A_bit = 0 if rem < 2 ** (i - 1) or (rem - 2 ** (i - 1)) % 2 == 1 else 1
    Abit_list.append(A_bit)

B_digit = len(bin(B)) - 2
Bbit_list = []
Bmin_bit = 1 if 1 <= B % 4 <= 2 else 0
Bbit_list.append(Bmin_bit)
for i in range(2, B_digit + 1):
    rem = B % 2 ** i
    B_bit = 0 if rem < 2 ** (i - 1) or (rem - 2 ** (i - 1)) % 2 == 1 else 1
    Bbit_list.append(B_bit)

Abit_list.reverse()
Bbit_list.reverse()
# print(Abit_list)
# print(Bbit_list)
Axor = 0
for v in Abit_list:
    Axor = Axor << 1
    if v == 1:
        Axor = Axor + 1

Bxor = 0
for v in Bbit_list:
    Bxor = Bxor << 1
    if v == 1:
        Bxor = Bxor + 1

# print(bin(Axor ^ Bxor))
# print(bin(435))
print(Axor ^ Bxor)
Buggy python submission (verdict: Runtime Error):
i = input()


if i == "SSS":
    print(0)
elif i == "RRR":
    print(3)
elif i == "RSR" or "SSR" or "RSS" or "SRS":
    print(1)
elif i = "RRS" or "SRR":
    print(2)


Fixed submission:
i = input()


if i == "SSS":
    print(0)
elif i == "RRR":
    print(3)
elif i == "RSR" or i == "SSR" or i=="RSS" or i=="SRS":
    print(1)
elif i == "RRS" or i=="SRR":
    print(2)
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())

ogpos = True

if X > 0:
    ogpos = True
else:
    ogpos = False

old = X
newpos = ogpos


while newpos == ogpos and K>0:
    K -= 1
    if X > 0:
        X -= D
    elif X < 0:
        X += D
    else:
        if ogpos == True:
            X -= D
        else:
            X += D

    if X>0:
        newpos = True
    elif X<0:
        newpos = False
        


if (K%2) == 0:
    print(abs(X))
else:
    if newpos == True:    
        print(abs(X-D))
    else:
        print(abs(X+D))


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

X = abs(X)

cuts = X//D

if cuts>=K:
    print(X-(K*D))
else:
    remainingcuts = K-cuts
    r = X-cuts*D

    if remainingcuts%2 == 1:
        print(abs(r-D))
    else:
        print(r)

Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())

poss = True

if X > 0:
    poss = True
else:
    poss = False

old = X

for i in range(K):
    if X > 0:
        if poss == False:
##            if abs(old) >= abs(X):
##                break
##            else:
##                print("false", i)
            if (K-i)%2 == 0:
                break
            else:
                X = abs(X-D)
                break
            
            
        old = X
        X -= D
    elif X < 0:

        if poss == True:
##            if abs(old) >= abs(X):
##                break
##            else:
##                
##                print("true", i, X, old)

            if (K-i)%2 == 0:
                break
            else:
                X = abs(X+D)
                break
        
        old = X
        X += D
    else:
        if (K-i)%2 == 0:
            break
        else:
            X = X+D
            break


print(abs(X))


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

X = abs(X)

cuts = X//D

if cuts>=K:
    print(X-(K*D))
else:
    remainingcuts = K-cuts
    r = X-cuts*D

    if remainingcuts%2 == 1:
        print(abs(r-D))
    else:
        print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split()))

res = 1

for i in range(n):
    res *= a[i]

    if a[i] == 0:
        break


if res > 10**18:
    print(-1)
else:
    print(res)


Fixed submission:
n = int(input())

a = list(map(int, input().split()))

res = 1

if 0 in a:
    print(0)
else:
    for i in range(n):
        res *= a[i]

        if a[i] == 0:
            break
        if res > 10**18:
            print(-1)
            break


    if res > 10**18:
        pass
    else:
        print(res)

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

a = list(map(int, input().split()))

res = 1

for i in range(n):
    res *= a[i]


if res > 10**18:
    print(-1)
else:
    print(res)


Fixed submission:
n = int(input())

a = list(map(int, input().split()))

res = 1

if 0 in a:
    print(0)
else:
    for i in range(n):
        res *= a[i]

        if a[i] == 0:
            break
        if res > 10**18:
            print(-1)
            break


    if res > 10**18:
        pass
    else:
        print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
A = [int(i) for i in input().split()]
for a in A:
  ans *= a
if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
N = int(input())
ans = 1
A = [int(i) for i in input().split()]
if 0 in A:
  print(0)
  exit()
for a in A:
  ans *= a
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input())
S = input()
if len(S) > K:
  print(S[:K]+"...")
else:
  print(S)


Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  print(S[:K]+"...")
else:
  print(S)

Buggy python submission (verdict: Runtime Error):
k = int(input())
S = input()
if len(S) > K:
  print(S[:K])
else:
  print(S)

Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  print(S[:K]+"...")
else:
  print(S)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
K = int(input())
total = 0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      total += gcd(i,j,k)
print(total)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
total = K*K
for i in range(2,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      total += gcd(i,j,k)
print(total)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      total += gcd(i,j,k)
print(total)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
total = K*K
for i in range(2,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      total += gcd(i,j,k)
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
X = [0]*3
for s in S:
  if s == "R":
    X[0] += 1
  elif s == "B":
    X[1] += 1
  else:
    X[2] += 1
total = X[0]*X[1]*X[2]
flag = [False] * 3
for i in range(N-2):
  for j in range(i+1, N-1):
    if S[i] == "R":
      flag[0] = True
    elif S[i] == "B":
      flag[1] = True
    else:
      flag[2] = True
    if S[j] == "R":
      flag[0] = True
    elif S[j] == "B":
      flag[1] = True
    else:
      flag[2] = True
    k = j + j - i
    if k <= N-1:
      if S[k] == "R":
        flag[0] = True
      elif S[k] == "B":
        flag[1] = True
      else:
        flag[2] = True
    #print(total, i,j,k, flag)
    if all(flag):
      total -= 1
    flag = [False]*3
print(total)

Fixed submission:
N = int(input())
S = input()
X = [0]*3
for s in S:
  if s == "R":
    X[0] += 1
  elif s == "B":
    X[1] += 1
  else:
    X[2] += 1
total = X[0]*X[1]*X[2]
flag = [False] * 3
for i in range(N-2):
  for j in range(i+1, N-1):
    if S[i] == "R":
      flag[0] = True
    elif S[i] == "B":
      flag[1] = True
    else:
      flag[2] = True
    if S[j] == "R":
      flag[0] = True
    elif S[j] == "B":
      flag[1] = True
    else:
      flag[2] = True
    k = j + j - i
    if k <= N-1:
      if S[k] == "R":
        flag[0] = True
      elif S[k] == "B":
        flag[1] = True
      else:
        flag[2] = True
    if all(flag):
      total -= 1
    flag = [False]*3
print(total)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
num = c**2+a**2+b**2-2*a*c+2*a*b-2*b*c
if bin(num) <= bin(4*a*b):
  print("No")
else:
  print("Yes")

Fixed submission:
k = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (c-a-b)**2 > 4*a*b:
  print("Yes")
else:
  print("No")

Fixed submission:
k = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])