peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
L = [1]
n = int(input())
x = 6
y = 9
while x <= n:
    L.append(x)
    x *= 6
while y <= n:
    L.append(y)
    y *= 9
L.sort()
dp = [float("Inf")]*(n+1)
dp[0] = 0
for i in range(n+1):
    for j in L:
        if i+j <= n:
            dp[i+j] = min(dp[i+j],dp[i]+1)
        else:
            break
print(dp[n])
# Judge status: Accepted
print('YNeos'[~('7'in input())%2::2])
# Judge status: Accepted
n, m = [int(i) for i in input().split(" ")]
sc = []
for i in range(m):
  sc.append([int(j) for j in input().split(" ")])

for i in range(10**(n-1) if n > 1 else 0, 10**(n), 1):
  f = True
  for con in sc:
    if str(i)[con[0]-1] != str(con[1]):
      f = False
  if f :
    print(i)
    break
else:
  print(-1)
# Judge status: Accepted
n = int(input())
num = dict()
for i in range(n):
    s = input()
    if s in num:
        num[s] += 1
    else:
        num[s] = 1
num_s = sorted(num.items(), key=lambda x:x[1],reverse=True)
max_num = max(num.values())
ans = []
for i in range(len(num_s)):
    if num_s[i][1] == max_num:
        ans.append(num_s[i][0])
ans.sort()
for i in range(len(ans)):
    print(ans[i])
# Judge status: Accepted
import sys,queue,math,copy
from fractions import gcd
input = sys.stdin.readline
LI = lambda : [int(x) for x in input().split()]
LI_2 = lambda : [int(x) / 2 for x in input().split()]

N,M = LI()
A = LI_2()

