peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
N = int(input())
a = [int(input()) for i in range(N)]
d = [0] * N
b = 0
c = 0
while True:
    if b == 1:
        print(c)
        sys.exit()
    c += 1
    b = a[b] - 1
    if d[b] == 1:
        print('-1')
        sys.exit()
    d[b] = 1
# Judge status: Accepted
N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for i in range(N)]
min_cost=float("inf")
for bit in range(1<<N):
    cost=0
    understand=[0]*M
    for digit in range(N):
        if (bit>>digit)&1:
            cost+=CA[digit][0]
            for m in range(M):
                understand[m]+=CA[digit][m+1]
    if all(understand[m]>=X for m in range(M)):
        min_cost=min(min_cost,cost)
print(min_cost if min_cost!=float("inf") else -1)
# Judge status: Accepted
S = input()

cap = S[0]
mid = list(S[2:-1])

if (mid.count('C') >= 1):
    index = S.index('C')
    strr = S[1:index] + S[index + 1 :]
else:
    print('WA')
    exit()


if (cap == 'A' and mid.count('C') == 1 and strr.islower() == True):
    print('AC')
else:
    print('WA')
# Judge status: Accepted
n = int(input())
student = list(map(int,input().split()))
a = [0]*n
 
for i in range(n):
  s = student[i] #生徒が出席した番号をメモ
  a[s-1] = i+1
  
print(*a)
# Judge status: Wrong Answer
N, X, T = map(int, input().split())
print((N+T-1)//X * T)
# Judge status: Accepted
S=input()
array=[]
for i in range(len(S)):
    if S[i]=='B':
        if array==[]:
            array=[]
        else:
            array.pop(-1)
    else:
        array.append(S[i])
c=""
for i in range(len(array)):
    c+=array[i]
print(c)
# Judge status: Accepted
a,b,c,d = map(int,input().split())

if abs(c-a) <= d or ((abs(b-a) <= d and abs(c-b) <= d)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    from itertools import accumulate
    n, k = map(int, input().split())
    *exp, = map(lambda x: (int(x) + 1) / 2, input().split())
    l = accumulate(exp)
    l = list(l)
    ans = l[k - 1]
    for i in range(0, n - k):
        x = l[i + k] - l[i]
        ans = max(ans, x)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
cnt1,cnt2,cnt4=0,0,0
for i in A:
  if i%2!=0:
    cnt1+=1
  elif i%2==0 and i%4!=0:
    cnt2+=1
  else:
    cnt4+=1
Check1=cnt4*2-cnt1
if cnt2%2==0:
  if Check1>=0:
    print('Yes')
    exit()
else:
  if Check1>=1:
    print('Yes')
    exit()
print('No')
# Judge status: Accepted
s=input()
for i in range(len(s)):
  if s[i] in s[i+1:]:
    print('no')
    break
  elif i==len(s)-1:
    print('yes')
# Judge status: Accepted
n, m = map(int,input().split())

ans = 0
if n > m//2:
    ans = m//2
else:
    ans += n
    m = m - n*2
    ans += m//4
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()

res =""

for ch in s:
    res += chr((ord(ch) + n) % 26)
print(res)
# Judge status: Wrong Answer
N = int(input())
A_ = list(map(int, input().split()))
A = list()
for i in range(len(A_)):
    if A_[i] < N - 1:
        A.append([i + 1, A_[i]])
ret = 0
for i in range(len(A)-1, -1, -1):
    ind, val = A[i][0], A[i][1]
    B = [a for a in A if a[1] < N - 1 - val]
    for b in B:
        if abs(b[0] - ind) == val + b[1]:
            ret += 1
print(ret)
# Judge status: Accepted
R=[int(input()) for i in range(5)]
r=[]
p=10
for i in range(5):
    if R[i] % 10 != 0:
        p = min(p,R[i]%10)
ans = 0
for i in range(5):
    if R[i] % 10 != 0:
        if R[i] % 10 == p:
          ans += R[i]
          p = 10
        else:
          ans += R[i] - R[i] % 10 + 10
    else:
        ans += R[i]
print(ans)
# Judge status: Wrong Answer
E,T=map(int,input().split())

Emotone=(E/0.08)
A=int(E/0.08)

if Emotone>A:
  Emotone=int(A+1)

if T<=((0.1/0.08)*E)<T+1:
  print(int(Emotone))
else:
  print(-1)
# Judge status: Accepted


def solve():

    N = int(input())
    for i in range(100, 1000):
        si = str(i)
        if N <= i:
            if si[0] == si[1] == si[2]:
                print(i)
                exit()


if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
s = int(input())
arr = []
count = 0
while s!=1:
  if s%2==0:
    s /= 2
  else:
    s = s*3+1
  count += 1
print(count+2)
# Judge status: Wrong Answer
# A - Kyu in AtCoder

late_table = [
    [400, 8],
    [600, 7],
    [800, 6],
    [1000, 5],
    [1200, 4],
    [1400, 3],
    [1600, 2],
    [1800, 1]
]


def kyu(late):
    for i in late_table:
        if late < i[0]:
            return i[1] + 1


if __name__ == "__main__":
    late = int(input())
    print(kyu(late))
# Judge status: Accepted
A,B,K=map(int,input().split())
 
if A-K>=0:
  print(A-K,B)
elif (A+B)<=K:
  print(0,0)
else:
  print(0,A+B-K)
# Judge status: Accepted
S=int(input())
if S >= 30:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())
s=0
for i in range(N):
  if i%3!=0 and i%5!=0:
    s+=i
print(s)
# Judge status: Accepted
s = list(input())

k, m, n, h = 0, 0, 0, 0

if 'N' in s:
    k = 1
if 'S' in s:
    m = 1
if 'W' in s:
    n = 1
if 'E' in s:
    h = 1

if (abs(k-m))%2 == 0 and (abs(n-h))%2 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = "Good"
c = '_'
for c2 in input():
  if c == c2:
    s = "Bad"
  c = c2
print(s)
# Judge status: Accepted
x, a, b = map(int, input().split())

if a >= b:
    print("delicious")
elif b <= a + x:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
ABCD=input()
a=list(ABCD)

for p in range(1<<3):
    t = int(a[0])
    ans = a[0]
    for i in range(1,4):
        if p&(1<<(i-1)):
            t+=int(a[i])
            ans += '+' + a[i]
        else:
            t-=int(a[i])
            ans += '-' + a[i]
    if t==7:
        print(ans+'=7')
        break
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))

