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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
    
N, M, K = map(int, input().split())

ans = 0

for i in range(1, M):
    ans += i * (M-i) * N**2 
for i in range(1, N):
    ans += i * (N-i) * M**2

ans *= cmb(N*M-2, K-2)

print(int(ans % (10**9+7)))


### FIXED CODE ###

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

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

ans = 0

for i in range(1, M):
    ans += (i * (M-i) * N**2) % (10**9 + 7) 
for i in range(1, N):
    ans += (i * (N-i) * M**2) % (10**9 + 7)

ans *= comb(N*M-2 , K-2, 10**9+7)

print(int(ans % (10**9+7)))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n,k = [int(i) for i in input().split()]
edges = [[int(i)-1 for i in input().split()] for j in range(n-1)]

node = [[] for i in range(n)]
for edge in edges:
    node[edge[0]].append(edge[1])
    node[edge[1]].append(edge[0])

M = 0
for i in range(n):
    count = 1
    que = []
    check = [False for i in range(n)]
    if k%2==0:
        check[i] = True
        que.append(i)
    elif i!=n-1:
        check[edges[i][0]]=True
        check[edges[i][1]]=True
        que.append(edges[i][0])
        que.append(edges[i][1])
        count = 2
    for j in range(k//2):
        newque = []
        while len(que)!=0:
            q = que.pop()
            for l in node[q]:
                if check[l]:
                    continue
                newque.append(l)
                check[l] = True
                count += 1
        que = newque
    M = max(M,count)
print(n-M)

### FIXED CODE ###

n,k = [int(i) for i in input().split()]
edges = [[int(i)-1 for i in input().split()] for j in range(n-1)]

node = [[] for _ in range(n)]
for edge in edges:
    node[edge[0]].append(edge[1])
    node[edge[1]].append(edge[0])

M = 0
for i in range(n):
    count = 1
    que = []
    check = [False]*n
    if k%2==0:
        check[i] = True
        que.append(i)
    elif i!=n-1:
        check[edges[i][0]]=True
        check[edges[i][1]]=True
        que.append(edges[i][0])
        que.append(edges[i][1])
        count = 2
    for j in range(k//2):
        newque = []
        while len(que)!=0:
            q = que.pop()
            for l in node[q]:
                if check[l]:
                    continue
                newque.append(l)
                check[l] = True
                count += 1
        que = newque
    M = max(M,count)
print(n-M)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h_list = input().split()
h_list = [int(h) for h in h_list]

count = 0

for i in range(n):
    a_height = h_list[i]
    for k in range(i + 1, n):
        b_height = h_list[k]
        if k <= b_height:
            continue
        elif k - i == a_height + b_height:
            count += 1

print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h_list = input().split()
h_list = [int(h) for h in h_list]

count = 0
result_dict = {}

for i in range(n):
    key = (i+1) + h_list[i]
    value = result_dict.get(key, 0)
    result_dict[key] = value + 1

for j in range(n):
    key = (j+1) - h_list[j]
    count += result_dict.get(key, 0)

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

x, y = map(int, input().split())
if x == y:
    print(-1)
elif y == 1:
    print(-1)
else:
    for i in range(x, 10**18+1, x):
        if i % x == 0:
            if not i % y == 0:
                print(i)
                exit()


### FIXED CODE ###

x, y = map(int, input().split())
if x % y == 0:
    print(-1)
else:
    print(x)
### BUGGY CODE ###

n,m=map(int,input().split())
ans=set(range(1,n+1))
for i in range(m):
    l,r=map(int,input().split())
    tmp=set(range(l,r+1))
    ans=ans&tmp
print(len(ans))

### FIXED CODE ###

n,m=map(int,input().split())
left=0
right=n
for i in range(m):
    l,r=map(int,input().split())
    left=max(l,left)
    right=min(r,right)
print(max(0,right-left+1))
### BUGGY CODE ###

from collections import Counter
n=int(input())
c=input()
d=Counter(c)
wn,rn=Counter(c)["W"], Counter(c)["R"]

MIN=min(wn,rn)
ans=[]

for i in range(MIN):
  w=Counter(c[:i])["W"]
  r=rn-(i-w)
  if w<=r:
    ans.append(r)
  else:
    ans.append(w)

if ans:
  print(min(ans))
else:
  print(0)

### FIXED CODE ###

from collections import Counter
n=int(input())
c=input()
d=Counter(c)
w,r=Counter(c)["W"], Counter(c)["R"]
ans=0
for i in range(r):
  if c[i]=="W":
    ans+=1

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

# D - Dice in Line

N, K = map(int, input().split())
P = [int(p) for p in input().split()]

Q = [0] * N
for i in range(N):
    Q[i] = ((1 + P[i]) * P[i] / 2) / P[i]

R = [0] * (N - K + 1)
for i in range(N - K + 1):
    for j in range(i, i + K):
        R[i] += Q[j]

print(max(R))


### FIXED CODE ###

# D - Dice in Line

N, K = map(int, input().split())
P = [int(p) for p in input().split()]

Q = [0] * (N + 1)
for i in range(N):
    q = ((1 + P[i]) * P[i] / 2) / P[i]
    Q[i + 1] = Q[i] + q

mx = 0
for i in range(N - K + 1):
    mx = max(mx, Q[i + K] - Q[i])

print(mx)
### BUGGY CODE ###

s = input()
cnt = 0
while True:
    state = False
    if len(s) == 0:
        break
    li = []
    for i in s:
        li.append(i)
    for i in range(len(li)-1):
        if li[i] == "0" and li[i+1] == "1":
            li[i] = ""
            li[i+1] = ""
            cnt+=1
            state = True
        elif li[i] == "1" and li[i+1] == "0":
            li[i] = ""
            li[i+1] = ""
            cnt+=1
            state = True
    s = ""
    for i in range(len(li)):
        s += li[i]
    if state == False:
        break
print(cnt*2)
    

### FIXED CODE ###

s = input()
cnt1 = 0
cnt0 = 0
for i in range(len(s)):
    if s[i] == "0":
        cnt0 +=1
    else:
        cnt1+=1
print(min(cnt0,cnt1)*2)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
def dfs(A, start):
    global ans
    if len(A) == 2:
        ans += ((A[0]*A[1])%MOD)
        return
    else:
        for i in range(start, len(a)):
            A.append(a[i])
            dfs(A, i+1)
            A.pop()

dfs([], 0)
print(ans%MOD)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
acc = [0]
ans = 0
for i in a:
    acc.append(acc[-1]+i)
acc = acc[1:]
for i, v in enumerate(a):
    ans += (v*(acc[-1]-acc[i]))%MOD
print(ans%MOD)
### BUGGY CODE ###

N, A, B = map(int, input().split())

cnt = []
for n in range(10 ** 100):
    if len(cnt) == N:
        break
    for i in range(A):
        if len(cnt) == N:
            break
        cnt.append("b")
    for j in range(B):
        if len(cnt) == N:
            break
        cnt.append("r")
print(cnt.count("b"))

### FIXED CODE ###

N, A, B = map(int, input().split())

cnt = A * int(N / (A+B))
if (N % (A+B)) <= A:
    cnt += (N % (A+B))
else:
    cnt += A

print(cnt)
### BUGGY CODE ###

import numpy as np
from collections import deque

ab = np.array([], int)
n,m = map(int, input().split())

for i in range(m):
    ab = np.append(ab, list(map(int, input().split())), axis=0)

ab = ab.reshape(m,2)

path = []

for i in range(n):
    path.append([])

for i in range(m):
    path[ab[i][0]-1].append(ab[i][1])
    path[ab[i][1]-1].append(ab[i][0])
    
d = deque([0])
dis = np.ones(n, int) * -1
dis[0] = 0

while len(d) != 0:
    hop = d.popleft()
    for i in path[hop]:
        if dis[i-1] == -1:
            d.append(i-1)
            dis[i-1] = hop+1
    
    hop += 1
    
if np.count_nonzero(dis)+1 != n:
    print('No')
else:
    print('Yes')
    for i in range(1,len(dis)):
        print(dis[i])

### FIXED CODE ###

from collections import deque

n,m = map(int, input().split())

path = [[] for _ in range(n)]

for i in range(m):
    a,b = map(int, input().split())
    path[a-1].append(b)
    path[b-1].append(a)
    
d = deque([0])
dis = [-1 for _ in range(n)]
dis[0] = 0

while d:
    hop = d.popleft()
    for i in path[hop]:
        if dis[i-1] == -1:
            d.append(i-1)
            dis[i-1] = hop+1
            
if -1 in dis:
    print('No')
else:
    print('Yes')
    for i in range(1,len(dis)):
        print(dis[i])
### BUGGY CODE ###

N = int(input().strip())
array = list(map(int, input().strip().split()))
ans = 1
for i in array:
  ans *= i
if ans > 1e18:
  print(-1)
else :
  print(ans)

### FIXED CODE ###

import sys
N = int(input().strip())
array = list(map(int, input().strip().split()))
ans = 1
for i in array:
  if i == 0:
    print(0)
    sys.exit()
for i in array:
  ans *= i
  if ans > 1e18:
    print(-1)
    sys.exit()
if ans > 1e18:
  print(-1)
else :
  print(ans)
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    K, S = map(int, input().split())
    ret = 0
    for z in range(K+1):
        for y in range(K+1):
            if S-z-y in range(K+1):
                ret += 1
    print(ret)

if __name__ == '__main__':
    main()

### FIXED CODE ###

k,s=map(int,input().split())
cnt=0
for x in range(k+1):
  if x<=s:
    for y in range(k+1):
      z=s-(x+y)
      if 0<=z<=k:
        cnt+=1
print(cnt)
### BUGGY CODE ###

def main(N,Q,C,LR):
    data=[0]*(N+1)
    def add(i,x):
        i+=1
        while i<=N:
            data[i]+=x
            i+=i&-i
    def sum(a,b):
        r=0
        i=b
        while i>0:
            r+=data[i]
            i-=i&-i
        i=a
        while i>0:
            r-=data[i]
            i-=i&-i
        return r
    p=[-1]*N
    q=0
    a=[0]*Q
    for i in range(N):
        if p[C[i]-1]>=0:
            add(p[C[i]-1],-1)
        p[C[i]-1]=i
        add(i,1)
        while q<Q and LR[q][2]==i+1:
            a[LR[q][0]]=sum(LR[q][1]-1,LR[q][2])
            q+=1
    return a

import sys
if sys.argv[-1]=='ONLINE_JUDGE':
    from numba import*
    from numba.pycc import CC
    cc=CC('my_module')

    def cc_export(f,signature):
        cc.export(f.__name__,signature)(f)
        return njit(f)

    main=cc_export(main,(i8,i8,i8[:],i8[:,:]))
    cc.compile()
    exit()

N,Q=map(int,input().split())
import numpy as np
C=np.array(input().split(),dtype=np.int64)
LR=sorted([[i]+list(map(int,input().split())) for i in range(Q)],key=lambda x:x[2])
LR=np.array(LR)

from my_module import main
print(*main(N,Q,C,LR),sep='\n')

### FIXED CODE ###

def main(N,Q,C,LR,A):
    data=[0]*(N+1)
    def add(i,x):
        i+=1
        while i<=N:
            data[i]+=x
            i+=i&-i
    def sum(a,b):
        r=0
        i=b
        while i>0:
            r+=data[i]
            i-=i&-i
        i=a
        while i>0:
            r-=data[i]
            i-=i&-i
        return r
    p=[-1]*N
    q=0
    a=[0]*Q
    for i in range(N):
        if p[C[i]-1]>=0:
            add(p[C[i]-1],-1)
        p[C[i]-1]=i
        add(i,1)
        while q<Q and LR[A[q]][1]==i+1:
            a[A[q]]=sum(LR[A[q]][0]-1,LR[A[q]][1])
            q+=1
    return a

import sys
if sys.argv[-1]=='ONLINE_JUDGE':
    from numba import*
    from numba.pycc import CC
    cc=CC('my_module')

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return njit(f)

    main=cc_export(main,(i8,i8,i8[:],i8[:,:],i8[:]))
    cc.compile()
    exit()

def input(): return sys.stdin.buffer.readline()
N,Q=map(int,input().split())
import numpy as np
C=np.array(input().split(),dtype=np.int64)
LR=np.array(sys.stdin.buffer.read().split(),dtype=np.int64).reshape(Q,2)
A=np.argsort(LR[:,1])

from my_module import main
print(*main(N,Q,C,LR,A),sep='\n')
### BUGGY CODE ###

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

n, m, s, t = list(map(int, input().split()))
graph = [0] + [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = list(map(int, input().split()))
    # (cost, dest)
    graph[u].append(({'yen': a, 'sunuke': b}, v))
    graph[v].append(({'yen': a, 'sunuke': b}, u))

import heapq

def dijkstra(graph, queue, dist, cost_type):
    while queue:
        d, n = heapq.heappop(queue)
        if dist[n] != -1 and dist[n] < d:
            continue
        for cost, next_n in graph[n]:
            cost_with_type = cost[cost_type]
            if dist[next_n] > d + cost_with_type:
                dist[next_n] = d + cost_with_type
                queue.append((dist[next_n], next_n))

queue = [(0, s)]
dist_yen = [10 ** 16] + [10 ** 16] * n
dist_yen[s] = 0
dijkstra(graph, queue, dist_yen, 'yen')

queue = [(0, t)]
dist_sunuke = [10 ** 16] + [10 ** 16] * n
dist_sunuke[t] = 0
dijkstra(graph, queue, dist_sunuke, 'sunuke')

import collections
answer = collections.deque()
for i in range(1, n + 1):
    answer.append(10 ** 15 - (dist_yen[i] + dist_sunuke[i]))
for i in range(n):
    print(max(answer))
    answer.popleft()


### FIXED CODE ###

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

n, m, s, t = list(map(int, input().split()))
graph = [0] + [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = list(map(int, input().split()))
    # (cost, dest)
    graph[u].append(({'yen': a, 'sunuke': b}, v))
    graph[v].append(({'yen': a, 'sunuke': b}, u))

import heapq

def dijkstra(graph, queue, dist, cost_type):
    while queue:
        d, n = heapq.heappop(queue)
        if dist[n] != -1 and dist[n] < d:
            continue
        for cost, next_n in graph[n]:
            cost_with_type = cost[cost_type]
            if dist[next_n] > d + cost_with_type:
                dist[next_n] = d + cost_with_type
                heapq.heappush(queue, (dist[next_n], next_n))

queue = [(0, s)]
dist_yen = [10 ** 16] + [10 ** 16] * n
dist_yen[s] = 0
dijkstra(graph, queue, dist_yen, 'yen')

queue = [(0, t)]
dist_sunuke = [10 ** 16] + [10 ** 16] * n
dist_sunuke[t] = 0
dijkstra(graph, queue, dist_sunuke, 'sunuke')

# FYI: https://atcoder.jp/contests/soundhound2018-summer-qual/submissions/10738125
answer = [0] + [0] * n
for i in range(n, 0, -1):
    answer[i - 1] = max(answer[i], 10 ** 15 - (dist_yen[i] + dist_sunuke[i]))
for i in range(n):
    print(answer[i])
### BUGGY CODE ###

n = int(input())
pf = []
i = 2
while n > 1:
    j = 0
    while n % i == 0:
        n = n // i
        j += 1
    if j > 0:
        pf.append(j)
    i += 1

ans = 0
for i in pf:
    tmp = i
    j = 1
    while j <= tmp:
        tmp -= j
        ans += 1
        j += 1
print(ans)

### FIXED CODE ###

from math import ceil
n = int(input())
pf = []
t = n
if n == 1:
    print(0)
    exit()
for i in range(2, ceil(n ** 0.5) + 1):
    c = 0
    while t % i == 0:
        c += 1
        t //= i
    if c > 0: pf.append(c)
if t != 1: pf.append(1)

ans = 0
for i in pf:
    tmp = i
    j = 1
    while j <= tmp:
        tmp -= j
        ans += 1
        j += 1
print(ans)
### BUGGY CODE ###

S = list(map(int, list(input())))

mods = [0 for _ in range(2019)]
mods[0] = 1

num = 0
for itr, s in enumerate(S[::-1]):
  num = s * 10 ** itr + num
  num %= 2019
  mods[num] += 1
  
ans = 0
for m in mods:
  ans += m * (m - 1) // 2

print(ans)


### FIXED CODE ###

S = list(map(int, list(input())))

MOD = 2019

mods = [0 for _ in range(2019)]
mods[0] = 1

num = 0
digit = 1
for s in S[::-1]:
  num = s * digit + num
  num %= MOD
  mods[num] += 1
  digit = (digit * 10) % MOD
  
ans = 0
for m in mods:
  ans += m * (m - 1) // 2

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

n,k=map(int,input().split())
H=list(map(int,input().split()))
A=[float("inf")]*n
A[0]=0
for i in range(1,n):
  for j in range(1,min(i+1,k+1)):
    A[i]=min(A[i],A[i-j]+abs(H[i]-H[i-j]))
print(A[n-1])

### FIXED CODE ###

def solve():
  n,k=map(int,input().split())
  H=list(map(int,input().split()))
  A=[0]*n
  for i in range(1,n):
    A[i]=min(A[i-j]+abs(H[i]-H[i-j]) for j in range(1,min(i+1,k+1)))
  return A[n-1]
print(solve())
### BUGGY CODE ###



N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]

l=[0]*(N+1)
l[0]=1

for i in range(N):
    c=l[i]%1000000007
    if i>N-2:
        if i not in a:
            l[i+1]+=c
    elif i not in a:
        l[i+1]+=c
        l[i+2]+=c

print(l[N]%1000000007)

### FIXED CODE ###

N,M=map(int,input().split())
a={int(input()) for _ in range(M)}

l=[0]*(N+1)
l[0]=1

for i in range(N):
    c=l[i]%1000000007
    if i>N-2:
        if i not in a:
            l[i+1]+=c
    elif i not in a:
        l[i+1]+=c
        l[i+2]+=c

print(l[N]%1000000007)
### BUGGY CODE ###

def main():
    from collections import deque
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    kitai=[]
    queue=deque()
    ans=0
    for i in range(n):
        buf=sum(range(1,p[i]+1))/p[i]
        kitai.append(buf)
        if i<=k-1:
            queue.append(buf)
            ans+=buf
    for i in range(k,n):
        queue.popleft()
        queue.append(kitai[i])
        if ans<=sum(queue):
            ans=sum(queue)
    print(ans)

if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    kitai=[]
    ans=0
    for i in range(n):
        buf=sum(range(1,p[i]+1))/p[i]
        kitai.append(buf)
        if i<=k-1:
            ans+=buf
    x=ans
    for i in range(k,n):
        x-=kitai[i-k]
        x+=kitai[i]
        if ans<=x:
            ans=x
    print(ans)

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

import math
n, d, a = map(int,input().split())
e = [[] for i in range(n)]
for i in range(n):
    x, h = map(int,input().split())
    e[i] = [x,h]
e.sort()
num = 0

for i in range(n):
    if e[i][1] > 0:
        k = math.ceil(e[i][1]/a)
        num += k
        for j in range(i+1,n):
            if e[j][0] <= e[i][0] + 2*d:
                e[j][1] -= k*a
            else:
                break

print(num)


### FIXED CODE ###

import math
n, d, a = map(int,input().split())
e = [[] for i in range(n)]
for i in range(n):
    x, h = map(int,input().split())
    e[i] = [x,h]
num = 0

e.sort()
sd = [0 for i in range(n)]
l = [i for i in range(n)]
for i in range(n):
    for j in range(l[i-1],i):
        if e[i][0]-e[j][0] <= 2*d:
            l[i] = j
            break

for i in range(n):
    res = e[i][1] - sd[i-1] + sd[l[i]-1]
    if res < 0:
        sd[i] = sd[i-1]
    else:
        k = math.ceil(res/a)
        sd[i] = sd[i-1]+k*a
        num += k

print(num)
### BUGGY CODE ###

N,A,B=map(int,input().split())

cnt_blue = 0
cnt_red = 0
total = 0

while(True):
    cnt_blue += A
    total += A
    if N <= total:
        cnt_blue = cnt_blue - (total - N)
        break 
    cnt_red += B
    total += B
    if N <= total:
        cnt_red = cnt_red - (total - N)
        break
print(cnt_blue)

### FIXED CODE ###

N,A,B=map(int,input().split())

cnt_blue = 0
total_tmp = 0

try:
    pre_cnt = N // (A+B)
    total_tmp = pre_cnt * (A+B)
    total_tmp += A
    if N <= total_tmp:
        cnt_blue = N -  (pre_cnt * B)
    else:
        cnt_blue = (pre_cnt * A) + A
    print(cnt_blue)
except Exception as e:
    print(0)
### BUGGY CODE ###

def popcnt1(n):
    return bin(n).count("1")


N = int(input())
X = input()


def solve(n):
    global res
    if popcnt1(n) == 0:
        return res
    n = n%popcnt1(n)
    res += 1
    solve(n)


for i in range(N):
    res = 0
    tX = list(X)
    if X[i] == "0":
        tX[i] = "1"
    else:
        tX[i] = "0"
    tXs = "".join(tX)
    solve(int(tXs, 2))
    print(res)

### FIXED CODE ###

# 数のbitに含まれる1の数をカウント
def bitsoncount(x):
    return bin(x).count('1')

def solve(x):
    global ans
    bx = bitsoncount(x)
    if bx == 0:
        return ans
    else:
        ans += 1
        x = x % bx
        solve(x)


N = int(input())
X = input()

Xb = bitsoncount(int(X, 2))
if (Xb - 1) != 0:
    X0 = int(X, 2) % (Xb-1)
X1 = int(X, 2) % (Xb+1)

for x, i in zip(X, reversed(range(N))):
    x = int(x)
    if x == 0:
        temp = (X1 + pow(2, i, Xb+1)) % (Xb+1)
        ans = 1
    else:
        if Xb - 1 == 0:
            print(0)
            continue
        temp = (X0 - pow(2, i, Xb-1)) % (Xb-1)
        ans = 1
    
    solve(temp)
    print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
def seek(LIST:list):
    global ans
    max_num = max(LIST)
    index = LIST.index(max(LIST))
    if(index == 0):
        for i in LIST[index:]:
            ans += max_num-i
    else:
        for i in LIST[index:]:
            ans += max_num-i
        new_list = LIST[0:index]
        seek(new_list)
seek(A)
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
max_num = A[0]
ans = 0
for i in A:
    if(max_num>=i):
        ans += max_num-i
    else:
        max_num = i
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
count=0
while len(a)>=2:
    ma=max(a)
    guess =a.index(ma)
    for i in range(guess,len(a)):
        count+=ma-a[i]
    a=a[:guess]
print(count)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
count=0
ma=a[0]
for i in range(1,len(a)):
    if a[i]<ma:
        count+=ma-a[i]
    else:
        ma=a[i]
print(count)
### BUGGY CODE ###

# encoding: "utf-8"

from collections import defaultdict

# class Stdin:
#     @staticmethod
#     def read_line(converter=str):
#         return [converter(x) for x in input().split()]
    
#     @staticmethod
#     def read_lines(n, converter=str):
#         result = list()
#         for _ in range(n):
#             result.append(Stdin.read_line(converter))
#         return result
    
#     @staticmethod
#     def convert(data, converter):
#         assert(len(data) == len(converter))
#         return tuple(map(lambda x, f: f(x), data, converter))

#     @staticmethod
#     def convert_lines(datas, n, converter):
#         return [converter(data, n, converter) for data in datas]


def first_count_and_pop(xs):
    cnt = 0
    fst = xs[0]
    # cnt = xs.count(fst)
    for x in xs:
        if x != fst:
            break
        cnt += 1
    return (cnt, xs[cnt:])    
    

def main():
    _ = input()
    # xs = Stdin.read_line(converter=int)
    xs = [int(x) for x in input().split()]
    xs.sort()
    ys = defaultdict(int)
    # for key in xs:
    #     ys[key] += 1
    #     ys[key-1] += 1
    #     ys[key+1] += 1
    while xs:
        key = xs[0]
        cnt, xs = first_count_and_pop(xs)
        ys[key] += cnt
        ys[key-1] += cnt
        ys[key+1] += cnt

    print(max(ys.values()))

# def main_():
#     input()
#     xs = Stdin.read_line(converter=int)
#     xs.sort()
#     counts = list()
#     for i in range(100000):
#         if not xs:
#             counts.extend([0] * (100000 - len(counts)))
#             break     
#         elif i == xs[0]:
#             cnt, xs = first_count_and_pop(xs)
#             counts.append(cnt)
#         else:
#             counts.append(0)
#     m = 0
#     for i in range(0, 100000):
#         if i == 0:
#             temp = counts[i] + counts[i+1]
#         elif i == 100000 - 1:
#             temp = counts[i-1] + counts[i]
#         else:
#             temp = counts[i-1] + counts[i] + counts[i+1]
#         if m < temp:
#             m = temp
#     print(m)

if __name__ == "__main__":
    main()

### FIXED CODE ###

input()
a_list = [int(s) for s in input().split()]

count = [0]*100002

for a in a_list:
    count[a] += 1
    count[a+1] += 1
    count[a+2] += 1
    
print(max(count))
### BUGGY CODE ###

in1 = input().split()
in1num = [int(x) for x in in1]
N = in1num[0]
K = in1num[1]
#print(N, K)

while abs(N-K) < N:
  N = abs(N-K)
print(N)


### FIXED CODE ###

in1 = input().split()
in1num = [int(x) for x in in1]
N = in1num[0]
K = in1num[1]
#print(N, K)

#while abs(N-K) < N:
#  N = abs(N-K)
#print(N)

q, mod = divmod(N, K)
#print(q, mod)
if mod == 0:
  print(0)
else:
  if K - mod < mod:
    print(K-mod)
  else:
    print(mod)