Harryxun/stf_run huggingface dataset:
N, K, Q = map(int, input().split())
X = list(map(int, input().split()))

r = Y[Q-1] - Y[0]
for y in X:
    tmp = []
    tmp2 = []
    for x in X:
        if x < y:
            tmp.sort()
            tn = len(tmp)
            if len(tmp) > K-1:
                tmp2 += tmp[:tn-K+1]
                print(tmp, tmp[:tn-K+1])
            tmp = []
            continue
        tmp.append(x)
    tn = len(tmp)
    if tn-K+1 > 0:
        tmp2 += tmp[:tn-K+1]
    tmp2.sort()
    if len(tmp2) >= Q:
        r = min(r, tmp2[Q-1] - y)
print(r)


### FIXED CODE ###

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

r = 10**18
for y in X:
    tmp = []
    tmp2 = []
    for x in X:
        if x < y:
            tmp.sort()
            tn = len(tmp)
            if len(tmp) > K-1:
                tmp2 += tmp[:tn-K+1]
            tmp = []
            continue
        tmp.append(x)
    tmp.sort()
    tn = len(tmp)
    if tn-K+1 > 0:
        tmp2 += tmp[:tn-K+1]
    tmp2.sort()
    if len(tmp2) >= Q:
        r = min(r, tmp2[Q-1] - y)
print(r)
while(1):
  count = int(raw_input())
  if count == 0: break
  previous_cube = [1, 2, 3, 4, 5, 6]
  operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]}
  sum = 1
  for i in xrange(count):
    new_cube = []
    for e in xrange(5):
      new_cube.append(previous_cube[operation[raw_input().strip()][e]])
    sum += new_cube[0]
    previous_cube = new_cube
  print sum

### FIXED CODE ###

while 1:
  n = input()
  if n == 0:  break
  d = range(1, 7)
  ans = 1
  for i in range(n):
    c = raw_input()[0]
    if c == 'N': S = [1,5,2,3,0,4]
    elif c == "S": S = [4,0,2,3,5,1]
    elif c == "E": S = [3,1,0,5,4,2]
    elif c == "W": S = [2,1,5,0,4,3]
    elif c == "R": S = [0,2,4,1,3,5]
    elif c == "L": S = [0,3,1,4,2,5]
    d = [d[s] for s in S]
    ans += d[0]
  print ans
h,w,m=map(int,input().split())
objs=[tuple(map(int,input().split())) for i in range(m)]
setobj=set(objs)
xs,ys=zip(*objs)

from collections import Counter as co

wk,wv= co(ys).most_common(1)[0]
hk,hv= co(ys).most_common(1)[0]
print(wv+kv-(hk,wk)in setobj)

### FIXED CODE ###

h,w,m=map(int,input().split())
objs=[tuple(map(int,input().split())) for i in range(m)]
setobj=set(objs)
xs,ys=zip(*objs)
from collections import Counter as co
xs,ys=co(xs),co(ys)
xim,yim=xs.most_common(1)[0][1], ys.most_common(1)[0][1]
A=len([1 for u in xs.values() if u==xim])* len([1 for u in ys.values() if u==yim])
for a,b in setobj:
  if xs[a]==xim and ys[b]==yim:A-=1

print(xim+yim-1+int(A>0))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

INF = 2**30
n = int(input())
P = list(map(int, input().split()))
T = [[] for _ in range(n)]
for i, p in enumerate(P, 1):
  T[p-1].append(i)
X = list(map(int, input().split()))
D = [-1]*n
def dfs(v):
  if D[v] != -1:
    return D[v]
  l = len(T[v])
  x = X[v]
  dp = [INF]*(x+1)
  dp[0] = 0
  for i, nv in enumerate(T[v]):
    k = [INF]*(x+1)
    for j in range(x+1):
      if j >= X[nv]:
        k[j] = min(k[j], dp[j-X[nv]]+dfs(nv))
      if j >= dfs(nv):
        k[j] = min(k[j], dp[j-dfs(nv)]+X[nv])
    dp = k.copy()
  res = min(dp)
  D[v] = res
  return res
ans = dfs(0)
if ans == INF:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")

### FIXED CODE ###

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

n = int(input())
P = list(map(int, input().split()))
T = [[] for _ in range(n)]
for i, p in enumerate(P, 1):
  T[p-1].append(i)
