Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02690 (python)

Fixed submission:
X = int(input())

c = 1
result = False


while not result:
    for i in range(c):
        a = c -i
        b = i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    for i in range(c):
        b = c - i
        a = - i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    for i in range(c):
        a = -c+i
        b = -i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    for i in range(c):
        a = i
        b = -c + i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    c += 1

print(A, B)

Buggy submission (verdict: Runtime Error):
X = int(input())
b = 0.0
c = True

while c:
    if ((X + b**5)**0.2).is_integer():
        c = False
        a = int(((X + b**5)**0.2))
    elif b == 0:
        b = 1.0
    elif b > 0:
        b = -1.0*b
    else:
        b = -1*b + 1
        
print(a, int(b))

Buggy submission (verdict: Runtime Error):
X = int(input())
b = 1.0
c = True

while c:
    if ((X + b**5)**0.2).is_integer():
        c = False
        a = int(((X + b**5)**0.2))
    elif b > 0:
        b = -1*b
    else:
        b = -1*b + 1
        
print(a, int(b))

Buggy submission (verdict: Runtime Error):
X = int(input())
b = 1
c = True

while c:
    if ((X + b**5)**0.2).is_integer():
        c = False
        a = int(((X + b**5)**0.2))
    elif b > 0:
        b = -1*b
    else:
        b = -1*b + 1
        
print(a, b)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
ans = 0

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

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
ans = 0

for i in range(3):
	if S[i] == T[i]:
    	ans += 1

print(ans)
Problem p02628 (python)

Fixed submission:
n,k=input().split();print(sum(sorted(map(int,input().split()))[:int(k)]))

Buggy submission (verdict: Runtime Error):
l=map(int,open(0).read().split());print(sum(sorted(l[2:])[:l[1]]))

Buggy submission (verdict: Runtime Error):
n,k=input().split();print(sum(sorted(int,input().split())[:int(k)]))
Problem p02658 (python)

Fixed submission:
input()
a=1
d=1000000000000000000
for i in input().split():
  a=min(a*int(i), d+1)
print([a,-1][a>d])

Buggy submission (verdict: Runtime Error):
a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18]
print(a)1

Buggy submission (verdict: Runtime Error):
input();a=1
for i in input().split():a*=int(i);a=[-1,a][1=<a<=eval('1'+'0'*18)]
print(a)
Problem p03210 (python)

Fixed submission:
print('YES'if input()in '753'else 'NO')

Buggy submission (verdict: Runtime Error):
print ['NO','YES'][input()in'753']
Problem p03212 (python)

Fixed submission:
import itertools as t;N=input();X=[]
for i in range(10):X+=list(t.product('357',repeat=i))
print(sum(len(set(i))>2and int(''.join(i))<=int(N)for i in X))

Buggy submission (verdict: Runtime Error):
import itertools as t;N=input();X=[];for i in range(9):X+=list(t.product('357',repeat=i));print(sum(len(set(i))>2and int(''.join(i))<=int(N)for i in X))
Problem p03323 (python)

Fixed submission:
a,b=map(int,input().split())
if max(a,b)<=8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
print('Yay!'if max(map(int,input().split()))<'9' else':(')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()):print('Yay!' if max(a,b)<=8 else ':(')
Problem p03359 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[3,13,23,43,53,73,103,113,163,173,193,223,233,263,283,293,313,353,373,383,443,463,503,563,593,613,643,653,673,683,733,743,773,823,853,863,883,953,983,1013,1033,1063,1093,1103,1123,1153,1163,1193,1213,1223,1283,1303,1373,1423,1433,1453,1483,1493]
for i in range(n):
    print(p[i],end=' ')
Problem p03773 (python)

Fixed submission:
a,b=input().split()
print((int(a)+int(b))%24)

