Harryxun/stf_run huggingface dataset:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

diff = []
for i in H:
	diff.append(abs(A-T+i*0.006))

diffmin = diff[0]
ans = 0
for i in range(N):
	if diffmin > diff[i]:
		diffmin = diff[i]
			ans = i
print(ans)

### FIXED CODE ###

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

diff = []
for i in H:
	diff.append(abs(A-T+i*0.006))

diffmin = diff[0]
ans = 0
for i in range(N):
	if diffmin > diff[i]:
		diffmin = diff[i]
		ans = i
print(ans+1)
string = input()
# print(string)
# string = string[0]
# num = int(string[1])

num = int(input())
# num = int(l[1])
# print(string)
if num == 0:
    print(string)
else:
    out=string[0]
    for i in [i for i in range(len(string))]:
        if i != 0:
            if i%num == 0:
                out=out+string[i]
    print(out)


### FIXED CODE ###

l = input().split()
if int(l[0])+int(l[1])==15:
    print('+')
elif int(l[0])*int(l[1]) ==15:
    print('*')
else:
    print('x')
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, m, q = I[:3]
l, r = I[3:3+m*2].reshape(-1, 2).T
p, q = I[3+m*2:].reshape(-1, 2).T

def main():
    res = np.zeros((n+2, n+2), dtype=np.int64)

    np.add.at(res, (np.full(m, 1), r), 1)
    np.add.at(res, (l+1, r), -1)
    np.add.at(res, (np.full(m, 1), np.full(m, n+1)), -1)
    np.add.at(res, (l+1, np.full(m, n+1)), 1)
    res = np.cumsum(res, axis=0)
    res = np.cumsum(res, axis=1)
    
    ans = res[p, q]
    return ans

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

### FIXED CODE ###

import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, m, q = I[:3]
l, r = I[3:3+m*2].reshape(-1, 2).T
p, q = I[3+m*2:].reshape(-1, 2).T

def main():
    res = np.zeros((n+2, n+2), dtype=np.int64)
    
    np.add.at(res, (1, r), 1)
    np.add.at(res, (l+1, r), -1)
    np.add.at(res, (1, n+1), -1)
    np.add.at(res, (l+1, n+1), 1)
    res = np.cumsum(res, axis=0)
    res = np.cumsum(res, axis=1)

    ans = res[p, q]
    return ans

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')
import sys
import itertools
from functools import lru_cache
if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))

#    def comb1(n, r):
#        if n == 0 or r == 0: return 1
#        return comb1(n, r - 1) * (n - r + 1) / r

    @lru_cache(None)
    def comb2(n, r):
        if n < 0 or r < 0 or n < r:
            return 0
        elif n == 0 or r == 0:
            return 1
        return comb2(n - 1, r - 1) + comb2(n - 1, r)

    max = 0
    comb_val1 = 0
    comb_val2 = 0
    for ele in itertools.combinations(A, 2):
        val = comb2(ele[1], ele[0])
        if val >= max:
            max = val
            if ele[1] > ele[0]:
                comb_val1 = ele[1]
                comb_val2 = ele[0]
            else:
                comb_val1 = ele[0]
                comb_val2 = ele[1]
#    print(max)
    print(str(comb_val1) + ' ' + str(comb_val2))

### FIXED CODE ###

import sys
import itertools
from functools import lru_cache
if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))

#    @lru_cache(None)
#    def comb1(n, r):
#        if n == 0 or r == 0: return 1
#        return comb1(n, r - 1) * (n - r + 1) / r
#
##    def comb2(n, r):
##        if n < 0 or r < 0 or n < r:
##            return 0
##        elif n == 0 or r == 0:
##            return 1
##        return comb2(n - 1, r - 1) + comb2(n - 1, r)
#
#    max = 0
#    comb_val1 = 0
#    comb_val2 = 0
#    for ele in itertools.combinations(A, 2):
#        buf_val1 = ele[0]
#        buf_val2 = ele[1]
#        if ele[1] > ele[0]:
#            buf_val1 = ele[1]
#            buf_val2 = ele[0]
##        print(buf_val1, buf_val2)
#        val = comb1(buf_val1, buf_val2)
#        if val >= max:
#            max = val
#            comb_val1 = buf_val1
#            comb_val2 = buf_val2
#    print(max)
#    print(str(comb_val1) + ' ' + str(comb_val2))

