qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = [int(x) for x in input().split()]
attacks = [int(x) for x in input().split()]
print("Yes" if H - sum(attacks) <= 0 else "No")

Fixed code:
H, N = [int(x) for x in input().split()]
attacks = [int(x) for x in input().split()]
print("Yes" if H - sum(attacks) <= 0 else "No")
Buggy code:
h, n = map(int, input().split())
a = input()
alst = []
for i in a.split():
    alst.append(int(i))
if sum(alst) > int(h):
    print("Yes")
else:
    print("No")


Fixed code:
h, n = map(int, input().split())
a = input()
alst = []
for i in a.split():
    alst.append(int(i))
if sum(alst) >= int(h):
    print("Yes")
else:
    print("No")
Buggy code:
import sys
input = sys.stdin.readline
H, N = map(int, input().split())
sm = sum(list(map(int, input().split())))
if N <= sm: print("Yes")
else: print("No")

Fixed code:
import sys
input = sys.stdin.readline
H, N = map(int, input().split())
sm = sum(list(map(int, input().split())))
if H <= sm: print("Yes")
else: print("No")
Buggy code:
h, n = map(int, input().split())
A = list(map(int, input().split()))

sum_a = sum(A)
if h - sum_a < 0:
    print("Yes")
else:
    print("No")

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

sum_a = sum(A)
if h - sum_a <= 0:
    print("Yes")
else:
    print("No")
Buggy code:
H, N = map(int, input().split())
total_A = sum(map(int, input.split()))

if H <= total_A:
    print('Yes')
else:
    print('No')


Fixed code:


H, N = map(int, input().split())
total_A = sum(list(map(int, input().split())))

if H <= total_A:
    print('Yes')
else:
    print('No')
Buggy code:
H,N=map(int,input().split())
A=map(int,input().split())
print("Yes" if max(A)>=H else "No")

Fixed code:
H,N=map(int,input().split())
A=map(int,input().split())
print("Yes" if sum(A)>=H else "No")
Buggy code:
h, n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print('Yes' if sum(a)>h else 'No')

Fixed code:
h, n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print('Yes' if sum(a)>=h else 'No')
Buggy code:
H, N = map(int, input().split())
a = list(map(int, input8).split())
sum = sum(a)
if sum >= H:
  print("Yes")
else:
  print("No")

Fixed code:
H, N = map(int, input().split())
a = list(map(int, input().split()))
sum = sum(a)
if sum >= H:
  print("Yes")
else:
  print("No")
Buggy code:


H, N = map(int, input().split())
total_A = sum(list(map(int, input.split())))

if H <= total_A:
    print('Yes')
else:
    print('No')


Fixed code:
H, N = map(int, input().split())

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

if H <= sum(l):
  print("Yes")
else:
  print("No")
Buggy code:
H,N=map(int,input().split())
A=[int(i) for i in input().split()]
print('Yes' if H<sum(A) else "No")

Fixed code:
H,N=map(int,input().split())
A=[int(i) for i in input().split()]
print('Yes' if H<=sum(A) else "No")
Buggy code:
h,n = map(int,input().split(" "))
a=[int(i) for i in input().split(" ")]

if sum(a) > h:
    print("Yes")
else:
    print("No")

Fixed code:
h,n = map(int,input().split(" "))
a=[int(i) for i in input().split(" ")]

if sum(a) >= h:
    print("Yes")
else:
    print("No")
Buggy code:
from sys import stdin
import math

h, n = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]

sum = 0
for i in a:
    sum += i

if sum > h:
    print("Yes")
else:
    print("No")


Fixed code:
from sys import stdin
import math

h, n = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]

sum = 0
for i in a:
    sum += i

if sum >= h:
    print("Yes")
else:
    print("No")
Buggy code:
h,n = map(int,input().split())
a = list(map(int,input().split()))
p = sum(a)
print("Yes" if h < p else "No")

Fixed code:
h,n = map(int,input().split())
a = list(map(int,input().split()))
p = sum(a)
print("Yes" if h <= p else "No")
Buggy code:
H, N  = map(int, input().split())

s = 0
for i in range(N):
    a = int(input())
    s += a

if H > s:
    print("No")
else:
    print("Yes")

Fixed code:
H, N  = map(int, input().split())
a = list(map(int, input().split()))

s = 0
for i in a:
    s += i

if H > s:
    print("No")
else:
    print("Yes")
Buggy code:
# import itertools
# import math


