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

N,K = list(map(int,input().split(" ")))
hs = list(map(int,input().split(" ")))
dp = [0] 
 

for i in range(1,N):
 
    stepLim = min(K,i)
    temp = 9999999999999999999
    for j in range(1,stepLim + 1):
        c = dp[i-j]+abs(hs[i]-hs[i-j])
        if temp >c:
                temp = c
    dp.append(temp)
print(dp[-1])

### FIXED CODE ###

N,K = list(map(int,input().split(" ")))
hs = list(map(int,input().split(" ")))
dp = [9999999999999] * N

dp[0] = 0
for i in range(1,N):
#ind → i-1 ~ i-stepLim -1   [i-stepLim -1:i]
    stepLim = min(K,i)
    temp = 9999999999999999999
    dp[i] = min([d+abs(hs[i]-h) for d,h in zip(dp[i-stepLim:i],hs[i-stepLim:i])])
print(dp[-1])
### BUGGY CODE ###

def add2(l):
    ys = []
    for i in range(len(l)):
        ys += [l[i] + x for x in l[i+1:]]
    return ys


def add(n, l):
    if not l:
        return []
    elif n == 1:
        return l
    elif n == 2:
        return add2(l)
    else:
        ys = [x for x in add(n, l[1:])]
        ys += [l[0] + x for x in add(n-1, l[1:])]
        return ys


