Harryxun/stf_run huggingface dataset:
from itertools import accumulate
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
acc = list(accumulate(a))

def maxsum(ls,k):
  l = len(ls)
  if l==0:
    return 0
  dp = [0 for i in range(l+1)]
  dp[0] = 1
  for i in range(1,l+1):
    dp[i] = dp[i-1]|(dp[i-1]<<ls[i-1])
  for b in range(k-1,-1,-1):
    if dp[l] & 1<<b:
      return b

for i in range(n):
  if a[i]>=k:
    a = a[:i]
    break
n = len(a)
if acc[n-1] < k:
  print(n)
  exit()
sepa=[]
for i in range(n-1):
  if acc[i]<a[i+1]:
    sepa.append(i)
m=len(sepa)
if m==0:
  print(0)
  exit()
lf = 0
r = m-1
while lf<r:
  mid = (lf+r)//2
  x=sepa[mid]
  sumx = acc[x]
  if maxsum(a[x+1:],k)+sumx >= k:
    r = mid
  else:
    lf = mid+1
if r==0:
  t=sepa[0]
  if maxsum(a[t+1],k)+acc[t]>=k:
    print(0)
  else:
    print(sepa[r]+1)
else:
  print(sepa[r]+1)

### FIXED CODE ###

from itertools import accumulate
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
acc = list(accumulate(a))

def maxsum(ls,k):
  l = len(ls)
  if l==0:
    return 0
  dp = [0 for i in range(l+1)]
  dp[0] = 1
  for i in range(1,l+1):
    dp[i] = (dp[i-1]|(dp[i-1]<<ls[i-1]))&((1<<k)-1)
  for b in range(k-1,-1,-1):
    if dp[l] & 1<<b:
      return b

for i in range(n):
  if a[i]>=k:
    a = a[:i]
    break
n = len(a)
if acc[n-1] < k:
  print(n)
  exit()
sepa=[]
for i in range(n-1):
  if acc[i]<a[i+1]:
    sepa.append(i)
m=len(sepa)
if m==0:
  print(0)
  exit()
lf = 0
r = m-1
while lf<r:
  mid = (lf+r)//2
  x=sepa[mid]
  sumx = acc[x]
  if maxsum(a[x+1:],k)+sumx >= k:
    r = mid
  else:
    lf = mid+1
if r==0:
  t=sepa[0]
  if maxsum(a[t+1:],k)+acc[t]>=k:
    print(0)
  else:
    print(sepa[r]+1)
else:
  print(sepa[r]+1)
N, K = map(int,input().split()) 
P = list(map(int,input().split()))
max_size = 0
expectsum = 0
for i in range(N-K):
    if P[i]>=P[i+K]:
        pass 
    else:
        sum_3 = sum(P[i+1:i+K+1])
        if sum_3 >= max_size:
            max_size = sum_3
            expect = 0
            for j in range(K):
                expect += (P[i+1+j]+1)/2
                if expect > expectsum:
                    expectsum = expect
print(expect)

### FIXED CODE ###

def expect(n):
    return (int(n)+1)/2
N, K = map(int,input().split()) 
P = list(map(expect,input().split()))
sumlist = [sum(P[0:K])]
sumnumber = sum(P[0:K])
for i in range(N-K):
    sumnumber -=P[i]
    sumnumber +=P[i+K]
    sumlist.append(sumnumber)
print(max(sumlist))
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    if index == n:
        break
    for j in range(info[i][0]):
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    if index == n:
        break
    for j in range(info[i][0]):
        if index == n:
            break
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)
N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()

E = []
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])

tree = [set() for _ in range(N)]
visited = [False] * N
root = E[0][0]
visited[root] = True
queue = [root]
D = [0] * N
for i, j in E:
  if visited[j]:
    D[i] += 1
    print(i+1, j+1)
  else:
    tree[i].add(j)

def f(tree, i):
  if tree[i] == set():
    return
  for j in tree[i]:
    f(tree, j)
    if D[i] % 2 == 0:
      D[j] += 1
      print(j+1, i+1)
    else:
      D[i] += 1
      print(i+1, j+1)
  return

f(tree, root)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()
  