### n=10^5 * a=0~10^9の組み合わせがありうるので計算量は結局多いのでメモ化しても意味はない。

    N = max(A)
    A.remove(N)
    min_distance = 10 ** 10
    M = 0
    for a in A:
        if abs(N/2 - a) < min_distance:
            min_distance = abs(N/2 - a)
            M = a
    print("{} {}".format(N, M))
t = input()
for i in t:
    if i == '?':
        t[i] = 'D'

print(t)

### FIXED CODE ###

t = input()
t = t.replace('?','D')
print(t)
from fractions import Fraction

h, w, a, b = map(int, input().split())


def search():
    for _ in range(b):
        print("0" * a + "1" * (w - a))
    for _ in range(b, H):
        print("1" * a + "0" * (w - a))
    return True


def solve():
    if a == 0 and b == 0:
        for _ in range(h):
            print("0" * w)
        return True
    if b == 0:
        for _ in range(h):
            print("0" * a + "1" * (w - a))
        return True
    if a == 0:
        for _ in range(b):
            print("0" * w)
        for _ in range(h - b):
            print("1" * w)
        return True
    if Fraction(w, h) == Fraction(a, b):
        for r in range(h):
            for c in range(w):
                if c // a == r // b:
                    print("1", end="")
                else:
                    print("0", end="")
            print()
        return True
    return search()


if not solve():
    print("No")


### FIXED CODE ###

h, w, a, b = map(int, input().split())

for _ in range(b):
  print("0" * a + "1" * (w - a))
for _ in range(b, h):
  print("1" * a + "0" * (w - a))
def RPN(states):

        operator = {
           '+' :(lambda x, y: x + y),
           '-' :(lambda x, y: x - y),
           '*' :(lambda x, y: x * y),
           '/' :(lambda x, y: float(x)/y)
        }
        stack = []
        print ('RPN : %s' % states)
        for index, z in enumerate(states):
                if index > 0:
                        print stack
                if z not in operator.keys ():
                        stack.append(int(z))
                        continue
                y = stack.pop()
                x = stack.pop()
                stack.append(operator[z](x,y))
                print ('%s %s %s = ' % (x, z, y))
        print (stack[0])
        return (stack[0])

if __name__ == '__main__':
        import sys
        RPN(sys.argv[1])

~

### FIXED CODE ###

def RPN(states):

        operator = {
           '+' :(lambda x, y: x + y),
           '-' :(lambda x, y: x - y),
           '*' :(lambda x, y: x * y),
           '/' :(lambda x, y: float(x)/y)
        }
        stack = []
        for index, z in enumerate(states):
                if z not in operator.keys ():
                        stack.append(int(z))
                        continue
                y = stack.pop()
                x = stack.pop()
                stack.append(operator[z](x,y))
        print (stack[0])
        return (stack[0])

if __name__ == '__main__':
        import sys
        RPN(input().split(" "))
n,m,K = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

#累積和
sa = [0]*len(a)
sa[0] = a[0]
for i,k in enumerate(a):
    if i == 0:continue
    sa[i] = sa[i-1] + a[i]
sb = [0]*len(b)
sb[0] = b[0]
for i,k in enumerate(b):
    if i == 0:continue
    sb[i] = sb[i-1] + b[i]

ai = len(a)-1
bi = len(b)-1

minu = sa[ai] + sb[bi]
while(minu > K):
    if (sa[ai] - sa[ai-1]) > (sb[bi] - sb[bi-1]):
        ai -= 1
        minu = sa[ai] + sb[bi]
    else:
        bi -= 1
        minu = sa[ai] + sb[bi]

print(ai + bi + 2)


### FIXED CODE ###

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

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])

#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if sa[i] > k:
        break
    while sb[m] > k - sa[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)
import numpy as np

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


def match2int(x, y):
    x, y = min(x, y), max(x, y)
    return (2 * n - 1 - x) * x // 2 + y - x - 1


match_sm = n * (n - 1) // 2

adj = [[] for _ in range(match_sm)]
in_deg = np.zeros(match_sm, dtype=np.int16)
for i, li in enumerate(a):
    for j, k in zip(li, li[1:]):
        j -= 1
        k -= 1
        match1 = match2int(i, j)
        match2 = match2int(i, k)
        adj[match1].append(match2)
        in_deg[match2] += 1