X = list(map(int, input().split()))
D = [[-1]*n for _ in range(2)]
def dfs(color, v):
  if D[color][v] != -1:
    return D[color][v]
  l = len(T[v])
  x = X[v]
  dp = [[float("inf")]*(x+1) for _ in range(l+1)]
  dp[0][0] = 0
  for i, nv in enumerate(T[v]):
    for j in range(x+1):
      if j >= X[nv]:
        dp[i+1][j] = min(dp[i+1][j], dp[i][j-X[nv]]+dfs(color, nv))
      if j >= dfs(color^1, nv):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j-dfs(color^1, nv)]+X[nv])
  res = min(dp[l])
  D[color][v] = res
  return res
ans = dfs(0, 0)
if ans == float("inf"):
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
    
n,x = map(int,input().split())
s = list(map(int,input().split()))

for i in range(n):
    s[i]-=x

ans=gcd_list(s)
   
print(ans)

### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

n,x = map(int,input().split())
s = list(map(int,input().split()))

for i in range(n):
    s[i]-=x
ans=s[0]
for i in range(n-1):
    ans=gcd(ans,s[i+1])

if(ans<0):
    ans=-ans
    

print(ans)
n, a, b, c, d = map(int, input().split())
s = list(input())
for i in range(b, d - 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        exit(0)
for i in range(a, c - 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        exit(0)
if c < d:
    exit(1)
else:
    l, r = a - 1, a
    while l >= 0 and (s[l] != '#' or s[l + 1] != '#'):
        l -= 1
    l += 2 - int(l == -1)
    while r < n and (s[r - 1] != '#' or s[r] != '#'):
        r += 1
    r -= 2 - int(r == n)
    for i in range(l, r - 1):
        if s[i] == '.' and s[i + 1] == '.' and s[i + 2] == '.':
            print('Yes')
            break
    else:
        print('No')


### FIXED CODE ###

n, a, b, c, d = map(int, input().split())
s = input()
if '##' in s[a-1:c] or '##' in s[b-1:d]:
    print('No')
elif c < d:
    print('Yes')
else:
    if '...' in s[b-2:d+1]:
        print('Yes')
    else:
        print('No')
def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))


def s_to_num(s):
    numlst = list(map(int, s))
    res = 0
    for i in numlst:
        res *= 10
        res += i
    return res


s = input()
length = len(s)
res = 0
for i in powerset(range(1, length)):
    if not i:
        res += int(s)
    else:
        jlst = [0] + list(i) + [length]
        for j in range(len(jlst) - 1):
            res += s_to_num(s[jlst[j]:jlst[j + 1]])
print(res)

### FIXED CODE ###

from itertools import chain, combinations


def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))


def s_to_num(s):
    numlst = list(map(int, s))
    res = 0
    for i in numlst:
        res *= 10
        res += i
    return res


s = input()
length = len(s)
res = 0
for i in powerset(range(1, length)):
    if not i:
        res += int(s)
    else:
        jlst = [0] + list(i) + [length]
        for j in range(len(jlst) - 1):
            res += s_to_num(s[jlst[j]:jlst[j + 1]])
print(res)
N, K = map(int, input().split())
A = list(map(int, input().split()))

#print(N, K, A)
A2 = [0] * N
for i in range(len(A)):
    A2[A[i]] += 1

A2.sort(reverse = True)
print(A2)
count = 0
for i in range(K):
    count += A2[i]
print(N - count)

### FIXED CODE ###

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

#print(N, K, A)
A2 = [0] * N
for i in range(len(A)):
    A2[A[i]-1] += 1

A2.sort(reverse = True)
#print(A2)
count = 0
for i in range(K):
    count += A2[i]
print(N - count)
N,A,B=map(int,input().split)
ans=N//(A+B)*A
rem=N%(A+B)
ans=ans+min(rem,A)
print(ans)

### FIXED CODE ###

