Harryxun/stf_run huggingface dataset:
import collections

n,m,k = map(int,raw_input().split(' '))

friendships = [map(int, raw_input().split(' ')) for _ in range(m)]
disses = [map(int, raw_input().split(' ')) for _ in range(k)]

parent = {i:i for i in range(1, n+1)}
sizes = {i:1 for i in range(1, n+1)}

hd = {i:0 for i in range(1, n+1)}

adj = collections.defaultdict(set)

def f(parent, a):
	if parent[a] != a: parent[a] = f(parent, parent[a])
	return parent[a]

for a,b in friendships:
	pa,pb = f(parent, a), f(parent, b)
	adj[a].add(b)
	adj[b].add(a)
	if pa != pb:
		parent[pb] = pa
		sizes[pa] += sizes[pb]

for c,d in disses:
	pa,pb = f(parent, c), f(parent, d)
	if pa == pb:
		hd[c] += 1
		hd[d] += 1

print ' '.join([str(sizes[f(parent,u)] - len(adj[u]) - hd[u] - 1)  for u in range(1, n+1)])

### FIXED CODE ###

import collections

n,m,k = map(int,raw_input().split(' '))

friendships = [map(int, raw_input().split(' ')) for _ in range(m)]
disses = [map(int, raw_input().split(' ')) for _ in range(k)]

parent = {i:i for i in range(0, n+1)}
sizes = {i:1 for i in range(0, n+1)}

hd = collections.Counter()

adj = collections.defaultdict(set)

def f(parent, u):
	if parent[u] != u: 
		parent[u] = f(parent, parent[u])
	return parent[u]

for a,b in friendships:
	if a == b: continue

	pa,pb = f(parent, a), f(parent, b)
	
	adj[a].add(b)
	adj[b].add(a)

	if pa != pb:
		if sizes[pa] >= sizes[pb]:
			parent[pb] = pa
			sizes[pa] += sizes[pb]
		else:
			parent[pa] = pb
			sizes[pb] += sizes[pa]

for c,d in disses:
	pc,pd = f(parent, c), f(parent, d)
	if (pc == pd):
		hd[c] += 1
		hd[d] += 1
"""
hd[u] = k
u has k disses in its connected component
"""

print ' '.join([str(sizes[f(parent,u)] - len(adj[u]) - hd[u] - 1)  for u in range(1, n+1)])
def triple(n):
    n = n * 3
    return n
    
print(int(triple(x)))


### FIXED CODE ###

x = int(input())
print(x*x*x)
import numpy as np
N = int(input())
A = list(map(int, input().split()))
R = np.zeros(N + 1, dtype="int32")
P = np.ones(N + 1, dtype="int32")
mod = 10 ** 9 + 7

def rev(a):
    return pow(a, mod - 2, mod)
    
for n in range(N + 1):
    R[n] = (R[n - 1] + rev(n)) % mod
    if n != 0:
        P[n] = P[n - 1] * n
    
C = [(R[j] + R[N - j + 1] - 1) % mod for j in range(1, N + 1)]

print(sum([a * c for a, c in zip(C, A)]) * P[N] % mod)


### FIXED CODE ###

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

def f(a, b):
    if b < a:
        a, b = b, a
    
    while b % a != 0:
        a, b = b % a, a
    return a

if S[0] != T[0]:
    print(-1)

