Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))



Fixed submission:
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(1, 100):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))

Buggy python submission (verdict: Runtime Error):
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)
    print(cost)

print(min(costs))



Fixed submission:
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(1, 100):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))

Buggy python submission (verdict: Runtime Error):
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) ** 2
    costs.append(cost)

print(min(costs))



Fixed submission:
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(1, 100):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))
Buggy python submission (verdict: Runtime Error):
import sys, os

if __name__ == '__main__':
    N = input()
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)

Fixed submission:
import sys, os

if __name__ == '__main__':
    N = int(input())
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)

Buggy python submission (verdict: Runtime Error):
import sys, os

if __name__ == '__main__':
    N = input()
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)


Fixed submission:
import sys, os

if __name__ == '__main__':
    N = int(input())
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)
Buggy python submission (verdict: Runtime Error):

ondo = input()
if ondo >= 30:
  print("Yes")
else:
  print("No")


Fixed submission:

ondo = input()
if int(ondo) >= 30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a=input();print(sum(list(map(int,input().split()))[:int(a[2])]))

Fixed submission:
n,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:k]))
Buggy python submission (verdict: Time Limit Exceeded):
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
cou = 0
name = ['']
key = True

while key:
  tmp = name.pop(0)
  for s in alph:
    name.append(tmp + s)
    cou += 1
    if cou==n:
      key = False
      break
print(tmp+s)

Fixed submission:
# けんちょんさんの記事見た！
# https://drken1215.hatenablog.com/entry/2020/06/21/225500
N = int(input())
res = ''

while N:
  N -= 1
  res += chr(ord('a') + N%26)
  N //= 26

print(res[::-1])  # 🍡( ´ ꒳ `🌸)さんありがとー٩(๑❛0❛๑)۶
Buggy python submission (verdict: Time Limit Exceeded):
n, *a = map(int, open(0).read().split())
a.sort()
key = [0]*n
for i in range(n-1):
  if key[i]: continue
  for j in range(i+1, n):
    if a[i]==a[j]:
      key[i] = 1
      key[j] = 1
    elif a[j]%a[i]==0:
      key[j] = 1
print(key.count(0))

Fixed submission:
N, *A = map(int, open(0).read().split())
A.sort()
dp = [True]*3*int(1e6)
x = -1
for a in A:
  if a == -1: continue
  x = a
  while x <= A[-1]:
    x += a
    dp[x] = False
  x = a

res = 0
for i, a in enumerate(A):
  if i > 0 and a == A[i-1]: continue
  if i < N-1 and a == A[i+1]: continue
  if dp[a]: res += 1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n, *a = map(int, open(0).read().split())
a.sort()
key = [False]*n
for i in range(n-1):
  if key[i]: continue
  for j in range(i+1, n):
    if a[j]==a[i]:
      key[i] = True
      key[j] = True
    elif a[j]%a[i]==0:
      key[j] = True
print(key.count(False))

Fixed submission:
N, *A = map(int, open(0).read().split())
A.sort()
dp = [True]*3*int(1e6)
x = -1
for a in A:
  if a == -1: continue
  x = a
  while x <= A[-1]:
    x += a
    dp[x] = False
  x = a

res = 0
for i, a in enumerate(A):
  if i > 0 and a == A[i-1]: continue
  if i < N-1 and a == A[i+1]: continue
  if dp[a]: res += 1
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)
K = int(input())
res = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      res += gcd(gcd(a, b), c)
print(res)

Fixed submission:
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)
K = int(input())
res = 0
for a in range(1, K+1):
  for b in range(a, K+1):
    for c in range(b, K+1):
      if len(set([a, b, c]))==3: res += gcd(gcd(a, b), c) * 6
      elif len(set([a, b, c]))==2: res += gcd(gcd(a, b), c) * 3
      else: res += gcd(gcd(a, b), c)