N,A,B=map(int,input().split())
ans=(N//(A+B))*A
rem=N%(A+B)
ans=ans+min(rem,A)
print(ans)
import collections as cl
N = int(input())
A = list(map(int,inpput().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cl.values()])
for k in range(N):
  print(sumC - cn[k] +1)

### FIXED CODE ###

import collections
N = int(input())
li = list(map(int, input().split()))
cn = collections.Counter(li)
sumC = sum([n*(n-1)//2 for n in cn.values()])
for k in range(N):
    print(sumC-cn[li[k]] + 1)
N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  if H[i+1]>=H[i] and H[1]<=H[i+1] and H[2]<=H[i+1]:
    ans += 1
print(ans+1)

### FIXED CODE ###

a,b = map(int, input().split())
if a>b:
  ans = 2*a-1
elif a==b:
  ans = 2*a
else:
  ans = 2*b-1
  
print(ans)
import sys

n,k = map(int, input().split())
a = list(map(int, input().split()))
if k > max(a) :
    print('IMPOSSIBLE')
    sys.exit()
elif k in a or 1 in a:
    print('POSSIBLE')
    sys.exit()

a.sort()
l = []
for i in range(n-1,-1,-1) :
    if a[i] < k :
        break
    else :
        l.append(a[i]-k)
else :
    l = list(set(l))

diff = [0]*(n-1)
for i in range(n-1) :
    diff[i] = a[i+1] - a[i]
else :
    diff = list(set(diff))
    diff.sort()

for d in diff :
    for ll in l :
        if ll%d == 0 or ll%d in diff :
            print('POSSIBLE')
            sys.exit()
else :
    print('IMPOSSIBLE')

### FIXED CODE ###

def gcd(a, b) :
    if a < b :
        a,b = b,a
    if b == 0 :
        return a
    else :
        return gcd(b, a%b)


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

g = a[0]
for i in range(n-1) :
    g = gcd(g,a[i+1])

if (k < max(a) and k%g == 0) or (k in a) :
    print('POSSIBLE')
else :
    print('IMPOSSIBLE')
N, K = map(int, input().split())

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
if name == 'main':
    dots = XY[:]

    import sys
    INT_MAX = sys.maxsize

    x_dots = [(x, y) for x, y in dots]
    x_dots = sorted(x_dots)
    y_dots = [(x, y) for x, y in dots]
    y_dots = sorted(y_dots, key=lambda x: x[1])

    ans = INT_MAX
    for i in range(N):
        for j in range(i+1, N):
            sub_x_dots = set(x_dots[i:j+1])
            xl = x_dots[i:j+1][0][0]
            xr = x_dots[i:j+1][-1][0]
            for k in range(N):
                for l in range(k+1, N):
                    sub_y_dots = set(y_dots[k:l+1])
                    #print("----")
                    #print(x_dots[i:j+1])
                    #print(y_dots[k:l+1])
                    intersection = sub_x_dots & sub_y_dots
                    if len(intersection) >= K:
                        yl = y_dots[k:l+1][0][1]
                        yr = y_dots[k:l+1][-1][1]
                        area = (xl-xr) * (yl-yr)

                        ans = min(ans, area)
    print(ans)
                
                

### FIXED CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for ((left_x, _), (right_x, _)) in itertools.combinations(dots, 2):
    if left_x > right_x:
        left_x, right_x = right_x, left_x
    for ((_, under_y), (_, top_y)) in itertools.combinations(dots, 2):
        if under_y > top_y:
            under_y, top_y = top_y, under_y
        counter = 0
        for d_x, d_y in dots:
            if  (left_x <= d_x) and (d_x <= right_x) and (under_y <= d_y) and (d_y <= top_y):
                counter += 1
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            if ans > area:
                ans = area
            
print(ans)
from sys import stdin
import math

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) // 2 for x in stdin.readline().rstrip().split()]
ans = 0
g = 1

for i in range(len(A)):
    g = g * A[i] // math.gcd(g, A[i])

for i in range(len(A)):
    if (g // A[i]) % 2 == 0:
        print(0)
        exit()

ans = M // g
if ans % 2 == 0:
    print(ans // 2)
else:
    print((ans + 1) // 2)


### FIXED CODE ###

from sys import stdin
import fractions

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) // 2 for x in stdin.readline().rstrip().split()]
ans = 0
g = 1

for i in range(len(A)):
    g = g * A[i] // fractions.gcd(g % A[i], A[i])
    if g > M:
        print(0)
        exit()

for i in range(len(A)):
    if (g // A[i]) % 2 == 0:
        print(0)
        exit()

ans = M // g
if ans % 2 == 0:
    print(ans // 2)
else:
    print((ans + 1) // 2)
for i in range(3)
	A[i] = input()
print(A[0][0] + A[1][1] + A[2][2])

### FIXED CODE ###

A=input()
B = input()
C = input()
print(A[0] + B[1] + C[2])
INFINITESIMAL = float("-inf")

N, M, P = [int(e) for e in input().split()]
Es = [None] * M

for i in range(M):
    Es[i] = ([int(e) for e in input().split()])
    Es[i][2] -= P

d = [INFINITESIMAL] * (M + 1)
d[1] = 0

for _ in range(M):
    for e in Es:
        u, v, w = e
        dd = d[u] + w
        if d[v] < dd:
            d[v] = dd

circle_exists = False

for e in Es:
    u, v, w = e

    if v != N:
        continue

    if d[v] < d[u] + w:
        circle_exists = True
        break


if circle_exists:
    print(-1)
elif d[N] < 0:
    print(0)
else:
    print(d[N])


### FIXED CODE ###

import collections


def bellman_ford(es, n, start):
    infinity = float("inf")
    m = len(es)

    d = [infinity] * (n + 1)
    d[start] = 0

    for _ in range(m):
        updated = False

        for u, v, w in es:
            if d[u] == infinity: continue

            dd = d[u] + w

            if dd < d[v]:
                d[v] = dd
                updated = True

        if not updated: break

    for u, v, w in es:
        if d[u] < infinity and d[u] + w < d[v]:
            return None, True

    return d, False


N, M, P = [int(e) for e in input().split()]

Es = [None] * M

for i in range(M):
    a, b, c = ([int(e) for e in input().split()])
    Es[i] = (a - 1, b - 1, P - c)

q = collections.deque()
q.append(N - 1)

valid = [False] * N
valid[N - 1] = True

while 0 < len(q):
    cur = q.popleft()

    for u, v, _ in Es:
        if cur == v and not valid[u]:
            valid[u] = True
            q.append(u)

es_tmp = []
for e in Es:
    if valid[e[0]] and valid[e[1]]:
        es_tmp.append(e)

Es = es_tmp

distances, le = bellman_ford(Es, N - 1, 0)

if le:
    print(-1)
else:
    print(max(-distances[-1], 0))
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dy, dx in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]   
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min(sc[y][x] for sc in scover):
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
 
while True:
    data = raw_input()
    if data == "0":
        break
    m, n = map(int, data.split())
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
S=int(input())

a=S/100
b=S%100

if(a>12 and b>12):
    print("NA")

elif(a==0 and b==0):
    print("NA")

elif((a>12 or a=0) and 1<=b<=12):
        print("YYMM")

elif(1<=a<=12 and (b>12 or b=0)):
        print("MMYY")

elif(1<=a<=12 and 1<=b<=12):
        print('AMBIGUOU')

else:
    print("NA")


### FIXED CODE ###

n = int(input()[:4])
a = n//100
b = n%100
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 1<=a<=12 and (b>=13 or b==0):
    print('MMYY')
elif 1<=b<=12 and (13<=a or a==0):
    print('YYMM')
else:
    print('NA')
from collections import defaultdict

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

a = []
b = []

for i in range(N):
	a_i, b_i = map(int, input().split( ))
	a.append(a_i)
	b.append(b_i)

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0
for a_i,b_i in d_sorted.items():
	l += b_i
	if l >= K:
		print(a_i)
		break


### FIXED CODE ###

from collections import defaultdict

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

a = []
b = []

for i in range(N):
	a_i, b_i = map(int, input().split( ))
	a.append(a_i)
	b.append(b_i)

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0

for i in range(N):
	a_i = d_sorted[i][0]
	b_i = d_sorted[i][1]
	l += b_i
	if l >= K:
		print(a_i)
		break
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(K+1,i+1))]

print(A[N-1])


### FIXED CODE ###

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(K+1,i+1))])

print(A[N-1])
a, b = map(int, input())
print(max([a+b, a-b, a*b]))

### FIXED CODE ###

a, b = map(int, input().split())
print(max([a+b, a-b, a*b]))
N = int(input())
A = list(map(int, input().split()))
num = 1
for i in range(0,N):
    if A[i]==0:
      	num=0
      	break
    else:
  		num *= A[i]
  
if num>10**18:
    print(-1)
else:
    print(num)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
num = 1
for i in range(0,N):
    if A[i]==0:
      	num=0
      	break
for i in range(0,N):
    if num>10**18:
        break
    else:
        num *=A[i]
if num>10**18:
    print(-1)
else:
    print(num)
s = list(input())

if s[2] == s[3] & s[4] == s[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = list(input())

if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")
N,R=map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-K))