Buggy submission (verdict: Runtime Error):
import math
N,A,B=map(int,input().split())
v=list(map(int,input().split()))
a=v.sort()[-A:]
print(sum(a)/A)
b=v.count(a[0])
c=a.count(a[0])
if c!=A:
    print(math.factorial(b)//(math.factorial(c)*math.factorial(b-c)))
else:
    l=[]
    i=min([b-c,B-A])
    for k in range(0,i+1):
        l.append(math.factorial(b)//(math.factorial(c+k)*math.factorial(b-c-k)))
    print(sum(l))
Problem p02588 (python)

Fixed submission:
N=int(input())
A=[]
for i in range(N):
  #tmp=float(input())*10**9
  inp=input()
  ten=inp.find(".")
  L=len(inp)
  batu=9
  if ten!=-1:
    batu-=L-ten-1
  inp=inp.replace(".","")
  inp=int(inp)
  inp*=10**batu
  A.append(inp)

#print(A)

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0 and dev2<18:
    dev2+=1
    A[i]//=2
  while A[i]%5==0 and dev5<18:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[]
for i in range(N):
  tmp=float(input())*10**9
  A.append(int(tmp))

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0:
    dev2+=1
    A[i]//=2
  while A[i]%5==0:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)
Problem p02609 (python)

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

k=0
for i in range(N):
  if X[i]=="1":
    k+=1

A=int(X,2)
#apは0->1の時の一回目の変換の値。
ap=A%(k+1)

am=100
if k != 1:
  am=A%(k-1)

popc_list=[-1]*(k+3)

def F(num):
  #print(str(num)+"called")
  if num==0:
    return 0
  if popc_list[num]!=-1:
    return popc_list[num]
  
  popc=0
  for s in bin(num):
    if s == "1":
      popc+=1
      
  popc_list[num]=F(num%popc)+1
  return popc_list[num]
  

for i in range(N):
  if X[i] == "0":
    print(F((ap+pow(2,N-1-i,k+1))%(k+1))+1)
  else:
    if k == 1:
      print(0)
      continue
    print(F((am-pow(2,N-1-i,k-1))%(k-1))+1)
"""
print(popc_list)
print(k)
"""

Buggy submission (verdict: Runtime Error):
N=int(input())
X=input()

k=0
for i in range(N):
  if X[i]=="1":
    k+=1

A=int(X,2)
#apは0->1の時の一回目の変換の値。
ap=A%(k+1)
am=A%(k-1)

popc_list=[-1]*(k+3)

def F(num):
  #print(str(num)+"called")
  if num==0:
    return 0
  if popc_list[num]!=-1:
    return popc_list[num]
  
  popc=0
  for s in bin(num):
    if s == "1":
      popc+=1
      
  popc_list[num]=F(num%popc)+1
  return popc_list[num]
  

for i in range(N):
  if X[i] == "0":
    print(F((ap+pow(2,N-1-i,k+1))%(k+1))+1)
  else:
    print(F((am-pow(2,N-1-i,k-1))%(k-1))+1)
"""
print(popc_list)
print(k)
"""

Buggy submission (verdict: Runtime Error):
N=int(input())
X=input()

k=0
for i in range(N):
  if X[i]=="1":
    k+=1

A=int(X,2)
#apは0->1の時の一回目の変換の値。
ap=A%(k+1)
am=A%(k-1)

popc_list=[-1]*(k+3)

def F(num):
  if num==0:
    return 0
  if popc_list[num]!=-1:
    return popc_list[num]
  
  popc=0
  for i in range(10000000):
    if num>>i==1:
      popc+=1
    if num>pow(2,i):
      break
  popc_list[num]=F(num%popc)+1
  return popc_list[num]
  

for i in range(N):
  if X[i] == "0":
    print(F((ap+pow(2,N-i,k+1))%(k+1))+1)
  else:
    print(F((am+pow(2,N-i,k-1))%(k-1))+1)
Problem p02614 (python)

Fixed submission:
H,W,K=map(int,input().split())
F=[input() for _ in range(H)]
ans=0
for i in range(2**H):
  for j in range(2**W):
    cnt=0
    for ii in range(H):
      for jj in range(W):
        if (i>>ii)%2==0 or (j>>jj)%2==0 or F[ii][jj]==".":
          continue
        cnt+=1
    if cnt==K:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
H,W,K=map(int,input().split())
F=[input() for _ in range(H)]
ans=0
for i in range(2**H):
 for j in range(2**W):
  cnt=0
  for ii in range(H):
   for jj in range(W):
    if i>>ii%2==0 or j>>jj%2==0 or F[ii][jj]==".":
     continue
    cnt+=1
  if cnt==K:
  ans+=1
print(ans)
Problem p02642 (python)

Fixed submission:
visited=[False]*(10**6+1)

N=int(input())
A=list(map(int,input().split()))
A.sort()

if N>=2 and A[1]==1:
  print(0)
  exit()
if A[0]==1 or N == 1:
  print(1)
  exit()
  
ans=0
for i in range(N):
  if visited[A[i]]:
    continue
  if i < N-1 and A[i]==A[i+1]:
    index = 1
    while A[i]*index<=10**6:
      visited[A[i]*index]=True
      index+=1
    continue
  ans+=1
  index=1
  while A[i]*index<=10**6:
    visited[A[i]*index]=True
    index+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
visited=[False]*(10**6+1)

N=int(input())
A=list(map(int,input().split()))
A.sort()

if A[1]==1:
  print(0)
  exit()
if A[0]==1:
  print(1)
  exit()
ans=0
for i in range(N):
  if visited[A[i]]:
    continue
  if i < N-1 and A[i]==A[i+1]:
    continue
  ans+=1
  index=1
  while A[i]*index<=10**6:
    visited[A[i]*index]=True
    index+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
visited=[False]*(10**6+1)

N=int(input())
A=list(map(int,input().split()))
A.sort()

if A[1]==1:
  print(0)
  exit()
if A[0]==1:
  print(1)
  exit()
ans=0
for i in range(N):
  if visited[A[i]]:
    continue
  ans+=1
  index=1
  while A[i]*index<=10**6+1:
    visited[A[i]*index]=True
    index+=1
num=0
for i in range(1,N):
  if A[i]==A[i-1] and num!=A[i]:
    ans-=1
    num=A[i]
    
print(ans)
Problem p02662 (python)

Fixed submission:
N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
dp=[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
  for j in range(S+1):
    dp[i][j]+=dp[i-1][j]*2
    if j-A[i-1]>=0:
      dp[i][j]+=dp[i-1][j-A[i-1]]
    dp[i][j]%=mod
print(dp[N][S])

Buggy submission (verdict: Runtime Error):
N,S=map(int,input().split())
A=list(map(int,input().split()))
#dp[i]{:}:iまでを使って数字k個でjを作る方法
dp=[[{}]*(S+1) for _ in range(N+1)]
dp[0][0]={0:1}
for i in range(1,N+1):
  for j in range(S):
    if j+A[i]>S:
      break()
    for k,v in dp[i-1][j].items:
      dp[i][j+A[i]][k+1]+=v

print(dp[N][K])
Problem p02678 (python)

Fixed submission:
N,M=map(int,input().split())
#AB=[list(map(int,input().split()) for _ n range(N))]
p=[[] for _ in range(N+1)]
for _ in range(M):
    a,b=map(int,input().split())
    p[a].append(b)
    p[b].append(a)
#print(p)
sirube=[-1]*N
visited=[True]+[False]*(N-1)
def bfs():
    global visited,sirube
    queue=[1]
    while queue:
        now=queue.pop(0)
        #print(now)
        for n in p[now]:
            if not visited[n-1]:
                queue.append(n)
                visited[n-1]=True
                sirube[n-1]=now
    return
bfs()
if -1 in sirube[1:]:
    print("No")
    exit()

print("Yes")
for sir in sirube[1:]:
    print(sir)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
#AB=[list(map(int,input().split()) for _ n range(N))]
p=[[] for _ in range(N+1)]
for _ in range(N):
    a,b=map(int,input().split())
    p[a].append(b)
    p[b].append(a)

sirube=[-1]*N
visited=[False]*N
def bfs():
    global visited,sirube
    queue=[1]
    while queue:
        now=queue.pop(0)
        for n in p[now]:
            if not visited[n-1]:
                queue.append(n)
                visited[n-1]=True
                sirube[n-1]=now
    return
bfs()
if -1 in sirube[1:]:
    print("No")
    exit()

print("Yes")
for sir in sirube[1:]:
    print(sir)
Problem p02691 (python)

Fixed submission:
n=int(input())

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**6))

