peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import numpy as np
import math

N = int(input())
P = np.array(list(map(int, input().split())))
Q = np.array(list(map(int, input().split())))

def _get_order(N, v, i):
  order=np.argsort(v[i:])
  return list(order).index(0) * math.factorial(len(order)-1)

def get_order(N, v):
  each_order=list(map(lambda i: _get_order(N, v, i), range(N)))
  return each_order
a = sum(get_order(N, P))
b = sum(get_order(N, Q))
print(abs(a-b))
# Judge status: Wrong Answer
n=int(input())
s=input()
ans=''
for ss in s:
  if ord(ss)+n<=ord('z'):
    ss=chr(ord(ss)+n)
  else:
    ss=chr(ord(ss)+n-26)
  ans+=ss
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

def check(N, K, A, L):
    return sum(a // L for a in A) <= K

answer=max(A)
lo = 1
hi = answer+1
while lo < hi:
    m = (lo + hi)//2
    ok = check(N, K, A, m)
    if ok: # 
        answer=m
        hi=m
    else:
        lo=m+1
print(min(max(A), answer))
# Judge status: Accepted
A,B = map(int, input().split())
ans = 0
while ans*(A-1)+1 < B:
    ans+=1
print(ans)
# Judge status: Accepted
a, b, c=map(int, input().split())
if a==b and b==c:
  if a%2==1:
    print(0)
  else:
    print(-1)
else:
  cnt=0
  while(1):
    if a%2==1 or b%2==1 or c%2==1:
      print(cnt)
      break
    cnt+=1
    ha=a/2
    hb=b/2
    hc=c/2
    a=hb+hc
    b=ha+hc
    c=ha+hb
# Judge status: Accepted
import heapq

N, M = map(int, input().split(" "))
work_que = []
can_work = []
ans = 0
for i in range(N):
    a, b = map(int, input().split(" "))
    heapq.heappush(work_que, (a, -b))

for i in range(M, -1, -1):
    while len(work_que) > 0 and work_que[0][0] + i <= M:
        top_work = heapq.heappop(work_que)
        heapq.heappush(can_work, top_work[1])
    
    if len(can_work) > 0:
        ans += -heapq.heappop(can_work)
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input().split(")(")
l = ""
r = ""
for i in range(len(s)):
    if len(s) != 1:
        if i % 2 == 0: s[i] += ")"
        else: s[i] = "(" + s[i]
    R = s[i].count(")")
    L = s[i].count("(")
    if R < L: r += ")" * (L-R)
    elif L < R: l += "(" * (R-L)
print(l + "".join(s) + r)
# Judge status: Accepted

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

# 1/1,2/2,3/3,4/4,5/5,6/6,7/7,8/8,9/9,10/10,11/11,12/12

ans = a-1
if b>=a:
	print(ans+1)
else:
	print(ans)
# Judge status: Accepted
# Problem B - Five Dishes

from itertools import permutations
import math

# input
nums = [0]*5
for i in range(5):
    n = int(input())
    nums[i] = n

# initialization
pattern_moto = [i for i in range(5)]
patterns = permutations(pattern_moto)
min_time = 1000

# time count
for p in patterns:
    tmp = 0
    for i in range(4):
        tmp += nums[p[i]]
        tmp = math.ceil(tmp/10)*10
    tmp += nums[p[4]]
    min_time = min(min_time, tmp)

# output
print(min_time)
# Judge status: Accepted
N = int(input())
s = input()
t = input()

for i in range(N, -1, -1):
    if s[-i:] == t[:i]:
        print(N + (N - i))
        break
else:
    print(N * 2)
# Judge status: Wrong Answer
import itertools
n, m, q = map(int, input().split())

array = []
for i in range(q):
    a = list(map(int, input().split()))
    array.append(a)

comb = list(itertools.combinations(range(1, m+1), n))

ans = -1
for i in comb:
    score = 0
    for a, b, c, d in array:
        if i[b-1] - i[a-1] == c:
            score += d
        ans = max(ans, score)
print(ans)
# Judge status: Accepted
n,y = map(int,input().split())
res = [-1,-1,-1]
for i in range(n+1):
    for j in range(n-i+1):
        if(10000*i + 5000*j + 1000*(n-i-j) == y):
            res = [i,j,n-i-j]
            break
                
print(*res)
# Judge status: Wrong Answer
def intersect(s,t):
    res = ''
    for char in s:
        if char in t:
            res+=char
    return res
  
n = int(input())
res = input()
for _ in range(n-1):
    s = input()
    res = intersect(res,s)
ans = list(res)
ans.sort()
print(*ans, sep='')
# Judge status: Wrong Answer
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

for i in range(1,N+1):
    t[i], x[i], y[i] = map(int, input().split())

# print(t, x, y)

for i in range(N):
    t_diff += t[i+1]-t[i]
    x_diff += x[i+1]-x[i]
    y_diff += y[i+1]-y[i]
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
A, B, M = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]
b = [int(x) for x in input().strip().split()]
ans = min(a) + min(b)
for m in range(M):
    x, y, c = [int(x) for x in input().strip().split()]
    ans = min(ans, a[x-1]+b[y-1]-c)

