Harryxun/stf_run huggingface dataset:
import numpy as np

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

p=np.sum(A>0)
q=np.sum(A<0)
Z=N-p-q
AP=A[-p:]
if q>0:
  AN=A[:q]

b=(N-Z)*Z+Z*(Z-1)//2
a=p*q

if K<=a:
  x=AP[-1]*AN[0]
  y=AP[0]*AN[-1]
  while y-x>1:
    tmp=(y+x)//2
    counter=np.searchsorted(AN, tmp/AP, side='right').sum()
    if counter<K:
      x=tmp
    else:
      y=tmp
  print(y)
elif K<=a+b:
  print(0)
else:
  K=K-a-b
  x=1
  y=10**18
  AN*=-1
  AN=AN[::-1]
  while y-x>1:
    tmp=(y+x)//2
    counter1=(np.searchsorted(AP, tmp/AP, side='right').sum()-np.searchsorted(AP, tmp**(1/2), side='right'))/2
    counter2=(np.searchsorted(AN, tmp/AN, side='right').sum()-np.searchsorted(AN, tmp**(1/2), side='right'))/2
    counter=counter1+counter2
    if counter<K:
      x=tmp
    else:
      y=tmp
  print(y)

### FIXED CODE ###

import numpy as np

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

p=np.sum(A>0)
q=np.sum(A<0)
Z=N-p-q
if p>0:
  AP=A[-p:]
else:
  AP=[]
if q>0:
  AN=A[:q]
else:
  AN=[]

b=(N-Z)*Z+Z*(Z-1)//2
a=p*q