for i in range(n):
    if 0<a[i]+10**6<2*(10**6):
        counter[a[i]+10**6]+=1

ans = 0
for i in range(len(needsearch)):
    if 0<needsearch[i]+10**6<2*(10**6):
        ans += counter[needsearch[i]+10**6]
    if 0<a[i]+10**6<2*(10**6):
        counter[a[i]+10**6]-=1


print(ans)

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

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**6))

for i in range(n):
    if 0<a[i]+10**6<2*(10**6):
        counter[a[i]+10**6]+=1

ans = 0
for i in range(len(needsearch)):
    if 0<needsearch[i]+10**6<2*(10**6):
        ans += counter[needsearch[i]+10**6]
    counter[a[i]+10**6]-=1


print(ans)

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

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**5))

for i in range(n):
    if 0<a[i]+10**5<2*(10**5):
        counter[a[i]+10**5]+=1

ans = 0
for i in range(len(needsearch)):
    if 0<needsearch[i]+10**5<2*(10**5):
        ans += counter[needsearch[i]+10**5]
    counter[a[i]+10**5]-=1


print(ans)

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

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**5))

for i in range(n):
    if 0<a[i]+10**5<2*(10**5):
        counter[a[i]+10**5]+=1

ans = 0
for i in range(len(needsearch)):
    ans += counter[needsearch[i]+10**5]



