Harryxun/stf_run huggingface dataset:
from heapq import heappop,heappush
n = int(input())
A = sorted(list(map(int,input().split())))
p = 0
P = []
m = 0
M = []
for a in A:
    if a>=0:
        p += 1
        P.append(a)
    else:
        m += 1
        M.append(a)
if m!=0 and p!=0:
    res = 0
    for a in A:
        res += abs(a)
    print(res)
    while p!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        p -= 1
        heappush(M,mm-pp)
    while m != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        m -= 1
        heappush(P,pp-mm)
elif m == 0:
    print(sum(P)-min(P)*2)
    mm = heappop(P)
    pp = heappop(P)
    print(mm,pp)
    p -= 2
    m += 1
    heappush(M,mm-pp)
    while p!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        p -= 1
        heappush(M,mm-pp)
    while m != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        m -= 1
        heappush(P,pp-mm)
else:
    res = 0
    MMM = -100000000
    for m in M:
        MMM = max(MMM,m)
        res += abs(m)
    print(res+MMM*2)
    M.sort()
    mm = M[-1]
    pp = M[-2]
    print(mm,pp)
    m -= 2
    p += 1
    M = M[:-2]
    heappush(P,mm-pp)
    while p!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        p -= 1
        heappush(M,mm-pp)
    while m != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        m -= 1
        if m==0:
            exit()
        heappush(P,pp-mm)

### FIXED CODE ###

from heapq import heappop,heappush
n = int(input())
A = sorted(list(map(int,input().split())))
P = []
M = []
if n == 2:
    print(A[1]-A[0])
    print(A[1],A[0])
    exit()
def move():
    while len(P)!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        heappush(M,mm-pp)
    while len(M) != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        heappush(P,pp-mm)
for a in A:
    if a>=0:
        P.append(a)
    else:
        M.append(a)

if A[-1]>=0 and A[0]<0:
    print(sum(abs(a) for a in A))
    while len(P)!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        heappush(M,mm-pp)
    while len(M) != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        heappush(P,pp-mm)
elif A[0]>=0:
    print(sum(A)-min(A)*2)
    mm = heappop(P)
    pp = heappop(P)
    print(mm,pp)
    heappush(M,mm-pp)
    while len(P)!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        heappush(M,mm-pp)
    while len(M) != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        heappush(P,pp-mm)
else:
    print(sum(abs(a) for a in A)+max(A)*2)
    mm = M[-1]
    pp = M[-2]
    print(mm,pp)
    M = M[:-2]
    heappush(P,mm-pp)
    while len(P)!= 1:
        mm = heappop(M)
        pp = heappop(P)
        print(mm,pp)
        heappush(M,mm-pp)
    while len(M) != 0:
        mm = heappop(M)
        pp = heappop(P)
        print(pp,mm)
        heappush(P,pp-mm)
from sys import stdin
import fractions

n,x = [int(x) for x in stdin.readline().rstrip().split()]

li = list(map(int,stdin.readline().rstrip().split()))

def gcd_all(list):
    return gcd_all([fractions.gcd(*list[:2])] + list[2:]) if len(list) > 1 else list[0]
lin = []
for i in range(len(li)):
    lin.append(abs(li[i]-x))
gcd = gcd_all(lin)
print(gcd)

### FIXED CODE ###

from sys import stdin
import fractions


n,x = [int(x) for x in stdin.readline().rstrip().split()]

li = list(map(int,stdin.readline().rstrip().split()))
lin = []
for i in range(len(li)):
    lin.append(abs(li[i]-x))
poi = lin[0]
for i in range(len(lin)-1):
    poi = fractions.gcd(poi,lin[i+1])

print(poi)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
last=9
for i in range(5):
    if l[i]%10!=0:
        last=min(last,l[i]%10)
        
sum=0
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(l))
else:
    for i in range(5):
        if l[i]%10==0:
            sum+=l[i]
        else:
            sum+=l[i]+10-l[i]%10
    print(sum-10+last)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
last=9
for i in range(5):
    if l[i]%10!=0:
        last=min(last,l[i]%10)
        
