Harryxun/stf_run huggingface dataset:
import math
N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))


if len(z_list)==1:
    print(z_list[0])
else:
    out=math.gcd(z_list[0], z_list[1])
    if len(z_list)>=3:
        for i in range(len(z_list)-3):
            out=math.gcd(out, z_list[i+2])
    print(out)


### FIXED CODE ###

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z


N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])

else:
    for i in range(len(z_list)-1):
        z_list[i+1]=gcd(z_list[i],z_list[i+1])
    print(z_list[-1])
n = int(input())
print((n*2) if n%2 == o else n)

### FIXED CODE ###

n = int(input())
print(n if n%2 == 0 else n*2)
a= int(input())
print(a+a**2+a**3)

### FIXED CODE ###

S = str(input())
T = str(input())
length =len(S)
listS=list(S)
listT=list(T)
num = len(T)
res = 0
for i in range(length):
    if (listS[num-1] != listT[num-1]):
        res +=1
    num -=1
print(res)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)

### FIXED CODE ###

N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<=K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)
n,k=map(int,input().split())
if k==1:
    print(0)
    exit()

def gcd(x,y):
    if x==y:
        return x
    elif x>y:
        r=-1
        while r!=0:
            r=x%y
            x=y
            y=r
        return x
    else:
        r=-1
        while r!=0:
            r=y%x
            y=x
            x=r
        return y

print(gcd(n,k))


### FIXED CODE ###

n,k=map(int,input().split())
if k==1:
    print(0)
    exit()
x=n%k
print(min(x,k-x))
import math
a, b, n = map(int, input().split())
if n < b:
    x = n
elif b < n:
    x = b-1
new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)


### FIXED CODE ###

import math
a, b, n = map(int, input().split())
x = n

if b <= n:
    x = b-1

new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)
#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right
import numpy as np

n, d, a = map(int, input().split())
xh=[list(map(int, input().split())) for _ in range(n)]
xh.sort()
xh = np.array(xh)
xh = xh.T
x = xh[0][:]
h = xh[1][:]
l = 0
ret = 0
while l < n:
    xl = x[l]
    hl = h[l]
    l += 1
    if hl <= 0:
        continue
    r = bisect_right(x, xl+2*d)
    k = (hl+(a-1))//a
    ret += k
    h[l:r] -= k * a
print(ret)

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

n, d, a = map(int, input().split())
x = []
xh = dict()
for _ in range(n):
    xi, hi = map(int, input().split())
    x.append(xi)
    xh[xi] = hi
x.sort()

l = 0
ret = 0
ai = [0] * (n+1)
anow = 0
while l < n:
    xl = x[l]
    hl = xh[xl]
    anow += ai[l]
    hl -= a * anow
    if hl > 0:
        r = bisect_right(x, xl+2*d)
        k = (hl+(a-1))//a
        ret += k
        anow += k
        ai[r] -= k
    l += 1
print(ret)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N = int(input())
words_dict = {}
for i in range(N):
  ss = input()
  ss_dict = {}
  for s in ss:
    ss_dict.setdefault(s, 0)
    ss_dict[s] += 1
  ss_dict = sorted(ss_dict.items())
  ss = [str(k)+str(v) for (k, v) in ss_dict]
  word = ''.join(ss)
  words_dict.setdefault(word, 0)
  words_dict[word] += 1
count = 0
for k, v in words_dict.items():
  if v > 1:
      count += cmb(v, 2)
      # count += int(factorial(v) / factorial(2) / factorial(v-2))
print(count)

### FIXED CODE ###

N = int(input())
words_dict = {}
count = 0
for i in range(N):
  ss = input()
  ss = "".join(sorted(ss))
  words_dict.setdefault(ss, 0)
  count += words_dict[ss]
  words_dict[ss] += 1
print(count)
a3={'357','375','537','573','735','753'}
def make_a(a,n):
    new_a=set()
    for i in a:
        for j in range(n+1):
            new_a.add(i[:j]+'3'+i[j:])
            new_a.add(i[:j]+'5'+i[j:])
            new_a.add(i[:j]+'7'+i[j:])
    return new_a
