Harryxun/stf_run huggingface dataset:
def swap(x):
    s = len(x)//2
    out = []
    if s>=1:
        for i in range(s):
            out.append([x[i][0],x[-1-i][1]])
            out.append([x[-1-i][0],x[i][1]])
        if len(x)%2==1:
            out.append([x[s][0],x[s][1]])
    else:
        out.append(x[0])
    return out

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

if K == 1:
    for i in range(N):
        print(K+i,K+2*N-i-1,K+2*N+i)
elif K <= (N+1)/2:
    ans=[]
    for i in range(N):
        ans.append([K+i,K+2*N-i-1])
    if N%2 == 0:
        s=N//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:-1]
        ans_3 = ans[-1]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new + ans_3
    else:
        s=(N-1)//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new
    ans = []
    for elem in ans_new:
        ans.append([elem[0],elem[1],elem[0]+elem[1]])
    ans = sorted(ans, key=lambda x: x[2])
    for i in range(N):
        ans[i][2] = K + 2*N + i
        print(ans[i][0],ans[i][1],ans[i][2])
else:
    print(-1)

### FIXED CODE ###

def swap(x):
    s = len(x)//2
    out = []
    if s>=1:
        for i in range(s):
            out.append([x[i][0],x[-1-i][1]])
            out.append([x[-1-i][0],x[i][1]])
        if len(x)%2==1:
            out.append([x[s][0],x[s][1]])
    else:
        out.append(x[0])
    return out

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

if K == 1:
    for i in range(N):
        print(K+i,K+2*N-i-1,K+2*N+i)
elif K <= (N+1)/2:
    ans=[]
    for i in range(N):
        ans.append([K+i,K+2*N-i-1])
    if N%2 == 0:
        s=N//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:-1]
        ans_3 = ans[-1]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new + [ans_3]
    else:
        s=(N-1)//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new
    ans = []
    for elem in ans_new:
        ans.append([elem[0],elem[1],elem[0]+elem[1]])
    ans = sorted(ans, key=lambda x: x[2])
    for i in range(N):
        ans[i][2] = K + 2*N + i
        print(ans[i][0],ans[i][1],ans[i][2])
else:
    print(-1)
import sys

s = input()
k = int(input())
cnt  = 0
ans  = 0
while True:
    if cnt == len(s)-1:
        print("1")
        sys.exit(1)
    if s[cnt] != '1':
        print("{}".format(s[cnt]))
        sys.exit(1)
    cnt += 1

### FIXED CODE ###

s = input()
k = int(input())
ans  = True
for i in range(k):
    if s[i] != '1':
        print(s[i])
        ans = False
        break
if ans:
    print(1)
s = list(input())
l, r = 0, len(s) - 1
ans = 0
while l != r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    else:
        if s[l] == "x":
            l += 1
            ans += 1
        elif s[r] == "x":
            r -= 1
            ans += 1
        else:
            ans = -1
            break

print(ans)


### FIXED CODE ###

s = list(input())
l, r = 0, len(s) - 1
ans = 0
while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    else:
        if s[l] == "x":
            l += 1
            ans += 1
        elif s[r] == "x":
            r -= 1
            ans += 1
        else:
            ans = -1
            break

print(ans)
import copy

def cost_val(visit_list, P, C):
    maxval = [-10**10] * (len(P) + 1)
    for start_idx in visit_list:
        cost = 0
        now_id = start_idx
        for i in range(len(visit_list)):
            now_id = P[now_id]
            cost += C[now_id]
            maxval[i + 1] = max(maxval[i + 1], cost)
    return maxval[1:len(visit_list) + 1]

def cycles(P):
    cycle_list = []
    visit_list = [False] * len(P)
    for i in range(len(P)):
        if visit_list[i]:
            continue
        now_id = i
        cycle = []
        for j in range(len(P)):
            if visit_list[now_id]:
                break
            cycle.append(now_id)
            visit_list[now_id] = True
            now_id = P[now_id]
        cycle_list.append(cycle)
    return cycle_list

