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

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

com_mx=200005
mod=998244353
fac=[0]*com_mx
finv=[0]*com_mx
inv=[0]*com_mx
fac[0]=1
fac[1]=1
finv[0]=1
finv[1]=1
inv[1]=1
for i in range(2,com_mx):
  fac[i]=fac[i-1]*i%mod
  inv[i]=-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def com(n,k):
  if n<k or n<0 or k<0:
    return 0
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod

def main():
  n,m,k=LI()
  ans=0
  col=m
  for x in range(n)[::-1]:
    now=col
    now*=com(n-1,x)
    if x<=k:
      ans+=now
      ans%=mod
    col*=m-1
  return ans

# main()
print(main())


### FIXED CODE ###

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

com_mx=200005
mod=998244353
fac=[0]*com_mx
finv=[0]*com_mx
inv=[0]*com_mx
fac[0]=1
fac[1]=1
finv[0]=1
finv[1]=1
inv[1]=1
for i in range(2,com_mx):
  fac[i]=fac[i-1]*i%mod
  inv[i]=-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def com(n,k):
  if n<k or n<0 or k<0:
    return 0
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod

def main():
  n,m,k=LI()
  res=0
  tmp=m*pow(m-1,n-k-1,mod)
   
  for r in range(n-k-1,n):
    res=(res+tmp*com(n-1,r)%mod)%mod
    tmp=tmp*(m-1)%mod
  return res

# main()
print(main())
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
for i in range(n):
    tmp = a[i]
    a[i] = 0
    print(max(a))
    a[i] = tmp

### FIXED CODE ###

n = int(input())
aaa = [int(input()) for _ in range(n)]
max_a = sorted(aaa)[-1]
second_a = sorted(aaa)[-2]
for a in aaa:
    if a == max_a:
        print(second_a)
    if a != max_a:
        print(max_a)
### BUGGY CODE ###

def main():
    n, *a, = map(int, open(0).read().split())
    m = max(a)

    def minimum_prime(x):
        if x == 1:
            return 1
        for i in range(3, x + 1, 2):
            if x % i == 0:
                return i

    d = [minimum_prime(i) if i % 2 == 1 else 2 for i in range(m + 1)]

    def primes(x):
        ps = set()
        while x != 1:
            p = d[x]
            ps.add(p)
            x = x // d[x]
        return ps

    b = set()
    c = primes(a[0])
    f = 1
    for i in a:
        primes = set()
        while i != 1:
            p = d[i]
            primes.add(p)
            i = i // d[i]
        if f:
            if b & primes:
                f = 0
            b |= primes
        c &= primes

    if f:
        ans = "pairwise coprime"
    elif len(c) == 0:
        ans = "setwise coprime"
    else:
        ans = "not coprime"

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, *a, = map(int, open(0).read().split())
    m = max(a)

    d = [0] * (m+1)
    d[1] = 1
    for i in range(2, m+1):
        for j in range(i, m+1, i):
            if d[j] == 0:
                d[j] = i

    def primes(x):
        ps = set()
        while x != 1:
            p = d[x]
            ps.add(p)
            x = x // d[x]
        return ps

    b = set()
    c = primes(a[0])
    f = 1
    for i in a:
        ps = set()
        while i != 1:
            p = d[i]
            ps.add(p)
            i = i // d[i]
        if f:
            if b & ps:
                f = 0
            b |= ps
        c &= ps

    if f:
        ans = "pairwise coprime"
    elif len(c) == 0:
        ans = "setwise coprime"
    else:
        ans = "not coprime"

    print(ans)


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

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N,K,Q=map(int,input().split())
A=[int(input()) for _ in range(Q)]
l = list(map(lambda x:'Yes' if K-Q+A.count(x)>0 else 'No',list(range(1,N+1))))
for i in l:
    print(i)

### FIXED CODE ###

N, K, Q = map(int, input().split())
P = [0] * N

for i in range(Q):
    P[int(input())-1] += 1
for i in range(N):
    ans = K - Q + P[i]
    if ans > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n, p = map(int,input().split())
D = input()
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * 10**i) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)

### FIXED CODE ###

n, p = map(int,input().split())
D = input()
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)
### BUGGY CODE ###

H, W, D = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(H)]

