Harryxun/stf_run huggingface dataset:
import itertools
n,m,q = map(int,input().split())
l = []
for i in range(q):
  l.append(list(map(int,input().split())))
j = [i for i in range(1,m+1)]
k = itertools.permutations(j, n)
for i in range(q):
  if k[l[i][1]]-k[l[i][0]] == l[i][2]:
    count += l[i][3]

### FIXED CODE ###

import itertools
n,m,q = map(int,input().split())
l = []
for i in range(q):
  l.append(list(map(int,input().split())))
j = [i for i in range(1,m+1)]
kk = list(itertools.combinations_with_replacement(j,n))
ans = []
for k in kk:
  count = 0
  for i in range(q):
    if k[l[i][1]-1]-k[l[i][0]-1] == l[i][2]:
      count += l[i][3]
  ans.append(count)
print(max(ans))
def f(t):
    c,t=t%N,t/N
    print "%02d:%02d:%02d"%(t/N,t%N,c)
    return

while 1:
    h,m,s=map(int,raw_input().split())
    if [h,m,s]==[-1,-1,-1]: break
    t=7200-(h*N+m)*N-s
    f(t)
    f(t*3)

### FIXED CODE ###

N=60
def f(t):
    c,t=t%N,t/N
    print "%02d:%02d:%02d"%(t/N,t%N,c)
    return

while 1:
    h,m,s=map(int,raw_input().split())
    if [h,m,s]==[-1,-1,-1]: break
    t=7200-(h*N+m)*N-s
    f(t)
    f(t*3)
A = int(input())
B = int(input())

print(max([A+B, A-B, A*B]))

### FIXED CODE ###

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

print(max([A+B, A-B, A*B]))
if __name__ == '__main__':

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

	cnt = 0
	ODD = []
	EVE = []

	#奇数と偶数に分類
	for i in A:
		if i % 2 == 1:
			ODD.append(i)
		else:
			EVE.append(i)

	while True:

		#全部奇数なら終了
		if len(ODD) == n:
			print(cnt)
			break
		else:
			#奇数は全部３倍する
			for i in range(len(ODD)):
				ODD[i] = ODD[i] * 3

			#偶数はMAX値を２で割る
			#それ以外は３倍する
			chg = False
			mval = max(EVE)
			ind = EVE.index(mval)
			for j in range(len(EVE)):
				if j == ind:
					EVE[j] = int(EVE[j] / 2)
					if ( mval / 2 ) % 2 == 1:
						chg = True
				else:
					EVE[j] = EVE[j] * 3

			#２で割った値が奇数になったらODDに移動
			if chg == True:
				ODD.append(EVE.pop(ind))

			cnt += 1


### FIXED CODE ###

import sys

if __name__ == '__main__':
	input()
	A = list(map(int,sys.stdin.readline().split()))

	cnt = 0
	EVE = [i for i in A if i % 2 == 0]

	for j in EVE:
		while True:
			j = j // 2
			if j % 2 == 1:
				cnt += 1
				break
			cnt += 1

	print(cnt)
H,W=map(int,input().split())
print(H*int(ceil(W/2)))

### FIXED CODE ###

import math
H, W = map(int,input().split())
if H == 1 or W == 1:
    print(1)
else:
    print(int(math.ceil(H*W/2)))
str alpha='B'
if (alpha.isupper()){
  print(A)
}else{
  print(B)
}


### FIXED CODE ###

alpha=input()
if (alpha.isupper()):
  print('A')
else:
  print('a')
import math
num_max = 1000000
isPrimeNum = [True for i in range(0,num_max)]

isPrimeNum[0] == False
isPrimeNum[1] == False

for i in range(2, int(math.sqrt(num_max))):
    if isPrimeNum[i] == True:
        for j in range (i**2, num_max, i):
            isPrimeNum[j] = False
        


num_len = int(input())
cnt = 0

for i in range(num_len):
    num = int(input())
    if isPrimeNum[num]==True:
        cnt = cnt + 1

print(str(cnt))

### FIXED CODE ###