cnd = [i for i, e in enumerate(in_deg) if e == 0]
day = 0
while cnd:
    in_deg[cnd] -= 1
    for u in cnd:
        in_deg[adj[u]] -= 1

    cnd = np.where(in_deg == 0)[0]
    day += 1

if not in_deg.all(0):
    day = -1

print(day)


### FIXED CODE ###

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


def match2int(x, y):
    x, y = min(x, y), max(x, y)
    return (2 * n - 1 - x) * x // 2 + y - x - 1


match_sm = n * (n - 1) // 2

adj = [[] for _ in range(match_sm)]
in_deg = [0] * match_sm
for i, li in enumerate(a):
    for j, k in zip(li, li[1:]):
        j -= 1
        k -= 1
        match1 = match2int(i, j)
        match2 = match2int(i, k)
        adj[match1].append(match2)
        in_deg[match2] += 1

cnd = [i for i, e in enumerate(in_deg) if e == 0]
day = 0
while cnd:
    nxt_cnd = []
    for u in cnd:
        for v in adj[u]:
            in_deg[v] -= 1
            if in_deg[v] == 0:
                nxt_cnd.append(v)

    cnd = nxt_cnd
    day += 1

if in_deg.count(0) != match_sm:
    day = -1

print(day)
N = int(input())
S = [input() for _ in range(N)]
a2n = lambda c: ord(c) - ord('a')
n2a = lambda c: chr(c+97)

inf = 2 ** 30 - 1
idxs = [[0]*26 for _ in range(26)]
idx = [inf] * 26

for i in range(N):
    for s in S[i]:
        idxs[i][a2n(s)] += 1

for i in range(26):
    for j in range(N):
        idx[i] = min(idx[i],idxs[j][i])
        
ans = ''
for i in range(26):
    for j in range(idx[i]):
        ans += n2a(i)
print(ans)
        




### FIXED CODE ###


N = int(input())
S = [input() for _ in range(N)]
a2n = lambda c: ord(c) - ord('a')
n2a = lambda c: chr(c+97)

inf = 2 ** 30 - 1
idxs = [[0]*26 for _ in range(N)]
idx = [inf] * 26

for i in range(N):
    for s in S[i]:
        idxs[i][a2n(s)] += 1

for i in range(26):
    for j in range(N):
        idx[i] = min(idx[i],idxs[j][i])
        
ans = ''
for i in range(26):
    for j in range(idx[i]):
        ans += n2a(i)
print(ans)
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
BC = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: (x[1]), reverse=True)

i = 0

for B, C in BC: # O(10^5)
    for _ in range(B):
        if A[i] < C:
            A[i] = C
            i += 1
        else:
            print(sum(A))
            exit()

print(sum(A))

### FIXED CODE ###

from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
BC = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: (x[1]), reverse=True)

i = 0
A_len = len(A)

for B, C in BC: # O(10^5)
    for _ in range(B):
        if A[i] < C:
            A[i] = C
            i += 1
            if i > A_len - 1:
                print(sum(A))
                exit()
        else:
            print(sum(A))
            exit()

print(sum(A))
N=int(input())
x=[]
y=[]
h=[]
for i in range(N):
  a,b,c=map(int,input().split())
  x.append(a)
  y.append(b)
  h.append(c)
field=[[-1 for i in range(101)] for i in range(101)]
for i in range(N):
  for j in range(101):
    for k in range(101):
      if(field[j][k]==-1):
        field[j][k]=h[i]+abs(j-x[i])+abs(k-y[i])
      elif(field[j][k]!=h[i]+abs(j-x[i])+abs(k-y[i])):
        field[j][k]=-2
for i in range(101):
  for j in range(101):
    if(field[i][j]>=0):
      cx=i
      cy=j
      H=field[i][j]
print(cx,cy,H)

### FIXED CODE ###

N=int(input())
x=[]
y=[]
h=[]
for i in range(N):
  a,b,c=map(int,input().split())
  x.append(a)
  y.append(b)
  h.append(c)
field=[[-1 for i in range(101)] for i in range(101)]
for i in range(N):
  for j in range(101):
    for k in range(101):
      if(h[i]!=0):
        if(field[j][k]==-1):
          field[j][k]=h[i]+abs(j-x[i])+abs(k-y[i])
        elif(field[j][k]!=h[i]+abs(j-x[i])+abs(k-y[i])):
          field[j][k]=-2
      else:
        if(field[j][k]>h[i]+abs(j-x[i])+abs(k-y[i])):
          field[j][k]=-2
