qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = input()[:-1]
while n[:len(n)//2] != [len(n)//2:]:
  n = n[:-1]
print(len(n))

Fixed code:
n = input()[:-1]
while n[:len(n)//2] != n[len(n)//2:]:
  n = n[:-1]
print(len(n))
Buggy code:
letters = input()
print(letters)
while True:
    not_equal = 0
    length = len(letters)
    letters = letters[:length-1]
    print(letters)
    if len(letters) % 2 != 0:
        continue

    if int(len(letters)) % 2 == 0:
        half = int(len(letters)/2 -1)
    else:
        half = int((len(letters)-1)/2)
    i = 0
    while i <= half:
        if letters[i] != letters[i + half + 1]:
            not_equal = 1
            break
        i += 1

    if not_equal == 0:
        print(len(letters))
        break


Fixed code:
letters = input()
while True:
    not_equal = 0
    length = len(letters)
    letters = letters[:length-1]
    if len(letters) % 2 != 0:
        continue

    if int(len(letters)) % 2 == 0:
        half = int(len(letters)/2 -1)
    else:
        half = int((len(letters)-1)/2)
    i = 0
    while i <= half:
        if letters[i] != letters[i + half + 1]:
            not_equal = 1
            break
        i += 1

    if not_equal == 0:
        print(len(letters))
        break
Buggy code:
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=s1[-1]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2)

Fixed code:
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=[s1[-1]]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2))
Buggy code:
s = input()

def iseven(str, n):
    for i in range(0, n/2):
        if str[i] != str[i+n/2]:
            return False
    else:
        return True


for i in range(2, n, 2):
    if iseven(s, n-i):
        print(i)


