Harryxun/stf_run huggingface dataset:
#coding:utf-8
N,M=map(int,raw_input().split())
A=map(int,raw_input().split())
dp=[-1 for i in range(N + 1)]
Cost={(i+1):v for i,v in enumerate([2,5,5,4,5,6,3,7,6])}

for a in A:
    dp[Cost[a]]=1
for n in range(N+1):
    for a in A:
        if dp[n-Cost[a]] != -1:
            dp[n]=max(dp[n], dp[n-Cost[a]]+1)
k=dp[N]
n=N
buf=[]
if dp[N]-1>=0:
    for i in range(dp[N]-1):
        b=-1
        for a in A:
            if dp[n-Cost[a]] == k-1:
                b=max(b,a)
            
        k-=1
        n-=Cost[b]
        buf.append(b)
b=-1
for a in A:
    if Cost[a] == n:
        b=max(b,a)
buf.append(b)
print("".join(map(str,buf)))







### FIXED CODE ###

#coding:utf-8
N,M=map(int,raw_input().split())
A=map(int,raw_input().split())
dp=[-1 for i in range(10**4 + 1)]
Cost={(i+1):v for i,v in enumerate([2,5,5,4,5,6,3,7,6])}

for a in A:
    dp[Cost[a]]=1
for n in range(2,N+1):
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] != -1:
            dp[n]=max(dp[n], dp[n-Cost[a]]+1)
k=dp[N]
n=N
buf=[]
for i in range(dp[N]-1):
    b=-1
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] == k-1:
            b=max(b,a)
    k-=1
    n-=Cost[b]
    buf.append(b)
b=-1
for a in A:
    if Cost[a] == n:
        b=max(b,a)
buf.append(b)   
print("".join(map(str,buf)))
n = int(input())
a = list(map(int, input().split()))
a_joined = 0

for i in range(n):

	a_joined = a_joined | a[i]

a_joined = a_joined & -(a_joined)
print(len(bin(a_joined)) - 3)

### FIXED CODE ###

print(str(input()).count("1"))
[N,M] = list(map(int,input().split()))
a = []
for i in range(M):
    a.append(int(input()))

#print(a)
dp = [0] * (N+1)
dp[0]=1
if a[0]!=1:
    dp[1]=1
#dp[1]=1
j=0
for i in range(1,N+1):
    if M!=0:
        if i==a[j]:
            dp[i] = 0
            j+=1
            if j==len(a):
                j=0

        else:
            dp[i] = dp[i-1] + dp[i-2]
    else:
        dp[i] = dp[i-1] + dp[i-2]

print(dp[-1] % 1000000007)

### FIXED CODE ###

[N,M] = list(map(int,input().split()))
a = []
for i in range(M):
    a.append(int(input()))

aa=[0]*(N+1)
for j in range(M):
    aa[a[j]] = 1

dp = [0]*(N+1)
dp[0]=1
if 1 not in a:
    dp[1]=1
else:
    dp[1]=0

for i in range(2,N+1):
    if aa[i]==0:
        dp[i]=dp[i-1] + dp[i-2]
    else:
        dp[i]=0

print(dp[-1] % 1000000007)
n,q = map(int, input().split())
s = input()

counts = [1 if s[i]=="A" and s[i+1]=="C" else 0 for i in range(n)]
cum_counts = [sum(counts[:i]) for i in range(n)]

for i in range(q):
  l,r = map(int, input().split())
  print(cum_counts[r-1] - cum_counts[l-1])

### FIXED CODE ###

n,q = map(int, input().split())
s = input()

counts = [1 if s[i:i+2]=="AC" else 0 for i in range(n)]

cum_counts=[0]*n
for i in range(1,n):
  cum_counts[i]=cum_counts[i-1]+counts[i-1]

#print(counts)
#print(cum_counts)

for i in range(q):
  l,r = map(int, input().split())
  print(cum_counts[r-1] - cum_counts[l-1])