print(ans)
# Judge status: Accepted
x, y, z = map(int, input().split())

print((x - z) // (y + z))
# Judge status: Wrong Answer
a = int(input())
s = input()
if a >= 3200:
    print('s')
if a < 3200:
    print('red')
# Judge status: Wrong Answer
N, K = map(int, input().split())
Alist = list(map(int, input().split()))
if K >= N:
    print(1)
else:
    from math import ceil
    one = Alist.index(1)
    left = one + 1
    right = N - one
    print(ceil(left / K) + ceil(right / K))
# Judge status: Accepted
n=int(input())
b=list(map(int,input().split()))
a=[0]*n
a[0]=b[0]
for i in range(n-2):
    a[i+1]=min(b[i],b[i+1])
a[-1]=b[-1]
print(sum(a))
# Judge status: Accepted
date=str(input())
print(date.replace("2017","2018",1))
# Judge status: Wrong Answer
s = input()
strset = {'dream': 5, 'dreamer': 7, 'erase': 5, 'eraser': 6}

while len(s)>0:
    if s[0:6] == 'eraser':
        s = s[6:]
        print(s)
    elif s[0:7] == 'dreamer':
        s = s[7:]
        print(s)
    elif s[0:5] == 'dream' or s[0:5] == 'erase':
        s = s[5:]
        print(s)
    else:
        print('NO')
        exit()

print('YES')
# Judge status: Wrong Answer
def gcd(a, b):
    if a == 0: return b
    return gcd(b % a, a)

n, m = map(int, input().split())
a = list(map(int, input().split()))
lcm = 1
cnt = 0
for e in a:
    e //= 2
    lcm *= e // gcd(lcm, e)
    if lcm > m: break
    cnt += e & 1

if cnt in {0, n}:
    res = (1 + m // lcm) // 2
else:
    res = 0
print(res)
# Judge status: Accepted
s = input()
t = input()

n= len(s)
diff = 0
for i in range(n):
    if s[i]!=t[i]:
        diff += 1
print(diff)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

m = -9999

ac = a * c
if ac >= m:
  m = ac

ad = a * d
if ad > m:
  m = ad

bc = b * c
if bc >= m:
  m = bc

bd = b * d
if bd >= m:
  m = bd

print(m)
# Judge status: Accepted
a,b,c=sorted(list(map(int,input().split())))
print(a*b//2)
# Judge status: Accepted
A = []
a = [1]*9
for i in range(3):
    A += input().split()
n = int(input())
for i in range(n):
    b = input()
    if b in A:
        a[A.index(b)] = 0

for i in range(3):
    if a[3*i] + a[3*i+1] + a[3*i+2] == 0 or a[i] + a[i+3] + a[i+6] == 0:
        print('Yes')
        break
else:
    if a[0] + a[4] + a[8] == 0 or a[2] + a[4] + a[6] ==0:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
x, y, z = map(int, input().split())
x = x-z
c = y+z
n = 0
while 0 < x:
  if c <= x:
    n = n+1
    x = x-c
  else:
    break
print(n)
# Judge status: Accepted
n, a, b = map(int, input().split())

if a == 0 :
    print (0)
elif b == 0 :
    print (n)
else :
    ans =  0
    ans += ( n // (a+b) ) * a
    ans += min( (n%(a+b)), a )
    print (ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
A.sort()

def binary(l,i):
  r=N-1
  while l<=r:
    m=(l+r)//2
    if A[m]==i:
      return A[m]
    elif A[m]>i:
      r=m-1
    else:
      l=m+1
  x=abs(A[m]-i)
  for j in range(max(0,m-2),min(m+3,N-1)):
    if x >= abs(A[j]-i):
      res = A[j]     
      x=abs(A[j]-i)
  return res


print(A[-1],binary(1,A[-1]/2))
# Judge status: Accepted
L, R, d = list(map(int, input().split(' ')))
ans = 0
for i in range(L, R + 1):
  if i % d == 0:
    ans += 1
print(ans)
# Judge status: Accepted
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    n = len(s)
    for i in reversed(range(n - 1)):
        if (i + 1) % 2 == 0:
            l = ''.join(s[:(i + 1) // 2])
            r = ''.join(s[(i + 1) // 2:i + 1])
            if l == r:
                print(i + 1)
                exit()


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Judge status: Accepted
N, K = [int(_) for _ in input().split()]
A = []
for i in range(K):
    d = int(input())
    A.append([int(_) for _ in input().split()])

xs = [0] * N
for rs in A:
    for r in rs:
        xs[r - 1] += 1

result = sum(x == 0 for x in xs)

print(result)
# Judge status: Accepted
X, Y = list(map(int,input().split()))
ans = 0
tmp = X
while tmp <= Y:
    tmp *= 2
    ans += 1

print(ans)
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()

total = [0]*(N+1)
for i in range(2, N+1):
    if S[i-2]=='A' and S[i-1]=='C':
        total[i] = total[i-1]+1
    else:
        total[i] = total[i-1]

for i in range(Q):
    l, r = map(int, input().split())
    print(total[r]-total[l])
# Judge status: Wrong Answer
S = input()
l = len(S)
ans = "*" * l
print(ans)
# Judge status: Accepted
a = input()
if a in "aiueo":
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
import math
n = int(input())
s = list(''.join(sorted(input())) for i in range(n))
cnt = 0

for i in set(s):
    n = s.count(i)
    if n >= 2:
        cnt += (math.factorial(n)//2*math.factorial(n-2))
print(cnt)
# Judge status: Wrong Answer
N=int(input())
s=0
for i in range(0,N):
 s=s+i
# Judge status: Accepted
S = str(input())

a=0
b=0
c=0
if S[0]=='A':
    a=1

cnt=0
for i in S[2:-1]:
    if i=='C':
        cnt+=1
if cnt==1:
    b=1

s=S[1:]
s=s.replace('C','')
if s.islower()==True:
    c=1

if a==1 and b==1 and c==1:
    print('AC')
else:
    print('WA')
# Judge status: Wrong Answer
X, N = map(int, input().split())
P = list(map(int, input().split()))
if N == 0:
    print(100)

else:
    min_abs = 100
    min_abs = min([abs(X-i) for i in range(100) if not i in P])
    min_abs


    ans_candi = [i+X for i in range(-min_abs, min_abs+1) if not i+X in P]
    ans = min(ans_candi)
    print(ans)
# Judge status: Wrong Answer
n=int(input())
ans=0
for i in range(1,n+1):
    cnt = 1
    for j in range(1,int(i**0.5)+5):
        if i==j:break
        if i%j ==0:cnt += 1
    ans += i*cnt
print(ans)
# Judge status: Accepted
K,A,B = list(map(int,input().split()))
if B-A <= 1:
    print(K+1)
    exit()
ans = A
K = K - (A-1)
yen = 0
if K%2 == 0:
    ans += (B-A)*(K//2)
else:
    ans += (B-A)*(K//2)+1
print(ans)
# Judge status: Wrong Answer
s=str(input())

if s[0]==s[1] and s[1]==s[2]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,x,t = map(int, input().split())
times = 0

times = t
while n - x > 0:
  n -= x
  times += t

print(times)
# Judge status: Accepted
from itertools import accumulate

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

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

for j in range(k):
    if j > 41:
        break

    b = [0] * n

    for i in range(n):
        b[max(0, i - a[i])] += 1
        
        if i + a[i] + 1 < n:
            b[i + a[i] + 1] -= 1

    a = list(accumulate(b))

print(*a)
# Judge status: Accepted

s = list(input())
a = int(s[0] + s[1])
b = int(s[2] + s[3])

if (a == 0 or 13 <= a <= 99) and (b != 0 and 1 <= b <= 12):
    print("YYMM")
elif (1 <= a <= 12) and (b == 0 or 13 <= b <=99):
    print("MMYY")
elif 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
else:
    print("NA")
# Judge status: Wrong Answer
N = int(input())
tmp = str(N)
if N < 1000:
    print("ABC"+tmp.zfill(3))
else:
    print("ABD"+tmp.zfill(4))
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    d = list(map(int, input().split()))
    d.sort()
    ans += d[n//2] - d[n//2-1]
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, M = map(int,input().split())
X = []
Y = []
for i in range(N):
    X = list(map(int,input().split()))
    Y.append(X)

Y = sorted(Y)
ans = 0
for i in range(N):
    if M >= Y[i][1]:
        ans += Y[i][0] * Y[i][1]
        M -= Y[i][1]

    else:
        ans += M * Y[i][0]
        print(int(ans))
        exit()
# Judge status: Accepted
l = {25: "Christmas",
     24: "Christmas Eve",
     23: "Christmas Eve Eve",
     22: "Christmas Eve Eve Eve"}

print(l[int(input())])
# Judge status: Accepted
N = int(input())
X = [int(x) for x in input().split()]
X.sort()
P = [[0 for i in range(N)] for _ in range(101)]
for p in range(101):
  for i, x in enumerate(X):
    P[p][i] = (x - p) ** 2
print(min([sum(p) for p in P[1:]]))
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
a,b,c,d = iim()

print(max(min(b,d)-max(a,c),0))
# Judge status: Accepted
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
cd = [list(map(int, input().split())) for i in range(m)]

for i in range(n):
  a, b = ab[i]
  
  dist = 1e+15
  ans = 0
  for j in range(m):
    c, d = cd[j]    

    if dist > abs(a - c) + abs(b - d):
      ans = j
      dist = abs(a - c) + abs(b - d)
  
  print(ans+1)
# Judge status: Accepted
N,K,S=map(int,input().split())
A=[S]*N
for i in range(K,N):
    if S!=1:
        A[i]=S-1
    else:
        A[i]=S+1
print(*A)
# Judge status: Wrong Answer
day = input()
count = day.count("R")
count1 = day.count("RR")
if count == 2:
    if count1 == 1:
	    print(2)
    else:
    	print(1)
if count == 1:
    print(1)
if count == 0:
    print(0)
# Judge status: Accepted
from collections import defaultdict

s = int(input())
D = defaultdict(int)
D[s] += 1
ans = 1

def f(a):
  if a%2 == 0:
    return a//2
  else:
    return 3*a + 1

while True:
  s = f(s)
  ans += 1
  if D[s] == 1:
    print(ans)
    break
  D[s] += 1
# Judge status: Accepted
N = int(input())
ans = 1
mod = pow(10, 9)+7
for i in range(1, N+1):
    ans = (ans*i) % mod
print(ans)
# Judge status: Wrong Answer
a=list(input())
print(a)
b=[]

for i in a:
    if i=="0":
        b.append(i)
    if i=="1":
        b.append(i)
    if i=="B":
        if b!=[]:
            b.pop(-1)
for j in b:
    print(j,end="")
# Judge status: Wrong Answer
#169A
#A*Bを整数として出力せよ
#1.入力をプログラムで扱えるように受け取ること
a,b = map(int, input().split())
print(a,b)
#2.受け取った入力値を使って適切に処理（計算）すること
answer = a * b

#3.計算した結果を出力すること
print(answer)
# Judge status: Accepted
N = int(input())
dp = [[]for i in range(87)] 
dp[0] = 2
dp[1] = 1

for i in range(2,87):
    dp[i] = dp[i-1]+dp[i-2]
    if i == N:
        print(dp[i])
        break
else:
    print(dp[N])
# Judge status: Accepted
a, b, k = map(int, input().split())
 
if a >= k:
  print(a-k, b)
else:
  if a+b > k:
    print(0, b-(k-a))
  else:
    print(0,0)
# Judge status: Accepted
def solve():
    N = int(input())
    ans = N // 11 * 2
    if N % 11 >= 7:
        ans += 2
    elif N % 11 >= 1:
        ans += 1
    
    print(ans)
    
if __name__ == '__main__':
    solve()
# Judge status: Accepted
S = input()

N = len(S)
for i in range(N):
    for j in range(i, N + 1):
        if S[:i] + S[j:] == "keyence":
            print("YES")
            quit()
print("NO")
# Judge status: Accepted
 
N = int(input())
i = 0
while 2**i < N:
  i +=1
  
  
if 2**i ==N:
  print(2**i)
else:
  print(2**(i-1))
# Judge status: Wrong Answer
P, Q, R = map(int,input().split())
print(min(P + Q, Q + R))
# Judge status: Accepted
a,b,c=map(int, input().split())
print("YES" if b-a == c-b else "NO")
# Judge status: Accepted
from collections import defaultdict

n, m = map(int, input().split())

ans = 0
i = 1
while i * i <= m:
    if m % i == 0:
        a, b = i, m // i
        if b >= n:
            ans = max(ans, a)
        if a >= n:
            ans = max(ans, b)
    i += 1
print(ans)
# Judge status: Accepted
L = int(input())

a = L / 3.0
print(a ** 3)
# Judge status: Accepted
n=int(input())
b=list(map(int,input().split()))

a=[0]*n
a[0]=b[0]
a[n-1]=b[n-2]
for i in range(n-2):
    a[i+1]=min(b[i],b[i+1])
print(sum(a))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
div = C // 2
ans = 0
if A * B * C % 2 != 0:
    ans = abs((A * B * div) - (A * B * (C - div)))
print(ans)
# Judge status: Accepted
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, A, B = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = N//(A+B)*A + (A if N%(A+B)>A else N%(A+B))
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)
# Judge status: Accepted
def main():
    import numpy as np
    N, W = map(int, input().split())
    ndp = np.zeros(W+1, dtype= np.int64)
    for _ in range(N):
        w, v = map(int,input().split())
        np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
    else:print(ndp[-1])

if __name__=="__main__":
    main()
# Judge status: Accepted
s=input()
f=int(s[:2])
b=int(s[2:])

if f>=1 and f<=12:
    if b>=1 and b<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if b>=1 and b<=12:
        print('YYMM')
    else:
        print('NA')
# Judge status: Accepted
import sys
input = sys.stdin.readline

h1,m1,h2,m2,k=map(int,input().split())
H=(h2-h1)*60
M=m2-m1
time=H+M


if time-k >=0:
  print(time-k)
else:
    print(0)
# Judge status: Accepted
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n = int(input())
    S = {input() for _ in range(n)}
    print(len(S))
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = str(input())
T = str(input())
N = len(S)-len(T)+1
M = len(T)
ans = None

for i in range(N):
    flag = 0
    for j in range(M):
        if S[i+j]==T[j] or S[i+j] == "?":
            flag += 1
        else:
            break
    if flag == M:
        ans = S[:i]+T+S[i+M:]
        ans = ans.replace('?','a')
        print(ans)

if ans is None:
    print("UNRESTORABLE")
# Judge status: Wrong Answer
S = input()
c = "keyence"
if S[-7:] == c or S[:7] == c:
    print("YES")
else:
    for i in range(1, 7):
        c_, _c = c[:i], c[i:]
        if S[:i] == c_ and S[-(i + 1):] == _c:
            print("YES")
            break
    else:
        print("NO")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

a.sort()
li = [True] * (10**6 + 10)
ans = 0

for i in range(n):
    if not li[a[i]]:
        continue
    li[a[i]] = False
    tmp = a[i]
    while tmp < len(li):
        li[tmp] = False
        tmp += a[i]
    if i < n-1:
        if a[i+1] == a[i]:
            continue
    ans += 1


print(ans)
# Judge status: Accepted
A, B, K = map(int, input().split())
print(max(0, A-K), max(0, B-max(0, K-A)))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
for i in range(N):
    A[i]=[A[i],i]
A.sort()
for i in range(N):
    print(A[i][1]+1,end=' ')
print()
# Judge status: Accepted
import math

R = int(input())
print(2*math.pi*R)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
import math

#残差最小化の解
x = sum(a)/N
x_large = math.ceil(x)
x_small = math.floor(x)

#大きい残差と小さい残差を計算
sum_large = 0
sum_small = 0
for i in a:
	sum_large += (x_large-i)**2
	sum_small += (x_small-i)**2
#最小残差
print(min(sum_large,sum_small))
# Judge status: Accepted
S1 = set(list('abcdefghijklmnopqrstuvwxyz'))
S2 = set(list(input()))
S3 = S1-S2
if len(S3) == 0:
    print('None')
else:
    print(sorted(list(S3))[0])
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 0 and 0 <= b:
    print('Zero')
elif a > 0:
    print('Positive')
else:
    if abs(a-b) % 2 == 0:
        print('Negative')
    else:
        print('Positive')
# Judge status: Wrong Answer
from itertools import combinations as c
n, *d = map(sorted, open(0).read().split())
print(sum(d[i[0]] == d[i[1]] for i in c(range(int("".join(n))), 2)))
# Judge status: Accepted
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
start=10**(n-1)
if n==1:
    start=0
for i in range(start,1001):
    i = str(i)
    for s,c in sc:
        if i[s-1] != str(c):
            break
    else:
        print(i)
        exit()
print(-1)
# Judge status: Wrong Answer
n,k,s = map(int, input().split())
a = list()
check = True
x = s - 1
y = s + 1
fin = 0
for i in range(n):
    if fin <= k:
        if check == True:
            check = False
            a.append(x)
        else:
            check = True
            a.append(1)
        fin += 1
    else:
        a.append(s+1)
print(*a)
# Judge status: Accepted
x = int(input())

ans = 0

if x >= 11:
    t = x//11
    ans += t*2
    x = x%11

if x > 6:
    ans += 2
elif x <= 6 and x != 0:
    ans += 1

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(5)]
print(N//(min(A))+5)
# Judge status: Accepted
import math
n = int(input())
q = math.floor(n/11)
r = n % 11
if r == 0: print(2*q)
elif r <= 6: print(2*q+1)
else: print(2*q+2)
# Judge status: Wrong Answer
#coding UTf-8
a,b,c,d = map(int,input().split())
while True:
    a=a-d;
    if a<=0:
        print("No")
        break;
    c=c-b;
    if c<=0:
        print("Yes")
        break;
# Judge status: Accepted
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

C = sr()
answer = chr(ord(C) + 1)
print(answer)
# 26
# Judge status: Accepted
# coding: utf-8

def main():
    N = int(input())
    ans = ':('

    for i in range(50001):
        if int(i * 1.08) == N:
            ans = i
            break

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
    nums = map(int, input().split())
    for i, num in enumerate(nums, 1):
        if num == 0:
            print(i)
            break
            
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
h = list(map(int,input().split()))
a = h[0]
m = 0
ans = 1
for i in range(1,n):
    if a >= h[i]:
        m += 1
    else:
        ans = max(ans,m)
        m = 0
    a = h[i]
print(max(ans,m))
# Judge status: Accepted
L, R, D = map(int, input().split())

cnt = 0
for i in range(L, R+1):
    if i % D == 0:
        cnt += 1

print(cnt)
# Judge status: Accepted
import sys
sys.setrecursionlimit(200000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=1
now=0
if sum(a)<=x:
    print(n+1)
    exit()
for i in a:
    now+=i
    if now>x:
        print(cnt)
        exit()
    cnt+=1
# Judge status: Wrong Answer
X = int(input())

#500
X_500 = X // 500 * 2
#5
X_5 = (X % 500) // 5 * 5

print(X_500 + X_5)
# Judge status: Wrong Answer
import collections

N = int(input())
A = [int(input()) for i in range(N)]

count_dict = collections.Counter(A)

count = 0

for i in count_dict.values():
    if i == 1:
        count += 1

print(count)
# Judge status: Wrong Answer

import itertools

K,S = map(int, input().split())
X = list(range(K+1))
count=0

for x,y in list(itertools.product(X, X)):
    if x+y >= S-K:
        count+=1

print(count)
# Judge status: Accepted
s = input()

for i in range(3):
    if s[i] == s[i+1]:
        print("Bad")
        exit()

print("Good")
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))

v = sorted(v)
res = v[0]
for i in range(1, n):
    res = (res + v[i]) / 2
print(res)
# Judge status: Accepted
from collections import Counter
N = int(input())
S = input()
S_c = Counter(S)
ans = 1
mod = 10 ** 9 + 7
for val in S_c.values():
    ans *= (val + 1)
    ans %= mod

print(ans - 1)
# Judge status: Accepted
a = sorted(list(map(int, input().split())))
if a[0]%2 == 1 and a[1]%2 == 1 and a[2]%2 == 1:
    print(a[0]*a[1])
else:
    print(0)