def solve(H, N, A):
    if (sum(A) > H):
        return 'Yes'
    return 'No'


# N = int(input())
# S = input()
H, N = map(int, input().split())
A = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(H, N, A))


Fixed code:
# import itertools
# import math


def solve(H, N, A):
    if (sum(A) >= H):
        return 'Yes'
    return 'No'


# N = int(input())
# S = input()
H, N = map(int, input().split())
A = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(H, N, A))
Buggy code:
import sys
n = int(input())
s = input()
t = input()

for i in range(n):
   if s[i:] == t[:n-i]:
		print(n+i)
		exit()

print(2*n)

Fixed code:
import sys
n = int(input())
s = input()
t = input()

for i in range(n):
    if s[i:] == t[0:n-i]:
        print(n + i)
        sys.exit()

print(n * 2)
Buggy code:
n = int(input())
a, b = [input() for i in range(2)]
for i in range(n+1):
  if a[i:] == b[:n-i]:
    print(i + n)


Fixed code:
n = int(input())
a, b = [input() for i in range(2)]
for i in range(n+1):
  if a[i:] == b[:n-i]:
    print(i + n)
    break
Buggy code:
n = int(input())
s = str(input())
t = str(input())
z = s + t
for i in range(n):
    if s[i:] == t[:n-i]:
        z = s + t[n-i:]
        break
print(z)

Fixed code:
n = int(input())
s = str(input())
t = str(input())
z = s + t
for i in range(n):
    if s[i:] == t[:n-i]:
        z = s + t[n-i:]
        break
print(len(z))
Buggy code:
N = int(input())
s = input()
t = input()
u = t
for i in range(N):
    if s[N - 1 - i:N] == t[0:i + 1]:
        u = t[i + 1:N]
print(s + u)
print (len(s + u))

Fixed code:
N=int(input())
s=input()
t=input()
u=s+t
for i in range(N):
    if s[i:N]==t[0:N-i]:
        u=s+t[N-i:N]
        break
print(len(u))
Buggy code:
n = int(input())
s = input()
t = input()
for i in range(n):
  if s[i:] == t[:n-i]:
    ans = n + i
    break
print(ans)

Fixed code:
n = int(input())
s = input()
t = input()
ans = s+t
for i in range(n):
    if s[i] == t[0]:
        if s[i:] == t[:n-i]:
            ans = s[:i]+t
            break
print(len(ans))
Buggy code:
n = int(input())
s = input()
t = input()

tmp = -1
for i in range(n):
    print(s[-i - 1:], t[:i + 1])
    if s[-i - 1:] == t[:i + 1]:
        tmp = i


print(n + n - (tmp + 1))


Fixed code:
n = int(input())
s = input()
t = input()

tmp = -1
for i in range(n):
    if s[-i - 1:] == t[:i + 1]:
        tmp = i


print(n + n - (tmp + 1))
Buggy code:
N = int(input())
s = input().strip()
t = input().strip()
lmin = 1000
for i in range(1,N+1):
    if s[-i:]==t[:i]:
        lmin = min(lmin,2*N-i)
print(lmin)

Fixed code:
N = int(input())
s = input().strip()
t = input().strip()
lmin = 2*N
for i in range(1,N+1):
    if s[-i:]==t[:i]:
        lmin = min(lmin,2*N-i)
print(lmin)
Buggy code:
n = int(input())
s = input()
t = input()

if (n == len(s) and (s == t)):
    print(s)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(s+t)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(res)
                break

Fixed code:
n = int(input())
s = input()
t = input()

if (n == len(s) and (s == t)):
    print(n)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i:] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(2*n)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(len(res))
                break
Buggy code:
N = int(input())
s = input()
t = input()
idx = 0
for i in range(N):
    tmp_s = s[N - i - 1:]
    tmp_t = t[:i + 1]
    if tmp_s == tmp_t:
        idx = i + 1

print(s + t[idx:])

Fixed code:
N = int(input())
s = input()
t = input()
idx = 0
for i in range(N):
    tmp_s = s[N - i - 1:]
    tmp_t = t[:i + 1]
    if tmp_s == tmp_t:
        idx = i + 1

print(len(s + t[idx:]))
Buggy code:
N = int(input())
S = input()
T = input()
ans = 2 * N
if (S == T):
    print(N)
    exit(0)
for i in range(N):
    if (T[i] == S[-(i + 1)]):
        print(T[i], S[-(i + 1)])
        ans -= 1
print(ans)

Fixed code:
N = int(input())
S = input()
T = input()