cx=0
cy=0
H=0
for i in range(101):
  for j in range(101):
    if(field[i][j]>=0):
      cx=i
      cy=j
      H=field[i][j]
print(cx,cy,H)
n = int(input())
a = input().split()
pl = []
sb = []
for i in range(len(a)):
	pl.append(i+int(a[i])+1)
	if i - int(a[i]) > 1:
		sb.append(i-int(a[i])+1)


if len(sb) == 0:
	print('0')
else:

# spl = sorted(pl)
	isb = [int(i) for i in sb]
	ipl = [int(i) for i in pl]
	ssb = sorted(isb)
	t = min(ssb)
	# tl = [0] * max(ipl)
	tl = [0] * 9999999999999
	for i in ssb:
		if int(i)-1 < len(tl):
			tl[int(i)-1] += 1
	# print(pl)
	# print(sb)
	# print(tl)
	cnt = 0
	for i in pl:
		if int(i)-1 < len(tl):
			cnt += tl[int(i)-1]

	print(cnt)
	



### FIXED CODE ###

n = int(input())
a = input().split()
pl = []
sb = []
for i in range(len(a)):
	pl.append(i+int(a[i])+1)
	if i - int(a[i]) > 0:
		sb.append(i-int(a[i])+1)


if len(sb) == 0:
	print('0')
else:

# spl = sorted(pl)
	isb = [int(i) for i in sb]
	ipl = [int(i) for i in pl]
	ssb = sorted(isb)
	t = min(ssb)
	# tl = [0] * max(ipl)
	tl = [0] * 2000000	
	for i in ssb:
		if int(i)-1 < len(tl):
			tl[int(i)-1] += 1
	# print(pl)
	# print(sb)
	# print(tl)
	cnt = 0
	for i in pl:
		if int(i)-1 < len(tl):
			cnt += tl[int(i)-1]

	print(cnt)
from collections import Counter
n = int(input())
v = list(map(int,input().split()))
v1 = [v[0]]
v2 = []
for i in range(1,n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])
c1 = Counter(v1)
c2 = Counter(v2)
mode1 = c1.most_common(1)
mode2 = c2.most_common(1)
if mode1[0][0] != mode2[0][0]:
    ans1 = len(v1)-mode1[0][1]
    ans2 = len(v2)-mode2[0][1]
    ans = ans1 + ans2
else:
    if mode1[0][1] == len(v1) and mode2[0][1] == len(v2):
       ans = min(mode1[0][1],mode2[0][1])
    elif mode1[0][1] == len(v1):
        ans = len(v)-mode1[0][1]-mode2[1][1]
    elif mode2[0][1] == len(v2):
        ans = len(v)-mode1[1][1]-mode2[0][1]  
    else:
        ans1 = len(v)-mode1[0][1]-mode2[1][1]
        ans2 = len(v)-mode1[1][1]-mode2[0][1]
        ans = min(ans1,ans2)
print(ans)

### FIXED CODE ###

from collections import Counter

n = int(input())

e = []
o = []
for i, v in enumerate(input().split(' ')):
    if i % 2 == 0:
        e.append(int(v))
    else:
        o.append(int(v))

if len(set(e + o)) == 1:
    print(int(len(e + o) / 2))
    exit()

if Counter(o).most_common()[0][0] == Counter(e).most_common()[0][0]:
    ans = min(len(o) - Counter(o).most_common()[1][1] + len(e) - Counter(e).most_common()[0][1], len(o) - Counter(o).most_common()[0][1] + len(e) - Counter(e).most_common()[1][1])
    print(ans)
else:
    print(len(o) - Counter(o).most_common()[0][1] + len(e) - Counter(e).most_common()[0][1])
import os, sys, re, math

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

(A, B, C, D) = [int(n) for n in input().split()]

minC = (A + (C - 1)) // C
maxC = B // C

minD = (A + (D - 1)) // D
maxD = B // D

CD = lcm(C, D)
minCD = (A + (CD - 1)) // CD
maxCD = B // CD

countC = maxC - minC + 1
countD = maxD - minD + 1
countCD = maxCD - minCD + 1

print(B - A - (countC + countD - countCD) + 1)


### FIXED CODE ###

import os, sys, re, math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

(A, B, C, D) = [int(n) for n in input().split()]

minC = (A + (C - 1)) // C
maxC = B // C

minD = (A + (D - 1)) // D
maxD = B // D