lcm = 1
for a in A:
    c = gcd(lcm,a)
    if (lcm//c) % 2 == 0:
        print (0)
        exit (0)
    lcm *= (a//c)

print (math.ceil((M//lcm) / 2))
# Judge status: Accepted
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
counter = np.append(0, np.bincount(A, minlength=10**5 + 10))
# print(counter)
cumsum = counter.cumsum()
# print(cumsum)
# print((cumsum[3:] - cumsum[:-3]))
print((cumsum[3:] - cumsum[:-3]).max())
# Judge status: Accepted
N=int(input())
A = list(map(int, input().split()))

dic={}
for i in A:
    if i in dic.keys():
        dic[i]+=1
    else:
        dic.setdefault(i,1)

hoge=0
for i in dic.values():
    hoge+=i*(i-1)
hoge =int(hoge/2)

for k in A:
    print(hoge-(dic[k]-1))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

cnt_2 = -1
multi_4 = 0
for i in range(n):
    if a[i] % 4 == 0:
        multi_4 += 1
    elif a[i] == 2:
        cnt_2 += 1
print("Yes" if multi_4 + max(0, cnt_2) >= n // 2 else "No")
# Judge status: Wrong Answer
#!/usr/bin/env python
# coding: utf-8

# In[71]:


s = input()
t = input()


# In[72]:


s_list = "".join(sorted(s))
t_list = "".join(sorted(t, reverse=True))
if sorted([s_list, t_list]) == [s_list, t_list]:
    print("Yes")
else:
    print("No")


# In[ ]:
# Judge status: Wrong Answer
import collections
import math


def main():
    n, k, s = map(int, input().split())
    if s > 1:
        print([s] * k + [s - 1] * (n - k))
    else:
        print([s] * k + [s + 1] * (n - k))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a < b <= 12:
    print(a)
elif a == b > 12 or (a and b > 12):
    print(12)
else:
    print(b)
# Judge status: Accepted
from collections import Counter
n = int(input())
A = list(map(int, input().split()))

c = Counter(A)

ans = 0
for k in c.keys():
    tmp = c[k-1] + c[k] + c[k+1]
    ans = max(ans, tmp)

print(ans)
# Judge status: Accepted
h = int(input())

result = 0
i = 1
while h > 0:
    h = h // 2
    result = result + i
    i *= 2

print(result)
# Judge status: Accepted
n, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, 1<<32 # (ng,ok] = (l,r]
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A: c += (a-1) // m
    if c <= k: ok = m
    else: ng = m
print(ok)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
c=int(input())
x=int(input())

m=x//500
n=(x-500*m)//100
way=0
while not m==0:
  way=way+n
  m-=1
  n+=5
print (way)
# Judge status: Wrong Answer
s = input()
s = s.replace("0B","").replace("1B","")
print(s.replace("B",""))
# Judge status: Accepted
dic={}

n=int(input())
for i in range(n):
    s=input()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=1

#print(dic)

maxa=0
for val in dic:
    maxa=max(dic[val],maxa)
ans=[]
for val in dic:
    if dic[val]==maxa:
        ans.append(val)
print("\n".join(sorted(ans)))
# Judge status: Accepted
s = sum(list(map(int,input().split())))
print("bust" if s > 21 else "win")
# Judge status: Accepted
c = input()
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o':
    print('vowel')
else:
    print('consonant')
# Judge status: Accepted
N, M = map(int,input().split())
A = list(map(int,input().split()))
# 17:22

import sys
from math import gcd
def lcm(a,b):
    return a//gcd(a,b)*b
#%%
ans = 0
L = 1
for i in range(N):
    L = lcm(L, A[i])
    if L>2*M:
        print(0)
        sys.exit()

L2 = L
L1 = L//2
for a in A:
    if (L//a)&1==0:
        print(0)
        sys.exit()
ans = M//L1 - M//L2
print(ans)
# Judge status: Accepted
n,k,q=map(int,input().split())
lst=[int(input()) for _ in range(q)]
lst_n=[k-q]*n
for i in lst:
  lst_n[i-1]+=1
for i in range(n):
  if lst_n[i]>=1:
    print("Yes")
  else:print("No")
# Judge status: Accepted
import math
N = int(input())
lsT = []
for i in range(5):
    lsT.append(int(input()))
print(4+math.ceil(N/min(lsT)))
# Judge status: Wrong Answer
def gcd(x, y):
    while (y):
        x, y = y, x % y
    return x

n,x=map(int,input().split())
a=list(map(int,input().split()))
if n==1:
    print(abs(a[0]-x))
else:
    a.append(x)
    a.sort()
    s = set()
    for i in range(1, n):
        s.add(a[i] - a[i - 1])
    s = list(s)
    hcf = s[0]
    for i in s[1:]:
        if i!=0:
            hcf = gcd(hcf, i)
    print(hcf)
# Judge status: Wrong Answer
N, S, K=map(int, input().split())
A=[str(K)]*S
B=[str(K+1)]*(N-S)
ans=A+B
print(" ".join(ans))
# Judge status: Accepted
X=int(input())
ans=[0]
for i in range(1,10**9):
    temp=ans[-1]+i
    ans.append(temp)
    if temp>=X:
        print(i)
        exit()
# Judge status: Accepted
S = input()

l0 = [0 if i % 2 == 0 else 1 for i in range(len(S))]
l1 = [1 if i % 2 == 0 else 0 for i in range(len(S))]

gap0 = 0
gap1 = 0
for i in range(len(S)):
    if l0[i] != int(S[i]):
        gap0 += 1
    if l1[i] != int(S[i]):
        gap1 += 1

print(min(gap0, gap1))
# Judge status: Accepted
n = int(input())
cou = 0
p = set()
for i in range(n):
    cou += i+1
    p.add(i+1)
    if cou == n:
        break
    elif cou > n:
        p = p - {cou-n}
        break

for i in p:
    print(i)
# Judge status: Accepted
youbi = ['SUN','MON','TUE','WED','THU','FRI','SAT']
y = input()

for i in range(7):
  if y == youbi[i]:
    print(7-i)
# Judge status: Wrong Answer
a,b,m = map(int,input().split())
A = list(input().split())
B = list(input().split())
X = []
Y = []
C = []
total = 2*10**5
for i in range(m):
    x,y,c = map(int,input().split())
    X.append(x)
    Y.append(y)
    C.append(c)
for i in range(m):
    result = int(A[int(X[int(i)])-1])+int(B[int(Y[int(i)])-1])-int(C[int(i)])
    if (total > result):
        total = result
if(int(min(A))+int(min(B))>result):
    print(result)
else:
    print(int(min(A))+int(min(B)))
# Judge status: Wrong Answer
N=int(input())
numbers=list(map(int,input().split()))
for i in range(1,N):
    for k in range(i):
        if numbers[k]<numbers[i]:
            temp=numbers[k]
            numbers[k]=numbers[i]
            numbers[i]=temp
            break
print(numbers)
Alice=0
Bob=0
for i in range(N//2+N%2):
    Alice+=numbers[2*i]
for i in range(N//2):
    Bob+=numbers[2*i+1]
print(Alice,Bob)
print(Alice-Bob)
# Judge status: Accepted
s=input()
if s[len(s)-1]=="s" :
    ans = s+"es"
else:
    ans = s+"s"
print(ans)
# Judge status: Accepted
s = list(input())
if len(set(s)) == len(s):
    print('yes')
else:
    print('no')
# Judge status: Accepted
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

MOD = 10**9+7
N,M = map(int, input().split())

if abs(N-M) == 1:
    ans = (math.factorial(N)*math.factorial(M))%MOD
elif abs(N-M) == 0:
    ans = (2*math.factorial(N)*math.factorial(M))%MOD
else: ans = 0

print(ans)
# Judge status: Accepted
#ABC093
s = input()
print("Yes" if len(set(s))==3 else "No")
# Judge status: Wrong Answer
N=int(input())
S=input()
if S=='#'*N or S=='.'*N:
  print(0)
  exit()
rightB=0
for i in S:
  if i=='#':
    rightB+=1
rightW=N-rightB
leftB=0
leftW=0
ans=rightB
for i in range(N):
  if S[i]=='.':
    leftW+=1
    rightW-=1
    d=rightW+leftB
    ans=min(ans,d)
  else:
    leftB+=1
    rightB-=1
    d=rightW+leftB
    ans=min(ans,d)
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(a) for a in input().split()]

total = 0
for a in A:
    total ^= a

for a in A:
    print(total^a, end=" ")
# Judge status: Accepted
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))

xn.sort()
ym.sort()

for z in range(x+1,y+1):
    if xn[-1]< z <=ym[0]:
        print('No War')
        exit()
print('War')
# Judge status: Wrong Answer
s=input()
k=int(input())
for i in s:
  if i=='1':
    k-=1
  else:
    k-=int(i)*(5*(10**15))
  if k<=0:
    print(i)
    exit()
# Judge status: Accepted
x,a,b=map(int, input().split())
da=abs(x-a)
db=abs(x-b)
if da>db:
  print("B")
else:
  print("A")
# Judge status: Accepted
w,h,n = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]

a = 0
b = w
c = 0
d = h

for i,j,k in l:
    if k == 1:
        a = max(a,i)
    elif k == 2:
        b = min(b,i)
    elif k==3:
        c = max(c,j)
    else:
        d = min(d,j)

    if a >= b or c >= d:
        print(0)
        exit()
print((b-a)*(d-c))
# Judge status: Accepted
X,N = map(int,input().split())
if(N == 0):
    print(str(X))
    exit()
p = list(map(int,input().split()))
p = sorted(p)
tmp = 200
for i in range(102):
    if(i in p):
        pass
    else:
        tmp2 = abs(X-i)
        if(tmp2 < tmp):
            tmp = tmp2
            ans = i
        elif(tmp2 == tmp):
            pass
print(str(ans))
# Judge status: Wrong Answer
l = list(input())[::-1]
ans = ''
idx = 0
while idx < len(l):
    cnt = 0
    while idx < len(l) and l[idx] == 'B':
        idx+=1
        cnt += 1
    idx += cnt
    if idx < len(l):
        ans += l[idx]
    idx+=1
print(ans)
# Judge status: Accepted
from collections import deque
N, M = map(int, input().split())
g = [[] for i in range(N+1)]
for _ in range(M):
    A, B = map(int, input().split())
    g[A].append(B)
    g[B].append(A)
Q = deque()
vstd = [0]*(N+1)
mark = [0]*(N+1)
vstd[1] = 1
Q.append(1)
while Q:
    par = Q.popleft()
    for r in g[par]:
        if vstd[r]==0:
            mark[r]=par
            vstd[r]=1
            Q.append(r)
print('Yes')
for mk in mark[2:]:
    print(mk)
# Judge status: Accepted
nDays = int(input())

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

for i in range(nDays - 1):
    tomorrow = [int(x) for x in input().split()]
    tomorrow[0] += max(today[1], today[2])
    tomorrow[1] += max(today[0], today[2])
    tomorrow[2] += max(today[0], today[1])
    today = tomorrow

print(max(today))
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())
if A-C <= 1:
    if B-D <= 0:
        print("No")
    else:
        print("Yes")
else:
        print("Yes")
# Judge status: Accepted
X,Y=map(int,input().split())
ans=0
while X<=Y:
    ans+=1
    X<<=1
print(ans)
# Judge status: Accepted
from math import atan, degrees

a, b, x = map(int, input().split())
if x > 1/2 * b * a**2:
    w = 2 * (b/a - x/a**3)
else:
    w = a * b**2 / (2*x)
print(degrees(atan(w)))
# Judge status: Accepted
n, k = (int(x) for x in input().split())
h = [0] + [int(x) for x in input().split()]
dp = [float('inf')] * (n + 1)
dp[1] = 0
for i in range(2, n + 1):
    for j in range(1, k + 1):
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print(dp[n])
# Judge status: Accepted
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))

for i in range(N):
    H[i] = abs(A - (T - H[i]*0.006))

print(H.index(min(H))+1)
# Judge status: Accepted
N=int(input())
c=input()
a=0
b=0
for i in range(N):
    if c[i]=='R':
        a+=1

ans=max(a,b)
for i in range(N):
    if c[i]=='R':
        a-=1
    else:
        b+=1
    now=max(a,b)
    ans=min(ans,now)
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]

from collections import Counter

c = Counter(a)

print(sum([1 for num,cnt in c.items() if cnt&2]))
# Judge status: Accepted
import sys,math,collections,itertools
input = sys.stdin.readline

N,M=list(map(int,input().split()))
ball = [0]*(N+1)
ball[1]=1
ball_num = [1]*(N+1)
for i in range(M):
    x,y=map(int,input().split())
    if ball[x]==1:
        ball[y]=1
    ball_num[x]-=1
    ball_num[y]+=1
    if ball_num[x]==0:
        ball[x]=0
    
cnt = 0
for a,b in zip(ball_num,ball):
    cnt += (a!=0 and b != 0)
print(cnt)
# Judge status: Accepted
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = [0] * n
for i in range(n):
    ans[i] = sum(a1[:i+1]) + sum(a2[i:])

print(max(ans))
# Judge status: Accepted
ans = 1

s = int(input())
l = {s}

while True:
    ans += 1
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    if s in l:
        print(ans)
        break
    l.add(s)
# Judge status: Accepted
n, a1, a2 = map(int, input().split(" "))
anscount = [0 for i in range(n + 1)]

for i in range(1, n):
    for j in range(i + 1, n + 1):
        anscount[min(abs(j - i), abs(i - a1) + abs(j - a2) + 1, abs(i - a2) + abs(j - a1) + 1)] += 1

for i in range(1, n):
    print(anscount[i])
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

b = [0] * n

if n % 2 == 0 :
    c = n//2 - 1
else :
    c = n // 2

b[c] = a[0]

for i in range(1,n) :
    if i % 2 == 1 :
        b[c + i] = a[i]
        c += i
    else :
        b[c - i] = a[i]
        c -= i

if c != 0 :
    b.reverse()
    print(b)
else :
    print(b)
# Judge status: Accepted
n=int(input())
s=[input() for i in range(n)]

a=ord("a")
l=[50]*26

for i in s:
    for j in range(26):
        l[j] = min(l[j],i.count(chr(a+j)))

for i in range(26):
    for kk in range(l[i]):
        print(chr(a+i),end="")
# Judge status: Accepted
d = int(input())

dict = {25:'Christmas',
        24:'Christmas Eve',
        23:'Christmas Eve Eve',
        22:'Christmas Eve Eve Eve'}

a = dict[d]

print(a)
# Judge status: Accepted
S = input()
 
 
if S[0] != "A":
    print("WA")
 
elif "C" in S:
    a = S.index("C")
 
    if 2 <= a <= len(S)-2:
        S = S.replace("A", "", 1).replace("C", "", 1)
        
        if S.islower():
            print("AC")
        
        else:
            print("WA")
 
    else:
        print("WA")
 
else:
    print("WA")
# Judge status: Wrong Answer
A, B, C = input().split()
print("A"+B+"C")
# Judge status: Wrong Answer
nn,*a=open(0).read().split()
n=int(nn)
cnt=0
for left in range(n-1):
  for right in range(left+1,n):
    for leng in range(10):
      flg=True
      if not a[left][leng] in a[right]:
        flg=False
        break
    if flg:
      cnt+=1
print(cnt)
# Judge status: Accepted
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
a=[]
b=[]
for i in range(n):
  a.append(l[i][0]+l[i][1])
  b.append(l[i][0]-l[i][1])
print(max(max(a)-min(a),max(b)-min(b)))
# Judge status: Wrong Answer
import math
a,b,c=map(int, input().split())

if a+2*math.sqrt(a)+math.sqrt(b)+b<c:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N=str(input())
ABC=[chr(i) for i in range(65, 65+26)]
if N in ABC:
    print("A")
else:
    print("a")
# Judge status: Accepted
N, A, B = map(int, input().split())

count = N // (A + B)

blue = A * count
red = B * count

N -= blue + red

if N > A:
    blue += A
    red += (N - A)
else:
    blue += N

print (blue)
# Judge status: Wrong Answer
import numpy as np
import itertools

n, d = map(int,input().split())
x = np.array([list(map(int,input().split())) for i in range(n)])

i = 1
tmp = 0
sq = []
while tmp <= 40**2*10:
    tmp += i**2
    sq.append(i**2)
    i += 1

cnt = 0
l = [int(i) for i in range(n)]
for v in itertools.combinations(l, 2):
    i, j = v[0], v[1]
    sub = x[i] - x[j]
    dist = sum(sub**2)
    if dist in sq:
        cnt += 1
print(cnt)
# Judge status: Accepted
from itertools import permutations

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

i = 0
a = 0
b = 0
for s in permutations(range(1, n+1)):
    for j in range(n):
        if p[j] != s[j]:
            break
    else:
        a = i
    for j in range(n):
        if q[j] != s[j]:
            break
    else:
        b = i
    i += 1

print(abs(a-b))
# Judge status: Accepted
n = int(input())
L = list(map(int,input().split()))

diff = 10**10
sum1 = sum(L)
l_sum = 0
ans = 10**10

for i in range(n-1):
    l_sum+=L[i]
    diff = abs(l_sum- sum1 + l_sum)
    ans = min(ans,diff)
    
print(ans)
# Judge status: Wrong Answer
N = int(input())
B = list(map(int, input().split()))
x = 1
result = 0
count = 1

for a in B[:N-2]:
    if a < B[x]:
        result += a * count
        if x < N - 2:
            x += 1
    else:
        count += 1
        if x < N - 2:
            x += 1
        continue
print(result + B[N-2])
# Judge status: Accepted
def ss(s):

    ans = 0
    ss = s
    flag = True

    while flag:
        ss = ss[:int(len(ss)-2)]
        if ss[:int(len(ss)/2)] == ss[(int(len(ss)/2)):]:
            ans += len(ss)
            flag = False

    return ans

def main():
    s = str(input())
    print(ss(s))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
A = [[0 for i in range(11)] for j in range(11)]
for i in range(1, N+1):
  A[int(str(i)[0])][int(str(i)[-1])] +=1

B = [[0 for i in range(11)] for j in range(11)]
for i in range(1, N+1):
  B[int(str(i)[0])][int(str(i)[-1])] +=1

ans = 0
for i in range(10):
  for j in range(10):
    ans += A[i][j] * B[j][i]
  
print(ans)
# Judge status: Wrong Answer
N, M, X, Y = map(int, input().split())
x = input().split()
y = input().split()
x = [int(i) for i in x]
y = [int(i) for i in y]
x.sort()
y.sort()
if (x[-1] < y[0]) and (Y >= x[-1]) and (X < y[0]):
    print("No War")
else:
    print("War")
# Judge status: Accepted
from functools import reduce
import fractions
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
N = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
 
cand = lcm_list(As)
 
sum = 0
 
for num in As:
    sum = sum + cand // num
 
print(sum % (10**9 + 7))
# Judge status: Accepted
n=int(input())
s=input()
c=s.count
a=c("R")*c("G")*c("B")
for i in range(n-2):
    for j in range((n-i+1)//2):
        if s[i]!=s[i+j] and s[i+j]!=s[i+2*j] and s[i+2*j]!=s[i]:
            a-=1
print(a)
# Judge status: Accepted
s = input()

start = []
end = []
for i in range(len(s)):
    if s[i] == "A":
        start.append(i)
    if s[-(i+1)] =="Z":
        end.append(len(s)-i)
print(end[0]-start[0])
# Judge status: Accepted
K=int(input())
A,B=map(int,input().split())
b=B//K
if A<=b*K:
	print("OK")
else:
	print("NG")
# Judge status: Wrong Answer
N = int(input())
if N == 2 or 4 or 5 or 7 or 9:
    print("hon")
elif N == 0 or 1 or 6 or 8:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
a = input()
t = 1
b =["q","a","z","w","s","x","e","d","c","r","f","v","t","g","b","y","h","n","u","j","m","i","k","p","o","l"]
for i in range(26):
  if a == b[i]:
    print("a")
    t = 0
    break
if t == 1:
  print("A")
# Judge status: Accepted
n,m=map(int,input().split())
l=1
r=n
for i in range(m):
    ll,rr = map(int,input().split())
    l=max(l,ll)
    r=min(r,rr)
if l<=r:
    print(r-l+1)
else:
    print(0)
# Judge status: Accepted
A1, A2, A3 = map(int, input().split())

if A1+A2+A3 >= 22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
n = int(input())
s = set([])

for i in range(n):
    s.add(input())
print(len(s))
# Judge status: Wrong Answer
n,c,k = map(int, input().split())
t = list(int(input()) for _ in range(n))

#Ti以上Ti+k以下のバスに乗る
#定員はC人

T = [i+k for i in t]

cnt = 0
bus = 0
x = 0
for i in range(n):
    cnt += 1
    if x==0: x = T[i]
    if x < t[i] or cnt == c:
        bus += 1
        x = T[i]
        if x < t[i]:cnt = 1
        else: cnt == 0
print(bus+1 if cnt >= 1 else bus)
# Judge status: Accepted
n,*L = map(int,open(0).read().split())

print(n//min(L) + 5 if n%min(L)!=0 else n//min(L) +4)
# Judge status: Wrong Answer
n = int(input())
ans = [2,1]

if n == 1:
  print(2)
  exit()

for _ in range(n-2):
  ans.append(ans[-1]+ans[-2])
  
print(ans[-1])
# Judge status: Wrong Answer
import re
multiplies = []

for i in range (1, 100):
    multiplies.append(i * 2019)

S = input()

count = 0

for i in multiplies:
    count += len(re.findall('(?=' + str(i) + ')',S))

print(count)
# Judge status: Accepted
def collatz(n):
    if n % 2 == 0:
        return int(n / 2)
    else:
        return int(n * 3 + 1)


s = int(input())
As = [s]
num = collatz(s)
while num not in As:
    As.append(num)
    num = collatz(num)

print(len(As) + 1)
# Judge status: Accepted
## C - Christmas Eve
N, K = map(int, input().split())
H = sorted([int(input()) for i in range(N)])
rt = 10**9
for i in range(0,N-K+1):
    rt = H[K - 1 + i] - H[i] if rt > H[K - 1 + i] - H[i] else rt
print(rt)
# Judge status: Accepted
A, B, C, D = map(int, input().split())

while A > 0 and C > 0:
    C = C - B
    A = A - D

if C <= 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-
a,b = map(int,input().split())

east_number = b - a
west_hight = 0
for i in range(east_number):
    west_hight += i
ans = west_hight - a
print(ans)
# Judge status: Accepted
C = input()

a = "abcdefghijklmnopqrstuvwxyz"
d = dict()
for i, x in enumerate(a):
    d[x] = i+1
print(a[d[C]])
# Judge status: Accepted
n = int(input())
al = list(map(int, input().split()))
s = sum(al)
acc = 0
res = 10**18
for a in al:
    acc += a
    res = min(res, abs((s-acc)-acc))
print(res)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

G = A[0]
for a in A:
    G = gcd(G, a)

print(G)
# Judge status: Accepted
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n):
    now = a[i] + a[i-1]
    if x >= now:
        continue
    ans += now - x
    a[i] -= min(a[i], now-x)

print(ans)
# Judge status: Accepted
from sys import stdin
import sys
import math

[N, C, K] = list(map(int, stdin.readline().rstrip().split()))
T = sorted([int(input()) for i in range(N)])

bus = 1
passenger = 0
first_passengers_time = -1
for i in T:
    if passenger == C or (passenger > 0 and first_passengers_time + K < i):
        bus += 1
        passenger = 0
        first_passengers_time = 0

    if passenger == 0:
        passenger += 1
        first_passengers_time = i
    elif passenger < C and first_passengers_time + K >= i:
        passenger += 1

print(bus)
# Judge status: Wrong Answer
M = 10**9 + 7
n, a, b = map(int, input().split())
r = pow(2, n, M) - 1
f = c = 1
for i in range(b):
  f = f * (i + 1) % M
  c = c * (n - i) % M
  if i + 1 == a:
    r -= c * pow(f, M - 2, M)
print((r - c * pow(f, M - 2, M) % M))
# Judge status: Accepted
S = input()
T = input()
n = len(S)
chars1 = []
chars2 = []
pos1 = {}
pos2 = {}
for i in range(n):
    c1 = S[i]
    c2 = T[i]
    if c1 in pos1:
        chars1[pos1[c1]].append(i)
    else:
        pos1[c1] = len(chars1)
        chars1.append([i])

    if c2 in pos2:
        chars2[pos2[c2]].append(i)
    else:
        pos2[c2] = len(chars2)
        chars2.append([i])
print('Yes' if chars1 == chars2 else 'No')
# Judge status: Accepted
N = int(input())

qq = [[0]*10 for _ in range(10)]

def start(n):
    return int(str(n)[0])
def end(n):
    return int(str(n)[-1])

for i in range(1,N+1):
    qq[start(i)][end(i)] += 1

ans = 0
for i in range(1,10):
    for j in range(i,10):
        if i == j:
            ans += qq[i][j]**2
        else:
            ans += qq[i][j]*qq[j][i]*2

print(ans)