def isPrimeNum(in_num):
    if in_num <= 1:
        return False
    elif in_num == 2:
        return True
    elif in_num % 2 == 0:
        return False
    else:
        if pow(2, in_num-1, in_num) == 1:
            return True
        else:
            return False


num_len = int(input())
cnt = 0
for i in range(num_len):
    num = int(input())
    if isPrimeNum(num)==True:
        cnt = cnt + 1

print(str(cnt))
s = input()
k = int(input())

len_s = len(s)
moji = [0]*(len_s)

for i in range(len_s):
    num = 26-(ord(s[i])-ord('a'))
    if num <= k:
        moji[i] = 'a'
        k -= num
    else:
        moji[i] = s[i]
        
if k != 0:
    #print(k)
    moji[len_s-1] = chr(ord(moji[len_s-1])+k)
        
print(*moji,sep='')

### FIXED CODE ###

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

len_s = len(s)
moji = [0]*(len_s)

for i in range(len_s):
    num = 26-(ord(s[i])-ord('a'))
    if num <= k and num != 26:
        moji[i] = 'a'
        k -= num
    else:
        moji[i] = s[i]

     
if k != 0:
    #print(k)
    moji[len_s-1] = chr(ord(moji[len_s-1])+k%26)
        
print(*moji,sep='')
n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]

path=[[] for _ in range(n)]
for i,(a,b) in enumerate(AB):
  a,b=a-1,b-1
  path[a].append((b,i))
  path[b].append((a,i))
  
visited=[0]*n
ans=[None]*(n-1)
  
def dfs(v,c=-1):
  nc=1
  for to,i in path[v]:
    if visited[to]: continue
    visited[v]=1
    if nc==c: nc+=1
    ans[i]=nc
    dfs(to,nc)
    nc+=1
dfs(0)
print(max(ans))
print(*ans,sep='\n')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]

path=[[] for _ in range(n)]
for i,(a,b) in enumerate(AB):
  a,b=a-1,b-1
  path[a].append((b,i))
  path[b].append((a,i))
  
visited=[0]*n
ans=[None]*(n-1)
  
def dfs(v,c=-1):
  nc=1
  for to,i in path[v]:
    if visited[to]: continue
    visited[v]=1
    if nc==c: nc+=1
    ans[i]=nc
    dfs(to,nc)
    nc+=1
dfs(0)
print(max(ans))
print(*ans,sep='\n')
f = open('newfile.txt')
all = []
sums = f.read()
f.close()

lines = sums.split('\n')
for i in range(len(lines)):
	all.append(lines[i].split(' '))

for i in range(len(all)):
	keta = str(int(all[i][0]) + int(all[i][1]))
	print(len(list(keta)))

### FIXED CODE ###

import sys
L = sys.stdin.readlines()
for line in L:
	N = line[:-1].split(' ')
	sums = int(N[0]) + int(N[1])
	print(len(str(sums)))
N = int(input())
a = list(map(int, input().split(' ')))

p = [i for i in a if i >= 0]
n = [i for i in a if i < 0]

process = []
if len(p) > 0 and len(n) > 0:
    p_seed = p.pop(0)
    n_seed = n.pop(0)
    while len(n) > 0:
        sub = n.pop(0)
        process.append((p_seed, sub))
        p_seed -= sub
    while len(p) > 0:
        sub = p.pop(0)
        process.append((n_seed, sub))
        n_seed -= sub
    process.append((p_seed, n_seed))
    m = p_seed - n_seed
    print(m)
    for x, y in process:
        print(f'{x} {y}')
else:
    target = p if len(p) > 0 else n
    target.sort(reverse=True)
    p_seed = target.pop(0)
    n_seed = target.pop(-1)
    while len(target) > 0:
        sub = target.pop(0)
        process.append((n_seed, sub))
        n_seed -= sub
    process.append((p_seed, n_seed))
    m = p_seed - n_seed
    print(m)
    for x, y in process:
        print(f'{x} {y}')


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split(' ')))
a.sort(reverse=True)

