Harryxun/stf_run huggingface dataset:
import sys
from itertools import combinations
#DEBUG = True
DEBUG = False
if DEBUG:
    f=open("202007_1st/C_input.txt")
else:
    f=sys.stdin
WHITE='.'
BLACK='#'
def count_black(H_index,W_index):
    count_tmp=0
    for H_entries in H_index:
        for _ in H_entries:
            if _==H_index:
                continue
            for W_entries in W_index:
                for __ in W_entries:
                    if __==W_index:
                        continue
                if S[_][__]==BLACK:
                    count_tmp+=1
    return count_tmp
ans=0
H,W,K=map(int,f.readline().split())
S=[f.readline().strip() for _ in range(H)]
H_indices=[_ for _ in range(0,H)]
W_indices=[_ for _ in range(0,W)]
combi_list_H=[(-1)]
combi_list_W=[(-1)]
for _ in range(1,H):
    combi_list_H.extend(list(combinations(H_indices,_)))
for _ in range(1,W):
    combi_list_W.extend(list(combinations(W_indices,_)))
for _ in combi_list_H:
    for __ in combi_list_W:
        if count_black(_,__)==5:
            ans+=1
print(ans)
f.close()

### FIXED CODE ###

import sys
from itertools import combinations
#DEBUG = True
DEBUG = False
if DEBUG:
    f=open("202007_1st/C_input.txt")
else:
    f=sys.stdin
WHITE='.'
BLACK='#'
def count_black(H_index,W_index):
    count_tmp=0
    for _ in range(H):
        if _ in H_index:
            continue
        for __ in range(W):
            if __ in W_index:
                continue
            if S[_][__]==BLACK:
                count_tmp+=1
    return count_tmp
ans=0
H,W,K=map(int,f.readline().split())
S=[f.readline().strip() for _ in range(H)]
H_indices=[_ for _ in range(0,H)]
W_indices=[_ for _ in range(0,W)]
combi_list_H=[[-1]]
combi_list_W=[[-1]]
for _ in range(1,H):
    combi_list_H.extend(list(combinations(H_indices,_)))
for _ in range(1,W):
    combi_list_W.extend(list(combinations(W_indices,_)))
for _ in combi_list_H:
    for __ in combi_list_W:
        if count_black(_,__)==K:
            ans+=1
print(ans)
f.close()
n = int(input())
alist = [0]+list(map(int,input().split()))
uv_list = []
for i in range(n-1):
    u,v = map(int,input().split())
    if u > v:
        u,v = v,u
    uv_list.append([u,v])

tree = [[] for _ in range(n+1)]
for i in range(n-1):
    uv = uv_list[i]
    tree[uv[0]].append(uv[1])

queue = [1]
used = [0]*(n+1)
ans = [0]*(n+1)
dp = []
stack = []
while queue != []:
    cur = queue[-1]

    if used[cur] == 0:
        if cur == 1:
            dp.append(alist[cur])
            stack.append([len(dp)-1,None])
        else:
            if alist[cur] > dp[-1]:
                dp.append(alist[cur])
                stack.append([len(dp)-1,None])
            else:
                offset = bisect.bisect_left(dp,alist[cur])
                stack.append([offset,dp[offset]])
                dp[offset] = alist[cur]
        ans[cur] = len(dp)

    if tree[cur] != [] and used[cur] == 0:
        queue.extend(tree[cur])
    else:
        queue.pop()

        #reverse
        back = stack.pop()
        if back[1] == None:
            dp.pop()
        else:
            dp[back[0]] = back[1]
    used[cur] = 1

for i in range(n):
    print(ans[i+1])

### FIXED CODE ###


import math
import bisect

n = int(input())
alist = [0]+list(map(int,input().split()))
uv_list = []
for i in range(n-1):
    u,v = map(int,input().split())
    if u > v:
        u, v = v, u
    uv_list.append([u,v])

tree = [[] for _ in range(n+1)]
for i in range(n-1):
    uv = uv_list[i]
    tree[uv[0]].append(uv[1])
    tree[uv[1]].append(uv[0])
    