E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)
#coding: utf-8
S = list(input())
enki = ["A", "T", "G", "C"]
cnt = 0
index = 0
a = []
ans = ""
for i in range(len(S)):
    if S[i] in enki:
        ans += S[i]
        a.append(ans)
    else:
        ans = ""
print(len(max(a)))

### FIXED CODE ###

#coding: utf-8
S = input()
enki = ["A", "T", "G", "C"]
a = []
ans = ""
max_ = 0
for i in range(len(S)):
    if S[i] in enki:
        ans += S[i]
    else:
        ans = ""
    a.append(ans)
    max_ = max(max_, len(ans))
print(max_)
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
    break
if x > y:
    print(y, x)
else:
    print(x, y)


### FIXED CODE ###

while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:break
    if x > y:
       print(y, x)
    else:
       print(x, y)
N, C = map(int, input().split())
r = [[0 for _ in range(C)] for _ in range(10 * 5)]

for _ in range(N):
    s, t, c = map(int, input().split())
    for i in range(s - 1, t):
        r[i][c - 1] = 1
ans = 0
for t in r:
    sum_t = sum(t)
    if sum_t > ans:
        ans = sum_t

print(ans)

### FIXED CODE ###

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

r = [[0 for i in range(c)] for j in range(100000)]  # テレビ局の番組表
for dummy in range(n):  # 入力
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1  # 放送中なら1

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i])  # 同時に放送されている番組の最大数

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

if (B-A+1) < K:
    for i in range(A, B+1):
        print(i)
    exit()

lst = list(range(A, B+1))
lst.sort()

x = [lst[i] for i in range(0, K)]
y = [lst[i] for i in range(-1, -K-1, -1)]

ans = list(set(x) | set(y))
ans.sort()

for i in ans:
    print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
for i in range(a, min(b, a + k - 1) + 1):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)
n = int(input())
if n%2 = 0:
	print(n/2)