print(ans)
Problem p02703 (python)

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

ways=[[] for _ in range(N)]
CD=[[0]*2 for _ in range(N)]

class Way:
  def __init__(self,t,f,ti):
    self.to=t
    self.fare=f
    self.time=ti 

for i in range(M):
  U,V,A,B=map(int,input().split())
  U-=1
  V-=1
  ways[U].append(Way(V,A,B))
  ways[V].append(Way(U,A,B))

for i in range(N):
  C,D=map(int,input().split())
  CD[i][0]=C
  CD[i][1]=D
  
#dp[i][j]:駅iにおいて銀貨をj枚所持するための最短時間
dp=[[float("inf")]*(50*N+1) for _ in range(N)]
S=min(S,50*N)
dp[0][S]=0
import heapq

#data型は(時間、駅、お金)
#q=heapq.heapify([(0,0,S)])
#q=heapq.heapify([])
q=[]
heapq.heappush(q,(0,0,S))
#print(q)
def Push(time,station,money):
  #print("called")
  global q,dp
  if money<0:
    return
  money=min(money,50*N)
  if dp[station][money] <= time:
    return
  dp[station][money] = time
  heapq.heappush(q,(time,station,money))

while q:
  #print("called!")
  dat = heapq.heappop(q)
  time,station,money=dat[0],dat[1],dat[2]
  
  if dp[station][money]!=time:
    continue
  #まず、両替。
  Push(time+CD[station][1],station,money+CD[station][0])
  #次に、各道について移動
  for w in ways[station]:
    Push(time+w.time,w.to,money-w.fare)

for i in range(1,N):
  ans=float("inf")
  for j in range(50*N+1):
    ans=min(ans,dp[i][j])
  print(ans)

Buggy submission (verdict: Runtime Error):
N,M,S=map(int,input().split())

ways=[[] for _ in range(N)]
CD=[[0]*2 for _ in range(N)]

class Way:
  def __init__(self,t,f,ti):
    self.to=t
    self.fare=f
    self.time=ti 