queue = [1]
used = [0]*(n+1)
ans = [0]*(n+1)
dp = []
stack = []
while queue != []:
    cur = queue[-1]

    if used[cur] == 0:
        if cur == 1:
            dp.append(alist[cur])
            stack.append([len(dp)-1,None])
        else:
            if alist[cur] > dp[-1]:
                dp.append(alist[cur])
                stack.append([len(dp)-1,None])
            else:
                offset = bisect.bisect_left(dp,alist[cur])
                stack.append([offset,dp[offset]])
                dp[offset] = alist[cur]
        ans[cur] = len(dp)

    if tree[cur] != [] and used[cur] == 0:
        for child in tree[cur]:
            if used[child] == 0:
                queue.append(child)
    else:
        queue.pop()

        #reverse
        back = stack.pop()
        if back[1] == None:
            dp.pop()
        else:
            dp[back[0]] = back[1]
    used[cur] = 1
for i in range(n):
    print(ans[i+1])
s = input()

if s[:(n-1)/2] == s[(n+3)/2:] and s[:(n-1)/2] == s[(n+3)/2:]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
n = len(s)

if s[:int((n-1)/2)] == s[int((n+3)/2)-1:] and s[:int((n-1)/2)] == (s[int((n+3)/2)-1:])[::-1]:
  print('Yes')
else:
  print('No')
import sys

ERROR_INPUT = 'input is invalid'
OPERAND = ['+', '-', '*']
STACK = []


def main():
    inp = get_input()
    print(calc_stack(li=inp))


def calc_stack(li):
    if li[0] in OPERAND:
        ans = calc(left=STACK[-2], right=STACK[-1], ope=li[0])

        del li[0]
        if not li:
            return ans

        STACK.pop()
        STACK.pop()
        STACK.append(ans)

        return calc_stack(li=li)

    else:
        STACK.append(int(li[0]))
        del li[0]
        return calc_stack(li=li)


def calc(left, right, ope):
    if ope == '+':
        return left + right
    elif ope == '-':
        return left - right
    elif ope == '*':
        return left * right


def get_input():
    inp = input().split(' ')
    operand_count = (inp.count(OPERAND[0]) + inp.count(OPERAND[1]) + inp.count(OPERAND[2]))

    if len(inp) < 2 or len(inp) > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    elif operand_count < 1 or operand_count > 100:
        print(ERROR_INPUT)
        sys.exit(1)

    for l in inp:
        if l in OPERAND:
            continue
        elif int(l) < 0 or int(l) > 10**6:
            print(ERROR_INPUT)
            sys.exit(1)

    return inp


main()

### FIXED CODE ###

import sys

ERROR_INPUT = 'input is invalid'
OPECODE = ['+', '-', '*']
STACK = []


def main():
    inp = get_input()
    print(calc_stack(li=inp))


def calc_stack(li):
    for l in li:
        if l in OPECODE:
            STACK.append(calc(right=STACK.pop(), left=STACK.pop(), ope=l))
        else:
            STACK.append(int(l))

    return STACK[0]


def calc(left, right, ope):
    if ope == '+':
        return left + right
    elif ope == '-':
        return left - right
    elif ope == '*':
        return left * right


def get_input():
    inp = input().split(' ')
    opecode_count = 0
    operand_count = 0

    for i in inp:
        if i in OPECODE:
            opecode_count += 1
        elif int(i) < 0 or int(i) > 10**6:
            print(ERROR_INPUT)
            sys.exit(1)
        else:
            operand_count += 1

    if opecode_count < 1 or opecode_count > 100:
        print(ERROR_INPUT)
        sys.exit(1)

    if operand_count < 2 or operand_count > 100:
        print(ERROR_INPUT)
        sys.exit(1)

    return inp


main()
i = raw_input().split(' ')
num = int(str(i[0]+str(i[1])))
for i in range(100)
	if i*i==num:
		print 'Yes'
	else:
		print 'No'


### FIXED CODE ###

i = raw_input().split(' ')
num = int(str(i[0]+str(i[1])))
flag = 'null'
for i in range(1000):
	if i*i==num:
		flag= 'Yes'
	else:
		pass