a4=make_a(a3,3)
a5=make_a(a4,4)
a6=make_a(a5,5)
a7=make_a(a6,6)
a8=make_a(a7,7)
a9=make_a(a8,8)
a=list(map(int,a3))+list(map(int,a4))+list(map(int,a5))+list(map(int,a6))+list(map(int,a7))+list(map(int,a8))+list(map(int,a9))
n=int(input())
a.append(n)
a.sort()
ans=a.index(n)
if a[ans]==a[ans+1]:
    ans+=1
print(ans)

### FIXED CODE ###

a3={'357','375','537','573','735','753'}
def make_a(a,n):
    new_a=set()
    for i in a:
        for j in range(n+1):
            new_a.add(i[:j]+'3'+i[j:])
            new_a.add(i[:j]+'5'+i[j:])
            new_a.add(i[:j]+'7'+i[j:])
    return new_a
a4=make_a(a3,3)
a5=make_a(a4,4)
a6=make_a(a5,5)
a7=make_a(a6,6)
a8=make_a(a7,7)
a9=make_a(a8,8)
a=list(map(int,a3))+list(map(int,a4))+list(map(int,a5))+list(map(int,a6))+list(map(int,a7))+list(map(int,a8))+list(map(int,a9))
n=int(input())
a.append(n)
a.sort()
ans=a.index(n)
if ans!=len(a)-1:
    if a[ans]==a[ans+1]:
        ans+=1
print(ans)
#UnionFindクラス
class UnionFind:

  def __init__(self,n):
    self.par =  [i for i in range(n)]
    self.rank = [1 for _ in range(n)]

  # xの根を返す
  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  
  # xとyの根を結合させる
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x != y:
      if self.rank[x] > self.rank[y]:
        x, y = y, x
      self.rank[x] += self.rank[y]
      self.par[y] = x
  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
  def is_same(self, x, y):
    return self.find(x) == self.find(y)

  # xが含まれる木の要素数を返す
  def size(self, x):
    return self.rank[self.find(x)]
    
n,m = map(int,input().split())
info = [list(map(int,input().split())) for i in range(m)]
uf = UnionFind(n)
okisa = [1]*(n)
ans = [0]*(m)
ans_=0
for i in range(n):
  ans_ = ans_+i
  
ans[m-1]= ans_
for i in range(1,m)[::-1]:
  if uf.is_same(info[i][0]-1,info[i][1]-1):
    ans[i-1] = ans[i] 
  else:
    ans[i-1] = ans[i]-uf.size(info[i][0]-1)*uf.size(info[i][1]-1)
    uf.union(info[i][0]-1,info[i][1]-1)
for i in range(m):
  print(ans[i])


### FIXED CODE ###

#UnionFindクラス
class UnionFind(object):

  def __init__(self, n=1):
    self.par =  [i for i in range(n)]
    self.rank = [1 for _ in range(n)]

  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  
  # xとyの根を結合させる
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x != y:
      if self.rank[x] < self.rank[y]:
        x, y = y, x
      self.rank[x] += self.rank[y]
      self.par[y] = x

  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
  def is_same(self, x, y):
    return self.find(x) == self.find(y)
    
n,m = map(int,input().split())
info = [list(map(int,input().split())) for i in range(m)]
uf = UnionFind(n)
okisa = [1]*(n)
ans = [0]*(m)
ans_=0
for i in range(n):
  ans_ = ans_+i
  
ans[m-1]= ans_
for i in range(1,m)[::-1]:
  if uf.is_same(info[i][0]-1,info[i][1]-1):
    ans[i-1] = ans[i] 
  else:
    ans[i-1] = ans[i]-uf.rank[uf.find(info[i][0]-1)]*uf.rank[uf.find(info[i][1]-1)]
    uf.union(info[i][0]-1,info[i][1]-1)
for i in range(m):
  print(ans[i])
