Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())
edges=[[] for i in range(N)]
for i in range(M):
  a,b = map(int,input().split())
  edges[a-1]+=[b-1]
  edges[b-1]+=[a-1]
#print(edges)
ans=0
#奇数へいろを検出する0から(N//2)*2+1ステップ進んだ時, 0に戻れたらアウト
m=(N//2)*2+1
plist=[[] for i in range(m+1)]
plist[0]=[0]
for i in range(m):#iはステップ数
  for label in plist[i]:
    plist[i+1]+=edges[label]
  plist[i+1]=list(set(plist[i+1]))
print(plist,plist[m])
if 0 in plist[m]:
  print((N*(N-1))//2-M)#奇数要素の閉路があった場合は全ての頂点を結べる. 
else:
  if N%2==0:
    n=N//2
    print(n,n*(n-1)-M)
  else:
    n1=N//2
    n2=N//2+1
    print(n1,n2)
    print((n1*(n1-1))//2+(n2*(n2-1))//2-M)

### FIXED CODE ###

s=str(input())
N=len(s)
print(s[:N-8])
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()))

ab=[]
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort()
aa=[]
for i in range(k):
    if x*y-i>=0:
        aa.append(ab[x*y-i])
ans=[]
for i in range(len(aa)):
    for j in range(z):
        ans.append(aa[i]+c[j])
ans.sort()
for i in range(k):
    print(ans[len(ans)-i]
        

### FIXED CODE ###

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()))

ab=[]
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort()
aa=[]
for i in range(k):
    if x*y-i-1>=0:
        aa.append(ab[x*y-i-1])
ans=[]
for i in range(len(aa)):
    for j in range(z):
        ans.append(aa[i]+c[j])
ans.sort()
for i in range(k):
    print(ans[len(ans)-i-1])
n,k = map(int,input().split())

m=abs(n-k)

mm=k%m

if k == 1:
    ans = 0
elif k >= mm:
    ans = mm
else:
    ans = k

print(str(ans))

### FIXED CODE ###

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

mm=n%k
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))
n, m = map(int, raw_input().split())

if n > m: swap(n, m)

if n == 1:
	if m == 1:
		print 1
	else:
		print m - 2 
	exit(0)

black = (n - 2) * (m - 2)
print black

### FIXED CODE ###

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

if n > m: 
	a = n
	n = m
	m = a

if n == 1:
	if m == 1:
		print 1
	else:
		print m - 2 
	exit(0)

black = (n - 2) * (m - 2)
print black
s = input()
N = int(input())
l = len(s)
li=list(set(s))
li.sort()
result=[]

if len(li)>5:
    a=5
else:
    a=l-1
for i in range(a):
    indexx=[f for f,x in enumerate(s) if x==s[i]]
    for index in indexx:
        for scope in range(1,l+1):
            if not s[index:index+scope] in result:
                result.append(s[index:index+scope])
                result.sort()


print(result)
print(result[N-1])

### FIXED CODE ###

str=input()
K=int(input())
s=set()
for scope in range(1,K+1):
    for f in range(len(str)-scope+1):
        s.add(str[f:f+scope])
print(sorted([x for x in s])[K-1])
p, q = map(int, input().split())
 
def lcm(a, b):
    return (a * b) // math.gcd(a, b)


print(lcm(p, q))

### FIXED CODE ###

p, q = map(int, input().split())
import fractions
 
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

print(lcm(p, q))
import bisect

N,M,K=map(int,inp().split())
list_a=list(map(int,inp().split()))
list_b=list(map(int,inp().split()))


totaltame_a=[0]
for a in list_a:
    temp_a=totaltame_a[-1]+a
    if temp_a>K:
        break
    else:
        totaltame_a.append(temp_a)


totaltime_b=[0]
for b in list_b:
    totaltime_b.append(totaltime_b[-1]+b)

ans=0

for i in range (len(totaltame_a)):
    Kb=K-totaltame_a[i]
    j=bisect.bisect_right(totaltime_b,Kb)-1
    if i+j>ans:
        ans=i+j
    else:
        pass

print(ans)

### FIXED CODE ###

import bisect


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

# print(K)
# print(a)
# print(b)
# N,M=3,4
# K=240
# a=[60, 90, 120]
# b=[80, 150, 80, 150]