p = round(sum(x)/n)

s = 0
for i in range(n):
  s += abs((x[i]-p))**2
  
print(s)
# Judge status: Accepted
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))
# Judge status: Accepted
n = int(input())
s = input()
rr = 0
gg = 0
bb = 0
for i in range(n):
    if s[i] == "R":
        rr += 1
    if s[i] == "G":
        gg += 1
    if s[i] == "B":
        bb += 1

ans = rr * gg * bb

for j in range(n):
    for i in range(min(j+1, n-j)):
        if s[j - i] != s[j] and s[j] != s[j + i] and s[j + i] != s[j - i]:
            ans -= 1
print(ans)
# Judge status: Accepted
n = int(input())
H = list(map(lambda x: int(x)-1, input().split()))
for i in range(n-1):
    if H[i] > H[i+1]:
        if H[i] <= H[i+1] + 1:
            # 次に1を足して大きいならOK
            # 足した場合は記録する
            H[i+1] += 1
        else:
            print('No')
            break
else:
    print('Yes')
# Judge status: Accepted
from itertools import combinations
N = int(input())
L = list(map(int, input().split()))

lst = list(combinations(range(N), 3))

ans = 0
for a, b, c in lst:
    if L[a] + L[b] <= L[c]:
        continue
    elif L[b] + L[c] <= L[a]:
        continue
    elif L[c] + L[a] <= L[b]:
        continue
    elif L[a] == L[b] or L[a] == L[c] or L[b] == L[c]:
        continue
    else:
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
N, K = map(int, input().split())
h = list(map(int, input().split()))
DP = [0]*N
if N < K:
    print(abs(h[0]-h[N-1]))
    sys.exit()

for i in range(1, K+1):
    DP[i] = abs(h[0]-h[i])
if N == K:
    print(DP[N-1])
    sys.exit()

for i in range(K, N):
    DPmin = 10000000
    for j in range(i-K, i):
        DPmin = min(DPmin, DP[j]+abs(h[j]-h[i]))
    DP[i] = DPmin
print(DP[N-1])
# Judge status: Accepted
from collections import Counter

n = int(input())
c = Counter(map(int, input().split()))

print("YES" if c.most_common(1)[0][1] <= 1 else "NO")
# Judge status: Accepted
a = list(map(int, input().split(' ')))
for i in range(len(a)):
    if a[i] == 0:
        print(i+1)