for i in range(N,0,-1):
    if S[-i:] == T[:i]:
        print(N*2 - i)
        exit()
print(N*2)
Buggy code:
n = int(input())
s = input()
t = input()

lst = []
for i in range(1,n+1):
    print(s[n-i:],t[:i])
    if s[n-i:] == t[:i]:
       lst.append(i+(n-i)*2)


if lst:
    print(min(lst))
else:
    print(n*2)



Fixed code:
n = int(input())
s = input()
t = input()

lst = []
for i in range(1,n+1):
    if s[n-i:] == t[:i]:
       lst.append(i+(n-i)*2)

if lst:
    print(min(lst))
else:
    print(n*2)
Buggy code:
N = int(input())
S = input()
T = input()
ans = S+T
for i in range(1,N+1):
    #print(S[-i:],T[:i])
    if S[-i:] == T[:i]:
        ans = S + T[i:]
print(ans)

Fixed code:
N = int(input())
S = input()
T = input()
ans = S+T
for i in range(1,N+1):
    #print(S[-i:],T[:i])
    if S[-i:] == T[:i]:
        ans = S + T[i:]
print(len(ans))
Buggy code:
N = int(input())
s = str(input())
t = str(input())

if s == t:
    print(N)
else:
    for i in range(N,0,-1):
        #print(s[N-i:],t[0:i],)
        if s[N-i:]==t[0:i]:
            print(2*N-i)
            break

Fixed code:
N = int(input())
s = str(input())
t = str(input())

if s == t:
    print(N)
else:
    for i in range(N,0,-1):
        #print(s[N-i:],t[0:i],)
        if s[N-i:]==t[0:i]:
            print(2*N-i)
            break
    else:
        print(2*N)
Buggy code:
n=int(input())
s=input()
t=input()
while True:
  if s==t:
    break
  s=s[1:]
  t=[:-1]
  n+=1
print(n)

Fixed code:
n=int(input())
s=input()
t=input()
while True:
  if s==t:
    break
  s=s[1:]
  t=t[:-1]
  n+=1
print(n)
Buggy code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
s = input()
t = input()
res = n*2
for i in range(n):
    if s[-i-1] == t[i]:
        res -= 1
    else:
        break
print(res)

Fixed code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
s = input()
t = input()
for i in range(n):
    for j in range(n-i):
        if s[i+j] != t[j]:
            break
    else:
        print(n+i)
        break
else:
    print(n*2)
Buggy code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
s = str(input())
t = str(input())

cnt = 0
for i in range(N):
    if s[i]==t[cnt]:
        cnt += 1
    else:
        cnt = 0
print(s+t[cnt:])

Fixed code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
s = str(input())
t = str(input())

for i in range(N):
    if s[i:]==t[:N-i]:
        break
else:
    i += 1
print(N+i)
Buggy code:
N = int(input())
s = input().strip()
t = input().strip()
k = 0
for i in range(1,N+1):
    if s[-i:]==t[:i]:
        k = i
        continue
    break
print(2*N-k)

Fixed code:
N = int(input())
s = input().strip()
t = input().strip()
k = 0
for i in range(1,N+1):
    if s[-i:]==t[:i]:
        k = i
        continue
print(2*N-k)
Buggy code:
n = int(input())
s = input()
t = input()

for i in range(n):
  if s[i:]==t[:n-i]:
    print(n-i)
    exit()




Fixed code:
n = int(input())
s = input()
t = input()
for i in range(n):
    if s == t:
        print(len(s))
        exit()
    if s[i:] == t[:n-i]:
        print(len(s+t[-i:]))
        exit()
print(len(s+t))
Buggy code:
n = int(input())
s = input()
t = input()
answer = n
for i in range (n) :
  newstring = s[0:i] + t[:n]
  if newstring[0:n] == s :
    answer += i
    break
print (answer)

Fixed code:
n = int(input())
s = input()
t = input()
answer = n
for i in range (n + 1) :
  newstring = s[0:i] + t[:n]
  if newstring[0:n] == s:
    answer += i
    break
print (answer)
Buggy code:
N = int(input())
s = str(input())
t = str(input())

if s==t:
    print(s)
    exit()

for i in range(1,N+1):
    ans = s + t[-i:]
    if ans[-N:] == t:
        break
print(ans)

Fixed code:
N = int(input())
s = str(input())
t = str(input())

if s==t:
    print(len(s))
    exit()

for i in range(1,N+1):
    ans = s + t[-i:]
    if ans[-N:] == t:
        break