n,q=map(int,input().split())
tree = [set() for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    tree[a-1].add(b)
#print(tree)

ans=[0]*n
def add_l(x,l):
    if tree[x]:
        for i in list(tree[x]):
            add_l(i-1,l)
        l.extend(list(tree[x]))

for i in range(q):
    
    p,x=map(int,input().split())
    add_list=[p]
    add_l(p-1,add_list)

    #print(add_list)
    for add in add_list:
        ans[add-1]+=x
print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
k = []
j = 0
na= 0
c = 0
if sum(a)<sum(b):
    print(-1)
else:
    for i in range(n):
        if a[i]<b[i]:
            na +=b[i]-a[i]
            c+=1
        elif a[i] > b[i]:
            k.append(a[i]-b[i])
    k.sort()
        k = k[::-1]
    while na > 0:
        na -=k[j]
        c +=1
        j+=1
    print(c)


### FIXED CODE ###

import sys
input=sys.stdin.readline
mii=lambda:map(int,input().split())

n=int(input())
a=list(mii())
b=list(mii())
k = []
j = 0
na= 0
c = 0
for i in range(n):
    if a[i]<b[i]:
        na +=b[i]-a[i]
        c+=1
    elif a[i] > b[i]:
        k.append(a[i]-b[i])
k.sort()
while na > 0 and k:
    na -=k[-1]
    k.pop(-1)
    c +=1
if na > 0:print(-1)
else:print(c)
s = input()
cnt = 0
cnt_list = []
for i in range(len(s)):
  if s[i] == "A":
    cnt +=1
  elif s[i] == "C":
    cnt +=1
  elif s[i] == "G":
    cnt +=1
  elif s[i] == "T":
    cnt +=1
  else:
    cnt_list.append(cnt)
    cnt = 0
print(max(cnt_list))

### FIXED CODE ###

s = input()
acgt = ["A","C","G","T"]
cnt = 0
cnt_list = []
for i in range(len(s)):
    if s[i] in acgt:
        cnt +=1
        if s[-1] in acgt:
            cnt_list.append(cnt)
    else:
        cnt_list.append(cnt)
        cnt = 0
print(max(cnt_list))
s = input()
ans = []
x = 0

for c in s:
    if c == '0' or c == '1':
        ans.append(c)
    else:
        if len(ans) != 0:
            del ans[x-1]
    x += 1

print(''.join(ans))

### FIXED CODE ###

s = input()
ans = []

for c in s:
    if c == '0' or c == '1':
        ans.append(c)
    else:
        if len(ans) != 0:
            ans.pop()

print(''.join(ans))
N = int(input())
ans = ['NIL' for i in range(N+1)]
appeared_num = []
 
if N == 1:
    print(1)
else:
 
    #1回目
    line = list(map(int, input().split()))
    appeared_num += [line[0], line[1]]
    if line[2] % 2 == 0:
        ans[line[0]] = 1
        ans[line[1]] = 1
    else:
        ans[line[0]] = 1
        ans[line[1]] = 0
 
    #2回目以降
    remain = []
    for i in range(N-2):
        line = list(map(int, input().split()))
        length = line[2] % 2
        if line[0] in appeared_num:
            if ans[line[0]] == 1:
                ans[line[1]] = (1 + length) % 2
            else:
                ans[line[1]] = length
            appeared_num += [line[1]]
 
 
        elif line[1] in appeared_num:
            if ans[line[1]] == 1:
                ans[line[0]] = (1 + length) % 2
            else:
                ans[line[0]] = length
                appeared_num += [line[0]]
 
        else:
            remain += line
 
    #2周目以降
    while len(remain) != 0:
        l = len(remain)
        for i in range(l):
            line = remain[i]
            length = line[2] % 2
            if line[0] in appeared_num:
                if ans[line[0]] == 1:
                    ans[line[1]] = (1 + length) % 2
                else:
                    ans[line[1]] = length
                appeared_num += [line[1]]
                remain.pop(i)
 
 
            elif line[1] in appeared_num:
                if ans[line[1]] == 1:
                    ans[line[0]] = (1 + length) % 2
                else:
                    ans[line[0]] = length
                    appeared_num += [line[0]]
                remain.pop(i)
 
            else:
                pass
 
    Ans = ans[1:]
    for i in range(N):
        print(Ans[i])

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    repn = [[] for _ in range(N)]
    for _ in range(N - 1):
        u, v, w = map(int, input().split())
        repn[u - 1].append((v - 1, w))
        repn[v - 1].append((u - 1, w))
    
    """
    Greedyに隣接する頂点ごとに色を塗っていけばよい
    """

    color = [-1] * N
    color[0] = 0
    q = [0]
    while q:
        v = q.pop()
        for u, w in repn[v]:
            if color[u] != -1:
                continue
            if w % 2 == 0:
                color[u] = color[v]
            else:
                color[u] = (1 + color[v]) % 2
            q.append(u)
    for ans in color:
        print(ans)


if __name__ == "__main__":
    main()
import sys
import math

r = float(sys.stdin.readline())
print('%.5f %.5f' % (r**2 * math.pi, r*2 * math,pi))

### FIXED CODE ###

import sys
import math

r = float(sys.stdin.readline())
print('%.5f %.5f' % (r**2 * math.pi, r*2 * math.pi))
import math
A, B, C, D = map(int, input().split())
CD = int((C*D)/math.gcd(C, D))

ac = (A-1)//C
bc = B//C
ad = (A-1)//D
bd = B//D
acd = (A-1)//CD
bcd = B//CD

print(int(B - A + 1 - ((bc - ac) + (bd - ad) - (bcd - acd))))


### FIXED CODE ###

import fractions
A, B, C, D = map(int, input().split())
CD = int((C*D)/fractions.gcd(C, D))

ac = (A-1)//C
bc = B//C
ad = (A-1)//D
bd = B//D
acd = (A-1)//CD
bcd = B//CD

print(int(B - A + 1 - ((bc - ac) + (bd - ad) - (bcd - acd))))
from fraction import gcd

def input_ints():
    return list(map(int, input().split()))

def main():
    n = int(input())
    a = input_ints()
    x = [a[0]]
    y = [a[-1]]
    for i in range(n-1):
        x.append(gcd(x[-1], a[i + 1]))
        y.append(gcd(y[-1], a[n - i - 2]))
    ans = max(x[-2],y[-2])
    for i in range(1, n-1):
        ans = max(ans,gcd(x[i-1],y[-i-1]))
    print(ans)
    

if __name__ == '__main__':
    main()


### FIXED CODE ###

from fractions import gcd

def input_ints():
    return list(map(int, input().split()))

def main():
    n = int(input())
    a = input_ints()
    x = [a[0]]
    y = [a[-1]]
    for i in range(n-1):
        x.append(gcd(x[-1], a[i + 1]))
        y.append(gcd(y[-1], a[n - i - 2]))
    ans = max(x[-2],y[-2])
    for i in range(1, n-1):
        ans = max(ans,gcd(x[i-1],y[-i-2]))
    print(ans)
    

if __name__ == '__main__':
    main()
N=int(input())
sen = N / 1000:

if N % 1000 == 0：
  print(0)
else:
  atai = N - sen
  print(sen + atai )

### FIXED CODE ###

#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if N % 1000 == 0:
 print(0)
else:
  sen = N//1000
  sen2 = sen*1000
  atai = N-sen2
  atai2 = 1000-atai
  print(atai2)
A,B = int(input().split())
C = A+B
if C % 2 == 0:
    K = int(C/2)
else:
    K = "IMPOSSIBLE"
print(K)

### FIXED CODE ###

A,B = map(int,input().split())
C = A+B
if C % 2 == 0:
    K = int(C/2)
else:
    K = "IMPOSSIBLE"
print(K)
s=list(int(input()))
f=True
for i in range(1,4):
	if s[i-1]==s[i]:
		f=False
		break
	else:
		continue
if f:
	print("Good")
else:
	print("Bad")

### FIXED CODE ###

s=list(str(input()))
f=True
for i in range(1,4):
	if s[i-1]==s[i]:
		f=False
		break
	else:
		continue
if f:
	print("Good")
else:
	print("Bad")
w = input()

count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT'
        break
    for s in line.lower()split():
         count += 1
print(count)

### FIXED CODE ###

W = input()
 
count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
 
    for word in line.split():
        if word.lower() == W.lower():
            count += 1
print(count)
N = int(input())

a = sorted(map(int,input().split()))

a.reverse()

A = []
B = []

for x in range(0,N+1,2):
    A.append(a[x])
    
if N%2 == 1:
    for y in range(1,N,2):
        B.append(a[y])
        
    
else:
    for y in range(1,N+1,2):
        B.append(a[y])
    
    
    

    

print(sum(A)-sum(B))


### FIXED CODE ###

N = int(input())

a = sorted(map(int,input().split()))

a.reverse()

A = []
B = []

for x in range(0,N,2):
    A.append(a[x])
    
        
for y in range(1,N,2):
    B.append(a[y])
    
print(sum(A)-sum(B))
import bisect
s = input()
t = input()
sub = s+s
dp = []
for i in range(len(s)):
    d = [10**15]*26
    dp.append(d)
index = [[] for i in range(26)]
for i in range(len(sub)):
    index[ord(sub[i])-97].append(i)
for i in range(len(s)):
    cur = s[i]
    for j in range(26):
        if len(index[j]) != 0:
            k = bisect.bisect_left(index[j], i)
            dp[i][j] = index[j][k]-i
ans = dp[0][ord(t[0])-97]+1
next = dp[0][ord(t[0])-97]
flag = True
for i in range(1,len(t)):
    cur = next
    if dp[cur][ord(t[i])-97] == 10**15:
        flag = False
        break
    else:
        ans += dp[cur][ord(t[i])-97]
        if cur + dp[cur][ord(t[i])-97] >= len(s):
            next = cur + dp[cur][ord(t[i])-97] - len(s)
        else:
            next = cur + dp[cur][ord(t[i])-97]
if flag:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

import bisect
s = input()
t = input()
sub = s+s
dp = []
for i in range(len(s)):
    d = [10**15]*26
    dp.append(d)
index = [[] for i in range(26)]
for i in range(len(sub)):
    index[ord(sub[i])-97].append(i)
for i in range(len(s)):
    cur = s[i]
    for j in range(26):
        if len(index[j]) != 0:
            k = bisect.bisect_right(index[j], i)
            dp[i][j] = index[j][k]-i
if s[0] == t[0]:
    ans = 1
else:
    ans = dp[0][ord(t[0])-97]+1
if dp[0][ord(t[0])-97] != 10**15 and dp[0][ord(t[0])-97] >= len(s):
    next = dp[0][ord(t[0])-97]-len(s)
else:
    next = dp[0][ord(t[0])-97]
if next == 10**15:
    print(-1)
    exit()
else:
    flag = True
for i in range(1,len(t)):
    cur = next
    if dp[cur][ord(t[i])-97] == 10**15:
        flag = False
        break
    else:
        ans += dp[cur][ord(t[i])-97]
        if cur + dp[cur][ord(t[i])-97] >= len(s):
            next = cur + dp[cur][ord(t[i])-97] - len(s)
        else:
            next = cur + dp[cur][ord(t[i])-97]
if flag:
    print(ans)
else:
    print(-1)
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))