for i in range(M):
  U,V,A,B=map(int,input().split())
  U-=1
  V-=1
  ways[U].append(Way(V,A,B))
  ways[V].append(Way(U,A,B))

for i in range(N):
  C,D=map(int,input().split())
  CD[i][0]=C
  CD[i][1]=D
  
#dp[i][j]:駅iにおいて銀貨をj枚所持するための最短時間
dp=[[float("inf")]*(50*N+1) for _ in range(N)]
dp[0][S]=0
import heapq

#data型は(時間、駅、お金)
#q=heapq.heapify([(0,0,S)])
#q=heapq.heapify([])
q=[]
heapq.heappush(q,(0,0,S))
#print(q)
def Push(time,station,money):
  #print("called")
  global q,dp
  if money<0:
    return
  money=min(money,50*N)
  if dp[station][money] <= time:
    return
  dp[station][money] = time
  heapq.heappush(q,(time,station,money))

while q:
  #print("called!")
  dat = heapq.heappop(q)
  time,station,money=dat[0],dat[1],dat[2]
  
  if dp[station][money]!=time:
    continue
  #まず、両替。
  Push(time+CD[station][1],station,money+CD[station][0])
  #次に、各道について移動
  for w in ways[station]:
    Push(time+w.time,w.to,money-w.fare)

for i in range(1,N):
  ans=float("inf")
  for j in range(50*N+1):
    ans=min(ans,dp[i][j])
  print(ans)
Problem p02705 (python)

Fixed submission:
print(int(input())*2*3.1415)

Buggy submission (verdict: Runtime Error):
print(int(input)*2*3.1415)
Problem p02708 (python)

Fixed submission:
N,K=map(int,input().split())
mod=7+10**9
ans=0
l=list(range(0,N+1))
for i in range(1,N+1):
    l[i]+=l[i-1]
for i in range(K,N+2):
    ans+=(l[-1]-l[-((1+i)%(N+2))]-l[i-1]+1)%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
