peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from queue import deque

N, M, K = map(int, input().split())

A = list(map(int, input().split()))
A = deque(A)
B = list(map(int, input().split()))
B = deque(B)

count = 0

while 1:
    a = A.popleft() if A else 10**9+1
    b = B.popleft() if B else 10**9+1
    
    if min(a, b) <= K:
        count += 1
        K -= min(a, b)
        if a <= b:
            B.appendleft(b)
        else:
            A.appendleft(a)
    else:
        break

print(count)
# Judge status: Wrong Answer
# ABC 096: A – Day of Takahashi
a, b = [int(s) for s in input().split()]
print(a if a <= b else b)
# Judge status: Accepted
def main():
 a,b,c,d = map(int,input().split())
 if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
     print('Yes')
 else:
     print('No')
main()
# Judge status: Accepted
n, m = map(int, input().split())
s=[]
c=[]
for i in range(m):
	_s, _c = map(int, input().split())
	s.append(_s-1)
	c.append(_c)

for i in range(1000):
	*t, = map(int, list(str(i)))

	if len(t) != n:
		continue

	ok = True
	for j in range(m):
		if t[s[j]]!=c[j]:
			ok = False
			break
 
	if ok:
		print(i)
		quit()

print(-1)
# Judge status: Accepted
s = open(0).read().rstrip()
print("x" * len(s))
# Judge status: Accepted
n= int(input())
if n==1:
  print('Yes')
  exit()
h=list(map(int,input().split()))
ans='Yes'
for i in range(n-1):
  if h[i+1]>h[i]:
    h[i+1]-=1
  elif h[i+1]<h[i]:
    print('No')
    exit()
print(ans)
# Judge status: Wrong Answer
n = int(input())
x = n * 800
y = n / 15 * 200
print(int(x - y))
# Judge status: Accepted
n,m=map(int,input().split())
List=sorted(list(map(int,input().split())))
s=[]
for _ in range(m):
    s.append(list(map(int,input().split())))
s.sort(key=lambda x: x[1], reverse=True)

ans=0
j=0
for i in range(m):
    if j>=n or s[i][1]<=List[j]:
        break
    while j<n and s[i][0]>0 and s[i][1]> List[j]:
        ans+=s[i][1]
        s[i][0]-=1
        j+=1
if j>=n:
    print(ans)
else:
    print(ans+sum(List[j:]))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
lists = [i for i in range(1, n + 1)]
dicts = {j:i for i, j in zip(lists, a)}
for i in range(1, n + 1):
    print(dicts[i], end=' ')
print()
# Judge status: Accepted
import collections

N = int(input())

A = list()
if N == 1:
	A.append(1)
else:
	while N%2 == 0:
		A.append(2)
		N = N//2
	f = 3
	while f*f <= N:
		if N % f == 0:
			A.append(f)
			N = N//f
		else:
			f += 2
	if N != 1:
		A.append(N)

A = collections.Counter(A)
del A[1]
count = 0

for a in A.values():
	n = 1
	th = n*(n+1)/2
	while a >= th:
		n += 1
		th = n*(n+1)/2
	count += n-1

print(count)
# Judge status: Accepted
# E - Payment

S = input()
N = len(S)

# 先頭からi桁目までの金額のやり取りに必要な紙幣の枚数
dp = [0]
dp_plus1 = [1]

for i in range(N):
    x = int(S[i])
    dp.append(min(dp[i] + x, dp_plus1[i] + (10 - x)))
    dp_plus1.append(min(dp[i] +  (x + 1), dp_plus1[i] + (10 -  (x + 1))))

print(dp[-1])
# Judge status: Accepted
s = input()
dic = {}
for i in s:
  if i in dic:
    dic[i] += 1
  else:
    dic[i] = 1

for i in dic:
  if dic[i]%2 != 0:
    print('No')
    break
else:
  print('Yes')
# Judge status: Accepted
S = input()
YY = int(S[0:2])
MM = int(S[2: ])

if YY <= 12 and YY > 0 and MM <= 12 and MM > 0:
  print("AMBIGUOUS")
elif YY <= 12 and YY > 0 and (MM >= 13 or MM == 0):
  print("MMYY")
elif (YY == 0 or YY >= 13) and MM <= 12 and MM > 0:
  print("YYMM")
else:
  print("NA")
# Judge status: Accepted
import sys
import numpy as np
read = sys.stdin.readline