def fibo(x2):
    if (x2 == 1) or (x2 == 2):
        return (1)
    else:
        return((fibo(x2-1) + fibo(x2-2)) % (10**9 + 7))

aa = [] #aの差を取ったもののリスト
for k in range(M-1):
    aa.append(a[k+1] - a[k] - 1)
#print(aa)
#aa.append(N - a(M))

if 0 in aa:
    ans = 0

else:
    ans = 1
    ans_list = []
    for i in range(M-1):
        if aa[i] >= 1:
            ans_list.append(fibo(aa[i]))

    ans_list.append(fibo(a[0]))
    ans_list.append(fibo(N - a[M-1]))
    #print(ans_list)
    
    for i in range (len(ans_list)):
        ans = (ans * ans_list[i]) % (10**9 + 7)

print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
a = []
if M >= 1:
    for i in range(M):
        a.append(int(input()))

def fibo(n):
    a, b = 1, 1
    if (n == 0) or (n == 1) or (n == 2):
        return 1
    else:
        for _ in range(n-2):
            a, b = b, a + b
        return b

aa = [] #aの差を取ったもののリスト
if M >= 2:
    for k in range(M-1):
        aa.append(a[k+1] - a[k] - 1)
#print(aa)
#aa.append(N - a(M))

    if 0 in aa:
        ans = 0

    else:
        ans = 1
        ans_list = []
        for i in range(M-1):
            ans_list.append(fibo(aa[i]))

        ans_list.append(fibo(a[0]))
        ans_list.append(fibo(N - a[M-1]))
    #print(ans_list)
    
        for i in range (len(ans_list)):
            ans = (ans * ans_list[i]) % (10**9 + 7)