else:
    p = f(N, M)
    k = N // p
    l = M // p

    for n in range(p):
        if S[n * k] != T[n * l]:
            print(-1)
            break
    else:
        print(N * M // p)
import numpy as np
from scipy.sparse import *

U = 10
N = int(input())
XY = np.array([input().split() for _ in range(N)], dtype=np.int32)

graph = csr_matrix((np.ones(N,dtype=np.bool), (XY[:,0], U + XY[:,1])), (2*U+1, 2*U+1))
_, component = csgraph.connected_components(graph)

X_cnt = np.bincount(component[:U+1], minlength = 2*U+2)
Y_cnt = np.bincount(component[U+1:], minlength = 2*U+2)
pts_cnt = np.bincount(component[XY[:,0]], minlength = 2*U+2)
answer = (X_cnt * Y_cnt - pts_cnt).sum()
print(answer)


### FIXED CODE ###

# (x,a), (x,b) → (s,a)と(t,b)は同値になる → aとbを同一視
# 連結成分を作る
N = int(input())
U = 10 ** 5
root_x = [None] * (U+1)
root_y = [None] * (U+1)
size_x = [0] * (U+1) # 連結成分のxの個数
size_y = [0] * (U+1) # 連結成分のyの個数
cnt_x = [0] * (U+1) # 生成時に登場した点
cnt_y = [0] * (U+1) # 生成時に登場した点
x_to_y = [None] * (U+1)
y_to_x = [None] * (U+1)

def find_root(root,size,x):
  y = root[x]
  if y is None:
    root[x] = x
    size[x] = 1
    return x
  if x == y:
    return y
  z = find_root(root,size,y)
  root[x] = z
  return z

def merge(root,size,cnt,x,y):
  rx = find_root(root,size,x)
  ry = find_root(root,size,y)
  if rx == ry:
    return
  sx = size[rx]
  sy = size[ry]
  if sx > sy:
    root[ry] = rx
    size[rx] += sy
    cnt[rx] += cnt[ry]
  else:
    root[rx] = ry
    size[ry] += sx
    cnt[ry] += cnt[rx]
  return

for _ in range(N):
  x,y = map(int,input().split())
  rx = find_root(root_x,size_x,x)
  ry = find_root(root_y,size_y,y)
  cnt_x[rx] += 1
  cnt_y[ry] += 1
  if x_to_y[rx] is None:
    x_to_y[rx] = ry
  if y_to_x[ry] is None:
    y_to_x[ry] = rx
  merge(root_y, size_y, cnt_y, x_to_y[rx], ry)
  merge(root_x, size_x, cnt_x, y_to_x[ry], rx)
  x_to_y[root_x[rx]] = root_y[ry]
  y_to_x[root_y[ry]] = root_x[rx]

  
answer = 0

for x in range(1,U+1):
  if root_x[x] is None:
    continue
  rx = find_root(root_x,size_x,x)
  if x != rx:
    continue
  y = x_to_y[x]
  ry = find_root(root_y,size_y,y)
  sx = size_x[rx]
  sy = size_y[ry]
  cnt = cnt_x[rx]
  answer += (sx * sy - cnt)
print(answer)
N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for _ in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])

### FIXED CODE ###

N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for i in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])
N = int(input())
data = {}
bits = 0
bit_table = [set() for _ in range(31)]
for a in map(int, input().split()):
	bits |= a
	if a in data:
		data[a] += 1
	else:
		data[a] = 1
	i = 0
	while a:
		if a % 2 == 1:
			bit_table[i].add(a)
		a //= 2
		i += 1

def pop(data, a):
	if a in data:
		if data[a] == 1:
			del data[a]
		else:
			data[a] -= 1
		return a
	else:
		return None

def check2(data0, a1, a2):
	if (a1 | a2) != bits:
		return False
	
	data = { k: data0[k] for k in data0 }
	a0 = a1
	pop(data, a1)
	pop(data, a2)
	
	while data:
		a3 = a1 ^ a2
		a4 = pop(data, a3)
		if a4 == None:
			return False
		a1 = a2
		a2 = a3
	return a0 == (a1 ^ a2)

def check(data):
	keys = data.keys()
	for a1 in keys:
		b = bits & (~a1)
		cands = None
		i = 0
		while b:
			if b % 2 == 1:
				if cands == None:
					cands = bit_table[i]
				else:
					cands &= bit_table[i]
			b //= 2
			i += 1
		
		for a2 in cands:
			if a1 != a2 or data[a1] > 1:
				if check2(data, a1, a2):
					return True
	return False

if check(data):
	print("Yes")
else:
	print("No")


### FIXED CODE ###

N = int(input())
data = {}
bits = 0
bit_table = [set() for _ in range(31)]
for a in map(int, input().split()):
	bits |= a
	if a in data:
		data[a] += 1
	else:
		data[a] = 1
	i = 0
	b = a
	while b:
		if b % 2 == 1:
			bit_table[i].add(a)
		b //= 2
		i += 1

def pop(data, a):
	if a in data:
		if data[a] == 1:
			del data[a]
		else:
			data[a] -= 1
		return a
	else:
		return None

