qyliang/CodeNanoFix huggingface dataset:
Buggy code:
# -*- coding: <encoding name> -*-

s = input()
s_former = s[:(n - 1) / 2 + 1]
s_latter = s[(n + 3) / 2 + 1:]
print('Yes' if s == s[::-1] and s_former == s_former[::-1] and s_latter == s_latter[::-1] else 'No')


Fixed code:
# -*- coding: <encoding name> -*-

s = input()
s_former = s[:(len(s) - 1) // 2]
s_latter = s[(len(s) + 3) // 2 - 1:]
print('Yes' if s == s[::-1] and s_former == s_former[::-1] and s_latter == s_latter[::-1] else 'No')
Buggy code:
X=input()
L=X[::-1]
if L==X:
    N=len(X)
    if N % 2== 1:
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya:
            if LYb == Yb:
                print("Yes")
else:
    print("No")

Fixed code:
X=input()
L=X[::-1]
N=len(X)
if N % 2 == 1:
    if L==X:
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya and LYb == Yb:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
Buggy code:
S = input()
S2 = S[:(len(S)-1)//2]
S3 = S[(len(S)+3)//2-1:]
print(S2, S3)
print("Yes" if S == S[::-1] and S2 == S2[::-1] and S3 == S3[::-1] else "No")

Fixed code:
S = input()
S2 = S[:(len(S)-1)//2]
S3 = S[(len(S)+3)//2-1:]
print("Yes" if S == S[::-1] and S2 == S2[::-1] and S3 == S3[::-1] else "No")
Buggy code:
S=input()
N=len(S)
ans='Yes'
if N=3:
    if S[0]!=S[2]:
        ans='No'
else:
    if int((N-1)/2)%2==1:
        for i in range((N-3)//4):
            if S[i] != S[(N-3)//2-i] or S[(N+1)//2+i] != S[N-i-1]:
                ans='No'
    else:
        for i in range((N-1)//4):
            if S[i]!=S[(N-3)//2-i] or S[(N-1//2)+i]!=S[N-i-1]:
                ans='No'

print(ans)

Fixed code:
S=input()
N=len(S)
ans='Yes'

for i in range((N-1)//2):
    if S[i] != S[N-i-1]:
        ans='No'

if int((N-1)/2)%2==1:
    for i in range((N-3)//4):
        if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
            ans='No'
else:
    for i in range((N-1)//4):
        if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
            ans='No'
 
print(ans)
Buggy code:
n = input()
m = len(n)
if n == n[::-1]:
  k = n[0:(m-1)//2]
  l = n[(m+3)//2-1:m]
  print(k,l)
  if k == k[::-1]:
    if l == l[::-1]:
      print('Yes')
      exit()
print('No')


Fixed code:
n = input()
m = len(n)
if n == n[::-1]:
  k = n[0:(m-1)//2]
  l = n[(m+3)//2-1:m]
  if k == k[::-1]:
    if l == l[::-1]:
      print('Yes')
      exit()
print('No')
Buggy code:
s = input()


def reverse(text):
    return text == ''.join(list(reversed(text)))


N = len(s)

if reverse(s) and reverse(s[:(N-1)/2]) and reverse(s[(N+3)/2 - 1:]):
    print('Yes')
else:
    print('No')

Fixed code:
s = input()


def reverse(text):
    return text == ''.join(list(reversed(text)))


N = len(s)

if reverse(s) and reverse(s[:int((N-1)/2)]) and reverse(s[int((N+3)/2) - 1:]):
    print('Yes')
else:
    print('No')
Buggy code:
s = input().split()
n = len(s)
hn = n//2
flag = True

for i in range(hn):
    if (not s[i] == s[n-i]) or (not s[i] == s[hn-i]):
        flag = False
        print("No")
        break

print("Yes")


Fixed code:
s = input()
n = len(s)
hn = n//2
flag = True

for i in range(hn):
    if (not s[i] == s[n-i-1]) or (not s[i] == s[hn-i-1]):
        flag = False
        print("No")
        break

if flag:
    print("Yes")
Buggy code:
S = input()
l = len(S)
import sys
a = S[:((l-1)//2)]


for i in range(len(a)//2):

    if str(a[i])==str(a[-i]):
        pass
    else:
        print('No')
        sys.exit(0)

b = S[l+3//2:l]

for j in range(len(b)//2):
    if b[j]==b[-j]:
        pass
    else:
        print('No')
        sys.exit(0)

for k in range((l//2)):
    if S[k] == S[-k]:
        pass
    else:
        print('No')
        sys.exit(0)

print('Yes')

Fixed code:
S = input()
l = len(S)
import sys
a = S[:(l-1)//2]
b = S[((l+3)//2)-1:l]

for i in range(len(a)//2):
    if str(a[i])==str(a[-i-1]):
        pass
    else:
        print('No')
        sys.exit(0)


for j in range(len(b)//2):

    if b[j]==b[-j-1]:
        pass
    else:
        print('No')
        sys.exit(0)


for k in range(l//2):
    if S[k] == S[-k-1]:
        pass
    else:
        print('No')
        sys.exit(0)

print('Yes')
Buggy code:
s = input()
l=int((len(s)-1)/2)
s1 = s[:l]
s2 = s[l+1:]
print(s1, s2)
if(s==s[::-1] and s1==s1[::-1] and s2==s2[::-1]):
    print('Yes')
else:
    print('No')

Fixed code:
s = input()
l=int((len(s)-1)/2)
s1 = s[:l]
s2 = s[l+1:]
if(s==s[::-1] and s1==s1[::-1] and s2==s2[::-1]):
    print('Yes')
else:
    print('No')
Buggy code:
S = input()
N = len(S)
left = S[:(N - 1) // 2 + 1]
right = S[((N + 3) // 2) - 1:]

if left == left[::-1] and right == right[::-1]:
    print('Yes')
else:
    print('No')


Fixed code:
S = input()
N = len(S)
left = S[:(N - 1) // 2]
right = S[((N + 3) // 2) - 1:]

if left == left[::-1] and right == right[::-1] and S == S[::-1]:
    print('Yes')
else:
    print('No')
Buggy code:
S=input()
N=len(S)
F=S[0:(N-1)//2]
B=S[(N+3)//2-1:N]
print(F,B)
if(F==B):
    l=len(F)
    for i in range(l//2):
        if(F[i]!=F[l-1-i]):
            print("No")
            break
    print("Yes")
else:
    print("No")

Fixed code:
S=input()
N=len(S)
F=S[0:(N-1)//2]
B=S[(N+3)//2-1:N]

if(F==B):
    l=len(F)
    for i in range(l//2):
        if(F[i]!=F[l-1-i]):
            print("No")
            break
    print("Yes")
else:
    print("No")
Buggy code:
S = input()
N = len(S)
print(S[:int((N-1)/2)],S[int((N-1)/2)-1::-1] ,S[int((N+3)/2)-1:],S[:int((N+3)/2)-2:-1])
if S[:int((N-1)/2)]==S[int((N-1)/2)-1::-1] and S[int((N+3)/2)-1:]==S[:int((N+3)/2)-2:-1] and S==S[::-1]:
    print('Yes')
else:
    print('No')

Fixed code:
S = input()
N = len(S)
if S[:int((N-1)/2)]==S[int((N-1)/2)-1::-1] and S[int((N+3)/2)-1:]==S[:int((N+3)/2)-2:-1] and S==S[::-1]:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()

s_norm = list(s)
s_rev = reversed(s)
if s_norm == s_rev:
    s_len = len(s)
    second = (s_len -1)/2
    s_new = s_norm[0:second]
    s_new_rev = reversed(s_new)
    if s_new == s_new_rev:
        third = (s_len +3)/2
        s_last = s_norm[third:s_len+1]
        s_last_rev = reversed(s_new)
        if s_last == s_last_rev:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")



Fixed code:
s = input()

s_norm = list(s)
s_rev = list(reversed(s))
if s_norm == s_rev:
    s_len = len(s)
    second = round((s_len -1)/2)
    s_new = s_norm[0:second]
    s_new_rev = list(reversed(s_new))
    if s_new == s_new_rev:
        third = round((s_len +3)/2)
        s_last = s_norm[third-1:s_len+1]
        s_last_rev = list(reversed(s_new))
        if s_last == s_last_rev:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
Buggy code:
s= input()
z=len(s)//2
flag=0
sd=s[0:z-1]
if sd==s[z+1:len(s)-1]:
    if sd==sd[::-1]:
        flag=1
if flag==1:
    print("Yes")
else:
    print("No")

Fixed code:
s= input()
z=len(s)//2
flag=0
sd=s[0:z]
if len(s)==3:
    if s[0]==s[2]:
        flag=1
else:
    if sd==s[z+1:len(s)]:
        if sd==sd[::-1]:
            flag=1
if flag==1:
    print("Yes")
else:
    print("No")
Buggy code:
s = input()
l = len(s)
sl = s[:(l-1)//2]
sr = s[((l+3)//2 -1):]
#print(sl)
#print(len(sl)//2)
#print(sr)
#print(len(sr)//2)

def f(s):
    l = len(s)
    j = False
    for i in range(l//2 +1):
        if s[i] == s[l-1-i]:
            j = True
        else :
            j = False

    return j

if f(s) and f(sl) and f(sr):
    print("Yes")
else :
    print("No")



#print(f(s))
#print(f(sl))
#print(f(sr))

Fixed code:
s = input()
l = len(s)
sl = s[:(l-1)//2]
sr = s[((l+3)//2 -1):]
#print(sl)
#print(len(sl)//2)
#print(sr)
#print(len(sr)//2)

def f(s):
    l = len(s)
    j = False
    for i in range(l//2 +1):
        if s[i] == s[l-1-i]:
            j = True
        else :
            j = False
            break

    return j

if f(s) and f(sl) and f(sr):
    print("Yes")
else :
    print("No")



#print(f(s))
#print(f(sl))
#print(f(sr))
Buggy code:
import sys
s =input()
n = len(s)
hn = int((n+1)/2)
qn = int((n+1)/4)
for i in range(qn):
  if s[i] == s[n-hn-i-1] and s[-i-1] == s[i+hn-n]:
    pass
  else:
    print(i)
    print(s[-i])
    print(s[i-hn])
    print(s[i])
    print(s[n-hn-i-1])
    print("No")
    sys.exit()
print("Yes")

Fixed code:
import sys
s =input()
n = len(s)
hn = int((n-1)/2)
qn = int((n+1)/4)
for i in range(qn):
  if s[i] == s[hn-i-1] and s[-i-1] == s[i-hn] and s[i] == s[-i-1]:
    pass
  else:
    print("No")
    sys.exit()
print("Yes")
Buggy code:
import math
a= input()
length=math.floor(len(a)/2)
def kaibun(p):
    length_p=math.floor(len(p)/2)
    total_p = 0
    for i in range(length_p):
        if p[i] is not p[-1*i -1]:
            return False
            break
        else:
            total_p += 1
        if total_p == length_p:
            return True
if kaibun(a):
    if kaibun(a[:length+1]):
        print('Yes')
    elif length==1:
        print('Yes')
    else:
        print('No')
else:
    print('No')



Fixed code:
import math
a= input()
length=math.floor(len(a)/2)
def kaibun(p):
    length_p=math.floor(len(p)/2)
    total_p = 0
    for i in range(length_p):
        if p[i] is not p[-1*i -1]:
            return False
            break
        else:
            total_p += 1
        if total_p == length_p:
            return True
if kaibun(a):
    if kaibun(a[:length]):
        print('Yes')
    elif length==1:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy code:
import sys

S = input()


def is_palindrome(s):
    N = len(s)
    half = N // 2
    f = s[:half]
    r = s[-half:][::-1]
    print(s, f, r)
    return f == r


if is_palindrome(S) and is_palindrome(S[: len(S) // 2]):
    print("Yes")
else:
    print("No")


Fixed code:
import sys

S = input()


def is_palindrome(s):
    N = len(s)
    if N == 1:
        return True

    half = N // 2
    f = s[:half]
    r = s[-half:][::-1]
    return f == r


if is_palindrome(S) and is_palindrome(S[: len(S) // 2]):
    print("Yes")
else:
    print("No")
Buggy code:
S = input()

def is_kaibun(s):
    for i in range(len(s) // 2):
        if s[i] != s[-i-1]:
            print('No')

N = len(S)
is_kaibun(S)
is_kaibun(S[:(N-1)//2])
is_kaibun(S[(N+3)//2-1:])
print('Yes')


Fixed code:
S = input()

def is_kaibun(s):
    for i in range(len(s) // 2):
        if s[i] != s[-i-1]:
            print('No')
            exit()

N = len(S)
is_kaibun(S)
is_kaibun(S[:(N-1)//2])
is_kaibun(S[(N+3)//2-1:])
print('Yes')
Buggy code:

def ispalindrome(s):
    h = len(s)
    if (h % 2) == 0:
        h = int(h/2)
        for a, b in zip(s[:h], reversed(s[h+1:])):
            if a != b: return 0
    else:
        h = int(h/2)
        for a, b in zip(s[:h-1], reversed(s[h+1:])):
            if a != b: return 0
    return 1

str_in = input()
N = len(str_in)
result = ispalindrome(str_in)

if result == 0:
    print('No')
else:
    str_half = str_in[:int((N-1)/2)]
    result &= ispalindrome(str_half)

    if result == 0:
      print('No')
    else:
        str_half = str_in[int((N+3)/2):]
        result &= ispalindrome(str_half)

        if result == 0:
            print('No')
        else:
            print('Yes')


Fixed code:

def ispalindrome(s):
    h = len(s)
    if (h % 2) == 0:
        h = int(h/2)
        for a, b in zip(s[:h], reversed(s[h:])):
            if a != b: return 0
    else:
        h = int(h/2)
        for a, b in zip(s[:h], reversed(s[h+1:])):
            if a != b: return 0
    return 1

str_in = input()
N = len(str_in)
result = ispalindrome(str_in)

if result == 0:
    print('No')
else:
    if N == 3:
        print('Yes')
    else:
        str_half = str_in[:int((N-1)/2)]
        result &= ispalindrome(str_half)

        if result == 0:
            print('No')
        else:
            str_half = str_in[int(((N+3)/2)-1):]
            result &= ispalindrome(str_half)

            if result == 0:
                print('No')
            else:
                print('Yes')
Buggy code:
s = input()
n = len(s)
ans = "Yes"
if s != s[::-1]:
    ans = "no"
else:
    if s[:(n//2):-1] != s[:(n//2)]:
        ans = "no"
    if s[n//2 + 1::] != s[:(n//2):-1]:
        ans = "no"

print(ans)

Fixed code:
s = input()
n = len(s)
ans = "Yes"
if s != s[::-1]:
    ans = "No"
else:
    if s[:(n//2):-1] != s[:(n//2)]:
        ans = "No"
    if s[n//2 + 1::] != s[:(n//2):-1]:
        ans = "No"

print(ans)
Buggy code:
S=input()
N=len(S)

flag=True
for i in range(N//2):
    if S[i]!=S[N-i-1]:
        flag=False
if flag==True:
    print("Yes")
else:
    print("No")

Fixed code:
S=input()
N=len(S)

flag=True
for i in range(N//2):
    if S[i]!=S[N-i-1]:
        flag=False
for j in range(N//2//2):
    if S[N-N//2+j]!=S[N-j-1]:
        flag=False             
        
if flag==True:
    print("Yes")
else:
    print("No")
Buggy code:
S = list(input())

import sys
import math
flag1 = 0
flag2 = 0
flag3 = 0

if S == S[::-1]:
    flag1 = 1
    print(1)
else:
    print('No')
    sys.exit()

S1 = S[:(int((len(S) - 1)/2))]
if S1 == S1[::-1]:
    flag2 = 1
    print(2)
else:
    print('No')
    sys.exit()

S2 = S[int((len(S)+3)/2) - 1:]
if S2 == S2[::-1]:
    flag3 = 1
    print(3)
else:
    print('No')
    sys.exit()

if flag1 == 1 and flag2 == 1 and flag3 == 1:
    print('Yes')


Fixed code:
S = list(input())

import sys
import math
flag1 = 0
flag2 = 0
flag3 = 0

if S == S[::-1]:
    flag1 = 1
else:
    print('No')
    sys.exit()

S1 = S[:(int((len(S) - 1)/2))]
if S1 == S1[::-1]:
    flag2 = 1
else:
    print('No')
    sys.exit()

S2 = S[int((len(S)+3)/2) - 1:]
if S2 == S2[::-1]:
    flag3 = 1
else:
    print('No')
    sys.exit()

if flag1 == 1 and flag2 == 1 and flag3 == 1:
    print('Yes')
Buggy code:
S = input()
L = list(S)
N = len(L)

revS = list(reversed(L))

preS = L[:int((N - 1) / 2)]
revPreS = list(reversed(preS))

backS = L[int((N + 3) / 2):]
revBackS = list(reversed(backS))

if L != revS:
    print("No")
elif preS != revPreS:
    print("No")
elif backS != revBackS:
    print("No")
else:
    print("Yes")


Fixed code:
S = input()
L = list(S)
N = len(L)

revS = list(reversed(L))

preS = L[:int((N - 1) / 2)]
revPreS = list(reversed(preS))

backS = L[int((N + 2) / 2):]
revBackS = list(reversed(backS))

if L != revS:
    print("No")
elif preS != revPreS:
    print("No")
elif backS != revBackS:
    print("No")
else:
    print("Yes")
Buggy code:
S = input().rstrip()
N = len(S)
for i in range((N - 1) // 2):
    if S[i] != S[N-1-i]:
        print("No")
        exit(0)
s = S[:(N-1) // 2]
n = len(s)
for i in range((n - 1) // 2):
    if s[i] != s[n-1-i]:
        print("No")
        exit(0)
print("Yes")


Fixed code:
S = input().rstrip()
N = len(S)
for i in range((N - 1) // 2):
    if S[i] != S[N-1-i]:
        print("No")
        exit(0)
s = S[:(N-1) // 2]
n = len(s)
if n == 2 and s[0] != s[1]:
    print("No")
    exit(0)

for i in range((n - 1) // 2):
    if s[i] != s[n-1-i]:
        print("No")
        exit(0)
print("Yes")
Buggy code:
s=input().strip();	n=len(S)
print("Yes" if s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1] and s[(n+3)//2-1:]==s[(n+3)//2-1:][::-1] else "No")

Fixed code:
s=input().strip();	n=len(s)
print("Yes" if s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1] and s[(n+3)//2-1:]==s[(n+3)//2-1:][::-1] else "No")
Buggy code:
s = input()
n = len(s)
top = s[:n//2]
under = s[n//2+1:n]

if s == s[::-1]:
  if top == top[::-1]:
    if under == under[::-1]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Fixed code:
s = input()
n = len(s)
top = s[:(n-1)//2]
under = s[(n+1)//2:]

if s==s[::-1] and top==top[::-1] and under==under[::-1]:
  print("Yes")
else:
  print("No")
Buggy code:
kaibunkai = input()
n = len(kaibunkai)
zenhan = kaibunkai[:(n-1)//2]
kouhan = kaibunkai[(n+3)//2-1:]
print(zenhan,kouhan)


def kaibun_desuka(bun):
  s = len(bun)
  for x in range(s//2):
    if bun[x] != bun[-x-1]:
      return False
  return True

if kaibun_desuka(kaibunkai) and kaibun_desuka(zenhan) and kaibun_desuka(kouhan):
  print("Yes")

  
else:
  print("No")
    
  

Fixed code:
kaibunkai = input()
n = len(kaibunkai)
zenhan = kaibunkai[:(n-1)//2]
kouhan = kaibunkai[(n+3)//2-1:]


def kaibun_desuka(bun):
  s = len(bun)
  for x in range(s//2):
    if bun[x] != bun[-x-1]:
      return False
  return True

if kaibun_desuka(kaibunkai) and kaibun_desuka(zenhan) and kaibun_desuka(kouhan):
  print("Yes")

  
else:
  print("No")
Buggy code:
S = input()
N = (len(S)-1)//2
M = (len(S)+3)//2
count = 0

if S[::-1] == S:
  if S[:N] == S[::-N]:
    if S[:M] == S[::-M]:
      count += 1
print("Yes" if count == 1 else "No")

Fixed code:
S = input()
N = (len(S)-1)//2
M = (len(S)+3)//2
count = 0

if S[::-1] == S:
  if S[:N] == S[:N][::-1]:
    if S[(M-1):] == S[(M-1):][::-1]:
      count += 1
print("Yes" if count == 1 else "No")
Buggy code:
S=list(input())
N=len(S)
kaibun=0
for i in range((N-1)//2):
    if S[i]==S[(N-1)//2-i-1]and S[(N+1)//2+i]==S[N-i-1]: 
        kaibun=kaibun+1
    else:
        kaibun=0
        break
for i in range (N):
    if S[i]==S[N-i-1]:
        kaibun=kaibun+1
    else:
        kaibun=0

if kaibun==0:
        print("No")
else:
        print("Yes")     



Fixed code:
S=list(input())
N=len(S)
tsuyoikaibun=0
kaibun=0
for i in range((N-1)//2):
    if S[i]==S[(N-1)//2-i-1]and S[(N+1)//2+i]==S[N-i-1]: 
        tsuyoikaibun=tsuyoikaibun+1
    else:
        tsuyoikaibun=0
        break
for i in range (N):
    if S[i]==S[N-i-1]:
        kaibun=kaibun+1
    else:
        kaibun=0
        break

if kaibun==0 or tsuyoikaibun==0:
        print("No")
else:
        print("Yes")
Buggy code:
S = input()
l = len(S)
i = 0
while i < (l-1)/2:
    if S[i] != S[-i-1]:
        print('No')
        break
    i = i + 1
else:
    print('Yes')
    

Fixed code:
S = input()
l = len(S)
i = 0

while i < (l-1)/2:
    if S[i] != S[-i-1] or S[i] != S[int((l-1)/2)-i-1]:
        print('No')
        break
    i = i + 1
else:
    print('Yes')
Buggy code:
s = input()

n = len(s)

s1 = s[:n//2]
s2 = s[(n//2)+1:]
if s == s[::-1]:
  if s1 == s2 and s2 ==  s2[::-1]:
    print('Yes')
  else:
    print('No')

Fixed code:
s = input()
n = len(s)

s1 = s[:(n-1)//2]
s2 = s[(n+3)//2-1:]

if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
  print("Yes")
else:
  print("No")
Buggy code:
def is_palindrome(s):
    i = 0
    n = len(s)-1
    while s[i] == s[n]:
        i += 1
        n -= 1
        if i >= n:
            break
    else:
        return False
    return True

s = input()
n = len(s)

if is_palindrome(s) and is_palindrome(s[0:(n-1)//2-1]) and is_palindrome(s[(n+3)//2-1:]):
    print("Yes")
else:
    print("No")


Fixed code:
def is_palindrome(s):
    if len(s) > 1:
        i = 0
        n = len(s)-1
        while s[i] == s[n]:
            i += 1
            n -= 1
            if i >= n:
                break
        else:
            return False
        return True
    else:
        return True

s = input()
n = len(s)

if is_palindrome(s) and is_palindrome(s[0:(n-1)//2]) and is_palindrome(s[(n+3)//2-1:]):
    print("Yes")
else:
    print("No")
Buggy code:
def ispalindrome(S,N):
    for a, b in zip(S[:N], reversed(S[N+1:])):
        if a != b: return 0
    return 1

def ispalindrome2(S,N):
    for a, b in zip(S[N2:N], reversed(S[N+1:N2])):
        if a != b: return 0
    return 1

S = input()
N = len(S)
N1 = (N-1)//2
N2 = (N+3)//2

r1 = ispalindrome(S,N)
r2 = ispalindrome(S,N1)
r3 = ispalindrome2(S,N2)
if r1==1 and r2==1 and r3==1:
    print('Yes')
else:
    print('No')

Fixed code:
def ispalindrome(S,N):
    for a, b in zip(S[:N], reversed(S[:N])):
        if a != b: return 0
    return 1

def ispalindrome2(S,N):
    for a, b in zip(S[N2-1:N], reversed(S[N2-1:N])):
        if a != b: return 0
    return 1

S = input()
N = len(S)
N1 = (N-1)//2
N2 = (N+3)//2

r1 = ispalindrome(S,N)
r2 = ispalindrome(S,N1)
r3 = ispalindrome2(S,N2)
if r1==1 and r2==1 and r3==1:
    print('Yes')
else:
    print('No')
Buggy code:

S = input()
N = len(S)



a = S[0:(N-1)//2-1]
b = S[0:(N-1)//2-1:-1]

c = S[(N+3)//2-1:N-1]
d = S[(N+3)//2-1:N-1:-1]

e = S[:N-1]
f = S[:N-1:-1]

if a == b and c ==d and e == f:
  print('Yes')
  
else:
  print('No')

Fixed code:
S = input()
N = len(S)



a = S[0:(N-1)//2]
b = a[::-1]

c = S[(N+3)//2-1::]
d = c[::-1]

e = S
f = S[::-1]

if a == b and c ==d and e == f:
  print('Yes')
  
else:
  print('No')
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 11:55:12 2020

@author: 17664
"""
kaibun = input()
joken1 = kaibun[:(len(kaibun)-1)//2]
# print(joken1)
joken2 = kaibun[(len(kaibun)+2)//2:]
# print(joken2)

ans = 'no'

if kaibun == kaibun[::-1] and joken1 == joken1[::-1] and joken2 == joken2[::-1]:
    ans = 'yes'
    
print(ans)

Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 11:55:12 2020

@author: 17664
"""
kaibun = input()
joken1 = kaibun[:(len(kaibun)-1)//2]
# print(joken1)
joken2 = kaibun[(len(kaibun)+2)//2:]
# print(joken2)

ans = 'No'

if kaibun == kaibun[::-1] and joken1 == joken1[::-1] and joken2 == joken2[::-1]:
    ans = 'Yes'
    
print(ans)
Buggy code:
# coding: utf-8
S = input()
N = len(S)
if S == S[::-1]:
  if S[:(N-1)//2] == S[:(N-1)//2][::-1]:
    if S[(N+3)//2:] == S[(N+3)//2:][::-1]:
      print('Yes')
else:
  print('No')

Fixed code:
# coding: utf-8
S = input()
N = len(S)
n1 = (N-1)//2 -1
n2 = (N+3)//2 - 1
if S == S[::-1]:
  if S[:n1+1] == S[:n1+1][::-1]:
    if S[n2:] == S[n2:][::-1]:
      print('Yes')
    else:
      print('No')
  else:
    print('No')     
else:
  print('No')
Buggy code:
s = input()
n = len(s)

s_list = list(s)
r_list = list(s)
r_list.reverse()

first_s_list = s_list[0:(n - 1) // 2]
first_r_list = reversed(first_s_list)

last_s_list = s_list[(n + 3) // 2:n]
last_r_list = reversed(last_s_list)

if s_list == r_list and first_s_list == first_r_list and last_s_list == last_r_list:
    print('Yes')
else:
    print('No')

Fixed code:
s = input()
n = len(s)

s_list = list(s)
r_list = list(s)
r_list.reverse()

first_s_list = s_list[0:(n - 1) // 2]
first_r_list = list(reversed(first_s_list))

last_s_list = s_list[(n - 1) // 2 + 1:n]
last_r_list = list(reversed(last_s_list))

if s_list == r_list and first_s_list == first_r_list and last_s_list == last_r_list:
    print('Yes')
else:
    print('No')
Buggy code:
S=input()
T=S[:(len(S)-1)//2-1]
U=S[(len(S)+3)//2-1:]
if S==S[::-1]:
    if T==T[::-1]:
        if U==U[::-1]:
            print('Yes')
        else:print('No')
    else:print('No')
else:print('No')

Fixed code:
S=input()
T=S[:(len(S)-1)//2]
U=S[(len(S)+3)//2-1:]
if S==S[::-1]:
    if T==T[::-1]:
        if U==U[::-1]:
            print('Yes')
        else:print('No')
    else:print('No')
else:print('No')
Buggy code:
a = input()
def p(s,n):
    for i in range(n//2):
        if s[i] != s[-(i+1)]:
            return 0
    return 1
r = len(a)
print(a[(r+3)//2-1:],r-(r+3)//2+1)
if p(a,r) == 1 and p(a[:((r-1)//2)],(r-1)//2) == 1 and p(a[(r+3)//2-1:],r-(r+3)//2+1)== 1:
    print("Yes")
else:
    print("No")
    


Fixed code:
a = input()
def p(s,n):
    for i in range(n//2):
        if s[i] != s[-(i+1)]:
            return 0
    return 1
r = len(a)
if p(a,r) == 1 and p(a[:((r-1)//2)],(r-1)//2) == 1 and p(a[(r+3)//2-1:],r-(r+3)//2+1)== 1:
    print("Yes")
else:
    print("No")
Buggy code:
s=input()

n=len(s)

a=s[::-1]
print(a)

mae=(a[0:int((n-1)/2)])
print(mae)

maer=(mae[::-1])
print(maer)

ato=(a[int((n+2)/2):])
print(ato)

ator=(ato[::-1])
print(ator)

if a==s :
    if mae==maer and ato==ator:
        print("Yes")
    else :
        print("No")
        

else :
    print('No')

Fixed code:
s=input()

n=len(s)

a=s[::-1]

mae=(a[0:int((n-1)/2)])

maer=(mae[::-1])

ato=(a[int((n+2)/2):])

ator=(ato[::-1])

if a==s :
    if mae==maer and ato==ator:
        print("Yes")
    else :
        print("No")
        

else :
    print('No')