Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

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

for i in range(n-k):
    if reduce(mul,a[i:k+i]) < reduce(mul,a[i+1:k+i+1]):
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n-k):
    if a[i] < a[k+i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
a = input()
if a.str.isupper():
  print("A")
else:
  print("a")

Fixed submission:
a = input()
if a.isupper():
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))

l = [i for i in range(1,101)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])

Fixed submission:
x,n = map(int, input().split())
p = list(map(int, input().split()))

l = [i for i in range(102)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])

Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = list(map(int, input().split()))
l = [i for i in range(1,101)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])

Fixed submission:
x,n = map(int, input().split())
p = list(map(int, input().split()))

l = [i for i in range(102)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])
Buggy python submission (verdict: Runtime Error):
a,v =  map(int, input().split())
b,w =  map(int, input().split())
t = int(input())

if abs(w*t+b)-abs(v*t+a) >=0:
    print("NO")
else:
    print("YES")

Fixed submission:
s = input()
print(s[:3])
Buggy python submission (verdict: Runtime Error):
h,n = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print("Yes") if a[0] + a[1] > h else print("No")

Fixed submission:
h,n = map(int, input().split())
a = list(map(int, input().split()))
print("Yes") if sum(a) >= h else print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input)
s = input()
s2 = s.replace("ABC","")
print(int((len(s)-len(s2))/3))

Fixed submission:
n = int(input())
s = input()
s2 = s.replace("ABC","")
print(int((len(s)-len(s2))/3))
Buggy python submission (verdict: Runtime Error):
s = int(input())
s_r = s[::-1]
cnt = 0
for i in range(len(s)):
    if s[i] != s_r[i]:
        cnt += 1