def main(n, k, a):
    for i in np.arange(n, 100000):
        ok = True
        j = i
        while j:
            ok &= j % 10 not in a
            j //= 10
        if ok:
            print(i)
            break


if __name__ == '__main__':
    n, k = np.fromstring(read(), dtype=np.int32, sep=' ')
    a = np.fromstring(read(), dtype=np.int32, sep=' ')
    main(n, k, a)
# Judge status: Accepted
n=int(input())
l=[0]*(n+1)
l[0]=2
l[1]=1
for i in range(n+1):
  if i==0 or i==1:
    continue
  else:
    l[i]=l[i-1]+l[i-2]
print(l[n])
# Judge status: Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    L, R, d = LI()

    ans = R // d - (L - 1) // d
    print(ans)

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
a, b, k = map(int, input().split())

for i in range(a, a + k):
    if i <= b:
        print(i)

for j in range(b - k + 1, b + 1):
    if i < j:
        print(j)
# Judge status: Wrong Answer
H,W = map(int, input().split())


print(int((H*W)/2+0.5))
# Judge status: Accepted
#!/usr/bin/env python3
s = input()
a = [int(c) for c in s]

for i in range(2 ** 3):
    ptn = []
    num = a[0]

    for j in range(3):
        if (i >> j) & 1:
            ptn.append("+")
            num += a[j + 1]

        else:
            ptn.append("-")
            num -= a[j + 1]
    
    if num == 7:
        print("{}{}{}{}{}{}{}=7".format(a[0], ptn[0], a[1], ptn[1], a[2], ptn[2], a[3]))
        break
# Judge status: Wrong Answer
def main():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print(s)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
info = []
for i in range(n):
    info.append(input())

info.sort()

ans = []
record = 1
tem_record = 1
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
        if tem_record == record:
            ans.append(info[i])
    else:
        if tem_record > record:
            record = tem_record
            ans = [info[i]]
        tem_record = 1

if record == 1 and  info[n-1] != info[n-2]:
    ans.append(info[n-1])


ans.sort()
for i in ans:
    print(i)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a1 = sorted(a, reverse=True)
com = 0

if n == 2:
    com = a1[0]
elif n%2 ==0:
    c = int(n/2)
    com = sum(a1[0:c])
    com += sum(a1[1:c])
else:
    c = int(n//2)
    com += sum(a1[0:c+1])
    com += sum(a1[1:c])
    
print(com)
# Judge status: Accepted
s=int(input())
a=[]
ans=1
while True:
  a.append(s)
  if s%2==0:
    s//=2
  else:
    s=s*3+1
  ans+=1
  if s in a:
    print(ans)
    break
# Judge status: Accepted
K, X = map(int, input().split())

stone = [str(i) for i in range(X - (K - 1), X + K)]
print(' '.join(stone))
# Judge status: Accepted
import sys
input = sys.stdin.readline

t=input()


ans=[]
for i in range(len(t)):
    if t[i]== "?":
        ans.append("D")
    else:
        ans.append(t[i])

for i in range(len(ans)):
    print(ans[i], end="")
# Judge status: Accepted
N, M = map(int,input().split())

WA = [0] * N
AC = [0] * N
ac = 0
wa = 0

for i in range(M):
  pi, S = map(str,input().split())
  p = int(pi)
  
  if S == "AC":
    if AC[p-1] != 1:
      AC[p-1] = 1
      ac += 1
      wa += WA[p-1]
  elif S == "WA":
    if AC[p-1] == 1:
      pass
    else:
      WA[p-1] += 1
else:
  print(ac, wa)
# Judge status: Wrong Answer
N,M=map(int,input().split())
if N==1:
  print(N)
  exit()
dp=[-1]*N
dp[-1]=1
dp+=[1]
mod=10**9+7
for i in range(M):
  a=int(input())
  dp[a]=0
i=N-2
while i>=0:
  if dp[i]==-1:
    dp[i]=dp[i+1]+dp[i+2]
  i-=1
print(dp[0])
# Judge status: Accepted
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n, k, s = nm()
ans_h = [str(s) for _ in range(k)]
if s==10**9 :
    ans_t = ['1' for _ in range(n-k)]
else:
    ans_t = [str(s+1) for _ in range(n-k)]
print(' '.join(ans_h + ans_t))
# Judge status: Wrong Answer
D=int(input())
c=list(map(int,input().split()))
s=[]
t=[]
v=0
lastday=[0 for i in range(26)]

for i in range(D):
  tmp=list(map(int,input().split()))
  s.append(tmp)
  
for i in range(26):
  print(26-i)
# Judge status: Accepted
# coding: utf-8
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:x]
q = q[:y]
all = p + q + r
all.sort(reverse=True)
print(sum(all[:x+y]))
# Judge status: Wrong Answer
H, A = map(int, input().split())
cnt = 0
while H<=0:
    H //= A
    cnt += 1

