Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(n) for n in input().split()]
#dice = [int(n) for n in input().split()]
evs = [(1 + int(n))/2 for n in input().split()]
maxev = 0
for i in range(N - K + 1):
    current_ev = 0
    for j in range(K):
        current_ev += evs[i + j]
    maxev = max(maxev, current_ev)

print(maxev)

Fixed submission:
N, K = [int(n) for n in input().split()]
#dice = [int(n) for n in input().split()]
evs = [(1 + int(n))/2 for n in input().split()]
cumsum = [0]

for i in range(1,N+1):
    cumsum.append(cumsum[i-1] + evs[i-1])

k_cum = [cumsum[i+K] - cumsum[i] for i in range(N-K+1)]

print(max(k_cum))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(n) for n in input().split()]
#dice = [int(n) for n in input().split()]
evs = [(1 + int(n))/2 for n in input().split()]
maxev = 0
for i in range(N - K + 1):
    current_ev = 0
    for j in range(K):
        current_ev += evs[i + j]
    maxev = max(maxev, current_ev)

print(maxev)

Fixed submission:
N, K = [int(n) for n in input().split()]
#dice = [int(n) for n in input().split()]
evs = [(1 + int(n))/2 for n in input().split()]
cumsum = [0]

for i in range(1,N+1):
    cumsum.append(cumsum[i-1] + evs[i-1])

k_cum = [cumsum[i+K] - cumsum[i] for i in range(N-K+1)]

print(max(k_cum))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(n) for n in input().split()]
dice = [int(n) for n in input().split()]

def ev(p):
    return (1 + p)/2

maxev = 0
for i in range(len(dice) - K + 1):
    current_ev = 0
    for j in range(K):
        current_ev += ev(dice[i + j])
    maxev = max(maxev, current_ev)

print(maxev)

Fixed submission:
N, K = [int(n) for n in input().split()]
#dice = [int(n) for n in input().split()]
evs = [(1 + int(n))/2 for n in input().split()]
cumsum = [0]

for i in range(1,N+1):
    cumsum.append(cumsum[i-1] + evs[i-1])

k_cum = [cumsum[i+K] - cumsum[i] for i in range(N-K+1)]

print(max(k_cum))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
L = [int(n) for n in input().split()]
L = sorted(L)

triples = set()

for i in range(len(L)):
    for j in range(i):
        a = L[i]
        b = L[j]

        right_index = j
        left_index = bisect.bisect_right(L, a-b)
        
        for k in range(left_index, right_index):
            c = L[k]
            triple = frozenset([a,b,c])
            if len(triple) == 3:
                triples.add(triple)

print(len(triples))

Fixed submission:
import bisect

N = int(input())
L = [int(n) for n in input().split()]
L = sorted(L)

total = 0

for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        right_endpoint = bisect.bisect_left(L, a+b, j)
        total += right_endpoint - j - 1

print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
L = sorted([int(n) for n in input().split()])

triples = set()

for i in range(len(L)):
    for j in range(i):
        a = L[i]
        b = L[j]

        right_index = bisect.bisect_left(L, a + b)
        left_index = bisect.bisect_right(L, abs(a - b))
        
        for k in range(left_index, right_index):
            triple = frozenset([i,j,k])
            if len(triple) == 3:
                triples.add(frozenset([i,j,k]))

print(len(triples))

Fixed submission:
import bisect

N = int(input())
L = [int(n) for n in input().split()]
L = sorted(L)

total = 0

for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        right_endpoint = bisect.bisect_left(L, a+b, j)
        total += right_endpoint - j - 1

print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
L = sorted([int(n) for n in input().split()])

triples = set()

for i in range(len(L)):
    for j in range(i):
        a = L[i]
        b = L[j]

        right_index = bisect.bisect_left(L, a + b)
        left_index = bisect.bisect_right(L, abs(a - b))
        
        for k in range(left_index, right_index):
            triple = frozenset([i,j,k])
            if len(triple) == 3:
                triples.add(frozenset([i,j,k]))

print(len(triples))

Fixed submission:
import bisect

N = int(input())
L = [int(n) for n in input().split()]
L = sorted(L)

total = 0

for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        right_endpoint = bisect.bisect_left(L, a+b, j)
        total += right_endpoint - j - 1

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

N = int(input())