elif M == 1:
    ans_list = []
    ans_list.append(fibo(a[0]))
    ans_list.append(fibo(N - a[0]))
    ans = (ans_list[0] * ans_list[1]) % (10**9 + 7)

elif M == 0:
    ans = fibo(N+1) % (10**9 + 7)

print(ans)
import.math
A, B, H, M = map(int, input.split())
sita = (H*30+M*0.5)-(M*6)
print((A**2+B**2-2*A*B*(math.cos(math.radians(Sita))))**0.5)

### FIXED CODE ###

def resolve():
    import math
    A, B, H, M = map(int, input().split())
    sita = abs(H*30+M*0.5-M*6)
    if sita > 180:
        sita = 360 - sita
    print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(sita))))
resolve()
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()

### FIXED CODE ###

import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()
a=int(input())
b=int(input())
print("GREATER" if a>b else "LESS" if a<b else "EQUAL")

### FIXED CODE ###

s1,s2,s3 = input().split()
s = s1[0].upper() + s2[0].upper() + s3[0].upper()
print(s)
from math import log, ceil
r = 26
ab = "abcdefghijklmnopqrstuvwxyz"
input = raw_input
n = int(input())
m = int(ceil(log(n*(r-1) + r, r) - 1))

uhen = r ** m
sahen = n * (r-1) + r
if sahen < uhen:
    m -= 1