print(len(ans))
Buggy code:
n = int(input())
s = input()
t = input()
cou = 0
for i in range(n):
  s1 = s[i:]
  t1 = t[:n-i]
#  print(s1,t1)
  if s1==t1:
    print(2*n-(n-i))


Fixed code:
n = int(input())
s = input()
t = input()
cou = 0
for i in range(n):
  s1 = s[i:]
  t1 = t[:n-i]
#  print(s1,t1)
  if s1==t1:
    print(2*n-(n-i))
    exit()
else:
  print(2*n)
Buggy code:
n=int(input())
s=input()
t=input()
c=0
for i in range(n):
    print(s[-i-1:])
    print(t[:i+1])
    if s[-i-1:]==t[:i+1]:
        c=i+1
print(n*2-c)


Fixed code:
n=int(input())
s=input()
t=input()
c=0
for i in range(n):
    if s[-i-1:]==t[:i+1]:
        c=i+1

ans=2*n-c
print(ans)
Buggy code:
N = int(input())
s = input()
t = input()

max_i = 0
for i in range(N):
    if s[N-i:] == t[:i]:
        max_i = i

ans = s[:N-max_i] + t
print(len(ans))


Fixed code:
N = int(input())
s = input()
t = input()

max_i = 0
for i in range(N+1):
    if s[N-i:] == t[:i]:
        max_i = i

ans = s[:N-max_i] + t
print(len(ans))
Buggy code:
n = int(input())
s = input()
t = input()
m = 0
for i in range(n):
  if t[i] == s[n-1-i]:
    m += 1
  else:
    break
print(n*2 - m)

Fixed code:
n=int(input())
s=input()
t=input()
yn=0
for i in range(n):
    if s[i:]==t[:n-i]:
        yn=1
        break
if yn==0:
    print(n*2)
else:
    print(n+i)
Buggy code:
n = int(input())
s = input()
t = input()
a = n
for i in range(n):
  if s[i:] == t[:-i]:
    a = i
    break
print(a+n)

Fixed code:
n = int(input())
s = input()
t = input()
a = n
if s == t:
  a = 0
else:
  for i in range(n):
    if s[i:] == t[:-i]:
      a = i
      break
print(a+n)
Buggy code:
n=int(input())
s=input()
t=input()
ans=0
for i in range(n):
  print(i,s[i:],t[:n-i])
  if s[i:] == t[:n-i]:
    ans = max(n-i,ans)
print(2*n-ans)

Fixed code:
n=int(input())
s=input()
t=input()
ans=0
for i in range(n):
  if s[i:] == t[:n-i]:
    ans = max(n-i,ans)
print(2*n-ans)
Buggy code:
N = int(input())
s = input()
t = input()
res = 2*N
for i in range(N):
    if s[i:N] == t[0:N-i]:
        res = N+1
        break
print(res)

Fixed code:
N=int(input())
s=input()
t=input()
res = 0
for i in range(N,-1,-1):
    if s[N-i:]==t[:i]:
        res = 2*N-i
        break
if res==0:
    res = 2*N
print(res)
Buggy code:
N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N+1):
  w = S[:i] + T
  if w[:N] == S and w[N:] == T:
    ans = min(ans,i+N)

for i in range(N+1):
  w = S + T[:i]
  if w[:N] == S and w[N:] == T:
    ans = min(ans,i+N)

print(ans)
    

Fixed code:
N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N):
  w = S + T[-(i+1):]
  if w[:N] == S and w[-N:] == T:
    ans = min(ans,i+N+1)

if S == T:
  ans = N
    
print(ans)
Buggy code:
N = int(input())

s = input()
t = input()

i = 0

while i < N:
    if s[i:] == t[:N-1]:
        break
    else:
        i+=1

print(N+i)

Fixed code:
N = int(input())

s = input()
t = input()

i = 0

while i < N:
    if s[i:] == t[:N-i]:
        break
    else:
        i+=1

print(N+i)
Buggy code:
n = int(input())
s = str(input())
t = str(input())
if s == t:
    print(n)
else:
    for i in range(1, n):
        l = s[:i + 1] + t
        if l[:n] == s:
            print(len(l))
            break

Fixed code:
n = int(input())
s = str(input())
t = str(input())
if s == t:
    print(n)
else:
    for i in range(n):
        l = s[:i + 1] + t
        if l[:n] == s:
            print(len(l))
            break