# Judge status: Accepted
S = input()
temp = S[0]
K = 0
cnt = 1
for i in range(2, len(S)+1):
    if temp!=S[cnt:i]:
        temp = S[cnt:i]
        K+=1
        cnt = i
print(K+1)
# Judge status: Accepted
a = input()
if a == "ABC":
  print("ARC")
else:
  print("ABC")
# Judge status: Accepted
from collections import deque

N = int(input())
s = list(map(int, input().split()))
s.sort()
s = deque(s)
gosei = 0
i = 0
while len(s) > 1:
    x = s.popleft()
    y = s.popleft()
    gosei = (x + y) / 2
    s.appendleft(gosei)
print(gosei)
# Judge status: Accepted
S = input()

cnt = 0
i = 0
while i < (len(S)-1):
    if S[i] == S[i+1]:
        cnt += 1
        i += 3
    else:
        i += 1

print(len(S) - cnt)
# Judge status: Accepted
a, b = map(int,input().split())

if a*b <= 0: #異符号もしくは0を含むなら
    print("Zero")

elif a > 0: #両方正なら
    print("Positive")

else: #両方負なら
    if (b-a)%2==0:
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd,numbers)

K =int(input())
sum = 0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            sum += gcd(a,b,c)
print(sum)
# Judge status: Accepted
n,x,y=map(int,input().split())
G=[[i,i+2] for i in range(n)]
G[0],G[-1]=[2],[n-1]
G[x-1].append(y)
G[y-1].append(x)
#print(G)
ans=[0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        temp1=j-i
        temp2=abs(x-(i+1))+1+abs(y-(j+1))
        dis=min(temp1,temp2)
        ans[dis-1]+=1
print(*ans,sep='\n')
# Judge status: Accepted
import sys
n = int(input())
# 2, 4, 8, 16, 32, 64 | 128

# if n % 2 == 1:
#     print(0)
#     sys.exit()

if n == 1:
    print(1)


if 2 <= n and n < 4:
    print(2)
elif 4 <= n and n < 8:
    print(4)
elif 8 <= n and n < 16:
    print(8)
elif 16 <= n and n < 32:
    print(16)
elif 32 <= n and n < 64:
    print(32)
elif 64 <= n and n <= 100:
    print(64)
# Judge status: Accepted
s=list(input())
ans=[]
for i in range(len(s)):
    if s[i]=="0":
        ans.append("0")
    elif s[i]=="1":
        ans.append("1")
    else:
        ans=ans[:-1]
        
print("".join(ans))
# Judge status: Wrong Answer
N = int(input())
print(((N//2)+1)/2/N if N%2 != 0 else "0.5" )
# Judge status: Accepted
A, B = map(int, input().split())
cnt=0
for i in range(A,B+1):
    i=str(i)
    a=i[::-1]
    flag=0
    for j in range(len(i)):
        if i[j]!=a[j]:
            flag=1
    if flag==0:
        cnt+=1
print(cnt)
# Judge status: Wrong Answer
a,b=[int(i) for i in input().split()]
s=input()
ans=0
if s[a]!="-":
    ans+=1
else:
    front=s[:a]
    back=s[a+1:]
    if ("-" not in front) and ("-" not in front):
        pass
    else:
        ans+=1
if ans==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import numpy as np
array = list(map(int, input().split(' ')))
print(np.unique(array))
# Judge status: Accepted
a, b = input().split()
x = int(a + b)
for i in range(3, 1200):
    if i * i == x:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
S = input()
ans = 1
tmp = S[0]
flg = False
for i in range(1,len(S)):
    if flg:
        tmp += S[i]
        ans += 1
        flg = False
        continue
    if S[i] != tmp:
        tmp = S[i]
        ans += 1
    else:
        flg = True
print(ans)
# Judge status: Wrong Answer
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
day=n-sum(a)
if day>0:
    print(day)
else:
    print(-1)
# Judge status: Accepted
N = int(input())
*A, = map(int,input().split())

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

for a in A:
    print(ans^a)
# Judge status: Accepted
import sys
a, b, c = map(int, sys.stdin.readline().split())

print(c, a, b)
# Judge status: Accepted
A,V = list(map(int, input().split()))
B,W = list(map(int, input().split()))
T = int(input())
if V - W <= 0:
    print("NO")
else:
    remain = abs(A-B)
    r, q = divmod(remain, V-W)
    if r == T and q == 0:
        print("YES")
    elif r < T:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
A,B = list(map(int,input().split()))
ans = 1
for i in range(10**18):
    if A * 2 <= B:
        A *= 2
        ans +=1
    else:
        print(ans)
        exit()
# Judge status: Wrong Answer
d, n = map(int, input().split())
print(n*(10**(2*d)))
# Judge status: Accepted
antena = [int(input()) for _ in range(5)]
k = int(input())
for i in range(5):
    for j in range(i + 1, 5):
        a = antena[i]
        b = antena[j]
        if b - a > k:
            print(':(')
            exit()
print('Yay!')
# Judge status: Accepted
def main():
    x, y = map(int, input().split())
    ans = x + y // 2
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def main(N, M, A):
    memo = N - sum(A)
    if memo >= 0:
        return memo
    else:
        return -1

if __name__ == '__main__':
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))
    # N = 314
    # M = 15
    # A = list(map(int, "9 26 5 35 8 9 79 3 23 8 46 2 6 43 3".split()))
    # print(N, M, A)
    print(main(N, M, A))
# Judge status: Accepted
n=int(input())
l=map(int,input().split())
c=0
for i in l:
  if i==c+1: c+=1
print(n-c if c else -1)
# Judge status: Accepted
from itertools import permutations, accumulate
mod = 2019

a = list(map(int,input()))
n = len(a) #入力の桁数

for i in range(n):
    a[i] *= pow(10,n-i-1,mod) #pow(a,b)==a^b べき乗
    
s = [0]+list(accumulate(a)) #accumulate([1,2,3,4,5]) --> 1 3 6 10 15
d = [0]*mod
ans = 0
for i in s:
    j = i%mod
    ans += d[j]
    d[j] += 1
print(ans)
# Judge status: Accepted
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
#m = y[n//2-1:n//2+1]
m_index = n//2-1
m = y[m_index]

for i in range(n):
  if x[i] <= m:
    print(y[m_index+1])
  else:
    print(y[m_index])
# Judge status: Accepted
from collections import*
s,t=Counter(input()),Counter(input())
print("YNeos"[sorted(s.values())!=sorted(t.values())::2])
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())

t=0
while a >= b:
  b *= 2
  t += 1
while b >= c:
  c *= 2
  t += 1
if k >= t:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

h.sort()
print(sum(h[:-k]))
# Judge status: Accepted
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
side = []
check = 4
A = sorted(set(A), reverse=True)
for i in A:
    if cnt[i] != 1:
        side.append(i)
        check -= cnt[i]
    if check <= 0:
        break
try:
    print(side[0]*side[1])
except IndexError:
    try:
        print(side[0]**2)
    except IndexError:
        print(0)
# Judge status: Accepted
s = input()
n = len(s)
ans = 'Yes'
for i in range(n):
    if i%2 == 0:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            ans = 'Yes'
        else:
            print('No')
            exit()

    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            ans = 'Yes'
        else:
            print('No')
            exit()

print(ans)
# Judge status: Accepted

# abc149_c

X = int(input())

def is_prime(n):
  dmax = int(n**0.5)+2
  for i in range(2, dmax):
    if n%i==0:
      return False
  return True

if X==2:
  print(X)
else:
  p = False
  while not p:
    p = is_prime(X)
    if p:
      print(X)
    X = X+1
# Judge status: Accepted
n,m =  map(int,input().split())
if n >= m//2:
    ans = min(n,m//2)
else:
    ans = n
    m -= 2*n
    ans += m//4
print(ans)
# Judge status: Accepted
s = input()

S = 0
T = 0

for c in s:
  if c == 'S':
    S += 1
  else:
    if S > 0:
      S -= 1
    else:
      T += 1
      
print(S+T)
# Judge status: Accepted
N = int(input())
W = [input() for _ in range(N)]

if len(list(set(W))) == N:
    first = W[0]
    for i in W[1:]:
        if first[-1] != i[0]:
            print("No")
            exit()
        first = i
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, L = map(int, input().split())
S = [input() for i in range(N)]
ans = ""
for i in range(N):
    tmp = min(S)
    S.remove(tmp)
    ans += tmp

print(ans)
# Judge status: Wrong Answer
from math import *
s=int(input())
x1=int(sqrt(s))
y2=ceil(s/x1)
x2=x1*y2-s
print(0,0,x1,1,x2,y2)
# Judge status: Wrong Answer
k=int(input())
print(int((int(k/2))*(int(k+1)/2)))
# Judge status: Wrong Answer
N = int(input())
ti = [int(input()) for i in range(N)]


def euc_alg(val1, val2):
    assert val1 >= val2

    if val1 == val2:
        return val1

    mod = val2
    divided = val1
    while 1:
        tmp_mod = divided % val2

        if tmp_mod == 0:
            break
        divided = mod
        mod = tmp_mod

    ret = val1 * val2 // mod

    return ret

maxti = max(ti)
least_common_mult = max([euc_alg(maxti, t) for t in ti])

print(least_common_mult)
# Judge status: Accepted
h, a = map(int, input().split())

num = 0
while(1):
    num += 1
    h -= a
    if h <= 0:
        print(num)
        break
# Judge status: Accepted
A, B, T = map(int, input().split())
ans = 0
time = A
while T+0.5 >= time:
    ans = ans+B
    time = time+A
print(ans)
# Judge status: Accepted
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

lcm = 1
for a in A:
    lcm = lcm // gcd(lcm,a) * a

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)
# Judge status: Wrong Answer
x,y = map(int, input().split())
if x%y==0 or y%x==0: print(-1)
else: print(x)
# Judge status: Accepted
N, M, X = map(int, input().split())
from itertools import product

CA = [
  list(map(int, input().split())) for _ in range(N)
]
P = list(product([0,1], repeat = N))

COST = 10 ** 9 + 7
for p in P:
  skill = [0]*M
  cost = 0
  for i, _p in enumerate(p):
    if _p == 0:
      cost += CA[i][0]
      for j in range(M):
        skill[j] += CA[i][j+1]
  #print(skill, cost)
  if min(skill) >= X:
    COST = min(COST, cost)

if COST == 10 ** 9 + 7:
  print(-1)
else:
  print(COST)
# Judge status: Accepted
n,m=map(int,input().split())
x=set([int(input()) for _ in range(m)])
f=[0]*(n+1)
f[0]=1
for i in range(1,n+1):
  f[i]=(f[i-1]+f[i-2])%(10**9+7)
  if i in x:
    f[i]=0
print(f[n]%(10**9+7))
# Judge status: Accepted
import bisect

f_inf = float("inf")
n = int(input())
A = [int(input()) for _ in range(n)][::-1]
dp = [f_inf for _ in range(n + 1)]

for a in A:
    idx = bisect.bisect_right(dp, a)
    dp[idx] = a

ans = bisect.bisect_left(dp, f_inf)
print(ans)
# Judge status: Accepted
import itertools
S = str(input())
L = ("+","-")

kouho = list(itertools.product(L, repeat=3))
#print(kouho)
for x in kouho:
  temp = S[0]+x[0]+S[1]+x[1]+S[2]+x[2]+S[3]
  ans = eval(temp)
  if ans == 7:
    print(temp+"=7")
    exit()
# Judge status: Accepted
import numpy as np
N, K = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h, dtype='int32')
x = [0] * N
x = np.array(x, dtype='int32')
x[0] = 0
x[1] = x[0] + abs(h[1] - h[0])
for i in range(2, N):
    if (i < K):
        x[i] = min(x[0:i] + abs(h[i] - h[0:i]))
    else:
        x[i] = min(x[i - K:i] + abs(h[i] - h[i - K:i]))