CD = lcm(C, D)
minCD = (A + (CD - 1)) // CD
maxCD = B // CD

countC = maxC - minC + 1
countD = maxD - minD + 1
countCD = maxCD - minCD + 1

print(B - A - (countC + countD - countCD) + 1)
import bisect
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
z = [0] * N
ans = 0
for i in range(N-1,-1,-1):
  e = b[i]
  cin =  bisect.bisect_right(c,e)
  if i + 1 == N:
    z[i] = N-cin
  else:
    z[i] = z[i+1] + N-cin
for i in range(N):
  d = a[i]
  bind =  bisect.bisect_right(b,d)
  ans += z[bind]
print(ans)

### FIXED CODE ###

import bisect
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
z = [0] * N
ans = 0
for i in range(N-1,-1,-1):
  e = b[i]
  cin =  bisect.bisect_right(c,e)
  if i + 1 == N:
    z[i] = N-cin
  else:
    z[i] = z[i+1] + N-cin
for i in range(N):
  d = a[i]
  bind =  bisect.bisect_right(b,d)
  if bind == N:
    continue
  ans += z[bind]
print(ans)
import sys
input = sys.stdin.readline
 
def I(): return int(input())

def main():
    
    if K%2 == 0:
        print('-1')
        sys.exit()
    
    ans = 1
    n = 7
    for i in range(K):
        
        if n%K ==0:
            print(ans)
            break
        
        n = (10*n + 7)%K  
        ans += 1
main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
def I(): return int(input())

def main():
    
    K = I()
    if K%2 == 0:
        print('-1')
        sys.exit()
    
    ans = 1
    n = 7
    for i in range(K):
        
        if n%K ==0:
            print(ans)
            break
        
        n = (10*n + 7)%K  
        ans += 1
    
    else:
        print('-1')

main()
n,d=map(int,input().split())
c=0
p=d*d
for j in range(n):
	x,y==map(int,input().split())
    if (x**2) + (y**2)==p:
        c=c+1
print(c)

### FIXED CODE ###

n,d=map(int,input().split())
c=0
p=d*d
for j in range(n):
    x,y=map(int,input().split())
    if (x**2) + (y**2)<=p:
        c=c+1
print(c)
alph = input()
print(ord(alph+1))

### FIXED CODE ###

alph = input()
print(chr(ord(alph)+1))
c=input()
if c == a or c== i or c == u or c == e or c == o :
    print('vowel')
else:
    print('consonant')

### FIXED CODE ###

c=input()
if (c == 'a' or c== 'i' or c == 'u' or c == 'e' or c == 'o') :
    print('vowel')
else:
    print('consonant')
import math

def comb(n, r, mod):
    return math.factorial(n + r - 1)//(math.factorial(n - 1)*math.factorial(r))%mod

n, k = map(int, input().split())
mod = 10**9 + 7
red = n - k

for i in range(k):
    ans = 0
    redmod = red - i
    redplace = 2 + i
    bluemod = k - (i + 1)
    if i == 0:
        bluemod = 0
    blueplace = i + 1
    ans += comb(redplace, redmod, mod)*comb(blueplace, bluemod, mod)
    print(ans%mod)

### FIXED CODE ###

import math

def comb(n, r, mod):
    return math.factorial(n + r - 1)//(math.factorial(n - 1)*math.factorial(r))%mod

n, k = map(int, input().split())
mod = 10**9 + 7
red = n - k

for i in range(k):
    ans = 0
    redmod = red - i
    if redmod < 0:
        print(0)
        continue
    redplace = 2 + i
    bluemod = k - (i + 1)
    if i == 0:
        bluemod = 0
    blueplace = i + 1
    ans += comb(redplace, redmod, mod)*comb(blueplace, bluemod, mod)
    print(ans%mod)
def gcdf(a,n,gcdv):
#    print("a:",a)
    a0=a[0]
    ramin=10**9
    ramin0=20**9
    while ramin0!=ramin:
        ramin0=ramin
        for i in range(n):
            a[i]=a[i]%a0
            if a[i]==0:
                a[i]=a0
            if ramin>a[i]:
                ramin=a[i]
            if ramin<=gcdv:
                return gcdv
        a0=min(a)
#        print("a:",a,ramin)
    return ramin


#n=2
#a=[1000000000, 1000000000]
#n=4
#a=[15, 18, 24, 36]
n=int(input())

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