if flag == 'Yes':
	print 'Yes'
else:
	print 'No'
from fractions import Fraction
a,b=input().split()
A=float(a)
B=Fraction(b)
print(floor(A*B))



### FIXED CODE ###

from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print(floor(a * b))
H, N = map(int,input().split())
Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]


dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)
 
print(dp[-1])

### FIXED CODE ###

H, N = map(int,input().split())
Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]

dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)
 
print(dp[-1])
N, K = map(int, input().split())
A = list(map(int, input().split()))

def get_divisors(n):
    from math import sqrt, ceil
    divisors = []
    for num in range(ceil(n**0.5), n+1):
        if n % num == 0:
            divisors.append(n//num)
            if n//num != n:
                divisors.append(num)
    divisors.sort(reverse=True)
    return divisors

total = sum(A)
divisors = get_divisors(total)
ans = -1
for d in divisors:
    R = [a%d for a in A]
    R.sort(reverse=True)
    pr = 0
    nr = -sum(R)
    for i, r in enumerate(R):
        pr += d-r
        nr += r
        if nr+pr >= 0:
            if pr <= K and nr+pr == 0:
                ans = d
            break
    if ans != -1:
        print(ans)
        break
else:
    print(1)


### FIXED CODE ###

S = input()
N = len(S)
cells = [0]*N

seq = 0
for i, s in enumerate(S):
    if s == 'R':
        seq += 1
        cells[i] = seq
        continue
    seq = 0

rev_S = S[::-1]
seq = 0
for i, s in enumerate(rev_S):
    if s == 'L':
        seq += 1
        cells[N-1-i] = seq
        continue
    seq = 0

ans = [0]*N
pre_cell = 0
pre_s = 'R'
l_flag =False
for i, s in enumerate(S):
    cell = cells[i]
    if pre_s == 'R' and s == 'L':
        ans[i] = cell//2 + cell%2 + pre_cell//2
        ans[i-1] = pre_cell//2 + pre_cell % 2 + cell//2
    pre_s = s
    pre_cell = cell

ans_str = ""
for a in ans:
    ans_str += str(a)+" "
print(ans_str)
b = input()

if b = 'A':
    print('T')
elif b = 'T':
    print('A')
elif b = 'C':
    print('G')
elif b = 'G':
    print('C')
else:
    pass


### FIXED CODE ###

b = input()

if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'C':
    print('G')
elif b == 'G':
    print('C')
else:
    pass
import math

d, g = map(int, input().split())
ls = [[100 * (i + 1)] + list(map(int,
                                 input().split())) for i in range(d)][::-1]
l0 = [a * p + c for a, p, c in ls]

res = float('inf')
for index in range(2**d):
    cs = format(index, 'b')
    cs = f'{int(cs):0{d}d}'
    count = 0
    s = 0
    for i, c in enumerate(cs):
        if c == '1':
            count += ls[i][1]
            s += l0[i]
    if s < g:
        for i, c in enumerate(cs):
            if c == '0' and s + ls[i][0] * ls[i][1] >= g:
                n = math.ceil((g - s) / ls[i][0])
                count += n
                s += ls[i][0] * n
                break
    if s >= g:
        res = min(res, count)
print(res)

### FIXED CODE ###

import itertools
import math

d, g = map(int, input().split())
ls = [[100 * (i + 1)] + list(map(int, input().split())) for i in range(d)]
s0 = [a * p for a, p, _ in ls]
s1 = [a * p + c for a, p, c in ls]

res = float('inf')
for indices in itertools.permutations(range(d)):
    count = 0
    s = 0
    for i in indices:
        if s + s0[i] >= g:
            count += math.ceil((g - s) / (100 * (i + 1)))
            break
        else:
            count += ls[i][1]
            if count >= res:
                break
            s += s1[i]
            if s >= g:
                break
    res = min(res, count)
print(res)
x=int(input())
result = []

for i in range(2, x):
    sum = i
    while sum * i <= x:
        sum = sum * i
        result.append(sum)

print(sorted(result)[-1])


### FIXED CODE ###

x=int(input())
result = [1]

for i in range(2, x):
    sum = i
    while sum * i <= x:
        sum = sum * i
        result.append(sum)

print(sorted(result)[-1])
H,W,M=map(int,input().split())
bombh=[]
bombw=[]
bomb=[[0]*W for _ in range(H)]
w=[0]*W
h=[0]*H
for i in range(M):
    hs,ws=map(int,input().split())
    w[ws-1]+=1
    h[hs-1]+=1
    bomb[hs-1][ws-1]=1
for i in range(H):
    bombh.append([h[i],i])
for i in range(W):
    bombw.append([w[i],i])
bombh.sort(reverse=True)
bombw.sort(reverse=True)
maxh=bombh[0][0]
maxw=bombw[0][0]
ans=maxh+maxw-1
for i in range(H):
    if maxh!=bombh[i][0]:
        break
    a=bombh[i][1]
    for j in range(W):
        if maxw!=bombw[j][0]:
            break
        b=bombw[j][1]
        if bomb[a][b]==0:
            ans+=1
            break
    if bomb[a][b]==0:
        break
print(ans)

### FIXED CODE ###

H,W,M=map(int,input().split())
bombh=[]
bombw=[]
bomb=[]
w=[0]*W
h=[0]*H
for i in range(M):
    hs,ws=map(int,input().split())
    w[ws-1]+=1
    h[hs-1]+=1
    bomb.append([hs-1,ws-1])
maxh=max(h)
maxw=max(w)
ans=maxh+maxw
count=0
for i in range(M):
    if ans==h[bomb[i][0]]+w[bomb[i][1]]:
        count+=1
a=h.count(maxh)*w.count(maxw)
if a==count:
    ans-=1
print(ans)
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(M)]

