Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
n_list = [0] * N
max_length = 0
for i in range(N):
    for j in range(max_length,N):
        if S[i:j] in S[j:N]:
            continue
        else:
            current_length = j-i-1
            if current_length > max_length:
                max_length = current_length
            break
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
max_length = 0
for i in range(N):
    j = i + 1
    while S[i:j] in S[j:N]:
        current_length = j-i
        if current_length > max_length:
            max_length = current_length
        j += 1
    '''
    #for j in range(i+1,N):
        if S[i:j] in S[j:N]:
            continue
        else:
            current_length = j-i-1
            if current_length > max_length:
                max_length = current_length
            break
    '''
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
max_length = 0
for i in range(N):
    for j in range(i+1,N):
        if S[i:j] in S[j:N]:
            continue
        else:
            current_length = j-i-1
            if current_length > max_length:
                max_length = current_length
            break
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
max_length = 0
for i in range(N):
    max_j = (N -i)//2
    for j in range(max_j):
        current_length = max_j-j
        if S[i:i+current_length] in S[i+current_length:N]:
            if current_length > max_length:
                max_length = current_length
            break
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
dp = [0] * N
min_selct = N//2
max_length = 0
for i in range(N):
    max_j = (N -i)//2
    for j in range(max_j):
        current_length = max_j-j
        if S[i:i+current_length] in S[i+current_length:N]:
            max_length = max(max_length,current_length)
            break
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
dp = [0] * N
min_selct = N//2
max_length = 0
for i in range(N):
    max_j = (N -i)//2
    for j in range(max_j):
        current_length = max_j-j
        if S[i+current_length:N].find(S[i:i+current_length]) >= 0:
            max_length = max(max_length,current_length)
            break
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
dp = [0] * N
min_selct = N//2
max_length = 0
for i in range(N):
    for j in range((N -i)//2): 
        if S[i+j+1:N].find(S[i:i+j+1]) >= 0:
            max_length = max(max_length,j+1)
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =  input()
dp = [0] * N
min_selct = N//2
max_length = 0
for i in range(N):
    for j in range(N -i): 
        if S[i+j+1:N].find(S[i:i+j+1]) >= 0:
            max_length = max(max_length,j+1)
print(max_length)

Fixed submission:
n = int(input())
S = input()
N = [0]*n
j = 0
 
for i in range(n):
  while S[i:j] in S[j:n]:
    N[i] = j-i
    j += 1
    
print(max(N))