### FIXED CODE ###

N,R=map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-N))
#import fractions
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

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

a=A[0]
for b in A:
    a=lcm(a,b)
    #a = a /fractions.gcd(a, b)*b

count=0
for i in A:
    count+=a/i
    if count>(10**9)+7:
        count=count%((10**9)+7)
print(int(count)%((10**9)+7))

### FIXED CODE ###

import fractions
n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    a = (a * b) // fractions.gcd(a, b)

count=0
for i in A:
    count+=a//i

print((count%((10**9)+7)))
def Get_nC2(n):
    return int(n*(n-1) / 2);


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

cnt_dict = {}
for a_i in A_i:
    cnt = 0
    if a_i in cnt_dict:
        print(cnt_dict[a_i])
        continue
    else:
    for j in range(min(A_i), max(A_i)+1):
        j_cnt = A_i.count(j)
        if a_i == j:
            j_cnt -= 1

        cnt += Get_nC2(j_cnt)

        cnt_dict[a_i] = cnt

        print(cnt)


### FIXED CODE ###

from collections import Counter

def Get_nC2(n):
    return int(n*(n-1) / 2)


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

c = Counter(A_i)


total = sum(list(map(Get_nC2, c.values())))

for a_i in A_i:
    result =  total - Get_nC2(c[a_i]) + Get_nC2(c[a_i]-1)
    print(result)
