Harryxun/stf_run huggingface dataset:
from collections import deque
N = int(input())
A = list(map(int, input().split()))
bb = deque(sorted(A))
x = [0]*(N-1)
y = [0]*(N-1)
start_bool = 1 if N % 2 == 0 else -1
for i in range(N-1):
    print(bb)
    l = bb.popleft()
    r = bb.pop()
    if start_bool < 0:
        if l > r:
            ret = r - l
            x[i] = r
            y[i] = l
        else:
            ret = l - r
            x[i] = l
            y[i] = r
    else:
        if l > r:
            ret = l - r
            x[i] = l
            y[i] = r
        else:
            ret = r - l
            x[i] = r
            y[i] = l
    if ret > 0:
        bb.append(ret)
    else:
        bb.appendleft(ret)
    start_bool *= -1
print(bb.pop())
for i in range(N-1):
    print(x[i], y[i])

### FIXED CODE ###

from collections import deque
N = int(input())
A = list(map(int, input().split()))
plus = 0
minus = 0
for i in range(N):
    if A[i] >= 0:
        plus += 1
    else:
        minus += 1
bb = deque(sorted(A))
x = [0]*(N-1)
y = [0]*(N-1)
for i in range(N-1):
    if len(bb) == 2:
        l = bb.popleft()
        r = bb.pop()
        if l > r:
            ret = l-r
            x[i] = l
            y[i] = r
        else:
            ret = r - l
            x[i] = r
            y[i] = l
    else:
        l = bb.popleft()
        r = bb.pop()

        if plus > minus:
            ret = l - r
            x[i] = l
            y[i] = r
            plus -= 1
        else:
            ret = r - l
            x[i] = r
            y[i] = l
            minus -= 1
    if ret > 0:
        bb.append(ret)
    else:
        bb.appendleft(ret)
print(bb.pop())
for i in range(N-1):
    print(x[i], y[i])
H, W = map(int, input().split(" "))

result = True
masu = [[0 for i in range(H+2)] for j in range(W+2)]
for h in range(1, H+1):
    s = "0"+input()+"0"
    masu[h] = list(s)

# print(masu)

for h in range(H):
    for w in range(W):
        if masu[h][w] == "#":
            if (masu[h][w] == masu[h+1][w]) or (masu[h][w] == masu[h][w+1]) or (masu[h][w] == masu[h-1][w]) or (masu[h][w] == masu[h][w-1]):
                pass
            else:
                result = False

if result:
    print("Yes")
else:
    print("No")


### FIXED CODE ###


H, W = map(int, input().split(" "))

# result = True
masu = [['.' for i in range(W+2)] for j in range(H+2)]
for h in range(H):
    s = "."+input()+"."
    masu[h+1] = s

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                # result = False
                print("No")
                exit()

print("Yes")
a,b=map(int,input().split())
h=[14]+list(range(2,14))
ifa==b:
  print("Draw")
else:
  print("Alice"if h[a]>h[b]else"Bob")

### FIXED CODE ###

a,b=map(int,input().split())
h=[0,14]+list(range(2,14))
if a==b:
  print("Draw")
else:
  print("Alice"if h[a]>h[b]else"Bob")
def judge(n):
    if n == 2 or n == 3:
        return 1
    if n % 2 == 0:
        return 0
    i = 3
    while i < n:
        if n%i == 0:
            return 0
        else:  
            i += 2
    return 1

print(sum(map(judge, ls)))



### FIXED CODE ###

n = int(input())
ls = [int(input()) for _ in range(n)]


def judge(n):
    if n == 2 or n == 3:
        return 1
    if n % 2 == 0:
        return 0
    i = 3
    while i <= n/i:
        if n%i == 0:
            return 0
        else:  
            i += 2
    return 1

print(sum(map(judge, ls)))
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N = list(map(int, input()))[::-1]
# N = int(input())
N, M, Q = map(int, input().split())
big = 0
s = 2**N
l = []

moto = list(range(1, Q+1))

for i in range(Q):
    l.append(list(map(int, input().split())))

A = []
for i in range(N):
    AA = []
    if A:
        for k in A:
            for j in range(1, M+1):
                if int(k[-1]) <= j:
                    AA.append(k+str(j))
        A = AA
    else:
        for j in range(1, M+1):
            A.append(str(j))