ans=0

accum_a=[0]
for i in a:
    _a=accum_a[-1]+i
    if _a>K:
        break
    else:
        accum_a.append(_a)
accum_a.append(K)

accum_b=[0]
for i in b:
    accum_b.append(accum_b[-1]+i)

ans=0

for j in range (len(accum_a)-1):
    Kb=K-accum_a[j]
    bookB=bisect.bisect_right(accum_b,Kb)-1
    if j+bookB>ans:
        ans=j+bookB
    else:
        pass

print(ans)
import sys

def biser(lst,func):
    n=len(lst)
    nh=n//2
    if n==1:
        if func(lst[0]):
            return lst[0]
        else:
            return -1
    if func(lst[nh]):
        return biser(lst[nh:],func)
    else:
        return biser(lst[:nh],func)

def mkns(a,s,m):
    if a==0:
        return s
    else:
        return (((s+1)<<a)|s) & m

def main():
    N,K=map(int,sys.stdin.readline().strip().split())
    a=list(map(int,sys.stdin.readline().strip().split()))
    a.sort()
    ss=[0]*(N+1)
    pm=(1<<K)-1
    mask=lambda c:(1<<K)-(1<<c)
    nn=0
    def isunnec(i):
        if a[i]>=K:
            return False
        for j in range(i+1,N):
            if a[j]>=K:
                break
            ss[i]=(((ss[i]+1)<<a[j])|ss[i]) & pm
        # print(bin(ss[i]), bin(mask(K-c)),ss[i]&mask(K-c))
        if ss[i]&mask(K-a[i])==0:
            return True
        return False
    
    # for i in range(N):
    #      if a[i]>=K:
    #          break
    #      ss[i+1]=(((ss[i]+1)<<a[i])|ss[i]) & pm
    #      if isunnec(i):
    #          nn+=1
        # for j in range(i+1,N):
        #     if a[j]>=K:
        #         break
        #     ss[i]=mkns(a[j],ss[i],pm)
        # # print(bin(ss[i]), bin(mask(K-c)),ss[i]&mask(K-c))
        # if ss[i]&mask(K-a[i])==0:
        #     nn+=1
    m=len(list(filter(lambda x:x<K, a)))
    nn=biser(list(range(m)),isunnec)+1
    # print(list(map(bin,ss)))
    print(nn)

if __name__=='__main__':
    main()


### FIXED CODE ###

#4 9
#1 3 5 6
#の時に1（正解は0）と出力されるがACになる

N, K = map(int, input().split())
a=list(map(int, input().split()))
a.sort()
ans = N
t = 0
for i in range(N-1, -1, -1) :
  if t+a[i] < K:
    t += a[i]
  else:
    ans = min(ans, i)
print(ans)
m,a,r,c,h = [0,0,0,0,0]
N = int(input())

for i in range(N):


### FIXED CODE ###

m, a, r, c, h = [0] * 5

N = int(input())

for _ in range(N):
    s = input()[0]

    if s == 'M':
        m += 1
    elif s == 'A':
        a += 1
    elif s == 'R':
        r += 1
    elif s == 'C':
        c += 1
    elif s == 'H':
        h += 1
print(m * a * r + 
      m * a * c +
      m * a * h + 
      m * r * c + 
      m * r * h + 
      m * c * h + 
      a * r * c + 
      a * r * h +
      a * c * h +
      r * c * h)
n, q = list(map(int, input().split()))
cnt = [0 for _ in range(n + 1)]
cnt[0] = -1
mx = [0, -1]
for _ in range(q):
    a, v = list(map(int, input().split()))
    cnt[a] += v
    if mx[0] == a and v > 0:
        mx[1] += v
    elif mx[0] == a and v < 0:

        def spam():
            max_v = max(cnt)
            idx = min([i for i, value in enumerate(cnt) if value == max_v])
            return idx, max_v

        mx = spam()

    if cnt[a] > mx[1]:
        print("%d %d" % (a, cnt[a]))
        mx[0], mx[1] = a, cnt[a]
    else:
        print("%d %d" % (mx[0], mx[1]))

### FIXED CODE ###