N=int(input())

for i in range(N//4+1):
  for i in range(N//7+1):
    if 4*i+7*j==N:
      print("Yes")
      break
else:
  print("No")

### FIXED CODE ###

N=int(input())
flag=False

for i in range(N//4+1):
  if flag==False:
    for j in range(N//7+1):
      if 4*i+7*j==N:
        print("Yes")
        flag=True
        break


if flag==False:
  print("No")
N = int(input())
A = list(map(int, input().split()))

As = sorted(A)

dellist = []
# A[0]は最小なので同じ数字を除いてそれよりも大きい他の数では割り切れない。
i = 1
while(i < len(As)):
#     print('i:{}'.format(i))
#     print('As:{}'.format(As))
    # As[i]が、A[0]～A[i-1]で割り切れるか試す
    for j in range(i):
#         print('j:{}'.format(j))
#         print('As[i]:{}'.format(As[i]))
#         print('As[j]:{}'.format(As[j]))
        if As[i]%As[j]==0: # 割り切れちゃった場合
            # A[i]とA[j]が同じ数字なら、後でA[j]も消す必要があるので、
            # A[j]を削除リストに入れる
            if As[i] == As[j]:
                dellist.append(A[j])
            # A[i]を消す
            As.pop(i)
            # 消す前にA[i+1]だったものがA[i]になるので、iの値は変えずに
            # 新しいA[i]についてwhile中の最初から割り切れるかを検討する。
            # break後に1増えてしまうので、ここで減らしておく
            i-=1
            break
        
    # A[0]～A[i-1]で割り切れなかった場合：A[i]は残す。
    # iを一つ増やして、A[i+1]について考える
    i += 1

# remove は、指定した要素がlistに含まれていないとエラーを吐くみたいなので、
# 重複を排除する
dellist = list(set(dellist))
    
for i in dellist:
    As.remove(i)

# print(As)
print(len(As))
# print(dellist)

### FIXED CODE ###

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

cnt = [0] * ((10 ** 6) + 1)

for elem in a:
    cnt[elem] += 1

unique = []

for i in range((10 ** 6) + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * ((10 ** 6) + 1)

a = list(set(a))

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0
        
for elem in unique:
    if cnt[elem] == 0:
        ans += 1

print(ans)
K, X = list(map(int, input()))

if K * 500 >= X:
  	print('Yes')
else:
  	print('No')

### FIXED CODE ###

K, X = list(map(int, input().split()))

if K * 500 >= X:
  	print('Yes')
else:
  	print('No')
#!/usr/bin/env python3
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
z = p[-x:].extend(q[-y:]).extend(r)
z.sort()
print(sum(z[-x-y:]))

### FIXED CODE ###

#!/usr/bin/env python3
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
z = p[-x:]
z.extend(q[-y:])
z.extend(r)
z.sort()
#print(z)
print(sum(z[-x-y:]))
N = input(int())
p = list(map(int, input().split()))
err = 0
for i in range(N):
  if p[i]!=i:
    err+=0
if err == 0:
  print("YES")
elif err == 2:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N = int(input())
p = list(map(int, input().split()))
err = 0
for i in range(N):
  if p[i] != i+1:
    err += 1
if err == 0:
  print("YES")
elif err == 2:
  print("YES")
else:
  print("NO")
c = input().split()
n = input().split()
idx = c.index(input())
n[idx] -= 1
print("".join(n), end="\n")

### FIXED CODE ###

c = input().split()
n = [int(c) for c in input().split()]
idx = c.index(input())
n[idx] -= 1
print(" ".join([str(c) for c in n]), end="\n")