for i in A:
    wa = 0
    for j in l:
        if (int(i[j[1]-1])-int(i[j[0]-1])) == j[2]:
            wa += j[3]

    if big < wa:
        big = wa
print(big)


### FIXED CODE ###

from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N = list(map(int, input()))[::-1]
# N = int(input())
N, M, Q = map(int, input().split())
big = 0
s = 2**N
l = []

moto = list(range(1, Q+1))

for i in range(Q):
    l.append(list(map(int, input().split())))

A = []
for i in range(N):
    AA = []
    if A:
        for k in A:
            for j in range(1, M+1):
                if k[-1] <= j:
                    AA.append(k+[j])
        A = AA
    else:
        for j in range(1, M+1):
            A.append([j])

for i in A:
    wa = 0
    for j in l:
        if (i[j[1]-1]-i[j[0]-1]) == j[2]:
            wa += j[3]

    if big < wa:
        big = wa
print(big)
from sys import stdin
import math
N,K=list(map(int,(stdin.readline().strip().split())))
print(math.gcd(N,K))

### FIXED CODE ###

from sys import stdin
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
N,K=list(map(int,(stdin.readline().strip().split())))
if N%K==0:print(0)
else:
    M=10**19
    while(True):
        M = N
        N=N%K
        if M==N:
            M = N
            N-=K
            if N<=0:
                if abs(N)<abs(M):
                    print(abs(N))
                    break
                else:
                    print(abs(M))
                    break
N,X,M = map(int,input().split())
#全体ループを見る配列
t_loop = [X]
#初回ループを見る配列
f_loop = [X]
#出現回数を見る辞書
memo = {X:1}
#2回目以降のループを見る配列
s_loop = []
while True:
    new_val = t_loop[-1]**2%M
    t_loop.append(new_val)
    if new_val not in f_memo:
        memo[new_val] = 1
        f_loop.append(new_val)
    else:
        memo[new_val] += 1
        if memo[new_val] == 3:
            break
        else:
            s_loop.append(new_val)

ans = 0
if N <= len(f_loop):
    ans += sum(f_loop[:N])
else:
    ans += sum(f_loop)
    shou = (N-len(f_loop))//len(s_loop)
    amari = (N-len(f_loop))%len(s_loop)
    ans += shou*sum(s_loop)
    ans += sum(s_loop[:amari])
    
print(ans)

### FIXED CODE ###

N,X,M = map(int,input().split())
t_loop = [X]
f_loop = [X]
f_memo = {X:1}
s_loop = []
while True:
    new_val = t_loop[-1]**2%M
    t_loop.append(new_val)
    if new_val not in f_memo:
        f_memo[new_val] = 1
        f_loop.append(new_val)
    else:
        f_memo[new_val] += 1
        if f_memo[new_val] == 3:
            break
        else:
            s_loop.append(new_val)

ans = 0
if N <= len(f_loop):
    ans += sum(f_loop[:N])
else:
    ans += sum(f_loop)
    shou = (N-len(f_loop))//len(s_loop)
    amari = (N-len(f_loop))%len(s_loop)
    ans += shou*sum(s_loop)
    ans += sum(s_loop[:amari])
    
print(ans)
# coding: utf-8
import sys
sys.setrecursionlimit(10000)

input_lines = []
input_lines.append(raw_input())
N,T,S = [int(x) for x in input_lines[0].split(' ')]
data = []
for i in range(N):
	input_lines.append(raw_input())
	a,b = [int(x) for x in input_lines[i+1].split(' ')]
	data.append([a,b])
dp = [[0 for i in range(T+1)]for j in range(N+1)]
judge = 0
judge2 = 0
def rec(i,t):
	global judge
	global judge2
	if judge2 == 1 and t < T-S:
		judge =1
	if dp[i][t] != 0:
		return dp[i][t]
	if i == N:
		res = 0
	elif t < data[i][1] or (judge == 0 and t - data[i][1] < T-S and data[i][1] > T-S):
		res = rec(i+1,t)
	else:
		if judge == 0 and t - data[i][1] < T-S and data[i][1] <= T-S:
			judge2 = 1
			res = max(rec(i+1,t),rec(i+1,T-S-data[i][1])+data[i][0])
			judge = 0
		else:
			res = max(rec(i+1,t),rec(i+1,t-data[i][1])+data[i][0])
	dp[i][t] = res
	return res