N = int(input())
S = input()
min = N
for i in range(N-1):
    if '.' not in S or '#' not in S:
        min = 0
        break
    if S[i] == '.' and S[i+1] == '#':
        left = S.count('#',0,i)
        right = S.count('.',i)
    elif S[i] == '#' and S[i+1] =='.':
        left = S.count('#',0,i)
        right = S.count('.',i)
    if left + right < min:
        min = left + right
print(min)

### FIXED CODE ###

N = int(input())
S = input()
min = N
clm_sum = [0]
for s in S:
    if s == '#':
        clm_sum.append(clm_sum[-1] + 1)
    else:
        clm_sum.append(clm_sum[-1])
for i in range(1,len(clm_sum)):
    if clm_sum[i-1] + ((N - i) - (clm_sum[-1] - clm_sum[i])) < min:
        min = clm_sum[i-1] + ((N - i) - (clm_sum[-1] - clm_sum[i]))
print(min)
n = int(input())
X = [int(i) for i in input().split(" ")]
Y = [int(i) for i in input().split(" ")]

#p = 1,2,3
for p in range(1, 4):
   print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )

#p = infinity
print("{:.6f}".format(max( [ abs(a - b) for a, b in zip(X, Y) ] ) ) )
 

### FIXED CODE ###

n = int(input())
X = [int(i) for i in input().split(" ")]
Y = [int(i) for i in input().split(" ")]

for p in range(1, 4):
    print("{:.6f}".format(sum( [abs(a - b) ** p for a, b in zip(X,Y) ] ) ** (1 / p) ) )

print("{:.6f}".format(max( [ abs(a - b) for a, b in zip(X, Y) ] ) ) )
// C/C++ キーワード定義ファイル キーワード
// cpp_kw2_keywords.kwd
//
//  Created on: 2015/06/13
//      Author: KeitetsuWorks
// CASE=True

__declspec
__except
__finally
__try
break
case
catch
class
const
const_cast
continue
default
delete
deprecated
dllexport
dllimport
do
dynamic_cast
else
enum
explicit
extern
false
for
friend
goto
if
inline
mutable
naked
namespace
new
noinline
noreturn
nothrow
private
protected
public
register
reinterpret_cast
return
selectany
sizeof
static
static_cast
struct
switch
template
this
thread
throw
true
try
typedef
typeid
typename
union
using
uuid
virtual
volatile
while


### FIXED CODE ###

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

if sum(A) > N:
    print(-1)
else:
    print(N-sum(A))
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
x=S//(B+R)#brグループが何回
y=S%(B+R)
print(B*x+y)

### FIXED CODE ###

inp=input()
if inp=='AAA'or inp=='BBB':
  print('No')
else:
  print('Yes')
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'
print(S)

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn)



### FIXED CODE ###

A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())
import sys

sys.setrecursionlimit(10 ** 5)

N, M = map(int, input().split())
A = []
ANS = []
for i in range(N + 10):
    ANS.append(None)

for _ in range(M):
    a = int(input())
    A.append(a)
    ANS[a] = 0


def f(x):
    if ANS[x] is not None:
        return ANS[x]

    if x > N:
        return 0
    if x == N:
        return 1

    if ANS[x + 1] is None:
        x1 = f(x + 1)
        ANS[x + 1] = x1
    else:
        x1 = ANS[x + 1]

    if ANS[x + 2] is None:
        x2 = f(x + 2)
        ANS[x + 2] = x1
    else:
        x2 = ANS[x + 2]

    ans = x1 + x2
    # ans = f(x + 1) + f(x + 2)
    ANS[x] = ans
    return ans


print(f(0) % 1000000007)


### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
A = []
ANS = []
for i in range(N + 10):
    ANS.append(None)

for _ in range(M):
    a = int(input())
    A.append(a)
    ANS[a] = 0


