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

Fixed submission:

L = list(map(int, input().split()))
if L[2] == L[0]/2 and L[3] == L[1]/2:
    print(L[0]*L[1]/2,1)
else:
    print(L[0]*L[1]/2, 0)

Buggy submission (verdict: Runtime Error):

#N = int(input())
A = input().split()
#B = input().split()
for i in range(N+1):
    A[i] = int(A[i])
#for i in range(N):
#    B[i] = int(B[i])

ue = A[0]*(A[1]-A[2])
shita = A[0]*A[2]
migi = A[1]*(A[0]-A[3])
hidari = A[1]*A[3]
chinpo = True

if ue > shita:
    if migi > hidari:
        if migi == ue:
            print(str(ue) + " " + "1")
        else:
            print(str(ue) + " " + "0")
    else:
        if migi == hidari:
            print(str(migi) + " " + "1")
            chinpo = False 
        if hidari == ue & chinpo:
            print(str(ue) + " " + "1")
        else:
            print(str(ue) + " " + "0")
else:
    if ue == shita:
        print(str(ue) + " " + "1")
        chinpo = False
    if migi > hidari & chinpo:
        if migi == ue:
            print(str(ue) + " " + "1")
        else:
            print(str(ue) + " " + "0")
    else:
        if migi == hidari:
            print(str(migi) + " " + "1")
            chinpo = False
        if hidari == ue & chinpo:
            print(str(ue) + " " + "1")
        else:
            print(str(ue) + " " + "0")
Problem p03565 (python)

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False
cnt = 0

for i in range(len(s)-len(t)+1)[::-1]:
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt += 1
        #print(cnt,len(t))
    if cnt == len(t):
        cnt = i
        flg = True
        #print(cnt)
        break

if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?", "a"))
    #print(li)
    for j in range(len(t))[::-1]:
        #print(li[cnt+j], t[j])
        li[cnt+j] = t[j]
    print("".join(li))

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


import sys
input = sys.stdin.readline
s = input()
t = input()
flg = False
cnt = 0

for i in range(len(s)-len(t)+1):

    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt += 1
            continue

    if cnt == len(t):
        flg = True
        print(cnt)
        break

if not flg:
    print("UNRESTORABLE")
else:
    li = list(s)
    for j in range(len(t)):
        li[cnt+j]=t[j]
    print("".join(li))
Problem p04045 (python)

Fixed submission:
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)'''

a=list(map(str, [0,1,2,3,4,5,6,7,8,9]))
n,k=map(int, input().split())
d=list(map(str, input().split()))
for item in d:
    a.remove(item)
#print(a)

from collections import deque

q=deque()
q.extend(a)
for i in range(len(a)):
    if int(a[i])>=n:
        print(a[i])
        sys.exit()

while True:
    qq=q.popleft()
    #print(q)
    for item in a:
        qqq=qq+item
        #print(qqq[::-1])
        if int(qqq[::-1])>=n:
            print(qqq[::-1])
            sys.exit()
        q.append(qqq[::-1])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)'''

a=list(map(str, [0,1,2,3,4,5,6,7,8,9]))
n,k=map(int, input().split())
d=list(map(str, input().split()))
for item in d:
    a.remove(item)
#print(a)

from collections import deque

q=deque()
q.extend(a)
if n<10:
    if a[0]!=0:
        print(a[1])
        sys.exit()
    else:
        print(a[0])
        sys.exit()

while True:
    qq=q.popleft()
    #print(q)
    for item in a:
        qqq=qq+item
        #print(qqq[::-1])
        if int(qqq[::-1])>=n:
            print(qqq[::-1])
            sys.exit()
        q.append(qqq[::-1])
Problem p02574 (python)

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

maxV = (10 ** 6 + 1)

sieve = [i for i in range(maxV)]
p = 2

