Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
x=int(input())
i=0
ok=True
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    n=ceil((x+i)**0.5)
    for j in range(2,n):
      if (x+i)%j==0:
        ok=False
    if ok:
      print(x+i)
      exit()
    i+=1


Fixed submission:
from math import ceil
x=int(input())
i=0
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    ok=True
    n=ceil((x+i)**0.5)
    for j in range(2,n):
      if (x+i)%j==0:
        ok=False
        break
    if ok:
      print(x+i)
      exit()
    i+=1

Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
x=int(input())
i=0
ok=True
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    for j in range(2,ceil((x+i)**0.5)):
      if (x+i)%j==0:
        ok=False
    if ok:
      print(x+i)
      exit()
    i+=1


Fixed submission:
from math import ceil
x=int(input())
i=0
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    ok=True
    n=ceil((x+i)**0.5)
    for j in range(2,n):
      if (x+i)%j==0:
        ok=False
        break
    if ok:
      print(x+i)
      exit()
    i+=1
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=0
for j in range(len(bin(max(a)))-2):
    cnt1=0
    cnt0=0
    for i in range(n):
      if (a[i]>>j)&1:
        cnt1+=1
      else:
        cnt0+=1
    s+=(cnt1*cnt0*2**j)%(10**9+7)
print(s%(10**9+7))