else:
    print(n//2+1)

### FIXED CODE ###

n = int(input())
if n%2 == 0:
	print(n//2)
else:
    print(n//2+1)
#n=list(map(int,input().split()))
n = int(input()) 
#num = [input() for i in range(n)] 
a=[0]*n    
ama=list(map(int,input().split()))

for i in reversed(ama):
    if sum(a[n-1::n])%2==i:
        next
    else:
        a[n-1]=(a[n-1]+1)%2
    n=n-1


print(sum(a))
print(" ".join([i for i, x in enumerate(a) if x == 1]))
#for i in range(n):
#    print(max(num[:i]+num[i+1:]))

### FIXED CODE ###

#n=list(map(int,input().split()))
n = int(input()) 
#num = [input() for i in range(n)] 
a=[0]*n    
ama=list(map(int,input().split()))

for i in reversed(ama):
    if sum(a[n-1::n])%2==i:
        next
    else:
        a[n-1]=(a[n-1]+1)%2
    n=n-1


print(sum(a))
print(" ".join(list(map(str,list(map(lambda x: x+1, [i for i, x in enumerate(a) if x == 1]))))))


#for i in range(n):
#    print(max(num[:i]+num[i+1:]))
def is_prime(x):
    if x < 2: return False
    if x == 2 or x == 3 or x == 5: return True 
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False

    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True

def prime_factorization(n):
  d = 2
  cnt = 0
  seen = []
  while d*d <= n:
    if n%d == 0:
      t = 1
      while d**t <= n:
        if n % (d**t) == 0:
          seen.append(d**t)
          n //= (d**t)
          cnt += 1
          t += 1
        else:
          break
    d += 1
 
  if n != 1 and is_prime(n):
    cnt += 1
 
  return cnt
 
n = int(input())
print(prime_factorization(n))


### FIXED CODE ###

import math
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(math.sqrt(n))+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

n = int(input())
factors = factorization(n)
res = 0
for j,cnt in factors:
  if j == 1: continue
  i = 1
  while cnt >= i:
    cnt -= i
    i += 1
    res += 1

print(res)
A = list(input().split())
a = A[1] * 10 + A[2]
if a % 4 == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A = list(map(int, input().split()))
a = A[1] * 10 + A[2]
if a % 4 == 0:
  print("YES")
else:
  print("NO")
s = list(input())
k = int(input())
S = s
cnt = 0
cnt_2 = 0
flow = 0
flow_2 = 0


for i in range(len(s)):
    if s[flow] == s[flow+1]:
        cnt += 1
        flow += 2
    else:
        flow += 1

    if flow >= len(s)-2:
        break
# --------------------------

for i in range(len(s)):
    S.append(s[i])

for i in range(len(S)):
    if S[flow_2] == S[flow_2+1]:
        cnt_2 += 1
        flow_2 += 2
    else:
        flow_2 += 1

    if flow_2 >= len(S)-2:
        break

if k == 1:
    print(cnt)
else:
    print(cnt + (cnt_2 - cnt) * (k-1))


### FIXED CODE ###

s = list(input())
k = int(input())
S = s.copy()
S_3 =s.copy()
cnt = 0
cnt_2 = 0
cnt_3 = 0


for i in range(1, len(s)):
    if s[i-1] == s[i]:
        cnt += 1
        s[i] = "A"

# --------------------------

for i in range(len(s)):
    S.append(S[i])

for i in range(1, len(S)):
    if S[i-1] == S[i]:
        cnt_2 += 1
        S[i] = "A"

# if k == 1:
#     print(cnt)
# else:
#     print(cnt + (cnt_2 - cnt) * (k-1))

# ---------------------------------------

for i in range(len(S)):
    S_3.append(S_3[i])

for i in range(1, len(S_3)):
    if S_3[i-1] == S_3[i]:
        cnt_3 += 1
        S_3[i] = "A"

# --------------------------------------

if k == 1:
    print(cnt)
elif k == 2:
    print(cnt_2)
elif k == 3:
    print(cnt_3)
elif cnt_2 - cnt == cnt_3 - cnt_2:
    print(cnt + (cnt_2 - cnt) * (k-1))
else:
    if k % 2 == 0:
        print(int(cnt + (cnt_2 - cnt) * (k / 2) + (cnt_3 - cnt_2) * (k / 2 - 1)))
    else:
        print(int(cnt + (cnt_2 - cnt) * ((k - 1) / 2) + (cnt_3 - cnt_2) * ((k - 1) / 2)))
L, N = list(map(int, input().split()))
S = []
for i in range(N):
    s = input()
    S.append(s)
S.sort()
ans = "";
for j in S:
    ans += j
print(ans)


### FIXED CODE ###

n,l = map(int,input().split())
A = [input() for _ in range(n)]
A.sort()
ans = ''
for i in range(n):
    ans += A[i]
 
print(ans)
arr=[]
numbero=list(map(int, input().split()))
for i in range(numbero[0]):
    arr.append(input())
way=[[False for i in range(numbero[1])] for j in range(numbero[0])]
def waycon(i,j):
    way[i][j]=True
    if i>0:
        if not way[i-1][j] and arr[i-1][j]=='.':
            waycon(i-1,j)
    if j>0:
        if not way[i][j-1] and arr[i][j-1]=='.':
            waycon(i,j-1)
    if i<numbero[0]-1:
        if not way[i+1][j] and arr[i+1][j]=='.':
            waycon(i+1,j)
    if j<numbero[1]-1:
        if not way[i][j+1] and arr[i][j+1]=='.':
            waycon(i,j+1)
waycon(0,0)
if not way[numbero[0]-1][numbero[1]-1]:
    print(-1)
else:
    

### FIXED CODE ###

arr=[]
numbero=list(map(int, input().split()))
for i in range(numbero[0]):
    arr.append(input())
way=[[0 for i in range(numbero[1])] for j in range(numbero[0])]
way[0][0]=1
head=0
whoop=[[0,0]]
while head<len(whoop):
    u=whoop[head][0]
    v=whoop[head][1]
    head+=1
    if u>0:
        if way[u-1][v]==0 and arr[u-1][v]=='.':
            way[u-1][v]=way[u][v]+1
            whoop.append([u-1,v])
    if v>0:
        if way[u][v-1]==0 and arr[u][v-1]=='.':
            way[u][v-1]=way[u][v]+1
            whoop.append([u,v-1])
    if u<numbero[0]-1:
        if way[u+1][v]==0 and arr[u+1][v]=='.':
            way[u+1][v]=way[u][v]+1
            whoop.append([u+1,v])
    if v<numbero[1]-1:
        if way[u][v+1]==0 and arr[u][v+1]=='.':
            way[u][v+1]=way[u][v]+1
            whoop.append([u,v+1])
if way[numbero[0]-1][numbero[1]-1]==0:
    print(-1)
else:
    head=0
    for i in arr:
        head+=i.count('.')
    print(head-way[numbero[0]-1][numbero[1]-1])
ans=10**8
h,w,K=map(int,input().split())
s=[]
import copy
def two(x):
	return "0"*(h-1-len(bin(x)[2:]))+bin(x)[2:]
for i in range(h):
	s.append(input())
for i in range(2**(h-1)):
	r=two(i)
	pre_ans=r.count("1")
	d=[0]*(pre_ans+1)
	cnt=0
	for j in range(w):
		now=0
		for k in range(h):
			if s[k][j]=="1":
				d[now]+=1
			if k!=h-1:
				if r[k]=="1":
					now+=1
		if max(d)>K:
			e=[]
			for x in range(len(d)):
				e.append(d[x]-dd[x])
			d=copy.copy(e)
			cnt+=1
	# 	if max(d)>K:
	# 		cnt=10**7
	# 	dd=copy.copy(d)
	# pre_ans+=cnt
	# ans=min(ans,pre_ans)
print(ans)

### FIXED CODE ###

ans=10**8
h,w,K=map(int,input().split())
s=[]
import copy
def two(x):
	return "0"*(h-1-len(bin(x)[2:]))+bin(x)[2:]
for i in range(h):
	s.append(input())
for i in range(2**(h-1)):
	r=two(i)
	pre_ans=r.count("1")
	d=[0]*(pre_ans+1)
	dd=copy.copy(d)
	cnt=0
	for j in range(w):
		now=0
		for k in range(h):
			if s[k][j]=="1":
				d[now]+=1
			if k!=h-1:
				if r[k]=="1":
					now+=1
		if max(d)>K:
			e=[]
			for x in range(len(d)):
				e.append(d[x]-dd[x])
			d=copy.copy(e)
			cnt+=1
		if max(d)>K:
			cnt=10**7
		dd=copy.copy(d)
	pre_ans+=cnt
	ans=min(ans,pre_ans)
print(ans)
n = int(input())
s = list(input().split() for _ in range(n))
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -int(x[1])))]
print(i) for i in ans