g=0
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(l))
else:
    for i in range(5):
        if l[i]%10==0:
            g+=l[i]
        else:
            g+=l[i]+10-l[i]%10
    print(g-10+last)
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
temps=[1]
i=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  temps=list(set(result))
  if len(temps)!=len(result):
    break
  i=i+1
l=len(result)
temp=result.index(result[l-1])
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
for i in range(n):
  temp=a[temp-1]
  result.append(temp)
temp=result.index(result[len(result)-1])
c=len(result)-temp-1
if k<n:
  print(result[k])
else:
  print(result[temp+(k-temp)%c])
n, a, b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    s = sum(map(int,list(str(i))))
    if a <= s and s <= b:
        ans += i
print(ans)
n, a, b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    s = sum(map(int,list(str(i))))
    if a <= s and s <= b:
        ans += i
print(ans)


### FIXED CODE ###

n, a, b = map(int, input().split())
#4569=n
t = 0
for i in range(1, n+1):
    ans = 0
    s = i
    while s!=0:
        amari = s%10
        s = int(s/10)
        ans += amari
    if a <= ans <= b:
        t += i
print(t)
while True:
    (x, y) = (int(i) for i in input().split())
    if x = 0 and y = 0:
        break
    elif x <= y:
        print(x, y)
    elif x >= y:
        print(y, x)

### FIXED CODE ###

while True:
    (x, y) = (int(i) for i in input().split())
    if x == 0 and y == 0:
        break
    elif x <= y:
        print(x, y)
    else:
        print(y, x)
moji = list(input())
ans = []

for i in moji:
  if i == "0":
    ans.append("0")
  elif i == "1":
    ans.append("1")
  else:
    ans.pop()
    
print("".join(ans))

### FIXED CODE ###

a = list(input())
b = []

for i in range(len(a)):
  if a[i] == "0":
    b.append("0")
  elif a[i] == "1":
    b.append("1")
  elif a[i] == "B":
    if b == []:
      b = []
    else:
      del b[-1]
    
print("".join(b))
import numpy as np

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

array = np.array(lst)
po_array = array[array>=0]
ne_array = abs(array[array<0])
ne_array.sort()

if len(po_array) >= len(ne_array):
    long_array = po_array
    short_array = ne_array
else:
    long_array = ne_array
    short_array = po_array

if len(short_array) > k:
    min_len = k
else:
    min_len = len(short_array)
        
if min_len == 0:
    print(long_array[k-1])
else:
    min_dist = 10**10
    for i in range(min_len):
        if i == k-1:
            dist = short_array[i]
        else:
            dist = short_array[i]*2 + long_array[k-i-2]
            if dist > short_array[i] + long_array[k-i-2]*2:
                dist = short_array[i] + long_array[k-i-2]*2
        if min_dist > dist:
            min_dist = dist
    if len(long_array) >= k:
        if min_dist > long_array[k-1]:
            min_dist = long_array[k-1]
    print(min_dist)

### FIXED CODE ###

import numpy as np

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

array = np.array(lst)
po_array = array[array>=0]
ne_array = abs(array[array<0])
ne_array.sort()

if len(po_array) >= len(ne_array):
    long_array = po_array
    short_array = ne_array
else:
    long_array = ne_array
    short_array = po_array

if len(short_array) > k:
    min_len = k
else:
    min_len = len(short_array)
        
if min_len == 0:
    print(long_array[k-1])
else:
    min_dist = 10**10
    for i in range(min_len):
        dist = 10**10
        if i == k-1:
            dist = short_array[i]
        elif k-i-1 <= len(long_array): 
            dist = min(short_array[i]*2 + long_array[k-i-2], short_array[i] + long_array[k-i-2]*2)
        if min_dist > dist:
            min_dist = dist
    if len(long_array) >= k:
        if min_dist > long_array[k-1]:
            min_dist = long_array[k-1]
    print(min_dist)
A, P = map(int, input().split())

APPLE = 3*A + P

if APPLE % 2 = 0:
  ans = APPLE/2
else:
  ans = (Apple-1)/2

### FIXED CODE ###

A, P = map(int, input().split())
 
Apple = 3*A + P
 
if Apple % 2 == 0:
  ans = Apple/2
else:
  ans = (Apple-1)/2
 