K.sort()
K.sort(key=lambda x:x[1])
#B_C = list(map(list, zip(*K)))
A.sort()

ans = 0
changed = []
for i in K[::-1]:
    changed += [i[1]]*i[0]
    if len(changed) < N:
        continue
    else:
        while(len(changed) > N):
            changed.pop()
        break

#print(changed,A)
SUM = [sum(changed[:i+1] + A[i+1:]) for i in range(N-1)]
#print(SUM)
print(max(max(SUM), sum(A), sum(changed)))


### FIXED CODE ###

from operator import itemgetter
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(M)]
K.sort()
K.sort(key=itemgetter(1))
#B_C = list(map(list, zip(*K)))
A.sort()

changed = []
for i in K[::-1]:
    changed += [i[1]]*i[0]
    if len(changed) < N:
        continue
    else:
        while(len(changed) > N):
            changed.pop()
        break
if len(changed) < N:
    changed += [0]*(N-len(changed))
#print(changed.__len__(),A.__len__())
for i in range(N):
    if changed[i] <= A[i]:
        SUM = sum(changed[:i]) + sum(A[i:])
        print(SUM)
        exit()
else:
    print(sum(changed))
import sys
input = sys.stdin.readline

N,M =  list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
q = [tuple(map(int,input().split())) for i in range(M)]
q.sort(key= lambda x:-x[1])
#print(q)  

mask = []
for num,cost in q:
  mask += [cost]*num
  if A[len(mask)-1] >= cost:
    break
    
res = 0
for idx,cost in enumerate(mask):
  if cost > A[idx]:
    res += cost
  else:
    break
else:
  idx+=1
    
for i in range(idx,len(A)):
  #print(i)
  res += A[i]
  
print(res)
  

### FIXED CODE ###

import sys
input = sys.stdin.readline

N,M =  list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
q = [tuple(map(int,input().split())) for i in range(M)]
q.sort(key= lambda x:-x[1])
#print(q)  

mask = []
for num,cost in q:
  mask += [cost]*num
  
  if len(mask) >=N:
    break
  if A[len(mask)-1] >= cost:
    break
    
res = 0
for idx,cost in enumerate(mask):
  if idx >= N:
    break
  if cost > A[idx]:
    res += cost
  else:
    break
else:
  idx+=1
    
for i in range(idx,len(A)):
  #print(i)
  res += A[i]
  