print(cnt+1)
# Judge status: Wrong Answer
from collections import Counter

# input
N = int(input())
S = []
s_append = S.append
for n in range(N):
    s = input()
    counter = Counter(s)
    s_append(counter)

matched = []
cnt = 0
m_append = matched.append
for i, s in enumerate(S):
    if s in matched:
        continue
    add = len(
        [
            1
            for j, c in enumerate(S)
            if i != j
            and s == c
        ]
    )
    if add > 0:
        m_append(s)
    cnt += add

print(cnt)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 8)
n = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
permutations = []

def dfs(a, size):
    if len(a) == size:
        global permutations
        permutations.append(a)
        return
    for i in range(1, max(a) + 2):
        dfs(a + [i], size)

dfs([1], n)
for i in permutations:
    print(''.join([alp[j-1] for j in i]))
# Judge status: Accepted
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


A, B, M = MI()
A = LMI()
B = LMI()

minA = min(A)
minB = min(B)
ans = minA + minB
for _ in range(M):
    x, y, c = MI()
    ans = min(ans, A[x - 1] + B[y - 1] - c)
print(ans)
# Judge status: Accepted
a,b,h,m=map(int,input().split())
# Pythonで三角関数は単位をradiansにしてから
from math import cos,radians
# 時針Aの角度は1時間で30°、分数を加味してh*30°+30°*m/60
# 分針Bの角度は1分で6°、m*6°
theta = abs(m*6 - (h*30 + m / 2))
# 余弦定理 c**2 = a**2 + b**2 - 2abcosθ
print((a**2 + b**2 - 2*a*b*cos(radians(theta)))**0.5)
# Judge status: Wrong Answer
s = list(input())
k = int(input())
n = len(s)
for i in range(n):
    d = ord('z')-ord(s[i])+1
    if d<=k:
        s[i] = 'a'
        k -= d

x = (ord(s[i])-ord('a')+k)%26
s[-1] = chr(ord('a')+x)

print(''.join(s))
# Judge status: Wrong Answer
import math
N = int(input())
Array = [1]*(N+1)
for i in range(1,int(math.sqrt(N))+1):
  for j in range(i+i,N+1,i):
    Array[j]+=1
ans = 0
for i in range(1,N+1):
  ans+=i*Array[i]
print(ans)
# Judge status: Accepted
x, a, b = (int(i) for i in input().split())
da = abs(x-a)
db = abs(x-b)
if da < db:
  print('A')
else:
  print('B')
# Judge status: Accepted
import sys

K,N = map(int, sys.stdin.readline().strip().split())
A = list(map(int, sys.stdin.readline().strip().split()))
# K = 20
# N = 3
# A =[0, 5, 15]
# A =[5, 10, 15]

distance = []
# 家間距離
for i,a in enumerate(A):
    if i == len(A) - 1:
        distance.append(K - A[i] + A[0])
    else:
        distance.append(A[i+1] - A[i])

# print(distance)
print(sum(distance) - max(distance))
# Judge status: Wrong Answer
from collections import defaultdict as ddf
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]

dd=ddf(lambda:0)
for e in s: dd[e]+=1
for e in t: dd[e]-=1
print(max(dd.values()))
# Judge status: Wrong Answer
N = int(input(""))
count = 0
for i in range(N):
    D = (input(""))
    l = D.split()
    l_i = [int(s) for s in l]
    if l_i[0] == l_i[1]:
        count += 1
if count > 2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for i in range(M)]

ListL = []
ListR = []

for i in range(M):
    ListL.append(LR[i][0])

for i in range(M):
    ListR.append(LR[i][1])

print(min(ListR)-max(ListL)+1)
# Judge status: Accepted
c = input()
if c in "aiueo":
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
data = input()

dataa,datab,datac,datad = data.split(' ')

dataa = int(dataa)
datab = int(datab)
datac = int(datac)
datad = int(datad)

length = dataa -datab + datab - datac