Fixed submission:
a1,a2,a3=map(int,input().split())
if a1+a2+a3>=22:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
g[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    g[i][x-1]=y
for i in range(2**n):
  ok=True
  for j in range(n):
    if (i>>j)&1:
      for k in range(n):
        if g[j][k]==-1:
          continue
        if (i>>j)&1!=g[j][k]:
          ok=False
  if ok:
    d=str(bin(i))
    t=d.count('1')
    ans=max(t,ans)
print(ans)
    
    
      

Fixed submission:
n=int(input())
ans=0
g=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    g[i][x-1]=y
for i in range(2**n):
  ok=True
  for j in range(n):
    if (i>>j)&1:
      for k in range(n):
        if g[j][k]==-1:
          continue
        if (i>>k)&1!=g[j][k]:
          ok=False
  if ok:
    d=i
    t=str(bin(d)).count('1')
    ans=max(t,ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=0
for j in range(len(bin(max(a)))-2):
    cnt1=0
    cnt0=0
    for i in range(n):
      if (a[i]>>j)&1:
        cnt1+=1
      else:
        cnt0+=1
    s+=cnt1*cnt0*2**j
print(s%(10**9+7))


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=n-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=0
for j in range(60):
    cnt1=0
    cnt0=0
    for i in range(n):
      if (a[i]>>j)&1:
        cnt1+=1
      else:
        cnt0+=1
    s+=(cnt1*cnt0*2**j)%(10**9+7)
print(s%(10**9+7))


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=n-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=0
for j in range(len(bin(max(a)))-2):
    cnt1=0
    cnt0=0
    for i in range(n):
      if (a[i]>>j)&1:
        cnt1+=1
      else:
        cnt0+=1
    s+=(cnt1*cnt0*2**j)%(10**9+7)
print(s%(10**9+7))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=n-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
x=int(input())
dp=[0]*(x+1)
dp[0]=1
for i in range(1,x+1):
  if i-100>=0 and dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
    dp[i]=1
  else:
    dp[i]=0
print(dp[x])

Fixed submission:
x=int(input())
if (x//100)*105>=x:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
x=int(input())
dp=[]*x
dp[0]=1
for i in range(1,x):
  if i-100>=0 and dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
    dp[i]=1
  else:
    dp[i]=0
print(dp[x-1])

Fixed submission:
x=int(input())
if (x//100)*105>=x:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
ans=0
d=dict()
for i in range(1000):
  num='0'*(3-len(str(i)))+str(i)
  for j in range(n-2):
    if s[j]==num[0]:
      for k in range(j+1,n-1):
        if s[k]==num[1]:
          for l in range(k+1,n):
            if s[l]==num[2]:
              if num not in d:
                ans+=1
                d[num]=0
            if l==n-1:
              break
        if k==n-2:
          break
    if j==n-3:
      break
print(ans)


Fixed submission:
n=int(input())
s=input()
cnt=0
for i in range(1000):
  l=(3-len(str(i)))*'0'+str(i)
  if l[0] in s:
    p1=s.index(l[0])
    if l[1] in s[p1+1:]:
      p2=p1+s[p1+1:].index(l[1])+1
      if l[2] in s[p2+1:]:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
ans=0
d=dict()
for i in range(1000):
  num='0'*(3-len(str(i)))+str(i)
  for j in range(n-2):
    if s[j]==num[0]:
      for k in range(j+1,n-1):
        if s[k]==num[1]:
          for l in range(k+1,n):
            if s[l]==num[2]:
              if num not in d:
                ans+=1
                d[num]=0
            if l==n-1:
              break
        if k==n-2:
          break
    if j==n-3:
      break
print(ans)

Fixed submission:
n=int(input())
s=input()
cnt=0
for i in range(1000):
  l=(3-len(str(i)))*'0'+str(i)
  if l[0] in s:
    p1=s.index(l[0])
    if l[1] in s[p1+1:]:
      p2=p1+s[p1+1:].index(l[1])+1
      if l[2] in s[p2+1:]:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
cnt=0
for i in range(1,11):
  if x-i*b>=0 and (x-i*b)//a>=10**(i-1):
    cnt+=1
if cnt==0 or x-i*b<0:
  print(0)
else:
  print(((x-cnt*b)-(x-cnt*b)%a)//a)


Fixed submission:
s=input()
if s=='SUN':
  print(7)
elif s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
import math
x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    c=int(math.factorial(a+b)/math.factorial(b)/math.factorial(a))
    print(c%(10**9+7))
  else:
    print(0)


Fixed submission:
r=int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
d=list()
s1=0
s2=0
d=[[c[i][1]/c[i][0],c[i][0],c[i][1]] for i in range(n)]
d=sorted(d,key=lambda x:(x[0],x[1]))
for i in range(n):
  s2+=d[i][2]
  s1+=d[i][1]
  if s1>=t-0.5:
    print(s2)
    exit()


Fixed submission:
r=int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
d=list()
s1=0
s2=0
d=[[c[i][1]/c[i][0],c[i][0],c[i][1]] for i in range(n)]
d.sort()
for i in range(n):
  s2+=d[i][2]
  s1+=d[i][1]
  if s1>t-0.5:
    print(s2)
    exit()


Fixed submission:
r=int(input())
print(r**2)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
z=[list(map(input().split())) for i in range(n)]
a=math.factorial(n)
for i in range(n-1):
  for j in range(i,n):
    b=(z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2
print(b**0.5/a)

Fixed submission:
import math
n=int(input())
z=[list(map(int,input().split())) for i in range(n)]
a=math.factorial(n)
b=0
for i in range(n):
  for j in range(n):
    b=b+((z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2)**0.5
print((math.factorial(n)/n)*b/a)
Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    print(cmb(a+b,b)%(10**9+7))
  else:
    print(0)


Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    print(cmb(a+b,b,mod))
  else:
    print(0)

Buggy python submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    print(cmb(a+b,b,mod))
  else:
    print(0)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    print(cmb(a+b,b,mod))
  else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under



x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    print(cmb(a+b,b)%(10**9+7))
  else:
    print(0)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
else:
  a=int((2*x-y)/3)
  b=int((2*y-x)/3)
  if a>=0 and b>=0:
    print(cmb(a+b,b,mod))
  else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
d=list()
s1=0
s2=0
d=[[c[i][1]/c[i][0],c[i][0],c[i][1]] for i in range(n)]
d=sort(d,key=lambda x:(x[0],x[1]))
for i in range(n):
  s2+=d[i][2]
  s1+=d[i][1]
  if s1>=t-0.5:
    print(s2)
    exit()


Fixed submission:
n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
dp=[[0]*(t+1) for i in range(n+1)]
for i in range(1,n+1):
  for j in range(t+1):
    if j!=t:
      if j-l[i-1][0]>=0:
        dp[i][j]=max(dp[i-1][j],dp[i-1][j-l[i-1][0]]+l[i-1][1])
    else:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-1]+l[i-1][1])
    dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[n]))

Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
d=list()
s1=0
s2=0
d=[[c[i][1]/c[i][0],c[i][0],c[i][1]] for i in range(n)]
d=sort(d,key=lamda x:(x[0],x[1]))
for i in range(n):
  s2+=d[i][2]
  s1+=d[i][1]
  if s1>=t-0.5:
    print(s2)
    exit()


Fixed submission:
n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
dp=[[0]*(t+1) for i in range(n+1)]
for i in range(1,n+1):
  for j in range(t+1):
    if j!=t:
      if j-l[i-1][0]>=0:
        dp[i][j]=max(dp[i-1][j],dp[i-1][j-l[i-1][0]]+l[i-1][1])
    else:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-1]+l[i-1][1])
    dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[n]))

Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
d=list()
s1=0
s2=0
for i in range(n):
  d.append([c[i][1]/c[i][0],c[i][0]])