print(int(ans))
n, m, l = map(int, input().split())
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
inf = 10**12
d = [[inf for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(m):
    x,y,z = map(int,input().split())
    d[x-1][y-1] = z
    d[y-1][x-1] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
dd = warshall_floyd(d)
ddd = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  for j in range(n):
    if dd[i][j] <= l:
      ddd[i][j] = 1
dddd = warshall_floyd(ddd)
q = int(input())
for i in range(q):
  s, t = map(int, input().split())
  if dddd[s][t] == inf:
    print(-1)
  else:
    print(dddd[s-1][t-1]-1)

### FIXED CODE ###

from scipy.sparse.csgraph import floyd_warshall

n, m, l = map(int, input().split())
inf = 10**12
d = [[inf for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(m):
    x,y,z = map(int,input().split())
    d[x-1][y-1] = z
    d[y-1][x-1] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
dd = floyd_warshall(d)
ddd = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  for j in range(n):
    if dd[i][j] <= l:
      ddd[i][j] = 1
dddd =floyd_warshall(ddd)
q = int(input())
for i in range(q):
  s, t = map(int, input().split())
  if dddd[s-1][t-1] == inf:
    print(-1)
  else:
    print(int(dddd[s-1][t-1]-1))
S = list(input())
S[3] = 8
print("".join(S))

### FIXED CODE ###

S = list(input())
S[3] = "8"
print("".join(S))
x = [int(i) for i in input().split()]
x.pop(0)
pay = int(sum(x) - max(x)/2)
print(pay)

### FIXED CODE ###

x = int(input())
p = [int(input()) for i in range(x)]
pay = sum(p) - max(p)//2
print(pay)
N = int(input())
ans = 0
for i in range(N):
    x, u = map(str,input())
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x*380000

print(ans)

### FIXED CODE ###

N = int(input())
mo = 0
for i in range(N):
    x,y = map(str,input().split())
    x = float(x)
    if y == 'JPY':
        mo += x
    else:
        tmp = x*380000
        mo += tmp
print(mo)
n = int(input())
a = [int(input()) for i in range(n)]
for i in range(3):
    m = max(a)
    a.remove(m)
    print (m)


### FIXED CODE ###

import sys
e = [int(i) for i in sys.stdin.readlines()]
for i in range(3):
    m = max(e)
    e.remove(m)
    print (m)
s = [i for i in input().strip()]
t = [i for i in input().strip()]

s.sort()
t.sort(reverse=True)

#print(s)
#print(t)

for i in range(len(s)):
  if s[i] < t[i]:
    print("Yes")
    exit()
    
print("No")    

### FIXED CODE ###

s = [i for i in input().strip()]
t = [i for i in input().strip()]

s.sort()
t.sort(reverse=True)

#print(s)
#print(t)

if s < t:
    print("Yes")
else:
    print("No")
n , k = map(int, input().split())
a = list(map(int,input().split()))
a.sort()

N = 1000000007

def combi(n,r,N):
    if n<r or n<0 or r<0:
        ans = 0
        return ans
    if n==r:
        ans = 1
        return ans
    r= min(r, n-r)
    ans = f[n]*rf[r]*rf[n-r]%N
    return ans

f = [0]*(n+1)
f[1]=1

for i in range(2,10**5+1):
    f[i] = f[i-1]*i

rf = [0]*(n+1)

for i in range(1,10**5+1):
    rf[i] = pow(f[i],N-2,N)

max_sum=0
min_sum=0

for i in range(k-1,n):
    max_sum+=a[i]*combi(i,k-1,N)
    max_sum%=N
for i in range(n-k+1):
    min_sum+=a[i]*combi(n-i-1,k-1,N)
    min_sum%=N
if max_sum-min_sum<0:
    max_sum+=N
print(max_sum-min_sum)


### FIXED CODE ###

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

MOD = 1000000007

factorial = [1]
inverse = [1]
for i in range(1, n+2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))

def combi(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD

max_sum=0
min_sum=0

for i in range(k-1,n):
    t = combi(i,k-1)
    max_sum+=a[i]*t
    max_sum%=MOD
    min_sum+=a[n-i-1]*t
    min_sum%=MOD
if max_sum-min_sum<0:
    max_sum+=MOD
print(max_sum-min_sum)
n=int(input())
for i in range(n):
a=int(input())
b=int(input())
print(a+b)

### FIXED CODE ###

n = int(input())

for i in range(n):
    a = int(input())
    b = int(input())

    if (a + b) < (10 ** 80):
        print(a + b)
    else:
        print("overflow")
a,b,c=list(map(int,input().splilt()))
if a==b==c or a!=b!=c:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a=input().split()
if (a[0]==a[1] and a[1]==a[2] and a[0]==a[2] )or (a[0]!=a[1] and a[1]!=a[2] and a[0]!=a[2]):
  print('No')
else:
  print('Yes')
# coding: utf-8

#Q003 Largest prime factor

#import math#,sys,time
#import numpy as np
   
#start_time = time.clock()


dic=[{} for i in range(26)]
alpha = "abcdefghijklmnopqrstuvwxyz"

def makedic():
    for i in range(26):
        tmp = alpha[i:]+alpha[:i]
        for j in range(26):
            dic[i][alpha[j]]=tmp[j]
    return

def crack(word):
    for i in range(26):
        s=[]
        for c in word:
            s.append(dic[i][c])
        s="".join(s)
        if s=="the" or s=="this" or s=="that":
            return i
    return None


makedic()
while True:
    try:
        s = raw_input()
    except:
        break

    for e in s.split():
        lene=len(e)
        if lene==3 or lene==4:
            offset = crack(e)
            break
    x = []
    for c in s:
        if "a"<=c and c<="z": x.append(dic[offset][c])
        else: x.append(c)
    print "".join(x)
        
#print time.clock() - start_time, "seconds"

### FIXED CODE ###

import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin:
    while not("the" in s or "that" in s or "this" in s):
        s=s.translate(tbl)
    print s[:-1]
N = int(input().strip())

n_list = [[] for i in range(N)]
d = [0] * N

for i in range(N-1):
    a, b = map(int, input().strip().split())
    a -= 1
    b -= 1
    n_list[a].append([b,i])
    n_list[b].append([a,i])
    d[a] += 1
    d[b] += 1


#print(n_list)
#print(d)

d_dict = {}
for i in range(N):
    d_dict[i] = d[i]
tmp = sorted(d_dict.items(), key = lambda x:x[1], reverse = True)

colors = [0] * (N)

root = tmp[0][0]

def paint(node, parent_edge_id):
    tmp_color = 1
    for edge in n_list[node]:
        if edge[1] != parent_edge_id:
            if parent_edge_id != -1 and tmp_color == colors[parent_edge_id]:
                tmp_color += 1
            colors[edge[1]] = tmp_color
            paint(edge[0], edge[1])
            tmp_color += 1

    
try:
    paint(tmp[0][0], -1)
except AttributeError:
    print(0)
print(tmp[0][1]) # color num    a
for i in range(N-1):
    print(colors[i])

### FIXED CODE ###

import sys
N = int(input().strip())

n_list = [[] for i in range(N)]
d = [0] * N

for i in range(N-1):
    a, b = map(int, input().strip().split())
    a -= 1
    b -= 1
    n_list[a].append([b,i])
    n_list[b].append([a,i])
    d[a] += 1
    d[b] += 1


#print(n_list)
#print(d)

d_dict = {}
for i in range(N):
    d_dict[i] = d[i]
tmp = sorted(d_dict.items(), key = lambda x:x[1], reverse = True)

colors = [0] * (N)

root = tmp[0][0]

def paint(node, parent_edge_id):
    #print(node, parent_edge_id)
    tmp_color = 1
    for edge in n_list[node]:
        #print("ege:", edge)
        if edge[1] != parent_edge_id:
            if parent_edge_id != -1 and tmp_color == colors[parent_edge_id]:
                tmp_color += 1
            colors[edge[1]] = tmp_color
            paint(edge[0], edge[1])
            tmp_color += 1

    
sys.setrecursionlimit(10**7)
paint(tmp[0][0], -1)
print(tmp[0][1]) # color num 
for i in range(N-1):
    print(colors[i])
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    n, m = MII()
    a_lst = [II() for _ in range(m)]
    DIV = 10**9+7
    stairs = [1]*2 + [0]*(n-1)
    for a in a_lst:
        stairs[a] = 'NG'
    cnt = 0
    for i in range(2, n+1):
        if cnt == 2:
            print(0)
            exit(1)
        if stairs[i] == 'NG': cnt += 1; continue
        cnt = 0
        a = stairs[i-1] if stairs[i-1] != 'NG' else 0
        b = stairs[i-2] if stairs[i-2] != 'NG' else 0
        stairs[i] = a + b
    print(stairs[n]%DIV)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    n, m = MII()
    a_lst = [II() for _ in range(m)]
    DIV = 10**9+7
    stairs = [1]*2 + [0]*(n-1)
    for a in a_lst:
        stairs[a] = 'NG'
    cnt = 0
    for i in range(2, n+1):
        if cnt == 2:
            print(0)
            exit(0)
        if stairs[i] == 'NG': cnt += 1; continue
        cnt = 0
        a = stairs[i-1] if stairs[i-1] != 'NG' else 0
        b = stairs[i-2] if stairs[i-2] != 'NG' else 0
        stairs[i] = a + b
    print(stairs[n]%DIV)

if __name__ == '__main__':
    main()
N, K = raw_input().split()
N, K = int(N), int(K)

R, S, P = raw_input().split()
R, S, P = int(R), int(S), int(P) 

T = raw_input()

his = list()
ret = 0

for i in range(N):
    if T[i] == 'r':
        if i-K >= 0 and his[i-K] == 'p':
            if i+K <= N and T[i+K] == 's':
                his.append('s')
            else:
                his.append('r')
        else:
            ret += P
            his.append('p')

    elif T[i] == 's':
        if i-K >= 0 and his[i-K] == 'r':
            if i+K <= N and T[i+K] == 'p':
                his.append('p')
            else:
                his.append('s')
        else:
            ret += R
            his.append('r')

    else: # T[i] == 'p'
        if i-K >= 0 and his[i-K] == 's':
            if i+K <= N and T[i+K] == 'r':
                his.append('r')
            else:
                his.append('p')
        else:
            ret += S
            his.append('s')
    
print '{}'.format(ret)
    
        


### FIXED CODE ###

# D - Prediction and Restriction
# https://atcoder.jp/contests/abc149/tasks/abc149_d


N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

def opt(seg):
    # dp[STEP][R/P/S]
    dp = [ [-1, -1, -1] for _ in range(len(seg))]

    dp[0][0] = (R if seg[0] == 's' else 0)
    dp[0][1] = (P if seg[0] == 'r' else 0)
    dp[0][2] = (S if seg[0] == 'p' else 0)

    for i in range(1, len(seg)):
        dp[i][0] = (R if seg[i] == 's' else 0) + max(dp[i-1][1], dp[i-1][2])
        dp[i][1] = (P if seg[i] == 'r' else 0) + max(dp[i-1][0], dp[i-1][2])
        dp[i][2] = (S if seg[i] == 'p' else 0) + max(dp[i-1][0], dp[i-1][1])

    return max(dp[-1])

segs = list()

for K_idx in range(K):
    segs.append( T[K_idx::K] )

print('{}'.format(sum(map(opt, segs))))
import sys
sys.setrecursionlimit(10**9)

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

while len(A) > 1:
    if len(A) % 2 == 1:
        for i in range(len(A)-1):
            A[i] = abs(A[i]-A[i+1])
        A.pop()
    B = []
    for i in range(len(A)//2):
        B.append(abs(A[i*2]-A[i*2+1]))
    A = B[:]
if A[0] == 2:
    print(1/0)
print(A[0])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N = int(input())
A = list(map(int,input()))
X = 2 in A

while len(A) > 1:
    if len(A) % 2 == 1:
        for i in range(len(A)-1):
            A[i] = abs(A[i]-A[i+1])
        A.pop()
    B = []
    for i in range(len(A)//2):
        B.append(abs(A[i*2]-A[i*2+1]))
    A = B[:]

if X:
    A[0] %= 2
print(A[0])
from collections import Counter


def main():
    n = int(input())
    v_n = input().split(' ')
    
    gu = Counter(v_n[::2])
    ki = Counter(v_n[1::2])

    guusuu = gu.most_common()
    kisuu = ki.most_common()
    
    if guusuu[0][0]==kisuu[0][0]:
        print(min(n - guusuu[0][1] - kisuu[1][1], n - guusuu[1][1] - kisuu[0][1]))
    else:
        print(n - guusuu[0][1] - kisuu[0][1])

main()

### FIXED CODE ###

from collections import Counter


def main():
    n = int(input())
    v_n = input().split(' ')
    
    gu = Counter(v_n[::2])
    ki = Counter(v_n[1::2])

    guusuu = gu.most_common()
    kisuu = ki.most_common()

    # print(guusuu, len(guusuu))
    # print(kisuu, len(kisuu))
    
    if guusuu[0][0]==kisuu[0][0]:
        if len(guusuu)==1 and len(kisuu)==1:
            # n=4, `4 4 4 4`
            # print('----------')
            print(guusuu[0][1])
        else:
            print(min(n - guusuu[0][1] - kisuu[1][1], n - guusuu[1][1] - kisuu[0][1]))
    else:
        print(n - guusuu[0][1] - kisuu[0][1])

main()
n = int(input())
s = [input() for i in range(3)]
ans_set = set(s)
print(len(ans_set))

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
ans_set = set(s)
print(len(ans_set))
a,b = map(int, input())


if a % 2 ==0 and b % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

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


if a % 2 ==0 or b % 2 == 0:
    print("Even")
else:
    print("Odd")
N = int(input())

n = 1000 - N
if 1000 < N:
  m = n * (-1)
else:
  pass

print(int(str(m)[-3])*100)




### FIXED CODE ###

N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000or N == 0:
  print(0)
elif 1000 < N:
  m = n * (-1)
  if m < 10:
    print(1000-m)
  elif m < 100:
    print(1000-(int(str(m)[-2])*10) + (int(str(m)[-1])))
  else:
    print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)
n = int(input())

res_v = np.zeros(n + 1, dtype='int64')
res_v_cumsum = np.zeros(n + 1, dtype='int64')
res_v[0] = 0
res_v[1] = 1
res_v[2] = 1
res_v_cumsum[0] = 0
res_v_cumsum[1] = 1
res_v_cumsum[2] = 2

M = 1000000007

for k in range(3, n):
    res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M
    res_v_cumsum[k] = (res_v_cumsum[k-1] + res_v[k]) % M

print((((res_v_cumsum[n-2] * (((n-1) * (n-1)) % M)) % M) + ((res_v_cumsum[n-1] * (n-1)) % M) + n + (n-1)*(n-1)%M) % M)

### FIXED CODE ###

n = int(input())

if n == 1:
    print(1)
else:
    res_v = [0]*(n + 1)
    res_v_cumsum = [0]*(n + 1)
    res_v[0] = 0
    res_v[1] = 1
    res_v[2] = 1
    res_v_cumsum[0] = 0
    res_v_cumsum[1] = 1
    res_v_cumsum[2] = 2

    M = 1000000007

    for k in range(3, n):
        res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M
        res_v_cumsum[k] = (res_v_cumsum[k-1] + res_v[k]) % M
    #print(res_v)
    print((((res_v_cumsum[n-2] * (((n-1) * (n-1)) % M)) % M) + ((res_v_cumsum[n-1] * (n-1)) % M) + n + (n-1)*(n-1)%M) % M)
def gcd(a,b):
  while b>=1:
    a,b=b,a%b
  return int(a)
def lcm(a,b):
  return int(a*b/gcd(a,b))
N=int(input())
List_T=[int(input()) for i in range(N)]
T=1
n=1
for i in List_T:
  T=lcm(T,i)
print(int(T))

### FIXED CODE ###

def gcd(a,b):
  if a<b:
    a,b=b,a
  while b>0:
    a,b=b,a%b
  return int(a)
N=int(input())
T=1
for i in range(N):
  ti=int(input())
  T=T*ti//gcd(T,ti)
print(T)
a = int(input())
b = int(input())
 
x = a * b
 
if x % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
 
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")