qyliang/CodeNanoFix huggingface dataset:
Buggy code:
sel='B'
#A
if sel=='A':
    N,M=map(int,input().split())
    ans=0
    ans+=M*(M-1)//2
    ans+=N*(N-1)//2
    print(ans)

#B
if sel=='B':
    def ispal(s):
        for i in range(len(s)//2+1):
            if s[i]!=s[-(i+1)]:
                return False
        return True

    S=input()
    if ispal(S) and ispal(S[:(N-1)//2]) and ispal(S[(N+3)//2-1:]):
        print('Yes')
    else:
        print('No')

#C
if sel=='C':
    L=int(input())
    print((L**3)/27)

#D
if sel=='D':    
    N=int(input())
    A=[int(i) for i in input().split()]
    kin=list(set(A))
    cnt={}
    for k in kin:
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    SUM=0
    for k in kin:
        SUM+=cnt[k]*(cnt[k]-1)//2
    for a in A:
        if cnt[a]>=2:
            print(SUM-cnt[a]+1)
        else:
            print(SUM)
        
#E
if sel=='E':
    a=0

#F
if sel=='F':
    N,S=map(int,input().split())
    A=[int(i) for i in input().split()]

    for l in range(N):
        for r in range(l,N):
            print(tab[l][r])



Fixed code:
sel='B'
#A
if sel=='A':
    N,M=map(int,input().split())
    ans=0
    ans+=M*(M-1)//2
    ans+=N*(N-1)//2
    print(ans)

#B
if sel=='B':
    def ispal(s):
        for i in range(len(s)//2+1):
            if s[i]!=s[-(i+1)]:
                return False
        return True

    S=input()
    N=len(S)
    if ispal(S) and ispal(S[:(N-1)//2]) and ispal(S[(N+3)//2-1:]):
        print('Yes')
    else:
        print('No')

#C
if sel=='C':
    L=int(input())
    print((L**3)/27)

#D
if sel=='D':    
    N=int(input())
    A=[int(i) for i in input().split()]
    kin=list(set(A))
    cnt={}
    for k in kin:
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    SUM=0
    for k in kin:
        SUM+=cnt[k]*(cnt[k]-1)//2
    for a in A:
        if cnt[a]>=2:
            print(SUM-cnt[a]+1)
        else:
            print(SUM)
        
#E
if sel=='E':
    a=0

#F
if sel=='F':
    N,S=map(int,input().split())
    A=[int(i) for i in input().split()]

    for l in range(N):
        for r in range(l,N):
            print(tab[l][r])
Buggy code:
import sys
input = sys.stdin.readline
S = input()
Sr=''.join(list(reversed(S)))
N=len(S)
S1=S[:int((N-1)/2)]
S1r=''.join(list(reversed(S1)))
S2=S[int((N+3)/2)-1:]
S2r=''.join(list(reversed(S2)))
if S==Sr and S1 ==S1r and S2==S2r:
    print('Yes')
else:
    print('No')

Fixed code:
import sys
input = sys.stdin.readline
S = input().strip()
Sr=''.join(list(reversed(S)))
N=len(S)
S1=S[:int((N-1)/2)]
S1r=''.join(list(reversed(S1)))
S2=S[int((N+3)/2)-1:]
S2r=''.join(list(reversed(S2)))
if S==Sr and S1 ==S1r and S2==S2r:
    print('Yes')
else:
    print('No')
Buggy code:
import numpy as np

S = np.array([i for i in input()])
S_rev = S[::-1]
N = len(S)

ans = 'No'

if all(S == S_rev):
  temp_S = S[:(N-1)//2+1]
  temp_S_rev = temp_S[::-1]
  
  if all(temp_S == temp_S_rev):
    temp_S = S[(N+3)//2:]
    temp_S_rev = temp_S[::-1]
    
    if all(temp_S == temp_S_rev):
      ans = 'Yes'
print(ans)

Fixed code:
import numpy as np

S = np.array([i for i in input()])
S_rev = S[::-1]
N = len(S)

ans = 'No'

if all(S == S_rev):
  temp_S = S[:(N-1)//2]
  temp_S_rev = temp_S[::-1]
  
  if all(temp_S == temp_S_rev):
    temp_S = S[(N+3)//2-1:]
    temp_S_rev = temp_S[::-1]
    
    if all(temp_S == temp_S_rev):
      ans = 'Yes'
print(ans)
Buggy code:
s = int(input())
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n +2)//2:n]
if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print('Yes')
else:
    print('No')

Fixed code:
s = str(input())
n = len(s)
s1 = s[0:n//2]
s2 = s[(n+2)//2:n]
if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print('Yes')
else:
    print('No')
Buggy code:
s = input()
print("Yes" if s == s[::-1] and s[:len(s)//2] == s[:len(s)//2:-1] else "No")

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


Fixed code:
S = list(input())
N = len(S)
s1 = S[:int((N-1)/2):]
s2 = S[int(((N+3)/2)-1):int(N):]
if S == S[::-1] :
    if s1 == s1[::-1] and s2 == s2[::-1] :
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy code:
s=input()
n=len(s)
ans="No"
if s==s[::-1]:
    if s[:(n-1)//2]==s[:((n-1)//2):-1]:
        if s[((n+3)//2)-1:n]==s[((n+3)//2)-1:n:-1]:
            ans="Yes"
print(ans)

Fixed code:
s=input()
n=len(s)
a=s[((n+3)//2)-1:n]
ans="No"
if s==s[::-1]:
    if s[:(n-1)//2]==s[:((n-1)//2):-1]:
        if a==a[::-1]:
            ans="Yes"
print(ans)
Buggy code:
S = input()

S_list = list(S)
N = len(S_list)
no_flag = 0

for i in range(N//2):
    if S_list[i] != S_list[N-i-1]:
        no_flag = 1

for i in range(int((N-1)/2)//2 -1):
    if S_list[i] != S_list[(N-1)/2-i-1]:
        no_flag = 1

for i in range((N-3)//2-1):
    if S_list[(N+3)//2+i-1] != S_list[N-1-i]:
        no_flag = 1

if no_flag == 1:
    print("No")
else:
    print("Yes")


Fixed code:
S = input()

S_list = list(S)
N = len(S_list)
#print(N)
no_flag = 0

for i in range(N//2):
    if S_list[i] != S_list[N-i-1]:
        no_flag = 1

for i in range(int((N-1)/2)//2):
    #print(S_list[i], S_list[(N-1)//2-i-1])
    if S_list[i] != S_list[(N-1)//2-i-1]:
        no_flag = 1

for i in range((N-3)//2):
    #print(S_list[(N+3)//2+i-1], S_list[N-1-i])
    if S_list[(N+3)//2+i-1] != S_list[N-1-i]:
        no_flag = 1

if no_flag == 1:
    print("No")
else:
    print("Yes")
Buggy code:
s = input()
n = len(s)
print(s, n)
i = int(((n-1)/2)-1)
j = int(((n+3)/2)-1)
#print(i, j)
l = s[:i+1]
l2 = l[::-1]
r = s[j:]
r2 = r[::-1]
#print(l, l2, r, r2)
if l == l2 and r == r2 and l == r:
  print('Yes')
else:
  print('No')

Fixed code:
s = input()
S = s[::-1]
n = len(s)
#print(s, n)
i = int(((n-1)/2)-1)
j = int(((n+3)/2)-1)
#print(i, j)
l = s[:i+1]
l2 = l[::-1]
r = s[j:]
r2 = r[::-1]
#print(l, l2, r, r2)
if l == l2 and r == r2 and s == S:
  print('Yes')
else:
  print('No')
Buggy code:
s= input()

s_r = s[::-1]
N = len(s)
s_2 = s[:int((N-1)/2)]
s_3 = s[int((N+1)/2):]
print(s_r, s_2, s_3)
if ( (s == s_r) & (s_2 ==s_2[::-1]) &(s_3 ==s_3[::-1])):
  print('Yes')
else :
  print('No')
  

Fixed code:
s= input()

s_r = s[::-1]
N = len(s)
s_2 = s[:int((N-1)/2)]
s_3 = s[int((N+1)/2):]
#print(s_r, s_2, s_3)
if ( (s == s_r) & (s_2 ==s_2[::-1]) &(s_3 ==s_3[::-1])):
  print('Yes')
else :
  print('No')
Buggy code:
s = list(input())
d = int((len(s)-1) / 2)
e = int((len(s)+3) / 2)
if s == s[::-1] and s[0:d-1] == s[0:d-1:-1] and s[e-1:] == s[e-1::-1]:
  print('Yes')
else:
  print('No')

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

for i in range((N-1)//2):
    if((N-1)//4>i ):
        a.append(S[i])
    elif((N-1)//4!=i):
        b.append(S[i])
if(a==b):
    if(S==S[::-1]):
    
        print('Yes')
    else:
        print('No')

    for i in range((N+3)//2-1,N):
        if(((N+3)//2-1+N)//2>i ):
            c.append(S[i])
        elif(((N+3)//2-1+N)//2!=i):
            d.append(S[i])
    if(c==d):
        if(S==S[::-1]):

            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Fixed code:
S=input()
N=len(S)
a=[]
b=[]
c=[]
d=[]

for i in range((N-1)//2):
    if((N-1)//2%2==1):
        if((N-1)//4>i ):
            a.append(S[i])

        elif((N-1)//4!=i):
            b.append(S[i])
    else:
        if((N-1)//4>i ):
            a.append(S[i])

        elif((N-1)//4==i):
            b.append(S[i])

        elif((N-1)//4!=i):
            b.append(S[i])

if(a==b[::-1]):
    if(S==S[::-1]):

        print('Yes')
    else:
        print('No')
    exit(0)

    for i in range((N+3)//2-1,N):
        if(((N+3)//2-1+N)//2>i ):
            c.append(S[i])
        elif(((N+3)//2-1+N)//2!=i):
            d.append(S[i])
    if(c==d):
        if(S==S[::-1]):

            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')
Buggy code:
# Author: cr4zjh0bp
# Created: Sun Mar 22 11:54:41 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

s = ns()
n = len(s)
flag = True
if s != reversed(s):
    flag = False
for i in range((n - 1) // 2):
    p = (n - 1) // 2
    if s[i] != s[p - i - 1]:
        flag = False

for i in range((n + 3) // 2 - 1, n):
    p = n
    if s[i] != s[p - i - 1]:
        flag = False

print("Yes" if flag else "No")

Fixed code:
# Author: cr4zjh0bp
# Created: Sun Mar 22 11:54:41 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

s = ns()
n = len(s)
flag = True
for i in range((n - 1) // 2):
    p = (n - 1) // 2
    if s[i] != s[p - i - 1]:
        flag = False

for i in range((n + 3) // 2 - 1, n):
    p = n
    if s[i] != s[p - i - 1]:
        flag = False

print("Yes" if flag else "No")
Buggy code:
S=input()
N=len(S)
s=''.join(list(reversed(S)))

T=S[0:int((N-1)/2)]
NT=len(T)
t=''.join(list(reversed(T)))

U=S[int((N+1)/2):N]
NU=len(U)
u=''.join(list(reversed(U)))

if S[0:int((N-1)/2)] == s[0:int((N-1)/2)] and T[0:int((NT-1)/2)] == t[0:int((NT-1)/2)] and U[0:int((NU-1)/2)] == u[0:int((NU-1)/2)]:
    print('Yes')
else:
    print('No')

Fixed code:
S=input()
N=len(S)
s=''.join(list(reversed(S)))

T=S[0:int((N-1)/2)]
NT=len(T)
t=''.join(list(reversed(T)))

U=S[int((N+1)/2):N]
NU=len(U)
u=''.join(list(reversed(U)))

if S[0:int((N-1)/2)] == s[0:int((N-1)/2)] and T == t and U == u:
    print('Yes')
else:
    print('No')
Buggy code:
#-String Palindrome
import math
character = input()
re_character = character[::-1]

num = int(len(character))
middle = math.ceil(num/2.0)

if (character[0:num] == re_character[0:num]):
  if (character[0:middle-1] == re_character[middle:num]):
    if (character[middle:num] == re_character[0:middle-1]):
      print("Yes")
else:
  print("No")


Fixed code:
#-String Palindrome
import math
character = input()
re_character = character[::-1]
 
num = int(len(character))
middle = math.ceil(num/2.0)
#print(middle)
#print(character[0:middle-1], re_character[middle:num])
#print(character[0:num], re_character[0:num])
#print (character[middle:num], re_character[0:middle-1])

if (character[middle:num] == re_character[0:middle-1]):
  if (character[0:num] == re_character[0:num]):
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy code:
str1 = input()
n = len(str1)
m = (n-1)/2
o = (n+3)/2
str2 = str1[:m]
str3 = str1[o:n]
if str1 != str1[::-1]:
	print("No")
else:
  	if str2 != str2[::-1]:
    	print("No")
    else:
    	if str3 != str3[::-1]:
        	print("No")
        else:
        	print("Yes")
    	
	

Fixed code:
str1 = input()
n = len(str1)
m = int((n-1)/2)
o = int((n+3)/2)
str2 = str1[:m]
str3 = str1[(o-1):n]
if str1 != str1[::-1]:
	print("No")
else:
    if str2 != str2[::-1]:
	    print("No")
    else:   
        if str3 != str3[::-1]:
            print("No")
        else:
            print("Yes")
Buggy code:
from sys import stdin

s = str(stdin.readline().rstrip())
len_s = len(s)

half_a = s[0:int((len_s - 1)/2)]
half_b = s[:int((len_s - 1)/2):-1]

rev_s = s[::-1]

if half_a == half_b:
    if rev_s == s:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Fixed code:
from sys import stdin

s = str(stdin.readline().rstrip())
len_s = len(s)

half_a = s[0:int((len_s - 1)/2)]
rev_half_a = half_a[::-1]
half_b = s[:int((len_s - 1)/2):-1]
rev_half_b = half_b[::-1]

if half_a == half_b:
    if rev_half_a == half_a:
        if rev_half_b == half_b:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')
Buggy code:
S = input()
N = len(S)
a = S[0:(N-1)//2]
b = S[(N+3)//2-1:]

def kaibun(l):
    for i in range(len(l)):
        if l[i] != l[len(l)-1-i]:
            return(False)
    return(True)

print(kaibun(S))
print(a)
print(kaibun(a))
print(b)
print(kaibun(b))
  
if kaibun(S) & kaibun(a) & kaibun(b):
    print("Yes")
else:
    print("No")
            

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


def k(a):
    for i in range(len(a)):
        if a[i] != a[len(a)-1-i]:
            return False
    else:
        return True

if k(S) & k(a) & k(b):
    print("Yes")
else:
    print("No")
Buggy code:
def judge(s):
    inv_str = s[::-1]
    print(inv_str)
    if(s == inv_str):
        return 0
    else:
        return 1

x = str(input())
len = len(x)
x1 = x[:int((len-1)/2)]
x2 = x[int((len+3)/2-1):]

if(judge(x1)==0 and judge(x2)==0):
    print("Yes")
else:
    print("No")

Fixed code:
def judge(s):
    inv_str = s[::-1]
    # print(inv_str)
    if(s == inv_str):
        return 0
    else:
        return 1

x = str(input())
len = len(x)
x1 = x[:int((len-1)/2)]
x2 = x[int((len+3)/2-1):]

if(judge(x1)==0 and judge(x2)==0 and judge(x)==0):
    print("Yes")
else:
    print("No")
Buggy code:
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholString == wholeString[::-1]:
  print("Yes")
else:
  print("No")

Fixed code:
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholeString == wholeString[::-1]:
  print("Yes")
else:
  print("No")
Buggy code:
S = input()
N = len(S)
A = int((N - 1) / 2)
B = int((A - 1) / 2)
X = 0

for i in range(A):
  if S[i] != S[-i-1]:
    X += 1

if N == 5:
  if S[0] != S[1]:
    X += 1

if N >= 7:
  for i in range(B):
  	if S[i] != S[A-1]:
    	X += 1
      
if X == 0:
  print("Yes")
else:
  print("No")

Fixed code:
S = input()
N = len(S)
A = int((N - 1) / 2)
if A % 2 == 0:
  B = int(A / 2)
else:
  B = int((A - 1) / 2)
X = 0
 
for i in range(A):
  if S[i] != S[-i-1]:
    X += 1
 
if N >= 5:
  for i in range(B):
  	if S[i] != S[A-1-i]:
  	    X += 1
      
if X == 0:
  print("Yes")
else:
  print("No")
Buggy code:
from copy import copy

S = input()
Slist = []
par = []
rap = []

for s in S:
    Slist.append(s)

if len(Slist)==3:
    if Slist==list(reversed(Slist)):
        print("Yes")
    else:
        print("No")
else:
    rap = copy(Slist)
    list(reversed(rap))
    if Slist==rap:
        rap = []
        par = copy(Slist)
        par = par[:(len(par)-1)//2]
        rap = copy(par)
        list(reversed(rap))
        if par==rap:
            rap = []
            par = copy(Slist)
            par = par[(len(par)+3)//2]
            rap = copy(par)
            list(reversed(rap))
            if par==rap:
                print("Yes")
    else:
        print("No")

Fixed code:
from copy import copy

S = input()
Slist = []
par = []
rap = []

for s in S:
    Slist.append(s)

if len(Slist)==3:
    if Slist==list(reversed(Slist)):
        print("Yes")
    else:
        print("No")
else:
    par = copy(Slist)
    rap = copy(Slist)
    rap = list(reversed(rap))

    if par==rap:
        rap = []
        par = copy(Slist)
        par = par[:(len(par)-1)//2]
        rap = copy(par)
        rap = list(reversed(rap))

        if par==rap:
            rap = []
            par = copy(Slist)
            par = par[(len(par)+3)//2-1:]
            rap = copy(par)
            rap = list(reversed(rap))

            if par==rap:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
Buggy code:
def isPalindrome(s):
  print(s)
  n=len(s)
  i=0
  while(i<=(n-1)/2):
    if s[i]==s[-(i+1)]:
      i+=1
    else:
      return False
  return True

s=input()
n=len(s)

left = s[:(n-1)//2]
right = s[(n+3)//2-1:]

if isPalindrome(left) and isPalindrome(right):
  if left==right:
    print("Yes")
  else:
    print("No")
else:
  print("No")


Fixed code:
def isPalindrome(s):
  n=len(s)
  i=0
  while(i<=(n-1)/2):
    if s[i]==s[-(i+1)]:
      i+=1
    else:
      return False
  return True

s=input()
n=len(s)

left = s[:(n-1)//2]
right = s[(n+3)//2-1:]

if isPalindrome(left) and isPalindrome(right):
  if isPalindrome(s):
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy code:
def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True

s=input()
print(s)
n=(len(s))
left=s[0:(n-1)//2]
right=s[((n+3)//2-1):]
if left!=right:
  print('No')
if is_kaibun(s):
  if is_kaibun(left):
    if is_kaibun(right):
      print('Yes')
    else:
      print('No')
  else:
     print('No')
else:
  print('No')      
    
    
  



  
    
 

   

  

Fixed code:
def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True

s=input()
n=(len(s))
left=s[0:(n-1)//2]
right=s[((n+3)//2-1):]

if is_kaibun(s):
  if is_kaibun(left):
    if is_kaibun(right):
      print('Yes')
    else:
      print('No')
  else:
     print('No')
else:
  print('No')
Buggy code:
def kaibun(sl):
    for i in range(len(sl)):
        if sl[i] != sl[-1-i]:
            return 'No'
            break
        else:
            return 'Yes'


s = input()



sl = []
out = 'Yes'
slz = []
slk = []

for i in range(len(s)):
    sl.append(s[i])

for i in range((len(s)-1) // 2):
    slz.append(s[i])


for i in range((len(s)+3)//2,len(s)):
    slk.append(s[i-1])



    
    
out = kaibun(sl)
out = kaibun(slz)
out = kaibun(slk)
print(out)






Fixed code:
def kaibun(sl):
	f = 'Yes'
	for i in range(len(sl)):
		if sl[i] != sl[-1-i]:
			f = 'No'
			break
	return f


s = input()



sl = []
slz = []
slk = []

for i in range(len(s)):
    sl.append(s[i])

for i in range((len(s)-1) // 2):
    slz.append(s[i])


for i in range(((len(s)+3)//2), len(s)+1):
    slk.append(s[i-1])


f = 'Yes'
    
    
if kaibun(sl) == 'No':
	f = 'No'

if kaibun(slz) == 'No':
	f = 'No'

if kaibun(slk) == 'No':
	f = 'No'

print(f)
Buggy code:
s = input()
def is_kaibun(s):
  for i in range(len(s)//2):
    if s[i] != s[-i-1]:
      return False
  return True
n = len(s)
s1 = s[:(n-1)/2]
s2 = s[(n+1)/2:]
if is_kaibun(s) & is_kaibun(s1) & is_kaibun(s2):
  print('Yes')
else:
  print('No')


Fixed code:
s = input()
def is_kaibun(s):
  for i in range(len(s)//2):
    if s[i] != s[-i-1]:
      return False
  return True
n = len(s)
s1 = s[:(n-1)//2]
s2 = s[(n+1)//2:]
if is_kaibun(s) & is_kaibun(s1) & is_kaibun(s2):
  print('Yes')
else:
  print('No')
Buggy code:
string_values = list(input())
size = len(string_values)
half_size = int((size - 1) / 2)
half_last_size = int((size + 3) / 2)

count = 0
is_true = True
for string_value in string_values:
    if string_value != string_values[size - count - 1]:
        is_true = False
    if count > half_size:
        break
    count += 1

count = 0
for string_value in string_values:
    if string_value != string_values[half_size - count - 1]:
        is_true = False
    if count + 1 == half_size:
        break
    count += 1

count = 0
check_count = 0
for string_value in string_values:
    if count + 1 < half_last_size:
        count += 1
        continue
    if string_value != string_values[size - check_count - 1]:
        is_true = False
        check_count += 1
    count += 1


answer = "No"
if is_true:
    answer = "Yes"
print(answer)


Fixed code:
string_values = list(input())
size = len(string_values)
half_size = int((size - 1) / 2)
half_last_size = int((size + 3) / 2)

count = 0
is_true = True
for string_value in string_values:
    if string_value != string_values[size - count - 1]:
        is_true = False
    if count > half_size:
        break
    count += 1

count = 0
for string_value in string_values:
    if string_value != string_values[half_size - count - 1]:
        is_true = False
    if count + 1 == half_size:
        break
    count += 1

count = 0
check_count = 0
for string_value in string_values:
    if count + 1 < half_last_size:
        count += 1
        continue
    if string_value != string_values[size - check_count - 1]:
        is_true = False
    check_count += 1
    count += 1


answer = "No"
if is_true:
    answer = "Yes"
print(answer)
Buggy code:
s = input()
print(s)
n = len(s)
print(n)
print(s[:int(n//2)])
print(s[int(n//2)+1:])
if s[:int(n//2)-1] == s[int(n//2)+1:]:
  print("Yes")
else:
  print("No")


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

def isp(s):
  n = len(s)
  for i in range(n // 2 - 1):
    if s[i] != s[n - 1 - i]:
      return False
  return True

if isp(S) and isp(S[0:(N - 1) / 3]):
  print("Yes")
else:
  print("No")

Fixed code:
S = input()
N = len(S)
 
def isp(s):
  n = len(s)
  for i in range(n // 2):
    if s[i] != s[n - 1 - i]:
      return False
  return True
 
if isp(S) and isp(S[0:(N - 1) // 2]):
  print("Yes")
else:
  print("No")
Buggy code:
# coding: utf-8
S = input()
def check(S):
    ret = True
    for i in range(len(S)//2):
        if S[i] != S[-i-1]:
            ret = False
    return ret
flag = True
if not check(S):
    flag = False
if not check(S[:(len(S)-1)//2]):
    flag = False
if not check(S[(len(S)+3)//2:]):
    flag = False
print("Yes" if flag else "No")

Fixed code:
# coding: utf-8
S = input()
def check(S):
    ret = True
    for i in range(len(S)//2):
        if S[i] != S[-i-1]:
            ret = False
    return ret
if len(S) == 3:
    if S[0] != S[-1]:
        print("No")
    else:
        print("Yes")
    exit()
flag = True
if not check(S):
    flag = False
if not check(S[:(len(S))//2]):
    flag = False
if not check(S[(len(S)+3)//2-1:]):
    flag = False
print("Yes" if flag else "No")
Buggy code:
s=input()
def kaibun(aa) :
  for i in range(len(aa)):
    if aa[i]!=aa[-i-1] :
      return False
    
  return True


b=int((len(s)-1)/2)
c=int((len(s)+3)/2)
mae=s[:b]
ato=s[c:]
if kaibun(s) and kaibun(mae) and kaibun(ato) :
  print ('Yes')
else :
  print('No')

Fixed code:
s=input()
def kaibun(aa) :
  for i in range(len(aa)):
    if aa[i]!=aa[-i-1] :
      return False
    
  return True


b=int((len(s)-1)/2)
c=int((len(s)+3)/2)
mae=s[:b]
ato=s[c-1:]
if kaibun(s) and kaibun(mae) and kaibun(ato) :
  print ('Yes')
else :
  print('No')
Buggy code:
s = list(input())
n = len(s)

s1 = [s[i] for i in range((n-1)//2)]
s2 = [s[i] for i in range((n+3)//2-1, n)]

s1r = list(reversed(s1))
s2r = list(reversed(s2))

if s1 == s1r and s2 == s2r:
    print('Yes')
else:
    print('No')
    
print(s1)

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

s1 = [s[i] for i in range((n-1)//2)]
s2 = [s[i] for i in range((n+3)//2-1, n)]

sr = list(reversed(s))
s1r = list(reversed(s1))
s2r = list(reversed(s2))

if s == sr and s1 == s1r and s2 == s2r:
    print('Yes')
else:
    print('No')