print(res)
from math import gcd
n, m, S, T = open(0).read().split()
n, m = int(n), int(m)
l = n*m // gcd(n, m)
A = ['*'] * l
step = l//n
for i in range(n):
    A[i*step] = S[i]
step = l//m
for i in range(m):
    if A[i*step] == T[i] or A[i*step] == '*':
        A[i*step] = T[i]
    else:
        print(-1)
        break
else:
    print(l)

### FIXED CODE ###

from math import gcd
n, m, S, T = open(0).read().split()
n, m = int(n), int(m)
l = n*m // gcd(n, m)

d = {}
t = l//n
for i in range(n):
    d[i*t] = S[i]
t = l//m
for i in range(m):
    if i*t not in d or d[i*t] == T[i]:
        d[i*t] = T[i]
    else:
        print(-1)
        break
else:
    print(l)
S = input()
K = int(input())
flg = True
for i in range(K):
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')

### FIXED CODE ###

S = input()
K = int(input())
flg = True
for i in range(K):
    if len(S) <= i:
        break
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


import math

A, B, C = input_int()

migi = math.sqrt(C)

migi -=  math.sqrt(A)
migi -=  math.sqrt(B)



if 0 < migi:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

from decimal import *

getcontext().prec = 28      # デフォルト28桁のところを20桁にする


A, B, C = input_int()

A = Decimal(A).sqrt()
B = Decimal(B).sqrt()
C = Decimal(C).sqrt()



if (A+B) < C:
    print("Yes")
else:
    print("No")
K = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[K+1])

### FIXED CODE ###

K = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[K-1])
from collections import deque

def dfs1(now,visited,ans):
    visited[now]=True
    for nx in g[now]:
        if not visited[nx]:
            ans.appendleft(nx)
            dfs1(nx,visited,ans)
            break

def dfs2(now,visited,ans):
    visited[now]=True
    for nx in g[now]:
        if not visited[nx]:
            ans.append(nx)
            dfs2(nx,visited,ans)
            break

n,m=map(int,raw_input().split())
g=[[] for _ in xrange(n)]
for i in xrange(m):
    a,b=map(int,raw_input().split())
    a-=1;b-=1
    g[a].append(b)
    g[b].append(a)
ans=deque([a,b])
visited=[False]*n
visited[a]=True
visited[b]=True
dfs1(a,visited,ans)
dfs2(b,visited,ans)
print len(ans)
for i in xrange(len(ans)):
    print ans[i]+1,
print

### FIXED CODE ###

from collections import deque
from sys import setrecursionlimit
setrecursionlimit(10**6)

def dfs1(now,visited,ans):
    visited[now]=True
    for nx in g[now]:
        if not visited[nx]:
            ans.appendleft(nx)
            dfs1(nx,visited,ans)
            break

def dfs2(now,visited,ans):
    visited[now]=True
    for nx in g[now]:
        if not visited[nx]:
            ans.append(nx)
            dfs2(nx,visited,ans)
            break

n,m=map(int,raw_input().split())
g=[[] for _ in xrange(n)]
for i in xrange(m):
    a,b=map(int,raw_input().split())
    a-=1;b-=1
    g[a].append(b)
    g[b].append(a)
ans=deque([a,b])
visited=[False]*n
visited[a]=True
visited[b]=True
dfs1(a,visited,ans)
dfs2(b,visited,ans)
print len(ans)
for i in xrange(len(ans)):
    print ans[i]+1,
print
sum = 0
n = int(input())
l = [list(map(int, input().split()) for i in range(3))]

for i in range(n):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][i]
sum = sum + l[1][n]
print(sum)

### FIXED CODE ###

sum = 0
n = int(input())
l = [list(map(int, input().split())) for i in range(3)]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][l[0][i]-1]
sum = sum + l[1][n-1]
print(sum)
n, k = map(int, input().split())

print(sum(sorted(list(map(input(split()))), reverse = True)[0:k+1]))

### FIXED CODE ###

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

num = sorted(list(map(int, input().split())), reverse = True)

print(sum(num[:k]))
d=int(input())
if d=25:
  print('christmas')
    
elif d=24:
  print('Christmas Eve')

elif d=23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')
 

### FIXED CODE ###