Buggy code:
N=int(input())
s=str(input())
t=str(input())
c=0
S=list(s)
T=list(t)
for i in range(N):
    if S[N-i-1]==T[i]:
        c+=1
print(2*N-c)


Fixed code:
N=int(input())
s=str(input())
t=str(input())
c=0
tmp=0
S=list(s)
T=list(t)
for i in range(N):
    if s[N-i-1:N]==t[0:i+1]:
        c=i+1
    #print(s[N-i-1:N],t[0:i+1])
#print(c)
print(2*N-c)
Buggy code:
n = int(input())
s = input()
t = input()
for i in range(n):
  cnt = 0
  for j in range(i, n):
    if s[j] != t[j-i]:
      break
    cnt += 1
  if cnt == n-i:
    ans = n+i
    break
print(ans)

Fixed code:
n = int(input())
s = input()
t = input()
for i in range(n):
  cnt = 0
  for j in range(i, n):
    if s[j] != t[j-i]:
      break
    cnt += 1
  if cnt == n-i:
    ans = n+i
    break
if cnt == 0:
  ans = 2*n
print(ans)
Buggy code:
n=int(input())
s=input()
t=input()

n_s=len(s)
n_t=len(t)
l=[]
for i in range(n_s):
    for j in range(n_t):
        l.append(s[:i]+t[j:])
ans=s+t
for c in l:
    if c[:n_s]==s and c[len(c)-n_t:]==t:
        if len(ans)>len(c):
            ans=c

print(ans)

Fixed code:
n=int(input())
s=input()
t=input()

n_s=len(s)
n_t=len(t)
l=[]
for i in range(n_s):
    for j in range(n_t):
        l.append(s[:i]+t[j:])
ans=s+t
for c in l:
    if c[:n_s]==s and c[len(c)-n_t:]==t:
        if len(ans)>len(c):
            ans=c

print(len(ans))
Buggy code:
N=int(input())
s=list(input())
t=list(input())
f=s+t
if s==t:
    print(s)
    exit()
for i in range(0,N):
    if s[-i:]==t[:i]:
        f=s+t[i:]
print(f)

Fixed code:
N=int(input())
s=list(input())
t=list(input())
f=s+t
if s==t:
    print(len(s))
    exit()
for i in range(0,N):
    if s[-i:]==t[:i]:
        f=s+t[i:]
print(len(f))
Buggy code:
N = int(input())
s = list(input())
t = list(input())
cnt = 0
if s==t:
    ans = N
else:
    for i in range(N):
        if s[i:]==t[:-i]:
            ans = N*2 - (N-i)
print(ans)

Fixed code:
N = int(input())
s = list(input())
t = list(input())
cnt = 0
if s==t:
    ans = N
    cnt = 1
elif N==1:
    ans = N*2
    cnt = 1
else:
    for i in range(N):
        if s[i:]==t[:-i]:
            cnt = 1
            ans = N*2 - (N-i)
print(ans) if cnt==1 else print(N*2)
Buggy code:
n=int(input())
s=input()
t=input()
if s==t:
  print(n)
  exit()
for i in range(1,n-1):
  if s[i+1:] == t[:-i-1]:
    print(n+i)
    break

Fixed code:
n=int(input())
s=input()
t=input()

for i in range(n+1):
    #print(s[i:],t[:n-i])
    if s[i:]==t[:n-i]:
        print(n+i)
        exit()
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
s = input()
t = input()
for i in range(n):
    if s[i:] == t[:n - i]:
        print(n + i)
        exit()
    print(s[i:], t[:n - i])
print(n * 2)


Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
s = input()
t = input()
for i in range(n):
    if s[i:] == t[:n - i]:
        print(n + i)
        exit()
print(n * 2)
Buggy code:
N=int(input())
S=input()
T=input()
s=[str(c) for c in (S)]
t=[str(c) for c in (T)]
flag=0
score=N
for i in range (N,2*N):
  for j in range(N+N-i):
    flag=0
    if s[i-N+j]!=t[j]:
      flag=1
  if flag==0:
    score=i
    flag=2
  if flag==2:
    break
print(score)

Fixed code:
N=int(input())
S=input()
T=input()
s=[str(c) for c in (S)]
t=[str(c) for c in (T)]
flag=0
score=N
for i in range (N,2*N):
  flag=0
  for j in range(N+N-i):
    if s[i-N+j]!=t[j]:
      flag=1
  if flag==0:
    score=i
    flag=2
  if flag==2:
    break
if flag==1:
  score=2*N