def main():
    n, a = (int(x) for x in input().split())
    xs = [int(x) for x in input().split()]
    tot = sum(xs)

    if n == 1:
        count = len([x for x in xs if x == a])
    else:
        count = 0
        lop = n // 2 + 1
        for i in range(1, n//2+1):
            ys = add(i, xs)
            count += len([y for y in ys if y == a * i])
            if n - i > i:
                zs = [tot - x for x in ys]
                count += len([z for z in zs if z == a * (n - i)])
        if sum(xs) == n * a:
            count += 1

    print(count)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import numpy as np
n,avea=tuple(map(lambda x:int(x),input().split()))
x=list(map(lambda x:int(x), input().split()))
x=np.array(x)
x=x-avea
w=max(abs(min(x)),abs(max(x)))*n
dp=np.zeros((n+1,2*w+1),dtype=int)
dp[0,w]=1
for i in range(n):
    for j in range(2*w+1):
        if 0<=j-x[i]<=2*w:
            dp[i+1,j]=dp[i,j]+dp[i,j-x[i]]
        else:
            dp[i+1,j]=dp[i,j]
print(dp[n,w]-1)
### BUGGY CODE ###

from math import factorial

N = factorial(int(input()))
i = 2
ans = dict()
n = N
while i*i <= N:
    while n%i ==0:
        n = n//i
        if i in ans:
            ans[i] += 1
        else:
            ans[i] = 1
    i += 1
if n != 1:
    ans[n] = 1

cnt = 1
for value in ans.values():
    cnt *= value + 1
M = 10**9 + 7    
print(cnt%M)

### FIXED CODE ###

from math import factorial
N = factorial(int(input()))
mod = 10**9 + 7
ans = 1
i = 2

while i*i <= N:
    cnt = 1
    while N%i == 0:
        cnt += 1
        N //= i
    ans *= cnt
    i += 1

if N != 1:
    ans *= 2
print(int(ans%mod))
### BUGGY CODE ###

s=input()
q=int(input())

rev = 1
fr = ""
rr = ""

for i in range(q):
    ss=input()
    if int(ss[0])==1:
        rev *= -1
    else:
        f,c=int(ss[2]),ss[4]
        if f == 2:
            f = -1
        
        if f*rev ==1:
            fr+=c
        else:
            rr+=c

ans = fr[::-1]+s+rr
if rev == -1:
    ans = ans[::-1]
print(ans)

### FIXED CODE ###

s=input()
q=int(input())

rev = 1
fr = ""
rr = ""

for i in range(q):
    ss=input()
    if int(ss[0])==1:
        rev *= -1
    else:
        f,c=int(ss[2]),ss[4]
        if f == 2:
            f = -1
        
        if f*rev ==1:
            fr+=c
        else:
            rr+=c

if rev == 1:
    ans = fr[::-1]+s+rr
else:
    ans = rr[::-1]+s[::-1]+fr
print(ans)
### BUGGY CODE ###

n=int(input())
v=list(map(int,input().split()))
odd=[]
even=[]
a=[]
b=[]
for i in range(n//2):
    odd.append(v[2*i+1])
    even.append(v[2*i])
lodd=list(set(odd))
leven=list(set(even))
for i in range(len(lodd)):
    a.append([odd.count(lodd[i]),lodd[i]])
for i in range(len(leven)):
    b.append([even.count(leven[i]),leven[i]])
a.sort()
b.sort()
if a[-1][1]!=b[-1][1]:
    print(n-a[-1][0]-b[-1][0])
if a[-1][1]==b[-1][1]:
    if len(a)>1 and len(b)>1:
        print(min(n-a[-1][0]-b[-2][0],n-a[-2][0]-b[-1][0]))
    if len(a)>1 and len(b)==1:
        print(n-a[-2][0]-b[-1][0])
    if len(a)==1 and len(b)>1:
        print(n-a[-1][0]-b[-2][0])
    if len(a)==1 and len(b)==1:
        print(n//2)

### FIXED CODE ###

from collections import Counter
n=int(input())
v=list(map(int,input().split()))
odd=v[1::2]
even=v[0::2]
a=Counter(odd)
b=Counter(even)
if a.most_common()[0][0]!=b.most_common()[0][0]:
    print(n-a.most_common()[0][1]-b.most_common()[0][1])
else:
    if len(a)>1 and len(b)>1:
        print(min(n-a.most_common()[0][1]-b.most_common()[1][1],n-a.most_common()[1][1]-b.most_common()[0][1]))
    elif len(a)>1 and len(b)==1:
        print(n-a.most_common()[1][1]-b.most_common()[0][1])
    elif len(a)==1 and len(b)>1:
        print(n-a.most_common()[0][1]-b.most_common()[1][1])
    elif len(a)==1 and len(b)==1:
        print(n//2)
### BUGGY CODE ###

#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : July 05, 2020
##################################################### SOURCE START #####################################################

import heapq

N = int(input().strip())
As = list(map(lambda s: -int(s), input().strip().split()))

heapq.heapify(As)

for n in range(N):
    a = - heapq.heappop(As)
    if   n == 0:
        g, gs = 0, [a]
    elif n == 1:
        g, gs = gs[0], [a, a]
    else:
        max_g = max(gs)
        idx_g = gs.index(max_g)
        g += gs[idx_g]
        gs[idx_g] = a
        gs.insert(idx_g, a)

print(g)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker


### FIXED CODE ###

#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : July 05, 2020
##################################################### SOURCE START #####################################################

import heapq
import collections

N = int(input().strip())
As = list(map(lambda s: -int(s), input().strip().split()))

heapq.heapify(As)

g  = 0
gs = collections.deque()

for n in range(N):

    a = - heapq.heappop(As)

    if n == 0:
        gs.append(a)    
    else:
        g += gs.popleft()
        gs.append(a)
        gs.append(a)

print(g)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker
### BUGGY CODE ###

s = input()
n = int(input())
qs = [list(input().split()) for i in range(n)]
for q in qs:
    if len(q) == 1:
        s = s[::-1]
    elif len(q) == 3:
        if int(q[1]) == 1:
            s = q[2]+s
        elif int(q[1]) == 2:
            s = s+q[2]
print(s)

### FIXED CODE ###

from collections import deque
s = deque(input())
n = int(input())
qs = [list(input().split()) for i in range(n)]
pre = deque()
suf = deque()
frag = True
for q in qs:
    if len(q) == 1:
        frag = not frag
    else:
        if (frag, q[1]) == (True, "1") or (frag, q[1]) == (False, "2"):
            pre.appendleft(q[2])
        else:
            suf.append(q[2])
if frag is True:
    print("".join(list(pre)+list(s)+list(suf)))
else:
    suf.reverse()
    s.reverse()
    pre.reverse()
    print("".join(list(suf)+list(s)+list(pre)))
### BUGGY CODE ###

n=int(input())
s=[]
z=0

for i in range(0,n):
    m=input()
    y=list(m)
    y.sort()
    m=''.join(y)
    s.append(m)



for j in range(0,n):
    for i in range(0,n):
        if s[j]==s[i]:
            z=z+1


z=(z-n)//2

print(z)

### FIXED CODE ###

n=int(input())
s=[]
z=0
d=0

for i in range(0,n):
    m=input()
    y=list(m)
    y.sort()
    m=''.join(y)
    s.append(m)

s.sort()

for j in range(0,n-1):
    if s[j]==s[j+1]:
        d=d+1
    else:
        if d==0:
            continue
        else:
            f=d*(d+1)//2
            z=z+f
            d=0
if d!=0:
    f=d*(d+1)//2
    z=z+f

print(z)
### BUGGY CODE ###

N = int(input())
P = list(map(int, input().split()))

count = 1
for i in range(1, N):
    for j in range(i):
        if P[j] < P[i]:
            break
    else:
        count = count + 1

print(count)

### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))

count = 1
minP = P[0]
for i in range(1, N):
    if P[i] < minP:
        count = count + 1
        minP = P[i]

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

N=input()
a=list(map(int,input().split()))
count=0
while all(x%2==0 for x in a):
    count+=1
print(count)

### FIXED CODE ###

N=input()
a=list(map(int,input().split()))
count=0
while all(x%2==0 for x in a):
    a=[x/2 for x in a]
    count+=1
print(count)
### BUGGY CODE ###

n = int(input())
s = list(input())
ans = n
for i in range(n):
    if i == 0:
        ans = min(ans, s[1:].count("E"))
    elif i == n-1:
        ans = min(ans, s[:n-2].count("W"))
    else:
        ans = min(ans, s[:i-1].count("W")+s[i+1:].count("E"))
print(ans)


### FIXED CODE ###

n = int(input())
s = list(input())
w = [0] * (n+1)
e = [0] * (n+1)
ans = n
for i in range(n):
    if s[i] == "W":
        w[i+1] = w[i] + 1
    else:
        w[i+1] = w[i]

for i in range(n-1, -1, -1):
    if s[i] == "E":
        e[i] = e[i+1] + 1
    else:
        e[i] = e[i+1]

for i in range(1, n+1):
    ans = min(ans, w[i-1]+e[i])
print(ans)
### BUGGY CODE ###

nums = int(input())
ary  = list(map(int,input().split()))
count =0
max_count = 0
ary.sort()

for x in ary:
    for i in range(nums):
        if ary[i] == x+1 or ary[i] == x or ary[i] == x-1:
            count += 1
        if ary[i] == x+2:
            break
    if count > max_count:
        max_count = count
    count = 0
print(max_count)

### FIXED CODE ###

nums = int(input())
ary  = list(map(int,input().split()))
count =0
max_count = 0
ary.sort()
ary_count = [0 for i in range(100005)]
ary_count.append(0)

for i in ary:
    ary_count[i] += 1

for i in range(1,100005):
    count += ary_count[i]
    count += ary_count[i+1]
    count += ary_count[i-1]
    if count > max_count:
        max_count = count
    count = 0
print(max_count)
### BUGGY CODE ###

#ないよりも10倍以上早くなる
import sys
input = sys.stdin.readline

K,S=map(int,input().split())
if 2<=K<=2500 and 0<=S<=3*K:
    count=0
    Ks=[]
    wa=[]
    for i in range(K+1):
        Ks.append(i)
    X,Y,Z =Ks,Ks,Ks
    for x in X:
        if x<=S:
            X_=[]
            X_.append(x)
            for y in Y:
                if y<=S:
                    X_Y_=list(X_)
                    X_Y_.append(y)
                    wa_=sum(X_Y_)
                    wa.append(wa_)
    for z in Z:
        for j in wa:
            j+=z
            if j==S:
                count+=1
    print(count)

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        if S-(x+y)>=0 and S-(x+y)<=K: count+=1
print(count)
### BUGGY CODE ###

from sys import stdin
import fractions
mod = 10**9+7
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l = 1
for i in A:
    l = lcm(l,i)
    
for j in A:
    ans += (l//j)
    ans %= mod
    
print(ans)


### FIXED CODE ###

from sys import stdin
import fractions
mod = 10**9+7
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def div(a, b):
    return mul(a, pow(b, mod-2,mod))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l = 1
for i in A:
    l = lcm(l,i)
    
for j in A:
    ans += div(l,j)
    ans %= mod
    
print(ans)
### BUGGY CODE ###

n = int(input())
ai = [int(x) for x in input().split()]
bn = [0] * n
cn = [0] * n
dn = [0] * n

for i in range(0,n):
    j = n - 1 - i
    if (n//(j+1)<1):
        bn[j] = ai[j]
    else:
        bn[j] = (cn[j] + ai[j]) % 2

    if bn[j] == 1:
        for k in range(0,((j+1)//2)+1):
            if (j+1)%(k+1) == 0:
                cn[k] += 1

m = sum(bn)
print(m)
for i in range(0,n):
    if bn[i] == 1:
        print(i+1, end=" ")


### FIXED CODE ###

n = int(input())
ai = [int(x) for x in input().split()]
bn = [0] * n

for i in range(0,n):
    j = n - 1 - i
    c = 0
    for k in range(2, n+1):
        idx = k * (j + 1) - 1
        if  idx > n-1:
            break
        c += bn[idx]
    
    bn[j] = (c + ai[j]) % 2


m = sum(bn)
print(m)
for i in range(0,n):
    if bn[i] == 1:
        print(i+1, end=" ")
### BUGGY CODE ###

import math
import sys
N=int(input())
a=sys.stdin.readline().split()
A=[int(b) for b in a]
numbers=[0]*N
for a in range(1,N+1):
    kosuu=A.count(a)
    if kosuu<=1:
        pass
    else:
        numbers.insert(a-1,kosuu)
answers=[0]*N
for a in range(1,N+1):
    if numbers[a-1]>=2:
        b=numbers[a-1]*(numbers[a-1]-1)//2
        answers[a-1]+=b
kotae=sum(answers)
for a in range(N):
    z=A[a]
    if kotae==0:
        print(0)
    else:
        answer=kotae-numbers[z-1]+1
        print(answer)


### FIXED CODE ###

import math
import sys
from collections import Counter
N=int(input())
a=sys.stdin.readline().split()
A=[int(b) for b in a]
numbers=[0]*N
count=Counter(A)
kotae=0
for a in range(N+1):
    b=count[a]
    kotae+=b*(b-1)//2
for a in A:
    print(kotae+1-count[a])
### BUGGY CODE ###

#coding: utf-8
def main(N, K, h):
    #N, K = map(int, input().split())
    #h = list(map(int, input().split()))
    dp = [float("inf") for _ in range(N)]
    dp[0] = 0
    for i in range(1, N):
        M = i if i <= K else K
        for k in range(1, M+1):
            dp[i] = min(dp[i], dp[i-k] + abs(h[i] - h[i-k]))
    print(dp[N-1])
if __name__ == "__main__":
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    main(N, K, h)

### FIXED CODE ###

#coding: utf-8
import sys
input = sys.stdin.readline
def main(N, K, h):
    dp = [float("inf")] * N
    dp[0] = 0
    for i in range(1, N):
        dp[i] = min(dp[i], min([dp[i-k] + abs(h[i] - h[i-k]) for k in range(1, min(i, K)+1)]))
    print(dp[N-1])
if __name__ == "__main__":
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    main(N, K, h)
### BUGGY CODE ###

import math

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

dic = {}
for a in A:
    if not a in dic:
        dic[a] = 1
    else:
        dic[a] += 1

ansdic = {}

for a in dic:
    ans = 0
    for aa in dic:
        if a == aa:
            t = dic[aa] - 1
        else:
            t = dic[aa]

        if t > 1:
            ans += t * (t - 1) // 2
        
    ansdic[a] = ans

for a in A:
    print(ansdic[a])

### FIXED CODE ###

import math

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

dic = {}
for a in A:
    if not a in dic:
        dic[a] = 1
    else:
        dic[a] += 1

ans = 0
for a in dic:
    if dic[a] > 1:
         ans += dic[a] * (dic[a] - 1) // 2

ansdic = {}

for a in dic:
    ansdic[a] = ans
    if dic[a] > 1:
        ansdic[a] = ans - (dic[a] - 1)

for a in A:
    print(ansdic[a])
### BUGGY CODE ###

import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = {}
for each in a_types:
    count_dict[each] = A.count(each)

for a in A:
    tmp_dict = copy.deepcopy(count_dict)
    tmp_dict[a] = count_dict[a] - 1
    combinations = 0
    for value in tmp_dict.values():
        combinations += int(value * (value - 1) / 2)
    print(combinations)

### FIXED CODE ###

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

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)
### BUGGY CODE ###

k, s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            if i+j+k==s:
                cnt+=1
print(cnt)

### FIXED CODE ###

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

s = input()
n = len(s)
n = max((n, 3))
x, y = map(int, input().split())
dpx = [[False] * 2 * (n + 1) for i in range(n)]
dpy = [[False] * 2 * (n + 1) for i in range(n)]

def c(s):
    ret = 0
    while s and s[0] == 'F':
        ret += 1
        s = s[1:]
    if s and s[0] == 'T':
        s = s[1:]
    return s, ret

s, d = c(s)
dpx[0][n] = True
dpx[1][d+n] = True
dpy[0][n] = True
dp = [dpx, dpy]
turn = 0
while s:
    s, d = c(s)
    turn += 1
    for i in range(-n, n+1):
        if -n <= i + d <= n:
            dp[turn%2][turn//2+1][i+d+n] = dp[turn%2][turn//2+1][i+d+n] \
                    or dp[turn%2][turn//2][i+n]
        if -n <= i - d <= n:
            dp[turn%2][turn//2+1][i-d+n] = dp[turn%2][turn//2+1][i-d+n] \
                    or dp[turn%2][turn//2][i+n]

if dpx[(turn-1)//2+2][x+n] and dpy[(turn-1)//2+1][y+n]:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

s = input()
x, y = map(int, input().split())
hL = len(s)
L = 2 * hL

dp = [[False] * (L + 1) for i in range(2)]
ndp = [False] * (L + 1)

def next(i):
    global s
    while i < hL and s[i] != 'T':
        i += 1
    i += 1
    return i

def c(x):
    global hL
    return x + hL

index = 0
t = 0
js = [1]
dp[0][c(0)] = True
dp[1][c(0)] = True
mini, maxi = 0, 1
while index < hL:
    ni = next(index)
    dx, index = ni - index - 1, ni
    for i in range(mini, maxi):
        for j in js:
            if -hL <= i + j * dx <= hL:
                nx = c(i + j * dx)
                ndp[nx] = ndp[nx] or dp[t][c(i)]
    for i in range(mini, maxi):
        dp[t][c(i)] = False
    dp[t], ndp = ndp, dp[t]
    mini, maxi = mini - dx, maxi + dx
    js = [-1, 1]
    t = (t + 1) % 2
print('Yes' if dp[0][c(x)] and dp[1][c(y)] else 'No')
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

c = 0
for i in range(len(ai)):
    for j in range(len(ai)):
        if i < j and ai[i] == ai[j]:
            c += 1

print(c)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

print(len(ai) - len(list(map(list,set(map(tuple, ai))))))
### BUGGY CODE ###

n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

k = min(n-1, k)

inf = 100000000

dp = [inf for _ in [0]*n]

for i in range(k+1):
	dp[i] = abs(h[0] - h[i])

for i in range(k+1, n):
	
	dp[i] = min([dp[i-j] + abs(h[i-j] - h[i]) for j in range(1, k+1)])

print(dp[-1])


### FIXED CODE ###

n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

k = min(n-1, k)

inf = 100000000

dp = [inf for _ in [0]*n]

def cost(i, j):
	return abs(h[i] - h[j])

for i in range(k+1):
	dp[i] = cost(0, i)

for i in range(k+1, n):
	
	dp[i] = min([dp[i-j] + cost(i-j, i) for j in range(1, k+1)])

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

A,B,Q=map(int, input().split())
S=[int(input()) for _ in range(A)]
T=[int(input()) for _ in range(B)]
X=[int(input()) for _ in range(Q)]

import bisect
def solve(x):
    sl=bisect.bisect_left(S,x)
    sr=bisect.bisect_right(S,x)
    tl=bisect.bisect_left(T,x)
    tr=bisect.bisect_right(T,x)
    sl-=1
    tl-=1
    ret=10**12
    if sl>=0 and tl>=0:
        ret=min(ret,x-min(S[sl],T[tl]))
    if sr<A and tl>=0:
        ret=min(ret,S[sr]-T[tl]+min(S[sr]-x,x-T[tl]))
    if sl>=0 and tr<B:
        ret=min(ret,T[tr]-S[sl]+min(T[tr]-x,x-S[sl]))
    if sr<A and tr<B:
        ret=min(ret,max(S[sr],T[tr])-x)
    return ret

for x in X:
    print(solve(x))

### FIXED CODE ###

import sys
input = sys.stdin.readline
A,B,Q=map(int, input().split())
S=[int(input()) for _ in range(A)]
T=[int(input()) for _ in range(B)]
X=[int(input()) for _ in range(Q)]

import bisect
def solve(x):
    sr=bisect.bisect_right(S,x)
    tr=bisect.bisect_right(T,x)
    sl=sr-1
    tl=tr-1
    ret=10**12
    if sl>=0 and tl>=0:
        ret=min(ret,x-min(S[sl],T[tl]))
    if sr<A and tl>=0:
        ret=min(ret,S[sr]-T[tl]+min(S[sr]-x,x-T[tl]))
    if sl>=0 and tr<B:
        ret=min(ret,T[tr]-S[sl]+min(T[tr]-x,x-S[sl]))
    if sr<A and tr<B:
        ret=min(ret,max(S[sr],T[tr])-x)
    return ret

for x in X:
    print(solve(x))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())
s = list(input() for _ in range(n))

s_set = sorted(list(set(s)))
s_num = [0]*len(s_set)

for i in range(n):
    s_num[s_set.index(s[i])] += 1

ans_num = max(s_num)
for i in range(len(s_set)):
    if s_num[i] == ans_num:
        print(s_set[i])

### FIXED CODE ###

from collections import Counter

n = int(input())
s_list = sorted(list(input() for _ in range(n)))

s = Counter(s_list)

ans_num = s.most_common(1)[0][1]

s_1 = sorted(list(s.items()), key=lambda x: x[0])

for i in range(len(s_1)):
    if s_1[i][1] == ans_num:
        print(s_1[i][0])
### BUGGY CODE ###

import numpy as np
N,M = list(map(int, input().split()))
S = np.array(list(map(int, input().split())))
T = np.array(list(map(int, input().split())))
mod = int(1e9+7)
"""
dp[i][j] : S の i 文字目までと T の j 文字目までを考慮し、
この 2 文字 (S[i] と T[j]）をペアにするときの場合の数とすると、

dp[i][j] = (sum(dp[1:i-1][1:j-1]) + 1 if S[i] == T[j] else 0)
このsumの部分をどうもとめるか。

最終的な答えはsum(dp[:][:])。

2-D cumsumをつかう
i,j = 0のときにきをつけて
DS[i][j] = DS[i-1][j] + DS[i][j-1] - DS[i-1][j-1] + dp[i][j]
"""

#dp = [[ 0 for _ in range(M)] for _ in range(N)]
dp = np.zeros((N,M), dtype = int)
# -1のIndexAccessをゼロにしたいので、ひとつ大きめに取っておく。
DS = np.zeros((N+1,M+1), dtype = int)

for i in range(N):
  for j in range(M):
    if S[i] != T[j]:
      dp[i, j] = 0
    else:
      dp[i, j] += 1
    ## 愚直ループを2次元部分和でなんとかする
    #for k in range(i):
    #  for l in range(j):
    #    dp[i][j] += dp[k][l]
    ## 愚直ループnp版。
      #dp[i,j] += np.sum(dp[:i, :j])
      dp[i,j] += DS[i-1,j-1]
      dp[i,j] %= mod
    DS[i,j] = DS[i-1,j] + DS[i,j-1] - DS[i-1,j-1] + dp[i,j]
    DS[i,j] %= mod
print(DS[-2][-2]+1)
#print(dp)
#print(DS)


### FIXED CODE ###

# numpyでかいてもTLEした。
# pypyでlistでかくととおる？

#import numpy as np
N,M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
mod = int(1e9+7)
"""
dp[i][j] : S の i 文字目までと T の j 文字目までを考慮し、
この 2 文字 (S[i] と T[j]）をペアにするときの場合の数とすると、

dp[i][j] = (sum(dp[1:i-1][1:j-1]) + 1 if S[i] == T[j] else 0)
このsumの部分をどうもとめるか。

最終的な答えはsum(dp[:][:])。

2-D cumsumをつかう
i,j = 0のときにきをつけて
DS[i][j] = DS[i-1][j] + DS[i][j-1] - DS[i-1][j-1] + dp[i][j]
"""

dp = [[ 0 for _ in range(M)] for _ in range(N)]
DS = [[ 0 for _ in range(M+1)] for _ in range(N+1)]

for i in range(N):
  for j in range(M):
    if S[i] != T[j]:
      dp[i][j] = 0
    else:
      dp[i][j] += 1
      dp[i][j] += DS[i-1][j-1]
      dp[i][j] %= mod
    DS[i][j] = DS[i-1][j] + DS[i][j-1] - DS[i-1][j-1] + dp[i][j]
    DS[i][j] %= mod
print(DS[-2][-2]+1)
#print(dp)
#print(DS)
### BUGGY CODE ###

N = int(input())
A_list = [int(x) for x in input().split()]
for i in range(A_list[0]+1):
    now = i * 2
    # print(now)
    for a in A_list:
        now = (a - now//2) * 2
        if (now<0):
            break
        # print(now)
    if (i == now//2):
        break
now = i * 2
ans = [str(now)]
for a in A_list[:-1]:
    now = (a - now//2) * 2
    ans.append(str(now))
print(" ".join(ans))


### FIXED CODE ###

N = int(input())
A_list = [int(x) for x in input().split()]
now = 0
for a in A_list:
    now = a - now
ans = [str(now)]
for a in A_list[:-1]:
    now = (a - now//2) * 2
    ans.append(str(now))
print(" ".join(ans))
### BUGGY CODE ###

import re

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

res = 0
fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"
for i in range(1000):
  s = "{:03}".format(i)
  if re.search(fmt.format(s[0], s[1], s[2]), S):
    res += 1

print(res)


### FIXED CODE ###

import re

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

res = 0
fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"
for i in range(10):
  idx_1 = S.find(str(i))
  if (idx_1 == -1) or (idx_1 > N-3):
    continue
  for j in range(10):
    idx_2 = S[idx_1+1:].find(str(j))
    if (idx_2 == -1) or (idx_2 > N-2):
      continue
    for k in range(10):
      idx_3 = S[idx_1+1+idx_2+1:].find(str(k))
      if idx_3 != -1:
        res += 1

print(res)