print rec(0,T)

### FIXED CODE ###

# coding: utf-8

input_lines = []
input_lines.append(raw_input())
N,T,S = [int(x) for x in input_lines[0].split(' ')]
data = []
for i in range(N):
	input_lines.append(raw_input())
	a,b = [int(x) for x in input_lines[i+1].split(' ')]
	data.append([a,b])
dp = [[0 for i in range(T+1)]for j in range(N+1)]
judge = 0

for i in range(N-1,-1,-1):
	for j in range(0,T+1):
		#もうこの店で遊べないorSをはじめてまたいで，かつS以降に配置不可能
		if j < data[i][1] or (j > T-S and j - data[i][1] < T-S and data[i][1] > T-S):
			dp[i][j] = dp[i+1][j]
		#Sをはじめてまたいで，かつS以降に配置可能
		elif j > T-S and j - data[i][1] < T-S and data[i][1] <= T-S:
			dp[i][j] = max(dp[i+1][j],dp[i+1][T-S-data[i][1]]+data[i][0])
		else:
			dp[i][j] = max(dp[i+1][j],dp[i+1][j-data[i][1]]+data[i][0])

print dp[0][T]
n = int(input())

z_vec = [0] * n
w_vec = [0] * n


for i in range(0, n + 1):
    line = input()
    tmp = line.split()
    z_vec[i] = int(tmp[0]) + int(tmp[1])
    w_vec[i] = int(tmp[0]) - int(tmp[1])

z_ans = max(z_vec) - min(z_vec)
w_ans = max(w_vec) - min(w_vec)


print(f'{max(z_ans, w_ans)}')

### FIXED CODE ###

n = int(input())

p_one = input()
p_one_list = p_one.split(' ')

zmax = int(p_one_list[0]) + int(p_one_list[1])
zmin = int(p_one_list[0]) + int(p_one_list[1])
wmax = int(p_one_list[0]) - int(p_one_list[1])
wmin = int(p_one_list[0]) - int(p_one_list[1])


for i in range(1, n):
    line = input()
    tmp = line.split(' ')
    z = int(tmp[0]) + int(tmp[1])
    w = int(tmp[0]) - int(tmp[1])
    zmax = max(zmax, z)
    wmax = max(wmax, w)
    zmin = min(zmin, z)
    wmin = min(wmin, w)


z_ans = zmax - zmin
w_ans = wmax - wmin


print(f'{max(z_ans, w_ans)}')
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())
t0=int(input())
t1=int(input())
t_lcm=lcm(t0,t1)
for i in range(n-2):
    t2=int(input())
    t_lcm=lcm(t_lcm,t2)
print(t_lcm)

### FIXED CODE ###

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())
t0=int(input())
if n==1:
    print(t0)
else:
    t1=int(input())
    t_lcm=lcm(t0,t1)
    for i in range(n-2):
        t2=int(input())
        t_lcm=lcm(t_lcm,t2)
    print(t_lcm)
n = int(input())
import sympy
ans = 0
for i in range(1,n):
    ans += sympy.divisor_count(i)
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n):
    ans += (n-1)//i
print(ans)
import math

r= map(int, raw_input().split())

a=float(r)*float(r)*??
b=2*float(r)*??
print a,b

### FIXED CODE ###

import math
r=input()
a=r*r*math.pi
b=2*r*math.pi
print "%f %f"%(a,b)
N = int(input())
A = list(map(int, input().split()))

c = [-1, -1 ,-1]

sum = 1
tmp = 0
for a in A:
    sum = sum * c.count(A-1) % 1000000007
    if A-1 == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif A-1 == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif A-1 == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
print(sum)


### FIXED CODE ###

N = int(input())
A = map(int, input().split())
MOD = 1000000007
ans = 1
cnt = [3 if i == 0 else 0 for i in range(N + 1)]
 
for a in A:
    ans = ans * cnt[a] % MOD
    if ans == 0:
        break
    cnt[a] -= 1
    cnt[a+1] += 1
 
print(ans)
mport copy
n,m = map(int,input().split())

dic = {}
for i in range(m):
    c,y = map(int,input().split())
    dic[y] = c
#print(dic)

