Harryxun/stf_run huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int S(vector<int> a,int N,int M){
  int S=0;
  for(int i=0;i<N;i++){
    S+=(a.at(i)-M)*(a.at(i)-M);
  }
  return S;
}

int main(){
  int N,V;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  V=S(a,N,-100);
  for(int i=0;i<201;i++){
    if(S(a,N,-100+i)<V) V=S(a,N,-100+i);
  }
  
  cout << V << endl;
}

### FIXED CODE ###

def S(a,N,M):
    m=0
    for i in range(N):
        m+=(a[i]-M)**2
    return m
    

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

m=S(a,N,-100)

for i in range(-99,101):
    if m > S(a,N,i):
        m=S(a,N,i)
        
print(m)
from math import gcd
g=9.8
while True:
    try:
        a,b=map(int,input().split())
    except:
        break
    print(gcd(a,b),a*b//gcd(a,b))

### FIXED CODE ###

def gcd(x,y):
    if y==0:
        return x
    return gcd(y,x%y)

while True:
    try:
        x,y=map(int,input().split())
    except:
        break
    print(gcd(x,y),x*y//gcd(x,y))
n,k=map(int,input().split())
s=input()
if s[0]=="0":
  a=[0]
else:a=[]
i=0
c=0
while True:
  c+=1
  if s[i]!=s[i+1]:
    a.append(c)
    c=0
  i+=1
  if i==len(s)-1:
    a.append(len(s)-sum(a))
    break
l=len(a)
if 2*k+1>=l:print(l)
else:
  c=sum(a[:2*k+1])
  ans=sum(a[:2*k+1])
  for i in range(l-2*k-1):
    c-=a[i]-a[i+2*k+1]
    if ans<c:
      ans=c
  print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
s=input()
s+="6"
c=0
l=[]
zcnt=0
for i in range(n):
  if s[i]!=s[i+1]:
    if s[i]=="0":zcnt+=1
    l.append((s[i],i+1-c))
    c=i+1
L=len(l)
sl=[0]*(L+1)
for i in range(L):
    sl[i+1]=sl[i]+l[i][1]
if k>=zcnt:print(n);exit()
ans=0
if s[0]=="0":
    for i in range(zcnt-k+1):
        ans=max(ans,sl[min(L,2*k+i*2)]-sl[max(0,i*2-1)])
    print(ans)
else:
    for i in range(zcnt-k+1):
        ans=max(ans,sl[min(L,2*k+i*2+1)]-sl[i*2])
    print(ans)
n = int(input())
nums = tuple(input().split())
judge = 0
for i in range(n):
  for j in range(i+1,n):
    if nums[i] == nums[j]:
      judge = 1
if judge == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

input1 = input()
s = str(input1).split(' ')[0]
t = str(input1).split(' ')[1]
input2 = input()
a = int(str(input2).split(' ')[0])
b = int(str(input2).split(' ')[1])
u = str(input())
if s == u:
  a = a - 1
else:
  b = b - 1
print(a, ' ', b)
class Point(object):
    x = 0.0
    y = 0.0
    def __init__(self, x, y):
        self.x = x
        self.y = y
    def __sub__(left, right):
        return Point(left.x - right.x, left.y - right.y)
    #cross
    def __mul__(left, right):
        return left.x * right.y - left.y * right.x

for i in range(int(raw_input())):
    (x1, y1, x2, y2, x3, y3, x4, y4) = [int(i) for i in raw_input().split()]
    a = Point(x1, y1)
    b = Point(x2, y2)
    c = Point(x3, y3)
    d = Point(x4, y4)
    ab = a - b
    cd = c - d
    if(a * b == 0):
        print 'YES'
    else:
        print 'NO'

### FIXED CODE ###

for i in range(int(raw_input())):
    (x1, y1, x2, y2, x3, y3, x4, y4) = map(float,raw_input().split())
    x1 -= x2
    y1 -= y2
    x3 -= x4
    y3 -= y4
    if(x1 == 0 or x3 == 0):
        if(x1 == 0 and x3 == 0):
            print 'YES'
        else:
            print 'NO'
    else:
        if(y1 / x1 == y3 / x3):
            print 'YES'
        else:
            print 'NO'
n = list(map(input().split()))
if len(set(n)) == 3:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

n = input()
s = list(n)
if len(set(s)) == 1:
    print("No")
else:
    print("Yes")
n = int(input())
l =[]
inv =[]
s = 0
for i in range(n):
    l.append(int(input()))

for i in l:
    i_inv = 1/i
    inv.append(i_inv)

for i in inv:
    s += i
print(1/s)
  

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
s = 0 
for i in l:
    i_inv = 1/i
    s += i_inv
print(1/s)
n,m = map(int,input().split())
s = str(input())
t = str(input())
a = 0
def get_gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd):
    lcm = a * b // gcd
    return lcm
saisyou = get_lcm(n,m,get_gcd(n,m))
ans = 0
if saisyou == n or saisyou == m:
    print(-1)
else:
    for l in range(saisyou,100000,saisyou):
        num = 0
        xlis = []
        ylis = []
        for i in range(min(n,m)):
            xlis.append(1+(l/n)*i+1)
            ylis.append(1+(l/m)*i+1)
        yset = set(ylis)
        xset = set(xlis)
        for i in yset:
            hanntei = 0
            for j in xset:
                if i == j:
                    if s[j-1] == t[i-1]:
                        break
                    else:
                        hanntei += 1
                        break
            if hanntei >= 1:
                break
        num += 1
        ans = l
        break 
    if num == 1:
        print(ans)    
    else:
        print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
s = str(input())
t = str(input())
def get_gcd(a, b): #最大公約数を求める関数
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd): #みたまんまそういうやつです
    lcm = a * b // gcd
    return lcm