print(res)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=n-k*(-((k-n)//k))
print(min(a,abs(a-k))

Fixed submission:
n,k=map(int,input().split())
a=n-k*(-((k-n)//k))
print(min(a,abs(a-k)))
Buggy python submission (verdict: Runtime Error):
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)

Fixed submission:
s = input()
print('YNeos'[s=='AAA' or s=='BBB'::2])
Buggy python submission (verdict: Runtime Error):
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)

Fixed submission:
def main():
  a,b=map(int, input().split())
  for i in range(1251):
    if int(i*0.08)==a and int(i*0.1)==b:
      return i
  return -1
  
if __name__ == '__main__':
  print(main())
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
a=1
for _ in range(q):
  t = input()
  if t=='1':
    a *= -1
  else:
    if t[2]=='1':
      s = t[4:] + s[::a]
    else:
      s = s[::a] + t[4:]
    a=1
print(s[::a])

Fixed submission:
s=input();q=int(input());r,a=0,[[],[]]
for _ in range(q):
  t=input()
  if t=='1':r=-(-~r%2)
  else:a[~-r+int(t[2])].append(t[4])
print(''.join(a[~-r+1][::-1])+s[::r or 1]+''.join(a[~-r+2]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)

Fixed submission:
s=input();q=int(input());r,a=0,[[],[]]
for _ in range(q):
  t=input()
  if t=='1':r=-(-~r%2)
  else:a[~-r+int(t[2])].append(t[4])
print(''.join(a[~-r+1][::-1])+s[::r or 1]+''.join(a[~-r+2]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)

Fixed submission:
s=input();q=int(input());r,a=0,[[],[]]
for _ in range(q):
  t=input()
  if t=='1':r=-(-~r%2)
  else:a[~-r+int(t[2])].append(t[4])
print(''.join(a[~-r+1][::-1])+s[::r or 1]+''.join(a[~-r+2]))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
es = [(p+1)/2.0 for p in map(float, input().split())]
dp = 0
for i in range(n-k+1):
  dp = max(dp, sum(es[i:i+k]))
print(dp)

Fixed submission:
n, k, *ps = map(int, open(0).read().split())
dp = tmp = sum(ps[:k])
for i in range(1,n-k+1):
  tmp = tmp - ps[i-1] + ps[i+k-1]
  dp = max(dp, tmp)
print((dp+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
n, *ps = map(int, open(0).read().split())
cou = 1
for i, p in enumerate(ps[1:], 2):
  a = sorted(ps[:i])
  if a.index(p)==0:
    cou += 1
print(cou)

Fixed submission:
n, *ps = map(int, open(0).read().split())
mp = ps[0]
cou = 1
for p in ps[1:]:
  if mp > p:
    cou += 1
    mp = p
print(cou)

Buggy python submission (verdict: Time Limit Exceeded):
n, *ps = map(int, open(0).read().split())
cou = 1
for i, p in enumerate(ps[1:], 2):
  a = sorted(ps[:i])
  if a.index(p)==0:
    cou += 1
print(cou)

Fixed submission:
n, *ps = map(int, open(0).read().split())
mp = ps[0]
cou = 1
for p in ps[1:]:
  if mp > p:
    cou += 1
    mp = p
print(cou)
Buggy python submission (verdict: Runtime Error):
a1, a2, a3 = map(int, input())
if (a1+a2+a3)>21:
  print("bust")
else:
  print("win")

Fixed submission:
a1, a2, a3 = map(int, input().split())
if (a1+a2+a3)>21:
  print("bust")
else:
  print("win")
Buggy python submission (verdict: Runtime Error):
n=int(input());print(min(x+n/x-2for x in range(1,int(n**.5)+1)if n%x<0))

Fixed submission:
n=int(input());print(min(x+n//x-2for x in range(1,int(n**.5)+1)if n%x<1))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  t=0
  for x in range(1,n+1):
    for y in range(1,x+1):
      if x*y==n:
        return x+y-2

if __name__ == '__main__':
  print(main())

Fixed submission:
n=int(input());print(min(x+n//x-2for x in range(1,int(n**.5)+1)if n%x<1))
Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
points = [K] * N
for _ in range(Q):
    a = int(input())
    points[a] +=1

for point in points:
    if point > Q:
        print('Yes')
    else:
        print('No')

Fixed submission:
N, K, Q = map(int, input().split())
points = [K] * N
for _ in range(Q):
    a = int(input())
    points[a-1] +=1

for point in points:
    if point > Q:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /= 2.0
As.sort()
N1 = int(N/10)
for _ in range(M):
    As[-1] /= 2.0
    if As.size == 1:
      continue
    elif (As[-1] < As[-2]):
        As.sort()

ans = np.sum(np.floor(As*2.0))
print(int(ans))

Fixed submission:
import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /= 2.0
As.sort()
a2 = As[-2]
N1 = int(N/10)
for _ in range(M):
    As[-1] /= 2.0
    if As[-1] < a2:
        As[-N1:].sort()

ans = np.sum(np.floor(As*2.0))
print(int(ans))

Fixed submission:
import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /=2.0

for _ in range(M):
    As[As.argmax()] /=  2.0
As *= 2.0
ans = np.sum(np.floor(As))
print(int(ans))

Fixed submission:
import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /=2.0

for _ in range(M):
    As[As.argmax()] /=  2.0
As *= 2.0
ans = np.sum(np.floor(As))
print(int(ans))

Fixed submission:
import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
strings = []
for i in range(N):
    string = list(input())
    string.sort()
    strings.append(string)
strings.sort()
anagramNum = 0
for i in range(N-1):
    for j in range(i+1, N):
        if strings[j] == strings[i]: anagramNum += 1
print(anagramNum)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
strings = []
for i in range(N):
    string = list(input())
    string.sort()
    strings.append(string)
strings.sort()
wordAnagramCou = 0
anagramCou = 0
for i in range(N-1):
    if strings[i+1] == strings[i]:
        wordAnagramCou += 1
    else:
        wordAnagramCou=0
    anagramCou += wordAnagramCou
print(anagramCou)
Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
s=range(l,r+1)[:2019]
print(min(i*j%2019for i in s for j in s if i<j

Fixed submission:
# ume 20/03/18

def main():
  l,r=map(int,input().split())
  if r-l>2018:
    return 0
  else:
    c=2019
    for i in range(l,r):
      for j in range(i+1,r+1):
        c=min(c,i*j%2019)
        if c==0: return c
    return c

if __name__ == '__main__':
  print(main())
Buggy python submission (verdict: Runtime Error):
n, *ps = map(int, open(0).read().split())
cou =0
for x, y, z in zip(ps[:-2], ps[1:-1], ps[2:]):
  if (x-y)*(z-y)<0:
    cou += 1
print(cou)

Fixed submission:
S = [s for s in input()]
S.sort()
if (S[0]==S[1]) and (S[1]!=S[2]) and (S[2]==S[3]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
from math import *
n,k=map(int,input().split())
e=0
for i in range(1,n+1):
  t=ceil(log2(k/i))
  e+=1*(m<1)or 2**-t
print(e/n)

Fixed submission:
import math
e=0
n, k = map(int, input().split())
for i in range(1,n+1):
  m = math.ceil(math.log2(k/i))
  e += 1*(m<1) or 2**-m
print(e/n)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split.())
print(max(a,b)+max(max(a,b)-1, min(a,b)))

Fixed submission:
a, b = map(int, input().split())
print(max(a,b)+max(max(a,b)-1, min(a,b)))
Buggy python submission (verdict: Runtime Error):
a, _,e,k=map(int,open(0).read().split())
print(e-a<=k ‘Yay!’or ‘:(‘)

Fixed submission:
a,*_,e,k=map(int,open(0))
print('Y:a(y !'[e-a>k::2])
Buggy python submission (verdict: Runtime Error):
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a)

Fixed submission:
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a))

Buggy python submission (verdict: Runtime Error):
s=sorted(list(input()));a=s.index('1');print(2*min(a,len(s)-a))

Fixed submission:
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a))

Buggy python submission (verdict: Runtime Error):
s=sorted(list(input());a=s.index('1');print(2*min(a,len(s)-a))

Fixed submission:
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a))

Buggy python submission (verdict: Runtime Error):
s=list(input()).sort();a=s.index('1');print(2*min(a,len(s)-a))

Fixed submission:
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a))
Buggy python submission (verdict: Runtime Error):
otosidama=0
for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
  
print(otosidama

Fixed submission:
otosidama=0.0
for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
  
print(otosidama)
Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

def recurfunc(i, x):
  if i==N-1:
    print(x)
    return
  recurfunc(i+1, gcd(x, A[i+1]))

N = int(input())
A = list(map(int, input().split()))
recurfunc(1, gcd(A[0], A[1]))

Fixed submission:
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

N = int(input())
A = list(map(int, input().split()))
a = A[0]
for i in range(N-1):
  a = gcd(a, A[i+1])
print(a)

Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

def recurfunc(i, x):
  if i==N-1:
    print(x)
    return
  recurfunc(i+1, gcd(x, A[i+1]))

N = int(input())
A = list(map(int, input().split()))
recurfunc(1, gcd(A[0], A[1]))

Fixed submission:
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

N = int(input())
A = list(map(int, input().split()))
a = A[0]
for i in range(N-1):
  a = gcd(a, A[i+1])
print(a)
Buggy python submission (verdict: Runtime Error):
_,l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])

Fixed submission:
_,*l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])

Buggy python submission (verdict: Runtime Error):
_,l=map(int,open(0).read().split())
l.sort()
print("YNeos"[::sum(l[:-1])<=l[-1]])

Fixed submission:
_,*l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])
Buggy python submission (verdict: Runtime Error):
# 検証のためのACの人のパクリですごめんなさい
N = int(input())
hs = [i for i in map(int, input().split())]

INF = 10*12
dp = [INF]*N

dp[0] = 0
dp[1] = abs(ha[0]-hs[1])
for i in range(2, N):
  dp[i] = min(dp[i-1] +abs(hs[i]-hs[i-1]), dp[i-2] +abs(hs[i]-hs[i-2]))
print(dp[-1])

Fixed submission:
# 検証のためのACの人のパクリですごめんなさい
N = int(input())
hs = [i for i in map(int, input().split())]

INF = 10*12
dp = [INF]*N

dp[0] = 0
dp[1] = abs(hs[0]-hs[1])
for i in range(2, N):
  dp[i] = min(dp[i-1] +abs(hs[i]-hs[i-1]), dp[i-2] +abs(hs[i]-hs[i-2]))
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
print("YNEOS"[~input()in"357"%2::2]

Fixed submission:
print("YNEOS"[~(input()in"357")%2::2])
Buggy python submission (verdict: Runtime Error):
N = int(input())

def dfs(s, res):
  if int(s) > N:
    return
  res = +all((t in s)for t in '753')
  for i in '753':
    res += dfs(s+i, res)
  return res

print(dfs('0', 0))

Fixed submission:
N = int(input())

def dfs(s, res):
  if int(s) > N:
    return 0
  res = +all((t in s)for t in '753')
  for i in '753':
    res += dfs(s+i, res)
  return res

print(dfs('0', 0))
Buggy python submission (verdict: Runtime Error):
n, m = int(input())
print((n-1)*(m-1))

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Time Limit Exceeded):
R = []
G = []
B = []
sum = 0

N = int(input())

S = input()

for i in range(len(S)):
   if S[i] == "R":
      R.append(i)
   elif S[i] == "G":
      G.append(i)
   else:
      B.append(i)

for i in R:
   for j in G:
      for k in B:
         l = [i,j,k]
         l.sort()
         if l[1]-l[0] != l[2]-l[1]:
            sum += 1
print(sum)




Fixed submission:
N = int(input())
S = input()

sum = S.count("R")*S.count("G")*S.count("B")

for i in range(N):
   for j in range(i+1,N-1):
      k = 2*j-i
      if(k<N):
         if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            sum-=1
print(sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n >= 25:
  print 'Yes'
else:
  print 'No'

Fixed submission:
n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
for i in range(q):
  a.sort()
  su = 0
  b,c = map(int,input().split())
  for j in range(n):
    if(a[j] > b ):
      break
    if(a[j] == b):
      a[j] = c
    su += a[j]
  print(su)

Fixed submission:
str = input()
if(str.islower()):
  print('a')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(res)
  sys.exit()
res = 1

for i in range(n):
  if(res > pow(10,18)):
    res = -1
    break
  else:
    res = res * a[i]
print(res)

Fixed submission:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
  
res = 1
for i in range(n):
  if(res > pow(10,18)):
    break
  else:
    res = res * a[i]
if(res > pow(10,18)):
   res = -1
print(res)

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(res)
  sys.exit()
res = 1
for i in range(n):
  res = res * a[i]
  if(res > pow(10,18)):
    res = -1
print(res)

Fixed submission:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
  
res = 1
for i in range(n):
  if(res > pow(10,18)):
    break
  else:
    res = res * a[i]
if(res > pow(10,18)):
   res = -1
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 = res * a[i]
  if(res > pow(10,18)):
    res = -1
print(res)

Fixed submission:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
  
res = 1
for i in range(n):
  if(res > pow(10,18)):
    break
  else:
    res = res * a[i]
if(res > pow(10,18)):
   res = -1
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 = res * a[i]
if(res > pow(10,18)):
  res = -1
print(res)

Fixed submission:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
  
res = 1
for i in range(n):
  if(res > pow(10,18)):
    break
  else:
    res = res * a[i]
if(res > pow(10,18)):
   res = -1
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 = res * a[i]
if(res > 1000000000000000000):
  res = -1
print(res)

Fixed submission:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
  
res = 1
for i in range(n):
  if(res > pow(10,18)):
    break
  else:
    res = res * a[i]
if(res > pow(10,18)):
   res = -1
print(res)
Buggy python submission (verdict: Runtime Error):
a = input()
if(a == "ABC"):
  input("ARC")
else:
  input("ABC")

Fixed submission:
a = input()
if(a == "ABC"):
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
import math

r = int(input())

h = R * R * math.pi

print(h)

Fixed submission:
import math
r = int(input())
h = 2 * r * math.pi
print(h)
Buggy python submission (verdict: Runtime Error):
import numpy as np
h,w = map(int,input().split())
bi = np.zeros((h, w))
for i in range(h):
  if(i % 2 != 0 ):
    for j in range(w):
      if(j % 2 != 0):
        bi[i][j] = 1
      else:
        bi[i][j] = 0
  else:
    for k in range(w):
      if(k % 2 == 0):
        bi[i][k] = 1
      else:
        bi[i][k] = 0
print(np.count_nonzero(bi))  
        
      

Fixed submission:
import math
h,w = map(int,input().split())
w1 = int(w/2)
h1 = int(h/2)
w2 = int(w/2)
h2 = int(h/2)
if ( w % 2 != 0 ):
  w1 += 1
if ( h % 2 != 0 ):
  h1 += 1
res = h1 * w1 + h2 * w2
if (h == 1 or w == 1):
  print(1)
else:
  print(res)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
ama = -1
cnt = 1
x = 7
while ama!=0:
    if k % 2 == 0:
        print('-1')
        ama = 0
        break

    if x % k == 0:
        ama = 0
        print(cnt)
        break
        
    x = x*10 + 7
    cnt += 1
        
    
        

Fixed submission:
k = int(input())

x = 7 % k
cnt = 1

while 10000:
    if k % 2 ==0 or k%5==0:
        print('-1')
        break
        
    if x == 0:
        print(cnt)
        break
        
    x = x*10+7
    x = x % k
    
    cnt += 1