### FIXED CODE ###

n = int(input())
s = list(list(input().split()) for _ in range(n))
ans = [s.index(i)+1 for i in sorted(s, key=lambda x:(x[0], -int(x[1])))]
for i in ans: print(i)
a,b=map(int,input().split())
if (a+b)%2==1:
  print("IMIMPOSSIBLE")
else:
  print(a+b)//2

### FIXED CODE ###

a,b=map(int, input().split())
if (a+b)%2==1:
  print("IMPOSSIBLE")
else:
  print((a+b)//2)
N, M = map(int, input().split())
if N-M == 0:
  print("Yes")
 else:
  print("No")

### FIXED CODE ###

from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

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

if N-M == 0:
    print("Yes")
else:
    print("No")
#整数Nを得る
N, K = map(int,input().split())
mod = 10**9 +7

for i in range(1,K+1):
    Ans = 1
    a = N - K + 1
    for j in range(1, i +1):
        Ans = Ans * a / j
        a = a-1
    c = 1
    for j in range(1,i):

        c = c * (K - j)/j
    
    Ans = int(Ans * c)
    Ans = Ans % mod
    print(Ans)


### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


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

for i in range(1, K+1):
    if i > R+1:
        print(0)
    else:
        ans = cmb(R+1, i, mod) * cmb(K-1, i-1, mod) % mod
        print(ans)
import heapq

n, m = map(int,input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))

heapq.heapify(A)