lcm = get_lcm(n,m,get_gcd(n,m)) #lcmはn,m最小公倍数
lcm2 = get_lcm(lcm/n,lcm/m,get_gcd(lcm/n,lcm/m)) #lcm２はlcm/nとlcm/mの最小公倍数
ans = 0
for i in range(int(lcm//lcm2)):
    if s[int(i*lcm2//(lcm/n))] == t[int(i*lcm2//(lcm/m))]:
        pass
    else:
        ans = 1
        break
if ans == 1:
    print(-1)
else:
    print(lcm)
from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            try:
                d[tuple(map(sub, balls[i], balls[j]))] += 1
            except:
                print(100)
    print(N-max(d.values()))


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = N - max(d.values(), default=0)
        print(mmax)
    except ValueError:
        print(100)

if __name__ == '__main__':
    main()
a,b,c=map(int,input().split())
l=[a,b,c]
sorted(l)
if len(l)==2:
  print('Yes')
elif:
  print('No')
  


### FIXED CODE ###

a,b,c=map(int,input().split())
l=[a,b,c]
l.sort()
if l[0]==l[1] and l[1]!=l[2]:
  print('Yes')
elif l[0]!=l[1] and l[1]==l[2]:
  print('Yes')
else:
  print('No')
a = list(int(input().split()))
print((a[0]-1)*(a[1]-1))

### FIXED CODE ###

a = list(input().split())
a = list(int(x) for x in a)
print((a[0]-1)*(a[1]-1))
s = input()

a = s[0:1]
b = s[2:3]

ans = 0

if a <= 12 and a >= 1:
    ans += 2

if b <= 12 and b >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")

### FIXED CODE ###

s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 0:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 1:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 2:
    x += 1


if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2

if int(sl[0]) == 1 and int(sl[1]) == 0:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 1:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 2:
    x += 2

b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')
D = input
msg = 'Christmas'
ev = ' Eve'
dic = {'22':msg+ev*3, '23':msg+ev*2, '24':msg+ev, '25':msg}
print(dic[str(D)])

### FIXED CODE ###

D = input()
dic = {'22':'Christmas Eve Eve Eve', '23':'Christmas Eve Eve', '24':'Christmas Eve', '25':'Christmas'}
print(dic[str(D)])
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

ll pow_mod(ll base, ll exp, ll q) {
	base %= q;
	ll ans = 1;
	while (exp) {
		if (exp & 1) ans = (ans * base) % q;	
		base = (base * base) % q;
		exp /= 2;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	cout << pow_mod(10, n, MOD) - 2*pow_mod(9, n, MOD) + pow_mod(8, n, MOD);
}

### FIXED CODE ###

from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

# setrecursionlimit(10**7)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = int(rl())

	dp = [[[0 for k in range(2)] for j in range(2)] for i in range(n+1)]
	dp[0][0][0] = 1

	for i in range(n):
		for j in range(2):
			for k in range(2):
				for d in range(10):
					nj = j or d == 0
					nk = k or d == 9
					dp[i+1][nj][nk] += dp[i][j][k]
					dp[i+1][nj][nk] %= MOD 

	ans = dp[n][1][1]
	print(ans)
	stdout.close()

if __name__ == "__main__":
	main()
import math

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
  
d = math.gcd(a,b)


### FIXED CODE ###

from fractions import gcd

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    return arr
  
d = gcd(a,b)
print(len(factorization(d)) + 1)
import sys
input = sys.stdin.readline

M=10**9+7
r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
d=[1]+[0]*12
for c in input():
    if c>'9':
      d=[sum(d[j]for j in k)%M for k in r]
    else:
      d=[d[(int(c)-k)*9%13]for k in range(13)]
print(d[5])


### FIXED CODE ###

def main():
  M=10**9+7
  r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
  d=[1]+[0]*12
  for c in input():
    if c>'9':
      d=[sum(d[j]for j in k)%M for k in r]
    else:
      d=[d[(int(c)-k)*9%13]for k in range(13)]
  print(d[5])
main()
a,b,c=map(int,input().split())
print('Yes' if c−a−b>0 and 4*a*b<(c−a−b)**2 else 'No')

### FIXED CODE ###

a,b,c=map(int,input().split())
print('Yes' if (c>a+b and (c-a-b)**2>4*a*b) else 'No')
n,k = map(int, input().split())
num = 1
for i in range(n):
    if num*2 < num+k:
        num = num*2
    else:
        num = num+k
print(num)

### FIXED CODE ###

n = int(input())
k = int(input())
num = 1
for i in range(n):
    num = min(num+k,num*2)
print(num)
s = input()

grid = [0 if i == 'g' else 1 for i in s]


def biggest(grid):
    dist = [float('-inf')] * len(s)
    move = (0, 1)
    st = deque([[0, 0, 0, 0]])
    while st:
        g, p, idx, cur = st.popleft()
        if idx > len(s) - 1:
            continue
        for a in move:
            if a:
                if p + 1 > g:
                    continue
                tmpg, tmpp = g, p + 1
            else:
                tmpg, tmpp = g + 1, p
            if a > grid[idx]:
                tmp = cur + 1
            elif a < grid[idx]:
                tmp = cur - 1
            else:
                tmp = cur
            if dist[idx] < tmp:
                dist[idx] = tmp
            st.append([tmpg, tmpp, idx + 1, tmp])
    return dist[-1]


print(biggest(grid))


### FIXED CODE ###

s = input()
p = sum(1 for i in s if i == 'p')
l = len(s)
print(l // 2 - p)
sx, sy, tx, ty= map(int, input().split())

w = tx-sx
h = ty-sy


ans = ""
ans+="R"*w
ans+="U"*h
ans+="L"*w
ans+="D"*h

ans+="D"
ans+="R"*(x+1)
ans+="U"*(y+1)
ans+="L"

ans+="U"
ans+="L"*(x+1)
ans+="D"*(y+1)
ans+="R"

print(ans)

### FIXED CODE ###

sx, sy, tx, ty= map(int, input().split())

w = tx-sx
h = ty-sy


ans = ""
ans+="R"*w
ans+="U"*h
ans+="L"*w
ans+="D"*h

ans+="D"
ans+="R"*(w+1)
ans+="U"*(h+1)
ans+="L"

ans+="U"
ans+="L"*(w+1)
ans+="D"*(h+1)
ans+="R"

print(ans)
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif sv == "RE":
        re += 1

print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)


### FIXED CODE ###

n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1

print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)
n,k=map(int,input().split())
print(n%k==0:
    print(0)
else:
    print(1)


### FIXED CODE ###

n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)
a=list(map(int,input().split()))
a=a.sort()
print(" ".join(a))

### FIXED CODE ###

a=list(map(int,input().split()))
a.sort()
print(a[0],a[1],a[2])
a = int(raw_input(""))
b = int(raw_input(""))
print a*b, 2*a+2*b

### FIXED CODE ###

a,b = map(int,raw_input().split())
print a*b,a*2 + b*2
a, b, c, d = list(map(int, input().split()))
if a >= d:
  print(d)
elif a+b>=d:
  print(a)
elif:
  print(2*a+b-d)


### FIXED CODE ###

a, b, c, d = list(map(int, input().split()))
if a >= d:
  print(d)
elif a+b>=d:
  print(a)
else:
  print(2*a+b-d)
n,x = map(int,input().split())
x = list(map(int,input().split()))
l = [abs(i-x) for i in x]

#ユークリッド互除法
def gcd(x,y):
    if y == 0:
        return
    else:
        return gcd(y,x%y)

ans = l[0]
for i in range(1,n):
    ans = gcd(l[i],ans)
print(ans)

### FIXED CODE ###

n,x = map(int,input().split())
a = list(map(int,input().split()))
new_lst=[abs(i-x) for i in a]

def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

ans=new_lst[0]
for i in range(1,n):
	ans =gcd(new_lst[i],ans)

print(ans)
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
fact = list()
i = 2
while m != 1:
    if m % i == 0:
        m = m // i
        fact.append(i)
    else:
        i += 1
j = 2
ans = 1
while j <= fact[-1]:
    ans = ans * combinations_with_replacement_count(n, fact.count(j))
    j += 1
print(ans % (10 ** 9 + 7))

### FIXED CODE ###

import math


def combinations_with_replacement_count(n, r):
    return math.factorial(n + r - 1) // (math.factorial(n - 1) * math.factorial(r))


nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
fact = {}
i = 2
while i * i <= m:
    while m % i == 0:
        m = m // i
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
    i += 1
if m > 1:
    fact[m] = 1
j = 2
ans = 1
for k in fact:
    ans = ans * combinations_with_replacement_count(n, fact[k])
print(ans % (10 ** 9 + 7))
import sys

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

if len(a_s) == 1:
	for i in range(m):
		a_s[0] = a_s[0] // 2
	print(a_s[0])
	sys.exit()

amax1, amax2 = a_s[-1], a_s[-2]

for i in range(m):
	a_s[a_s.index(amax1)] = amax1 // 2
	if amax1 // 2 < amax2:
		a_s = sorted(a_s)
		amax1, amax2 = a_s[-1], a_s[-2]

res = sum(a_s)
print(res)


### FIXED CODE ###

from math import ceil
from heapq import *

n, m = map(int, input().split())
a_s = [-int(a) for a in input().split()]
heapify(a_s)

for _ in range(m):
	amax = heappop(a_s)
	heappush(a_s, ceil(amax / 2))

res = sum([-heappop(a_s) for _ in range(n)])
print(res)
A, B = [int(x) for x in input().split(" ")]

ans= A + B

print("error" if ans >=10 else ans)

### FIXED CODE ###

A, B = [int(x) for x in input().split(" ")]

ans= A + B

print("error" if ans >=10 else ans)
n=int(input())
d=[]
for i in range(1, n+1)
  if i%3==0 or i%10==3:
    d.append(i)
print(" ", end="")
print(*d)


### FIXED CODE ###

n=int(input())
d=[]
for i in range(1,n+1):
    if i%3==0 or "3" in str(i):
        d.append(i)
print(" ",end="")
print(*d)
import sys
n = int(input())
a = list(map(int, input().split()))
count = 0
while all(a[i] % 2 == 0 for i in a):
    a = [a[i] // 2 for i in a]
    count+=1
print(count)

### FIXED CODE ###

import sys
n = int(input())
a = list(map(int, input().split()))
count = 0
while all(i % 2 == 0 for i in a):
    a = [i // 2 for i in a]
    count+=1
print(count)
#!venv/bin/python
#from collections import defaultdict 
from itertools import combinations
import math
import datetime
import numpy
from pprint import pprint
N = int(input())
A = [int(x) for x in input().split()]
import time

mat = numpy.zeros((N,N))
a2 = numpy.array(A).reshape(-1,1)

#pprint(a2)

for i in range(N):
    mat[i,i] = 0.5
    j = i + 1 if i != N -1 else 0
    mat[i,j] = 0.5
#print("mat")
#pprint(mat)
rev_mat = numpy.linalg.inv(mat)
#print("rev")
#print(rev_mat)

ans = numpy.dot(rev_mat,a2)
da = []
for a in ans:
    for b in a:
        da.append(str(int(b)))
print(" ".join(da))


### FIXED CODE ###

#!venv/bin/python
#from collections import defaultdict 
from itertools import combinations
import math
import datetime
import numpy
from pprint import pprint
N = int(input())
A = [int(x) for x in input().split()]

ans = []

ans1 = 0
plus = 1
for i in range(N):
    ans1 += plus * A[i]
    plus *= -1

ans.append(ans1)
plus = -1
for i in range(1,N):
    t = i - 1
    a = ans[t] + plus * 2 * A[t]
    plus *= -1
    ans.append(a)

print(" ".join([str(abs(s)) for s in ans]))
N = int(input())
A = [int(a) for a in input().split()]

def chk(k):
    if k == 1:
        for i in range(1, N):
            if A[i] <= A[i-1]: return 0
        return 1
    
    X = [(0, 0)]
    def add(x):
        if x <= 0: return 0
        if a > X[-1][0]:
            X.append((a, 0))
        elif a == X[-1][0]:
            if X[-1][1] + 1 < k:
                X[-1] = (X[-1][0], X[-1][1] + 1)
            else:
                add(x-1)
        else:
            while X[-1][0] > a:
                X.pop()
            if a > X[-1][0]:
                X.append((a, 1))
            elif a == X[-1][0]:
                if X[-1][1] + 1 < k:
                    X[-1] = (X[-1][0], X[-1][1] + 1)
                else:
                    add(x-1)
        return 1
    
    for a in A:
        c = add(a)
        if c == 0: return 0
    return 1

l, r = 0, 1 << 18
while r - l > 1:
    m = (l + r) // 2
    if chk(m):
        r = m
    else:
        l = m

print(r)

### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]

def chk(k):
    if k == 1:
        for i in range(1, N):
            if A[i] <= A[i-1]: return 0
        return 1
    
    X = [(0, 0)]
    def add(x, y):
        if x <= 0: return 0
        if x > X[-1][0]:
            X.append((x, 0 if x == y else 1))
        elif x == X[-1][0]:
            if X[-1][1] + 1 < k:
                X[-1] = (X[-1][0], X[-1][1] + 1)
            else:
                if add(x-1, y) == 0: return 0
        else:
            while X[-1][0] > x:
                X.pop()
            if x > X[-1][0]:
                X.append((x, 1))
            elif x == X[-1][0]:
                if X[-1][1] + 1 < k:
                    X[-1] = (X[-1][0], X[-1][1] + 1)
                else:
                    if add(x-1, y) == 0: return 0
        if X[-1][0] < y: X.append((y, 0))
        return 1
    
    for a in A:
        if add(a, a) == 0: return 0
    return 1

l, r = 0, 1 << 18
while r - l > 1:
    m = (l + r) // 2
    if chk(m):
        r = m
    else:
        l = m

print(r)
K = int(input())
S = input()

if len(S) <= K:
  print(S)
  
else:
  print("{}...".format(S[0,K]))

### FIXED CODE ###

K = int(input())
S = input()
 
if len(S) <= K:
  print(S)
  
else:
  print("{}...".format(S[:K]))
from fractions import gcd
#from math import gcd
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
ans = 0
tmp = A[0]
for i in range(1,N):
    tmp = gcd(A[i],tmp)
A = A//tmp
num = 0
numtmp = 10**10
hantei = False
judge = False
for i in range(N-1):
    tmp2 = gcd(A[i],A[i+1])
    if tmp2 == 1 and (i == 0 or i == N-2):
        num += 1
        numtmp = i
        hantei = True
        continue
    if tmp2 == 1 and judge == False:
        num += 1
        judge = True
        continue
    if tmp2 == 1 and judge == True:
        if num == 1:
            numtmp = i
        num += 1
        hantei = True
    judge = False
if hantei == True and num <= 2:
    ans = 0
    tmp3 = A[0]
    if numtmp == 0:
        tmp3 =A[1]
    for i in range(1,N):
        if i == numtmp:
            continue
        tmp3 = gcd(A[i],tmp3)
    print(tmp*tmp3)
else:
    print(tmp)


### FIXED CODE ###

from fractions import gcd
#from math import gcd
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
ans = 0

L = [0]*(N+1)
R = [0]*(N+1)
for i in range(0,N):
    L[i+1] = gcd(L[i],A[i])
for i in range(N-1,-1,-1):
    R[i] = gcd(R[i+1],A[i])

M = [0]*N
for i in range(N):
    M[i] = gcd(L[i],R[i+1])
print(max(M))
import fractions
N = int(input())
A = [int(i) for i in input().split()]

def mygcd(A):
    if len(A) == 1:
        return A[0]
    else:
        return fractions.gcd(A[0],mygcd(A[1:]))
        
ans = []
for i in range(N):
    ans.append(mygcd(A[:i]+A[i+1:]))

print(max(ans))

### FIXED CODE ###

from fractions import gcd
#input
N = int(input())
A = [int(i) for i in input().split()]
#cluc left and right gcd 
left = [0]*N
right = [0]*N
count = 0
left[0] = A[0]
right[-1] = A[-1]
Ans = []

for i in A[1:]:
    left[count+1] = gcd(left[count],i)
    count += 1

for i in reversed(A[:-1]):
    right[count-1] = gcd(right[count],i)
    count -= 1
# make ans
Ans.append(right[1])
Ans.append(left[-2])
for i in range(N-2):
    Ans.append(gcd(left[i],right[i+2]))
print(max(Ans))
a, b = map(int, input().split())

if a == b:
    print('H')
else:
    print('D')

### FIXED CODE ###

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

if a == b:
    print('H')
else:
    print('D')