print(cnt//2)

Fixed submission:
s = input()
s_r = s[::-1]
cnt = 0
for i in range(len(s)):
    if s[i] != s_r[i]:
        cnt += 1
print(cnt//2)
Buggy python submission (verdict: Runtime Error):
n,l = int(input())
tastes = [(i + l) for i in range(n)]
t = tastes.copy()
for j in range(n):
    t[j] = abs(t[j])
del tastes[t.index(min(t))]
print(sum(tastes))

Fixed submission:
n,l = map(int, input().split())
tastes = [(i + l) for i in range(n)]
t = tastes.copy()
for j in range(n):
    t[j] = abs(t[j])
del tastes[t.index(min(t))]
print(sum(tastes))
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
h,w = map(int,input().split())

 print(max(H*W-h*W-(H-h)*w,0))

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())

print(max(H*W-h*W-(H-h)*w,0))
Buggy python submission (verdict: Runtime Error):
# a,b,k = map(int, input().split())
l = []
for i in range(1,100):
    if (a % i == 0) & (b % i == 0):
        l.append(i)
print(l[k-1])

Fixed submission:
a,b,k = map(int, input().split())
l = []
for i in range(1,101):
    if (a % i == 0) & (b % i == 0):
        l.append(i)
print(l[-k])
Buggy python submission (verdict: Runtime Error):
s = list(int(input()))
for i in range(1000001):
    if s[i] % 2 == 0:
        s.append(s[i]/2)
    else:
        s.append(3 * s[i] + 1)
    if s[i] in s[:i]:
        print(i+1)
        break

Fixed submission:
s = [int(input())]
for i in range(1000001):
    if s[i] % 2 == 0:
        s.append(s[i]/2)
    else:
        s.append(3 * s[i] + 1)
    if s[i] in s[:i]:
        print(i+1)
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n==1:
  print("Hello World")
else:
  i = [int(input()) for i in range(3)]
  print(i[0]+i[1])

Fixed submission:
n = int(input())
if n==1:
  print("Hello World")
else:
  i = [int(input()) for i in range(2)]
  print(i[0]+i[1])

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

if i[0]==1:
  print("Hello World")
else:
  print(i[1]+i[2])

Fixed submission:
n = int(input())
if n==1:
  print("Hello World")
else:
  i = [int(input()) for i in range(2)]
  print(i[0]+i[1])
Buggy python submission (verdict: Runtime Error):
def lcm_base(x,y):
    return (x * y) // math.gcd(x,y)

def n_lcm(*numbers):
    print(reduce(lcm_base,numbers,1))
    
n_lcm(2,int(input()))

Fixed submission:
import math

def lcm_base(x,y):
    return (x * y) // math.gcd(x,y)

print(lcm_base(2,int(input())))
Buggy python submission (verdict: Runtime Error):
s = input()
s.sort()
if "".join(s) = "abc":
    print("Yes")
else:
    print("No")

Fixed submission:
s = list(input())
s.sort()
if "".join(s) == "abc":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print("Yes") if c =< a+b else print("No")

Fixed submission:
a,b,c = map(int, input().split())
print("Yes") if c <= a+b else print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [map(int, input().split())]
l = [0 for i in range(n)]
for i in range(len(a)):
    while a[i] % 2 == 0:
        a[i] /= 2
        l[i] += 1
print(min(l))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = [0 for i in range(n)]
for i in range(len(a)):
    while a[i] % 2 == 0:
        a[i] /= 2
        l[i] += 1
print(min(l))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
l = [0 for i in range(n)]
for i in range(len(a)):
    while a[i] % 2 == 0:
        a[i] /= 2
        l[i] += 1
print(min(l))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = [0 for i in range(n)]
for i in range(len(a)):
    while a[i] % 2 == 0:
        a[i] /= 2
        l[i] += 1
print(min(l))
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
ref = 1

for i in range(n):
  if ref * 2 < ref + k:
    ref *= 2
  else:
    ref += k

print(ref)

Fixed submission:
import math
n = int(input())
print(int(math.sqrt(n))**2)
Buggy python submission (verdict: Runtime Error):
l = [0] * n
r = [0] * n
for i in range(n):
    l[i],r[i] = map(int, input().split())
res = 0

for i in range(n):
  res += r[i]-l[i]+1

print(res)

Fixed submission:
n = int(input())
l = [0] * n
r = [0] * n
for i in range(n):
    l[i],r[i] = map(int, input().split())
res = 0

for i in range(n):
  res += r[i]-l[i]+1

print(res)
Buggy python submission (verdict: Runtime Error):
x,t = map(int, input().split())
print(max(x-t,0)

Fixed submission:
x,t = map(int, input().split())
print(max(x-t,0))
Buggy python submission (verdict: Runtime Error):
n = int(intput())
res = []
for i in range (1,n + 1):
    cnt = 0
    while i % 2 == 0:
        i /= 2
        cnt += 1
    res.append(cnt)
print(res.index(max(res))+1)

Fixed submission:
n = int(input())
res = []
for i in range (1,n + 1):
    cnt = 0
    while i % 2 == 0:
        i /= 2
        cnt += 1
    res.append(cnt)
print(res.index(max(res))+1)
Buggy python submission (verdict: Runtime Error):
x,a,b = map(int, input().split())
if b-a < 1:
    print("delicious")
elif b-a = 1:
    print("safe")
else:
    print("dangerous")

Fixed submission:
x,a,b = map(int, input().split())
if b-a < 1:
    print("delicious")
elif b-a < x + 1:
    print("safe")
else:
    print("dangerous")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [0,int(input()) for i in range(n)]
cnt = 1
next_a = a[1]
while cnt <= 10**5:
    next_a = a[next_a]
    cnt += 1
    if next_a == 2:
        break

if cnt < 10**5:
    print(cnt)
else:
    print(-1)

Fixed submission:
n = int(input())
a = [0] + [int(input()) for i in range(n)]
cnt = 1
next_a = a[1]

if a[1] == 2:
    print(cnt)

else:
    while cnt <= 10**5:
        next_a = a[next_a]
        cnt += 1
        if next_a == 2:
            break

    if cnt <= 10**5:
        print(cnt)
    else:
        print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
print(max(a)-min(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))
Buggy python submission (verdict: Runtime Error):
a,b = map(str, input().split())
print(a+b) if a+b <= 10 else print("error")

Fixed submission:
a,b = map(int, input().split())
print(a+b) if a+b < 10 else print("error")
Buggy python submission (verdict: Runtime Error):
a,b = map(int(input().split()))

a = 14 if a == 1 else a
b = 14 if b == 1 else b

if a > b:
    print("Alice")
elif a < b:
    print("Bob")
else:
    print("Draw")

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

a = 14 if a == 1 else a
b = 14 if b == 1 else b

if a > b:
    print("Alice")
elif a < b:
    print("Bob")
else:
    print("Draw")
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l == s:
                cnt += 1
print(cnt)

Fixed submission:
k,s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(k+1):
            if 0 <= s-(i+j) <= k:
                cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,l = map(int,input().split())
s = [input() for _ in range(l)]
s.sort()
ss = ""
for i in range(n):
    ss += s[i]
print(ss)

Fixed submission:
n,l = map(int,input().split())
s = [input() for _ in range(n)]
s.sort()
ss = ""
for i in range(n):
    ss += s[i]
print(ss)

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

s = [list(int(input())) for i in range(l)]

s.sort()
ss = ""
for i in range(n):
    ss += s[i]
print(ss)

Fixed submission:
n,l = map(int,input().split())
s = [input() for _ in range(n)]
s.sort()
ss = ""
for i in range(n):
    ss += s[i]
print(ss)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
mod = 1000000007
ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        n = (A[i] * A[j])%mod
        ans += n

print(ans%mod)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 1000000007
ans = 0
cs = [0]*N
cs[0] = A[0]

for i in range(1, N):
    cs[i] = cs[i-1] + A[i]

for i in range(N-1):
    n = A[i] * (cs[-1] - cs[i]) % mod
    ans += n
    ans %= mod

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
score = [0]*(N+1)

score[1] = A[1]
for i in range(2, K+1):
    score[i] = score[i-1]*A[i]

for i in range(K+1, N+1):
    score[i] = score[i-1]*A[i]//A[i-K]
    print('Yes' if score[i] > score[i-1] else 'No')


Fixed submission:
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))


