Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# import numpy as np

n = int(input())
s = input()

# dp = np.zeros([n+1, n+1])
dp = [0] * (n+1)

for dif in range(1,n):
    count = 0
    t_max = 0
    for l1_r in range(0, n-dif):
        if(s[l1_r] == s[l1_r + dif]):
            count += 1
            t_max = max(count, t_max)
            if( count == dif):
                dp[dif] = count
                break
        else:
            count = 0
    dp[dif] = t_max

print(max(dp))    

### FIXED CODE ###

# import numpy as np

n = int(input())
s = input()

# dp = np.zeros([n+1, n+1])
dp = [0] * (n+1)

for dif in range(1,n):
    count = 0
    t_max = 0
    for l1_r in range(0, n-dif):
        if(s[l1_r] == s[l1_r + dif]):
            count += 1
            t_max = max(count, t_max)
            if( count == dif):
                dp[dif] = count
                break
        else:
            count = 0
    dp[dif] = t_max

print(max(dp))
### BUGGY CODE ###

def gcd(a,b):
    while b:
        a,b==b,a%b
    return a
def lcm(a,b):
    return a//gcd(a,b)*b
 
n=int(input())
a=[int(i) for i in input().split()]
L=a[0]
for i in a:
    if L%i!=0:
        L=lcm(L,i)
L%=(10**9+7)
ans=0
for i in a:
    ans=(ans+L//i)%(10**9+7)
print(ans)

### FIXED CODE ###

from fractions import gcd
def lcm(a,b):
    return a//gcd(a,b)*b

n=int(input())
a=[int(i) for i in input().split()]
L=a[0]
for i in a:
    L=lcm(L,i)
ans=0
for i in a:
    ans+=L//i
print(ans%(10**9+7))
### BUGGY CODE ###

from collections import deque
def resolve():
    N, M, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    read = deque()
    w = 0
    while w <= K:
        if len(A) == 0 and len(B) == 0:
            break

        if len(A) == 0:
            if w + B[0] <= K:
                read.append(B[0])
                w += B[0]
            B.pop(0)
            continue

        if len(B) == 0:
            if w + A[0] <= K:
                read.append(A[0])
                w += A[0]
            A.pop(0)
            continue

        if A[0] < B[0]:
            if w + A[0] <= K:
                read.append(A[0])
                w += A[0]
            A.pop(0)
        else:
            if w + B[0] <= K:
                read.append(B[0])
                w += B[0]
            B.pop(0)

    print(len(read))


resolve()

### FIXED CODE ###

def resolve():
    N, M, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    ans = 10 ** 10
    t = 0

    for i in range(M):
        t += B[i]
    j = M
    ans = 0
    for i in range(N+1):
        while j > 0 and t > K:
            j -= 1
            t -= B[j]
        
        if t > K:
            break
        
        ans = max(ans, i+j)
        
        if i == N:
            break
        t += A[i]
    
    print(ans)

resolve()
### BUGGY CODE ###

def permutation(n,k):
    ans=1
    for i in range(k):
        ans*=(n-i)%1000000007
    return ans%1000000007
num_vertax,num_coler=map(int,input().split())
ver_array=[0 for i in range(num_vertax)]
for i in range(num_vertax-1):
    a,b=map(int,input().split())
    ver_array[a-1]+=1
    ver_array[b-1]+=1
ans=num_coler
top=1
for ver in ver_array:
    ans*=permutation(num_coler-2+top,ver+top-1)
    top=0
print(ans%1000000007)

### FIXED CODE ###

N,K=map(int,input().split())
mod=1000000007
path=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  a=a-1
  b=b-1
  path[a].append(b)
  path[b].append(a)
#print(path)
  
abc=[False for i in range(N)] #0ならまだ塗ってない
 
abc[0]=True
cnt=0
ans=K%mod
nx=[]
for i in range(len(path[0])):
  child=path[0][i]
  if abc[child]:
    continue
  ans=ans*(K-1-cnt)
  ans=ans%mod
  cnt=cnt+1
  abc[child]=True
  nx.append(child)
while len(nx)>0:
  a=nx.pop()
  cnt=0
  for i in range(len(path[a])):
    child=path[a][i]
    if abc[child]:
      continue
    ans=ans*(K-2-cnt)
    ans=ans%mod
    cnt=cnt+1
    abc[child]=True
    nx.append(child)
      
print(ans%mod)
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]

