Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
n=int(input())
a=list(map(int, input().split()))
a.sort()
num=a[1]
alist=[0]*(num+2)
for i in range(n):
  for j in make_divisors(a[i]):
    if j<=num:
      alist[j]+=1
ans=0
for i in range(num+2):
  if alist[i]>=n-1:
    ans=i
print(ans)

Fixed submission:
import math
n=int(input())
a=list(map(int, input().split()))
alist=[]
gcd1=a[0]
for i in range(0,n):
  gcd1=math.gcd(gcd1,a[i])
  alist.append(gcd1)
blist=[]
gcd2=a[n-1]
for i in range(n-1,-1,-1):
  gcd2=math.gcd(gcd2,a[i])
  blist.append(gcd2)
clist=[alist[n-2],blist[n-2]]
for i in range(n-2):
  clist.append(math.gcd(alist[i],blist[n-i-3]))
print(max(clist))
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int, input().split())
s=input()
cnt=[0]*(n-1)
for i in range(n-1):
  if s[i:i+2]=='AC':
    cnt[i]=1
for i in range(q):
  l,r=map(int, input().split())
  print(sum(cnt[l-1:r-1]))

Fixed submission:
n,q=map(int, input().split())
s=input()
cnt=[0]*(n-1)
for i in range(n-1):
  if s[i:i+2]=='AC':
    cnt[i]=1
cnt2=[0]*(n)
for i in range(1,n):
  cnt2[i]=cnt2[i-1]+cnt[i-1]