n, q = list(map(int, input().split()))
cnt = [0 for _ in range(n + 1)]
cnt[0] = -9999999999
mx = [0, cnt[0]]


def spam():
    max_v = max(cnt)
    idx = min([i for i, value in enumerate(cnt) if value == max_v])
    return idx, max_v

for _ in range(q):
    a, v = list(map(int, input().split()))
    cnt[a] += v
    if mx[0] == a and v > 0:
        mx[1] += v

    elif mx[0] == a:
        mx[0], mx[1] = spam()

    elif mx[1] < cnt[a]:
        mx[0], mx[1] = a, cnt[a]

    elif mx[1] == cnt[a] and mx[0] > a:
        mx[0], mx[1] = a, cnt[a]

    print("%d %d" % (mx[0], mx[1]))
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
inx = p[0][0]
for i in range(m):
	if not p[i][0] in box:
		if p[i][1] == 'AC':
				box.append(inx)
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

### FIXED CODE ###

n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
ac =[0]*(n+1)
wa =[0]*(n+1)
for i in range(m):
    question =int(p[i][0])
    if p[i][1] == "AC" and ac[question] == 0:
        ac[question] = 1
    elif p[i][1] == "WA" and ac[question] == 0:
        wa[question] += 1
for j in range(n+1):
    if ac[j] == 0:
        wa[j] = 0
       # print(wa)
print(sum(ac),sum(wa))
n = int(intput())
res = n // 2
if res % 2 == 1:
  res += 1
print(res)

### FIXED CODE ###

n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)
#A = input('Aを入力してください')
#B = input('Bを入力してください')
#K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

S = input()

A = S[0]
B = S[1]
K = S[2]

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])


### FIXED CODE ###

import sys

#A = input('Aを入力してください')
#B = input('Bを入力してください')
#K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

#S = input('ABKを入力してください')
S = input()
S = S.split(' ')

#for i in range(len(S)):
#    print(S[i])

#sys.exit()

A = int(S[0])
B = int(S[1])
K = int(S[2])

ANS = []
for i in range(K):
    if A + i <= B:
        ANS.append(A + i)


for j in range(K):
    if B - j not in ANS and B - j >= A:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])
import sys
input = sys.stdin.readline
n = int(input())
h = list(map(int, input().split()))
if n == 1:
    print(h[0])
else:
    ans = h[0]
    for i in range(1, n):
        if h[i] > h[i-1]:
            ans += h[i] - h[i-1]
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
h = list(map(int, input().split()))
if n == 1:
    print(h[0])
else:
    ans = h[0]
    for i in range(1, n):
        if h[i] > h[i-1]:
            ans += h[i] - h[i-1]
    print(ans)
S = input()
flag = True
while(flag):
    if(len(s)==0):
        flag = False
    if s[-5:] == 'dream' or s[-5:] == 'erase':
        s = s[:-5]
    elif s[-6:]== 'eraser':
        s = s[:-6]
    elif s[-7:0]=='dreamer':
        s = s[:-7]
    else:
        break
if(flag):
    print('NO')
else:
    print('YES')
    

### FIXED CODE ###

S = input()
flag = True
while(flag):
    if(len(S)==0):
        flag = False
    if(S[-5:]=='dream' or S[-5:]=='erase'):
        S=S[:-5]
    elif(S[-6:]=='eraser'):
        S=S[:-6]
    elif(S[-7:]=='dreamer'):
        S=S[:-7]
    else:
        break
if(flag):
    print('NO')
else:
    print('YES')
#反省点
A,B=[int(s) for s in input().split(" ")]
N1list=[]
N2list=[]

for i in range(0,10,1):
    N1list.append((A+(i/10))/0.08)   
    N2list.append((B+(i/10))/0.1)

N3=-2
N1list.sort(reverse=True)
N2list.sort(reverse=True)

for i in range(len(N1list)+1):
    N=N1list[i]
    if N==int(N):
        for j in range(len(N2list)+1):
            if N==N2list[j]:
                N3=N
                break
    else:
        N4=-1

print(int(N3) if N4<N3 else N4)

### FIXED CODE ###

import math
A,B=[int(s) for s in input().split(" ")]
list=[]
for i in range(1010):
    if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
            list.append(i)
list.sort()

