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

Fixed submission:
print('A' + input().split()[1][0] + 'C')

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
A = list(map(int, input().split()))

if len(A) % 2 == 0:
    A = A + [0]
# print('A', A)

ans = 0
for i in range(1, N, 2):
    total = A[i - 1] + A[i]
    diff = total - x
    if diff <= 0:
        continue
    v1 = min(A[i], diff)
    v2 = diff - v1
    A[i] -= v1
    A[i - 1] -= v2
    ans += v1 + v2
    # print('A', A)
print(ans)
Problem p02657 (python)

Fixed submission:
x,y=map(int,input().split())
print(x*y)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if(0 in l):
  print(0)
else:
  p=1
  for i in l:
      p*=i
      if(p>1000000000000000000):
          print(-1)
          exit()
  print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if(0 in l)::
    print(0)
    exit()
p=1
for i in l:
    p*=i
    if(p>1000000000000000000):
        print(-1)
        exit()
print(p)
Problem p02801 (python)

Fixed submission:
s=input()
print(chr(ord(s)+1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[0]*n
d=[0]*n
for i in range(m):
    s=input().split()
    x=int(s[0])
    if(s[1]=='AC'):
        l[x-1]=1
    else:
        if(l[x-1]==1):
            continue
        else:
            d[x-1]+=1
p=0
for i in range(n):
    if(l[i]==1):
        p+=d[i]
print(sum(l),p)
Problem p02969 (python)

Fixed submission:
n=int(input())
print(3*n*n)

Buggy submission (verdict: Runtime Error):
print(3*(int(input())**2)
Problem p02999 (python)

Fixed submission:
a,b=map(int,input().split())
if(a<b):
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=1
for i in range(n):
  s+=l[i]
  if(s<=k):
    c+=1
  else:
    break
print(c)
Problem p03000 (python)

Fixed submission:
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=1
for i in range(n):
    s+=l[i]
    if(k<s):
        break
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=0
i=0
while(s<=k):
    s+=l[i]
    i+=1
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=0
i=0
while(s<=k):
    s+=l[i]
    i+=1
    c+=1
print(c)
Problem p03079 (python)

Fixed submission:
l=list(map(int,input().split()))
m=len(set(l))
if(m==1):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
l=list(map(int,input().split()))
m=len(set(l))
if(m==1):
  print("Yes")
else:
  prit("No")
Problem p03150 (python)

Fixed submission:
s=input()
l='keyence'
n=len(s)
for i in range(n-1):
    for j in range(i,n):
        r=s[:i]+s[j:]
        if(r==l):
            print("YES")
            exit()
print("NO")

Buggy submission (verdict: Runtime Error):
s=input()
l='keyence'
x=0
n=len(s)
f=0
i=0
while(i<n):
    if(l[x]==s[i]):
        x+=1
    else:
        f+=1
        j=i
        while(j<n):
            if(l[x]==s[j]):
                x+=1
                i=j
                break
            else:
                j+=1
    i+=1
if(f<=1 and x==7):
    print("YES")
else:
    print('NO')
Problem p03264 (python)

Fixed submission:
n=int(input())
print(n//2*(n-n//2))

Buggy submission (verdict: Runtime Error):
import sys 

x1,y1,x2,y2=list(map(int,input().split()))
dx=x2-x1
dy=y2-y1
print("%d %d %d %d"%(x2-dy,y2+dx,x1-dy,y1+dx))

Buggy submission (verdict: Runtime Error):
x1,y1,x2,y2=list(map(int,input().split()))
dx=x2-x1
dy=y2-y1
print(x2-dy,y2+dx,x1-dy,y1+dx)
Problem p03289 (python)

Fixed submission:
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
    for i in range(1,len(s)):
        if s[i].islower() == True:
            continue
        else:
            if s[i] == 'C':
                continue
            else:
                print('WA')
                exit()
else:
    print('WA')
    exit()
print('AC')

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
if(s.count('C')==1):
    x=s.index('C')
c=0
for i in s:
    if(i.islower()):
        c+=1
if(s[0]=='A' and (x>=2 and x<=n-2) and c==n-2):
    print('AC')
else:
    print("WA")
Problem p03292 (python)

Fixed submission:

l=list(map(int,input().split()))
l.sort()
print(l[1]-l[0]+l[2]-l[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l.sort()
print(l[1]-l[0]+l[2]-l[1])
Problem p03399 (python)

Fixed submission:
l=[]
for i in range(4):
    l.append(int(input()))
print(min(l[0],l[1])+min(l[2],l[3]))

Buggy submission (verdict: Runtime Error):
l=list(map(int,input().split()))
print(min(l[0],l[1])+min(l[2],l[3]))
Problem p03624 (python)

Fixed submission:
s=input()
l='abcdefghijklmnopqrstuvwxyz'
for i in range(26):
    if(s.count(l[i])==0):
        print(l[i])
        exit()
print('None')

Buggy submission (verdict: Runtime Error):
s=input()
l='abcdefghijklmnopqrstuvwxyz'
s=''.join(list(set(s)))
s=sorted(s)
f=0
for i in range(26):
    if(s[i]!=l[i]):
        print(l[i])
        f=1
        break
if(f==0):
    print('None')

Buggy submission (verdict: Runtime Error):
s=input()
l='abcdefghijklmnopqrstuvwxyz'
s=''.join(list(set(s)))
s=sorted(s)
for i in range(26):
    if(s[i]!=l[i]):
        print(l[i])
        exit()
Problem p03635 (python)

Fixed submission:
x,y=map(int,input().split())
print((x-1)*(y-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
x=0
y=0
c=0
for i in range(n):
    if(l[i]%4==0):
        x+=1
    elif(l[i]%2==0):
        y+=1
    else:
        c+=1
if(n%2==0):
    if(x>=c):
        print("Yes")
    else:
        print('No')
else:
    if(x>=(c-1)):
        print("Yes")
    else:
        print("No")
Problem p03738 (python)

Fixed submission:
x=int(input())
y=int(input())
if(x>y):
    print('GREATER')
elif(x<y):
    print("LESS")
else:
    print("EQUAL")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if(x>y):
    print('GREATER')
elif(x<y):
    print("LESS")
else:
    print("EQUAL")
Problem p02642 (python)

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

Cnt = [0 for i in range(10**6 + 8)]
for i in A:
    if Cnt[i] != 0:
        Cnt[i] = 2
        continue
    else:
        pass
    for j in range(i, 10**6 + 8, i):
        Cnt[j] += 1

ans = 0
for i in A:
    if Cnt[i] == 1:
        ans += 1
    else:
        pass

print(ans)

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

Cnt = [0 for i in range(10**6 + 7)]
for i in A:
    if Cnt[i] != 0:
        Cnt[i] = 2
        continue
    else:
        pass
    for j in range(i, 10**6 + 8, i):
        Cnt[j] += 1

ans = 0
for i in A:
    if Cnt[i] == 1:
        ans += 1
    else:
        pass

print(ans)

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

Cnt = [0 for i in range(10**6 + 7)]
for i in A:
    if Cnt[i] != 0:
        Cnt[i] = 2
        continue
    for j in range(i, 10**6 + 8, i):
        Cnt[j] += 1

ans = 0
for i in A:
    if Cnt[i] == 1:
        ans += 1
    else:
        pass

print(ans)
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

pnum, qnum, rnum = 0, 0, 0
ans = 0
time = 0
while time < x+y:
    #P, Q, Rのなかで現状最大の値を取り出す(x,yの値も考慮)
    #P
    if pnum >= x:
        p = 0
    else:
        p = P[pnum]
    #Q
    if qnum >= y:
        q = 0
    else:
        q = Q[qnum]
    #R
    if rnum >=  c:
        r = 0
    else:
        r = R[rnum]
    Option = [p, q, r]

    #今の状況の中でおいしさ最大のものを取り出す
    m = 0
    color = 0
    for i in range(3):
        if m < Option[i]:
            m = Option[i]
            color = i
        else:
            pass
    ans += m

    #選択済みのリンゴを反映
    if color == 0:
        pnum += 1
    elif color == 1:
        qnum += 1
    elif color == 2:
        rnum += 1
    else:   
        print('error')

    #今まで選んだリンゴの数を反映
    time += 1

print(ans)

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse = True)
Q = sorted(list(map(int, input().split())), reverse = True)
R = sorted(list(map(int, input().split())), reverse = True)

pnum, qnum, rnum = 0, 0, 0
ans = 0
for i in range(x+y):
    O = [0 for j in range(3)]
    if pnum >= x:
        O[0] = 0
    else:
        O[0] = P[pnum]
    
    if qnum >= y:
        O[1] = 0
    else:
        O[1] = Q[qnum]

    O[2] = R[rnum] 
    c = 0
    num = 0
    for j in range(3):
        if c <= O[j]:
            c = O[j]
            num = j
        else:
            pass
    
    if num == 0:
        pnum += 1
    elif num == 1:
        qnum += 1
    elif num == 2:
        rnum += 1
    else:
        pass
    ans += c
    
print(ans)
Problem p02802 (python)

Fixed submission:
#print("<input>") #
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

#print("<test>") #
#print("A=",A) #

nAC=0
nWA=0
inWA=0
j=0
for i in range(N):
    #print("i=",i) #
    if len(A[i])==0:
        pass
    else: 
        while A[i][j]=="WA":
            inWA+=1
            nWA+=1
            #print("j=",j) #
            #print("inWA=",inWA) #
            #print("nWA=",nWA) #
            if j==len(A[i])-1:
                nWA-=inWA
                break
            else:
                pass
            j+=1
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
        inWA=0
        j=0
        #print("inWA=",inWA) #
        #print("nWA=",nWA) #
        

#print("<ans>") #
print("{0} {1}".format(nAC,nWA))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            j+=1
            if j==len(A[i])-1:
                break
            else:
                pass
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1}{:2}".format(nAC,nWA))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            j+=1
            if j==len(A[i]):
                break
            else:
                pass
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1}{:2}".format(nAC,nWA))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            j+=1
            if j>len(A[i]):
                break
            else:
                pass
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1}{:2}".format(nAC,nWA))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[[] for i in range(N)]
for i in range(M):
    Pi,Si=map(str,input().split())
    Pi=int(Pi)
    A[Pi-1].append(Si)

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            j+=1
            if j>len(A[i]):
                break
            else:
                pass
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1},{:2}".format(nAC,nWA))
Problem p02882 (python)

Fixed submission:
from math import atan2, degrees

a, b, x = map(int, input().split())

s = x/a
if s >= a*b/2:
    z = 2*b - 2*x/a**2
    ans = degrees(atan2(z, a))
else:
    z = 2*x/(a*b)
    ans = 90-degrees(atan2(z, b))
print(ans)

Buggy submission (verdict: Runtime Error):
import math 
a,b,x=map(int,input().split())
if x==(a*a*b)//2:
    print(math.degrees(math.atan(b/a)))
elif x>(a*a*b)//2:
    x=((2*x)/(a*b))-a
    print(math.degrees(math.atan(b/(a-x))))
Problem p02909 (python)

Fixed submission:
w=input()
a=("Sunny","Cloudy","Rainy")
b=a.index(w)
if b == 2:
    ans=0
else:
    ans=b+1
c=a[ans]
print(c)

Buggy submission (verdict: Runtime Error):
w=input()
a=("Sunny","Cloudy","Rainy")
b=a.index(w)
if b == 3:
    ans=1
else:
    ans=b+1
c=a[ans]
print(c)
Problem p02922 (python)

Fixed submission:
po=list(map(int,input().split()))
A=po[0]
B=po[1]
C=po[0]-1
ans=1
if B == 1:
    ans=0
else:
    while A < B:
        ans=ans+1
        A=A+C
print(ans)

Buggy submission (verdict: Runtime Error):
po=list(map(int,input().split()))
A=po[0]
B=po[1]
C=po[0]-1
ans=1
if B == 1:
    ans=0
elif:B == 0:
    ans=0
else:
    while A < B:
        ans=ans+1
        A=A+C
print(ans)
print(A)

Buggy submission (verdict: Runtime Error):
po=list(map(int,input().split()))
A=po[0]
B=po[1]
C=po[0]-1
ans=1
if B == 1:
    ans=0
    break
else:
    while A < B:
        ans=ans+1
        A=A+C
print(ans)
print(A)
Problem p02945 (python)

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

a=int[0]
b=int[1]

x=a+b
y=a-b
z=a*b

max=x
if y > max:
    max=y
if z > max:
    max=z
print(max)

Buggy submission (verdict: Runtime Error):
x=input().split()

a=x[0]
b=x[1]

p=a + b
q=a - b
r=a * b

max=p
if q > max:
    max = q
    if r > max:
        max = r

print(max)
Problem p02946 (python)

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

k = int[0]
x = int[1]

p=x + 1 
q=p - k
r=x + k

s =list(range(q,r))
print(*s)

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

k = int[0]
x = int[1]

p = range(x + 1 - k,x + k)

print(list[p])

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

k=int.pop(0)
x=int.pop(1)

p=range((x+1)-k,x+k)

print(p)
Problem p03238 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
ans=[]
if n == 1:
    ans="Hello World"
else:
    ans=a+b
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
ans=[]
if n == 1:
    ans="Hello World"
else:
    ans=a+b
print(ans)
Problem p02554 (python)

Fixed submission:
def div(n,T):
    tmp = 10 ** 9 + 7
    _ = 1
    for t in range( T- 1):
        _ *= n
        _ %= tmp
    return _ * n
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)
print((a + c - b * 2) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
 tmp = 10 ** 9 + 7
def div(n,T):
    _ = 1
    for t in range(T):
        _ *= n
        _ %= tmp
    return _
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)

print((a + c - 2 * b) % tmp
Problem p02601 (python)

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

i = 0
while B <= A:
  B *= 2
  i += 1
  
while C <= B:
  C *= 2
  i += 1

print('Yes' if i <= K else 'No')

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
K = int(input())

n = 0
while B <= A:
  B * 2
  i += 1
  
while C <= B:
  C * 2
  i += 1

print('Yes' if i <= K else 'No)
Problem p02607 (python)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (n + 1) % 2 == 1 and L[n] % 2 == 1:
    cnt += 1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (i + 1) % 2 == 1 and L[n] % 2 == 0:
    cnt += 1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(n):
  if (i + 1) % 2 == 1 and L[n] % 2 == 0:
    cnt += 1
    
print(cnt)
Problem p02608 (python)

Fixed submission:
N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = int(((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 )
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')
Problem p02628 (python)

Fixed submission:
N,M = map(int, input().split())
prices = list(map(int,input().split()))
prices.sort()
print(sum(prices[0:M]))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input())
prices = list(map(int,input().split()))
prices.sort()
print(sum(sumprices[0:M - 1]))
Problem p02630 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C_A = Counter(A)
S = 0
for ca in C_A:
  S += ca * C_A[ca]

Q = int(input())
for q in range(Q):
  b, c = map(int,input().split())
  S += (c - b) * C_A[b]
  C_A[c] += C_A[b]
  C_A[b] = 0
  
  print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
Q = int(input())
for q in range(Q):
  b, c = input().split()
  A = A.replace(b,c)
  An = list(map(int,A)
  print(sum(An))
Problem p02842 (python)

Fixed submission:
import math
price = int(input())
tax = 8
price_1 = math.ceil(price / (1 + tax / 100))
price_2 = math.floor(price_1 * tax / 100)
print(price_1 if price == price_1 + price_2 else ':(')

Buggy submission (verdict: Runtime Error):
import math
price = int(input())
tax = 8
price_1 = math.ceil(price / (1 + tax / 100))
price_2 = math.floor(price * tax / 100)
print(price_1 if price == price_1 + price2 else ':(')
Problem p02952 (python)

Fixed submission:
N = int(input())
cnt = 0
for n in range(1,N + 1):
    l = len(str(n))
    if l % 2 == 1:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
cnt = 0
for n in range(1,N　+ 1):
    l = len(str(n))
    if l % 2 == 1:
        cnt += 1

print(cnt)
Problem p03243 (python)

Fixed submission:
contests = [i for i in range(100,1000) if i % 111 == 0]
N = int(input())
for contest in contests:
  if contest >= N:
    print(contest)
    break
  else:
    continue

Buggy submission (verdict: Runtime Error):
contests = [i for i in range(100,1000) if i % 111 == 0]
N = int(input())
for contest in contests:
  if contests >= N:
    print(contest)
    break
  else:
    continue
Problem p03545 (python)

Fixed submission:
N = input()
N = [int(n) for n in N]
A,B,C,D = N
op =['+','-']
ops = []
for a in op:
  for b in op:
    for c in op:
        ops.append(a + b + c)
        
for op in ops:
  S = "{}{}{}{}{}{}{}".format(A,op[0],B,op[1],C,op[2],D)
  if eval(S) == 7:
    print("{}=7".format(S))
    break

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
op =['+','-']
ops = []
for a in op:
  for b in op:
    for c in op:
        ops.append(a + b + c)
        
for op in ops:
  S = "{1}{2}{3}{4}{5}{6}{7}".format(A,op[0],B,op[1],C,op[2],D)
  if eval(S) == 7:
    print("{}=7".format(S))
    break
Problem p02601 (python)

Fixed submission:
from itertools import product
def solve():
    card_org = list(map(int,input().split()))
    K = int(input())
    comb = list(product(range(3), repeat=K))

    for c in comb:
        card = card_org[:]
        if card[1] > card[0] and card[2] > card[1]:
            print('Yes')
            return

        for i in range(K):
            card[c[i]] *= 2
        
            if card[1] > card[0] and card[2] > card[1]:
                print('Yes')
                return
    
    print('No')

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
from itertools import product
def solve():
    card_org = list(map(int,input().split()))
    K = int(input())
    comb = list(product(range(3), repeat=K))

    for c in comb:
        card = card_org[:]
        for i in range(3):
            card[c[i]] *= 2
        
        if card[1] > card[0] and card[2] > card[1]:
            print('Yes')
            return
    
    print('No')

if __name__ == '__main__':
    solve()
Problem p02609 (python)

Fixed submission:
def solve():
    N = int(input())
    X = input()
    X_10 = int(X,2)

    r = X.count("1")
    r0 = r-1
    r1 = r+1
    ans = []
    
    s0 = X_10 % r0 if r != 1 else None
    s1 = X_10 % r1 

    for i in range(N):
        if X[i] == '0':
            ans.append(f((s1 + pow(2,N-1-i,r1)) % r1))
        else:
            if r0 == 0:
                ans.append(0)
            else:
                ans.append(f((s0 - pow(2,N-1-i,r0)) % r0))
    
    print(*ans, sep='\n')

def f(N):
    cnt = 1
    while N != 0:
        N = N % popcount(N)
        cnt += 1
    
    return cnt

def popcount(N):
    b = bin(N)
    cnt = 0
    for i in range(2,len(b)):
        if b[i] == '1':
            cnt += 1

    return cnt

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    X = input()
    X_10 = int(X,2)

    r = X.count("1")
    r0 = r-1
    r1 = r+1
    ans = []
    
    s0 = X_10 % r0 
    s1 = X_10 % r1 

    for i in range(N):
        if X[i] == '0':
            ans.append(f((s1 + pow(2,N-1-i,r1)) % r1))
        else:
            if r == 1:
                ans.append(0)
            else:
                ans.append(f((s0 - pow(2,N-1-i,r0)) % r0))
    
    print(*ans, sep='\n')

def f(N):
    cnt = 1
    while N != 0:
        N = N % popcount(N)
        cnt += 1
    
    return cnt

def popcount(N):
    b = bin(N)
    cnt = 0
    for i in range(2,len(b)):
        if b[i] == '1':
            cnt += 1

    return cnt

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    X = input()
    X_10 = int(X,2)

    r = X.count("1")
    r0 = r-1
    r1 = r+1
    ans = []
    
    s0 = X_10 % r0 
    s1 = X_10 % r1 

    for i in range(N):
        if X[i] == '0':
            ans.append(f(s1 + pow(2,N-1-i) % r1))
        else:
            if r == 1:
                ans.append(0)
            else:
                ans.append(f(s0 - pow(2,N-1-i) % r0))
    
    print(*ans, sep='\n')

def f(N):
    cnt = 1
    while N != 0:
        N = N % popcount(N)
        cnt += 1
    
    return cnt

def popcount(N):
    b = bin(N)
    cnt = 0
    for i in range(2,len(b)):
        if b[i] == '1':
            cnt += 1

    return cnt

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    X = input()
    X_10 = int(X,2)

    r = X.count("1")
    r0 = r-1
    r1 = r+1
    ans = []
    
    s1 = X_10 % r1 
    s0 = X_10 % r0 
    for i in range(N):
        if X[i] == '0':
            ans.append(f((s1 + pow(2,N-1-i)) % r1))
        else:
            if r == 1:
                ans.append(0)
            else:
                ans.append(f((s0 - pow(2,N-1-i)) % r0))
    
    print(*ans, sep='\n')

def f(N):
    cnt = 1
    while N != 0:
        N = N % popcount(N)
        cnt += 1
    
    return cnt

def popcount(N):
    b = bin(N)
    cnt = 0
    for i in range(2,len(b)):
        if b[i] == '1':
            cnt += 1

    return cnt

if __name__ == '__main__':
    solve()
Problem p02743 (python)

Fixed submission:
import math
def solve():
    a,b,c = map(int, input().split())
    if 4 * a * b < (c-a-b)**2 and c-a-b>0:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
def solve():
    a,b,c = map(int, input().split())
    if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt()
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    solve()