print(x[N - 1])
# Judge status: Wrong Answer
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
if len([s for s in S[3:-2] if s == 'C']) != 1:
    print('WA')
    exit()
SL = [s for s in S if s not in ['A', 'C']]
if not all([sl.islower() for sl in SL]) or len(SL) + 2 != len(S):
    print('WA')
    exit()
print('AC')
# Judge status: Accepted
x = int(input())
ans = x//11*2
if 6 < x%11:
    ans += 2
elif 0 < x%11:
    ans += 1
print(ans)
# Judge status: Wrong Answer
S, W = map(int, input().split())
if W>S:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
a=input()
b=a
c=b[::-1]
d=0
for i in range(len(a)):
  if a[i]!=b[i]:
    d+=1
  else:
    pass
print(d)
# Judge status: Wrong Answer
import fractions

n, s = map(int, input().split())
x = list(map(int, input().split()))
x.append(s)
m = min(x)
xr = [e - m for e in x]
if n == 2:
    gcd = fractions.gcd(xr[0], xr[1])
    print(gcd)
    exit()
gcd = fractions.gcd(xr[0], xr[1])
for i in xr[2:]:
    gcd = fractions.gcd(gcd, i)
print(gcd)
# Judge status: Accepted
n,a,b,c,d=map(int,input().split())
s=input()