def f(x):
    # print(ANS)
    # if x in A:
    #     print('::::', x)
    #     d[x] = 0
    #     return 0
    if ANS[x] is not None:
        return ANS[x]

    if x > N:
        return 0
    if x == N:
        return 1

    # if d.get(x + 1):
    #     x1 = d.get(x + 1)
    # else:
    #     x1 = f(x + 1)
    #     d[x + 1] = x1
    #
    # if d.get(x + 2):
    #     x2 = d.get(x + 2)
    # else:
    #     x2 = f(x + 2)
    #     d[x + 2] = x2

    # ans = x1 + x2
    ans = f(x + 1) + f(x + 2)
    ANS[x] = ans
    return ans


print(f(0) % 1000000007)
def bread_cnt(lev):
    return 2 ** (lev + 1) - 2


def patty_cnt(lev):
    return 2 ** (lev + 1) - 1


def burger_cnt(lev):
    return 2 ** (lev + 2) - 3


def solve(n, x):
    return _solve(n, x, 0)


def _solve(n, x, p):
    total_s = burger_cnt(n)
    mid = (total_s + 1) // 2

    if x == 1:
        return p + (1 if n == 0 else 0)
    elif 1 < x <= mid:
        reach_mid = 1 if x == mid else 0
        return _solve(n - 1, x - 1 - reach_mid, p + reach_mid)
    elif mid < x < total_s:
        return _solve(n - 1, x - 2 - burger_cnt(n - 1), p + 1 + patty_cnt(n - 1))
    elif x == total_s:
        return p + patty_cnt(n)


n, x = map(int, input().split(' '))
print(solve(n, x))


### FIXED CODE ###

print("Christmas" + " Eve"*(25-int(input())))
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] else continue for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))

### FIXED CODE ###

H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row = -1
for i in range(H):
    if 'snuke' in S[i]: row=i+1
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))
S = input()


def makeRepeat(arr):
    repeat = [[arr[0], 0]]
    for x in arr:
        if x == repeat[-1][0]:
            repeat[-1][1] += 1
        else:
            repeat.append([x, 1])
    return repeat


ans = []
repeats = makeRepeat(S)
for i, (ch, count) in enumerate(repeats):
    if ch != "?":
        ans.append(ch * count)
    else:
        if i - 1 >= 0:
            prev = repeats[i - 1][0]
        nxt = None
        if i + 1 < len(repeats):
            nxt = repeats[i + 1][0]

        if prev == "P":
            q, r = divmod(count, 2)
            ans.append("DP" * q + "D" * r)
        elif nxt == "D":
            q, r = divmod(count, 2)
            ans.append("P" * r + "DP" * q)
        else:
            ans.append("D" * count)

print("".join(ans))


### FIXED CODE ###

inf = float("inf")

S = input()



N = len(S)
bestP = [None for i in range(N)]
bestD = [None for i in range(N)]
if S[0] in ["?", "D"]:
    bestP[0] = 0
    bestD[0] = 1
else:
    bestP[0] = 0
    bestD[0] = 0
for i in range(1, N):
    bestP[i] = max(bestD[i - 1], bestP[i - 1])
    bestD[i] = max(bestD[i - 1] + 1, bestP[i - 1] + 2)
    if S[i] != "?":
        if S[i] == "P":
            bestD[i] = -inf
        else:
            assert S[i] == "D"
            bestP[i] = -inf

ans = [None for i in range(N)]
if bestP[-1] > bestD[-1]:
    ans[-1] = 'P'
else:
    ans[-1] = 'D'
for i in range(N - 2, -1, -1):
    if S[i] != '?':
        ans[i] = S[i]
    else:
        prev = ans[i + 1]
        if prev == 'D':
            if bestP[i] + 2 > bestD[i] + 1:
                ans[i] = 'P'
            else:
                ans[i] = 'D'
        else:
            if bestP[i] > bestD[i]:
                ans[i] = 'P'
            else:
                ans[i] = 'D'

print(''.join(ans))
a=0
n = int(input())
b = list(map(int, input().split()))

for i in range(n-2):
  if b[i] > b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  a = a + b[n-1] + b[0]
print(a)

### FIXED CODE ###

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

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)
N, M = map(int, input().split())
data = []
for i in range(N):
  data.append(input())