else:
    uhen *= r
    if sahen > uhen:
        m += 1
    else:
        pass

cur = r ** (m-1)
out = ""
for i in range(m):
    i = n // cur
    out = out + ab[i-1]
    n -= i * cur
    cur //= r


print(out)

### FIXED CODE ###

from math import log, ceil
r = 26
ab = "abcdefghijklmnopqrstuvwxyz"
input = raw_input
n = int(input())

def answer(n):
    m = int(ceil(log(n*(r-1) + r, r))) - 1

    #cur = r ** (m-1)
    out = ""

    sub = (r ** m - r) // (r-1)
    n = n - sub - 1
    for i in range(m):
        i = n % r
        out = ab[i] + out
        n //= r
        #i = n // cur
        #out = out + ab[i-1]
        #n -= i * cur
        #cur //= r
    return out

#for n in range(1, 676 + 26 + 2):
if True:
    out = answer(n)
    #print(n, out)
    print(out)
n = int(input())
a = list(map(int,input().split()))

b = len(set(a))
if len(a)== len(b):
	print('YES')
else:
	print('NO')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))

b = list(set(a))
if len(a)== len(b):
	print('YES')
else:
	print('NO')
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
c=sum(b)
if c%10!=0:
  print(c)
else:
  for i in range(a):
    if b[i]%!=0:
      d=c-b[i]
      print(d)
      break
  if d==c:
    print(0)

### FIXED CODE ###

a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
c=sum(b)
d=0
if c%10!=0:
  print(c)
else:
  for i in range(a):
    if b[i]%10!=0:
      c=c-b[i]
      print(c)
      break
  if sum(b)==c:
    print(0)
import sys
import numpy as np

X,n=map(int,input().split())
p=list(map(int,input().split()))
if n==0:
    print(X)
pp = list(map(lambda x: abs(x-X), p))
pp.sort()
for i in range(1,100):
    tmp=X-pp[0]-i
    if not tmp in p:
        print(tmp)
        sys.exit()
    tmpp=X-pp[0]+i
    if not tmpp in p:
        print(tmpp)
        sys.exit()


### FIXED CODE ###

import sys
import numpy as np

X,n=map(int,input().split())
p=list(map(int,input().split()))
if n==0:
    print(X)
    sys,exit()
pp = list(map(lambda x: abs(x-X), p))
pp.sort()
for i in range(1,100):
    tmp=X-pp[0]-i
    if not tmp in p:
        print(tmp)
        sys.exit()
    tmpp=X-pp[0]+i
    if not tmpp in p:
        print(tmpp)
        sys.exit()
def main(s, t):
    s = list(input())
    t = list(input())
    assert len(s) == len(t)
    res = 0
    for i, ss in enumerate(s):
        if ss == t[i]:
            res += 1
    return res


if __name__ == "__main__":
    main()


### FIXED CODE ###

def solve(s, t):
    assert len(s) == len(t)
    res = 0
    for i, ss in enumerate(s):
        if ss == t[i]:
            res += 1
    return res


if __name__ == "__main__":
    S = list(input())
    T = list(input())
    print(solve(S, T))
N=int(input())
P=[tuple(map(int,input().split())) for i in range(N-1)]
Path=[[] for i in range(N)]
for p in P:
  Path[p[0]-1].append(p[1]-1)
  Path[p[1]-1].append(p[0]-1)
colornum=1
dic={}
def bfs(nodes,p,pcolor,selfnum):
  global colornum
  if len(nodes)-1==0 and p!=-1:
    return
  c=1
  for n in nodes:
    if n == p:
      continue
    if c==pcolor:
      c+=1
    dic[(selfnum+1,n+1)]=c
    dic[(n+1,selfnum+1)]=c
    bfs(Path[n],selfnum,c,n)
    c+=1
  if c>colornum:
    colornum=c
bfs(Path[0],-1,0,0)
print(colornum-1)
for p in P:
  print(dic[p])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