#print(a)
if n==2:
    print(max(a))
elif n<-16:
    ns=int(n/8)
    a1=[0:ns]
    a2=[ns:ns*2]
    a3=[ns*2:ns*3]
    a4=[ns*3:n]
    gcdv=0
    gcd1=gcdf(a1,len(a1),gcdv)
    gcd2=gcdf(a2,len(a2),gcdv)
    gcd3=gcdf(a3,len(a3),gcdv)
    gcd4=gcdf(a4,len(a4),gcdv)
    
else:
    gcdv=0
    a.sort()
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy,n-1,gcdv)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)


### FIXED CODE ###

def gcdf(a):
    a.sort()
#    print("a2:",a)
    a0=a[0]
    a=[int(x%a0) for x in a if x%a0 != 0]
#    print("a2:",a)
    if len(a)==0:
        return a0
    else:
        a.append(a0)
        a0=min(a)
        return gcdf(a) 

#n=8
#a=[746130, 1385670, 4849845, 881790, 3233230, 1939938, 570570, 510510]
#ans=[19]
#n=2
#a=[1000000000, 1000000000]
#n=5
#a=[15, 18, 24, 36, 81]
#n=3
#a=[7, 6, 8]
n=int(input())
a=[]
for i in map(int,input().split()):
    a.append(i)
if n==2:
    print(max(a))
elif n<2**10:
    gcdv=0
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)
else:
    m=int(n**(1/2))
    ns=int(n/m)
    rgcd=[]
    for mi in range(m):
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
        gcdm=gcdf(am)
        rgcd.append(gcdm)
    gcdv=0

    for mi in range(m):
        rgcd1=list(rgcd)
        del rgcd1[mi]
        gcdrg1=gcdf(rgcd1)
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
#        print(mi,gcdf(am),len(am),gcdf(rgcd1))
        for i in range(len(am)):
            acpy=list(am)
#            del acpy[i]
#            acpy.append(gcdrg1)
            acpy[i]=gcdrg1
            gcdx=gcdf(acpy)
            if gcdx>gcdv:
                gcdv=gcdx
    print(gcdv)
n = int(input())
cnt= [0]*10001
a = list(map(int, input().split()))
for v in a:
    cnt[v-1] += 1
    cnt[v] += 1
    cnt[v+1] += 1

print(max(cnt))

### FIXED CODE ###

n = int(input())
cnt= [0]*100002
a = list(map(int, input().split()))
for v in a:
    cnt[v-1] += 1
    cnt[v] += 1
    cnt[v+1] += 1

print(max(cnt))
from math import gcd
MOD = 10**9 + 7
H, W, T = map(int, input().split())
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W)) - 2
print(pow(ans, ga*gb, MOD))


### FIXED CODE ###

from fractions import gcd
MOD = 10**9 + 7
H, W, T = map(int, input().split())
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W)) - 2) % MOD
print(pow(ans, ga*gb, MOD))
a=input()
if a<1200:
  print(ABC)
elif 1199<a<2800:
  print(ARC)

### FIXED CODE ###

a=int(input())
if a<1200:
  print("ABC")
elif 1199<a<2800:
  print("ARC")
else:
  print("AGC")
n = (int, raw_input().split)
x = n.sort()
print x

### FIXED CODE ###

a,b,c = map(int, raw_input().split())
n = [a,b,c]
n.sort()
for i in n:
    print i,
s = map(int, input().split())
d = s[0]
t = s[1]
s = s[2]
if d >= t * s:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input().split()
d = int(s[0])
t = int(s[1])
s = int(s[2])
if d <= t * s:
  print("Yes")
else:
  print("No")
NK = [int(i) for i in input().split()]
N,K = NK[0],NK[1]
h = []
h1 = []
for i in range(N):
  h.append(int(input()))
h.sort()
for i in range(N-1):
  h1.append(h[i+1]-h[i])
hh,hhh = [],[]
for i in range(N-K):
  hh.append([0]*i+h1+[0]*(K-2-i))
for i in range(N-K+1):
  h2 = 0
  for j in range(K-1):
      h2 = h2 + hh[j][i+K-2]
  hhh.append(h2)
print(min(hhh))
    

### FIXED CODE ###

n,k = map(int,input().split())
h = []
for i in range(n):
  h.append(int(input()))
h.sort()
g = float('inf')
for i in range(n-k+1):
  g = min(g, h[i+k-1] - h[i])
print(g)