process = []
p_seed = a.pop(0)
n_seed = a.pop(-1)
for e in a:
    if e >= 0:
        process.append((n_seed, e))
        n_seed -= e
    else:
        process.append((p_seed, e))
        p_seed -= e
process.append((p_seed, n_seed))
m = p_seed - n_seed
print(m)
for x, y in process:
    print(str(x) + ' ' + str(y))
import sys
from bisect import bisect_left
changed = []
input = sys.stdin.readline
N = int(input())
A = [int(a) for a in input().split()]
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    u, v = map(int, input().split())
    Edge[u-1].append(v-1)
    Edge[v-1].append(u-1)
LIS = [10 ** 20] * N

def dfs(i, pre, Ans):
    changeID = bisect_left(LIS, A[i])
    changed.append(LIS[changeID])
    LIS[changeID] = A[i]
    Ans[i] = changeID + 1
    for nextN in Edge[i]:
        if nextN != pre: dfs(nextN, i, Ans)
    backNum = changed.pop()
    LIS[changeID] = backNum
    return 0


def solve():
    Ans = [1] * N
    dfs(0, 0, Ans)
    print("\n".join(map(str, Ans)))
    

    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
from bisect import bisect_left
sys.setrecursionlimit(1000000)
INF = pow(10, 10)

changed = []
input = sys.stdin.readline
N = int(input())
A = [int(a) for a in input().split()]
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    u, v = map(int, input().split())
    Edge[u-1].append(v-1)
    Edge[v-1].append(u-1)
LIS = [INF] * N

def dfs(i, pre, Ans):
    changeID = bisect_left(LIS, A[i])
    changed.append((changeID, LIS[changeID]))
    LIS[changeID] = min(A[i], LIS[changeID])
    #print(i, LIS)
    #print(changed)
    Ans[i] = bisect_left(LIS, INF) 
    for nextN in Edge[i]:
        if nextN != pre: dfs(nextN, i, Ans)
    backID, backV = changed.pop()
    LIS[backID] = backV
    return 0

def solve():
    Ans = [1] * N
    dfs(0, 0, Ans)
    print("\n".join(map(str, Ans)))
    
    return 0

if __name__ == "__main__":
    solve()
d = map(int, input().split())
d.sort()
print(d[0])

### FIXED CODE ###

ary=list(map(int, input().split()))
ary.sort()
print("{} {} {}".format(ary[0], ary[1], ary[2]))
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

# 二分探索木の代わり BST HST
# 存在しない要素に対するremoveはこないことを仮定している

h = []
from collections import Counter, defaultdict
from itertools import chain
ca = defaultdict(int)
ca.update(Counter(a))
cb = defaultdict(int)
cb.update(Counter(b))
ks = set(ca.keys()) | set(cb.keys())
ans = defaultdict(list)
done = 0
amari = 0
for k in ks:
    h.append((-ca[k], -cb[k], k))
h.sort(key=lambda x: x[0]+x[1])
la = []
lb = []
for va,vb,k in h:
    la.extend([k]*-va)
    lb.extend([k]*-vb)
na = [None]*n
nb = [None]*n
ia = 0
ib = n-1
ib2 = 0
for aa,bb,k in h:
    aa *= -1
    bb *= -1
    for _ in range(aa):
        na[ia] = k
        ia += 1
    for _ in range(bb):
        if na[ib]!=k:
            nb[ib] = k
            ib -= 1
        else:
            nb[ib2] = k
            ib2 += 1
if any((na[i]==nb[i]) for i in range(n)):
    print("No")
else:
    d = defaultdict(list)
    for i in range(n):
        d[la[i]].append(nlb[i])
    ans = []
    for i in range(n):
        ans.append(d[la[i]].pop())
    print("Yes")
    write(" ".join(map(str, ans)))

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

# 二分探索木の代わり BST HST
# 存在しない要素に対するremoveはこないことを仮定している