input_data=[]
for i in range(M):
  input_data.append(input())
flag_1 = False
for i in range(N - M + 1):
  for j in range(N - M + 1):
    if flag = False
    for k in range(M):
      for l in range(M):
        if data[i+k][j+l] != input_data[k][l]:
          flag = True
    if flag:
      flag_1 = True

if flag_1:
  print("Yes")
else:
  print("No")
      




### FIXED CODE ###

N, M = map(int, input().split())
data = []
for i in range(N):
  data.append(input())
input_data=[]
for i in range(M):
  input_data.append(input())
flag_1 = False
for i in range(N - M + 1):
  for j in range(N - M + 1):
    flag = True
    for k in range(M):
      for l in range(M):
        if data[i+k][j+l] != input_data[k][l]:
          flag = False
    if flag:
      flag_1 = True

if flag_1:
  print("Yes")
else:
  print("No")
a, b, c, d = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
c = 0
while True:
    c += 1
#for i in range(d):
    print(c)
    #print(len(ans))
    s, aq, bq, cq = map(int, q.pop())
    if len(al) > aq+1:
        if [al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq] not in ans:
            q.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])
            ans.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])

    if len(bl) > bq+1:
        if [al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq] not in ans:
            q.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])
            ans.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])

    if len(cl) > cq+1:
        if [al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1] not in ans:
            q.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])
            ans.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])

    q = sorted(q)

    if len(ans) > d:
        ans = sorted(ans, reverse=True)
        if ans[d-2][0] > q[len(q)-1][0]:
            break

ans = sorted(ans, reverse=True)
print(len(ans))
for i in range(d):
    print(ans[i][0])

### FIXED CODE ###

a, b, c, d = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
ans = [[al[0] + bl[0] + cl[0], 0, 0, 0]]
#while True:
for i in range(d):
    s, aq, bq, cq = map(int, q.pop())
    if len(al) > aq+1:
        if [al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq] not in ans:
            q.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])
            ans.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])

    if len(bl) > bq+1:
        if [al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq] not in ans:
            q.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])
            ans.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])

    if len(cl) > cq+1:
        if [al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1] not in ans:
            q.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])
            ans.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])

    q = sorted(q)

    #if len(ans) > d:
    #   ans = sorted(ans, reverse=True)
    #    if ans[d][0] > q[len(q)-1][0]:
    #        break

ans = sorted(ans, reverse=True)
for i in range(d):
    print(ans[i][0])
def permutations(iterable, r=None):
    pool = tuple(iterable)
    n = len(pool)
    r = n if r is None else r
    if r > n:
        return
    indices = range(n)
    cycles = range(n, n-r, -1)
    yield tuple(pool[i] for i in indices[:r])
    while n:
        for i in reversed(range(r)):
            cycles[i] -= 1
            if cycles[i] == 0:
                indices[i:] = indices[i+1:] + indices[i:i+1]
                cycles[i] = n - i
            else:
                j = cycles[i]
                indices[i], indices[-j] = indices[-j], indices[i]
                yield tuple(pool[i] for i in indices[:r])
                break
        else:
            return


L=[input() for i in range(input())]
S=[]
for i in permutations(L,2):
    S.append(int("".join(map(str,i))))
print sorted(S)[2]

### FIXED CODE ###

n = input()
h = sorted(input() for i in range(n))[:4]
h = map(str, h)
ans = []
for i in range(3):
    for j in range(i+1, 4):
        ans.append(int(h[i]+h[j]))
        ans.append(int(h[j]+h[i]))
print sorted(ans)[2]
from functools import reduce
from fractions import gcd
def lcms(a,b):
  return a*b//gcd(a,b)
def lcmm(l):
  return reduce(lcm,l)
n=int(input())
l=[int(input()) for i in range(n)]
print(lcmm(l))

### FIXED CODE ###

from functools import reduce
from fractions import gcd
def lcm(a,b):
  return a*b//gcd(a,b)
def lcmm(l):
  return reduce(lcm,l)