for i in range(K+1, N+1):
    print('Yes' if A[i] > A[i-K] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
score = [0]*(N+1)

s = 1
for i in range(1, K+1):
    s *= A[i]
score[K] = s

for i in range(K+1, N+1):
    score[i] = score[i-1]*A[i]//A[i-K]
    print('Yes' if score[i] > score[i-1] else 'No')

Fixed submission:
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))


for i in range(K+1, N+1):
    print('Yes' if A[i] > A[i-K] else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

csA = A
for i in range(1, N+1):
    csA[i] = csA[i-1] + csA[i]
csB = B
for i in range(1, M+1):
    csB[i] = csB[i-1] + csB[i]

if csA[-1] + csB[-1] <= K:
    print(N+M)

else:
    
    ans = 0
               
    for i in range(N+1):
        wa = csA[i]
        numA = i
        if wa <= K:
            for j in range(M+1):
                numB = j
                wa += csB[j]
                if wa > K:
                    if numA + numB - 1 > ans:
                        ans = numA + numB - 1
                    break
                else:
                    wa = csA[i]
        else:
            break

    print(ans)

Fixed submission:
import numpy as np
N, M, K = map(int, input().split())
A = np.cumsum([0] + list(map(int, input().split())))
B = np.cumsum([0] + list(map(int, input().split())))
ans = 0
j = M
for i in range(N+1):
  if A[i] > K:
    break
  while A[i] + B[j] > K:
    j -= 1
  ans = max(ans,i+j)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

csA = np.cumsum(A)
csB = np.cumsum(B)

if csA[-1] + csB[-1] <= K:
    print(N+M)

else:
    
    ans = 0
               
    for i in range(N+1):
        wa = csA[i]
        numA = i
        if wa <= K:
            for j in range(M+1):
                numB = j
                wa += csB[j]
                if wa > K:
                    if numA + numB - 1 > ans:
                        ans = numA + numB - 1
                    break
                else:
                    wa = csA[i]
        else:
            break

    print(ans)

Fixed submission:
import numpy as np
N, M, K = map(int, input().split())
A = np.cumsum([0] + list(map(int, input().split())))
B = np.cumsum([0] + list(map(int, input().split())))
ans = 0
j = M
for i in range(N+1):
  if A[i] > K:
    break
  while A[i] + B[j] > K:
    j -= 1
  ans = max(ans,i+j)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

csA = np.cumsum(A)
csB = np.cumsum(B)

if csA[-1] + csB[-1] <= K:
    print(N+M)

else:
    
    ans = 0
               
    for i in range(N+1):
        wa = csA[i]
        numA = i
        if wa <= K:
            for j in range(M+1):
                numB = j
                wa += csB[j]
                if wa > K:
                    if numA + numB - 1 > ans:
                        ans = numA + numB - 1
                    break
                else:
                    wa = csA[i]
        else:
            break

    print(ans)

Fixed submission:
import numpy as np
N, M, K = map(int, input().split())
A = np.cumsum([0] + list(map(int, input().split())))
B = np.cumsum([0] + list(map(int, input().split())))
ans = 0
j = M
for i in range(N+1):
  if A[i] > K:
    break
  while A[i] + B[j] > K:
    j -= 1
  ans = max(ans,i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
def divisors(n):
    cnt = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i != n // i:
                cnt += 1
        i += 1
    return cnt
    
ans = 0
for k in range(1, N+1):
    ans += k*divisors(k)

print(ans)

Fixed submission:
N = int(input())
A = [0]*(N+1)
for i in range(1, N+1):
  for j in range(i, N+1, i):
    A[j] += j
print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

DP = [-1 for i in range(max(A)+1)]

A.sort()

for a in A:
  if DP[a] != 0:
    if DP[a] == 1:
      DP[a] = 0
      continue
    for i in range(2*a, max(A)+1, a):
      DP[i] = 0
    DP[a] = 1
  
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)

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

A.sort()
maxA = A[-1]
DP = [-1 for i in range(maxA+1)]
for a in A:
  if DP[a] != 0:
    if DP[a] == 1:
      DP[a] = 0
      continue
    for i in range(2*a, maxA+1, a):
      DP[i] = 0
    DP[a] = 1
  
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)

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