h = []
from collections import Counter, defaultdict
from itertools import chain
ca = defaultdict(int)
ca.update(Counter(a))
cb = defaultdict(int)
cb.update(Counter(b))
ks = set(ca.keys()) | set(cb.keys())
ans = defaultdict(list)
done = 0
amari = 0
for k in ks:
    h.append((-ca[k], -cb[k], k))
h.sort(key=lambda x: x[0]+x[1])
la = []
lb = []
for va,vb,k in h:
    la.extend([k]*-va)
    lb.extend([k]*-vb)
na = [None]*n
nb = [None]*n
ia = 0
ib = n-1
ib2 = 0
for aa,bb,k in h:
    aa *= -1
    bb *= -1
    for _ in range(aa):
        na[ia] = k
        ia += 1
    for _ in range(bb):
        if na[ib]!=k:
            nb[ib] = k
            ib -= 1
        else:
            nb[ib2] = k
            ib2 += 1
if any((na[i]==nb[i]) for i in range(n)):
    print("No")
else:
    d = defaultdict(list)
    for i in range(n):
        d[na[i]].append(nb[i])
    ans = []
    for i in range(n):
        ans.append(d[a[i]].pop())
    print("Yes")
    write(" ".join(map(str, ans)))
# ABC070-C
import math
from functools import reduce
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def lcm_base(x, y):
    return (x * y ) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers)
print(lcm_list(T))

### FIXED CODE ###

# ABC070-C
import fractions
from functools import reduce
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def lcm_base(x, y):
    return (x * y ) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers)
print(lcm_list(T))
h,w = map(int, input().split())

a = h*w