dic2 = copy.deepcopy(dic)
#print(dic)
dic2 = sorted(dic2.items(),key=lambda x:x[1],reverse=True)
dic2 = sorted(dic2.items(),key=lambda x:x[0])#,reverse=True)
#print(dic2)
#[(32, 1), (12, 1), (63, 2)]

ken = dic2[0][1]
counter = 0
ans = {}

for y,k in dic2:
    if ken == k:
        counter +=1
    else:
        counter = 1
    tmp = str(k).zfill(6) + str(counter).zfill(6)
    ans[y] = tmp

for i in dic.keys():
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()
 
def main():
    N,M=map(int,input().split())
    city=[[] for _ in range(N)]
    s=set()
    for i in range(M):
        P,Y=map(lambda x:int(x)-1,input().split())
        s.add(P)
        city[P].append((Y,i))
    city=list(map(sorted,city))
    ans=[0]*M
    for x in s:
        for i,c in enumerate(city[x]):
            ans[c[1]]=str(x+1).zfill(6)+str(i+1).zfill(6)
    for i in range(M):
        print(ans[i])
main()
(n, m) = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))

score = [0 for _ in range(m)]
for i in a:
    for food_index in range(1, len(i)):
        if 0 >= food_index:
            continue
        score[i[food_index - 1]] += 1
print(score.count(n))

### FIXED CODE ###

(n, m) = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
    a[-1].pop(0)

score = [0 for _ in range(m)]
for i in a:
    for food_index in i:
        score[food_index - 1] += 1
print(score.count(n))
N = int(input())
A = list(map(int,input().split))
ans = A[0]
for i in range(N):
    for n in range(i):
        if ans < A[i]:
            ans = A[i]
    for n in range(i+1,N):
        if ans < A[i]:
            ans = A[i]
    print(ans)
    ans = A[0]

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B= sorted(A)

for i in range(N):
    if A[i] == B[N-1]:
        ans = B[N-2]
        print(ans)
    else:
        print(B[N-1])
from collections import deque
N = int(input())
A = deque(sorted([int(input()) for _ in range(N)]))
que = deque([])
que.append(A.popleft())
while A:
    if turn == 1:
        a = A.pop()
        if abs(a-que[0])<=abs(a-que[-1]):
                que.append(a)
            else:
                que.appendleft(a)
        if A:
            a = A.pop()
            if abs(a-que[0])<=abs(a-que[-1]):
                que.append(a)
            else:
                que.appendleft(a)
    else:
        a = A.popleft()
        if abs(a-que[0])<=abs(a-que[-1]):
                que.append(a)
            else:
                que.appendleft(a)
        if A:
            a = A.popleft()
            if abs(a-que[0])<=abs(a-que[-1]):
                que.append(a)
            else:
                que.appendleft(a)
    turn = 1-turn
cnt = 0
for i in range(1,N):
    cnt += abs(que[i]-que[i-1])
print(cnt)

### FIXED CODE ###

from collections import deque
N = int(input())
A = deque(sorted([int(input()) for _ in range(N)]))
B = deque([])
B.append(A.popleft())
cnt = 0
while A:
    a0 = A[0]
    a1 = A[-1]
    b0 = B[0]
    b1 = B[-1]
    c00 = abs(a0-b0)
    c01 = abs(a0-b1)
    c10 = abs(a1-b0)
    c11 = abs(a1-b1)
    cmax = max(c00,c01,c10,c11)
    if cmax == c00:
        B.appendleft(A.popleft())
    elif cmax == c01:
        B.append(A.popleft())
    elif cmax == c10:
        B.appendleft(A.pop())
    else:
        B.append(A.pop())
    cnt += cmax
print(cnt)
A=int(input())
B=int(input())
if 1<=A<=100 and 1<=B<=100:
  print(A*B)

### FIXED CODE ###

str=input()
arr=str.split(' ')
A=int(arr[0])
B=int(arr[1])
if 1<=A<=100 and 1<=A<=100:
  print(A*B)
N, K = map(int, input().split())
Aall = set(range(1, N))
Ak = []
for i in range(N):
  d = input().split()
  A = list(map(int, input().split()))
  Ak.extend((A))
print(len(Aall - set(Ak)))

### FIXED CODE ###