N=int(input())
P=[tuple(map(int,input().split())) for i in range(N-1)]
Path=[[] for i in range(N)]
for p in P:
  Path[p[0]-1].append(p[1]-1)
  Path[p[1]-1].append(p[0]-1)
colornum=1
dic={}
def bfs(nodes,p,pcolor,selfnum):
  global colornum
  if len(nodes)-1==0 and p!=-1:
    return
  c=1
  for n in nodes:
    if n == p:
      continue
    if c==pcolor:
      c+=1
    dic[(selfnum+1,n+1)]=c
    dic[(n+1,selfnum+1)]=c
    bfs(Path[n],selfnum,c,n)
    c+=1
  if c>colornum:
    colornum=c
bfs(Path[0],-1,0,0)
print(colornum-1)
for p in P:
  print(dic[p])
n=int(input())
l=list(map(int,input().split()))
l.sort()
lcount=[]
count=0
now=l[0]
for i in range(n):
  if now==l[i]:
    count+=1
  else:
    lcount.append([count,now])
    count=1
    now=l[i]
if count!=1:
  lcount.append([count,now])
if len(lcount)==1:
  print(n)
elif len(lcount)==2:
  l1=lcount[0][0]
  l2=lcount[1][0]
  if lcount[1][1]-lcount[0][1]==1:
    print(l1+l2)
  else:
    print(max(l1,l2))
else:
  count=0
  for i in range(1,len(lcount)-1):
    scount=0
    scount+=lcount[i][0]
    if lcount[i][1]-lcount[i-1][1]==1:
      scount+=lcount[i-1][0]
    if lcount[i][1]-lcount[i+1][1]==-1:
      scount+=lcount[i+1][0]
    if scount>count:
      count=scount
  count1=lcount[0][0]
  if lcount[1][1]-lcount[0][1]==1:
    count1+=lcount[1][0]
  count2=lcount[-1][0]
  if lcount[-2][1]-lcount[-1][1]==-1:
    count2+=lcount[-2][0]
  print(max(count,count1,count2))


### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()
lcount=[]
count=0
now=l[0]
for i in range(n):
  if now==l[i]:
    count+=1
  else:
    lcount.append([count,now])
    count=1
    now=l[i]
lcount.append([count,now])
if len(lcount)==1:
  print(n)
elif len(lcount)==2:
  l1=lcount[0][0]
  l2=lcount[1][0]
  if lcount[1][1]-lcount[0][1]==1:
    print(l1+l2)
  else:
    print(max(l1,l2))
else:
  count=0
  for i in range(1,len(lcount)-1):
    scount=0
    scount+=lcount[i][0]
    if lcount[i][1]-lcount[i-1][1]==1:
      scount+=lcount[i-1][0]
    if lcount[i][1]-lcount[i+1][1]==-1:
      scount+=lcount[i+1][0]
    if scount>count:
      count=scount
  count1=lcount[0][0]
  if lcount[1][1]-lcount[0][1]==1:
    count1+=lcount[1][0]
  count2=lcount[-1][0]
  if lcount[-2][1]-lcount[-1][1]==-1:
    count2+=lcount[-2][0]
  print(max(count,count1,count2))
import fractions
n,X=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n):
  x[i]=x[i]-X
G=float'inf'
for j in range(n):
  G=min(G,fractions.gcd(x[j],x[j+1]))
print(G)
  



### FIXED CODE ###

import fractions
import sys
n,X=map(int,input().split())
x=list(map(int,input().split()))
y=[]
if n==1:
  print(abs(x[0]-X))
  sys.exit()
for i in range(n):
  y.append(abs(x[i]-X))
G=100000000000
for j in range(n-1):
  G=min(G,fractions.gcd(y[j],y[j+1]))
print(G)
n=int(input())
for i in range(0,9):
  if n%i==0 and n/i>=1 and n/i<=9:
    print("Yes")
    break
else:
  print("No")


### FIXED CODE ###

n=int(input())
for i in range(1,10):
  if n%i==0:
    if n/i>=1 and n/i<=9:
      print("Yes")
      break
else:
  print("No")
import collections

n = int(input())
a = [input() for i in range(n)]
 
count = 0
dic = collections.Counter(l)
 
for i in dic.values():
    if i%2 == 1:
        count += 1
 
print(count)

### FIXED CODE ###

n = int(input())
a = [input() for i in range(n)]

count = 0
dic = {}

for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for i in dic.values():
    if i%2 == 1:
        count += 1

print(count)