DP = [-1 for i in range(max(A)+1)]

A.sort()

for a in A:
  if DP[a] == -1:
    for i in range(2*a, max(A)+1, a):
      DP[i] = 0
    DP[a] = 1
  elif DP[a] == 1:
    DP[a] = 2
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)

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

A.sort()
maxA = A[-1]
DP = [-1 for i in range(maxA+1)]
for a in A:
  if DP[a] != 0:
    if DP[a] == 1:
      DP[a] = 0
      continue
    for i in range(2*a, maxA+1, a):
      DP[i] = 0
    DP[a] = 1
  
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)

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

ans = N

for i in range(N):
  for j in range(N):
    if j == i:
      continue
    else:
      if A[i]%A[j] == 0:
        ans -= 1
        break
        
print(ans)

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

A.sort()
maxA = A[-1]
DP = [-1 for i in range(maxA+1)]
for a in A:
  if DP[a] != 0:
    if DP[a] == 1:
      DP[a] = 0
      continue
    for i in range(2*a, maxA+1, a):
      DP[i] = 0
    DP[a] = 1
  
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if 0 in A:
  ans = 0
  
else:
  ans = 1
  for i in range(N):
    ans *= A[i]
  
if ans > 10**18:
  ans = -1
  
print(ans)

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

if 0 in A:
  ans = 0
  
else:
  ans = 1
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
 
ans = 1
 
for i in range(N):
  ans *= A[i]
  
if ans > 10**18:
  ans = -1
  
print(ans)

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

if 0 in A:
  ans = 0
  
else:
  ans = 1
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      ans = -1
      break

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:
  ans = -1
  
print(ans)

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

if 0 in A:
  ans = 0
  
else:
  ans = 1
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      ans = -1
      break

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:
  ans = -1
  
print(ans)

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

if 0 in A:
  ans = 0
  
else:
  ans = 1
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      ans = -1
      break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

ans = []
numA = min([A, K])

for i in range(B + 1):
  if K - numA - i <= C:
    wa = numA - (K - numA - i)
    ans.append(wa)
            