d=int(input())
if d==25:
  print('Christmas') 
elif d==24:
  print('Christmas Eve')
elif d==23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')
A, B, C = map(int, input().split())
B = str(B)
print(ABC)

### FIXED CODE ###

A, B, C = map(str, input().split())
print(int(A)+int(C) if B=="+" else int(A)-int(C))
N=int(input())
dp=[0]*(N)
for i in range(1,N):
  dp[i] += dp[i-1]+i
print(dp[-1])

### FIXED CODE ###

N=int(input())-1
print(N*(N+1)//2)
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[v-1]=i+1
print(d)
  


### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[val-1]=i+1
print(*d)
n=int(input())
u,t=str(n),len(n)
if t<4:
  print(1000-n)
else:
  k,p=u[0],u[1]
  if p!=0:
    print((k+1)*1000-n)
  else:
    print(0)
  


### FIXED CODE ###

n=input()
t=len(n)
if t<4:
  print(1000-int(n))
else:
  k=int(n[0])
  if int(n)>k*10**(t-1):
    print((k+1)*1000-int(n))
  else:
    print(0)
r = int(input())

c = r * r *3.141592653589

a = ("{0:.6f}".format(c))

print((a),(a))

### FIXED CODE ###

import math
r = float(input())

c = r * r *math.pi
cf = r *2 *math.pi

a = ("{0:.5f} {1:.5f}".format(c,cf))

print(a)
def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if rate <= 399:
            return '灰色'
        elif rate <= 799:
            return '茶色'
        elif rate <= 1199:
            return '緑色'
        elif rate <= 1599:
            return '水色'
        elif rate <= 1999:
            return '青色'
        elif rate <= 2399:
            return '黄色'
        elif rate <= 2799:
            return '橙色'
        elif rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()

### FIXED CODE ###

def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if rate <= 399:
            return '灰色'
        elif rate <= 799:
            return '茶色'
        elif rate <= 1199:
            return '緑色'
        elif rate <= 1599:
            return '水色'
        elif rate <= 1999:
            return '青色'
        elif rate <= 2399:
            return '黄色'
        elif rate <= 2799:
            return '橙色'
        elif rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    if None in res: res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()
N, M = [int(i) for i in input().split(" ")]
conds = []
for _ in range(M):
    conds.append([int(i) for i in input().split(" ")])

exists = True
A = [None for _ in range(N)]
for s, c in conds:
    idx = s-1
    if A[idx] != None and A[idx] != c:
        exists = False
        break
    A[idx] = c


def check():
    if not exists:
        return [-1]

    if N == 1:
        if A[0] == None:
            return [0]
        else:
            return A
    else:
        if A[0] == 0:
            return [-1]

    for i in range(N):
        if A[i] == None:
            A[i] = -float("infinity")

    base = [1] + [0] * (N-1)
    res = []
    for i in range(N):
        res[i] = max(A[i], base[i])
    return res


print("".join(str(x) for x in check()))


### FIXED CODE ###

N, M = [int(i) for i in input().split(" ")]
conds = []
for _ in range(M):
    conds.append([int(i) for i in input().split(" ")])

exists = True
A = [None for _ in range(N)]
for s, c in conds:
    idx = s-1
    if A[idx] != None and A[idx] != c:
        exists = False
        break
    A[idx] = c


def check():
    if not exists:
        return [-1]

    if N == 1:
        if A[0] == None:
            return [0]
        else:
            return A
    else:
        if A[0] == 0:
            return [-1]

    for i in range(N):
        if A[i] == None:
            A[i] = -float("infinity")

    base = [1] + [0] * (N-1)
    res = []
    for i in range(N):
        res.append(max(A[i], base[i]))
    return res


print("".join(str(x) for x in check()))
s = input()
s = s.sort()
t = input()
t = t.sort(reverse=True)
if s<t:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = list(input())
t = list(input())
if s==t:
    print('No')
    exit()

s = sorted(s)
s = ''.join(s)
t = sorted(t, reverse=1)
t = ''.join(t)
l = [s,t]
k = sorted(l)
if l==k:
    print('Yes')
else:
    print('No')