while s1=<t-0.5:
  s2+=c[d.index(d.pop(max(d)))][1]
  s1+=c[d.index(d.pop(max(d)))][0]
print(s2)

Fixed submission:
n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
dp=[[0]*(t+1) for i in range(n+1)]
for i in range(1,n+1):
  for j in range(t+1):
    if j!=t:
      if j-l[i-1][0]>=0:
        dp[i][j]=max(dp[i-1][j],dp[i-1][j-l[i-1][0]]+l[i-1][1])
    else:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-1]+l[i-1][1])
    dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[n]))
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)+1
l=[0]*n
r=[0]*n
for i in range(n-1):
    if S[i]=='<': 
      l[i+1]=l[i]+1
    if S[n-2-i]=='>': 
      r[n-2-i]=r[n-1-i]+1
ans=0
for i in range(N):
  ans+=max(l[i],r[i])
print(ans)


Fixed submission:
s=input()
n=len(s)+1
l=[0]*n
r=[0]*n
for i in range(n-1):
    if s[i]=='<': 
      l[i+1]=l[i]+1
    if s[n-2-i]=='>': 
      r[n-2-i]=r[n-1-i]+1
ans=0
for i in range(n):
  ans+=max(l[i],r[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=list()
for i in range(int(n*0.5)):
  if n%(i+1)==0:
    k.append(int(i+n/(i+1)-1))
print(min(k))


Fixed submission:
n=int(input())
k=list()
for i in range(int(n**0.5)):
  if n%(i+1)==0:
    k.append(int(i+n/(i+1)-1))
print(min(k))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=list()
for i in range(n):
  if n%(i+1)==0:
    k.append(int(i+n/(i+1)-1))
print(min(k))

Fixed submission:
n=int(input())
k=list()
for i in range(int(n**0.5)):
  if n%(i+1)==0:
    k.append(int(i+n/(i+1)-1))
print(min(k))
Buggy python submission (verdict: Runtime Error):
import numpy
a,b,x=map(int,input().split())
if x>=2/a**2*b:
  print(math.degrees(numpy.arccos(a/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(numpy.arccos((2*x/a/b)/((2*x/a/b)**2+b**2)**0.5)))


Fixed submission:
import math
a,b,x=map(int,input().split())
if x>=(a**2*b)/2:
  print(math.degrees(math.acos(a/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(math.acos((2*x/a/b)/(((2*x/a/b)**2+b**2)**0.5))))

Buggy python submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
if x>=2/a**2*b:
  print(math.degrees(math.asin(2*(a**2*b-x)/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(math.asin(b/((2*x/a/b)**2+b**2)**0.5)))


Fixed submission:
import math
a,b,x=map(int,input().split())
if x>=(a**2*b)/2:
  print(math.degrees(math.acos(a/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(math.acos((2*x/a/b)/(((2*x/a/b)**2+b**2)**0.5))))
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
l=[]
for i in range(n):
  l.append([f[i]*a[i],a[i],f[i]])
l.sort()
ng=-1
ok=l[n-1][0]
while ok-ng>1:
  mid=(ok+ng)//2
  cnt=0
  for i in range(n):
    if l[i][0]>mid:
      cnt+=ceil((l[i][0]-mid)/l[i][2])
  if cnt<=k:
    ok=mid
  else:
    ng=mid
print(ok)

Fixed submission:
from math import ceil
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
l=[]
for i in range(n):
  l.append([f[i]*a[i],a[i],f[i]])
l.sort()
ng=-1
ok=l[n-1][0]
while ok-ng>1:
  mid=(ok+ng)//2
  cnt=0
  for i in range(n):
    if l[i][0]>mid:
      cnt+=ceil((l[i][0]-mid)/l[i][2])
  if cnt<=k:
    ok=mid
  else:
    ng=mid
print(ok)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2＊b>0:
  print(a-2＊b)
else:
  print(0)


Fixed submission:
a,b=map(int,input().split())
if a-2*b>0:
  print(a-2*b)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2＊b>0:
  print(a-2b)
else:
  print(0)


Fixed submission:
a,b=map(int,input().split())
if a-2*b>0:
  print(a-2*b)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2b>0:
  print(a-2b)
else:
  print(0)

Fixed submission:
a,b=map(int,input().split())
if a-2*b>0:
  print(a-2*b)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n-1):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)

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

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
            if j<n:
                hp=hp+d[i]*d[j]
print(hp)


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

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
           if i<j: 
               hp=hp+d[i]*d[j]
print(hp)


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

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)


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

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
            hp+=d[i]*d[j]
print(hp)

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
hp=0
for i in range(n-1):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)
Buggy python submission (verdict: Runtime Error):
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    c=bisect.bisect_left(l,a+b)
      cnt+=c-1-j
print(cnt)


Fixed submission:
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    c=bisect.bisect_left(l,a+b)
    cnt+=c-1-j
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i]<l[j]+l[k]:
        if l[j]<l[i]+l[k]:
          if l[k]<l[j]+l[i]:
            cnt+=1
print(cnt)


Fixed submission:
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    c=bisect.bisect_left(l,a+b)
    cnt+=c-1-j
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[j]+l[i]:
        cnt+=1
print(cnt)


Fixed submission:
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    c=bisect.bisect_left(l,a+b)
    cnt+=c-1-j
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(n)]
b.sort()
for i in b:
  print(i[i]+1,end=" ")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(n)]
b.sort()
for i in b:
  print(i[1]+1,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=list()
for i in range(n):
  b.append(1+a.index(1+i))
print(*b)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(n)]
b.sort()
for i in b:
  print(i[1]+1,end=" ")

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=(list(map(int,input().split()))
b=list()
for i in range(n):
  b.append(1+a.index(1+i))
print(*b)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(n)]
b.sort()
for i in b:
  print(i[1]+1,end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a,b=map(int,input().split())
c=list()
cnt=1
if fractions.gcd(a,b)==1:
  print(1)
elif fractions.gcd(a,b)==2:
  print(2)
else:
  for i in range(2,fractions.gcd(a,b)+1):
    if a%i==0 and b%i==0:
      if i==2:
        cnt+=1
      else:
        c.append(i)
  for j in c:
      ok=True
      for k in range(2,j):
        if j%k==0:
            ok=False
      if ok:
        cnt+=1
  print(cnt)

Fixed submission:
A, B = map(int, input().split())
ans = 1
for i in range(2, 1+int(min(A**.5, B**.5))):
    if A % i == 0 and B % i == 0:
        ans += 1
    while A % i == 0:
        A //= i
    while B % i == 0:
        B //= i
if A != 1 and B != 1 and (A % B == 0 or B % A == 0):
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
trs=[]
for _ in range(m):
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  cnt=0
  for i in range(b):
    cnt+=2**(c[i]-1)
  trs.append((a,cnt))
dp=[10**9]*2**n
dp[0]=0
for i in range(2**n):
  for a,cnt in trs:
    dp[i|cnt]=min(dp[i]+a,dp[i|cnt])
if dp[2**n-1]!=10**9:
  print(dp[2**n-1])
else:
  print(-1)

Fixed submission:
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
trs=[]
for _ in range(m):
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  cnt=0
  for i in range(b):
    cnt+=2**(c[i]-1)
  trs.append((a,cnt))
dp=[10**9]*2**n
dp[0]=0
for i in range(2**n):
  for a,cnt in trs:
    dp[i|cnt]=min(dp[i]+a,dp[i|cnt])
if dp[2**n-1]!=10**9:
  print(dp[2**n-1])
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
s=input()
if s='Sunny':
  print('Cloudy')
elif s='Cloudy':
  print('Rainy')
else:
  print('Sunny')

Fixed submission:
s=input()
if s=='Sunny':
  print('Cloudy')
elif s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
s=input()
ng=False
for i in range(n):
  if i%2==0:
    if s[i]=='R':
      ng=True
  else:
    if s[i]=='L':
      ng= True
if ng:
  print('No')
else:
  print('Yes')


Fixed submission:
s=input()
ng=False
for i in range(len(s)):
  if i%2==0:
    if s[i]=='L':
      ng=True
  else:
    if s[i]=='R':
      ng= True
if ng:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
s=input()
ng=False
for i in range(n):
  if i%2=0:
    if s[i]=='R':
      ng=True
  else:
    if s[i]=='L':
      ng= True
if ng:
  print('No')
else:
  print('Yes')

Fixed submission:
s=input()
ng=False
for i in range(len(s)):
  if i%2==0:
    if s[i]=='L':
      ng=True
  else:
    if s[i]=='R':
      ng= True
if ng:
  print('No')
else:
  print('Yes')