print(max(ans))
        

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

ans = []
numA = min([A, K])
numB = min([B, K - numA])
numC = K - numA - numB 

print(numA - numC)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().rstrip().split())
sunuke = [int(i) for i in range(1,N + 1)]
d = []
A = []

for i in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

for k in range(K):
  for i in range(d[k]):
    for j in A[i]:
      if j in sunuke:
        sunuke.remove(j)
    
print(len(sunuke))

Fixed submission:
N, K = map(int, input().rstrip().split())
sunuke = [int(i) for i in range(1,N + 1)]
d = []
A = []

for i in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

for k in range(K):
  for i in range(d[k]):
    if A[k][i] in sunuke:
      sunuke.remove(A[k][i])
  
    
print(len(sunuke))
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())

ans = 0
for i in range(B+1):
    if i > N:
        break
    n = (A * i // B) - A * (i // B)
    ans = max(ans, n)

print(ans)




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

x = min(B-1, N)

ans = (A * x // B) - A * (x // B)

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

keihin  = []
ans = 0
for i in S:
  if i not in keihin:
    keihin.append(i)
    ans += 1
print(ans)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
S.sort()

ans = N
for i in range(N-1):
  if S[i] == S[i+1]:
    ans -= 1
print(ans)

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

keihin  = []
ans = 0
for i in S:
  if i not in keihin:
    keihin.append(i)
    ans += 1
print(ans)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
S.sort()

ans = N
for i in range(N-1):
  if S[i] == S[i+1]:
    ans -= 1
print(ans)

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

keihin  = []

for i in S:
  if i not in keihin:
    keihin.append(i)
    
print(len(keihin))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
S.sort()

ans = N
for i in range(N-1):
  if S[i] == S[i+1]:
    ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

K = int(input())
ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    ab = gcd(a,b)
    for c in range(1, K+1):
      ans += gcd(ab,c)

print(ans)

Fixed submission:
import math

K = int(input())
ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    ab = math.gcd(a,b)
    for c in range(1, K+1):
      ans += math.gcd(ab,c)

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

cnt = 0
jk = {}
for j in range(1, N-1):
    jk[j] = []
    for k in range(j+1, N):
        if S[j] != S[k]:
            jk[j].append(k)

for i in range(N-2):
    for j in range(i+1, N-1):
        if S[i] == S[j]:
            continue
        ks = jk[j]
        for k in ks:
            if S[i] == S[k]:
                continue
            if j-i != k-j:
                cnt += 1

print(cnt)



Fixed submission:
N = int(input())
S = "A" + input()
r, g, b = 0, 0, 0

for s in S[1:]:
    if s == "R":
        r += 1
    elif s == "G":
        g += 1
    else:
        b += 1

pat = r*g*b

for i in range(1, N-1):
    for j in range(i+1, N):
        k = 2*j - i
        if (j+1 <= k <= N) and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            pat -= 1

print(pat)

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

cnt = 0
jk = {}
for j in range(1, N-1):
    jk[j] = []
    for k in range(j+1, N):
        if S[j] != S[k]:
            jk[j].append(k)

for i in range(N-2):
    for j in range(i+1, N-1):
        if S[i] == S[j]:
            continue
        ks = jk[j]
        for k in ks:
            if S[i] == S[k]:
                continue
            if j-i != k-j:
                cnt += 1

print(cnt)



Fixed submission:
N = int(input())
S = "A" + input()
r, g, b = 0, 0, 0

for s in S[1:]:
    if s == "R":
        r += 1
    elif s == "G":
        g += 1
    else:
        b += 1

pat = r*g*b

for i in range(1, N-1):
    for j in range(i+1, N):
        k = 2*j - i
        if (j+1 <= k <= N) and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            pat -= 1

print(pat)
Buggy python submission (verdict: Runtime Error):
L = int(input())

ans = 0
for i in range(1, L+1):
  for j in range(1, L+1):
    if L - i - j > 0:
      V = i*j*(L - i - j)
    if V > ans:
      ans = V
print(ans)

Fixed submission:
L = int(input())

ans = (L**3)/27
print(ans)