def check2(data0, a1, a2):
	if (a1 | a2) != bits:
		return False
	
	data = { k: data0[k] for k in data0 }
	a0 = a1
	pop(data, a1)
	pop(data, a2)
	
	while data:
		a3 = a1 ^ a2
		a4 = pop(data, a3)
		if a4 == None:
			return False
		a1 = a2
		a2 = a3
	return a0 == (a1 ^ a2)

def check(data):
	keys = list(data.keys())
	a1 = keys[0]
	b = bits & (~a1)
	cands = set(keys)
	i = 0
	while b:
		if b % 2 == 1:
			cands &= bit_table[i]
		b //= 2
		i += 1
	
	for a2 in cands:
		if a1 != a2 or data[a1] > 1:
			if check2(data, a1, a2):
				return True
	return False

if check(data):
	print("Yes")
else:
	print("No")
int(input(H W h w))

s=(H-h)*(W-w)
print(s)


### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())

print((H-h)*(W-w))
a,b=map(int,input().split())

if a % 2==1 and b % 2==1:
 print("Yes")
else: 
 print("No")​

### FIXED CODE ###

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

if a % 2==1 and b % 2==1:
 print("Yes")
else: 
 print("No")
H,W,A,B = map(int,input().split())
matrix = [[0 for i in range(H)] for j in range(W)]

if A ==  B == 1:
    for i in range(W):
        matrix[i][i] = 1
elif A == B:
    for i in range(H):
        for j in range(W):
            if (i + j) % 2 == 0:
                matrix[i][j] = 1
elif H == 1 and B == 0:
    for i in range(W):
        if i % 2 != 0:
            matrix[0][i] = 1
elif W == 1 and A == 0:
    for i in range(H):
        if i % 2 != 0:
            matrix[i][0] = 1
else:
    print("No")
    exit()

for i in range(W):
        print(''.join(map(str,matrix[i])))

### FIXED CODE ###

H,W,A,B = map(int,input().split())

for i in range(H):
    if i < B:
        print("1"*A + "0"*(W-A))
    else:
        print("0"*A + "1"*(W-A))
import  fractions
import  math
A, B = map(int, input().split())

c=fractions.gcd(A,B)

Cnt=[]

def prime_decomposition(n):
  i = 2
  table = set([])
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.add(int(i))
    i += 1
  if n > 1:
    table.add(int(n))
  return table

Cnt=prime_decomposition(c)

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

ans=1


for i in range(0,len(Cnt)):
    if is_prime(int(Cnt[i])):
        ans+=1

print(ans)

### FIXED CODE ###

import  fractions
import  math
A, B = map(int, input().split())

c=fractions.gcd(A,B)

Cnt=[]

def prime_decomposition(n):
  i = 2
  table = set([])
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.add(int(i))
    i += 1
  if n > 1:
    table.add(int(n))
  return table

Cnt=prime_decomposition(c)
Cnt=list(Cnt)
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

ans=1


for i in range(0,len(Cnt)):
    if is_prime(int(Cnt[i])):
        ans+=1

print(ans)
a = int(input())
b = int(input())
c = int(input())
n = [a,b,c]
d = int ((a+b+c)/2)
if n.count(d) == 1:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b == c or b+c == a or c+a == b:
  print("Yes")
else:
  print("No")
N, M = map(int, input().split())
A = []
for i in range(N):
    A.append(list(map(int, input().split())) for i in range(N))
A.sort()
sumcost = 0
k = 0
t = 0
while M-k>0:
    buy = min(M-k, A[t][1])
    sumcost += A[t][0]*buy
    k += buy
    t += 1


print(sumcost)

### FIXED CODE ###

N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]
A.sort()
sumcost = 0
for i in range(M):
    sumcost += A[0][0]
    A[0][1] -= 1
    if A[0][1] < 1:
        A.pop(0)