def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))
    cycle_list = cycles(P)
    ans = -10**9
    for cycle in cycle_list:
        maxval = cost_val(cycle, P, C)
        if N >= K:
            ans = max(ans, max(maxval[:K]))
        else:
            ans = max(ans, max(maxval), maxval[-1] * (K // len(cycle)) + max(maxval[:(K % len(cycle))]))
    return ans

if __name__ == '__main__':
    print(main())

### FIXED CODE ###

import copy

def cost_val(visit_list, P, C):
    maxval = [-10**10] * (len(P) + 1)
    for start_idx in visit_list:
        cost = 0
        now_id = start_idx
        for i in range(len(visit_list)):
            now_id = P[now_id]
            cost += C[now_id]
            maxval[i + 1] = max(maxval[i + 1], cost)
    return maxval[1:len(visit_list) + 1]

def cycles(P):
    cycle_list = []
    visit_list = [False] * len(P)
    for i in range(len(P)):
        if visit_list[i]:
            continue
        now_id = i
        cycle = []
        for j in range(len(P)):
            if visit_list[now_id]:
                break
            cycle.append(now_id)
            visit_list[now_id] = True
            now_id = P[now_id]
        cycle_list.append(cycle)
    return cycle_list

def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x) - 1, input().split()))
    C = list(map(int, input().split()))
    cycle_list = cycles(P)
    ans = max(C)
    for cycle in cycle_list:
        maxval = cost_val(cycle, P, C)
        if len(cycle) > K:
            ans = max(ans, max(maxval[:K]))
        else:
            if K % len(cycle) == 0:
                ans = max(ans, max(maxval), max(map(lambda x: x + maxval[-1] * (K // len(cycle) - 1), maxval)), maxval[-1] * (K // len(cycle)))
            else:
                ans = max(ans, max(maxval), max(map(lambda x: x + maxval[-1] * (K // len(cycle) - 1), maxval)), maxval[-1] * (K // len(cycle)) + max(maxval[:(K % len(cycle))]))
    return ans

if __name__ == '__main__':
    print(main())
l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, max(l)):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[k-1])


### FIXED CODE ###

l = []
ans = []
a, b, k = list(map(int, input().split()))
l.append(a)
l.append(b)
i = 1

for i in range(1, min(l) + 1):
    if (a % i) == 0 and (b % i) == 0:
       ans.append(i) 

if len(ans) == 0:
    print(1)
else:
    print(ans[-k])
def solve(s,e):
	res=0
	for i in range(s,e+1):
		res+=train[i][e+1]-train[i][s]
	return res

city,dnum,qnum=map(int,input().split())

train=[[0 for i in range(city+1)] for i in range(city+1)]

for i in range(dnum):
	l,r=map(int,input().split())
	train[l][r]+=1

for i in train:
	tmp=0
	for j in i:
		tmp+=j
		j=tmp
	
querry=[list(map(int,input().split())) for i in range(qnum)]

for q in querry:
	print(solve(*q))

### FIXED CODE ###

def main():
    n, m, Q = map(int, input().split())
    Train= [[0 for _ in range(n)] for _ in range(n)]
    
    for i in range(m):
        l, r = map(int, input().split())
        l, r = l - 1, r - 1
        Train[l][r] += 1
    
    P_Train = [[0 for _ in range(n)] for _ in range(n)]
    for i in range(n):
        tmp = 0
        for j in range(n):
            tmp += Train[i][j]
            P_Train[i][j] = tmp

    for i in range(Q):
        p, q = map(int, input().split())
        p, q = p - 1, q - 1
        ans = solve(P_Train, n, p, q)
        print(ans)

def solve(P_Train, n, p, q):
    ans = 0
    for i in range(p, q + 1):
        if  p - 1 < 0:
            ans += P_Train[i][q]
        else:
            ans += P_Train[i][q] - P_Train[i][p - 1]
    return ans


if __name__ == '__main__':
    main()
s = str(input())
s = sorted([s[i] for i in range(len(s))])
t = str(input())
t = sorted([t[i] for i in range(len(t))],reverse=True)

if len(t) < len(s):
    for i in range(len(t)):
        if s[i] == t[i]:
            i += 1
        if s[i] < t[i]:
            print("Yes")
            exit()
    print("No")
else:
    s = sorted(s,reverse=True)
    for i in range(len(s)):
        if s[i] > t[i]:

            print("No")
            exit()

    print("Yes")

### FIXED CODE ###

s=" ".join(sorted(input()))
t=" ".join(sorted(input(),reverse=True))
if s<t:print("Yes")
else:print("No")
x=input()
otoshi=x.split(" ")
N=int(otoshi[0])
Y=int(otoshi[1])
ten_t=Y//10000

if ten_t>N:
    ansa=-1 
    ansb=-1 
    ansc=-1
elif ten_t==N:
    if Y==100000*N:
        ansa=N
        ansb=0
        ansc=0
    else:
        ansa=-1 
        ansb=-1 
        ansc=-1
elif ten_t<N:
    for i in range(0,ten_t+1):
        ra=Y-10000*(ten_t-i)
        fiv_t=ra//5000
        
        if fiv_t+ten_t-i>N:
            ansa=-1 
            ansb=-1 
            ansc=-1
            break
        elif fiv_t+ten_t-i<=N:
            if ra==5000*(N-ten_t+i):
                ansa=ten_t-i
                ansb=N-ten_t+i
                ansc=0
                break
            else:
                for j in range(0,fiv_t+1):
                    rb=ra-5000*(fiv_t-j)
                    if rb==1000*(N-ten_t+i-fiv_t+j):
                        ansa=ten_t-i
                        ansb=fiv_t-j
                        ansc=N-ten_t+i-fiv_t+j
                        break
    
else:
    ansa=-1 
    ansb=-1 
    ansc=-1
print(ansa,ansb,ansc)                   

### FIXED CODE ###

N,Y=input().split()
n=int(N)
y=int(Y)//1000
p=y-n
s=y//10
t=y//5
i=-1
j=-1
k=-1
fl=False
for X in range(0,s+1):
    for Y in range(0,t+1):
        q=p-(9*X+4*Y)
        if q==0 and X+Y<=n:
            Z=n-X-Y
            i=X
            j=Y
            k=Z
            break
        if fl:
            break
    if fl:
        break
print(i,j,k)
s=str(input())
ans=0
cnt=0
for i in range(len(s)):
  if s[i]=='A' or 'G' or 'C' or 'T':
    cnt++
  else:
    ans=max(ans, cnt)
    cnt=0
print(ans)

### FIXED CODE ###

s=str(input())
ans=0
cnt=0

for i in range(len(s)):
  
  if s[i]=="A" or s[i]== "G" or s[i]== "C" or s[i]== "T":
    cnt=cnt+1
    ans=max(ans, cnt)
    
  else:
    cnt=0
    
print(ans)
a,b,c=input()
print('A'+b[0]+'C')

### FIXED CODE ###

a,b,c=input().split()
print('A'+b[0]+'C')
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 21:02:42 2020

@author: morihiranaoki
"""
import numpy as np
from decimal import Decimal
a, b, c = map(str, input().split())


a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**Decimal("0.5")  + b**Decimal("0.5") < c**Decimal("0.5"):
    print("Yes")
else:
    print("No")


### FIXED CODE ###



from decimal import Decimal
from decimal import *
a, b, c = map(str, input().split())

getcontext().prec = 500

a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

if a**Decimal("0.5")  + b**Decimal("0.5") < c**Decimal("0.5"):
    print("Yes")
else:
    print("No")
x = list(input().split())
print(15-sum(x))

### FIXED CODE ###

x = list(map(int,input().split()))
print(15-sum(x))
n = int(input())
s = str(input())
  
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
f = ''

for in range(len(s)):
    for j in range(26):
        if s[i] == alp[j]:
            f += alp[j]
print(f)

### FIXED CODE ###

n = int(input())
s = input()
for x in s:
    st = (ord(x) +n-65)%26
    print(chr(65+st),end='')
import numpy as np
temp=input().split(" ")
n=int(temp[0])
k=int(temp[1])
k2=2*k
tileb=[[0 for i in range(k2*2)] for j in range(k2*2)]
for i in range(n):
    temp=input().split(" ")
    x=int(temp[0])
    y=int(temp[1])
    c=temp[2]
    tempx=x%(k2)
    if c=='B':  
        tempy=y%(k2)
        
    elif c=='W':  
        tempy=(y+k)%(k2)

    tileb[tempy][tempx]+=1
    tileb[tempy+k2][tempx]+=1
    tileb[tempy][tempx+k2]+=1
    tileb[tempy+k2][tempx+k2]+=1
        

ruisekiwa=[[0 for i in range(k2)] for j in range(k2)]
# for x in range(0,k2):
#     ruisekiwa[0][x]=tileb[0][x]

# ans=0
# for y in range(0,k2*2):
#     for x in range(1,k2*2):
#         tileb[y][x]+=tileb[y][x-1]

# for x in range(0,k2*2):
#     for y in range(1,k2*2):
#         tileb[y][x]+=tileb[y-1][x]

# tileb=np.array(tileb)
# tileb=tileb.cumsum(0)
# tileb=tileb.cumsum(1)
# tileb=list(tileb)
def nijiruisekiwa(x,y,k): #左下(x,y) 長さkの正方形領域の和
    global tileb
    if x==0 and y==0:     
        return tileb[y+k-1][x+k-1]
    if y==0:     
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]
    if x==0:     
        return tileb[y+k-1][x+k-1]-tileb[y-1][x+k-1]
    else:     
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]-tileb[y-1][x+k-1]+tileb[y-1][x-1]

for x in range(0,k2):
    for y in range(0,k2):
        temp=0
        a=nijiruisekiwa(x,y,k)
        b=nijiruisekiwa(x+k,y+k,k)

        temp=a+b
      #  print("temp="+str(temp))

        if temp>ans:
            # print(a)
            # print(b)
            # print("x={0}  y={1}  ".format(x,y))
            ans=temp
print(ans)


### FIXED CODE ###

temp=input().split(" ")
n=int(temp[0])
k=int(temp[1])
k2=2*k
tileb=[[0 for i in range(k2*2)] for j in range(k2*2)]
for i in range(n):
    temp=input().split(" ")
    x=int(temp[0])
    y=int(temp[1])
    c=temp[2]
    tempx=x%(k2)
    if c=='B':  
        tempy=y%(k2)
        
    elif c=='W':  
        tempy=(y+k)%(k2)

    tileb[tempy][tempx]+=1
    tileb[tempy+k2][tempx]+=1
    tileb[tempy][tempx+k2]+=1
    tileb[tempy+k2][tempx+k2]+=1
        
ans=0
for y in range(0,k2*2):
    for x in range(1,k2*2):
        tileb[y][x]+=tileb[y][x-1]

for x in range(0,k2*2):
    for y in range(1,k2*2):
        tileb[y][x]+=tileb[y-1][x]

def nijiruisekiwa(x,y,k): #左下(x,y) 長さkの正方形領域の和
    global tileb
    if x!=0 and y!=0:
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]-tileb[y-1][x+k-1]+tileb[y-1][x-1]
    
    if x==0 and y==0:     
        return tileb[y+k-1][x+k-1]
    if y==0:     
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]
    if x==0:     
        return tileb[y+k-1][x+k-1]-tileb[y-1][x+k-1]
    
for x in range(0,k2):
    for y in range(0,k2):
        temp=0
        a=nijiruisekiwa(x,y,k)
        b=nijiruisekiwa(x+k,y+k,k)

        temp=a+b
      #  print("temp="+str(temp))

        if temp>ans:
            # print(a)
            # print(b)
            # print("x={0}  y={1}  ".format(x,y))
            ans=temp
print(ans)
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**5+10)

n = int(input())
visited = set()
g = {}
idx = {}
color = {}
for i in range(n-1):
    a,b = map(int, input().split())
    idx[i] = (a,b)
    if a not in g:
        g[a] = []
    g[a].append(b)
    if b not in g:
        g[b] = []
    g[b].append(a)

def dfs(v,c):
    cc = 0
    for u in g[v]:
        if u in visited:
            continue
        visited.add(u)

        cc += 1
        while cc==c:
            cc += 1
        a,b = min(u,v),max(u,v)
        color[(a,b)] = cc
        
        dfs(u,cc)
visited.add(1)
dfs(1,0)

print(max(*color.values()))
for i in range(n-1):
    print(color[idx[i]])

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**5+10)

n = int(input())
visited = set()
g = {}
idx = {}
color = {}
for i in range(n-1):
    a,b = map(int, input().split())
    idx[i] = (a,b)
    if a not in g:
        g[a] = []
    g[a].append(b)
    if b not in g:
        g[b] = []
    g[b].append(a)

def dfs(v,c):
    cc = 0
    for u in g[v]:
        if u in visited:
            continue
        visited.add(u)

        cc += 1
        while cc==c:
            cc += 1
        a,b = min(u,v),max(u,v)
        color[(a,b)] = cc
        
        dfs(u,cc)
visited.add(1)
dfs(1,0)

mc = 0
for c in color.values():
    mc = max(mc, c)
print(mc)
for i in range(n-1):
    print(color[idx[i]])
N = int(input())
L = [a for a in map(int,input().split())]
K = max(L)
Power = []
for i in range(1,K):
  add = 0
  for j in range(len(L)):
    add+= (i - L[j])**2
  Power.append(add)
print(min(Power))

  

### FIXED CODE ###

N = int(input())
L = [a for a in map(int,input().split())]
K = max(L)
Power = []
for i in range(1,K+1):
  add = 0
  for j in range(len(L)):
    add+= (i - L[j])**2
  Power.append(add)
print(min(Power))
import math

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


def search(start, end, i, W):
    S1 = sum(W[0:i + 1])
    S2 = sum(W[i + 1:len(W)])

    next_i = math.floor(i / 2) if S1 >= S2 else math.floor((i + end) / 2)

    if S1 == S2: return i
    if S1 > S2:
        next_start = start
        next_end = i
    else:
        next_start = i + 1
        next_end = end
    
    # print(start, next_start, end, next_end, i, next_i, S1, S2)
    if next_start == end: return next_start
    if next_end == start: return next_end
    
    return search(next_start, next_end, next_i, W)


i = search(0, len(W) - 1, math.floor((len(W) - 1) / 2), W)

S1 = sum(W[0:i + 1])
S2 = sum(W[i + 1:len(W)])
diff = abs(S2 - S1)

print(diff)


### FIXED CODE ###

inputted = list(map(int, input().split()))
AB = BA = inputted[0]
BC = CB = inputted[1]
AC = CA = inputted[2]

answer = min([
    AB + BC,
    AC + CB,
    BA + AC,
    BC + CA,
    CA + AB,
    CB + BA,
])

print(answer)
from collections import Counter
import sys
n = int(input())
l = sys.stdin.read().split()
c = counter(l)
m = max(c.values())

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

### FIXED CODE ###

from collections import Counter
import sys
n = int(input())
l = sys.stdin.read().split()
c = Counter(l)
m = max(c.values())

if(m==1):
    print("YES")
else:
    print("NO")
n, a, b = map(int, input().split())

total = 0
for i in range(n+1):
  x = str(i)
  y = 0
  for j in X:
    y += j
    
  if a <= y <= b:
    total += i

print(total)

### FIXED CODE ###

n, a, b = map(int, input().split())
 
total = 0
for i in range(n+1):
  x = str(i)
  y = 0
  for j in x:
    y += int(j)
  if a <= y <= b:
    total += i
print(total)
from sys import stdin
def ch_max(dp_i, dp_i_1):
    if dp_i < dp_i_1:
        dp_i = dp_i_1
    return dp_i
def chmin(dp_i, dp_i_1):
    if dp_i > dp_i_1:
        dp_i = dp_i_1
    return dp_i
n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]

if n == 2:
    print(abs(h[0] - h[1]))
    exit()
dp = []
dp1[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(n - 2):
    dp[i + 2] = float('inf')
    dp[i + 2] = chmin(dp[i + 2],dp[i + 1] + abs(h[i + 2] - h[i + 1]))
    dp[i + 2] = chmin(dp[i + 2],dp[i] + abs(h[i + 2] - h[i]))
print(dp[n - 1])



### FIXED CODE ###

from sys import stdin
def ch_max(dp_i, dp_i_1):
    if dp_i < dp_i_1:
        dp_i = dp_i_1
    return dp_i
def chmin(dp_i, dp_i_1):
    if dp_i > dp_i_1:
        dp_i = dp_i_1
    return dp_i
n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]

if n == 2:
    print(abs(h[0] - h[1]))
    exit()
dp = [float('inf')] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(n - 2):
    dp[i + 2] = chmin(dp[i + 2],dp[i + 1] + abs(h[i + 2] - h[i + 1]))
    dp[i + 2] = chmin(dp[i + 2],dp[i] + abs(h[i + 2] - h[i]))
print(dp[n - 1])
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper && flag != 0:
    flag = 2
  if num == 0:
    flag = 0
if flag == 2:
  print(-1)
else:
  print(sum * flag)

### FIXED CODE ###

n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  if flag == 1:
    sum = sum * num
    if sum > upper:
      flag = 2
  if num == 0:
    flag = 0
    break
if flag == 2:
  print(-1)
else:
  print(sum * flag)
n = input()
b = input()
if n[0] == "1":
    print(n[1])
else:
    print(n[0])

### FIXED CODE ###

n = input()
b = int(input())
lenn = len(n)
count = 0
for i in range(lenn):
    if n[i] == "1":
        count += 1
    else:
        break
if count >= b:
    print(1)
else:
    print(n[count])
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    ans = (x * y)//math.gcd(x, y)
    return ans
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

### FIXED CODE ###

import math
N = int(input())
T = []

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

for i in range(N):
    T.append(int(input()))

    

if len(T) > 2:
    g = lcm(T[0],T[1])
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
elif len(T) == 2:
    g = lcm(T[0],T[1])
    print(g)
else:
    print(T[0])
#coding:utf-8
n,k=map(int, input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))

### FIXED CODE ###

#coding:utf-8
d=int(input())
if d==25:
	print("Christmas")
elif d==24:
	print("Christmas Eve")
elif d==23:
	print("Christmas Eve Eve")
elif d==22:
	print("Christmas Eve Eve Eve")
else:
	print("")
N=int(input())

a=0
if N>81:
  print('No')
elif N<1:
  print('No')
else:
  for i in range(1,9):
    if N%i==0:
      if N/i<=9:
	    print('Yes')
      	a=1
      	break
  if a==0:
    print('No')

### FIXED CODE ###

N=int(input())

a=0
if N>81:
  print('No')
elif N<1:
  print('No')
else:
  for i in range(1,10):
    if N%i==0:
      if N/i<=9:
          print('Yes')
          a=1
          break
  if a==0:
    print('No')
n, m = list(map(int, input().split()))

counter = 0
c = [-1 for i in range(n)]
p = [[] for n in range(n)]

for i in range(m):
    x, y, z = list(map(int, input().split()))
    x -= 1
    y -= 1
    p[x].append(y)
    p[y].append(x)

def dfs(num, depth):
    if c[num] != -1:
        return
    else:
        c[num] = depth
    for i in p[num]:
        dfs(i, depth)

for i in range(n):
    if c[i] == -1:
        counter += 1
        dfs(i, counter)

print(max(c))

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

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

counter = 0
c = [-1 for i in range(n)]
p = [[] for n in range(n)]

for i in range(m):
    x, y, z = list(map(int, input().split()))
    x -= 1
    y -= 1
    p[x].append(y)
    p[y].append(x)

def dfs(num, depth):
    if c[num] != -1:
        return
    else:
        c[num] = depth
    for i in p[num]:
        dfs(i, depth)

for i in range(n):
    if c[i] == -1:
        counter += 1
        dfs(i, counter)

print(max(c))
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a.sort()
D = [[a[i+j-k] for j in range(k)] for i in range(-k,k)]
A = (functools.reduce(operator.mul,D[_]) for _ in range(len(D)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
x, n = map(int, input().split())
p = list(map(int, input().split()))
np = [x for x in range(102) if x not in p]
mnd = 103
mnv = 103
for i in np:
  if abs(i - x) < mn:
    mnv = i
    mnd = abs(i - x)
print(mnv)

### FIXED CODE ###

x,n = map(int, input().split())
p = list(map(int, input().split()))
for i in range(101):
  if (x - i) not in p:
    print(x - i)
    break
  elif (x + i) not in p:
    print(x + i)
    break