if length < datad:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
f=lambda a:any(all(b)for b in a)or all(a[i][i]for i in(0,1,2))   
a=eval('list(map(int,input().split())),'*3)
exec('b=int(input());a=[[u*(u!=b)for u in t]for t in a];'*int(input()))
a=[[not u for u in t]for t in a]
r=0
exec('r|=f(a)|f(a[::-1]);a=[t[::-1]for t in a];'*2)
print('NYoe s'[r::2])
# Judge status: Accepted

n=int(input())
c=[0]*(n-1)
s=[0]*(n-1)
f=[0]*(n-1)
for i in range(n-1):
    c[i],s[i],f[i]=map(int,input().split())

for i in range(n):
    t=0
    for j in range(i,n-1):
        if t<s[j]:
            t=s[j]
        elif t%f[j]!=0:
            t=t+f[j]-t%f[j]
        t+=c[j]
    print(t)
# Judge status: Wrong Answer
#!/usr/bin/env python3
a,b = map(int,input().split())
if (a % 3)*(b % 3) % 3 == 1:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
N, T = map(int,input().split())

ans = "TLE"
for i in range(N):
    c, t = map(int,input().split())
    if t <= T:
        if ans == "TLE" or ans > c:
            ans = c

print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
count = 0
for i in range(a,b):
  if str(i)[0]==str(i)[4] and str(i)[1]==str(i)[3]:
    count+=1
print(count)
# Judge status: Wrong Answer
n = int(input())

a = n % 4
b = n % 7
c = n % 11
if a == 0 or b == 0 or c == 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x = int(input())
s, r = divmod(x, 11)
s *= 2
s += 2 if r > 6 else 1
print(s)
# Judge status: Accepted
a,b=map(int,input().split())
if a*b*(a+b)%3==0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Wrong Answer
import math
radius = float(input("Enter the radius of the circle : "))
circumference = 2 * math.pi * radius
print("Circumference of the circle is : %.2f" % circumference)
# Judge status: Accepted
N = int(input())
import math

n = math.sqrt(N)
if n.is_integer():
  x = round(n) - 1
  print(2 * x)