for i in range(m):
    a = heap.heappop(A)
    heapq.heappush(A,-1* (-a//2))
print(-sum(a))

### FIXED CODE ###

s = input()

if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
elif s == "Rainy":
  print("Sunny")
def main():
    n, m, k = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    B = [int(e) for e in input().split()]

    t = 0
    ca, cb = 0, 0
    for a in A:
        t += a
        if t > k:
            t -= a
            break

        ca += 1

    while True:
        t += B[cb]
        cb += 1

        if t > k:
            cb -= 1
            t -= B[cb]
            break

        if cb == len(B):
            break

    AA = [ca + cb]
    while True:
        if ca == 0 or cb == len(B):
            break

        ca -= 1
        t -= A[ca]
        while True:
            t += B[cb]
            if t > k or cb == len(B):
                break

            cb += 1

        AA.append(ca + cb)

    print(max(AA))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, m, k = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    B = [int(e) for e in input().split()]

    AS = [0]
    for i in range(n):
        AS.append(AS[i] + A[i])

    BS = [0]
    for i in range(m):
        BS.append(BS[i] + B[i])

    ans = 0
    bi = 0
    for ai in range(n, -1, -1):
        if bi == m + 1:
            break

        if AS[ai] > k:
            continue

        while bi < m + 1 and AS[ai] + BS[bi] <= k:
            bi += 1

        ans = max(ai + bi - 1, ans)

    print(ans)


if __name__ == '__main__':
    main()
a,b = map(int, input().split())
print(max(a+b,max(a-b,a*b))

### FIXED CODE ###

a,b = map(int, input().split())
print(max(a+b,max(a-b,a*b)))
WeatherToady = input()
if WeatherToday == "Sunny":
  return("Cloudy")
elif WeatherToday == "Cloudy":
  return("Rainy")
else:
  return("Sunny")

### FIXED CODE ###

WeatherToday = input()
if WeatherToday == "Sunny":
  print("Cloudy")
elif WeatherToday == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
while True :
s= raw_input
a, op, b = s.split()
if op == ? : break
print eval(s)


### FIXED CODE ###

while True:
  s = raw_input()
  a, op, b = s.split()
  if op == '?': break
  print eval(s)
print(7 - ['SUN', 'MUN', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))

### FIXED CODE ###

print(7 - ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))
def euclidean(a,b):
    _ = a % b
    while 1:
        if b % _ == 0:
            break
        else:
            _ = b % _
    return _

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

a = max(A, B)
b = min(A, B)
e = euclidean(a,b)

by = []
r = int(e ** (1 / 2))
for i in range(1, r + 1):
    if e % i == 0:
        by.append(i)
        j = e // i
        if j != i:
            by.append(j)
by.sort()
print(by[K - 1])

### FIXED CODE ###

def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
  
A, B, K = map(int, input().split())
 
a = max(A, B)
b = min(A, B)
e = euclidean(a, b)
by = []
r = int(e ** (1 / 2))
 
for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j)
by.sort(reverse = True)
print(by[K - 1])
import sys
n=input()
w=input()
l=[]
l.append(w)
for i in range(1,n):
    w=input()
    if w[0]!=l[-1][-1] or w in l:
        print("No")
        sys.exit()
    else:
        l.append(w)
print("Yes")

### FIXED CODE ###

import sys
n=int(input())
w=input()
l=[]
l.append(w)
for i in range(1,n):
    w=input()
    if w[0]!=l[-1][-1] or w in l:
        print("No")
        sys.exit()
    else:
        l.append(w)
print("Yes")
for i in range(n):
    if a[i] < 400:
        mapa[1] += 1
    elif a[i] < 800:
        mapa[2] += 1
    elif a[i] < 1200:
        mapa[3] += 1
    elif a[i] < 1600:
        mapa[4] += 1
    elif a[i] < 2000:
        mapa[5] += 1
    elif a[i] < 2400:
        mapa[6] += 1
    elif a[i] < 2800:
        mapa[7] += 1
    elif a[i] < 3200:
        mapa[8] += 1
    else:
        el += 1
count = 0
for i in mapa:
    if mapa[i] > 0:
        count += 1
if count > 0:
    print(str(count) + ' ' + str(count + el))
else:
    print('1 ' + str(el))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
mapa = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}
el = 0
for i in range(n):
    if a[i] < 400:
        mapa[1] += 1
    elif a[i] < 800:
        mapa[2] += 1
    elif a[i] < 1200:
        mapa[3] += 1
    elif a[i] < 1600:
        mapa[4] += 1
    elif a[i] < 2000:
        mapa[5] += 1
    elif a[i] < 2400:
        mapa[6] += 1
    elif a[i] < 2800:
        mapa[7] += 1
    elif a[i] < 3200:
        mapa[8] += 1
    else:
        el += 1
count = 0
for i in mapa:
    if mapa[i] > 0:
        count += 1