while p*p < maxV:
    if sieve[p] == p:
        for q in range(p*2, maxV, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

from math import gcd

g = 0
primes = set()
for a in A:
    g = gcd(g, a)

    v = a


if g > 1:
    print('not coprime')
    exit()

for a in A:
    temp_prime = set()
    while a > 1:
        prime = sieve[a]
        temp_prime.add(prime)
        a = a // prime

    for t in temp_prime:
        if t in primes:
            print('setwise coprime')
            exit()
        primes.add(t)

print('pairwise coprime')

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

maxV = (10 ** 6 + 1)

sieve = [i for i in range(maxV)]
p = 2

while p*p < maxV:
    if sieve[p] == p:
        for q in range(p*2, maxV, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

from math import gcd

g = 0
primes = set()
for a in A:
    g = gcd(g, A)

    v = a
    while a > 1:
        prime = sieve[a]
        if prime in primes:
            print('')
        primes.add(prime)
        a = a // prime


if g > 1:
    print('not coprime')

for a in A:
    while a > 1:
        prime = sieve[a]
        if prime in primes:
            print('pairwise coprime')
            exit()
        primes.add(prime)
        a = a // prime

print('setwise coprime')
Problem p02696 (python)

Fixed submission:
a,b,n = map(int, input().split())

m = min(b-1, n)

print(a * m // b)

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

print(min(b-1, n))a,b,n = map(int, input().split())

print(min(b-1, n))
Problem p02642 (python)

Fixed submission:
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    adic={}
    for i in range(n):
        if a[i] in adic:
            adic[a[i]]+=1
        else:
            adic[a[i]]=1
    ans=0
    a=list(set(a))
    a.sort()
    maxa=max(a)
    dp=[True for i in range(maxa+1)]
    for i in a:
        if dp[i] and adic[i]==1:ans+=1
        j=i+i
        while j<=maxa:
            dp[j]=False
            j+=i
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    from sympy import sieve
    import sys
    import math
    import copy
    input=sys.stdin.readline
    n=I()
    a=L()
    
    primelist=[i for i in sieve.primerange(1,int(math.sqrt(1e+6))+1)]
    
    dic={}
    for i in range(n):
        for j in primelist:
            if a[i]%j==0:
                if j in dic:
                    dic[j].add(a[i])
                else:
                    dic[j]={a[i]}
    ans=0
    a=list(set(a))
    keyset=set([i for i in dic.keys()])
    if len(a)==1:
        print(0)
        exit()
    for i in range(len(a)):
        tmpset=copy.copy(keyset)
        seta=set(a)
        tmp=[]
        for j in primelist:
            if a[i]%j==0:tmp.append(j)
        tmpset=tmpset - set(tmp)
        for j in tmpset:
            seta=seta-dic[j]
        ans+=1 if(min(seta)==a[i]) else 0 
    print(ans)
    
if __name__ == '__main__':
    main()
Problem p02684 (python)

Fixed submission:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    import sys
    input = sys.stdin.readline
    n,k=L()
    a=L()
    visited=[0]*(n+1)
    tmp=0
    now=0
    visited[0]=1
    loopat=-1
    for i in range(k):
        #print(visited,end="")
        tmp=i+2
        now=a[now]-1
        #print(now)
        #print(tmp,now+1)
        if visited[now]==0:
            visited[now]=i+2
        else:
            loopat=now
            break
    #print(visited)
    #print(loopat,visited[loopat],tmp)
    #print(tmp,now)
    if loopat==-1:
        print(now+1)
        exit()
    elif tmp-visited[loopat]==0:
        tmp2=k
        dist=1
        now=0
    else:
        tmp2=(k-(visited[loopat]-1))%(tmp-visited[loopat])
        dist=loopat+1
    #print(tmp2)
    
    #print(now,dist)
    #print(now+1,end=" ")
    for i in range(tmp2):
        now=a[now]-1
        dist=now+1
        #print(now,dist)
    #print()
    print(dist)
    
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    import sys
    input = sys.stdin.readline
    n,k=L()
    a=L()
    visited=[0]*n
    tmp=0
    now=0
    visited[0]=1
    
    for i in range(k):
        #print(visited,end="")
        now=a[now]-1
        #print(now)
        #print(tmp,now+1)
        if visited[now]==0:
            visited[now]=i+2
        else:
            tmp=i+2
            loopat=now
            break
    #print(visited)
    #print(loopat,visited[loopat],tmp)
    #print(tmp,now)
    tmp2=(k-(visited[loopat]-1))%(tmp-visited[loopat])
    #print(tmp2)
    dist=loopat+1
    #print(now,dist)
    #print(now+1,end=" ")
    for i in range(tmp2):
        now=a[now]-1
        dist=now+1
        #print(now,dist)
    #print()
    print(dist)
    
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    import sys
    input = sys.stdin.readline
    n,k=L()
    a=L()
    visited=[0]*n
    tmp=0
    now=0
    visited[0]=1
    for i in range(k):
        now=a[i]-1
        #print(tmp,now+1)
        if visited[now]==0:
            visited[now]=1
        else:
            tmp=i
            break
    #print(tmp,now)
    tmp2=k%tmp
    dist=a[now]
    #print(now+1,end=" ")
    for i in range(tmp2):
        now=a[now]-1
        dist=now+1
        #print(now+1,end=" ")
    #print()
    print(dist)
    
    
if __name__ == '__main__':
    main()
Problem p02730 (python)

Fixed submission:
def main():
    I=lambda:input()
    s=I()
    if s!=s[::-1]:
        print('No')
        exit()
    s1=s[:(len(s)-1//2)+1]
    if s1!=s1[::-1]:
        print('No')
        exit()
    s2=s[(len(s)+3)//2-1:]
    if s2!=s2[::-1]:
        print('No')
        exit()
    print('Yes')
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
s=input()

n=len(s)
h=(n-1)//2
hh=h//2
h3=(n+3)//2
h3h=(h3+n)//2

s1=s[:h]
s2=s[h+1:]
s3=s[:hh]
s4=s[hh+1:h]
s5=s[h3-1:h3h-1]
s6=s[h3h:]

f1=f2=f3=True
for i in range(len(s1)):
  if s1[i]!=s2[len(s2)-1-i]:
    f1=False
for i in range(len(s3)):
  if s3[i]!=s4[len(s4)-1-i]:
    f2=False
for i in range(len(s5)):
  if s5[i]!=s6[len(s6)-1-i]:
    f3=False

ans='Yes' if f1==f2==f3==True else 'No'
print(ans)
Problem p02761 (python)

Fixed submission:
def main():
    I=lambda:input()
    L=lambda:list(map(int,input().split()))
    n,m=L()
    sc=[]
    for i in range(m):
        si,ci=L()
        sc.append([si,ci])
    mini=0 if n==1 else 10**(n-1)
    for i in range(mini,10**n):
        tmp=str(i)
        flag=True
        for j in range(m):
            if tmp[sc[j][0]-1]!=str(sc[j][1]):
                flag=False
        if flag:
            print(i)
            exit()
    print(-1)
        
    
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
num=[0 for i in range(n)]
flag=[False for i in range(n)]
s=[]
c=[]
for i in range(m):
    si,ci=map(int,input().split())
    s.append(si)
    c.append(ci)

def ans():
    for i in range(m):
        if s[i]-1==0 and c[i]==0:
            continue
        if !flag[s[i]-1]:
            num[s[i]-1]=c[i]
            flag=True
        else:
            num[s[i]-1]=min(c[i],num[s[i]-1])
    if n!=1 and num[0]==0:
        print(-1)
        return
    for i in range(n):
        print(num[i],end="")
    print()

ans()
Problem p02928 (python)

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

ans_mono=0
ans_di=0
for i in range(n):
    for j in range(i+1,n):
        if a[i]>a[j]:ans_mono+=1
for i in range(n):
    for j in range(n):
        if a[i]>a[j]:ans_di+=1
print((ans_mono*k+ans_di*(k*(k-1)//2))%int(1e+9+7))

Buggy submission (verdict: Runtime Error):
import copy
import math
n, k = map(int, input().split())
a=[]
a=list(map(int, input().split()))
b=copy.copy(a)
ans=0
b.extend(a)
#print(b)
#print(b[n])

def fact(i):
    sum=1
    for j in range(1,k):
        sum*=j
    return j
        
    """
    if i==1:
        return 1
    else:
        return i*fact(i-1)
    """

for i in range(len(b)):
    tmp=0
    for j in range(i+1,len(b)):
        if j<n:
            if b[i]>b[j]:
                #print("B["+str(i)+"]:" + str(b[i])+" B["+str(j)+"]:"+str(b[j]))
                ans+=1
        else:
            if b[i]>b[j]:
                #print("B["+str(i)+"]:" + str(b[i])+" B["+str(j)+"]:"+str(b[j])+"#")
                tmp+=1
    tmp=int((tmp*sum(list(range(1,k))))%(1e+9+7))
    ans=int((ans+tmp)%(1e+9+7))
print(ans)

#ans=int((ans+1)%(1e+9+7))
Problem p03000 (python)

Fixed submission:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    n,x=L()
    l=L()
    ans=1
    d=0
    for i in range(n):
       d=d+l[i]
       if d<=x:
           ans+=1
    print(ans)
    

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
i=0
s=0
while D<=X or i<N:
  D+=L[i]
  s+=1
  i+=1
print(s)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
i=0
s=0
while D<=X:
  D+=L[i]
  s+=1
  i+=1
print(s)
Problem p03612 (python)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n):
    if i+1==p[i]:
        if i+1==n:
            p[i],p[i-1]=p[i-1],p[i]
        else:
            p[i],p[i+1]=p[i+1],p[i]
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n):
    if i+1==p[i]:
        p[i],p[i+1]=p[i+1],p[i]
        ans+=1
print(ans)
Problem p02614 (python)

Fixed submission:
H, W, K = map(int, input().split())
fi = []
for _ in range(H):
    s = input()
    fi.append(s)
a = 2 ** H
b = 2 ** W
total = 0

for i in range(a * b):
    lh = list()
    lw = list()

    for j in range(H):
        if i & (1 << j):
            lh.append(1)
        else:
            lh.append(0)
    for j in range(W):
        if i & (1 << (j + H)):
            lw.append(1)
        else:
            lw.append(0)
    # print(lh)
    # print(lw)

    cnt = 0
    for j in range(H):
        for l in range(W):
            if lh[j] == 1 or lw[l] == 1:
                continue
            if fi[j][l] == '#':
                cnt += 1
    # print(cnt)
    if cnt == K:
        total += 1

print(total)

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
fi = []
for _ in range(H):
  s = input()
  fi.append(s)
a = 1 << H
b = 1 << W
total = 0

for i in range(a * b):
  lh = list()
  lw = list()

  for j in range(h):
    if i & (1 << j):
      lh.append(1)
    else:
      lh.append(0)
  for j in range(W):
    if i & (1 << (j + H)):
      lw.append(1)
    else:
      lw.append(0)

  cnt = 0
  for j in range(H):
    for l in range(W):
      if lh[j] == 1 or lw[j] == 1:
        continue
      if fi[j][l] == '#':
        cnt += 1
  if cnt == K:
    total += 1

print(total)
Problem p02657 (python)

Fixed submission:
nums = input().split()
print(int(nums[0]) * int(nums[1]))

Buggy submission (verdict: Runtime Error):
nums = input().split()
print(int(num[0]) * int(num[1]))

Buggy submission (verdict: Runtime Error):
nums = input().split()
print(float(num[0]) * float(num[1]))
Problem p02694 (python)

Fixed submission:
import math
X = int(input())
now = 100

year = 0

while True:
    if now >= X:
        break
    now += now // 100
    year += 1

print(year)

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal
X = int(input())
now = Decimal(100)
year = 0

while True:
    if now >= X:
        break
    #王道
    #now += now // 100

    #Decimal型を経由する方法
    #now = int(now * Decimal("1.01"))
    #now = int(now * round(Decimal(1.01), 2))
    now = int(now * round(1.01, 2))
    #now = Decimal(math.floor(now * Decimal(1.01)))
    year += 1

print(year)

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal
X = int(input())
now = 100
year = 0

while True:
    if now >= X:
        break
    #王道
    #now += now // 100

    #Decimal型を経由する方法
    #now = int(now * Decimal("1.01"))
    #now = int(now * round(Decimal(1.01), 2))
    now = now * Decimal(floor(now * 1.01))


    year += 1

print(year)

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal
X = int(input())
now = 100
year = 0

while True:
    if now >= X:
        break
    #王道
    #now += now // 100

    #Decimal型を経由する方法
    #now = int(now * Decimal("1.01"))
    #now = int(now * round(Decimal(1.01), 2))
    now = Decimal(floor(now * 1.01))


    year += 1

print(year)
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
X, Y, Z = map(int, input())
print(Z, X, Y)
Problem p02755 (python)

Fixed submission:
import math

A, B = map(int, input().split())

volume_A = math.floor(A / 0.08)
volume_B = math.floor(B / 0.1)

min_A, max_A = math.inf, -math.inf
range_A = math.floor(1 / 0.08)
min_B, max_B = math.inf, -math.inf
range_B = math.floor(1 / 0.1)
# print(range_A)
# print(range_B)

for i in range(volume_A - range_A, volume_A + range_A):
    if math.floor(i * 0.08) == A:
        min_A = min(min_A, i)
        max_A = max(max_A, i)

for j in range(volume_B - range_B, volume_B + range_B):
    if math.floor(j * 0.1) == B:
        min_B = min(min_B, j)
        max_B = max(max_B, j)

ans_A = set()
for i in range(min_A, max_A + 1):
    ans_A.add(i)
# print(ans_A)

ans_B = set()
for j in range(min_B, max_B + 1):
    ans_B.add(j)
# print(ans_B)

ans = ans_A & ans_B

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())

volume_A = A / 0.08
volume_B = B / 0.1

min_A, max_A = volume_A, volume_A
range_A = 1 / 0.08
min_B, max_B = volume_B, volume_B
range_B = 1 / 0.1

for i in range(math.floor(volume_A - range_A), math.ceil(volume_A + range_A)):
    if math.floor(i * 0.08) == A:
        min_A = min(min_A, i)
        max_A = max(max_A, i)

for j in range(math.floor(volume_B - range_B), math.ceil(volume_B + range_B)):
    if math.floor(j * 0.1) == B:
        min_B = min(min_B, j)
        max_B = max(max_B, j)

ans_A = set()
for i in range(min_A, max_A + 1):
    ans_A.add(i)

ans_B = set()
for j in range(min_B, max_B + 1):
    ans_B.add(j)

ans = ans_A & ans_B

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))
Problem p02548 (python)

Fixed submission:
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
n=int(input())
print(sum(num_divisors_table(n-1)))

Buggy submission (verdict: Runtime Error):
n=int(input())
g=lambda x:(x*(n//x)*(n//x+1))//2
print(sum(g(i) for i in range(2,n+2)-sum(g(i) for i in range(1,n+1))))

Buggy submission (verdict: Runtime Error):
n=int(input())
g=lambda x:(x*(n//x)*(n//x+1))//2
print(sum(g(i) for i in range(2,n+2)-sum(g(i) for i in range(1,n+1)))
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
print((a*min(n,b-1))//b)

Buggy submission (verdict: Runtime Error):
li=[]
a,b,n=map(int,input().split())
for x in range(1,n+1):
    if x%b!=0:
        li.append((a*x)//b-a*(x//b))
print(max(li))
Problem p02713 (python)

Fixed submission:
k=int(input())
s=0
import math
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            s+=math.gcd(math.gcd(a,b),c)
print(s)

Buggy submission (verdict: Runtime Error):
import itertools
import math
k=int(input())
s=0
for a,b,c in itertools.combinations_with_replacement(range(1,n+1), 3):
    g=math.gcd(math.gcd(a,b),c)
    s+=g
print(s)
Problem p02718 (python)

Fixed submission:
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))[::-1]
print("Yes" if 4*m*a[m-1]>=sum(a) else "No")

Buggy submission (verdict: Runtime Error):
m,n=map(int,input().split())
a=sorted(list(map(int,input().split())))
s=0
for j in range(n):
  s+=a[j]
for i in range(n):
  if a[n-i] < s/(4*m):
    if i!=0:
      a=a[n-i+1:]
      break
    else:
      a=[]
      break
if len(a) >= m:
  print("Yes")
else:
  print("No")
Problem p02730 (python)

Fixed submission:
S=input()
N=len(S)
S1=S[:int((N-1)/2)]
S2=S[int((N+1)/2):]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
S1=S[:((N+1)/2)]
S2=S[((N+3)/2):]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
S1=S[:(N+1)/2]
S2=S[(N+3)/2:]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
  print("Yes")
else:
  print("No")
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
x=0
for i in range(2000):
  if x == 0 and int(i*0.08) == a and int(i*0.10) == b:
    print(i)
    x=1
  if x == 0 and i == 1299:
    print("-1")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
na=int(a*12.5)
nb=b*10
x=0
for i in range(8):
  nai=na+i
  for j in range(10):
    nbj=nb+j
    if nai == nbj:
      x=1
      y=nai
      break
  if x==1:
    print(y)
    break:
  if x==0 and i==7:
    print("-1")
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if t.startswith(s):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
ara = [input() for _ in range(n)]
pref = []
suff = []

for s in ara:
	pos = neg = 0
	for ch in s:
		if ch == '(':
			pos += 1
		elif pos == 0:
			neg += 1
		else:
			pos -= 1
	if pos >= neg:
		pref.append([pos, neg])
	else:
		suff.append([pos, neg])


pref.sort(key=lambda x: x[1])
suff.sort(key=lambda x: x[0], reverse=True)

totPos = 0

ara = pref + suff

for pos, neg in ara:
	if neg > totPos:
		print("No")
		exit(0)
	totPos -= neg
	totPos += pos


if totPos != 0:
	print("No")
else:
	print("Yes")
Problem p02609 (python)

Fixed submission:
N=int(input())
X=input()
Y=int(X,2)
Z=Y
C=X.count('1')
if C==1:
  for i in range(N):
    if X[i]=='1':
      print(0)
    elif i==N-1:
      print(2)
    else:
      print(1)
  exit()
Y,Z=Y%(C+1),Z%(C-1)

def f(x):
  if x==0:
    return 0
  return 1+f(x%bin(x).count('1'))

for i in range(N):
  if X[i]=='1':
    print(1+f((Z-pow(2,N-i-1,C-1))%(C-1)))
  else:
    print(1+f((Y+pow(2,N-i-1,C+1))%(C+1)))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(input(),2)
zuru = [0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 3, 1, 2, 1, 2, 1, 1, 2, 3, 1, 2, 2, 3, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 3, 1, 2, 1, 3, 2, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 1, 2, 1, 1, 2, 3, 1, 2, 2, 3, 2, 2, 2, 2, 1, 1, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, 3, 1, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 3, 3, 1, 2, 2, 3, 2, 3, 1, 2, 1]

_max = pow(2, n-1)
while 1:
  n = x ^ _max
  count = 0
  while n != 0:
    if 0 <= n <=1024:
      count += zuru[n]
      break
    n = n % bin(n).count("1")
    count += 1
  print(count)
  n = x ^ _max
  _max = _max // 2
  if _max == 0:
    break