Harryxun/stf_run huggingface dataset:
# In[]
s = [list(input()) for _ in range(h)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]

count = 0

for y in range(h):
    for x in range(w):
        cnt = 0
        for k in range(4):
            ny = y + dy[k]
            nx = x + dx[k]
            if nx < 0 or nx>=w or ny < 0 or ny >=h:
                continue
            if s[y][x] == '#':
                if s[ny][nx] == '#':
                    cnt += 1
        if cnt == 0:
            print('No')
            exit()

                        
print('Yes')
               

### FIXED CODE ###



h, w = map(int,input().split())
# In[]
s = [list(input()) for _ in range(h)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]

count = 0

for y in range(h):
    for x in range(w):
        cnt = 0
        for k in range(4):
            ny = y + dy[k]
            nx = x + dx[k]
            if nx < 0 or nx>=w or ny < 0 or ny >=h:
                continue
            if s[y][x] == '.':
                cnt +=1
                continue
            if s[y][x] == '#':
                if s[ny][nx] == '#':
                    cnt += 1
        if cnt == 0:
            print('No')
            exit()

                        
print('Yes')
from sympy import *

n = int(input())
l = list()
a = 0
i = 0
while i < n:
    a = nextprime(a)
    if a % 5 != 1:
        continue 
    l.append(a)
    i += 1

print(l)

### FIXED CODE ###

#from sympy import *

def prime(x):
    i = x
    while True:
        f = False
        j = 2
        while i > j:
            if i % j == 0:
                f = True
                break
            j += 1
        if f == False:
            break
        i += 1
    return i


n = int(input())
l = list()
a = 6
i = 0
while i < n:
    a = prime(a+1)
    if a % 5 != 1:
        continue 
    l.append(a)
    i += 1

print(' '.join(map(str, l)))
N = int(input())
A = [int(i) for i in input().split()]
C = [0] * 10001
s = 0
for i in A:
    C[i] += 1
    s += i

K = int(input())

for i in range(K):
    f, t = map(int, input().split())
    if f == t:
        continue
    C[t] += C[f]
    s += t * C[f]
    s -= f * C[f]
    C[f] = 0
    print(s)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
C = [0] * 100001
s = 0
for i in A:
    C[i] += 1
    s += i

K = int(input())

for i in range(K):
    f, t = map(int, input().split())
    C[t] += C[f]
    s += t * C[f]
    s -= f * C[f]
    C[f] = 0
    print(s)
S = str(input())
print('Yes' if S[2]==S[3] and S[4]==S[5] else 'No')

### FIXED CODE ###

S = input()

if len(S)==3 and S.count('A')==2 or S.count('B')==2:
    print('Yes')