Heights = [int(n) for n in input().split()]
Costs = [math.inf for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i == 1:
        Costs[i] = abs(Heights[1] - Heights[0])
    else:
        Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))

print(Costs[-1])


Fixed submission:
N = int(input())

Heights = [int(n) for n in input().split()]
Costs = [-1 for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i == 1:
        Costs[i] = abs(Heights[1] - Heights[0])
    else:
        Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))

print(Costs[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(n) for n in input().split()]

Heights = [int(n) for n in input().split()]
Costs = [float('inf') for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i < K:
        for j in range(i+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))
    else:
        #Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))
        for j in range(K+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))

print(Costs[-1])


Fixed submission:
N, K = [int(n) for n in input().split()]

Heights = [int(n) for n in input().split()]
Costs = [float('inf') for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i < K:
        for j in range(i+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))
    else:
        #Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))
        for j in range(K+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))

print(Costs[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(n) for n in input().split()]

Heights = [int(n) for n in input().split()]
Costs = [float('inf') for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i < K:
        for j in range(i+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))
    else:
        #Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))
        for j in range(K+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))

print(Costs[-1])


Fixed submission:
N, K = [int(n) for n in input().split()]

Heights = [int(n) for n in input().split()]
Costs = [float('inf') for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i < K:
        for j in range(i+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))
    else:
        #Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))
        for j in range(K+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))