N, K = map(int, input().split())
Aall = set(list(range(1, N+1)))
A = []
for i in range(N*2):
  try: 
    if i % 2 != 0:
      a = list(map(int, input().split()))
      A.extend(a)
    else:
      d = list(map(int, input().split()))
  except EOFError:
    d = 1
print(len(Aall-set(A)))
import math
N,D,A=map(int,input().split())
l=[]
for i in range(N):
  x,h=map(int,input().split())
  l.append((x<<30)+h)
l.sort()
S=[0]*N
ma=[0]*N
tmp=N-1
for i in reversed(range(N)):
  x=l[i]>>30
  for j in reversed(range(0,tmp)):
    if abs(l[j]>>30-(x-D))>D:
      ma[i]=j+1
      tmp=j+1
      break
  else:
    ma[i]=0
    tmp=0
ans=0
S[0]=math.ceil(l[0]&(2**30-1)/A)
for i in range(1,N):
  h=l[i]&(2**30-1)
  left=S[ma[i]-1] if ma[i]>0 else 0
  right=S[i-1]
  sum_=(right-left)*A
  if h<=sum_:
    S[i]=S[i-1]
    continue
  time=math.ceil((h-sum_)/A)
  S[i]=time+S[i-1]
print(S[N-1])


### FIXED CODE ###

import math
N,D,A=map(int,input().split())
l=[]
for i in range(N):
  k=list(map(int,input().split()))
  l.append(k)
l.sort()
S=[0]*N
ma=[0]*N
tmp=N-1
for i in reversed(range(N)):
  x=l[i][0]
  for j in reversed(range(0,tmp)):
    if abs(l[j][0]-(x-D))>D:
      ma[i]=j+1
      tmp=j+1
      break
  else:
    ma[i]=0
    tmp=0
ans=0
S[0]=math.ceil(l[0][1]/A)
for i in range(1,N):
  h=l[i][1]
  left=S[ma[i]-1] if ma[i]>0 else 0
  right=S[i-1]
  sum_=(right-left)*A
  if h<=sum_:
    S[i]=S[i-1]
    continue
  time=math.ceil((h-sum_)/A)
  S[i]=time+S[i-1]
print(S[N-1])
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = None
        self.right = None

class BST:
    def __init__(self):
        self.root = None
    def insert(self, key):
        x = self.root
        y = None
        z = Node(key)
        while x != None:
            y = x
            x = x.left if z.key < x.key else x.right
        if y == None: self.root = z
        else:
            if z.key < y.key: y.left = z
            else: y.right = z
    def print_tree(self):
        def inorder(node):
            if node:
                inorder(node.left)
                temp += f' {node.key}'
                inorder(node.right)
        def preorder(node):
            if node:
                temp += f' {node.key}'
                preorder(node.left)
                preorder(node.right)
        temp = ''
        inorder(self.root)
        print(temp)
        temp = ''
        preorder(self.root)
        print(temp)

tree = BST()
input()
for e in sys.stdin:
    if e[0] == 'i': tree.insert(int(e[7:]))
    else: tree.print_tree()


### FIXED CODE ###

import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x, y = root, None
    while x: x, y = x.left if key < x.key else x.right, x
    if y is None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''

input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    else: print(inorder(root)); print(preorder(root))
import sys

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

win_choice = {'s':'r', 'p':'s', 'r':'p'}
janken_point = {'r':r, 's':s, 'p':p}

dp = []
# a: 相手の手, x:自分が出せない手
def point(a, x=None):
    if x == win_choice[a]: return 0
    else: return janken_point[win_choice[a]]

def total_score(i, cnt, x=None):
    if cnt == 0:
        return 0
    else:
        a = t[(cnt - 1) * k + i]
        a_next = t[(cnt - 2) * k + i] if cnt > 1 else None
        choice = win_choice[a]
        if a == a_next and point(a, x) != 0:
            return point(a, x) + total_score(i, cnt - 1, choice)
        else:
            return point(a, x) + total_score(i, cnt - 1)

sys.setrecursionlimit(n + 1)
r = [0] * k
for i in range(n):
    i = i % k
    r[i] += 1

score = 0
for i in range(k):
    cnt = r[i]
    score += total_score(i, cnt)

print(score)

### FIXED CODE ###

import sys

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

win_choice = {'s':'r', 'p':'s', 'r':'p'}
janken_point = {'r':r, 's':s, 'p':p}