print(sumcost)
def main():
    from collections import deque, defaultdict
    n = int(input())
    t = [[] for _ in range(n + 1)]
    m = []

    for _ in range(n - 1):
        i, j = map(int, input().split())
        t[i].append(j)
        m.append([i, j])
    d = defaultdict(dict)

    def f(u, i):
        z = t[u]
        l = len(z)
        r = list(range(1, i)) + list(range(i + 1, l + 2))
        for v, j in zip(z, r):
            d[u].update({v: j})
            f(v, j)

    f(m[0][0], len(t[m[0][0]]) + 1)

    ans = ''
    if t.count([]) == n:
        ans += str(n - 1) + '\n'
    else:
        ans += str(max(len(i) for i in t) + 1) + '\n'

    for (u, v) in m:
        ans += str(d[u][v]) + '\n'

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def f(u, i, d, t, vis):
    if vis[u]:
        return
    vis[u] = True
    z = t[u]

    c = 1
    for v in z:
        if vis[v]:
            continue
        if c == i:
            c += 1
        d[u].update({v: c})
        f(v, c, d, t, vis)
        c += 1


def main():
    from collections import defaultdict
    import sys
    sys.setrecursionlimit(100000)
    n = int(input())
    t = [[] for _ in range(n + 1)]
    m = []

    for _ in range(n - 1):
        i, j = map(int, input().split())
        t[i].append(j)
        t[j].append(i)
        m.append([i, j])
    d = defaultdict(dict)
    vis = [False for _ in range(n + 1)]
    f(1, len(t[1]) + 1, d, t, vis)

    ans = ''
    if t.count([]) == n:
        ans += str(n - 1) + '\n'
    else:
        ans += str(max(len(i) for i in t)) + '\n'

    for (u, v) in m:
        ans += str(d[u][v]) + '\n'

    print(ans)


if __name__ == '__main__':
    main()
n = int(input())
c = [tuple(map(int, input().split())) for _ in range(n)]
s = {}
for i in range(n):
    for j in range(i + 1, n):
        (p, q) = [b - a for a, b in zip(c[i], c[j])]
        s[(p, q)] = s.get((p, q), 0) + 1
print(n - max(s.values()))

### FIXED CODE ###

n = int(input())
c = [tuple(map(int, input().split())) for _ in range(n)]
s = {(0, 0): 0}
for i in range(n):
    for j in range(n):
        if i != j:
            (p, q) = [b - a for a, b in zip(c[i], c[j])]
            s[(p, q)] = s.get((p, q), 0) + 1
print(n - max(s.values()))
n, l = map(int, input().split())

str = []
for i in range(n):
  str.append(input())

str.sort()

print("".join(str))

### FIXED CODE ###

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

count_5 = 0
if a == 5:
  count_5 += 1
if b == 5:
  count_5 += 1
if c == 5:
  count_5 += 1
  
count_7 = 0
if a == 7:
  count_7 += 1
if b == 7:
  count_7 += 1
if c == 7:
  count_7 += 1
  
if count_5 == 2 and count_7 == 1:
  print("YES")
else:
  print("NO")
from math import modf
n, k, *A = map(int, open(0).read().split())
A.sort(reverse=1)
t = sum(A) / (n+k)
B = [(modf(a/t - 1)[0], modf(a/t - 1)[1], a) for a in A if a/t > 1]
B.sort(reverse=1)
c = k - sum(int(y) for x, y, z in B)
ans = 0
X = []
for i, (_, y, z) in enumerate(B):
    X.append(ceil(z / (y+2)))
    X.append(ceil(z / (y+1)))
X.sort()
print(X[-c-1])

### FIXED CODE ###

from math import ceil
n, k, *A = map(int, open(0).read().split())
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
c = k - sum(int(a/t)-1 for a in A)
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print(X[-c-1])
def actual(a, b, h):
    return int((a + b) * h / 2)

a, b, h = map(int, input().split())
print(actual(a, b, h))


### FIXED CODE ###

def actual(a, b, h):
    return int((a + b) * h / 2)

a = int(input())
b = int(input())
h = int(input())

print(actual(a, b, h))
import math


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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
    
L = int(M*N/gcd(N, M))
X = 'A'*int(L)

for i, s in enumerate(S):
    j = int(L/N*i)
    if X[j] == 'A':
        X = X[:j]+s+X[j+1:]
    elif X[j] == s:
        continue
    else:
        print(-1)
        exit(0)

        
for i, t in enumerate(T):
    j = int(L/M*i)
    if X[j] == 'A':
        X = X[:j]+t+X[j+1:]        
    elif X[j] == t:
        continue
    else:
        print(-1)
        exit(0)