if count > 0:
    print(str(count) + ' ' + str(count + el))
else:
    print('1 ' + str(el))
s_d = [i for i in input()]
t = input()
flg = True

for i in range(len(s_d)-1, -1, -1):
    if len(s_d) - i >= len(t) and s_d[i] == '?' or s_d[i] == t[0]:
        j, n = i+1, 1
        while s_d[j] == '?' or s_d[j] == t[n]:
            j += 1
            n += 1
            if j > len(s_d) - 1:
                break

        if n >= len(t):
            s_d[i:j] = t
            break
else:
    print("UNRESTORABLE")
    flg = False

if flg:
    for i in range(len(s_d)):
        if s_d[i] == '?':
            s_d[i] = 'a'

    print("".join(s_d))


### FIXED CODE ###

s_d = [i for i in input()]
t = input()
flg = True

for i in range(len(s_d)-1, -1, -1):
    if len(s_d) - i >= len(t) and s_d[i] == '?' or s_d[i] == t[0]:
        j, n = i+1, 1
        while j <= len(s_d) - 1 and n <= len(t) - 1:
            if s_d[j] == '?' or s_d[j] == t[n]:
                j += 1
                n += 1
            else:
                break

        if n >= len(t):
            s_d[i:i+len(t)] = t
            break
else:
    print("UNRESTORABLE")
    flg = False

if flg:
    for i in range(len(s_d)):
        if s_d[i] == '?':
            s_d[i] = 'a'

    print("".join(s_d))
n,W=map(int,input().split())
w=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
V=sum(v)+1
dp=[10**10 for i in range(sum(v)+1)]
dp[0]=0
for i in range(n):
    for j in range(V,-1,-1):
        if dp[j]!=10**10:
            dp[j+v[i]]=min(dp[j+v[i]],dp[j]+w[j])
for i in range(V,-1,-1):
    if dp[i]<=W:
        print(i)
        exit()

### FIXED CODE ###

n,W=map(int,input().split())
w=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
V=sum(v)+1
dp=[10**10 for i in range(sum(v)+1)]
dp[0]=0
for i in range(n):
    for j in range(V-1,-1,-1):
        if dp[j]!=10**10:
            dp[j+v[i]]=min(dp[j+v[i]],dp[j]+w[i])
for i in range(V-1,-1,-1):
    if dp[i]<=W:
        print(i)
        exit()
N = int(input())
A = list(map(int, input().split()))
count = 0
target = A[1]
for i in range(N - 1):
    if target == A[i] or target - 1 == A[i] or target + 1 == A[i]:
        count += 1

print(count)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
ans = 0
count = {}
for i in range(0, 10**5+1):
  count[i] = 0

for i in l:
  count[i] = count[i] + 1

for i in range(0, 10**5+1):
  if i == 0:
    temp = count[i] + count[i+1]
  elif i == 10**5:
    temp = count[i] + count[i-1]
  else:
    temp = count[i] + count[i+1] + count[i-1]

  if temp > ans:
    ans = temp

print(ans)
H,A=,map(int,input().split())

n=(H//A)+1
print(n)

### FIXED CODE ###

H,A=map(int,input().split())
 
n=(H//A)+1
 
if H%A==0:
  n=H//A
else:
  n=(H//A)+1
print(n)
c1 = list(map(str,input().split()))
c2 = list(map(str,input().split()))
c3 = list(map(str,input().split()))
d = (c1[0],c2[1],c3[2])
print("".join(d))

### FIXED CODE ###

c1 = list(input())
c2 = list(input())
c3 = list(input())
d = (c1[0],c2[1],c3[2])
print("".join(d))
year = int(input())
if year == 3 or year == 5 or year == 7:
  print(YES)
else:
  print(NO)

### FIXED CODE ###

year = int(input())
if year == 3 or year == 5 or year == 7:
  print('YES')
else:
  print('NO')
N,S = int(input()),input()
ans = ""
abc = "ABCDEFGHIGKLMNOPQRSTUVWXYZ"
for i in S:
  ans += abc[(abc.index(i)+N)%26]
print(ans)

### FIXED CODE ###

N = int(input())
 
T = [chr((ord(s)-65 + N)%26 + 65) for s in input()]
 
print("".join(T))