if N % 2:
    if A.count(0) != 1:
        flg = 0
    else:
        if all(A.count(i) == 2 for i in range(2, N, 2)):
            flg = 1
        else:
            flg = 0
else:
    if all(A.count(i) == 2 for i in range(1, N, 2)):
        flg = 1
    else:
        flg = 0

if flg:
    ans = 2 ** (N//2) % (10**9+7)
else:
    ans = 0

print(ans)


### FIXED CODE ###

from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
c = Counter(A)

flg = 0
if N % 2:
    if c[0] != 1:
        flg = 1
    else:
        for i in range(2, N, 2):
            if c[i] != 2:
                flg = 1
                break
else:
    for i in range(1, N, 2):
        if c[i] != 2:
            flg = 1
            break

if flg:
    ans = 0
else:
    ans = 2 ** (N//2) % (10**9+7)

print(ans)
### BUGGY CODE ###

S = input()
N = len(S)
l = [0]*2019
n = 0
out = 0
for i in range(N-1, -1, -1):
    n += int(S[i]) * (10**(N-1 - i))
    r = n % 2019
    l[r] += 1
for i in range(2019):
    m = l[i]
    out += (m*(m-1))//2 
    if i == 0:
        out += m
print(out)

### FIXED CODE ###

S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse = True)
a = [[f[i]*a[i], f[i], a[i]] for i in range(n)]
a.sort(reverse = True)
for i in range(k):
    if a[0][-1] > 0:
        a[0][-1] -= 1
        a = [a[i][-1] for i in range(n)]
        a.sort()
        a = [[f[i]*a[i], f[i], a[i]] for i in range(n)]
        a.sort(reverse = True)
    else:
        break
print(a[0][0])

### FIXED CODE ###

def main():

    import numpy as np
    
    n, k = map(int, input().split())
    a = np.array(input().split(), np.int64)
    f = np.array(input().split(), np.int64)
    a.sort()
    a = a[::-1]
    f.sort()
    right = np.max(a*f)
    left = 0
    while right > left:
        middle = (right + left)//2
        b = 0
        
        if np.sum(np.maximum(a-middle//f, 0)) <= k:
            right = middle
        else:
            left = middle+1

    print(right)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

# L, R, U, D方向の照らされるマス数を事前に計算
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

for i in range(H):
  for j in range(W):
    road = S[i][::-1][W - j - 1:]
    cnt = 0
    for k in road:
      if k == ".":
        cnt += 1
      else:
        break
    L[i][j] = cnt
    
    road = S[i][j:]
    cnt = 0
    for k in road:
      if k == ".":
        cnt += 1
      else:
        break
    R[i][j] = cnt

# 転置行列を準備
ST = list(map(list, zip(*S)))

for i in range(W):
  for j in range(H):
    road = ST[i][::-1][H - j - 1:]
    cnt = 0
    for k in road:
      if k == ".":
        cnt += 1
      else:
        break
    U[j][i] = cnt

    road = ST[i][j:]
    cnt = 0
    for k in road:
      if k == ".":
        cnt += 1
      else:
        break
    D[j][i] = cnt

ans = 0
for i in range(H):
  for j in range(W):
    ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

# L, R, U, D方向の照らされるマス数を事前に計算
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

for i in range(H):
  for j in range(W):
    if S[i][j] == "#":
      L[i][j] = 0
    elif j == 0:
      L[i][j] = 1
    else:
      L[i][j] = L[i][j - 1] + 1

for i in range(H):
  for j in reversed(range(W)):
    if S[i][j] == "#":
      R[i][j] = 0
    elif j == W - 1:
      R[i][j] = 1
    else:
      R[i][j] = R[i][j + 1] + 1

for i in range(H):
  for j in range(W):
    if S[i][j] == "#":
      U[i][j] = 0
    elif i == 0:
      U[i][j] = 1
    else:
      U[i][j] = U[i - 1][j] + 1

for i in reversed(range(H)):
  for j in range(W):
    if S[i][j] == "#":
      D[i][j] = 0
    elif i == H - 1:
      D[i][j] = 1
    else:
      D[i][j] = D[i + 1][j] + 1

ans = 0
for i in range(H):
  for j in range(W):
    ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)
### BUGGY CODE ###

def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    ans = 0

    for i in range(N):
        if P[i] <= min(P[j] for j in range(i+1)):
            ans += 1

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

### FIXED CODE ###

def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    ans = 0
    minP = P[0]

    for i in range(N):
        minP = min(minP, P[i])
        if P[i] <= minP:
            ans += 1
    
    print(ans)
        
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
    p[i]-=1
ans=max(c)
for i in range(n):
    f=i
    r=0
    l=[]
    while True:
        f=p[f]
        l.append(c[f])
        r+=c[f]
        if f==i:
            break
    t=0
    for j in range(len(l)):
        t+=l[j]
        if j+1>k:
            break
        ret=t
        if r>0:
            e=(k-j-1)//len(l)
            ret+=r*e
        ans=max(ans,ret)
print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
    p[i]-=1
ans=max(c)
for i in range(n):
    f=i
    r=0
    l=[]
    while True:
        f=p[f]
        l.append(c[f])
        r+=c[f]
        if f==i:
            break
    t=0
    for j in range(len(l)):
        t+=l[j]
        if j+1>k:
            break
        ret=t
        if r>0:
            e=(k-j-1)//len(l)
            ret+=r*e
        ans=max(ans,ret)
print(ans)
### BUGGY CODE ###

N = int(input())
S = input()

from collections import defaultdict
d = defaultdict(list)

for i,s in enumerate(S):
    d[s].append(i)

Bs = [0] * 8000
cnt_b = len(d["B"])

for i in  d["B"]:
    Bs[i] += 1

ans = 0
for i_r in d["R"]:
    for i_g in d["G"]:
        ls = []
        mx = max(i_r,i_g)
        mn = min(i_r,i_g)
        if (mx-mn) % 2 == 0:
            ls.append((mx+mn)//2)    
        ls.append(mx + (mx-mn))
        if  mn - (mx-mn) >= 0: 
            ls.append(mn-(mx-mn)) 
        cnt = 0
        for l in ls:
            cnt += Bs[l]
        # print(i_r,i_g,ls)
        ans += cnt_b - cnt
print(ans)

### FIXED CODE ###

N = int(input())
S = input()

from collections import defaultdict
d = defaultdict(list)

for i,s in enumerate(S):
    d[s].append(i)

Bs = [0] * 8000
cnt_b = len(d["B"])

for i in  d["B"]:
    Bs[i] += 1

ans = 0
for i_r in d["R"]:
    for i_g in d["G"]:
        ls = []
        mx = max(i_r,i_g)
        mn = min(i_r,i_g)
        if (mx-mn) % 2 == 0:
            ls.append((mx+mn)//2)    
        ls.append(mx + (mx-mn))
        if  mn - (mx-mn) >= 0: 
            ls.append(mn-(mx-mn)) 
        cnt = 0
        for l in ls:
            cnt += Bs[l]
        # print(i_r,i_g,ls)
        ans += cnt_b - cnt
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input().strip())
from itertools import combinations
nodes = list(combinations(range(N), 2))
graph = {i:[] for i in nodes}
for x in range(N):
  l = list(map(int,input().split()))
  y = l[0]-1
  prev = (min(x,y),max(x,y))
  for y in l[1:]:
    y -= 1
    now = (min(x,y),max(x,y))
    graph[prev].append(now)
    prev = now

d = {k:1 for k in nodes}
in_cnt = {k:0 for k in nodes}
for x in nodes:
  for y in graph[x]:
    in_cnt[y] += 1
q = [i for i in nodes if not in_cnt[i]]
if not q:
  print(-1)
  exit()
ans = 0
while q:
  x = q.pop()
  for y in graph[x]:
    d[y] = max(d[y],d[x]+1)
    ans = max(ans,d[y])
    in_cnt[y] -= 1
    if not in_cnt[y]:
      q.append(y)
if [i for i in nodes if in_cnt[i]]:
  print(-1)
  exit()

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input().strip())
M = N*(N-1)//2

graph = [[] for i in range(M)]
in_cnt = [0 for i in range(M)]
for x in range(1,N+1):
  l = list(map(int,input().split()))
  y = l[0]
  b,s = max(x,y),min(x,y)
  prev = (b-1)*(b-2)//2+s-1
  for y in l[1:]:
    b,s = max(x,y),min(x,y)
    now = (b-1)*(b-2)//2+s-1
    graph[prev].append(now)
    in_cnt[now] += 1 
    prev = now

d = [1 for k in range(M)]
q = [i for i in range(M) if not in_cnt[i]]

if not q:
  print(-1)
  exit()
ans = 0
while q:
  x = q.pop()
  for y in graph[x]:
    d[y] = max(d[y],d[x]+1)
    ans = max(ans,d[y])
    in_cnt[y] -= 1
    if not in_cnt[y]:
      q.append(y)
if [i for i in range(M) if in_cnt[i]]:
  print(-1)
  exit()

print(ans)
### BUGGY CODE ###

n = int(input())

count = 0
table = [[0 for i in range(26)] for _ in range(n)]

for i in range(n):
    for s in str(input()):
        table[i][ord(s)-97] += 1

for i in range(n):
    for j in range(i+1, n):
        if table[i] == table[j]:
            count += 1

print(count)

### FIXED CODE ###

n = int(input())
 
string = {}
count = 0

for i in range(n):
    base = sorted(input())

    if string.get("".join(base)) != None:
        count += int(string["".join(base)])
        string["".join(base)] += 1
    else:
        string["".join(base)] = 1

print(count)
### BUGGY CODE ###

a, b = map(int, input().split())
for i in range(a, b):
  a *= i
if a < 0 :
  print("Negative")
elif a == 0:
  print("Zero")
else:
  print("Positive")
  

### FIXED CODE ###

a, b = map(int, input().split())
if a > 0 :
  print("Positive")
elif b < 0 :
  if (b - a) % 2 == 0 :
      print("Negative")
  else:
      print("Positive")
else:
   print("Zero")
### BUGGY CODE ###

n = int(input())
r = list(map(int,input().split(" ")))
l = []
ar = {}
s = sum(r)
for a in r:
    if a not in l:
        ar[a] = 1
        l.append(a)
    else:
        ar[a] += 1
q = int(input())
for i in range(q):
    x,y = map(int,input().split(" "))
    if x in l:
        s += (y - x) * ar[x]
        if y in l:
            ar[y] += ar[x]
        else:
            ar[y] = ar[x]
            l.append(y)
        ar[x] = 0
    print(s)

### FIXED CODE ###

n = int(input())
r = list(map(int,input().split(" ")))
ar = {i: 0 for i in range(1,10 ** 5 + 1)}
s = sum(r)
for a in r:
    ar[a] += 1
q = int(input())
for i in range(q):
    x,y = map(int,input().split(" "))
    s += (y - x) * ar[x]
    ar[y] += ar[x]
    ar[x] = 0
    print(s)
### BUGGY CODE ###

import queue


def make_state(N):
    state = [[-1 for j in range(N+1)] for i in range(N+1)]
    min_state = 0
    s = min_state
    for i in range(1, N+1):
        for j in range(1, i):
            state[i][j] = s
            state[j][i] = s
            s += 1
    return state


def solve(N, A):
    state = make_state(N)
    max_state = N * (N-1) // 2
    prev_states = [[] for i in range(max_state)]
    next_states = [[] for i in range(max_state)]
    for i in range(1, N+1):
        for k in range(N-2):
            ps = state[i][A[i][k]]
            ns = state[i][A[i][k+1]]
            prev_states[ns].append(ps)
            next_states[ps].append(ns)
    
    n_days = 0
    active_states = set(range(max_state))
    q = queue.Queue()
    while len(active_states) > 0:
        n_days += 1
        for s in active_states:
            if len(prev_states[s]) == 0:
                q.put(s)
        if q.empty():
            return -1
        while not q.empty():
            s = q.get()
            for ns in next_states[s]:
                prev_states[ns].remove(s)
            active_states.remove(s)
    return n_days


def main():
    N = int(input())
    A = list()
    A.append([])
    for i in range(N):
        a = list(map(int, input().strip().split()))
        A.append(a)
    print(solve(N, A))


if __name__ == "__main__":
    main()


### FIXED CODE ###

def make_state(N):
    state = [[-1 for j in range(N+1)] for i in range(N+1)]
    min_state = 0
    s = min_state
    for i in range(1, N+1):
        for j in range(1, i):
            state[i][j] = s
            state[j][i] = s
            s += 1
    return state


def solve(N, A):
    state = make_state(N)
    max_state = N * (N-1) // 2
    n_prev_states = [0 for i in range(max_state)]
    next_states = [set() for i in range(max_state)]
    for i in range(1, N+1):
        for k in range(N-2):
            ps = state[i][A[i][k]]
            ns = state[i][A[i][k+1]]
            n_prev_states[ns] += 1
            next_states[ps].add(ns)
    
    today_states = set()
    for s in range(max_state):
        if n_prev_states[s] == 0:
            today_states.add(s)
    
    n_days = 0
    n_states_left = max_state
    while len(today_states) > 0:
        n_days += 1
        if len(today_states) == 0:
            break
        n_states_left -= len(today_states)
        nextday_states = set()
        for s in today_states:
            for ns in next_states[s]:
                n_prev_states[ns] -= 1
                if n_prev_states[ns] == 0:
                    nextday_states.add(ns)
        today_states = nextday_states
    return n_days if n_states_left == 0 else -1


def main():
    N = int(input())
    A = list()
    A.append([])
    for i in range(N):
        a = list(map(int, input().strip().split()))
        A.append(a)
    print(solve(N, A))


if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,x=map(int,input().split())
if x==1 or x==2*n-1:
    print('No')
else:
    print('Yes')
    l=[]
    r=[1,x,2*n-1]
    for i in range(2,2*n-1):
        if i!=x:
            l.append(i)
    #print(l,r)
    for i in range(1,2*n):
        if i==n:
            print(x)
        elif i==n-1:
            print(1)
        elif i==n+1:
            print(2*n-1)
        else:
            print(l[0])
            l=l[1:]

### FIXED CODE ###

n,x=map(int,input().split())
if x==1 or x==2*n-1:
    print('No')
else:
    print('Yes')
    if x<=n-1:
        for i in range(2,x):
            print(i)
        for i in range(x+1,n+1):
            print(i)
        print(1);print(x);print(2*n-1)
        for i in range(n+1,2*n-1):
            print(i)
    else:
        for i in range(2,n):
            print(i)
        print(1);print(x);print(2*n-1)
        for i in range(n,x):
            print(i)
        for i in range(x+1,2*n-1):
            print(i)
### BUGGY CODE ###

from sys import setrecursionlimit, stdin


def f(i, links, dp):
    if dp[i] != -1:
        return dp[i]
    if len(links[i]) == 0:
        dp[i] = 0
    else:
        dp[i] = max(f(j, links, dp) for j in links[i]) + 1
    return dp[i]


setrecursionlimit(10 ** 6)
readline = stdin.readline

N, M = map(int, readline().split())

links = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, readline().split())
    links[x - 1].append(y - 1)

dp = [-1] * N
print(max(f(i, links, dp) for i in range(N)))


### FIXED CODE ###

from sys import setrecursionlimit


def f(i, links, dp):
  if dp[i] != -1:
    return dp[i]
  if len(links[i]) == 0:
    dp[i] = 0
  else:
    dp[i] = max(f(j, links, dp) for j in links[i]) + 1
  return dp[i]


setrecursionlimit(1000000)

N, M = map(int, input().split())

links = [[] for _ in range(N)]
for _ in range(M):
  x, y = map(int, input().split())
  links[x - 1].append(y - 1)

dp = [-1] * N
print(max(f(i, links, dp) for i in range(N)))
### BUGGY CODE ###

N,Q = map(int,input().split())
AB = [[] for _ in range(N-1)]
for n in range(N-1):
    AB[n] = list(map(int,input().split()))
PX = [[] for _ in range(Q)]
for q in range(Q):
    PX[q] = list(map(int,input().split()))
graph = [[] for _ in range(N+1)]
for ab in AB:
    graph[ab[0]].append(ab[1])
    graph[ab[1]].append(ab[0])
val = [0] * (N+1)
for px in PX:
    val[px[0]] += px[1]
parent = [0] * (N+1)
Q  = [1]
while Q:
    q = Q.pop()
    for c in graph[q]:
        if c == parent[q]:
            continue
        parent[c] = q
        Q.append(c)
        val[c] += val[q]
print(*val[1:])

### FIXED CODE ###

N,Q = map(int,input().split())
AB = [[] for _ in range(N-1)]
for n in range(N-1):
    AB[n] = list(map(int,input().split()))
PX = [[] for _ in range(Q)]
for q in range(Q):
    PX[q] = list(map(int,input().split()))
graph = [[] for _ in range(N+1)]
for ab in AB:
    graph[ab[0]].append(ab[1])
    graph[ab[1]].append(ab[0])
val = [0] * (N+1)
for px in PX:
    val[px[0]] += px[1]
parent = [0] * (N+1)
from collections import deque
Q  = deque([1])
while Q:
    q = Q.popleft()
    for c in graph[q]:
        if c == parent[q]:
            continue
        parent[c] = q
        Q.append(c)
        val[c] += val[q]
print(*val[1:])
### BUGGY CODE ###

# 長さNの文字列Sについて、i=2,3,...,N でのSのi文字目以降から成る文字列とSの最長共通接頭辞の長さ O(N) 
def z_algo(S):
    N = len(S)
    A = [0]*N
    i = 1; j = 0
    A[0] = l = len(S)
    while i < l:
        while i+j < l and S[j] == S[i+j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while l-i > k < j - A[k]:
            A[i+k] = A[k]
            k += 1
        i += k; j -= k
    return A
  
N = int(input())
S = input()

ans = 0
for i in range(N):
  SS = S[i:]
  lcp = z_algo(SS)
  for j in range(len(lcp)):
    l = min(lcp[j], j)
    ans = max(ans, l)

print(ans)

### FIXED CODE ###

n = int(input())
s = input()

l = 0
r = 1
ans = 0
# 順番に見ていく

while r < n:
  if s[l:r] in s[r:]:
    ans = max(ans, r - l)
    r += 1
  else:
    l += 1
  if l == r:
    l += 1
    r += 2
print(ans)
### BUGGY CODE ###

_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]

for s, e in sorted(arms, key=lambda k:k[1]):
    if t <= s:
        t = e
    else:
        arms.remove((s, e))

print(len(arms))

### FIXED CODE ###

_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]
arms_sorted = sorted(arms, key=lambda k:k[1])