if "##" in s[a:max(c,d)]:print("No")
elif c>d and "..." not in s[b-2:d+1]:print("No")
else:print("Yes")
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))

ch = [0]
ans = 0
for i in range(N-1):
    if H[i] < H[i+1]:
        ch.append(i+1)
    if i == N-2:
        ch.append(i+2)
    if len(ch) > 1:
        ans = max(ans, ch[-1]-ch[-2]-1)
print(ans)
# Judge status: Accepted
from collections import Counter

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

p = []
l = []
for k, v in A.items():
    if v >= 4:
        p.append(k)
    if v >= 2:
        l.append(k)

ans = 0
if len(p) >= 1:
    p.sort()
    ans = p[-1]**2
if len(l) >= 2:
    l.sort()
    ans = max(l[-1] * l[-2], ans)
print(ans)
# Judge status: Wrong Answer
import re

n = int(input())
c = input()

def set_c(a):
    a = re.sub('^[R]*W', 'W', a)
    a = re.sub('R[W]*$', 'R', a)
    return a

c = set_c(c)
l1 = len(c)//2
l2 = (len(c)+1)//2

print(min(c[:l1].count('W'),c[l2:].count('R')))
# Judge status: Accepted
total = sum([int(i) for i in input().split()])

if total < 22:
    print('win')