mod=7+10**9
ans=0
l=range(0,N+1)
for i range(k,n+2):
    ans+=(sum(l[(-k%(n+1)9:])-sum(l[:k])+1)
print(ans%mod)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
mod=7+10**9
ans=0
l=range(0,N+1)
for i range(k,n+2):
    ans+=(sum(l[(-k%(n+1)9:])-sum(l[:k])+1)%mod
print(ans%mod)
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P.append(float("inf"))
Q.append(float("inf"))
ans=sum(P[:X]+Q[:Y])
rfinish=False
gfinish=False
r,g,f=X-1,Y-1,0
while f<C and (R[f]>P[r] or R[f]>Q[g]):
    if P[r]<Q[g]:
        ans=ans-P[r]+R[f]
        r-=1
        f+=1
    else:
        ans=ans-Q[g]+R[f]
        g-=1
        f+=1
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

ans=sum(P[:X]+Q[:Y])
r,g,f=X,Y,0
while (R[f]>P[r] or R[f]>Q[g]) and r>=0 and g>=0 and f<C:
    if P[r]<Q[g]:
        ans=ans-P[r]+R[f]
        r-=1
        f+=1
    else:
        ans=ans-Q[g]+R[f]
        g-=1
        f+=1
print(ans)
Problem p02730 (python)

Fixed submission:

s=input()
flag=True
n=len(s)
if s!=s[::-1]:
    flag=False
if s[:(n-1)//2]!="".join(list(reversed(s[:(n-1)//2]))):
    flag=False
if s[(n+3)//2-1:]!="".join(list(reversed(s[(n+3)//2-1:]))):
    flag=False
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
s=input()
flag=True
n=len(s)
if s!=reversed(s):
    flag=False
if s[:(n-1)/2]!=reversed(s[:(n-1)/2]):
    flag=False
if s[(n+3)/2-1:]!=reversed(s[(n+3)/2-1::-1]):
    flag=False
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
s=input()
flag=True
n=len(s)
if s!=s.reversed():
    flag=False
if s[:(n-1)/2]!=s[:(n-1)/2:-1]:
    flag=False
if s[(n+3)/2-1:]!=s[(n+3)/2-1::-1]:
    flag=False
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
s=input()
a=s
s=a
flag=True
n=len(s)
if s!=s.reversed():
    flag=False
if s[:(n-1)/2]!=s[:(n-1)/2].reversed():
    flag=False
if s[(n+3)/2-1:]!=s[(n+3)/2-1:].reversed():
    flag=False
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
s=str(input())
flag=True
n=len(s)
if s!=s.reversed():
    flag=False
if s[:(n-1)/2]!=s[:(n-1)/2].reversed():
    flag=False
if s[(n+3)/2-1:]!=s[(n+3)/2-1:].reversed():
    flag=False
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
s=input()
flag=True
n=len(s)
if s!=s.reversed():
    flag=False
if s[:(n-1)/2]!=s[:(n-1)/2].reversed():
    flag=False
if s[(n+3)/2-1:]!=s[(n+3)/2-1:].reversed():
    flag=False
print("Yes" if flag else "No")
Problem p02731 (python)

Fixed submission:
l=int(input())
print((l/3.0)**3)

Buggy submission (verdict: Runtime Error):
l=int(input())
ans((l/3.0)**3)
Problem p02732 (python)

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

counter=[0]*(n+1)
for a in al:
    counter[a]+=1

sum=0
for c in counter:
    sum+=c*(c-1)//2

for a in al:
    print(sum-(counter[a]-1))

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

counter=[0]*(n+1)
for a in al:
    nums[a]+=1

sum=0
for c in counter:
    sum+=c*(c-1)//2

for a in al:
    print(sum-(counter[a]-1))

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

counter=[0]*n
for a in al:
    nums[a]+=1

sum=0
for c in counter:
    sum+=c*(c-1)//2

for a in al:
    print(sum-(counter[a]-1))
Problem p02814 (python)

Fixed submission:
from fractions import gcd
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
List=list(map(lambda x:int(x)//2,map(int, set(input().split()))))

def main():
    LCM=1

    for i in List:
        LCM*=i//gcd(LCM,i)

    for i in List:
        if LCM//i%2==0:
            print(0)
            exit()

    print(int(M//(LCM*2)+M%(LCM*2)//LCM))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N,M=map(int,input().split())
#List=list(map(lambda x:int(x)/2,input().split()))
List=list(int,input().split()))


LCM=1
cut2count=0
a=List[0]
while a%2==0:
    a/=2
    cut2count+=1

for i in List:
    i/=2
    LCM*=i/gcd(LCM,i)
        
    cut2countb=0
    b=i
    while b%2==0:
        b/=2
        cut2count+=1
    if cut2count!=cut2countb:
        print(0)
        exit()


#for i in List:
 #   if LCM/i%2==0:
  #      print(0)
   #     exit()

print(int(M//(LCM*2)+M%(LCM*2)//LCM))
Problem p02838 (python)

Fixed submission:

n = int(input())
al = list(map(int,input().split()))

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
def main():
    n =int(input())
    al = list(map(int,input().split()))

    res = 0
    bits = [[0]*2 for _ in range(60)]
    for a in al:
        i = 0
        while a > 0:
            bits[i][a&1] += 1
            a = a >> 1
            d += 1

    res = 0

    for i in range(60):
        res += bits[i][0] * bits[i][1]  * (2 ** i)

    print(res % (10 ** 9 + 7))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n =int(input())
    al = list(map(int,input().split()))

    res = 0
    bits = [[0]*2 for _ in range(60)]
    for a in al:
        i = 0
        while a > 0:
            bits[i][a&1] += 1
            a == a >> 1
            d += 1

    res = 0

    for i in range(60):
        res += bits[i][0] * bits[i][1]  * (2 ** i)

    print(res % (10 ** 9 + 7))

if __name__ == "__main__":
    main()