L = [[] for i in range(H * W)]
for i in range(H):
    for j in range(W):
        L[A[i][j] - 1] = [i + 1, j + 1]


Q = int(input())
for i in range(Q):
    ans = 0
    l, r = map(int, input().split())
    if l == r:
        print(ans)
        continue
    a, b = L[l - 1]
    while L[r - 1] != L[l + D - 1]:
        c, d = L[l - 1 + D]
        ans += abs(a - c) + abs(b - d)
        a, b = L[l + D - 1]
        l = l + D
    e, f = L[r - 1]
    ans += abs(a - e) + abs(b - f)
    print(ans)

### FIXED CODE ###

H, W, D = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(H)]

L = [[] for i in range(H * W + 1)]
for i in range(H):
    for j in range(W):
        L[A[i][j]] = [i + 1, j + 1]
        
d = [0] * (H * W + 1)
for i in range(D + 1, H * W + 1):
    d[i] = d[i - D] + abs(L[i][0] - L[i - D][0]) + abs(L[i][1] - L[i - D][1])

Q = int(input())
for i in range(Q):
    l, r = map(int, input().split())
    print(d[r] - d[l])
### BUGGY CODE ###

H,W=map(int,input().split())
c=[input() for _ in range(H)]
H-=1
W-=1

def permutations(L):
    
    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutations(data):
                ret.append([i] + j)

        return ret
        
junretsu = permutations([0]*W+[1]*H)
ans=10**10
for i in junretsu:
    h=0
    w=0
    now=0
    for g in i:
        if g==0:
            w+=1
            if c[h][w]=="#":
                now+=1
        if g==1:
            h+=1
            if c[h][w]=="#":
                now+=1
    ans=min(ans,now)

if c[0][0]=="#":
    ans+=1

print(ans)

### FIXED CODE ###

from collections import defaultdict
import queue

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