if K<=a:
  x=AP[-1]*AN[0]-1
  y=AP[0]*AN[-1]
  while y-x>1:
    tmp=(y+x)//2
    counter=np.searchsorted(AN, tmp//AP, side='right').sum()
    if counter<K:
      x=tmp
    else:
      y=tmp
  print(y)
elif K<=a+b:
  print(0)
else:
  x=0
  y=10**18
  K=K-a-b
  if q<=1:
    while y-x>1:
      tmp=(y+x)//2
      counter=(np.searchsorted(AP, tmp//AP, side='right').sum()-np.searchsorted(AP, int(pow(tmp, 1/2)), side='right'))//2
      if counter<K:
        x=tmp
      else:
        y=tmp
    print(y)
    exit()
    
  AN=AN[::-1]
  AN=-AN
  
  if p<=1:
    while y-x>1:
      tmp=(y+x)//2
      counter=(np.searchsorted(AN, tmp//AN, side='right').sum()-np.searchsorted(AN, int(pow(tmp, 1/2)), side='right'))//2
      if counter<K:
        x=tmp
      else:
        y=tmp
    print(y)
    exit()
    
  while y-x>1:
    tmp=(y+x)//2
    counter1=(np.searchsorted(AP, tmp//AP, side='right').sum()-np.searchsorted(AP, int(pow(tmp, 1/2)), side='right'))//2
    counter2=(np.searchsorted(AN, tmp//AN, side='right').sum()-np.searchsorted(AN, int(pow(tmp, 1/2)), side='right'))//2
    counter=counter1+counter2
    if counter<K:
      x=tmp
    else:
      y=tmp
  print(y)
from collections import deque
def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    B = [(i, j) for i, a in enumerate(A) for j, b in enumerate(a) if b == '#']
    dxy = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    stack = deque(B)
    colored = len(B)
    tot = h * w
    count = 0
    while colored < tot:
        next = deque([])
        while stack:
            y, x = stack.popleft()
            for dx, dy in dxy:
                X = x + dx
                Y = y + dy
                if X < 0 or X >= w or Y < 0 or Y >= h:
                    continue
                if A[X][Y] == '.':
                    next.append((X, Y))
                    A[X][Y] = '#'
        stack = next
        count += 1
        colored += len(next)
    print(count)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque
def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    B = [(i, j) for i, a in enumerate(A) for j, b in enumerate(a) if b == '#']
    dxy = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    stack = deque(B)
    colored = len(B)
    tot = h * w
    count = 0
    while colored < tot:
        next = deque([])
        while stack:
            y, x = stack.popleft()
            for dx, dy in dxy:
                X = x + dx
                Y = y + dy
                if X < 0 or X >= w or Y < 0 or Y >= h:
                    continue
                if A[Y][X] == '.':
                    next.append((Y, X))
                    A[Y][X] = '#'
        stack = next
        count += 1
        colored += len(next)
    print(count)

if __name__ == '__main__':
    main()
imporrt itertools
N,M,Q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
  ta,tb,tc,td=map(int,input().split())
  a+=[ta]
  b+=[tb]
  c+=[tc]
  d+=[td]
maxs=0
A=[0 for i in range(N)]
for i in itertools.combination_with_replacement(A,N):
  s=0
  for k in range(Q):
    if i[b[k]-1]-i[a[k]-1]==c[k]:
      s+=d[k]
  maxs=max(maxs,s)
      
print(maxs)


### FIXED CODE ###

N,M,Q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
  ta,tb,tc,td=map(int,input().split())
  a+=[ta]
  b+=[tb]
  c+=[tc]
  d+=[td]
maxs=0
A=[0 for i in range(10)]
for i in range(M):
  for j in range(i,M):
    for k in range(j,M):
      for l in range(k,M):
        for m in range(l,M):
          for n in range(m,M):
            for o in range(n,M):
              for p in range(o,M):
                for q in range(p,M):
                  for r in range(q,M):
                    A[0]=i
                    A[1]=j
                    A[2]=k
                    A[3]=l
                    A[4]=m
                    A[5]=n
                    A[6]=o
                    A[7]=p
                    A[8]=q
                    A[9]=r
                    su=0
                    for z in range(Q):
                      if A[b[z]-1]-A[a[z]-1]==c[z]:
                        su+=d[z]
                    if su>maxs:
                      maxs=su
print(maxs)
def combi(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
def b(k,i):
  if(i==k-1):
    return 1
  else:
    return combi(k-1,i)

def r(n,k,i,j):
  if(n-k-1<=0):
    return r(n,k,i,j+1)
  else:
    return combi(n-k+1,i+1)
  
def main():
  n,k = map(int,input().split())	
  
  for i in range(k):
    j=0
    ans=b(k,i)*r(n,k,i,j)%(1000000000+7)
    print(ans)
  

import sys
input = sys.stdin.readline
import math  
main()

### FIXED CODE ###

from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n,k = map(int,input().split())
    dp = [[0 for _ in range(k+1)] for _ in range(k+1)]
    dp[0][0] = 1
    for i in range(1,k+1):
        for j in range(1,i+1):
            dp[i][j] = (dp[i-1][j]*(i+j-1)+dp[i-1][j-1]*(n-k-j+2))//i
    for i in range(1,k+1):
        print(dp[-1][i]%mod)

if __name__ == "__main__":
    main()
import math
A, B = map(int, input().split())
print(A * B / (math.gcd(A,B)))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print (int(A * B // (fractions.gcd(A,B))))
from sys import stdin
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D_lcm = lcm(C, D)

    z = B//C_D_lcm - A//C_D_lcm

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy.sort()
deff_xy = []
memo = {}
for i in range(N-1):
    x = str(xy[i+1][0]-xy[i][0])
    y = str(xy[i+1][1]-xy[i][1])
    deff_xy = ('').join([x, y])
    if deff_xy in memo:
        memo[deff_xy] += 1
    else:
        memo[deff_xy] = 1
print(N-max(memo.values()))

### FIXED CODE ###

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
x, y = [], []
for i, j in xy:
    x += [i]
    y += [j]
ans = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = x[j] - x[i]
        q = y[j] - y[i]
        c = 0
        for k in range(N):
            for l in range(N):
                if k == l:
                    continue
                if (x[k] - x[l]) == p and (y[k] - y[l]) == q:
                    c += 1
        ans = max(ans, c)
if N != 1:
    print(N-ans)
else:
    print('1')
N, A, B = map(int, input().split(" "))


balls = ''
for i in range(2*N):
    balls += 'b'*A + 'r'*B
balls = balls[0:N]
print(balls.count('b'))

### FIXED CODE ###

def main():
    N, A, B = map(int, input().split(" "))
    if (A + B) == 0:
        print(0)
        return
    amari = N % (A+B)
    kaisuu = N // (A+B)
    print(kaisuu*A+min(amari, A))
main()
input = sys.stdin.readline
n, k = map(int,input().split())

lst = [[int(i) for i in input().split()] for _ in range(n)]

lst.sort(key = lambda x: x[0])

for [i, j] in lst:
    if j >= k:
        print(i)
        quit()
    else:
        k -= j

### FIXED CODE ###

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

lst = [[int(i) for i in input().split()] for _ in range(n)]

lst.sort(key = lambda x: x[0])

for [i, j] in lst:
    if j >= k:
        print(i)
        quit()
    else:
        k -= j
a,b,c=input().split();print('NYOE S'[a[-1]==b[0]and b[-1]==c[0]]::2)

### FIXED CODE ###

a,b,c=input().split();print('NYOE S'[a[-1]==b[0]and b[-1]==c[0]::2])
N=int(input())
S=input()
count=0
if N%2!=0:
  print("No")
else:
  for i in range(len(S)/2):
    if S[i]!=S[len(S)/2+i]:
      print("No")
      break
    count+=1
  if count=len(S)/2:
    print("Yes")

### FIXED CODE ###

N=int(input())
S=input()
if N%2!=0:
  print("No")
else:
  half=N//2-1
  T1=[]
  T2=[]
  for i in range(half+1):
    T1.append(S[i])
  for j in range(half+1,len(S)):
    T2.append(S[j])
  if T1==T2:
      print("Yes")
  else:
      print("No")
N, M = map( int, input().split())
A = list( map( int, input().split()))
C = [0,2,5,5,4,5,6,3,7,6]
dp = [(0,0)]*(N+1)
for a in A:
    dp[C[a]] = (1,0)
Z = sorted(list( set( [ C[a] for a in A])))
for i in range(2,N+1):
    for z in Z:
        if i >= z:
            if dp[i-z][0] == 1:
                dp[i] = (1, i-z)
                break
b = 1
s = N
ANS = [0]*10
while b != 0:
    a, b = dp[s]
    ANS[s-b] += 1
    s = b
ans = ""
for i in range(9,0,-1):
    if ANS[C[i]] > 0:
        if i in A:
            ans += str(i)*ANS[C[i]]
            ANS[C[i]] = 0
print( ans)

### FIXED CODE ###

N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*10
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    if x <= N:
        dp[x] = 1
for i in range(1,N):
    t = dp[i]
    for x in Check:
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for a in A:
        x = Needs[a]
        if t-x>=0:
            if dp[t-x]+1 == dp[t]:
                W[V[x]] += 1
                t -= x
                break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)
n = int(input())
s = input()
l = []
b = 0
w = s.count(".")
for i in range(n):
    if s[i] == "#":
        b += 1
    elif s[i] == ".":
        w -= 1
        l.append(b + w)
print(min(l))

### FIXED CODE ###

n = int(input())
s = input()
b = 0
w = s.count(".")
l = [w]
for i in range(1, n + 1):
    if s[i - 1] == "#":
        b += 1
    if s[i - 1] == ".":
        w -= 1
    l.append(b + w)
print(min(l))
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]

def calc_score(day, contest, last):
  t_last = last[:]
  t_last[contest] = day + 1

  contest_score = s[day][contest]
  score = contest_score

  dis = 0
  for i in range(26):
    dis += c[i] * ((day + 1) - t_last[i])
  score -= dis

  return score

score = 0
last = [0 for i in range(26)]

for day in range(d):
  best_score = 0
  best_contest = -1
  for contest in range(26):
    t_score = calc_score(day, contest, last)
    if t_score > best_score:
      best_score = t_score
      best_contest = contest

  last[best_contest] = day + 1
  score += best_score
#  print(score)
  print(best_contest + 1

### FIXED CODE ###

d = int(input())
c_l = list(map(int,input().split()))
s_l = [list(map(int,input().split())) for i in range(d)]

last_l = [-1 for i in range(26)]

def calc_score(contest_num):
  contest_val = s_l[day][contest_num]
  point = contest_val

  temp_last_l = last_l[:]
  temp_last_l[contest_num] = day

  for i in range(26):
    point -= c_l[i] * (day - temp_last_l[i])

  return point

ans = []

point = 0
for day in range(d):
  each_point = 0
  each_contest_num = 0
  for temp_contest_num in range(26):
    temp_point = calc_score(temp_contest_num)
    if temp_point > each_point:
      each_point = temp_point
      each_contest_num = temp_contest_num

  ans.append(each_contest_num + 1)

for i in ans:
  print(i)
n,k = map(int,input().split())
a = list(map(int,input().split()))

b = []
for i in range(n):
    r = 0
    for j in range(n-i):
        r += a[i+j]
        b.append(r)


n2 = n*(n+1)//2

res = 0
for i in range(41):
    p = res + 2**(40-i)
    
    c = 0
    for j in range(n2):
        if p == p&b[j]:
            c+=1
    
    if c >= k:
        res = p

print(res)

### FIXED CODE ###

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

b = sum(a)/n
for i in range(n):
    a[i] = abs(a[i]-b)

k = a.index(min(a))
print(k)
(a,b,c) = input().rstrip().split()
a = int(a)
b = int(b)
c = int(c)

if a < b < c
 print("Yes")
else:
 print("No")

### FIXED CODE ###

(a,b,c) = input().rstrip().split()
a = int(a)
b = int(b)
c = int(c)

if a < b < c:
 print("Yes")
else:
 print("No")
limit = input()



def dfs(s):
	if int(s)>limit:
		return 0

	ret = 1 if all(s.count(c)>0 for c in "753") else 0
	for c in "753":
		ret += dfs(s+c)
	return ret
print(dfs("0"))


### FIXED CODE ###

n = int(input())

def dfs(s):
	if int(s) > n:#nより大きいならカウントしない
		#print(int(s))
		return 0

	ret = 1 if all(s.count(c) > 0 for c in '753') else 0
	#753,全てが含まれているなら1
	
	for c in '753':
		ret += dfs(s+c)
		#print(s+c)
	return ret

print(dfs('0'))
from collections import deque

h, w = map(int, input().split())
a = [input() for _ in range(h)]

d = [[-1] * w for _ in range(h)]


def bfs():
    q = deque()
    for i in range(h):
        for j in range(w):
            if a[i][j] == "#":
                q.append((j, i))
                d[j][i] = 0

    dxy = [[1, 0], [-1, 0], [0, 1], [0, -1]]

    while q:
        ux, uy = q.popleft()
        for dx, dy in dxy:
            vx = ux + dx
            vy = uy + dy
            if 0 <= vx <= w - 1 and 0 <= vy <= h - 1 and a[vy][vx] == "." and d[vy][vx] == -1:
                d[vy][vx] = d[uy][ux] + 1
                q.append((vx, vy))


bfs()

ans = 0
for row in d:
    for e in row:
        ans = max(ans, e)

print(ans)


### FIXED CODE ###

from scipy.ndimage import distance_transform_cdt


def main():
    h, w = map(int, input().split())
    a = [list(input()) for _ in range(h)]

    sq = [[1 if e == "." else 0 for e in row] for row in a]

    cnt = distance_transform_cdt(sq, metric="taxicab")

    print(cnt.max())


if __name__ == "__main__":
    main()
S1, S2, S3 = map(int,input().split()) #'1'あるいは'0'
print(str(S1 + S2 +S3))

### FIXED CODE ###

s = input()
print(s.count("1"))
import math

Line = [int(s) for s in input().split()]

A,B,H,M = Line[0],Line[1],Line[2],Line[3]

# print(A,B,H,M)

kakudo = abs(  H/12*360 + M/12/60*360 - M/60*360 )

if kakudo > 180 :
    kakudo = 360 - kakudo

# print(kakudo)

ans = math.sqrt(A**2 + B**2 - 2*A*B*round(math.cos(round(math.radians(kakudo),100),100))

print(ans)

### FIXED CODE ###

import math

Line = [int(s) for s in input().split()]

A,B,H,M = Line[0],Line[1],Line[2],Line[3]

# print(A,B,H,M)

kakudo = abs(  H/12*360 + M/12/60*360 - M/60*360 )

if kakudo > 180 :
    kakudo = 360 - kakudo

# print(kakudo)

ans = math.sqrt(A**2 + B**2 - 2*A*B*round(math.cos(math.radians(kakudo)),100))

print(ans)
import math

def dic(s):
  len(s)= l
  tmp = 1
  for i,c in enumerate(s):
    tmp += (int(c) - i -1) * math.factorial(l - i -1)
  return tmp

n = input()
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))

print(abs(dic(s1)-dic(s2))

### FIXED CODE ###

import math
 
def dic(s):
  l = len(s)
  if l == 0:
    return 0
  c = s[0]
  tmp = ((sorted(s)).index(c)-1) * math.factorial(l -1)
  return tmp + dic(s[1:])
 
n = input()
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
 
print(abs(dic(s1)-dic(s2)))
n = int(input())
s = list(input())

c = 0
for i in s:
  if i == "E":
    c+=1

min = c


for i in range(n):
  if s[i] == s[i+1]:
    if s[i] == "W":
      c+=1
    else:
      c-=1
  if c < min:
    min = c

temp = 0
for i in range(n-1):
  if s[i] == "W":
    temp += 1
  
if temp < min:
  min = temp 

print(min)


### FIXED CODE ###

n = int(input())
s = list(input())
 
c = 0
for i in range(1,n):
  if s[i] == "E":
    c+=1
 
min = c
 
 
for i in range(n-1):
  if s[i] == s[i+1]:
    if s[i] == "W":
      c+=1
    else:
      c-=1
  if c < min:
    min = c
 
print(min)
def main():
  b=int(input())

  if b=="A":
    return "T"
  elif b=="C":
    return "G"
  elif b="G":
    return "C"
  elif b=="T":
    return "A"

main()


### FIXED CODE ###

def main():
  b=input()

  if b=="A":
    print("T")
  elif b=="C":
    print("G")
  elif b=="G":
    print("C")
  elif b=="T":
    print("A")

main()
from math import gcd

n = int(input())
tn = [int(input()) for _ in range(n)]
answer = tn[0]
for i in range(1,n):
    answer = answer * tn[i] // gcd(answer,tn[i])
print(answer)


### FIXED CODE ###

from fractions import gcd

n = int(input())
tn = [int(input()) for _ in range(n)]
answer = tn[0]
for i in range(1,n):
    answer = answer * tn[i] // gcd(answer,tn[i])
print(answer)
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

delta_t = abs(a - b)/abs(v - w) - 1

if v <= w:
    print("No")
elif t < delta_t:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v <= w:
    print("NO")
elif t < abs(a - b) / abs(v - w):
    print("NO")
else:
    print("YES")
m = eval(input(""))
n = eval(input(""))
num = m*n
num = int(num)
print(num)

### FIXED CODE ###

A, B = map(str, input().split()) # take the input in one line
A = int(A) # convert A into integer
C = B[0]+B[2]+B[3]
C = int(C)
print(A*C//100) # printing the output

# time complixity O(1)
n = int(input())
p = [int(input()) for _ in range(n)]


lsi = list(0 for _ in range(n+1))

for i in range(n):
    num = p[i]
    lsi[num] = 1

    for j in range(num):
        if j + lsi[j] == num:
            lsi[j] += 1

print(n - max(lsi))

### FIXED CODE ###



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

if k % 2 == 0:
    if a - b > pow(10,18):
        print("Unfair")
    else:
        print(a - b)
else:
    if b - a > pow(10,18):
        print("Unfair")
    else:
        print(b - a)
import heapq

X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
flag = [[[True for _ in range(Z)] for _ in range(Y)] for _ in range(X)]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ABC = []
heapq.heappush(ABC,(-1 * (A[0]+B[0]+C[0]),0,0,0))
flag[0][0][0] = False
ctr = 0
while ctr < K and ABC:
    s,a,b,c = heapq.heappop(ABC)
    print(-s)
    if flag[a+1][b][c]:
        heapq.heappush(ABC,(-1 * (A[a+1]+B[b]+C[c]),a+1,b,c))
        flag[a+1][b][c] = False
    
    if flag[a][b+1][c]:
        heapq.heappush(ABC,(-1 * (A[a]+B[b+1]+C[c]),a,b+1,c))
        flag[a][b+1][c] = False
    if flag[a][b][c+1]:
        heapq.heappush(ABC,(-1 * (A[a]+B[b]+C[c+1]),a,b,c+1))
        flag[a][b][c+1] = False
    ctr += 1


### FIXED CODE ###

import heapq
import numpy as np
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
flag = np.ones((X,Y,Z),dtype=np.bool)
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ABC = []
heapq.heappush(ABC,(-1 * (A[0]+B[0]+C[0]),0,0,0))
flag[0][0][0] = False
ctr = 0
while ctr < K and ABC:
    s,a,b,c = heapq.heappop(ABC)
    print(-s)
    if a+1<X and flag[a+1][b][c]:
        heapq.heappush(ABC,(-1 * (A[a+1]+B[b]+C[c]),a+1,b,c))
        flag[a+1][b][c] = False
    if b+1<Y and flag[a][b+1][c]:
        heapq.heappush(ABC,(-1 * (A[a]+B[b+1]+C[c]),a,b+1,c))
        flag[a][b+1][c] = False
    if c+1<Z and flag[a][b][c+1]:
        heapq.heappush(ABC,(-1 * (A[a]+B[b]+C[c+1]),a,b,c+1))
        flag[a][b][c+1] = False
    ctr += 1
set = list(map(int,input().split()))
index = 0
next = set[index]
while next:
	print("Case "+str(index)+": "+str(set[index]))
	index += 1
	next = set[index]

### FIXED CODE ###

import sys
cnt = 1
while 1:
	x = sys.stdin.readline().strip()
	if x == '0':
		break;
	print("Case %d: %s"%(cnt,x))
	cnt+=1
if input().isupper() = True:
    print(A)
else:
    print(a)


### FIXED CODE ###

if input().isupper():
    print("A")
else:
    print("a")
S = input()
K = int(input())
if K == 1:
    print(S[0])
elif S[K-1] == "1":
    print(1)
else:
    for i in range(len(S)):
        if S[i] != "1":
            print(S[i])
            exit()


### FIXED CODE ###

S = input()
K = int(input())
if K == 1:
    print(S[0])
    exit()
else:
    for i in range(K):
        if S[i] != "1":
            print(S[i])
            exit()
print(1)
N = int(input())
S = list(input())

if S == ['#'] * N or S == ['.'] * N:
    print(0)
    exit()
ans = 0
b, w = 0, 0
for j in range(N):
    if S[j] == '.':
        w += 1
    else:
        b += 1
    if b < w and b != 0 and w != 0:
        ans += b
        num = j
        b, w = 0, 0

b, w = 0, 0
    for j in range(N - 1, num, -1):
        if S[j] == '.':
            w += 1
        else:
            b += 1
        if b > w and b != 0 and w != 0:
            ans += w
            b, w = 0, 0

print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())

w_cnt = [0]
w = 0
for s in S:
    if s == '.':
        w += 1
    w_cnt.append(w)

b_cnt = [0]
b = 0
for s in S[::-1]:
    if s == '#':
        b += 1
    b_cnt.append(b)
b_cnt.reverse()


ans = float('inf')
i = 0
for b, w in zip(b_cnt, w_cnt):
    ww, bb = i, N - i
    ans = min(ans, abs(b - bb) + abs(w - ww))
    i += 1
print(ans)
n=int(input())
a=list(map(int,input().split()))
color=[]
count,free=0,0

for i in range(n):
    c=a[i]//400
    if a[i]<3200 and c not in color:
        color.append(c)
        count+=1
    elif a[i]>=3200:
        free+=1
      
min,max=0,0
if count==0:
    max=free
    min=1
else:
    max=count+free
    min=count
    
print(min,max)

### FIXED CODE ###

n=int(input())

for a in range(1,int(n**0.5+1)):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)