print(score)
Buggy code:
N = int(input())
S = input()
T = input()

best = float('inf')
for i in range(len(T)):
    s = S + T[i:]
    if s[::-1][:N][::-1] == T:
        best = min(best, len(s))

print(best)

Fixed code:
N = int(input())
S = input()
T = input()

best = float('inf')
for i in range(len(T)+1):
    s = S + T[i:]
    if s[::-1][:N][::-1] == T:
        best = min(best, len(s))

print(best)
Buggy code:
N = int(input())
S = input()
T = input()

ans = 2*N
for i in range(N):
  if S[N-1-i] == T[i]:
    ans -= 1
  else:
    break
    
print(ans)

Fixed code:
N = int(input())
S = input()
T = input()

if S == T:
    print(N)
else:
    ans = 2 * N
    for i in range(N):
        if S[i:] == T[:N - i]:
            ans -= len(S[i:])
            break
    print(ans)
Buggy code:
N = int(input())
s = input()
t = input()
ans = s+t
for i in range(N):
    print(s[i:], t[:N-i])
    if s[i:] == t[:N-i]:
        ans = s[:i]+t
print(len(ans))

Fixed code:
N = int(input())
s = input()
t = input()
ans = len(s) + len(t)
for i in range(N) :
    if s[N - 1 - i :] == t[:i + 1] :
        ans = len(s) + len(t) - (i + 1)
print(ans)
Buggy code:
n = int(input())
s = input()
t = input()

sf = s[0:n]
tf = t[-n:]

ans = []

for i in range(len(sf)):
    if (sf[i] in tf):
        for j in range(0, len(sf) - i):
            if (sf[i + j] != tf[j]):
                break
        else:
            ans.append(tf)
            #print(tf)
            break

    else:
        ans.append(sf[i])
#        print(sf[i],end="")
else:
    ans.append(tf)
    #print(tf)
print(len(ans))


Fixed code:
n = int(input())
s = input()
t = input()


ans = []

for i in range(n):
    if (s[i] == t[0]):
        for j in range(0, n - i):
            if (s[i + j] != t[j]):
                break
        else:
            ans+=t
            #print(t)
            break

    #else:
    ans.append(s[i])
#        print(s[i],end="")
else:
    ans+=t
    #print(t)
#print(ans)
print(len(ans))
Buggy code:
n = int(input())
s = input()
t = input()

if s == t:
  print(n)
  exit()

ans = ''
for i in range(n):
  ss = s[n-i-1:]
  tt = t[:i+1]
  if ss == tt:
    ans = s[:n-i-1]+t[i+1:]

if len(ans) == 0:
  print(len(s+t))
else:
  print(len(ans))
  

Fixed code:
n = int(input())
s = input()
t = input()

if s == t:
  print(n)
  exit()

ans = ''
for i in range(n):
  ss = s[n-i-1:]
  tt = t[:i+1]
  if ss == tt:
    ans = s[:n-i-1]+ss+t[i+1:]
if len(ans) == 0:
  print(len(s+t))
else:
  print(len(ans))
Buggy code:
n = int(input())
s = input()
t = input()

for i in reversed(range(n)):
	j = (-1) * i - 1
	if t[:(i+1)] == s[j:]:
		break
	else:
		continue

if i == 0:
	print(len(s + t))
else:
	print(len(s[:j] + t))

Fixed code:
n = int(input())
s = input()
t = input()

flag = 0

for i in reversed(range(n)):
	j = (-1) * i - 1
	if t[:(i+1)] == s[j:]:
		flag = 1
		break
	else:
		continue

if i == 0 and flag == 0:
	print(len(s + t))
else:
	print(len(s[:j] + t))
Buggy code:
N = int(input())
s = input()
t = input()
ans = s + t

for i in range(N):
    if(s[i:] == t[:(len(t)-i)]):
        ans = s + t[-i:]

print(ans if s != t else s)

Fixed code:
N = int(input())
s = input()
t = input()
ans = s + t

for i in range(N):
    if(s[i:] == t[:(len(t)-i)]):
        ans = s + t[-i:]

print(len(ans) if s != t else N)
Buggy code:
N=int(input())
s=input()
t=input()
for i in range(len(s),-1,-1):
  if s[-i:]==t[:i]:
    break
print(s+t[i:])

Fixed code:
N = int(input())
s = input()
t = input()
for i in range(min(len(s), len(t)), -1, -1):
    if s[len(s) - i:] == t[:i]:
        print(len(s) + len(t) - i)
        break