inf = float("inf")
dp = [[inf]*W for _ in range(H)]
if c[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0

n = dp[0][0]
for i in range(H-1):
    if c[i][0] == "." and c[i+1][0] == "#":
        n += 1
    dp[i+1][0] = n

m = dp[0][0]
for i in range(W-1):
    if c[0][i] == "." and c[0][i+1] == "#":
        m += 1
    dp[0][i+1] = m

for i in range(1, H):
    for g in range(1, W):
        if c[i-1][g] == "." and c[i][g] == "#":
            dp[i][g] = min(dp[i-1][g]+1, dp[i][g])
        else:
            dp[i][g] = min(dp[i-1][g], dp[i][g])

        if c[i][g-1] == "." and c[i][g] == "#":
            dp[i][g] = min(dp[i][g-1]+1, dp[i][g])
        else:
            dp[i][g] = min(dp[i][g-1], dp[i][g])

print(dp[H-1][W-1])
### BUGGY CODE ###

n = int(input())
p = 1
for i in range(1, n+1):
    p = p * i
print(p % (10 ** 9 + 7))

### FIXED CODE ###

n = int(input())
p = 1
for i in range(1, n+1):
    p = p * i
    p = p % (10 ** 9 + 7)
print(p % (10 ** 9 + 7))
### BUGGY CODE ###

s = input()
if s[-1] == "?":
    pre = [1 if i<10 else 0 for i in range(13)]
else:
    pre = [0 for i in range(13)]
    pre[int(s[-1])] = 1
n = 10**9 + 7
t = 10
for i in range(1, len(s)):
    if s[-1*i-1] == "?":
        c = pre.copy()
        for j in range(1,10):
            te = t*j % 13
            for k in range(13):
                c[k] = c[k] + pre[(13+k-te)%13]
        pre = c.copy()
        for k in range(13):
            pre[k] %= n
    else:
        te = int(s[-1*i-1])*t % 13
        pre = pre[13-te:]+pre[:13-te]
    t = t*10%13
print(pre[5])

### FIXED CODE ###

s = input()
pre = [1]+[0]*12
n = 10**9 + 7
tem = [[i*j%13 for i in range(10)] for j in range(13)]
t = 1
for i in range(len(s)):
    if s[-1*i-1] > "9":
        pre = [sum([pre[k-i] for i in tem[t]])%n for k in range(13)]      
    else:
        te = int(s[-1*i-1])*t % 13
        pre = [pre[i-te] for i in range(13)]
    t = t*10 % 13
print(pre[5])
### BUGGY CODE ###

import sys
input_ = sys.stdin.readline

n, q = map(int, input().split())
s = input()
for _ in range(q):
  first, last = map(int, input().split())
  print(s[first-1:last].count("AC"))

### FIXED CODE ###

import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
ac_list = [0]

for i in range(1, n):
  if s[i-1:i+1] == 'AC':
    ac_list.append(ac_list[i-1]+1)
  else:
    ac_list.append(ac_list[i-1])

for _ in range(q):
  first, last = map(int, input().split())
  print(ac_list[last-1] - ac_list[first-1])
### BUGGY CODE ###

num = int(input())
data = [int(input()) for _ in range(num)]

for i in range(num):
    print(max((data[0:i])+(data[i+1:num])))

### FIXED CODE ###

"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())
a = []

for _ in range(n):
    var = int(input())
    a.append(var)

first = int(max(a))
if 1<a.count(first):
    second = int(first)
else:
    second = sorted(set(a))[-2]

for _ in a[:]:
    if _ == first:
        print(second)
    else:
        print(first)
### BUGGY CODE ###

import bisect
N = int(input())
A = [int(input()) for _ in range(N)]

S = []

cnt = 0
for i in range(N):
    j = bisect.bisect_left(S, A[i])
    if j <= 0:
        cnt += 1
        S.insert(j, A[i])
    else:
        S[j-1] = A[i]

print(cnt)


### FIXED CODE ###

import bisect
N = int(input())
A = [int(input()) for _ in range(N)]

S = [0] * N

end = N
for i in range(N):
    j = bisect.bisect_left(S, A[i], end, N)
    if j <= end:
        S[j-1] = A[i]
        end -= 1
    else:
        S[j-1] = A[i]

print(N-end)
### BUGGY CODE ###

# ABC 158 D
S=list(input())
Q=int(input())
for _ in [0]*Q:
    s=input()
    if s=='1':
        s=int(s)
        S=S[::-1]
    else:
        t,f,c=s.split()
        if f=='1':
            S=[c]+S
        else:
            S=S+[c]
print(*S,sep='')

### FIXED CODE ###

# ABC 158 D
from collections import deque

S=list(input())
q=deque(S)
Q=int(input())
inv=0
for _ in [0]*Q:
    s=input()
    if s=='1':
        inv+=1
    else:
        t,f,c=s.split()
        if ((f=='1') ^ (inv%2==1)):
            q.appendleft(c)
        else:
            q.append(c)
S=[]
if inv%2:
    while q:
        S.append(q.pop())
else:
    while q:
        S.append(q.popleft())
    
print(*S,sep='')
### BUGGY CODE ###

import math

a, b, n = map(int, input().split(" "))

_max = 0
i = 0
while i <= n:
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    _max = max(_max, val)
    i += 1

print(_max)

### FIXED CODE ###

import math

a, b, n = map(int, input().split(" "))

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))
### BUGGY CODE ###

import fractions
MOD = 1000000007

N = int(input())
A = list(map(int, input().split()))
L = A[0]
for i in range(1, N):
    L = L * A[i] // fractions.gcd(L, A[i])