print(-1 if list==[] else list[0])
# A - Placing Marbles
# coding: utf-8

s1, s2 ,s3 = map(int, raw_input().split())
s = [s1, s2, s3]

print s.count(1)

### FIXED CODE ###

# A - Placing Marbles
# coding: utf-8

s1, s2 ,s3 = map(int, raw_input())
s = [s1, s2, s3]

print s.count(1)
l,r = map(int,input().split())

if r -l >= 2019:
    print(0)
else:
    res = 2018
    for i in range(l,r+1):
        for j in range(1,r+1):
            if i<j:
                res = min(res,(i*j)%2019)
print(res)

### FIXED CODE ###

l,r = map(int,input().split())

if r -l >= 2019:
    print(0)
else:
    res = 2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            res = min(res,(i*j)%2019)
    print(res)
def main():
  H, N = (int(_) for _ in input().split())
  A = [[int(_) for _ in input().split()] for __ in range(N)]
  INF = 10 ** 15
  dp = [[INF] * (H + 1) for _ in range(N+1)]
  dp[0][0] = 0
  for i in range(N):
    for j in range(H+1):
      dp[i+1][j] = min(dp[i+1][j], dp[i][j])
      if A[i][0] <= j < H:
        dp[i+1][j] = min(dp[i+1][j], A[i][1] + dp[i+1][j-A[i][0]])
      elif j == H:
        for k in range(j - A[i][0], j):
          dp[i+1][j] = min(dp[i+1][j], A[i][1] + dp[i+1][k])
  print(dp[N][H])
  return

if __name__ == '__main__':
  main()

### FIXED CODE ###

def main():
  H, N = (int(_) for _ in input().split())
  A = [[int(_) for _ in input().split()] for __ in range(N)]
  INF = 10 ** 15
  dp = [[INF] * (H + 1) for _ in range(N+1)]
  dp[0][0] = 0
  for i in range(N):
    for j in range(H+1):
      dp[i+1][j] = min(dp[i+1][j], dp[i][j])
      if A[i][0] <= j < H:
        dp[i+1][j] = min(dp[i+1][j], A[i][1] + dp[i+1][j-A[i][0]])
      elif j == H:
        for k in range(max(j - A[i][0], 0), j):
          dp[i+1][j] = min(dp[i+1][j], A[i][1] + dp[i+1][k])
  print(dp[N][H])
  return

if __name__ == '__main__':
  main()
a,b,c = map(input().split(","))
print(A,b,c)

### FIXED CODE ###

a,b,c = input().split(",")
print(a,b,c)
h,w=map(int,input().split())
grid=[["#"]*(w+2)]+[list("#"+input()+"#") for x in range(h)]+[["#"]*(w+2)]

g=0
x=1
y=1
lock=[]
while 1:
    for x in range(1,h+1):
        for y in range(1,w+1):
            if (y,x) in lock:
                continue
            if grid[y][x]=='#':
                for i,j in([0,1],[1,0],[0,-1],[-1,0]):
                    if grid[y+i][x+j]=="#":
                        continue
                    grid[y+i][x+j]="#"
                    lock.append((y+i,x+j))
    g+=1
    lock=[]
                    
    if all(all(j=="#" for j in i)for i in grid):
        print(g)
        exit()


### FIXED CODE ###

from heapq import*
h,w=map(int,input().split())
grid=[["#"]*(w+2)]+[list("#"+input()+"#")for x in range(h)]+[["#"]*(w+2)]

stack=[]
for y in range(1,h+1):
    for x in range(1,w+1):
        if grid[y][x]=="#":
            grid[y][x]=0
            stack.append((y,x))

for i in range(h*w):
    tmp=[]
    for my,mx in stack:
        for y,x in ([0,1],[1,0],[-1,0],[0,-1]):
            if grid[my+y][mx+x]==".":
                grid[my+y][mx+x]=i+1
                tmp.append([my+y,mx+x])
    stack=tmp
    if len(tmp)==0:
        print(i)
        break
N, K = map(int, input().split())
X = list(map(int, input().split()))

answer = []
for i in range(N):
  if i + K > N:
    break
  Y = X[i:i+K]
  if Y[0] > 0:
    answer.append(Y[-1])
  elif Y[-1] < 0:
    answer.append(-Y[0])
  else:
    answer.append(min(Y[0]*(-2)+Y[-1], Y[-1]*2-Y[0]))