else:
    print('No')
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    n, y = map(int, sys.stdin.readline().split())

    for i in range(y // 10000):
        for j in range((y - 10000 * i) // 5000):
            if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
                print(i, j, k)
    else:
        print('-1 -1 -1')

if __name__ == '__main__':
    main()


### FIXED CODE ###

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

import sys

def main():
    n, y = map(int, sys.stdin.readline().split())

    for i in range(y // 10000 + 1):
        for j in range((y - 10000 * i) // 5000 + 1):
            k = n - i - j
            if 10000 * i + 5000 * j + 1000 * k == y:
                print(i, j, k)
                sys.exit()
    else:
        print('-1 -1 -1')

if __name__ == '__main__':
    main()
from itertools import combinations
from bisect import bisect_left

INF = float('INF')
N = int(input())
points = []
scores = []

for i in range(N):
    point = list(map(int,input().split()))
    points.append(point + [i])
    scores.append(max(abs(point[0]), abs(point[1])) * point[2])

for i in range(N+1):
    MIN = INF
    for j in range(i+1):
        for P in combinations(points, N-j):
            X = [0]
            tmp_scores = scores[:]
            for p in points:
                if not p in P:
                    X.append(p[0])
                    tmp_scores[p[3]] = 0
            X.sort()
            X += [100000]
            for p in P:
                index = bisect_left(X, p[0])
                tmp_scores[p[3]] = min(tmp_scores[p[3]], min(p[0]-X[index], X[index+1]-p[0]) * p[2])
            for Q in combinations(P, i-j):
                Y = [0]
                for p in points:
                    if p in Q:
                        Y.append(p[1])
                        tmp_scores[p[3]] = 0
                Y.sort()
                Y += [100000]
                for p in Q:
                    index = bisect_left(Y, p[0])
                    tmp_scores[p[3]] = min(tmp_scores[p[3]], min(p[1]-Y[index], Y[index+1]-p[1]) * p[2])
                MIN = min(MIN, sum(tmp_scores))

print(MIN)

### FIXED CODE ###

INF = 10 ** 12

N = int(input())
X = [0] * N
Y = [0] * N
P = [0] * N
for i in range(N):
    X[i], Y[i], P[i] = map(int,input().split())

score_X = []

for i in range(2 ** N):
    x = []
    I = i
    for j in range(N):
        i = I
        score = abs(X[j]) * P[j]
        for k in range(N):
            if i & 1:
                score = min(score, abs(X[j] - X[k]) * P[j])
            i >>= 1
        x.append(score)
    score_X.append(x)

score_Y = []

for i in range(2 ** N):
    y = []
    I = i
    for j in range(N):
        i = I
        score = abs(Y[j]) * P[j]
        for k in range(N):
            if i & 1:
                score = min(score, abs(Y[j] - Y[k]) * P[j])
            i >>= 1
        y.append(score)
    score_Y.append(y)

ans = [INF] * (N + 1)

for i in range(2 ** N):
    cnt = 0
    for j in range(N):
        if (i >> j) & 1:
            cnt += 1
    
    j = i
    
    while True:
        score = 0
        for k in range(N):
            if not (i >> k) & 1:
                score += min(score_X[j][k], score_Y[i - j][k])
        ans[cnt] = min(ans[cnt], score)
        if j == 0:
            break
        j = (j - 1) & i

for i in range(N + 1):
    print(ans[i])
import math
mod=10**9+7
factorial=[1 for _ in range(10**5+10)]
for i in range(1, 10**5+10):
    factorial[i]=i*factorial[i-1] % mod
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==0:
    print(2*factorial[n]*factorial[m])
else:
    print(factorial[n]*math.factorial[m])

### FIXED CODE ###

import math
mod=10**9+7
factorial=[1 for _ in range(10**5+10)]
for i in range(1, 10**5+10):
    factorial[i]=i*factorial[i-1] % mod
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==0:
    print(2*factorial[n]*factorial[m]%mod)
else:
    print(factorial[n]*factorial[m]%mod)
n=input()
w=sorted(list(map(int,input().split())))
s=sum(w)//2
for i,j in enumerate(w):
  s-=j
  if s<0:
    print(j-w[i-1]);break
  elif s==0:
    print(min(j-w[i-1],w[i+1]-j);break

### FIXED CODE ###

n = int(input())
wli = list(map(int,input().split()))
cand = []
for i in range(n-1):
  cand.append(abs(sum(wli[:i+1])-sum(wli[i+1:])))
print(min(cand))
#!/usr/bin/env python
# coding: utf-8

# In[12]:


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


# In[13]:


mylist = list(range(A,B+1))
for x in mylist:
    if x < A+K or x > B-K:
        print(x)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[41]:


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


# In[42]:


ans = []
for x in range(A, min(A+K,B+1)):
    ans.append(x)
for x in range(max(A,B-K+1), B+1):
    ans.append(x)
for x in sorted(list(set(ans))):
    print(x)


# In[ ]:
n,m=map(int,input().split())
lists_A=sorted(list(map(int,input().split())))
lists_BC=[]
sumk=0
cnt=0
while cnt!=m:
    if sumk<n+1and cnt !=m: 
        k,l=map(int,input().split())
        sumk+=k
        lists_BC=lists_BC+[l]*k
        cnt+=1
        
    if sumk>=n+1 and cnt!=m:
        k,l=map(int,input().split())
        cnt+=1

A=listsBC+lists_A
Ans=sorted(A)
print(sum(Ans[-n:]))
    

### FIXED CODE ###

n,m=map(int,input().split())
lists=list(map(int,input().split()))
checklist=[]
count=0

for i in range(m):
    b,c=map(int,input().split())
    checklist.append((c,b))
checklist=sorted(checklist,reverse=True)
lists=sorted(lists)
uselist=[]
count=0

for i in checklist:
    for _ in range(i[1]):
        uselist.append(i[0])
    count+=i[1]

    if count>=n:
        break
answer=0
n=min(n,len(uselist))
for i in range(n):
    if lists[i]<uselist[i]:
            lists[i]=uselist[i]
    else:
        break
print(sum(lists))
import sys
a,b,n = map(int,input().split())
d = 0
i = 0
for i in range(1,n+1):
    c = int(a*i/b)-a*int(i/b)
    if c >= d:
        d = c
    else:
        j += 1
        if j > 1:
            print(int(a*(j-2)/b)-a*int((j-2)/b))
            sys.exit()
print(d)

### FIXED CODE ###

a,b,n = map(int,input().split())
if n>= b-1:
    print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
    print(int(a*n/b)-a*int(n/b))
import java.util.Scanner;

public class Main<i> {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        int s = x - (k - 1);
        int e = x + (k - 1);

        for (int i = s; i <= e; i++) {
            System.out.println(i);
        }
    }
}

### FIXED CODE ###

k, x = map(int, input().split())

for i in range(x-(k-1), x + (k-1)+1):
  print(i, end=" ")
import math

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

print(a*b//math.gcd(a, b))


### FIXED CODE ###

def yu(x, y):
    min_v = min(x, y)
    max_v = max(x, y)

    mod = max_v % min_v
    if mod != 0:
        min_v = yu(min_v, mod)
    return min_v


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

print(a*b//yu(a, b))
a = int(input())
b = int(input())

if a > b:
 return print('a > b')
if a < b:
 return print ('a < b')
if a == b:
 return print (' a == b')

### FIXED CODE ###

a, b = map(int, input().split())
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
lst = list(map(int, input().split()))
lst = lst.sorted()
print('Yes' if lst[0] + lst[1] == lst[2] else 'No')

### FIXED CODE ###

lst = list(map(int, input().split()))
lst = sorted(lst)
print('Yes' if lst[0] + lst[1] == lst[2] else 'No')
# Author: cr4zjh0bp
# Created: Sun Mar 29 05:26:08 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()
s = ns()

def ok(p):
    k = 0
    for i in range(n):
        if s[i] == p[k]:
            k += 1
        if k == 3:
            return True
    return False

ans = 0
for i in range(1000):
    p = "{:0>3}".format(i)
    if ok(p):
        ans += 1

print(ans)

### FIXED CODE ###

# Author: cr4zjh0bp
# Created: Sat Mar 28 15:38:17 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

m, d = na()
m2, d2 = na()

if d + 1 != d2:
    print(1)
else:
    print(0)
n,l  = list(map(int, input().split()))
ln = []
for n in range(l):
    ln.append(input())
output = ''
for i in sorted(ln):
    output += i
print(output)



### FIXED CODE ###

line  =input().split(' ')
ln = []
for i in range(int(line[0])):
    ln.append(input())
outline= ''
for i in sorted(ln):
    outline += i
print (outline)
N, W = map(int, input().split())
    dp = [-1] * (W + 1)
    dp[0] = 0
    for _ in range(N):
        w, v = map(int, input().split())
        for i in range(W - w, -1, -1):
            if dp[i] == -1:
                continue
            if dp[i + w] < dp[i] + v:
                dp[i + w] = dp[i] + v
    print(max(dp))

### FIXED CODE ###

# DP
def main():
    N, W = map(int, input().split())
 
    dp = [-1] * (W + 1)
    dp[0] = 0
    for _ in range(N):
        w, v = map(int, input().split())
        for i in range(W - w, -1, -1):
            if dp[i] == -1:
                continue
            if dp[i + w] < dp[i] + v:
                dp[i + w] = dp[i] + v
    print(max(dp))
 
 
main()
A,B,K = list(map(int,input().split()))

mylist = []
for i in range(1,max(A,B)):
	if A%i == 0 and B%i == 0:
		mylist.append(i)

print(mylist[K-1])

### FIXED CODE ###

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

diflist = []
for i in range(1,min(A,B)+1):
	if (A%i == 0 and B%i == 0):
		diflist.append(i)

print(diflist[-K])
k=int(input())
if k%2=0:
    print(k/2*k/2)
else:
    print(k//2*(k//2+1))


### FIXED CODE ###

k=int(input())
if k%2==0:
    print(int((k/2)*(k/2)))
else:
    print(int((k//2)*(k//2+1)))
def main():
    N = int(input())
    print(solve(N))


def count(n, start, end):
    """n以下の数字でsで始まりeで終わる数字の個数
    732, 1, 2 -> 12, 102, 112, 122, ... , 192 = 11
    Examples:
        >>> count(732, 1, 2)
        11
        >>> count(25, 1, 1)
        2
        >>> count(25, 3, 3)
        1
        >>> count(100, 1, 2)
        1
        >>> count(102, 1, 2)
        2
    """

    if n <= 9:
        return 1 if start == end and start <= n else 0
    if n <= 99:
        one_digit = 1 if start == end else 0
        two_digit = 1 if start * 10 + end <= n else 0
        return one_digit + two_digit
    digit_length = len(str(n))
    # digit_length桁以下
    ret1 = count(10 ** (digit_length - 1) - 1, start, end)
    # digit_length桁
    min_cand = start * (10 ** (digit_length - 1)) + end
    if min_cand > n:
        return ret1
    ret2 = min((n-min_cand) // 10 + 1, 10 ** (digit_length - 2))
    return ret1 + ret2


def solve(n):
    """n以下の組で, (213, 382)のような末尾と先頭が等しい数の個数"""
    result = 0
    for i in range(1, 10):
        for j in range(i + 1, 10):
            result += 2 * count(n, i, j) * count(n, j, i)
    for i in range(1, 10):
        result += count(n, i, i) * count(n, i, i)
    return result


def assert_equal(left, right):
    assert left == right, f"{left} != {right}"

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N = int(input())
    print(solve(N))


def count(n, start, end):
    """n以下の数字でsで始まりeで終わる数字の個数
    732, 1, 2 -> 12, 102, 112, 122, ... , 192 = 11
    Examples:
        >>> count(732, 1, 2)
        11
        >>> count(25, 1, 1)
        2
        >>> count(25, 3, 3)
        1
        >>> count(100, 1, 2)
        1
        >>> count(102, 1, 2)
        2
    """

    if n <= 9:
        return 1 if start == end and start <= n else 0
    if n <= 99:
        one_digit = 1 if start == end else 0
        two_digit = 1 if start * 10 + end <= n else 0
        return one_digit + two_digit
    digit_length = len(str(n))
    # digit_length桁以下
    ret1 = count(10 ** (digit_length - 1) - 1, start, end)
    # digit_length桁
    min_cand = start * (10 ** (digit_length - 1)) + end
    if min_cand > n:
        return ret1
    ret2 = min((n-min_cand) // 10 + 1, 10 ** (digit_length - 2))
    return ret1 + ret2


def solve(n):
    """n以下の組で, (213, 382)のような末尾と先頭が等しい数の個数"""
    result = 0
    for i in range(1, 10):
        for j in range(i + 1, 10):
            result += 2 * count(n, i, j) * count(n, j, i)
    for i in range(1, 10):
        result += count(n, i, i) * count(n, i, i)
    return result


if __name__ == "__main__":
    main()
N=int(input())
h=list(map(int,input().split()))
a=[]
a[0]=0
a[1]=abs(h[1]-h[0])
for i in range(2,N):
  a[i]=min(a[i-1]+abs(h[i]-h[i-1]),a[i-2]+abs(h[i]-h[i-2]))
print(a[N-1])


### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
a=[]
for i in range(N):
  a.append(0)
a[0]=0
a[1]=abs(h[1]-h[0])
for i in range(2,N):
  a[i]=min(a[i-1]+abs(h[i]-h[i-1]),a[i-2]+abs(h[i]-h[i-2]))
print(a[N-1])
ef koch_curve(i, n, x1, y1, x2, y2):
    x = [0] * 5
    y = [0] * 5
    if i < n:
        x[0] = x1
        y[0] = y1
        x[1] = (2 * x1 + x2) / 3.0
        y[1] = (2 * y1 + y2) / 3.0
        x[2] = (x1 + 2 * x2) / 3.0
        y[2] = (y1 + 2 * y2) / 3.0
        x[3] = (x[2] - x[1]) * math.cos(math.pi/3) - (x[2] - x[1]) * math.sin(math.pi/3) + x[1]
        y[3] = (y[2] - y[1]) * math.cos(math.pi/3) + (y[2] - y[1]) * math.sin(math.pi/3) + y[1]
        x[4] = x2
        y[4] = y2
        koch_curve(i+1, n, x[0], y[0], x[1], y[1])
        print x[1], y[1]
        koch_curve(i+1, n, x[1], y[1], x[3], y[3])
        print x[3], y[3]
        koch_curve(i+1, n, x[3], y[3], x[2], y[2])
        print x[2], y[2]
        koch_curve(i+1, n, x[2], y[2], x[4], y[4])
n = input()  
print x1 y1
koch_curve(0, n, x1, y1, x2,y2)
print x2, y2

### FIXED CODE ###


 
import math

 
def koch_curve(i, n, x1, y1, x2, y2):
    x = [0]*5
    y = [0]*5
    if i < n:
        x[0] = x1
        y[0] = y1
        x[1] = (2*x1+x2)/3.0
        y[1] = (2*y1+y2)/3.0
        x[2] = (x1+2*x2)/3.0
        y[2] = (y1+2*y2)/3.0
        x[3] = (x[2] - x[1])*math.cos(math.pi/3) - (y[2] - y[1])*math.sin(math.pi/3) + x[1]
        y[3] = (y[2] - y[1])*math.cos(math.pi/3) + (x[2] - x[1])*math.sin(math.pi/3) + y[1]
        x[4] = x2
        y[4] = y2
        koch_curve(i+1, n, x[0], y[0], x[1], y[1])
        print x[1], y[1]
        koch_curve(i+1, n, x[1], y[1], x[3], y[3])
        print x[3], y[3]
        koch_curve(i+1, n, x[3], y[3], x[2], y[2])
        print x[2], y[2]
        koch_curve(i+1, n, x[2], y[2], x[4], y[4])
        
n = int(input())
 
x1 = 0
y1 = 0
x2 = 100
y2 = 0 
print x1, y1
koch_curve(0, n, x1, y1, x2, y2)
print x2, y2
s = input()
K = int(input())

L = []
for i in range(len(s)):
    L.append(s[i])
    
L.sort()
word_list = []
idx = 0
if len(s) >= 18:
    while idx < len(s):
        if s[idx] == L[0]:
            for j in range(1, K+1):
                word_list.append(s[idx:idx+j])
        idx += 1
else:
    for i in range(len(s)):
        for j in range(i+1, len(s)+1):
            word_list.append(s[i:j])
    
word_set = set(word_list)
word_list = list(word_set)
word_list.sort()
print(word_list[K-1])

### FIXED CODE ###

s = input()
K = int(input())

L = []
for i in range(len(s)):
    L.append(s[i])
    
L.sort()
cnt = 0
for i in range(len(L)):
    if L[i] == L[0]:
        cnt += 1

word_list = []
idx = 0
if len(s) >= 20:
    if cnt <= 5:
        while idx < len(s):
            if s[idx] == L[0] or s[idx] == L[cnt]:
                for j in range(1, K+1):
                    word_list.append(s[idx:idx+j])
            idx += 1
    else:
        while idx < len(s):
            if s[idx] == L[0]:
                for j in range(1, K+1):
                    word_list.append(s[idx:idx+j])
            idx += 1
else:
    for i in range(len(s)):
        for j in range(i+1, len(s)+1):
            word_list.append(s[i:j])
    
word_set = set(word_list)
word_list = list(word_set)
word_list.sort()
print(word_list[K-1])
s = list(input())
t = list(input())

sdash = "".join(sorted(s))
tdash = "".join(sorted(s, reverse = True))

print("Yes" if sdash < tdash else "No")


### FIXED CODE ###

a, b = map(int, input().split())
print( int((a + b + 2 - 1) / 2) )
a,b=map(int,input().split())
print(int((a*b*100)/100))

### FIXED CODE ###

from fractions import Fraction
a,b=map(Fraction,input().split())
print(int(a*b))
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections
INF = 10**8

N, = map(int, sys.stdin.readline().rstrip().split(" "))
costs = map(int, sys.stdin.readline().rstrip().split(" "))


def solve(costs):
    dp = [0] + [INF for _ in costs]
    for i in range(len(costs)-2):
        dp[i+1] = min(dp[i+1], dp[i] + abs(costs[i+1] - costs[i]))
        dp[i+2] = min(dp[i+2], dp[i] + abs(costs[i+2] - costs[i]))
    #print(dp)
    return dp[-4]

print(solve(costs + [INF] * 2))
exit(0)

        


### FIXED CODE ###

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections
INF = 10**10

N, = map(int, sys.stdin.readline().rstrip().split(" "))
costs = map(int, sys.stdin.readline().rstrip().split(" "))


def solve(costs):
    dp = [0] + [INF for _ in costs]
    for i in range(len(costs)-2):
        dp[i+1] = min(dp[i+1], dp[i] + abs(costs[i+1] - costs[i]))
        dp[i+2] = min(dp[i+2], dp[i] + abs(costs[i+2] - costs[i]))
    #print(dp)
    return dp[-4]

ans = solve(costs + [INF] * 2)
assert ans < INF
print(ans)
exit(0)
a, b, k = map(int, input().split())
a, b = sorted([a, b])
lst = []

if b != 1:
    for i in range(1, b):
        if a%i==b%i==0:
            lst.append(i)

else:
    lst.append(1)

print(lst[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split())
a, b = sorted([a, b])
lst = []

if b != 1:
    for i in range(1, a+1):
        if a%i==b%i==0:
            lst.append(i)

else:
    lst.append(1)

lst.reverse()
print(lst[k-1])
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(A[-1] - A[1])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
print(A[-1] - A[0])
n, m = map(int, input().split())
G = [[] for _ in range(n)]

for i in range(n):
    a, b = map(int, input().split())
    a-=1; b-=1
    G[a].append(b)
    G[b].append(a)

flag = (1<<n)-1

def dfs(v=0, visited=1):
    if visited == flag:
        return 1

    cnt = 0
    for to in G[v]:
        if visited & 1<<to:
            continue
        cnt += dfs(to, visited^(1<<to))
    return cnt

print(dfs())

### FIXED CODE ###

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

for i in range(m):
    a, b = map(int, input().split())
    a-=1; b-=1
    G[a].append(b)
    G[b].append(a)

flag = (1<<n)-1

def dfs(v=0, visited=1):
    if visited == flag:
        return 1

    cnt = 0
    for to in G[v]:
        if visited & (1<<to):
            continue
        cnt += dfs(to, visited^(1<<to))
    return cnt

print(dfs())
i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]
min == 0
min=i2[len(i2)-1]
if min == 0:
    min == i[len(i)]
count = 0
for x in i:
    if 0 < x % 10 < min % 10:
        min = x
        count += 1
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))


### FIXED CODE ###

i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]

if not i2:
    min = i[len(i)-1]

else:
    min = i2[len(i2)-1]

count = 0
for x in i:
    if 0 < x % 10 < min % 10:
        min = x
        count += 1
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))
from fractions import gcd
print(int(2 * n / gcd(2, n)))

### FIXED CODE ###

n = int(input())
if n%2==0:
  print(n)
else:
  print(n*2)
A, B = map(int, input().sp;it())
if A>=13:
  print(B)
elif 6 <= A <= 12:
  print(B//2)
else:
  print(0)


### FIXED CODE ###

A, B = map(int, input().split())
if A>=13:
  print(B)
elif 6 <= A <= 12:
  print(B//2)
else:
  print(0)
a = []
sum_a = b[0] + b[-1]
for i,b_i in enumerate(b):
    
    if i+1 < n-1:
        if b[i+1] >= b[i]:
            a.append(b[i])
            sum_a += b[i]
        else:
            a.append(b[i+1])
            sum_a += b[i+1]
print(sum_a)

### FIXED CODE ###

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

a = []
sum_a = b[0] + b[-1]
for i,b_i in enumerate(b):
    
    if i+1 < n-1:
        if b[i+1] >= b[i]:
            a.append(b[i])
            sum_a += b[i]
        else:
            a.append(b[i+1])
            sum_a += b[i+1]
print(sum_a)
n = input().split()
if n[2] == '+':
    print(int(n[0]+n[4]))
else:
    print(int(n[0]-n[4]))

### FIXED CODE ###

n = input().split()
if n[1] == '+':
    print(int(n[0])+int(n[2]))
else:
    print(int(n[0])-int(n[2]))