ans = 0
for i in range(N):
    ans = (ans + L // A[i]) % MOD

print(ans)


### FIXED CODE ###

import fractions

N = int(input())
A = list(map(int, input().split()))
L = A[0]
for i in range(1, N):
    L = L * A[i] // fractions.gcd(L, A[i])

ans = 0
for i in range(N):
    ans = (ans + L // A[i]) #% 1000000007

print(ans%1000000007)
### BUGGY CODE ###

N = int(input())
H = list(map(int, input().split()))
max_move_cnt = 0
tmp_move_cnt = 0

for i in range(N):
    tmp_move_cnt = 0

    for i in range(i, N-1):
        if H[i] >= H[i+1]: 
            tmp_move_cnt += 1
        else:
            break

    if tmp_move_cnt >= max_move_cnt:
        max_move_cnt = tmp_move_cnt


print(max_move_cnt)

        


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
max_move_cnt = 0
tmp_move_cnt = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        tmp_move_cnt += 1
    else:
        tmp_move_cnt = 0

    max_move_cnt = tmp_move_cnt if tmp_move_cnt >= max_move_cnt else max_move_cnt

print(max_move_cnt)
### BUGGY CODE ###

N,M=map(int,input().split())
l=[tuple(map(int,input().split())) for i in range(N)]
l.sort(reverse=True)
 
h=[]
ans=0
for i in range(1,M+1):
    while l and l[-1][0]==i:
        h.append(l.pop()[1])
    if h:
        ans+=max(h)
        h.pop(h.index(max(h)))
print(ans)

### FIXED CODE ###

import heapq
import bisect

N,M = (int(i) for i in input().split()) 
ab = [[int(i) for i in input().split()] for i in range(N)] 

ans=0
ab.sort()
_index=[i[0] for i in ab]
p=[]
heapq.heapify(p)

for i in range(1,M+1):
	for g in ab[bisect.bisect_left(_index, i) : bisect.bisect_right(_index, i)]:
		heapq.heappush(p, -g[1])
	if p!=[]:
		ans+=heapq.heappop(p)*(-1)

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

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


n, m = map(int, input().split())
p_list = list(map(int, input().split()))
q_list = []
for item in p_list:
    q_list.append(item-1)

uni = UnionFind(n)

for i in range(m):
    x, y = map(int, input().split())
    uni.union(x-1, y-1)

ret = 0

for item in uni.all_group_members():
    t_list = uni.all_group_members()[item]
    tmp = []
    for var in t_list:
        tmp.append(q_list[var])
    ret += len(set(tmp) & set(t_list))

print(ret)


### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.parents = list(range(n))
        self.rank = [0] * n

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parents[x] = y
        else:
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


n, m = map(int, input().split())
p_list = list(map(int, input().split()))
q_list = list(map(lambda x: x - 1, p_list))

uni = UnionFind(n)

for i in range(m):
    x, y = map(int, input().split())
    uni.union(x-1, y-1)

ret = 0

tmp_dict = dict()

for i in range(n):
    parent = uni.find(i)
    if parent in tmp_dict:
        tmp_dict[parent].append(i)
    else:
        tmp_dict[parent] = [i]

for item in tmp_dict:
    t_list = tmp_dict[item]
    tmp = set()
    for var in t_list:
        tmp.add(q_list[var])
    ret += len(tmp & set(t_list))

print(ret)
### BUGGY CODE ###

from collections import deque


def main():
    N = int(input())
    adj = [set() for _ in range(N)]
    for i in range(N-1):
        a, b = map(int, input().split())
        adj[a-1].add((b-1, i))
        adj[b-1].add((a-1, i))
    path = [[None] * N for _ in range(N)]
    for i in range(N):
        start = i
        q = deque()
        q.appendleft((i, set()))
        while len(q):
            cur, p = q.pop()
            for nxt, npath in adj[cur]:
                if npath in p:
                    continue
                path[i][nxt] = p | {npath}
                q.appendleft((nxt, path[i][nxt]))
    M = int(input())
    dp = [{tuple(): set()} for _ in range(M+1)]
    for i in range(M):
        u, v = map(int, input().split())
        dp[i+1] = dict(dp[i])
        for t in dp[i]:
            dp[i+1][t + (i, )] = dp[i+1][t] | path[u-1][v-1]
    ans = 0
    for key in dp[M]:
        ans += (-1) ** len(key) * 2 ** (N - len(dp[M][key]) - 1)
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque


def getPath(adj, start, goal):
    q = deque()
    q.appendleft((start, 0))
    while len(q):
        cur, p = q.pop()
        if cur == goal:
            return p
        for nxt, nhop in adj[cur]:
            if 2**nhop & p:
                continue
            npath = p | 2**nhop
            q.appendleft((nxt, npath))


def bitcount(x):
    return bin(x).count("1")


def main():
    N = int(input())
    adj = [set() for _ in range(N)]
    for i in range(N-1):
        a, b = map(int, input().split())
        adj[a-1].add((b-1, i))
        adj[b-1].add((a-1, i))
    M = int(input())
    dp = [0] * (2**M)
    for i in range(M):
        u, v = map(int, input().split())
        path = getPath(adj, u-1, v-1)
        for j in range(2**i):
            dp[j + 2**i] = dp[j] | path
    ans = 0
    for i in range(2**M):
        ans += (-1) ** bitcount(i) * 2 ** (N - bitcount(dp[i]) - 1)
    print(ans)


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

N, K = map(int, input().split())
h = list(map(int, input().split()))

# dpテーブル
dp = [10 ** 9] * N

# 初期値
dp[0] = 0
dp[1] = abs(h[1] - h[0])

# ループ
for i in range(2, N):
    for j in range(min(i + 1, K + 1)):
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

# 解を出力
print(dp[N - 1])


### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))

# DPテーブル
dp = [10 ** 10] * N

# 初期値
dp[0] = 0

# ループ
for i in range(1, N):
    for j in range(1, K + 1):
        if i - j < 0:
            pass
        else:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

# 解を出力
print(dp[N - 1])
### BUGGY CODE ###

from functools import reduce
from operator import mul
N = int(input())
ab = [tuple(map(int, input().split())) for _ in range(N-1)]
E_n = {k: 0 for k in ab}
for i in range(1,N+1):
    items = {k:v for k,v in E_n.items() if i in k}
    c = 1
    if reduce(mul, items.values()) == 0:
      for k in items.keys():
        if items[k] != 0: continue
        while True:
          if c not in items.values():
            items[k] = c
            break
          else: c += 1
      for k,v in items.items(): E_n[k] = v
    if reduce(mul, E_n.values()) != 0: break

print(len(set(E_n.values())))
for k in ab: print(E_n[k])

### FIXED CODE ###

N = int(input())
edge = {}
tree = [[] for i in range(N)]
colors = [1]*(N-1)
c_p = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    tree[a].append(b)
    edge[(a,b)] = i

for i in range(N):
    c = 1
    for v_c in tree[i]:
      while c in c_p[i]: c+=1
      colors[edge[(i,v_c)]] = c
      c_p[v_c].append(c)
      c+=1

print(max(colors))
print(*colors, sep="\n")
### BUGGY CODE ###

import numpy as np
n,m=map(int,input().split())
d=[[] for i in range(n)]
l=[]
g=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a-1].append(b)
    l.append(a)
    g.append(b)
x=[{} for i in range(n)]
for i in range(n):
    for j in range(len(d[i])):
        ds=sorted(d[i])
        x[i][ds[j]]=j
for i in range(m):
    b=x[l[i]-1][g[i]]
    b+=1
    p=len(list(str(l[i])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append([a,b])
x=sorted(l)
dic={}
x.append([0,0])
f=1
for i in range(m):
    if x[i][0]==x[i+1][0]:
        dic[str(x[i][0])+'000000'+str(x[i][1])]=f
        f+=1
    else:
        dic[str(x[i][0])+'000000'+str(x[i][1])]=f
        f=1
for i in range(m):
    b=dic[str(l[i][0])+'000000'+str(l[i][1])]
    p=len(list(str(l[i][0])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i][0])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)
### BUGGY CODE ###

n = int(input())
li = list(map(int,input().split()))
ans = 0

for x in range(min(li), max(li)+1):
    y = li.count(x-1) + li.count(x) + li.count(x+1)
    if y > ans:
        ans = y
    
print(ans)


### FIXED CODE ###

import collections

n = int(input())
li = list(map(int,input().split()))
ans = []

for i in li:
    ans.append(i-1)
    ans.append(i)
    ans.append(i+1)

c = collections.Counter(ans)

print(c.most_common()[0][1])
### BUGGY CODE ###

from collections import defaultdict

def smallestPrimeFactor(mxn): 
    spf = [i for i in range(1+mxn)]

    for i in range(4, 1+mxn, 2):
        spf[i] = 2

    for i in range(3, int(mxn**0.5)+1):
        if spf[i] == i:
            for j in range(i*i, mxn, i):
                if spf[j] == j:
                    spf[j] = i
                    
    return spf

n = int(input())
spf = smallestPrimeFactor(1+n)
ans = 0

for i in range(1, n+1):
    num = i
    d = defaultdict(int)
    d[1] = 0
    
    while i != 1:
        d[spf[i]] += 1
        i //= spf[i]
        
    prod = 1
    for k,v in d.items():
        prod *= (v+1)
    ans += prod*num
    
print(ans)

### FIXED CODE ###

n = int(input())
s = 0

for i in range(1, n+1):
    y = n//i
    s += i*y*(y+1)//2
    
print(s)