print(Costs[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys

S = input()

while len(S) > 0:
    if len(S) < 5:
        print('NO')
        sys.exit(0)
    third = S[-3]
    if third == 'e':
        if len(S) < 5 or S[-5:] != 'dream':
            print('NO')
            sys.exit(0)
        S = S[:-5]
    if third == 'a':
        if len(S) < 5 or S[-5:] != 'erase':
            print('NO')
            sys.exit(0)
        S = S[:-5]
    if third == 'm':
        if len(S) < 7 or S[-7:] != 'dreamer':
            print('NO')
            sys.exit(0)
        S = S[:-7]
    if third == 's':
        if len(S) < 6 or S[-6:] != 'eraser':
            print('NO')
            sys.exit(0)
        S = S[:-6]

print('YES')

Fixed submission:
import sys

S = input()

while len(S) > 0:
    if len(S) < 5:
        print('NO')
        sys.exit(0)
    third = S[-3]
    if third == 'e':
        if len(S) < 5 or S[-5:] != 'dream':
            print('NO')
            sys.exit(0)
        S = S[:-5]
        continue
    if third == 'a':
        if len(S) < 5 or S[-5:] != 'erase':
            print('NO')
            sys.exit(0)
        S = S[:-5]
        continue
    if third == 'm':
        if len(S) < 7 or S[-7:] != 'dreamer':
            print('NO')
            sys.exit(0)
        S = S[:-7]
        continue
    if third == 's':
        if len(S) < 6 or S[-6:] != 'eraser':
            print('NO')
            sys.exit(0)
        S = S[:-6]
        continue
    else:
        print('NO')
        sys.exit(0)

print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
import sys

S = input()

while True:
    if S == '':
        print('YES')
        sys.exit(0)
    if len(S) < 5:
        print('NO')
        sys.exit(0)
    third = S[-3]
    if third == 'e':
        if len(S) < 5 or S[-5:] != 'dream':
            print('NO')
            sys.exit(0)
        S = S[:-5]
    if third == 'a':
        if len(S) < 5 or S[-5:] != 'erase':
            print('NO')
            sys.exit(0)
        S = S[:-5]
    if third == 'm':
        if len(S) < 7 or S[-7:] != 'dreamer':
            print('NO')
            sys.exit(0)
        S = S[:-7]
    if third == 's':
        if len(S) < 6 or S[-6:] != 'eraser':
            print('NO')
            sys.exit(0)
        S = S[:-6]


Fixed submission:
import sys

S = input()

while len(S) > 0:
    if len(S) < 5:
        print('NO')
        sys.exit(0)
    third = S[-3]
    if third == 'e':
        if len(S) < 5 or S[-5:] != 'dream':
            print('NO')
            sys.exit(0)
        S = S[:-5]
        continue
    if third == 'a':
        if len(S) < 5 or S[-5:] != 'erase':
            print('NO')
            sys.exit(0)
        S = S[:-5]
        continue
    if third == 'm':
        if len(S) < 7 or S[-7:] != 'dreamer':
            print('NO')
            sys.exit(0)
        S = S[:-7]
        continue
    if third == 's':
        if len(S) < 6 or S[-6:] != 'eraser':
            print('NO')
            sys.exit(0)
        S = S[:-6]
        continue
    else:
        print('NO')
        sys.exit(0)

print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
# 整数の入力
import numpy as np
import sys
x=200000
sys.setrecursionlimit(x)

N = int(input())
S = input()


def check_condition(S):
    N = len(S)
    ind = np.where(S=="R")[0]
    if len(ind) == 0 or len(ind) == N:
        return True
    
    if np.max(ind) == len(ind) - 1:
        return True
    
    return False

def action(S):
    W_index = np.where(S=="W")[0][0]
    R_index = np.where(S=="R")[0][-1]
    S[W_index] = "R"
    S[R_index] = "W"
    return S

def alter(S, M):
    if check_condition(S):
        return M
    
    S = action(S)
    
    return alter(S, M+1)

S = np.array(list(S))
print(alter(S,0))

Fixed submission:
# 整数の入力
import numpy as np

N = int(input())
S = input()


def check_condition(S):
    N = len(S)
    ind = np.where(S=="R")[0]
    if len(ind) == 0 or len(ind) == N:
        return True
    
    if np.max(ind) == len(ind) - 1:
        return True
    
    return False

def alter(S):
    if check_condition(S):
        return 0
    ind = np.where(S=="R")[0]
    num_r = len(ind)
    num_offset = np.sum(ind > num_r - 1)
    return num_offset

S = np.array(list(S))
print(alter(S))

Buggy python submission (verdict: Time Limit Exceeded):
# 整数の入力
import numpy as np
N = int(input())
S = input()


def check_condition(S):
    N = len(S)
    ind = np.where(S=="R")[0]
    if len(ind) == 0 or len(ind) == N:
        return True
    
    if np.max(ind) == len(ind) - 1:
        return True
    
    return False

def action(S):
    W_index = np.where(S=="W")[0][0]
    R_index = np.where(S=="R")[0][-1]
    S[W_index] = "R"
    S[R_index] = "W"
    return S

def alter(S, M):
    if check_condition(S):
        return M
    
    S = action(S)
    
    return alter(S, M+1)

S = np.array(list(S))
print(alter(S,0))

Fixed submission:
# 整数の入力
import numpy as np

N = int(input())
S = input()


def check_condition(S):
    N = len(S)
    ind = np.where(S=="R")[0]
    if len(ind) == 0 or len(ind) == N:
        return True
    
    if np.max(ind) == len(ind) - 1:
        return True
    
    return False

def alter(S):
    if check_condition(S):
        return 0
    ind = np.where(S=="R")[0]
    num_r = len(ind)
    num_offset = np.sum(ind > num_r - 1)
    return num_offset

S = np.array(list(S))
print(alter(S))
Buggy python submission (verdict: Runtime Error):
import math
N= int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
prod = math.prod(A)

count = 0

for i in range(N):
    qualify = 1

    if i > 1 and A[i - 1] == A[i]:
        continue

    if prod/A[i] % A[i] != 0:
        continue

    for j in range(i+1, N):
        if (A[i] % A[j]) == 0:
            qualify = 0
            break


    count += qualify


print(count)




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

not_p = set(range(102)) - set(P)

min_value = 200
min_list = []

for v in not_p:
    dist = abs(X-v)

    if dist < min_value:
        min_value = dist
        min_list = [v]

    if dist == min_value:
        min_list.append(v)

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

L = [1] * A + [0] * B + [-1] * C
print(sum(L[:K]))

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

def mysum(A, B, C, K):
  if K <= A:
    return(K)
  
  if K <= A+B:
    return(A)
  
  return(A + -1 * (K-A-B))
 
print(mysum(A, B, C, K))
Buggy python submission (verdict: Runtime Error):
contest = int(input())

if contest == "ABC":
  print("ARC")
else:
  print("ABC")



Fixed submission:
contest = str(input())
 
if contest == "ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))

S = set(range(N))
A_list = []
B_list = []

for _ in range(M):
  A, B = map(int, input().split())
  A_list.append(A - 1)
  B_list.append(B - 1)

for A, B in zip(A_list, B_list):
  A_height = H[A]
  B_height = H[B]
  
  if A_height <= B_height:
    S = S - set([A])
  
  if B_height <= A_height: 
    S = S - set([B])
  
  
print(len(S)) 
 

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


A_list = []
B_list = []
Remove_list = []

for _ in range(M):
  A, B = map(int, input().split())
  A_list.append(A - 1)
  B_list.append(B - 1)

for A, B in zip(A_list, B_list):
  A_height = H[A]
  B_height = H[B]
  
  if A_height <= B_height:
    Remove_list.append(A)
  
  if B_height <= A_height: 
    Remove_list.append(B)
  
S = set(range(N))
S = S - set(Remove_list)

print(len(S))

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

S = set(range(N))

for _ in range(M):
  A, B = map(int, input().split())
  A = A - 1
  B = B - 1
  A_height = H[A]
  B_height = H[B]
  
  if A_height <= B_height:
    S = S - set([A])
  
  if B_height <= A_height: 
    S = S - set([B])
    
  
  
print(len(S)) 
 

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


A_list = []
B_list = []
Remove_list = []

for _ in range(M):
  A, B = map(int, input().split())
  A_list.append(A - 1)
  B_list.append(B - 1)

for A, B in zip(A_list, B_list):
  A_height = H[A]
  B_height = H[B]
  
  if A_height <= B_height:
    Remove_list.append(A)
  
  if B_height <= A_height: 
    Remove_list.append(B)
  
S = set(range(N))
S = S - set(Remove_list)

print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
numb = input().split()

def answer(N, numb):
    for i in range(N):
        for j in range(N):
            if i <= j:
                continue

            if numb[i] == numb[j]:
                return "NO"

    return "YES"
 
print(answer(N,numb))


Fixed submission:
N = int(input())
numb = input().split()

if len(set(numb)) == len(numb):
    print("YES")
else:
    print("NO")

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

def answer(N, numb):
    for i in range(N):
        for j in range(N):
            if i == j:
                continue

            if numb[i] == numb[j]:
                return "NO"

    return "YES"
 
print(answer(N,numb))

Fixed submission:
N = int(input())
numb = input().split()

if len(set(numb)) == len(numb):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
if K >= N:
    print(0)
elif K == 0:
    answer = np.sum(H)
    print(answer)
else:
    ind = np.argpartition(H, -K)[-K:]
    print(ind)
    top_k = H[ind]
    answer = np.sum(H) - np.sum(top_k)
    print(answer)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
H = np.array(list(map(int,input().split())))

if K >= N:
    print(0)
elif K == 0:
    answer = np.sum(H)
    print(answer)
else:
    ind = np.argpartition(H, -K)[-K:]
    top_k = H[ind]
    answer = np.sum(H) - np.sum(top_k)
    print(answer)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
A.sort()
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  a=set(A)
  if b in a:
    k=A.count(b)
    x=A.index(b)
    f=x+k
    for i in range(x,f):
      A[i]=c
    ans=sum(A)
  print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
k={}
ans=sum(A)
for i in A:
  if i in k:
    k[i]+=1
  else:
    k[i]=1
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  if b in k:
    f=c*k[b]-b*k[b]
    ans+=f
    p=k[b]
    del k[b]
    if c in k:
      k[c]+=p
    else:
      k[c]=p
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
  ans*=i
if ans<=10**18:
  print(ans)
else:
  print(-1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
  ans*=i
  if ans>10**18:
    break
if 0 in a:
  print(0)
elif ans<=10**18:
  print(ans)
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
  ans*=i
if ans<=10**18:
  print(ans)
else:
  print(-1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
  ans*=i
  if ans>10**18:
    break
if 0 in a:
  print(0)
elif ans<=10**18:
  print(ans)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
for i in range(s.count("?")):
  s[s.index("?")]="D"
print("".join(s))

Fixed submission:
s=list(input())
for i in range(len(s)):
  if s[i]=="?":
    s[i]="D"
print("".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
for i in range(s.count("?")):
  s[s.index("?")]="D"
print("".join(s))

Fixed submission:
s=list(input())
for i in range(len(s)):
  if s[i]=="?":
    s[i]="D"
print("".join(s))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n==3:
  print("bon")
elif n=0 or n=1 or n=6 or n=8:
  print("pon")
else:
  print("hon")

Fixed submission:
n=int(input())
n=n%10
if n==3:
  print("bon")
elif n==0 or n==1 or n==6 or n==8:
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
k=0
if n%2==1:
  for i in range(m):
    print(i+1,end=" ")
    print(n-i)
else:
  for i in range((n+2)//4-1):
    if k>=m:
      break
    print(i+1,end=" ")
    print(n-i)
    k+=1
  for i in range((n+2)//4-1,n//2):
    if k>=m:
      break
    print(i+1,end=" ")
    print(n-i-1)
    k+=1

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l1=[0]*n
l2=[0]*n
k=0
ans=0
for i in a:
  if k+i<n:
    l1[k+i]+=1
  if k-i>=0:
    l2[k-i]+=1
  k+=1
for i in range(n):
  ans+=l1[i]*l2[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(map(int,input().split()))
for i in range(n):
  print(s.count(i+1))


Fixed submission:
n=int(input())
s=list(map(int,input().split()))
k=[0]*n
for i in s:
  k[i-1]+=1
for i in k:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(map(int,input().split()))
for i in range(n):
  print(s.count(i+1))


Fixed submission:
n=int(input())
s=list(map(int,input().split()))
k=[0]*n
for i in s:
  k[i-1]+=1
for i in k:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(map(int,input().split()))
for i in range(n):
  print(s.count(i+1))

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
k=[0]*n
for i in s:
  k[i-1]+=1
for i in k:
  print(i)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(int,input()))
for i in range(n):
  print(s.count(i+1))

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
k=[0]*n
for i in s:
  k[i-1]+=1
for i in k:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
k=int(input())
ans=0
for i in range(1,k+1):
  for u in range(1,k+1):
    for y in range(1,k+1):
      ans+=gcd(i,u,y)
print(ans)



Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
k=int(input())
ans=0
for i in range(1,k+1):
  for u in range(1,k+1):
    for y in range(1,k+1):
      ans+=gcd(i,u,y)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())
r=s.count("R")
b=s.count("B")
g=s.count("G")
ans=0
herasu=0
for i in range(n):
  if s[i]=="R":
    ab=s[:i].count("B")
    ag=s[:i].count("G")
    bb=b-ab
    bg=g-ag
    l=ab*bg+ag*bb
    ans+=l
  elif s[i]=="B":
    ar=s[:i].count("R")
    ag=s[:i].count("G")
    br=r-ar
    bg=g-ag
    l=ar*bg+ag*br
    ans+=l
  else:
    ab=s[:i].count("B")
    ar=s[:i].count("R")
    bb=b-ab
    br=r-ar
    l=ab*br+ar*bb
    ans+=l
for i in range(1,n):
  for e in range(i):
    if s[i]!=s[e]:
      if i*2-e<=n-1:
        if s[e]!=s[i*2-e] and s[i]!=s[i*2-e]:
          herasu+=1
print(ans-herasu)

Fixed submission:
n=int(input())
s=list(input())
r=s.count("R")
b=s.count("B")
g=s.count("G")
ans=0
herasu=0
for i in range(n):
  if s[i]=="R":
    ab=s[:i].count("B")
    ag=s[:i].count("G")
    bb=b-ab
    bg=g-ag
    l=ab*bg+ag*bb
    ans+=l
  elif s[i]=="B":
    ar=s[:i].count("R")
    ag=s[:i].count("G")
    br=r-ar
    bg=g-ag
    l=ar*bg+ag*br
    ans+=l
  else:
    ab=s[:i].count("B")
    ar=s[:i].count("R")
    bb=b-ab
    br=r-ar
    l=ab*br+ar*bb
    ans+=l
for i in range(1,n):
  for e in range(i):
    if s[i]!=s[e]:
      if i*2-e<=n-1:
        if s[e]!=s[i*2-e] and s[i]!=s[i*2-e]:
          herasu+=1
print(ans-herasu)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,int,input()))
k=sum(a)/(4*m)
x=0
for i in a:
  if a>=k:
    x+=1
if x>=m:
  print("Yes")
else:
  print("No")

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
k=sum(a)/(4*m)
x=0
for i in a:
  if i>=k:
    x+=1
if x>=m:
  print("Yes")
else:
  print("No")