Fixed code:
s = input()
n = len(s)
def iseven(str, n):
    for i in range(0, n//2):
        if str[i] != str[i+n//2]:
            return False
    else:
        return True


for i in range(2, n, 2):
    if iseven(s, n-i):
        print(n-i)
        break
Buggy code:
S=list(input())
print(S)

lenS=len(S)
print(lenS)
ans=0

if lenS%2==0:
  for l in range(lenS//2-1):
    check=0
    for k in range(l+1):
      if S[k]==S[k+l+1]:
        check+=1
    if check==l+1:
      ans=check*2
  print(ans)

else:
  for l in range(lenS//2):
    check=0
    for k in range(l+1):
      if S[k]==S[k+l+1]:
        check+=1
    if check==l+1:
      ans=check*2
  print(ans)


Fixed code:
S=list(input())
lenS=len(S)
ans=0

if lenS%2==0:
  for l in range(lenS//2-1):
    check=0
    for k in range(l+1):
      if S[k]==S[k+l+1]:
        check+=1
    if check==l+1:
      ans=check*2
  print(ans)

else:
  for l in range(lenS//2):
    check=0
    for k in range(l+1):
      if S[k]==S[k+l+1]:
        check+=1
    if check==l+1:
      ans=check*2
  print(ans)
Buggy code:
from collections import deque
def main():
    s=deque(input())
    for i in range(0,len(s)):
        s.pop()
        print(s)
        if len(s)%2==1:
            continue
        else:
            if "".join(s)[0:len(s)//2]=="".join(s)[len(s)//2:len(s)]:
                print(len(s))
                break;
if __name__=='__main__':
    main()


Fixed code:
from collections import deque
def main():
    s=deque(input())
    for i in range(0,len(s)):
        s.pop()
        if len(s)%2==1:
            continue
        else:
            if "".join(s)[0:len(s)//2]=="".join(s)[len(s)//2:len(s)]:
                print(len(s))
                break;
if __name__=='__main__':
    main()
Buggy code:
s=str(input())
# print(s)
List=list(s)
List.pop(-1)
# print(List)
ans=0
for i in range((len(List)//2)+1):
    R=List[0:i]
    L=List[i:i+len(R)]
    # print("L",L,"R",R)
    if(R==L):
        print(i,i+1,R,L)
        ans=len(R)*2

print(ans)

Fixed code:
s=str(input())
# print(s)
List=list(s)
List.pop(-1)
# print(List)
ans=0
for i in range((len(List)//2)+1):
    R=List[0:i]
    L=List[i:i+len(R)]
    # print("L",L,"R",R)
    if(R==L):
        # print(i,i+1,R,L)
        ans=len(R)*2

print(ans)
Buggy code:
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=input()
while len(s)>0:
    if s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        exit()
    s=s[:-1]


Fixed code:
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=input()
s=s[:-1]
while len(s)>0:
    if s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        exit()
    s=s[:-1]
Buggy code:
# input
S = input()

for i in range(len(S)):
    if S[:i] + S[:i] == S[:2 * i]:
        ans = i

print(ans)

Fixed code:
# input
S = input()

for i in range(len(S) // 2):
    if S[:i] + S[:i] == S[:2 * i]:
        ans = i

print(2 * ans)
Buggy code:
S = input()
for i in range(S//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i)


Fixed code:
S = input()
for i in range((len(S)-1)//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i*2)
Buggy code:
s = input()
ans = 0
for i in range(len(s) // 2 - 1):
  if s[:i * 2] == s[:i] + s[:i]:
    ans = 2 * i
print(ans)

Fixed code:
s = input()
ans = 0
for i in range(len(s) // 2 - 1):
  if s[:i * 2 + 2] == s[:i+1] + s[:i+1]:
    ans = 2 * i +2
print(ans)
Buggy code:
s=input()
n=len(s)//2

for x in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break

Fixed code:
s=input()
n=len(s)//2
 
for i in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break
Buggy code:
l=list(input())
for i in range(len(l)):
            del l[-1]
            if len(l)%2!=0:
                        del l[-1]
                        #print('1',l)
            if len(l)%2==0:
                        if l[:len(l)//2]==l[len(l)//2:]:
                                    #print('2',l,'len(l)',len(l))
                                    exit()
                        else:
                                    del l[-1]
                                    #print('3',l)
                                    


Fixed code:
l=list(input())
for i in range(len(l)):
            del l[-1]
            if len(l)%2!=0:
                        del l[-1]
                        #print('1',l)
            if len(l)%2==0:
                        if l[:len(l)//2]==l[len(l)//2:]:
                                    print(len(l))
                                    exit()
                        else:
                                    del l[-1]
                                    #print('3',l)
Buggy code:
S=input()
for i in range(N-1):
  S=S[:-1]
  N=len(S)//2
  if S==S[:N]*2:
    print(N*2)
    exit()
print(1)

Fixed code:
S=input()
for i in range(len(S)-1):
  S=S[:-1]
  N=len(S)//2
  if S==S[:N]*2:
    print(N*2)
    exit()
print(1)
Buggy code:

def main():
    msg = input()
    msg = msg[:-1]
    if len(msg) % 2 != 0:
        msg = msg[:-1]
    while len(msg) >= 2:
        before = msg[:int(len(msg) / 2)]
        after = msg[int(len(msg) / 2):]
        if before == after:
            print(len(before))
            break
        msg = msg[:-2]


if __name__ == '__main__':
    main()

Fixed code:

def main():
    msg = input()
    msg = msg[:-1]
    if len(msg) % 2 != 0:
        msg = msg[:-1]
    while len(msg) >= 2:
        before = msg[:int(len(msg) / 2)]
        after = msg[int(len(msg) / 2):]
        if before == after:
            print(len(msg))
            break
        msg = msg[:-2]


if __name__ == '__main__':
    main()
Buggy code:
S = input()

l = len(S)
for i in range(l-2,2,-2):
    # print(S[i//2:i], S[0:i//2])
    if S[i//2:i] == S[0:i//2]:
        print(i)
        break

Fixed code:
S = input()

l = len(S)
for i in range(l-2,0,-2):
    # print(S[i//2:i], S[0:i//2])
    if S[i//2:i] == S[0:i//2]:
        print(i)
        break
Buggy code:
s=input()
ans=len(s)
def check(m):
  a=len(m)
  if a%2==1:
    return False
  else:
    if s[0:m//2]==s[m//2:m]:
      return True
    else:
      return False
for i in range(1,len(s),-1):
  ans-=1
  if check(s[0:i]):
    print(ans)
  


Fixed code:
s=input()
ans=len(s)
def check(m):
  a=len(m)
  if a%2==1:
    return False
  else:
    if s[0:a//2]==s[a//2:a]:
      return True
    else:
      return False
for i in range(len(s)-1,0,-1):
  ans-=1
  if check(s[0:i])==True:
    print(ans)
    break
Buggy code:
s=input()
while 1:
    s=s[:-2]
    if s[:len(s)//2]==s[:-len(s)//2-1:-1]:
        break
print(len(s))

Fixed code:
s=input()
while 1:
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        break
print(len(s))
Buggy code:
s = input()
n = len(s)//2
for i in range(n):
    if s[:n-i] == s[n-i:2*(n-i)]:
        print(2*(n-i))
        break

Fixed code:
s = input()
n = len(s)//2
for i in range(1,n):
    if s[:n-i] == s[n-i:2*(n-i)]:
        print(2*(n-i))
        break
Buggy code:
s = input()
for i in range(len(s)):
    s = s[:-1]
    if len(s)%2 == 0:
        if s[:len(s)/2] == s[len(s)/2:]:
            print(len(s))
            break

Fixed code:
s = input()
for i in range(len(s)):
    s = s[:-1]
    if len(s)%2 == 0:
        if s[:int(len(s)/2)] == s[int(len(s)/2):]:
            print(len(s))
            break
Buggy code:
def f(x):
    return len(x) % 2 == 0 and x[:len(x)/2] == x[len(x)/2:]
x=input()
while f(x):
    x=x[:-1]
print(len(x))

Fixed code:
def f(x):
    return len(x) % 2 == 0 and x[:len(x)//2] == x[len(x)//2:]
 
x=input()[:-1]
while not f(x):
    x=x[:-1]
 
print(len(x))
Buggy code:
s = input()
while True:
  s = s[:len(s) - 2]
  if s[:len(s) // 2] == s[len(s) // 2:]:
    break
print(s)

Fixed code:
s = input()
while True:
  s = s[:len(s) - 2]
  if s[:len(s) // 2] == s[len(s) // 2:]:
    break
print(len(s))
Buggy code:
s = input()
n = (len(s) - 1) // 2

for i in reversed(range(1, n + 1)):
  if s[:i] == s[i:2*i]:
    print(i)
    break

Fixed code:
s = input()
n = (len(s) - 1) // 2

for i in reversed(range(1, n + 1)):
  if s[:i] == s[i:2*i]:
    print(2 * i)
    break
Buggy code:
s=int(input())

for n in range(1,len(s)-1):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        break
print(len(s))


Fixed code:
s=list(input())

for n in range(1,len(s)-1):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        break
print(len(s))
Buggy code:
s=list(input())
x=len(s)

for i i range(1,x//2):
    s=s[:-2]
    if s[:len(s)//2==s[len(s)//2:]:
            break
print(len(s))


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

for i in range(1,x//2):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        
        break

print(len(s))
Buggy code:
n=input()
c=0
for i in range(len(n)):
    p=n[:len(n)-i]
    if p[:len(p)//2]==p[len(p)//2:]:
        c=len(n)-i
        break
print(c)

Fixed code:
n=input()
c=0
for i in range(1,len(n)):
    p=n[:len(n)-i]
    if p[:len(p)//2]==p[len(p)//2:]:
        c=len(n)-i
        break
print(c)
Buggy code:
def check(s):
    if len(s)%2 !=0:
        return False
    i=int(len(s)/2)
    s1=s[:i]
    s2=s[i:]
    print(s1+" "+s2)
    return s1==s2

s = input()
while True:
    s = s[:len(s)-1]
    if check(s):
        print(len(s))
        break


Fixed code:
def check(s):
    if len(s)%2 !=0:
        return False
    i=int(len(s)/2)
    s1=s[:i]
    s2=s[i:]
    return s1==s2

s = input()
while True:
    s = s[:len(s)-1]
    if check(s):
        print(len(s))
        break
Buggy code:
s = input()
lens = len(s)
for i in range(2 if lens % 2 == 0 else 1, lens, 2):
    s = s[:-i]
    mid = len(s) // 2
    if s[:mid] == s[mid:]:
        print(len(s))
        break

Fixed code:
s = input()
for i in range(2 if len(s) % 2 == 0 else 1, len(s), 2):
    t = s[:-i]
    mid = len(t) // 2
    if t[:mid] == t[mid:]:
        print(len(t))
        break
Buggy code:
S = input()

def f(x):
  l = len(x)//2
  for i in range(l):
    if x[i] != x[l+i]:
      return False
  else:
    return True

for i in range(1,len(S)):
  if f(S[:-1*i]):
    print(S[:-1*i])
    break
  

Fixed code:
S = input()

def f(x):
  l = len(x)//2
  for i in range(l):
    if x[i] != x[l+i]:
      return False
  else:
    return True

for i in range(2,len(S),2):
  if f(S[:-1*i]):
    print(len(S[:-1*i]))
    break
Buggy code:
s=input()
for i in range(len(s)/2-1,0,-1):
  if s[0:i]==s[i:i+i]:
    print(i)
    exit(0)

Fixed code:
s=input()
for i in range(len(s)//2-1,0,-1):
  if s[0:i]==s[i:i+i]:
    print(i<<1)
    exit(0)
Buggy code:
s=input()
n=len(s)
for i in range(n//2,0,-1):
  if s[0:i]==s[i:i+i]:
    print(i)
    break

Fixed code:
s=input()
n=len(s)
for i in range(n//2,0,-1):
  if i*2==n:
    continue
  if s[0:i]==s[i:i+i]:
    print(i+i)
    break
Buggy code:
s = input()
for i in range(len(s)-1):
    s = s[::-1]        
    s = s.replace(s[0],'',1)
    s = s[::-1] 
    a = s[0]
    for j in range(1,int(len(s)/2)+1):
        a += s[j]
        if a * (int(len(s)/len(a))) == s and int(len(s)/len(a)) % 2 == 0:
            print(len(a * (int(len(s)/len(a)))))
            exit()

Fixed code:
s = input()
for i in range(len(s)-1):
    s = s[::-1]        
    s = s.replace(s[0],'',1)
    s = s[::-1] 
    a = s[0]
    for j in range(1,int(len(s)/2)+1):
        a += s[j]
        if a * (int(len(s)/len(a))) == s and (int(len(s)/len(a)) % 2 == 0 or s.count(s[0]) == len(s)):
            print(len(a * (int(len(s)/len(a)))))
            exit()
Buggy code:
import sys

def main():
    input = sys.stdin.readline
    S = list(map(str, input().strip()))

    S = S[:-2]
    while len(S) > 2:
        n = len(S) // 2
        a = ''.join(S[:n])
        b = ''.join(S[n:])

        if a == b:
            return 2 * n
        else:
            S = S[:-2]


if __name__ == '__main__':
    print(main())


Fixed code:
import sys

def main():
    input = sys.stdin.readline
    S = list(map(str, input().strip()))

    S = S[:-2]
    while len(S) >= 2:
        n = len(S) // 2
        a = ''.join(S[:n])
        b = ''.join(S[n:])

        if a == b:
            return 2 * n
        else:
            S = S[:-2]


if __name__ == '__main__':
    print(main())
Buggy code:
def ss(s):
    print(s)
    return s[:len(s)//2] == s[len(s)//2:]

S = input()
N = len(S)
for i in range(1, N-1):
    if ss(S[:N-i]):
        ans = N-i
        break
print(ans)

Fixed code:
def ss(s):
    return s[:len(s)//2] == s[len(s)//2:]

S = input()
N = len(S)
for i in range(1, N-1):
    if ss(S[:N-i]):
        ans = N-i
        break
print(ans)
Buggy code:
ss = input()
for i in range(2, len(ss), 2):
    tt = ss[:-i]
    l = len(tt) // 2
    if tt[:l] == tt[l:]:
        print(tt)
        break


Fixed code:
ss = input()
for i in range(2, len(ss), 2):
    tt = ss[:-i]
    l = len(tt) // 2
    if tt[:l] == tt[l:]:
        print(len(tt))
        break
Buggy code:
s = input()[:-1]
if len(s) == 0:
    print(0)
    quit()
for i in range(len(s) - 1, -1, -1):
    if i % 2 == 1:
        l = i // 2 + 1
        if s[: l] == s[l : i + 1]:
            print(2 * l)
print(0)

Fixed code:
s = input()[:-1]
if len(s) == 0:
    print(0)
    quit()
for i in range(len(s) - 1, -1, -1):
    if i % 2 == 1:
        l = i // 2 + 1
        if s[: l] == s[l : i + 1]:
            print(2 * l)
            quit()
print(0)
Buggy code:
s=input()
n=len(s)
for i in range(n):
    s=s[:-1]
    if len(s)%2==0:
        if s[:int(len(s)/2)+1]==s[int(len(s)/2)+1:]:
            print(len(s))
            break


Fixed code:
s=input()
n=len(s)
for i in range(n):
    s=s[:-1]
    if len(s)%2==0:
        if s[:int(len(s)/2)]==s[int(len(s)/2):]:
            print(len(s))
            break
Buggy code:
s = list(str(input()))

s_rev = list(reversed(s))
n = len(s_rev)

for i in range(len(s_rev)):
  del s_rev[0]
  if len(s_rev) == 1:
    print(1)
    break
  elif len(s_rev) % 2 == 1:
    continue
  elif s[0:len(s_rev) // 2] != s[len(s_rev) // 2:len(s_rev)]:
    continue  
  elif len(s_rev) != 0:
    print(len(s_rev))
    


Fixed code:
s = list(str(input()))

s_rev = list(reversed(s))
n = len(s_rev)

for i in range(n):
  del s_rev[0]
  if len(s_rev) % 2 == 1:
    continue
  elif s[0:len(s_rev)// 2] != s[(len(s_rev) // 2):len(s_rev)]:
    continue  
  elif len(s_rev) != 0:
    print(len(s_rev))
    break
Buggy code:
if __name__ == "__main__":
    s = input()
    data = list(s)
    while len(data):
        data.pop()
        if len(data) % 2 == 0:
            half = int(len(data) / 2)
            if data[:half] == data[half:]:
                print("".join(data[:half]))
                break

Fixed code:
if __name__ == "__main__":
    s = input()
    data = list(s)
    while len(data):
        data.pop()
        if len(data) % 2 == 0:
            half = int(len(data) / 2)
            if data[:half] == data[half:]:
                print(len(data))
                break
Buggy code:
import sys
S=input()
for i in range(1,len(S)):
  S=S[:-1]
  if len(S)%2==0:
    c=len(S)
    print(S[c//2+1:])
    print(S[:c//2])
    if S[:c//2]==S[c//2+1:]:
      print(i)
      sys.exit()

Fixed code:
import sys
S=input()
for i in range(1,len(S)):
  S=S[:-1]
  if len(S)%2==0:
    c=len(S)
    if S[:c//2]==S[c//2:]:
      print(c)
      sys.exit()
Buggy code:
def main():
    from collections import deque
    s = deque(list(input()))
    while deque:
        t = s.pop()
        if len(s)%2 != 0:
            continue
        l = list(s)
        if l == l[::-1]:
            print(len(l))
            return 0

if __name__ == '__main__':
    main()


Fixed code:
def main():
    from collections import deque
    s = deque(list(input()))
    while deque:
        t = s.pop()
        if len(s)%2 != 0:
            continue
        l = list(s)
        if l[:len(l)//2] == l[len(l)//2:]:
            print(len(l))
            return 0

if __name__ == '__main__':
    main()
Buggy code:
S = input()
L = len(S)

ans = None
for i in range(1,L):
  if (L - i) % 2 != 0:
    continue
  ns = S[:-i]
  h = (L - i) // 2
  m = ns[:h] + ns[:h]
  if ns == m:
    ans = ns
    break
    
print(ans)

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

ans = None
for i in range(1,L):
  if (L - i) % 2 != 0:
    continue
  ns = S[:-i]
  h = (L - i) // 2
  m = ns[:h] + ns[:h]
  if ns == m:
    ans = ns
    break
    
print(len(ans))
Buggy code:
s=list(input())
while len(s) != 0:
  s.pop()
  if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
    print(len(s)
    exit()

Fixed code:
s=list(input())
while len(s) != 0:
  s.pop()
  if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
    print(len(s))
    exit()
Buggy code:
s = input()
ans = 0
for i in range(1, len(s) // 2 - 1):
  if s[:i] == s[i:2*i]:
    ans = i
print(ans)


Fixed code:
s = input()
ans = 0
for i in range(1, len(s) // 2):
  if s[:i] == s[i:2*i]:
    ans = 2 * i
print(ans)
Buggy code:
s = input()
for k in range(len(s)//2-1, 0, -1)
  if s[:k] == s[k:2*k]: break
print(k)

Fixed code:
s = input()
for k in range(len(s)//2-1, 0, -1):
  if s[:k] == s[k:2*k]: break
print(k*2)
Buggy code:
S = str(input())
S = S[:-2]

for _ in range(len(S)//2-2):
  
  if S[:len(S)//2] == S[len(S)//2:]:
    print(len(S))
    break
  else:
    S = S[:-2]

Fixed code:
S = str(input())
S = S[:-2]

for _ in range(len(S)//2):
  
  if S[:len(S)//2] == S[len(S)//2:]:
    print(len(S))
    break

  else:
    S = S[:-2]
Buggy code:
S = input()

for i in range(1,len(S)):
    if i%2 == 1:continue
    tmp = S[:i//2]
    print(tmp,S[i//2:i])
    if S[i//2:i] == tmp:
        ans = i
        
print(ans)

Fixed code:
S = input()

for i in range(1,len(S)):
    if i%2 == 1:continue
    tmp = S[:i//2]
    if S[i//2:i] == tmp:
        ans = i
        
print(ans)
Buggy code:
s = input()
l = len(s)
while len(s) >=0:
    s = s[:len(s)-2]
    if s[:len(s)//2] == s[len(s)//2:]:
        print(l - len(s))
        break

Fixed code:
s = input()
l = len(s)
while len(s) >=0:
    s = s[:len(s)-2]
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        break
Buggy code:
n = input()
num = len(s)-2
for i in range(num,0,2):
  f = int(i/2)
  if s[:f]==s[f:i]:
    print(i)
    break

Fixed code:
n = input()
num = len(n)-2
for i in range(num,0,-2):
  f = int(i/2)
  if n[:f]==n[f:i]:
    print(i)
    break
Buggy code:
S = input
while len(S)!=0:
    S.pop()
    if len(S)%2==0 and S[0:len(S)/2]==S[len(S)/2:]:
        print(len(S))
        exit()

Fixed code:
S = list(input())
while len(S)!=0:
    S.pop()
    if len(S)%2==0 and S[:int(len(S)/2)]==S[int(len(S)/2):]:
        print(len(S))
        exit()
Buggy code:
s = input()

r = 0
while len(s) > 0:
  s = s[:-2]
  print(s)
  print(s[:int(len(s)/2)])
  print(s[int(len(s)/2):])
  print("--")
  if s[:int(len(s)/2)] == s[int(len(s)/2):]:
    r = len(s)
    break
    
print(r)

Fixed code:
s = input()

r = 0
while len(s) > 0:
  s = s[:-2]
  if s[:int(len(s)/2)] == s[int(len(s)/2):]:
    r = len(s)
    break
    
print(r)
Buggy code:
import sys
s = input()
l = len(s)
del_len_max = l-2
del_len_min = 1 if l%2 == 1 else 2
if del_len_min == del_len_max:
    print(del_len_max)
for i in range(del_len_min, del_len_max+2, 2):
    before = s[0:(l-i)//2]
    after = s[(l-i)//2:l-i]
    if before == after:
        print(l-i)
        sys.exit()

Fixed code:
import sys
s = input()
l = len(s)
del_len_max = l-2
del_len_min = 1 if l%2 == 1 else 2
if del_len_min == del_len_max:
    print(del_len_max)
    sys.exit()
for i in range(del_len_min, del_len_max+2, 2):
    before = s[0:(l-i)//2]
    after = s[(l-i)//2:l-i]
    if before == after:
        print(l-i)
        sys.exit()
Buggy code:
s = input()[:-1]
while s[:len(s)//2] != s[len(s)//2:]:
  s = s[:-1]
print(s)

Fixed code:
s = input()
s = s[:-2]
while s[:len(s)//2] != s[len(s)//2:]:
  s = s[:-2]
print(len(s))
Buggy code:
#S = list(map(str, input()))
S = input()

S = S[0:len(S)-1]
if len(S) % 2 == 0:
    while True:
        if len(S) == 2:
            print(1)
            exit()
            
        left = S[0:len(S)//2]
        right = S[len(S)//2:len(S)]
        if left == right:
            print(len(S))
            exit()
        else:
            S = S[0:len(S)-2]
else:
    S = S[0:len(S)-1]
    while True:
        if len(S) == 2:
            print(1)
            exit()
            
        left = S[0:len(S)//2]
        right = S[len(S)//2:len(S)]
        if left == right:
            print(len(S))
            exit()
        else:
            S = S[0:len(S)-2]

Fixed code:
#S = list(map(str, input()))
S = input()

S = S[0:len(S)-1]
if len(S) % 2 == 0:
    while True:
        if len(S) == 2:
            if S[0] == S[1]:
                print(2)
                exit()
            else:
                print(1)
                exit()
            
        left = S[0:len(S)//2]
        right = S[len(S)//2:len(S)]
        if left == right:
            print(len(S))
            exit()
        else:
            S = S[0:len(S)-2]
else:
    S = S[0:len(S)-1]
    while True:
        if len(S) == 2:
            if S[0] == S[1]:
                print(2)
                exit()
            else:
                print(1)
                exit()
            
        left = S[0:len(S)//2]
        right = S[len(S)//2:len(S)]
        if left == right:
            print(len(S))
            exit()
        else:
            S = S[0:len(S)-2]
Buggy code:
s = list(input())
while True:
  s.pop()
  c = len(s) // 2
  if s[:c] == s[c:]:
    print(c)
    exit()

Fixed code:
s = list(input())
while True:
  s.pop()
  c = len(s)
  if s[:c//2] == s[c//2:]:
    print(c)
    exit()
Buggy code:
N = str(input())
cnt = 0

while True:
    N = N[0:-1]
    cnt += 1
    if len(N) % 2 == 0:
        if N[0:int(len(N)/2)] == N[int(len(N)/2):]:
            break

print(cnt)



Fixed code:
N = str(input())

while True:
    N = N[0:-1]
    if len(N) % 2 == 0:
        if N[0:int(len(N)/2)] == N[int(len(N)/2):]:
            break

print(len(N))