n=int(input())
l=[int(input()) for i in range(n)]
print(lcmm(l))
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N = int(input())

Ans = 0
numlist = [0] * 10000

if int(float(N)**0.5) <= 1:
  rMax = 1
else:
  rMax = int(float(N)**0.5)  

for x in range(1,rMax+1):
  for y in range(1,rMax+1):
    for z in range(1,rMax+1):
      Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x)
      if Ans <= 10000:
        numlist[Ans] += 1
  
for r in range(1,N+1):
  print(numlist[r])

### FIXED CODE ###

# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N = int(input())

Ans = 0
numlist = [0] * 10001

if int(float(N)**0.5) <= 1:
  rMax = 1
else:
  rMax = int(float(N)**0.5)  

for x in range(1,rMax+1):
  for y in range(1,rMax+1):
    for z in range(1,rMax+1):
      Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x)
      if Ans <= 10000:
        numlist[Ans] += 1
  
for r in range(1,N+1):
  print(numlist[r])
#!/usr/bin/env python3

def main():
    a = input()
    b = input() + [""]
    for i in range(len(a)):
        print(a[i], end="")
        print(b[i], end="")


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

def main():
    a = input()
    b = input()
    for i in range(len(a)):
        print(a[i], end="")
        if i < len(b):
            print(b[i], end="")
    print()


if __name__ == "__main__":
    main()
#https://atcoder.jp/contests/abc061/tasks/abc061_d



# coding: utf-8
# Your code here!

#input_template
inpPh = 2
debug = True
debug = False
if not debug:
    inpPh = 0





inputXs = [input1, input2, input3, None]


if debug:
    try:
        inputXs.append(inputA0)
    except:
        pass
    else:
        pass



    
inploc = inpPh - 1 #0,1,2

if inpPh > 0:
    print('selected_input:\n'+inputXs[inploc])


inpX_lst = []
if debug and inpPh > 0:
    inpX_lst = inputXs[inploc].splitlines()


if inpPh == 0:
    N,M = tuple(map(lambda x: int(x), sys.stdin.readline().split() ) )
else:
    N,M =tuple( map(lambda x: int(x),  inpX_lst.pop(0).split() ) )

elist = []    

for i in range(M):
    if inpPh == 0:
        ai,bi,ci = list(map(lambda x: int(x), sys.stdin.readline().split() ))
    else:
        ai,bi,ci = list(map(lambda x: int(x), inpX_lst.pop(0).split() ))
    
    ai_loc, bi_loc = ai-1, bi - 1
    elist.append(( ai_loc, bi_loc,ci))

vlist =[ [None,[]] for _ in range(N)]    

for e in elist:
    a,b,c = e
    vlist[a][1].append((a,b,-c))
        
s_loc,g_loc = 0, N-1

vlist[s_loc][0] = 0
#print(vlist)

for v1 in vlist:
    v1_d,v1_elist = v1[0],v1[1]
    #print(v1_d,v1_elist)
    for e in v1_elist:
        a,b,c = e
        v2 = vlist[b]
        v2_d, v2_elist = v2
        if v1_d == None:
            continue
        elif v2_d == None or v2_d > v1_d +c:
            vlist[b][0] = v1_d + c

g0 = vlist[g_loc][0]            

for v1 in vlist:
    v1_d,v1_elist = v1[0],v1[1]
    #print(v1_d,v1_elist)
    for e in v1_elist:
        a,b,c = e
        v2 = vlist[b]
        v2_d, v2_elist = v2
        if v1_d == None:
            continue
        elif v3_d == None or v2_d > v1_d +c:
            vlist[b][0] = v1_d + c

g1 = vlist[g_loc][0]  

if g0 != g1:
    print('inf')
else:
    print(-g0)

#print('res',g0,g1)
for v in vlist:
    #print(v)        
    pass


### FIXED CODE ###

import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                if i == n-1 and v == n-1:
                    return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)
a, b c = map(int, input().split())
if a-b == b-c:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

a, b, c = map(int, input().split())
if a-b == b-c:
    print('YES')
else:
    print('NO')