dp = []
# a: 相手の手, x:自分が出せない手
def point(a, x=None):
    if x == win_choice[a]: return 0
    else: return janken_point[win_choice[a]]

score = 0
flag = [('0', 1)] * k
for i in range(n):
    if flag[i % k][0] != t[i]:
        score += point(t[i])
        flag[i % k] = (t[i], -1)
    elif flag[i % k][0] == t[i] and flag[i % k][1] == 1:
        score += point(t[i])
        flag[i % k] = (t[i], -1)
    else:
        flag[i % k] = (t[i], 1)

print(score)
list=[1, 1, 1, 1, 1]
for i in range(1, 7):
  list.append(6**i)
for j in range(1, 7):
  list.append(9**i)
sorted(list, reverse=True)
N=int(input())
count=0
for i in list:
  if i <= N:
    N=N-i
    count+=1
      if N==0:
        break
print(count)

### FIXED CODE ###

N=int(input())

A=[1]

i = 1
while True:
    if 6**i <= 100000:
        A.append(6**i)
    else:
        break
    i += 1

i = 1
while True:
    if 9**i <= 100000:
        A.append(9**i)
    else:
        break
    i += 1

A.sort()

dp = [N]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    for j in range(len(A)):
        if i - A[j] >= 0:
            dp[i] = min(1+dp[i-A[j]], dp[i])

print(dp[-1])
N = int(input())
A = [0] * 9
for a in list(map(int, input().split())):
    A[min(a//400, 9)] += 1

ans = 0
for a in A[:-1]:
    ans += int(a>0)
max_ans = min(ans+A[-1], 8)

if A[-1] > 0:
    min_ans = max(1, ans)
else:
    min_ans = ans
print(min_ans, end=" ")
print(max_ans)

### FIXED CODE ###

N = int(input())
A = [0] * 9
for a in list(map(int, input().split())):
    A[min(a//400, 8)] += 1

ans = len(list(filter(lambda x: x>0, A[:-1])))

max_ans = ans+A[-1]

if A[-1] > 0:
    min_ans = max(1, ans)
else:
    min_ans = ans
print(min_ans, end=" ")
print(max_ans)
a,b,c,d=map(int, input().split())
for i in range(c,1,-1):#cから2まで
    if c % i == 0 and d % i == 0:
        s = i
        break
s = (c // s) * (d // s) * s
print(s)
print(b - a + 1 - b//c + a//c - b//d + a//d + b//s - a//s)


### FIXED CODE ###

def ABC162C(a,b):#from:https://atcoder.jp/contests/abc162/submissions/11871774
    while b != 0:
        a %= b
        if a == 0:break
        b %= a
    return max(a,b)
    

a,b,c,d=map(int,input().split())
e=c//ABC162C(c,d)*d
print(b-b//c-b//d+b//e-(a-1-(a-1)//c-(a-1)//d+(a-1)//e))
N,K=map(int,input().split())
ans=[0]*(10**9+1)

A=list(map(int,input().split()))
A=[A[j]%K for j in range(N)]
ans[1] = A.count(1)

B=[(A[j]+A[j+1])%K for j in range(N-1)]
ans[2] = B.count(2)

for i in range(2,min(K+1,N)):
    C = [(B[j]+B[j+1]-A[j+1])%K for j in range(N-i)]
    ans[i+1] = C.count(i+1)
    A = B
    B = C
    
print(sum(ans))


### FIXED CODE ###

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

if K==1:
    print(0)
    exit(0)

A=list(map(int,input().split()))
S=[0]+list(numpy.cumsum(A)) #累積和
S2=[(S[i]-i)%K for i in range(N+1)]

d = {}
ans = 0
for j in range(1,N+1):
    if j>K-1:
        if S2[j-K] in d:
            d[S2[j-K]] -= 1
        
    if S2[j-1] in d:
        d[S2[j-1]] += 1
    else:
        d[S2[j-1]] = 1
        
    if S2[j] in d:
        ans += d[S2[j]]
print(ans)
a=int(input())
x,y = map(int,input().split())	

b = x//a
c = y//a

if c-b <= 1:
    print('NG')
elif:
    print('OK')


### FIXED CODE ###

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

c = b // k
d = k*c

if a <= d and d <= b:
    print('OK')
else:
    print('NG')