for i in range(q):
  l,r=map(int, input().split())
  print(cnt2[r-1]-cnt2[l-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      if h[k]>0:
        alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ans=True
      for k in range(n):
        if h[k]==0:
          if alist[0]<(h[k]+abs(x[k]-i)+abs(y[k]-j)):
            ans=False
      if ans:
        ansx=i
        ansy=j
        ansh=alist[0]
print(ansx,ansy,ansh)

Fixed submission:
n=int(input())
alist=[list(map(int, input().split())) for i in range(n)]
alist.sort(key=lambda x:x[2],reverse=True)
for i in range(101):
  for j in range(101):
    h=abs(alist[0][0]-i)+abs(alist[0][1]-j)+alist[0][2]
    ans=True
    for k in range(n):
      if max((h-abs(alist[k][0]-i)-abs(alist[k][1]-j)),0)!=alist[k][2]:
        ans=False 
    if ans:
      ansx=i
      ansy=j
      ansh=h
print(ansx,ansy,ansh)

Buggy python submission (verdict: Runtime Error):
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      if h[k]>0:
        alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ans=True
      for k in range(n):
        if h[k]==0:
          if alist[0]>(h[k]+abs(x[k]-i)+abs(y[k]-j)):
            ans=False
      if ans:
        ansx=i
        ansy=j
        ansh=alist[0]
print(ansx,ansy,ansh)

Fixed submission:
n=int(input())
alist=[list(map(int, input().split())) for i in range(n)]
alist.sort(key=lambda x:x[2],reverse=True)
for i in range(101):
  for j in range(101):
    h=abs(alist[0][0]-i)+abs(alist[0][1]-j)+alist[0][2]
    ans=True
    for k in range(n):
      if max((h-abs(alist[k][0]-i)-abs(alist[k][1]-j)),0)!=alist[k][2]:
        ans=False 
    if ans:
      ansx=i
      ansy=j
      ansh=h
print(ansx,ansy,ansh)

Buggy python submission (verdict: Runtime Error):
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ansx=i
      ansy=j
      ansh=alist[0]
print(ansx,ansy,ansh)

Fixed submission:
n=int(input())
alist=[list(map(int, input().split())) for i in range(n)]
alist.sort(key=lambda x:x[2],reverse=True)
for i in range(101):
  for j in range(101):
    h=abs(alist[0][0]-i)+abs(alist[0][1]-j)+alist[0][2]
    ans=True
    for k in range(n):
      if max((h-abs(alist[k][0]-i)-abs(alist[k][1]-j)),0)!=alist[k][2]:
        ans=False 
    if ans:
      ansx=i
      ansy=j
      ansh=h
print(ansx,ansy,ansh)
Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
xlist=list(map(int, input().split()))
num0=0
nump=0
numm=0
for i in xlist:
  if i>0:
    nump+=1
  elif i<0:
    numm+=1
  else:
    num0+=1
listp=[0]*(nump+1)
listm=[0]*(numm+1)
for i in range(1,nump+1):
  listp[i]=xlist[numm+num0+i-1]
for i in range(1,numm+1):
  listm[i]=-xlist[numm-i]
cnt=k-num0
ans=10**30
for i in range(cnt):
  if i<=numm and cnt-i<=nump:
    ans=min(ans,listm[i]+listp[cnt-i]+min(listm[i],listp[cnt-i]))
if numm==0 and nump==0:
  ans=0
elif numm==0:
  ans=listp[cnt+1]
elif nump==0:
  ans=listm[cnt+1]
print(ans)

Fixed submission:
n,k=map(int, input().split())
xlist=list(map(int, input().split()))
ans=10**20
for i in range(n-k+1):
  ans=min(abs(xlist[i]-xlist[i+k-1])+min(abs(xlist[i]),abs(xlist[i+k-1])),ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
xlist=list(map(int, input().split()))
num0=0
nump=0
numm=0
for i in xlist:
  if i>0:
    nump+=1
  elif i<0:
    numm+=1
  else:
    num0+=1
listp=[0]*(nump+1)
listm=[0]*(numm+1)
for i in range(1,nump+1):
  listp[i]=xlist[numm+num0+i-1]
for i in range(1,numm+1):
  listm[i]=-xlist[numm-i]
cnt=k-num0
ans=10**30
for i in range(cnt):
  if i<=numm and cnt-i<=nump:
    ans=min(ans,listm[i]+listp[cnt-i]+min(listm[i],listp[cnt-i]))
if numm==0:
  ans=listp[cnt+1]
if nump==0:
  ans=listm[cnt+1]
print(ans)

Fixed submission:
n,k=map(int, input().split())
xlist=list(map(int, input().split()))
ans=10**20
for i in range(n-k+1):
  ans=min(abs(xlist[i]-xlist[i+k-1])+min(abs(xlist[i]),abs(xlist[i+k-1])),ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
alist=list(map(int, input().split()))
blist=[]
for i in range(n):
  blist.append(alist[i]-i-1)
blist.sort()
if n%2==1:
  cnt=0
  for i in range(n):
    cnt+=abs(blist[i]-blist[(i+1)//2])
  print(cnt)
else:
  cnt=0
  num=(blist[i//2]+blist[i//2+1])//2
  for i in range(n):
    cnt+=abs(blist[i]-num
  print(cnt,cnt2)

Fixed submission:
import statistics
n=int(input())
alist=list(map(int, input().split()))
blist=[]
for i in range(n):
  blist.append(alist[i]-i-1)
blist.sort()
median=statistics.median_high(blist)
ans=0
for i in range(n):
  ans+=abs(blist[i]-median)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    ans += A[i]*A[j]
print(ans % (10**9+7))

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
L = [0]*(n+1)
ans = 0
for i in range(n):
  L[i+1] = L[i]+A[i]
for i in range(1,n):
  ans += L[i]*A[i]
print(ans % (10**9+7))
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[K:]+...)

Fixed submission:
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[:K]+"...");
Buggy python submission (verdict: Runtime Error):
n,r = map(int,input().split())
print(r-(100*(10-n))

Fixed submission:
n,r = map(int,input().split())
print(r+(100*(max(10-n,0))))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = input()
L = []
ans = 0
for i in range(10):
  for j in range(10):
    for k in range(10):
      cnt = 0
      iflag = 0
      jflag = 0
      while True:
        if cnt >= n:
          break
        if iflag == 0 and S[cnt] == str(i):
          iflag = 1
          cnt += 1
          continue
        if iflag == 1 and jflag == 0 and S[cnt] == str(j):
          jflag= 1
          cnt += 1
          continue
        if jflag == 1 and S[cnt] == str(k):
          ans += 1
          break
        cnt += 1

print(ans)

Fixed submission:
n = int(input())
S = input()
L = []
ans = 0
for i in range(10):
  for j in range(10):
    for k in range(10):
      cnt = 0
      iflag = 0
      jflag = 0
      while True:
        if cnt >= n:
          break
        if iflag == 0 and S[cnt] == str(i):
          iflag = 1
          cnt += 1
          continue
        if iflag == 1 and jflag == 0 and S[cnt] == str(j):
          jflag= 1
          cnt += 1
          continue
        if jflag == 1 and S[cnt] == str(k):
          ans += 1
          break
        cnt += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
print(" ".join(map(str,[A.index(i)+1 for i in range(1,n+1)])))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans = list(range(n))
for i in range(n):
  ans[A[i]-1] = i+1
print(" ".join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
print(" ".join(map(str,[A.index(i)+1 for i in range(1,n+1)])))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans = list(range(n))
for i in range(n):
  ans[A[i]-1] = i+1
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
for i in range(n):
  tmp=A[i]
  A[i]=0
  print(max(A))
  A[i]=tmp

Fixed submission:
n=int(input())
A=[int(input()) for i in range(n)]
ma=max(A)
flag=False
if A.count(ma)>=2:
  flag=True
for i in range(n):
  if A[i] != ma:
    print(ma)
  else:
    if flag:
      print(ma)
    else:
      A[i]=0
      print(max(A))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans = set(range(1,n+1))
for i in range(m):
  l,r=map(int,input().split())
  ans &= set(range(l,r+1))
print(len(ans))  

Fixed submission:
n,m=map(int,input().split())
ansl = 1
ansr = n
for i in range(m):
  l,r=map(int,input().split())
  ansl = max(ansl,l)
  ansr = min(ansr,r)
print(max(0,ansr-ansl+1))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(min(a,b,c)*(sum([a,b,c]-min(a,b,c)-max(a,b,c)))//2)

Fixed submission:
a,b,c = map(int,input().split())
print(min(a,b,c)*(sum([a,b,c])-min(a,b,c)-max(a,b,c))//2)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
A=[list(input()) for i in range(w)]
answ=[]
ansh=[]
for i in range(w):
  if not all([a=="." for a in A[i]]):
    answ.append(i)
for j in range(h):
  if not all([A[i][j]=="." for i in range(w)]):
    ansh.append(j)
for i in answ:
  for j in ansh:
    print(A[i][j],end="")
  print("\n")
    

Fixed submission:
h,w=map(int,input().split())
A=[list(input()) for i in range(h)]
answ=[]
ansh=[]
for i in range(h):
  if not all([a=="." for a in A[i]]):
    answ.append(i)
for j in range(w):
  if not all([A[i][j]=="." for i in range(h)]):
    ansh.append(j)
for i in answ:
  for j in ansh:
    print(A[i][j],end="")
  print("\n")
Buggy python submission (verdict: Runtime Error):
S1 = input()
S2 = input()
if S1.reverse == S2:
  print("YES")
else:
  print("NO")

Fixed submission:
S1 = input()
S2 = input()
if S1[::-1] == S2:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n=int(input())
L = [0]*(100001)
ans = 0
for  i in range(n):
  L[int(input())] += 1
print(sum([L[i]%2 for i in range(len(L))]))

Fixed submission:
n=int(input())
ans = {}
printed = 0
for i in range(n):
  a = int(input())
  if not a in ans:
    ans[a] = 1
    printed += 1
  else:
    ans[a] += 1
    if ans[a] % 2 == 0:
      printed -= 1
    else:
      printed += 1
print(printed)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
Aset = set(A)
ans = 0
for a in Aset:
  if A.count(a) % 2 == 1:
    ans += 1
print(ans)

Fixed submission:
n=int(input())
ans = {}
printed = 0
for i in range(n):
  a = int(input())
  if not a in ans:
    ans[a] = 1
    printed += 1
  else:
    ans[a] += 1
    if ans[a] % 2 == 0:
      printed -= 1
    else:
      printed += 1
print(printed)
Buggy python submission (verdict: Runtime Error):
print(max(0,int(input())-int(input())))

Fixed submission:
a,b=map(int,input().split())
print(max(0,a-b))

Buggy python submission (verdict: Runtime Error):
print(max(0,int(input())-int(input())))

Fixed submission:
a,b=map(int,input().split())
print(max(0,a-b))
Buggy python submission (verdict: Runtime Error):
S=input()
print(S[0]+str(len(S-2))+S[-1])

Fixed submission:
S=input()
print(S[0]+str(len(S)-2)+S[-1])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(sum([a,b,c]-max(a,b,c)))

Fixed submission:
a,b,c=map(int,input().split())
print(sum([a,b,c])-max(a,b,c))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
ans = []
for i in range(n):
  ans.append(A[i])
  ans = ans[::-1]
print(*ans)

Fixed submission:
from collections import deque
n=int(input())
A=list(map(int,input().split()))
ans = deque([])
for i in range(n):
  if i % 2 == 0:
    ans.append(A[i])
  else:
    ans.appendleft(A[i])
if n % 2 == 1:
  ans = list(ans)[::-1]
print(*ans)
Buggy python submission (verdict: Runtime Error):
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  crt=1
  for i in range(n):
    crt = A[crt-1]
    if crt == 2:
      print(len(L))
      break
  else:
    print(-1)
main()

Fixed submission:
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  crt=1
  cnt=0
  for i in range(n):
    cnt += 1
    crt = A[crt-1]
    if crt == 2:
      print(cnt)
      break
  else:
    print(-1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  L = [1]
  crt=1
  for i in range(n):
    crt = A[crt-1]
    if crt in L:
      print(-1)
      break
    if crt == 2:
      print(len(L))
      break
    L.append(crt)
main()

Fixed submission:
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  crt=1
  cnt=0
  for i in range(n):
    cnt += 1
    crt = A[crt-1]
    if crt == 2:
      print(cnt)
      break
  else:
    print(-1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  L = [1]
  crt=1
  for i in range(n):
    crt = A[crt-1]
    if crt in L:
      print(-1)
      break
    if crt == 2:
      print(len(L))
      break
    L.append(crt)
main()

Fixed submission:
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  crt=1
  cnt=0
  for i in range(n):
    cnt += 1
    crt = A[crt-1]
    if crt == 2:
      print(cnt)
      break
  else:
    print(-1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
L = [1]
crt=1
for i in range(n):
  crt = A[crt-1]
  if crt in L:
    print(-1)
    break
  if crt == 2:
    print(len(L))
    break
  L.append(crt)

Fixed submission:
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  crt=1
  cnt=0
  for i in range(n):
    cnt += 1
    crt = A[crt-1]
    if crt == 2:
      print(cnt)
      break
  else:
    print(-1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
L = [1]
crt=1
for i in range(n):
  crt = A[crt-1]
  if crt in L:
    print(-1)
    break
  if crt == 2:
    print(len(L))
    break
  L.append(crt)

    

Fixed submission:
def main():
  n=int(input())
  A=[int(input()) for i in range(n)]
  crt=1
  cnt=0
  for i in range(n):
    cnt += 1
    crt = A[crt-1]
    if crt == 2:
      print(cnt)
      break
  else:
    print(-1)
main()
Buggy python submission (verdict: Runtime Error):
L=[1,0,1,2,1,2,1,1,2,1,2,1]
a,b=map(int,input().split())
if L[a]==L[b]:
  print("Yes")
else:
  print("No")

Fixed submission:
L=[1,0,1,2,1,2,1,1,2,1,2,1]
a,b=map(int,input().split())
if L[a-1]==L[b-1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Fixed submission:
a,b,c=map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
upper  = min(k,s)+1
lower = max(0,s-2*k)
ans = 0
for i in range(lower,upper):
  for j in range(lower,upper):
    if i + j > s:
      break
    for k in range(lower,upper):
      if i+j+k == s:
        ans += 1
        break
print(ans)

Fixed submission:
k,s=map(int,input().split())
upper  = min(k,s)+1
lower = max(0,s-2*k)
ans = 0
for i in range(lower,upper):
  for j in range(lower,upper):
    if 0 <= s-(i+j) <= k:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
upper  = min(k,s)+1
lower = max(0,s-2*k)
ans = 0
for i in range(lower,upper):
  for j in range(lower,upper):
    for k in range(lower,upper):
      if i+j+k == s:
        ans += 1
print(ans)

Fixed submission:
k,s=map(int,input().split())
upper  = min(k,s)+1
lower = max(0,s-2*k)
ans = 0
for i in range(lower,upper):
  for j in range(lower,upper):
    if 0 <= s-(i+j) <= k:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
start = max(0,s-2*k)
for a in range(start,k+1):
  for b in range(start,k+1):
    for c in range(start,k+1):
      if a+b+c==s:
        ans += 1
print(ans)

Fixed submission:
k,s=map(int,input().split())
upper  = min(k,s)+1
lower = max(0,s-2*k)
ans = 0
for i in range(lower,upper):
  for j in range(lower,upper):
    if 0 <= s-(i+j) <= k:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for a in range(k+1):
  for b in range(k+1):
    for c in range(k+1):
      if a+b+c==s:
        ans += 1
print(ans)

Fixed submission:
k,s=map(int,input().split())
upper  = min(k,s)+1
lower = max(0,s-2*k)
ans = 0
for i in range(lower,upper):
  for j in range(lower,upper):
    if 0 <= s-(i+j) <= k:
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print((a+b)*c//2)

Fixed submission:
a,b,c=[int(input()) for i in range(3)]
print((a+b)*c//2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_s = input().split(" ")
a_s = list(map(int, a_s))

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  ans += (sum(a_s[i+1:])*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)

Fixed submission:
N = int(input())
a_s = input().split(" ")
a_s = list(map(int, a_s))
asum = sum(a_s)

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  asum -= a_s[i]
  ans += (asum*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)

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

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  ans += ((sum(a_s[i+1:])%mod)*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)

Fixed submission:
N = int(input())
a_s = input().split(" ")
a_s = list(map(int, a_s))
asum = sum(a_s)

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  asum -= a_s[i]
  ans += (asum*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)

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

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  for j in range(i+1, len(a_s)):
    ans += ((a_s[i]*a_s[j])%mod)
    if ans > mod:
      ans = ans%mod
      
print(ans)

Fixed submission:
N = int(input())
a_s = input().split(" ")
a_s = list(map(int, a_s))
asum = sum(a_s)

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  asum -= a_s[i]
  ans += (asum*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
n = n/3
a = n**3
print(a)

Fixed submission:
n = int(input())
n = n/3
a = n**3
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 998244353
n, s = map(int, input().split())
nums = list(map(int, input().split()))

dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1

for i in range(n):
  for j in range(s + 1):
    dp[i + 1][j] += dp[i][j] * 2 % MOD
    if j >= nums[i]:
      dp[i + 1][j] += dp[i][j - nums[i]]
    dp[i + 1][j] %= MOD
print(dp[n][s])

Fixed submission:
MOD = 998244353
n, s = map(int, input().split())
nums = list(map(int, input().split()))

dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1

for i in range(n):
  for j in range(s + 1):
    dp[i + 1][j] += dp[i][j] * 2 % MOD
    if j >= nums[i]:
      dp[i + 1][j] += dp[i][j - nums[i]]
    dp[i + 1][j] %= MOD
print(dp[n][s])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
if n % 2 == 0:
  if (s[:n // 2] == s[n // 2:]) print(Yes)
  else print(No)
else print(No)
  

Fixed submission:
n = int(input())
s = input()
if (s[:n // 2] == s[n // 2:]): print("Yes")
else: print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

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

for i in range(m):
    a.sort()
    a[-1] //= 2

sum = 0
for i in a:
    sum += i

print(int(sum))

Fixed submission:
n, m = map(int, input().split())
aas = list(map(int, input().split()))
import heapq
hq = []
for i in aas:
    heapq.heappush(hq,-i)
for i in range(m):
    tmp = heapq.heappop(hq)
    heapq.heappush(hq,-((-tmp)//2))
print(-sum(hq))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp =[1e10+5]*n
dp[0] = 0

for i in range(n):
    for j in range(1, k+1):
        if i-j < 0:
            break
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))
print(dp[n-1])

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp =[1e10+5]*n
dp[0] = 0

for i in range(n):
    for j in range(1, k+1):
        if i-j < 0:
            break
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
import math
from sys import stdin

X,N=[int(x) for x in stdin.readline().rstrip().split()]
P=[int(x) for x in stdin.readline().rstrip().split()]
l=[i for i in range(1,101) if i not in P]
abslist = list(map(lambda a:abs(a-X),l))
result = min(abslist)

print(l[abslist.index(result)])


Fixed submission:
from sys import stdin


X,N=[int(x) for x in stdin.readline().rstrip().split()]
P=[int(x) for x in stdin.readline().rstrip().split()]
l=[i for i in range(-1,102) if i not in P]
abslist = list(map(lambda a:abs(a-X),l))
print(l[abslist.index(min(abslist))])
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sorted(a+b)
ans = 0
tmp = 0
for i in c:
  tmp += i
  if(tmp > k):print(ans);exit()
  ans+=1
else:print(ans)

Fixed submission:
a = int(input())
print(a + a*a + a*a*a)

Buggy python submission (verdict: Runtime Error):
n = int(input())
print(a + a*a + a*a*a)

Fixed submission:
a = int(input())
print(a + a*a + a*a*a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, input().split())
ans = 1
for i in s:ans*=i
print(ans)

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

Fixed submission:
n = int(input())
s = list(map(int, input().split()))
if 0 in s:print(0);exit()
ans=1
for i in s:
  ans*=i
  if(ans > 10**18):print(-1);exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(len(set([input() for i in range(n)]))

Fixed submission:
n = int(input())
d = {}
for i in range(n):
    s = input()
    try:d[s]+=1
    except:d[s]=1
print(len(d))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = 1
while(True):
    if(int(c*0.08)==a and int(c*0.1)==b):
        print(c)
        exit()
    c+=1
    if(c=100000):
        print(-1)
        exit()

Fixed submission:
a, b = map(int, input().split())
c = 1
while(True):
    if(int(c*0.08)==a and int(c*0.1)==b):
        print(c)
        exit()
    c+=1
    if(c==100000):
        print(-1)
        exit()