print(L)

        


### FIXED CODE ###

import math


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

if N>M:
    N,M = M,N
    S,T = T,S
    
def gcd(a, b):
    while b:
	    a, b = b, a % b
    return a
    
L = int(M*N/gcd(N, M))

for i in range(N):
    if (M*i)%N == 0:
        j = int((M*i)/N)
        if S[i] != T[j]:
            print(-1)
            exit(0)

print(L)
S=list(input())
yes_flag=0
in_flag=0
S=[s for s in S if s!=' ']
for i in range(len(S)):
  #print(S)
  if S[0:5] == list("erase"):
    in_flag=1
    del S[0:5]
    if S[0] == "r":
      del S[0]
    if len(S) == 0:
      yes_flag=1
      break
  if S[0:5] == list("dream"):
    in_flag=1
    del S[0:5]
    if S[0:2] == list("er"):
      if not len(S) == 2:
      	if not S[2] == "a":
          del S[:2]
      else :
        del S[:2]
    if len(S) == 0:
      yes_flag=1
      break
  
  if in_flag==0:
    break
  in_flag=0

if yes_flag == 1:
  print("YES")
else :
  print("NO")

### FIXED CODE ###

import re
print("YES" if re.match("^(dream|dreamer|erase|eraser)+$",input()) else "NO")
o = input()
e = input()
pw = ""
for i in range(e):
    pw+= o[i] + e[i]
if len(o) != len(e):
    pw += o[-1]
print(pw)

### FIXED CODE ###

o = input()
e = input()
pw = ""
for i in range(len(e)):
    pw+= o[i] + e[i]
if len(o) != len(e):
    pw += o[-1]
print(pw)
#アキュムレータ版
D = 1000000007
n, m = map(int, input().split())
a = [0] * (10**5 + 3)
for i in range(m):
    a[int(input())] += 1

# 初期値
s0 = 1
if (a[1] == 1):
    s1 = 0
else:
    s1 = 1


def calc(l, acc1, acc2):
    # print("calc(l, acc1, acc2):" + str(l) + str(acc1) + str(acc2))
    if (l == 1):
        return acc2
    else:
        oldacc2 = acc2
        if (a[n - l + 2] == 1):
            acc2 = 0
        else:
            acc2 = (acc1 + acc2) % D
        acc1 = oldacc2
        return calc(l - 1, acc1, acc2)


print(calc(n, s0, s1))


### FIXED CODE ###

#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
D = 1000000007
n, m = map(int, input().split())
a = [0] * (10**5 + 1)
for i in range(m):
    a[int(input())] += 1

# 初期値
s = [0] * (n + 1)
s[0] = 1
if (a[1] == 1):
    s[1] = 0
else:
    s[1] = 1

# 暫定結果を格納する配列


def calc(n):
    if(a[n] == 1):
        return 0
    else:
        return (s[n - 1] + s[n - 2]) % D


def solver(n):
    for i in range(2, n + 1):
        s[i] = calc(i)


solver(n)
print(s[n])
import sys
n, m = map(int, input().split())
S,C=[],[]

for _ in range(m):
  s,c=map(int,input().split())
  S.append(s)
  C.append(c)
cur = 0
for i in range(10**(n-1)-1, 10**n):
  isOk = True
  for j in range(m):
    if str(i)[S[j]-1] != str(C[j]):
      isOk = False
  if isOk:
    print(i)
    sys.exit()
print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
 
sc=[list(map(int,input().split())) for _ in range(m)]
 
def main():
  for i in range(10**n):
    scstr = str(i)
    f = True
    if len(scstr) == n:
      for j in range(m):
        if scstr[sc[j][0]-1] != str(sc[j][1]):
          f = False
      if f:
        print(i)
        return
  print('-1')
 
main()
a,b=map(int,input().split())
if (a%2==1)&&(b%2==1):
  print('Odd')
else:
  print('Even')
  

### FIXED CODE ###

a,b=map(int,input().split())
if (a%2==1)and(b%2==1):
  print('Odd')
else:
  print('Even')
n = input()
 
S = range(1, 14)
H = range(1, 14)
C = range(1, 14)
D = range(1, 14)
 