else:
  def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        divisors.append(i)
        if i != n // i:
          divisors.append(n // i)
    divisors.sort()
    return divisors
  l = make_divisors(N)
  if len(l) % 2 == 0:
    x = l[len(l) // 2 - 1]
    y = l[len(l) // 2]
    print(x + y - 2)
# Judge status: Accepted
L = [int(input()), list(map(int, input().split(' '))), list(map(int, input().split(' '))), list(map(int, input().split(' ')))]
print(sum([L[2][L[1][i]-1]+L[3][L[1][i]-2] if i>0 and L[1][i]-L[1][i-1]==1 else L[2][L[1][i]-1] for i in range(L[0])]))
# Judge status: Accepted
s=str(input())
s=list(s)
s=list(set(s))
s.sort()
if len(s)>=3:
  if s[0]=="a" and s[1]=="b" and s[2]=="c":
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Accepted
d, n = map(int, input().split())
cnt = 0
i = 0
while cnt < n:
  i += 1
  if i % 100**d == 0 and i % 100**(d+1) != 0:
    cnt += 1
print(i)
# Judge status: Wrong Answer
n=int(input())
if(n<599):
  print('8')
elif n<799:
  print('7')
elif n<999:
  print('6')
elif n<1199:
  print('5')
elif n<1399:
  print('4')
elif n<1599:
  print('3')
elif n<1799:
  print('2')
else:
  print('1')
# Judge status: Wrong Answer
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
A = l()
ruiseki = [0]+list(itertools.accumulate(A))
i = bisect.bisect_left(ruiseki,sum(A)/2)
print(abs(sum(A[:i])-sum(A[i:])))
# Judge status: Accepted
s=int(input())
A=set()
A.add(s)
count=1
while count==len(A):
    if s%2==0:
        A.add(s/2)
        count+=1
        s=s/2
    else:
        A.add(3*s+1)
        count+=1
        s=3*s+1
print(count)
# Judge status: Accepted
N = int(input())
S = set()
for _ in range(N):
    S.add(input())
print(len(S))
# Judge status: Accepted
W,H,x,y = map(int,input().split())
if W/2 == x and H/2 == y:
    ans = 1
else:
    ans = 0
print(H*W/2, ans)
# Judge status: Accepted
a,b,c = map(int, input().split())
print('win' if a+b+c<22 else 'bust')
# Judge status: Accepted
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/A-AtCoderCrackers.py
#
n, k = map(int, input().split())
if n % k == 0:
    print(0)
else:
    print(1)
# Judge status: Wrong Answer
k = int(input())
x = 0

if k <= 12:
    print(k)
else:
    x = ((11 * (int((k-12)/3)) + 12))
    if (k-12) % 3 == 0:
        print(x)
    elif (k-12) % 3 == 1:
        print(x+9)
    else:
        print(x+10)
# Judge status: Accepted
n = int(input())
d = {}
for _ in range(n):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
m = int(input())
for _ in range(m):
  t = input()
  if t in d and d[s] > 0:
    d[t] -= 1
print(max(d[s] for s in d))
# Judge status: Accepted
num = int(input())

even_count = num // 2

if num % 2 == 0:
    odd_count = even_count
else:
    odd_count = even_count + 1

print(odd_count * even_count)
# Judge status: Accepted
A, B = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    if str(i) == str(i)[::-1]:
        cnt += 1
print(cnt)
# Judge status: Accepted
s = input()
t = input()

res = 0
for i in range(len(s)):
    if s[i] != t[i]:
        res += 1

print(res)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
dp = [float("inf") for i in range(n)]
dp[0] = 0
dp[1] = dp[0] + (h[1] - h[0])
for i in range(1, n):
    dp[i] = min(dp[i - 2] + (abs(h[i] - h[i - 2])), dp[i - 1] + (abs(h[i] - h[i - 1])))
print(dp[n - 1])
# Judge status: Accepted
n=int(input())
for i in range(1, n+1):
  x=360*i%n
  if x==0:
    print(360*i//n)
    break;
  else:
    continue;
# Judge status: Accepted
n = int(input())
s = input()
x = 0
ans = 0
for c in s:
    if c == 'I':
        x += 1
    else:
        x -= 1
    ans = max(ans, x)
print(ans)
# Judge status: Accepted
from collections import Counter

N = int(input())
S = list(input())

ac = Counter(S)
ans = 0
for value in ac.values():
    if ans == 0:
        ans = value+1
    else:
        ans = ans*(value+1)

MOD = 10**9+7
print((ans-1) % MOD)
# Judge status: Wrong Answer
s = input()
t = input()

ls = len(s)
lt = len(t)

ans = 1000000
for i in range(ls - lt):
    tmp = s[i:i+lt]
    score = 0
    for j in range(lt):
        if tmp[j] != t[j]:
            score += 1
    ans = min(ans, score)

print(ans)
# Judge status: Accepted
a,b,x = map(int,input().split())
import math

if( x*2 < a*a*b):
    tan_y = 2*x/(b*b*a)
    ans = 90 - math.degrees(math.atan(tan_y))

else:
    tan_x = 2*(a*a*b - x)/(a*a*a)
    ans = math.degrees(math.atan(tan_x))

print(ans)
# Judge status: Accepted
from collections import defaultdict
n=int(input())
d=defaultdict(int)
for i in range(n):
    a=int(input())
    d[a]+=1

sm=0
for i,j in d.items():
    sm+=j%2

print(sm)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

if (a * b) % 2 != 0:
    print('Odd')
else:
    print('Even')
# Judge status: Accepted
s = input()
modl = [0]*2019
modl[0] = 1
mstack = 0
digit = 1
ans = 0

for i in s[::-1]:
    mstack += int(i) * digit
    mstack %= 2019
    modl[mstack] += 1
    digit = digit*10%2019

for i in modl:
    ans += i*(i - 1)//2

print(ans)
# Judge status: Wrong Answer
k=int(input())
c=0
x=0
for c in range(7):
  x=x+7*10**c
  if x%k==0:
    print(c+1)
    break
  elif c==6:
    print(-1)
    break
# Judge status: Accepted
a,b = map(int, input().split())

if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
# Judge status: Accepted
N = int(input().rstrip())
A = list(map(int,input().rstrip().split()))
B = list(map(int,input().rstrip().split()))
C = list(map(int,input().rstrip().split()))
ans = sum(B)
for i in range(N-1):
    if A[i]+1 == A[i+1]:
        ans += C[A[i]-1]
print(ans)
# Judge status: Wrong Answer
A, B = map(int, input().split())

if A % 3 == 0 or B % 3 == 0 or A + B % 3 == 0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
a,b=map(int, input().split())
 
n=int((b-1)/(a-1))
if (b-1)%(a-1)==0:
    print(n)
else:
    print(n+1)
# Judge status: Accepted
a = int(input())

print(a**3+a**2+a)
# Judge status: Accepted
def fx(X, n):
    if (X//n):
      #print(X//5)
      return fx(X//n, n)+X//n
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(N//2,5))
# Judge status: Wrong Answer
s = input()
x = 0
l_x = []
for c in s:
  x += 1 if c == 'I' else -1
  l_x.append(x)
    
print(max(l_x))
# Judge status: Accepted
N, M = list(map(int, input().split()))

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

notgoods = [False for _ in range(N)]

for m in range(M):
    a, b = list(map(int, input().split()))
    if H[a - 1] <= H[b - 1]:
        notgoods[a - 1] = True
    if H[b - 1] <= H[a - 1]:
        notgoods[b - 1] = True

print(N - sum(notgoods))
# Judge status: Wrong Answer
a=input()
if a.islower():
    print("a")
else:
    print("b")
# Judge status: Accepted
num = int(input())
vals = list(input().split())

ivals = []
for i in range(num):
  ival = int(vals[i])
  ivals.append(ival)

count = 0
check_flag=0

def is_odd(n):
    """ 奇数判定関数 """
    return (n%2) == 1

while check_flag==0:
  for i in range(num):
    if (ivals[i])%2 != 0:
      check_flag=1
      break
    else:
      ivals[i]=ivals[i]/2
  
  if check_flag==0:
    count+=1

print(count)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
b_dic = {}
for i in range(1, N + 1):
  b_dic[i] = B[i - 1]
c_dic = {}
for i in range(1, N):
  c_dic[i] = C[i - 1]
count=0
br = -1
for a in A:
  count += b_dic[a]
  if br == a - 1:
    count += c_dic[br]
  br = a
print(count)
# Judge status: Wrong Answer
S = list(input())
T = input()
ls = []

for i in range(len(S)-len(T)):
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != "?":
            break
    else:
        ls.append(i)

if ls:
    for j in range(len(T)):
        S[ls[-1]+j] = T[j]
    print("".join(S).replace("?", "a"))
else:
    print("UNRESTORABLE")
# Judge status: Accepted
S=input()
T=input()
LS=len(S)
LT=len(T)
ans=0

for i in range(LS-LT+1):
    cnt=0
    kari=S[i:i+LT]
    for j in range(LT):
        if kari[j]==T[j]:
            cnt+=1
    #print(kari,cnt,ans)
    ans=max(cnt,ans)        

print(LT-ans)
# Judge status: Accepted
def resolve():
    X, Y = [int(i) for i in input().split()]
    cnt = 0
    while X <= Y:
        cnt += 1
        X *= 2
    print(cnt)


resolve()
# Judge status: Wrong Answer
n, m, k = map(int, input().split())

for i in range(n):
    for j in range(m):
        if i * (m - j) + j * (n - i) == k:
            print("Yes")
            exit()

print("No")
# Judge status: Accepted
a,b = map(int,input().split())
if a <= b:
    print(a)
else:
    print(a - 1)
# Judge status: Accepted
import math


def main():
    r = int(input())
    print(2 * math.pi * r)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
p = list(map(int,input().split()))
ans = 0
c = 0
for i in range(N-1):
    if p[i] == i+1:
        c += 1
    else:
        ans += (c+1)//2
        c = 0
print(ans)
# Judge status: Wrong Answer
n = int(input())
d = [[0] * 10 for _ in range(10)]

for i in range(1, n + 1):
  s = str(i)
  if s[-1] == '0':
    continue
  d[int(s[0])][int(s[-1])] += 1

result = 0
for i in range(1, 10):
  for j in range(1, 10):
    result = d[i][j] * d[j][i]
print(result)
# Judge status: Accepted
x, y = map(int, input().split())
print(min(y+~x+1, abs(y+x)+1) if x<y else min(-~x-y+1, abs(y+x)+1))
# Judge status: Accepted
N,K = map(int, input().split())
lis = list(map(int, input().split()))

lis = [(ele+1)/2 for i, ele in enumerate(lis)]

ans_lis = []

ans_lis.append(sum(lis[0:K]))

for i in range(N-K):
    ele = ans_lis[-1] - lis[i] + lis[i+K]
    ans_lis.append(ele)
    
print(max(ans_lis))