if a%2==0:
  print(a//2)
else:
  pirnt(a//2+1)

### FIXED CODE ###

h,w = map(int, input().split())
 
a = h*w
 
if h==1 or w==1:
  print(1)
elif a%2==0:
  print(a//2)
else:
  print(a//2+1)
a = map(int, input().split())
b = map(int, input().split())
c = a*b
print(c)

### FIXED CODE ###

a, b =map(int, input().split())
c = a*b
print(c)
import numpy as np
from collections import Counter


n = int(input())
a = [int(x) for x in input().split(' ')]

s = np.array(sorted(set(a)),int)
bl = np.array([True]*n, bool)
for i in range(1, n):
    mod = s[i]
    buf = s[:i][bl[:i]]
    for j in range(len(buf)):
        if mod % buf[j] == 0:
            bl[i] = False
            break
s = set(s[bl])

c = Counter(a)
keys = set([k for k, v in c.items() if v == 1])

print(len(s&keys))

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split(' ')]

a.sort()
a_max = a[-1] + 1   # aの最大値
lst = [0] * a_max   # a_max個のリストを生成

for x in a:
    lst[x] += 1                         # リストの該当の数字に1追加 
    if lst[x] == 1:                     # まだ他の数値の倍数でなければ、リストへ2倍、3倍…の数字を1追加していく
        for i in range(x*2, a_max, x):
            lst[i] += 1

output = 0
for x in a:
    if lst[x] == 1:
        output += 1
print(output)
a=int(input())
b=int(input())
c=int(input())
if a < b < c:
 print("yes")
else:
   print("no") 


### FIXED CODE ###

c=input().split(" ")
a=int(c[0])
b=int(c[1])
c=int(c[2])
if a < b and b < c:
 print("Yes")
else:
   print("No")
n,d=input().split()
n=int(n)
d=int(d)
a=d*2+1
if n%a==0:
    print(n//a)
else:
    print(n//a+1)

### FIXED CODE ###

r=int(input())
a=3*r**2
print(int(a))
n = int(input())
s = str(input())
count = 0
for i in range(0,n):
    if s[i] == "A":
        if i+2 <= n:
            if s[i+1] == "B" and s[i+2] == "C":
                count += 1
print (count)

### FIXED CODE ###

n = int(input())
s = str(input())
count = 0
for i in range(0,n):
    if s[i] == "A":
        if i+2 <= n-1:
            if s[i+1] == "B" and s[i+2] == "C":
                count += 1
print (count)
# -*- coding: utf-8 -*-
import math
import sys
import bisect

## input
a,b,q = map(int, sys.stdin.readline().rstrip().split())
s_s, t_s, x_s = [[], [], []]
for _ in range(a):
  s_s.append(int(sys.stdin.readline().rstrip()))
for _ in range(b):
  t_s.append(int(sys.stdin.readline().rstrip()))
for _ in range(q):
  x_s.append(int(sys.stdin.readline().rstrip()))


## solve
def get_otherlen(st_s, k):
  idx = bisect.bisect_left(st_s, k)
  if idx == 0:
    mn = abs(st_s[0]-k)
  elif idx == len(s_s):
    mn = abs(st_s[-1]-k)
  else:
    mn = min(abs(st_s[idx]-k), abs(st_s[idx-1]-k))
  return(mn)


def get_len(k):
  # s -> t
  idx = bisect.bisect_left(s_s, k)
  if idx == 0:
    mn = abs(s_s[0]-k) + get_otherlen(t_s, s_s[0])
  elif idx == len(s_s):
    mn = abs(s_s[-1]-k) + get_otherlen(t_s, s_s[-1])
  else:
    mn1 = abs(s_s[idx]-k) + get_otherlen(t_s, s_s[idx])
    mn2 = abs(s_s[idx-1]-k) + get_otherlen(t_s, s_s[idx-1])
    mn = min(mn1, mn2)

  # t -> s
  idx = bisect.bisect_left(t_s, k)
  if idx == 0:
    mn = min(mn, abs(t_s[0]-k) + get_otherlen(s_s, t_s[0]))
  elif idx == len(t_s):
    mn = min(mn, abs(t_s[-1]-k) + get_otherlen(s_s, t_s[-1]))
  else:
    mn1 = abs(t_s[idx]-k) + get_otherlen(s_s, t_s[idx])
    mn2 = abs(t_s[idx-1]-k) + get_otherlen(s_s, t_s[idx-1])
    mn = min(mn, mn1, mn2)
  return(mn)


if __name__ == "__main__":
  for x in x_s:
    print(x, get_len(x))

### FIXED CODE ###

# -*- coding: utf-8 -*-
import math
import sys
import bisect

## input
a,b,q = map(int, sys.stdin.readline().rstrip().split())
s_s, t_s, x_s = [[-10**11], [-10**11], []]
for _ in range(a):
  s_s.append(int(sys.stdin.readline().rstrip()))
for _ in range(b):
  t_s.append(int(sys.stdin.readline().rstrip()))
for _ in range(q):
  x_s.append(int(sys.stdin.readline().rstrip()))
s_s.append(10**11)
t_s.append(10**11)


def solve(k):
  s_pos = bisect.bisect_left(s_s, k)
  t_pos = bisect.bisect_left(t_s, k)
  mn = 10**11
  for i in [s_s[s_pos-1], s_s[s_pos]]:
    for j in [t_s[t_pos-1], t_s[t_pos]]:
      mn = min(mn,abs(i-k)+abs(i-j), abs(j-k)+abs(i-j))
  return(mn)

if __name__ == "__main__":
  for x in x_s:
    print(solve(x))
N = int(input())
ans = len(N)

if ans = 1:
	print(N)

### FIXED CODE ###

n = int(input())
 
if  n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-99+9)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(n-9999+909)
elif n == 100000:
    print(90909)
import numpy as np
h,w=map(int,input().split())
"""
入力はスペースなしだった
文字列としてリストの行にぶち込む必要あり
icon=list()
for i in range(h):
    icon.append(list(input().split()))

"""
icon=[''] * h
for i in range(h):
    a[i]=input()


row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if icon[i][j]=='#':
            row[i]=True
            col[j]=True

for  i in range(h):
    if row[i]==True:
        for j in range(w):
            if col[j]==True:
                print(icon[i][j],end='')
        print()  


### FIXED CODE ###

import numpy as np
h,w=map(int,input().split())
"""
入力はスペースなしだった
文字列としてリストの行にぶち込む必要あり
icon=list()
for i in range(h):
    icon.append(list(input().split()))

"""
icon=[''] * h
for i in range(h):
    icon[i]=input()


row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if icon[i][j]=='#':
            row[i]=True
            col[j]=True

for  i in range(h):
    if row[i]==True:
        for j in range(w):
            if col[j]==True:
                print(icon[i][j],end='')
        print()
s = input()
c = int((len(s) - 1)/2)
ans = (list(s) == list(reversed(s) and list(s[:c]) == list(reversed(s[:c])) and list(s[(c+1):]) == list(reversed(s[(c+1):])))
print(["No", "Yes"][ans])

### FIXED CODE ###

s = input()
c = int((len(s) - 1)/2)
ans = (list(s) == list(reversed(s)) and list(s[:c]) == list(reversed(s[:c])) and list(s[(c+1):]) == list(reversed(s[(c+1):])))
print(["No", "Yes"][ans])
n,m=map(int,input().split())
a=[0]*m
for _ in range(n):
    b=list(map(int,input().split()))
    for i in b[1:]:
        a[i]+=1
print(sum(x==n for x in a))

### FIXED CODE ###

n,m=map(int,input().split())
a=[0]*m
for _ in range(n):
    b=list(map(int,input().split()))
    for i in b[1:]:
        a[i-1]+=1
print(sum(x==n for x in a))
a = list.map(int, input().split())

a.sort()

print(a)



### FIXED CODE ###

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

a.sort()

print(a[0], a[1], a[2])
def main():
    S = input()
    K = int(input())
    a = list(S)
    cnt = 0
    if len(set(a))==1:
        cnt = (len(a)*K)//2
        print(cnt)
    else:
        temp = 1
        temp_2 = 1
        i = 0
        while a[i] == a[i+1]:
            temp += 1
            i += 1
        j = len(a) - 1
        while a[j] == a[j-1]:
            temp_2 += 1
            j -= 1
        for k in range(i+1,j-1):
            if a[k+1] == a[k]:
                a[k+1] = str(k)
                cnt += 1
        cnt *= K
        cnt += temp//2
        cnt += temp_2//2
        
        if a[0] == a[-1]:
            temp_3 = (temp + temp_2)//2
            cnt += temp_3 * (K-1)
        temp_4 = 0
        elif temp > 1:
            temp_4 += temp
        elif temp_2 > 2:
            temp_4 += temp_2
        cnt += temp_4 * (K-1)


        print(cnt)

    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    S = input()
    K = int(input())
    a = list(S)
    cnt = 0
    if len(set(a))==1:
        cnt = (len(a)*K)//2
    elif a[0] != a[-1]:
        for l in range(len(a)-1):
            if a[l+1] == a[l]:
                a[l+1] = str(l)
                cnt += 1
        cnt *= K
    else:
        temp = 1
        temp_2 = 1
        i = 0
        while a[i] == a[i+1]:
            temp += 1
            i += 1
        j = len(a) - 1
        while a[j] == a[j-1]:
            temp_2 += 1
            j -= 1
        for k in range(i+1,j-1):
            if a[k+1] == a[k]:
                a[k+1] = str(k)
                cnt += 1
        cnt *= K
        cnt += temp//2
        cnt += temp_2//2
        temp_3 = (temp + temp_2)//2
        cnt += temp_3 * (K-1)


    print(cnt)

    
if __name__ == '__main__':
    main()
import numpy as np

x = list(map(int,input().split()))
x.sort()
sum = np.sum(x)
print('%s %s %s'%(max(x),min(x),sum))


### FIXED CODE ###

n = input()
x = list(map(int,input().split()))
x.sort()
print('%s %s %s'%(min(x),max(x),sum(x)))
n,k=map(inr,input().split())
l=[(int(i) for i in input().split())]
l.sort(reverse=True)
print(sum(l[:k]))

### FIXED CODE ###

n,k=map(int,input().split())
l=[int(i) for i in input().split()]
l.sort(reverse=True)
print(sum(l[:k]))
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(a*b//fractions.gcd(a,b))
i = 0

while 1:
  x = raw_input()
  i += 1
  if x == '0':
    break
  print "Case %d: %d" % i,x

### FIXED CODE ###

i = 0

while 1:
  x = raw_input()
  i += 1
  if x == "0":
    break
  print "Case %d: %s" % (i,x)
import string
alphabets = string.ascii_lowercase

def alphabet_check(S, checker):
    for i, s in enumerate(S):
        checker[alphabets.index(s)] = i

S = input()
checker = [-1]*26

alphabet_check(S, checker)

if len(S) < 26:
    char_idx = checker.index(-1) 
    print(S + alphabets[char_idx])
elif S == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
else:
    cont_flag = False
    for i in range(26-1):
        if S[i] > S[i+1]:
            if cont_flag == False:
                idx = i
                cont_flag = True
        else:
            cont_flag = False
    string = S[:idx-1]
    checker2 = [-1]*26
    alphabet_check(string, checker2)
    for i in range(26):
        if checker2[i] == -1 and alphabets[i] > S[idx-1]:
            char_idx = i
            break
    print(string + alphabets[char_idx])

### FIXED CODE ###

S = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'
if S == alpha[::-1]:
    print(-1)
else:
    rest = sorted(list(set(alpha) - set(S)))
    if rest:
        print(S + rest[0])
    else:
        for i in range(len(S)-1, 0, -1):
            if S[i-1] < S[i]:
                break
        rest = sorted([s for s in S[i:] if s > S[i-1]])
        print(S[:i-1] + rest[0])
a, b, k = (int(i) for i in input().split())
takahashi = a - k
aoki = b + takahashi if takahashi < 0 else b
print(f"{max(takahashi, 0)} {max(aoki, 0)}")


### FIXED CODE ###

a, b, k = (int(i) for i in input().split())
takahashi = a - k
aoki = b + takahashi if takahashi < 0 else b
print("{} {}".format(max(takahashi, 0), max(aoki, 0)))
card = [list(map(int, input().split())) for i in range(3)]
N = int(input())
 
bingo = [[0 for i in range(3)] for j in range(3)]
 
for i in range(N):
  	key = int(input())
    for j in range(3):
        for k in range(3):
            if card[j][k] == key:
                bingo[j][k] += 1
 
for i in range(3):
    if bingo[0][i] * bingo[1][i] * bingo[2][i] > 0:
        print('Yes')
        exit()
for i in range(3):
    if bingo[i][0] * bingo[i][1] * bingo[i][2] > 0:
        print('Yes')
        exit()
if bingo[0][0] * bingo[1][1] * bingo[2][2] > 0:
    print('Yes')
    exit()
if bingo[0][2] * bingo[1][1] * bingo[2][0] > 0:
    print('Yes')
    exit()
print('No')

### FIXED CODE ###

import math
n = int(input())

print(math.ceil(n/2))
import math
A,B,H,M=map(int,input().split())

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<180:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=(180-abs(360*i-abs(30*H+int(M/2)-6*M)))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

### FIXED CODE ###

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

for i in range(10):
    if 0<=abs(360*i-abs(30*H+(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+(M/2)-6*M))
        c=abs(360-abs(360*i-abs(30*H+(M/2)-6*M)))
        break
b=min(a,c)

print("{:.9f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))
n = int(input())
color = [-1] * n
neighbor = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v, w = tuple(map(int, input().split()))
    neighbor[u - 1].append((v-1, w))
    neighbor[v - 1].append((u-1, w))
def col(u, c):
    print(u, c)
    color[u] = c
    for v, w in neighbor[u]:
        if color[v] < 0:
            col(v, (c + w) % 2)
col(0, 0)
for i in range(n):
    print(color[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5)
n = int(input())
color = [-1] * n
neighbor = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v, w = tuple(map(int, input().split()))
    neighbor[u - 1].append((v-1, w))
    neighbor[v - 1].append((u-1, w))
def col(u, c):
    color[u] = c
    for v, w in neighbor[u]:
        if color[v] < 0:
            col(v, (c + w) % 2)
col(0, 0)
for i in range(n):
    print(color[i])