else:
    print('bust')
# Judge status: Wrong Answer
p,q,r=list(map(int,input().split()))
print(min(p+q,q+r))
# Judge status: Accepted
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
U=[]
for i in range(N):
    U.append(abs(A-(T-0.006*H[i])))
for i in range(N):
    if U[i]==min(U):
        print(i+1)
        break
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
p=True
for i in range(1,N):
  if A[i] in A[:i-1]:
    p = False
    break
print("YES" if p else "NO")
# Judge status: Wrong Answer
import heapq
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

low = 1
high = 10**9

if k == 0:
    print(max(a))
    exit()
"""
if n == 1:
    print((a[0]+k-1)//k)
    exit()
"""
while low+1 < high:
    tmp = 0
    mid = (low + high) //2
    #print(mid)
    
    for i in range(n):
        tmp += ((a[i]+mid-1) // mid)-1
    
    if tmp <= k:
        high = mid
    else:
        low = mid
        
print(high)
# Judge status: Accepted
n = int(input())

if n % 10:
    ans = 0
    while n > 0:
        ans += n % 10
        n = n //10
    print(ans)
else:
    print(10)
# Judge status: Accepted
rgb = list(map(int,input().split()))
Num = rgb[0] * 100 + rgb[1] * 10 + rgb[2]

if Num % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if(a<c and c<b):
		print('Yes')
else:
		print('No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print(a*b*0.5)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
ans = [0] * n

for i in range(n):
  ans[l[i]-1] = i + 1
print(*ans)
# Judge status: Wrong Answer
l=list(map(int,input().split()))
l.sort()
print(l[0]*l[1]/2)
# Judge status: Accepted
A, B, K = map(int, input().split())

if K >= A:
    K = K - A
    A = 0
    if K >= B:
        K = K - B
        B = 0
    else:
        B = B - K

else:
    A = A - K

print(A, B)
# Judge status: Wrong Answer
n = int(input())

ans = ''

while n != 0:
    r = n % 2 

    if r < 0:
        r = r + 2
    
    n = (n-r) / (-2)

    ans = ans + str(int(r))

ans = list(ans)    
ans.reverse()
print(''.join(ans))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(60):
	x = 0
	for j in a:
		if j >> i & 1:
			x += 1
	ans += x * (n-x)*(2**i)%mod
print(ans%mod)
# Judge status: Wrong Answer
import itertools
N, M, Q = map(int, input().split())
tapple = []
d_sum_max = 0
for i in range(Q):
    tapple.append([int(n) for n in input().split()])

A = list(itertools.product(range(1,M+1), repeat=N))
for j in range(len(A)):
    d_sum = 0
    for i in range(Q):
        if A[j][tapple[i][1]-1] - A[j][tapple[i][0]-1] == tapple[i][2]:
            d_sum += tapple[i][3] 
    if d_sum_max < d_sum:
        d_sum_max = d_sum
        
print(d_sum_max)
# Judge status: Wrong Answer
import sys

def main():

	R = int(input())
	print(R*3.14159)

if __name__ == "__main__":
    main()