for i in range(0, n):
   mk, num = map(int,raw_input()split())
      if mk == 'S':
         S[str(num)-1] = 0
      elif mk == 'H':
         S[str(num)-1] = 0
      elif mk == 'C':
         S[str(num)-1] = 0
      elif mk == 'D':
         S[str(num)-1] = 0
 
for i in S:
   if S[i] != 0:
      print ('S' i+1)

for i in H:
   if S[i] != 0:
      print ('H' i+1)

for i in C:
   if S[i] != 0:
      print ('C' i+1)

for i in D:
   if S[i] != 0:
      print ('D' i+1)

### FIXED CODE ###

n=input()
  
s=range(1,14)
h=range(1,14)
c=range(1,14)
d=range(1,14)
   
for i in range(n):
   m, k=raw_input().split()
   if m == 'S':
      s[int(k)-1] = 0
   elif m == 'H':
      h[int(k)-1] = 0
   elif m == 'C':
      c[int(k)-1] = 0
   elif m == 'D':
      d[int(k)-1] = 0
  
for i in range(0, 13):
   if s[i] != 0:
      print 'S '+str(s[i])
  
for i in range(0, 13):
   if h[i] != 0:
      print 'H '+str(h[i])
  
for i in range(0, 13):
   if c[i] != 0:
      print 'C '+str(c[i])
  
for i in range(0, 13):
   if d[i] != 0:
      print 'D '+str(d[i])
# -*- coding: utf-8 -*-
A,B,C =map(int,input().split())
if A == B:
  print(C)
elif B == C:
  print(A)
else:
  print()B

### FIXED CODE ###

# -*- coding: utf-8 -*-
A,B,C =map(int,input().split())
if A == B:
  print(C)
elif B == C:
  print(A)
else:
  print(B)
from math import floor

X, val, a = eval(input()), 100, 1

while True :
    val += floor(val * 0.01)
    if val >= X:
        break
    a += 1
print(a)

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)
a, b = [for x in input().split()]
print('H' if a == b else 'D')


### FIXED CODE ###

a, b = input().split()
print('H' if a == b else 'D')
a,b,c=input()
if a<b:
  a,b=b,a
if b<c:
  b,c=c,b
if a<b:
  a,b=b,a
print(10*a+b+c)

### FIXED CODE ###


a,b,c=map(int,input().split())
if a<b:
  a,b=b,a
if b<c:
  b,c=c,b
if a<b:
  a,b=b,a
print(10*a+b+c)
.lower()
.upper()

### FIXED CODE ###

print(input().swapcase())
# https://atcoder.jp/contests/abc112/tasks/abc112_d

# 答えansの満たす条件
# ans<=M//Nである
# M%ans==0である


# 仮説:M//Nからansを--して、M%ans==0となるansが答え
# でももしN=2, M=10*9+7とかだったらTLEしそう →約数ならば

from math import sqrt

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

ans = M // N
if M % N == 0:
    print(ans)
    exit()

s = min(ans, sqrt(M) + 1)
for a in range(s, 0, -1):
    if M % a == 0:
        print(a)
        exit()


### FIXED CODE ###

# https://atcoder.jp/contests/abc112/tasks/abc112_d

# 答えansの満たす条件
# ans<=M//Nである
# M%ans==0である


# 仮説:M//Nからansを--して、M%ans==0となるansが答え
# でももしN=2, M=10*9+7とかだったらTLE思想

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

ans = M // N
for a in range(ans, 0, -1):
    if M % a == 0:
        print(a)
        exit()
while 1:
    n = raw_input()
    if x == '0': break;
    print reduce(lambda x,y: x+int(y), n, 0)

### FIXED CODE ###

while 1:
    x = raw_input()
    if x == '0': break;
    print sum(int(s) for s in x)
N = int(input())
A = list(map(int, input().split()))
i=1
while A[0]<=10**18 and i<=N-1:
   A[0]*=A[i]
   i+=1
if A[0]>10**18:
   A[0]=-1
print(A[0])

import gc
gc.collect()

### FIXED CODE ###

a,b = map(int, input().split()) 
print(a*b)
N,K = list(map(int,input().split(' ')))
pi = list(map(int,input().split(' ')))
value = pi[:K]
max_value = value
for i in range(K, N):
  value -= pi[i-K]
  value += pi[K]
  if value>max_value:
    max_value = value