print(min(answer)

### FIXED CODE ###

N,K=map(int,input().split())
x=list(map(int,input().split()))

tmp=10**10
for i in range(N-K+1):
  if x[i]*x[i+K-1]<0:
    tmp=min(tmp,min(abs(x[i]),abs(x[i+K-1]))*2+max(abs(x[i]),abs(x[i+K-1])))
  else:
    tmp=min(tmp,max(abs(x[i]),abs(x[i+K-1])))
print(tmp)
N = int(intput())
print(N*(N-1)//2)

### FIXED CODE ###

N = int(input())
print(N * (N-1) // 2)
S=input()
T=input()
U=T+S
Print(U)


### FIXED CODE ###

S=list(input().split())
print(S[1]+S[0])
c1 = input()
c2 = input()
c3 = input()

print(c1[1]+c2[2]+c3[3])

### FIXED CODE ###

c1 = input()
c2 = input()
c3 = input()
 
print(c1[0]+c2[1]+c3[2])
h, w = map(int, input().split())
s = [['.']*(w+2)]
s = s + [['.']+list(input())+[','] for _ in range(w)]
s = s + [['.']*(w+2)]
a = True
for i in range(1, w+1):
    for j in range(1, w+1):
        if s[i][j] == '#':
           up = s[i-1][j]
           left = s[i][j-1]
           right = s[i][j+1]
           down = s[i+1][j]
           if up == '.' and left == '.' and right == '.' and down == '.':
               a = False
if a ==True:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]
 
flag = False
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if (j-1 >= 0 and s[i][j-1] == '.') and (j+1 < W and s[i][j+1] == '.') and (i-1 >= 0 and s[i-1][j] == '.') and (i+1 < H and s[i+1][j] == '.'):
                print('No')
                flag = True
                break
    if flag:
        break
else:
    print('Yes')
N, K = map(int, input().split())
Ss = input()
 
num = Ss.count('RL')*2
if list(Ss)[-1]=='L':
  num += 1
if list(Ss)[0]=='L':
  num += 1
ans = N - max(1, num-2*K)
print(ans)

### FIXED CODE ###

N = int(input())
print(N**3)
MOD = 1000000007
def fast_power(base, power):
    """
    Returns the result of a^b i.e. a**b
    We assume that a >= 1 and b >= 0

    Remember two things!
     - Divide power by 2 and multiply base to itself (if the power is even)
     - Decrement power by 1 to make it even and then follow the first step
    """

    result = 1
    while power > 0:
        # If power is odd
        if power % 2 == 1:
            result = (result * base) % MOD

        # Divide the power by 2
        power = power / 2
        # Multiply base to itself
        base = (base * base) % MOD

    return result


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

tyo = 5e15

char = [int(ss) for ss in s]

res = 0

_sum = 0
ok = 0

for i in range(k):
    _sum = _sum + (fast_power(int(s[i]), tyo))
    if _sum >= k and ok == 0:
        res = s[i]
        ok = 1

# for num in char:
#     _sum = _sum + (fast_power(num, tyo))
#     if _sum >= k and ok == 0:
#         res = num
#         ok = 1

print(res)


### FIXED CODE ###

from math import pow
s = input()
k = int(input())

char = [ss for ss in s]


res = '1'

_sum = 0
for i in range(k):
    if s[i] != '1':
        res = s[i]
        break

print(res)
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    H = math.ceil(N/4)
    for h in range(H, 3501):
        if flag == True:
            break
        
        N_ = math.ceil((N*h)/(h*4-N)) 
        for n in range(N_, 3501):
            if flag == True:
                break
            
            
            if (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
            

### FIXED CODE ###

import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    
    for h in range(1, 3501):
        if flag == True:
            break
        
        for n in range(1, 3501):
            if flag == True:
                break
            
            if ((n*(h*4-N)-N*h) > 0) and (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
n,m,x = map(int,input().split())

ca=[list(map(int,input().split())) for _ in range(n)]

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc=+ca[j][0]
      a+=ca[j][1:]
  if min(a)>=x:
    res=min (sc,res)

if res == INF:
    print(-1)
else:
    print(res)


### FIXED CODE ###

n,m,x = map(int,input().split())

ca=[list(map(int,input().split())) for _ in range(n)]

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc+=ca[j][0]
      for k in range(m):
        a[k]+=ca[j][k+1]
  if min(a)>=x:
    res=min(sc,res)

if res == float('inf'):
    print(-1)
else:
    print(res)
import math
from goto import goto, label

X = int(input())
max = 10 ** 5

for i in range(X,max):
    sqt = math.sqrt(i)
    for j in range(1, math.ceil(sqt)):
        cal = i % j
        if cal == 0:
            print(i)
            goto .END
label .END


### FIXED CODE ###

import math
X = int(input())
key = 0

def prim(N):
    sqt = int(math.sqrt(N))
    for i in range(2,sqt+1):
        if N%i == 0:
            return False
    return True

while key == 0:
    if prim(X):
        key = 1
        break
    X += 1

print(X)
import math
import fractions
import numpy as np
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0

for a in range(1,K+1) :
    for b in range(1,K+1) :
        for c in range(1,K+1) :
           X = fractions.gcd(a, b)
           Y = fractions.gcd(X, c)
           ans += Y

print(ans)

### FIXED CODE ###

from math import gcd

K = int(input())

ans = 0

for a in range(1,K+1) :
    for b in range(1,K+1) :
        X = gcd(a, b)
        for c in range(1,K+1) :
           Y = gcd(X, c)
           ans += Y

print(ans)
size = 101
n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
ans = None
for i in range(size):
  for j in range(size):
    # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
    max_h = None
    succ = True
    for x, y, h in points:
      tmp = abs(i-x) + abs(j-y) + h
      if max_h == None:
        max_h = tmp
        continue
      else:
        if max_h != tmp:
          succ = False
          break
    if succ:
      ans = (i, j, max_h)
      break
  if succ: break
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

### FIXED CODE ###

def solve():
  size = 101
  n = int(input())
  points = []
  for _ in range(n):
    x, y, h = map(int, input().split())
    # h=0の点はスキップ ←勾配がないので高さ計算に使えない
    if h == 0: continue
    else: points.append((x, y, h))

  if len(points) == 1:
    # 必ず頂上が1つに定まる制約なので、測定点が1つしかなければそれが答え
    ans = points[0]
    return ans

  ans = (-1, -1, -1)
  for i in range(size):
    for j in range(size):
      # 高いほうに持ち上げるよう試みて、整合性とれなければ却下
      max_h = None
      succ = True
      for x, y, h in points:
        tmp = abs(i-x) + abs(j-y) + h
        if max_h == None:
          max_h = tmp
          continue
        else:
          if max_h != tmp:
            succ = False
            break
      # 成り立っているなかでの最高点を更新していく
      if succ:
        if ans[2] < max_h:
          ans = (i, j, max_h)
  # すべて終了
  return ans

ans = solve()
print('{} {} {}'.format(ans[0], ans[1], ans[2]))
i=input;s=split;n,k=i().s();l=[int(_) for _ in i().s()];c=0
for _ in l:
  if _>int(~-k):
    c+=1
print(c)

### FIXED CODE ###

i=input;n,k=i().split();l=[int(_) for _ in i().split()];c=0
for _ in l:
  if _>=int(k):
    c+=1
print(c)
D,T,S = (int(x) for x in input().split())

disable = D - T*S

if disable>0:
    print("No")
else 
    print("Yes")

### FIXED CODE ###

D,T,S = (int(x) for x in input().split())

disable = D - T*S

if disable>0:
    print("No")
else:
    print("Yes")
import math

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

A=sorted(A)
maxA=max(A)
limit=math.ceil(maxA/2)
comb=min(A)
for i in range(N):
    if(limit<A[i]):
        if(abs(limit-A[i+1])<abs(limit-A[i])):
            comb=A[i+1]
        break
    comb=A[i]

print(maxA,comb)

### FIXED CODE ###

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

A=sorted(A)
maxA=max(A)
limit=maxA/2
tmp=10**9
for i in range(N):
    if(abs(limit-A[i])<tmp):
        tmp=abs(limit-A[i])
        comb=A[i]
    else:
        break

print(maxA,comb)