ans = 0

for s, e in arms_sorted:
    if t <= s:
        t = e
        ans += 1
        
print(ans)
### BUGGY CODE ###

n=int(input())
nums=input().split()
firstl=len(nums)
nums.sort()
nums_uniq=[]

for n in nums:
    if n not in nums_uniq:
        nums_uniq.append(n)

#print('uniqnum',nums_uniq)
s=0
for num in nums_uniq:
    s+=int(num)
if len(nums)-s>0:
    print(len(nums)-s)
else:
    k=0
    for p in nums_uniq:
        if nums.count(p)==int(p):
            continue
        else:
            if nums.count(p)>int(p):
                while nums.count(p)>int(p):
                    #print('remove',p)
                    nums.remove(p)
                    k+=1
            else:
                while nums.count(p)>0:
                    #print('remove',p)
                    nums.remove(p)
                    k+=1
    print(k)

### FIXED CODE ###

from collections import Counter
n=int(input())
counter=Counter(map(int,input().split()))
print(sum(c-num if c>=num else c for num,c in counter.items()))
### BUGGY CODE ###

N = int(input())
a_lst = [int(x) for x in input().split()]

max_a = -1
max_cnt = -1

for a in a_lst:
    if max_a < a:
        max_a = a
for x in range(max_a + 1):
    cnt = 0
    for a in a_lst:
        if x - 1 <= a and a <= x + 1:
            cnt += 1
    if max_cnt < cnt:
        max_cnt = cnt
print(max_cnt)


### FIXED CODE ###

N = int(input())
a_lst = [int(x) for x in input().split()]

dict = {}

for a in a_lst:
    if not a - 1 in dict.keys():
        dict[a - 1] = 1
    else:
        dict[a - 1] += 1
    if not a in dict.keys():
        dict[a] = 1
    else:
        dict[a] += 1
    if not a + 1 in dict.keys():
        dict[a + 1] = 1
    else:
        dict[a + 1] += 1
val_lst = list(dict.values())
val_lst.sort(reverse=True)
print(val_lst[0])
### BUGGY CODE ###

N,K,Q=map(int,input().split())
import numpy as np
B=np.array([K]*N)
for i in range(Q):
  A=int(input())
  if A==1:
    B[1:]-=1
  elif A==N:
    B[:-2]-=1
  else:
    B[:A-1]-=1
    B[A:]-=1
for i in range(N):
  if B[i]>0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

N,K,Q=map(int,input().split())
B=[0]*N
def minu(n):
  return n-1
for i in range(Q):
  A=int(input())
  B[A-1]+=1
for i in range(N):
  if B[i]>Q-K:
    print("Yes")
  else:
    print("No")