print(max_value/float(K))

### FIXED CODE ###

N,K = list(map(int,input().split(' ')))
pi = list(map(int,input().split(' ')))
value = sum(pi[:K])
max_value = value
for i in range(N-K):
  value -= pi[i]
  value += pi[i+K]
  max_value = max(value, max_value)
print((max_value+K)/2)
N= int(input())
L=[0]*(N+1)
a=2
b=1
​
for i in range(1,N+1):
    L[0]=2
    L[1]=1
    L[i]=L[i-1]+L[i-2]
    
print(L[N])

### FIXED CODE ###

N= int(input())
L=[0]*(N+1)
L[0]=2
L[1]=1
for i in range(2,N+1):
    
    L[i]=L[i-1]+L[i-2]
    
print(L[N])
n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
z = 0
ans = 1
mod = 10**9+7
for i in range(n): #1文字目
  if a[i] == x:
    x = x + 1
    if x-1 == y:
      if x-1 == z:
        ans = ans * 3
      else:
        ans = ans * 2
  elif a[i] == y:
    y = y + 1
    if y-1 == z:
      ans = ans * 2
  else:
  	z = z + 1
print(ans % mod)

### FIXED CODE ###

# -*- coding: utf-8 -*-
m_1, d_1 = map(int, input().split())
m_2, d_2 = map(int, input().split())

if m_1 == m_2:
  print(0)
else:
  print(1)
a = set(map(int, input()))
print(len(a))



### FIXED CODE ###

from collections import Counter
a = Counter(list(map(str, input().split())))
print(len(a))
#AIsing2020 d
 
import sys
input = sys.stdin.readline
 
 
def popcount(n):
    bin_str = bin(n)
    cou1 = bin_str.count('1')
    return cou1
 
def count(nc):
    co = 0
    while nc >0:
        cou1 = popcount(nc)
        nc = nc%cou1
        co +=1
    return co
 
N = int(input())
X = list(input().rstrip())
X10 = int('0b'+"".join(X),2)
X10_num1 = popcount(X10)
X10_pulse = X10%(X10_num1+1)
X10_ninus = X10%(X10_num1-1)


for i in range(N,0,-1):
    a = X10
    if a>>(i-1) & 1:
        a -= 2**(i-1)
        amari = (X10_ninus - (2**(i-1))%(X10_num1-1))%(X10_num1-1)
        #print(bin(X10),bin(a),X10,a,amari)
    else:
        a += 2**(i-1)
        amari = (X10_pulse + (2**(i-1))%(X10_num1+1))%(X10_num1+1)
        #print(bin(X10),bin(a),X10,a,amari)

    if a ==0:
        co = 0
    else:
        co = count(amari)+1
    print(co)


### FIXED CODE ###

#AIsing2020 d

def f(n):
        cnt = 0
        while n:
            cnt+= 1
            n = n%bin(n).count('1')
        return cnt

def main():
    N = int(input())
    X = input()
    X10 = int(X,2)
    X10_num1 = X.count('1')
    X10_pulse = X10%(X10_num1+1)
    X10_ninus = X10%(X10_num1-1) if X10_num1 >1 else 0


    for i in range(N,0,-1):
        j = N-i
        if (X[j] == '1') and X10_num1 >1:
            mod = X10_num1-1
            amari = (X10_ninus - pow(2,i-1,mod))%(mod) 
        elif (X[j] == '1') and X10_num1 ==1:
            print(0)
            continue
        else:
            mod = X10_num1+1
            amari = (X10_pulse + pow(2,i-1,mod))%(mod)

        print(1+f(amari))


main()
s = input()
k = int(input())

n = len(s)

d = set()
for i in range(n):
    for j in range(i+1, min(i+k,n+1)):
        tmp = s[i:j]
        d.add(tmp)
a = sorted(list(d))
print(a[k-1])



### FIXED CODE ###

s = input()
k = int(input())

n = len(s)

d = set()
for i in range(n):
    for j in range(i+1, min(i+k+1,n+1)):
        tmp = s[i:j]
        d.add(tmp)
a = sorted(list(d))
print(a[k-1])