peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
X,K,D = map(int, input().split())
place = X

if K > 50000 and K % 2 == 0:
    K = 10000
if K > 50000 and K % 2 == 1:
    K = 10001

for i in range(K):
    if place == 0 and (K-i)%2==0:
        break

    if place >= 0 and (place - D) >= 0:
        place -= D

    elif place >= 0 and (place - D) <= 0:
        place -= D
  
    else: 
        place += D 
      
if place < 0:
    place = abs(place)
print(place)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split(" "))

prices = []
if X > Y:
    half_max_count = X + 1
else:
    half_max_count = Y + 1

# 3 for文はダメなので削減する
# sliceで半分にできる多分。
for i in range(0, half_max_count):
    a_price = int(X - i) * A if (int(X - i) >= 0) else 0
    b_price = int(Y - i) * B if (int(Y - i) >= 0) else 0
    half_price = 2 * i * C
    price = half_price + a_price + b_price
    prices.append(price)
print(min(prices))
# Judge status: Accepted
N,M = map(int,input().split())
gcd = M//N

while gcd*N!=M:
  gcd = M//N
  N = 1+(M-1)//gcd

print(gcd)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
B = [0]
for i in range(N):
    B.append(B[i]+A[i])
ans = pow(10,9)
for i in range(N):
    ans = min(ans,abs(B[N]-2*B[i]))
print(ans)
# Judge status: Wrong Answer
n=int(input())

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

s=0
for i in range(len(a)-1):
    if a[i]>a[+1]:
        s+=0
    else:
        s+=a[i+1]-a[i]

print(s)
# Judge status: Accepted
n,a,b=map(int,input().split())
cab,cb=0,0
S=input()
for i in range(n):
  s=S[i]
  if s=='c':
    print('No')
  if s=='a':
    if cab<a+b:
      print('Yes')
      cab+=1
    else:
      print('No')
  if s=='b':
    if cab<a+b and cb<b:
      print('Yes')
      cab+=1
      cb+=1
    else:
      print('No')
# Judge status: Accepted
a,b,t = map(int,input().split())
print(t//a * b)
# Judge status: Accepted
n,*l=map(int,open(0).read().split())
m,M=sorted(l[::2]),sorted(l[1::2])
d=n//2
print(M[d]-m[d]+1+(M[d-1]+-m[d-1])*(n%2^1))
# Judge status: Accepted
a,b=map(int,input().split())

print(a*b)
# Judge status: Accepted
L , R , d = map(int,input().split())
k = 0
for i in range(L,R+1):
  if i%d == 0:
    k +=1
print(k)
# Judge status: Wrong Answer
(N,M)=input().split()
(N,M)=(int(N),int(M))
H=list(map(int, input().split()))
Bad=[]
AB=list(range(M))
for i in range(M):
  AB[i]=list(map(int, input().split()))
  if H[AB[i][0]-1] > H[AB[i][1]-1]:
    Bad.append(H[AB[i][1]-1])
  elif H[AB[i][0]-1] < H[AB[i][1]-1]:
    Bad.append(H[AB[i][0]-1])
for i in range(len(Bad)):
  if Bad[i] in H:
    H.remove(Bad[i])
print(len(H))
# Judge status: Accepted
# https://atcoder.jp/contests/abc061/tasks/abc061_a

A, B, C = map(int, input().split())

if A <= C <= B:
    print('Yes')

else:
    print('No')
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
for i in range(1,max(a,b)+1):
  if a%i==0 and b%i==0:
    k-=1
    if k==1:
      break
print(i)
# Judge status: Accepted
a ,b ,c = map(int,input().split())
if a == b == c and a % 2 == 0:
    ans = -1
else:
    ans = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        na = a
        nb = b
        nc = c
        a = (nb + nc)//2
        b = (na + nc)//2
        c = (na + nb)//2
        ans += 1
print(ans)
# Judge status: Accepted
a,b = input().split()
a2 = a*int(b)
b2 = b*int(a)
print(min(a2,b2))
# Judge status: Accepted
S = input()
if S == 'RRR':
    print(3)
elif S == 'SSS':
    print(0)
elif S == 'SRR' or S == 'RRS':
    print(2)
else:
    print(1)
# Judge status: Accepted
a,b = map(int, input().split())
if(a>=13):
  print(b)
elif(a<=5):
  print(0)
else:
  print(int(b/2))
# Judge status: Accepted
sheet=[list(map(int,input().split())) for i in range(3)]
n=int(input())
number=[int(input()) for i in range(n)]
answer="No"

for i in range(3):
   for j in range(3):
      if sheet[i][j] in number:
        sheet[i][j]=0

if sheet[0][0]+sheet[1][1]+sheet[2][2]==0 or sheet[2][0]+sheet[1][1]+sheet[0][2]==0:
  answer="Yes"
else:        
  for i in range (3):
    if sheet[i]==[0,0,0]:
      answer="Yes"
    elif sheet[0][i]==0 and sheet[1][i]==0 and sheet[2][i]==0:
      answer="Yes"

print(answer)
# Judge status: Accepted
s = input()
n = len(s)+1
ans = 0
ls = [0 for _ in range(n)]
rs = [0 for _ in range(n)]
for i in range(n-1):
    if s[i] == '<':
        ls[i+1] = ls[i]+1
for i in range(n-1):
    if s[-1-i] == '>':
        rs[-2-i] = rs[-1-i]+1
for i,j in zip(ls,rs):
    ans += max(i,j)
print(ans)
# Judge status: Wrong Answer
S = list(map(int,input()))
K = int(input())
for i in range(K):
  if S[i] != 1:
    print(S[i])
    break
# Judge status: Accepted
n, q = map(int, input().split())
s = input()

lc = [0]
c = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        c += 1
    lc.append(c)

for i in range(q):
    l, r = map(int, input().split())
    print(lc[r-1]-lc[l-1])
# Judge status: Wrong Answer

S = list(input())
print(S)

if S.count('a') ==1 and S.count('b') and S.count('c'):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
if A*C<B:
  print(B)
else:
  print(B//A)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
flag = 'APPROVED'
for a in A:
    print(a)
    if a % 2 == 0:
        if a % 3 != 0:
            if a % 5 != 0:
                flag = 'DENIED'
            break
print(flag)
# Judge status: Accepted
n = int(input())
csf = []
for _ in range(n-1):
    c, s, f = map(int, input().split())
    csf.append((c, s, f))
ans = [0]*n
for i, (c, s, f) in enumerate(csf):
    for j in range(0, i+1):
        if ans[j] <= s:
            ans[j] = c+s
        else:
            ans[j] = (ans[j]+f-1)//f*f+c
for i in ans:
    print(i)
# Judge status: Accepted
N=int(input())
print((pow(10,N)-2*pow(9,N)+pow(8,N))%(pow(10,9)+7))
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())

x = max(h, w)
if n%x == 0:
  print(n//x)
else:
  print(n//x+1)
# Judge status: Accepted
lis = []
for i in range(5):
  lis.append(int(input()))
  
if max(lis)-min(lis) > int(input()):
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
# ABC112B

n, T = map(int, input().split())
Min = -1
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        if Min == -1:
            Min = c
        else:
            Min = min(Min, c)
if Min == -1:
    print('TLE')
else:
    print(Min)
# Judge status: Accepted
n,m = map(int,input().split())
n=min(n,m)
x = list(map(int,input().split()))

x = sorted(x)

#print("x",x)

y = []

for i in range(m-1):
    y.append(x[i+1]-x[i])

y = sorted(y, reverse=True)

#print("y",y)

skip = 0
for i in range(n-1):
    skip += y[i]

print(max(x)-min(x)-skip)
# Judge status: Accepted
def solve():
    X = int(input())
    num, mod = divmod(X,11)
    print(2*num+(mod+5)//6)



if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
S = input()
temp = S[0]
a = 1
b = 0
for i in range(1,4):
  if temp == S[i]:
    a = a+1
  else:
    b = b+1
if b == 2 and a == 2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
A=[]
B=[]
for i in range (n):
  p=abs(a[i])
  A.append(p)
  if a[i]<0:
    B.append(a[i])
if len(B)%2==0:
  print(sum(A))
else:
  print(sum(A)-(min(A)*2),)
# Judge status: Wrong Answer
k, yen = input().split()
print('Yes' if k*500>yen else 'No')
# Judge status: Wrong Answer
W,a,b=map(int,input().split())
 
if a+W<b:
  print(b-(W+a))
else:
  print(0)
# Judge status: Wrong Answer
d = input()
if d == 25:
  print("Christmas")
elif d == 24:
  print("Christmas eve")
elif d == 23:
  print("Christmas eve eve")
else:
  print("Christmas eve eve eve")
# Judge status: Accepted
n, x, y = [int(i) for i in input().split()]

ans = [0]*n
for i in range(1, n):
    for j in range(i+1, n+1):
        ans[min(j-i, abs(x-i)+abs(j-y)+1)] += 1

print(*ans[1:], sep='\n')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
answer = [0] * N

for i in A:
  answer[i-1] += 1

for n in answer:
  print(n)
# Judge status: Wrong Answer
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

print(K*X+(N-K)*Y)
# Judge status: Wrong Answer
n = int(input())
s = [input().split() for _ in range(n)]
m = int(input())
t = [input().split() for _ in range(m)]
ans = -100
for i in s:
    ans = max(ans,s.count(i) - t.count(i))
print(ans)
# Judge status: Accepted
n = int(input())
lis = list(map(int, input().split()))

b = [0]*3

for i in lis:
    if i % 4 == 0:
        b[2] += 1
    elif i % 2 == 0:
        b[1] += 1
    else:
        b[0] += 1

if b[1] == 0:
    if b[2] + 1 >= b[0]:
        print("Yes")
        exit()
    else:
        print("No")
        exit()



if b[2]  >= b[0]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, l = map(int, input().split())
scores = [ i+l for i in range(n) ]
min_abs = float("inf")

for s in scores:
    if abs(s) < abs(min_abs):
        min_abs = s

print(sum(scores)-min_abs)
# Judge status: Wrong Answer
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
count = 0

for i in range(N-1):
  if x[i] == y[i]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0
  

if flag == 1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
s, c = map(int, input().split())
c = c//2

if s == c:
    print(s)
elif s > c:
    print(c)
elif s < c:
    t = c - s
    print(s + t//2)
# Judge status: Wrong Answer
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
print((a-c)//b)
# Judge status: Accepted
n, m = map(int, input().split())
ans = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    ans[a] += 1
    ans[b] += 1

for i in ans:
    print(i)
# Judge status: Accepted
S = input()
print(S[0]+S[1]+S[2])
# Judge status: Accepted
N=int(input())
mod = 10**9+7
A=pow(10,N,mod)-2*pow(9,N,mod)+pow(8,N,mod)
print(A%mod)
# Judge status: Wrong Answer
# import math
# import statistics
a=input()
#b,c=int(input()),int(input())
c=[]
for i in a:
   c.append(i)
#e1,e2,e3,e4 = map(int,input().split())
#f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
count=0
for i in range(len(c)-1):
    if c[i]==c[i+1]:
        count+=1

if count>0:
    print("no")
else:
    print("yes")
# Judge status: Accepted
A,B,C = map(int,input().split())

print(min(C, B//A))
# Judge status: Wrong Answer
from collections import deque

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

tree=[[0] for _ in range(N)]

for _ in range(M):
    A,B=map(int,input().split())
    tree[A-1].append(B-1)
    tree[B-1].append(A-1)

dist = [-1]*N
que = deque([0])
dist[0] = 0
while que:
    v = que.popleft()
    d = dist[v]
    for w in tree[v]:
        if dist[w] > -1:
            continue
        dist[w] = d + 1
        que.append(w)
print("Yes")
for j in range(1,N):
    print(dist[j])
# Judge status: Accepted
import copy
n=int(input())
x=list(map(int,input().split()))

y=copy.copy(x)
y.sort()

left=y[n//2-1]
right=y[n//2]

for i in range(n):
    if x[i]<=left:
        print(right)
    else:
        print(left)
# Judge status: Wrong Answer
from math import ceil
N, K, S = map(int,input().split())

if N == K:
  for i in range(K): print(S,end=" ")
else:
  for i in range(ceil(K/2)): 
    print(S-1,end=" ")
    print(1,end=" ")
  if K%2 == 0: 
    print(S-1,end=" ")  
    for i in range(N-ceil(K/2)*2-1):
      print(10**9,end=" ")
  else:
    for i in range(N-ceil(K/2)*2):
      print(10**9,end=" ")
# Judge status: Accepted
N, D = map(int, input().split())
x, y = 0, 0
res = 0

for _ in range(N):
    x, y = map(int, input().split())

    if (x ** 2 + y ** 2) ** 0.5 <= D:
        res += 1

print(res)
# Judge status: Accepted
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
a = sorted(list(set(a)))
from fractions import gcd
lc = a[0]
if n != 1:
  for num,i in enumerate(a[1:]):
    if lc == 0:
      break
    lc = lc * i // gcd(lc, i)
    if gcd(lc, i) == min(i,lc):
      for j in a[:num+1]:
        if (i/j)%2 == 0:
          lc = 0
          break 
if lc == 0:
  print(0)
else:
  print((m+lc//2)//lc)
# Judge status: Wrong Answer
x, y = map(int, raw_input() .split())
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]
if x and y in list1 or list2 or list3:
    print "Yes"
else:
    print "No"
# Judge status: Wrong Answer
def candy():
    boxNum, x = [int(i) for i in input().split()]
    ain = input()
    alist = ain.split(' ')

    s = 0

    if int(alist[0]) > x:
        s = x - int(alist[0])
        alist[0] = x

    for i in range(0, boxNum-1):
        if int(alist[i+1]) + int(alist[i]) > x:
            s = s + (int(alist[i+1]) + int(alist[i]) - x)
            alist[i+1] = x - int(alist[i])
        
    print(s)
    
candy()
# Judge status: Accepted
sx, sy, tx, ty=map(int,input().split())

hrz=tx-sx
vrt=ty-sy

a="U"*vrt
b="R"*hrz
c="D"*vrt
d="L"*hrz
ans1=a+b+c+d
a2=a+"U"
b2=b+"R"
c2=c+"D"
d2=d+"L"
ans2="L"+a2+b2+"DR"+c2+d2+"U"
print(ans1+ans2)
# Judge status: Wrong Answer
from fractions import gcd
n,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
ans=x[1]-x[0]
for i in range(2,n):
    ans=gcd(ans,x[i]-x[i-1])
print(ans)
# Judge status: Accepted
words = input().split(' ')

print(words[1]+words[0])
# Judge status: Accepted
C = input()
C = ord(C)
C = C+1
print(chr(C))
# Judge status: Wrong Answer
if __name__ == "__main__":
  a, b, c = map(int,input().split())
  ans = 3
  if a == b:
    ans -= 1
  if b == c:
    ans -= 1
  print(ans)
# Judge status: Accepted
line = int(input())
column = int(input())
min_black_tile = int(input())
paint_tile = 0
count = 0

if line > column:
  while paint_tile < min_black_tile:
    paint_tile += line
    count += 1
  print(count)
else:
  while paint_tile < min_black_tile:
    paint_tile += column
    count += 1
  print(count)
# Judge status: Accepted
import math
N, K = map(int, input().split())

ans = sum(0.5 ** math.ceil(math.log2(K / i)) if K > i else 1 for i in range(1, N + 1)) / N
print(ans)
# Judge status: Accepted
S = input()
if S[0] == "A":
    S_cpy = S.lstrip("A")
else:
    print("WA")
    exit()

if S[2:-1].count("C") == 1:
    S_cpy = S_cpy.replace("C", "")
else: 
    print("WA")
    exit()

if S_cpy.islower():
    print("AC")
else:
    print("WA")
# Judge status: Wrong Answer
n=int(input())
ct=0
for i in range(n):
    j=str(i)
    if int(j[::-1])<i:
        ct+=1
    elif int(j[::-1])==i:
        ct+=len(j)
print(ct)
# Judge status: Accepted
n=int(input())
if n<7:print(n//3);quit()
M=10**9+7
ln,hn,dp=n-6,n-5,2
s=n-4
n,d=n-5,1
while n:
  for i in range(3):n=(n*ln)%M;ln-=1
  for i in range(2):n=(n*pow(hn,-1,M))%M;hn-=1
  d=(d*pow(dp,-1,M))%M;dp+=1
  s=(s+n*d)%M
print(s)
# Judge status: Accepted
from collections import deque

S = deque(input())
Q = int(input())
flip = False # False: left side is the head
for i in range(Q):
  Query_i = list(map(str, input().split()))
  if Query_i[0]=='1':
    flip = not flip
  elif Query_i[1] == '1' and not flip:
    S.appendleft(Query_i[2])
  elif Query_i[1] == '1' and flip:
    S.append(Query_i[2])
  elif Query_i[1] == '2' and not flip:
    S.append(Query_i[2])
  elif Query_i[1] == '2' and flip:
    S.appendleft(Query_i[2])
if flip:
  S.reverse()
print(''.join(S))
# Judge status: Accepted
fib = [0 for i in range(10**5+1)]
fib[0] = 1
fib[1] = 1
for i in range(2,10**5+1):
    fib[i] = fib[i-1] + fib[i-2] % (10**9+7)
n,m = map(int,input().split())
a = [-1]
for i in range(m):
    ai = int(input())
    if ai - a[i] == 1:
        print(0)
        exit()
    a.append(ai)
a.append(n+1)
ans = 1
for i in range(1,m+2):
    ans = (ans * fib[a[i]-a[i-1]-2]) % (10**9 + 7)
print(ans)
# Judge status: Accepted
N=int(input())
d=list(map(int, input().split()))
 
d=sorted(d)
ans=0
 
for i in range(1+10**5):
    if d[int(N/2-1)] < i and i <= d[int(N/2)]:
        ans +=1
 
print(ans)
# Judge status: Accepted
K, X = map(int, input().split())
for i in range(X - K + 1, X + K):
  print(i,end = " ")
# Judge status: Wrong Answer
n = int(input())
a_l = list(map(int,input().split()))

count = 0
for i in range(n):
    for j in range(i+1,n):
        if (j-i) == abs(a_l[j-1] - a_l[i-1]):
            count += 1

print(count)
# Judge status: Accepted
n = int(input())
P = list(map(int,input().split()))

ans = 0

for i in range(1,n-1):
  pl = P[i-1:i+2]
  pl.sort()
  p = P[i]
  if pl[1] == p:
    ans += 1
print(ans)
# Judge status: Accepted
n,a,b,c,d=map(int,input().split())
s=input()
# a->c, b->d
# a<b
if c>d:
  if '...' in s[b-2:d+1]:
    if '##' in s[a:c]:
      print('No')
      exit()
  else:
    print('No')
    exit()

else:
  if '##' in s[a:c]:
    print('No')
    exit()
  if '##' in s[b:d]:
    print('No')
    exit()
print('Yes')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

node = 1
# 作成しなければならない葉の残りの数
leaf = sum(A)
max_node = 1
judge = True
ans = 0
for i, a in enumerate(A):
    ans += node
    leaf -= a
    if node < a+1 and leaf > 0:
        judge = False
        break
    # 次の深さのノード
    max_node = (node - a) * 2
    node = min(leaf, max_node)
    

if judge and max_node == 0:
    print(ans)
else:
    print(-1)
# Judge status: Wrong Answer
a, b, c = (int(_) for _ in input().split())
print('Yes' if a + b <= c else 'No')
# Judge status: Accepted
a,b = map(int,input().split())
if a >= 13:
    print(b)
elif 6<=a<=12:
    print(b//2)
else:
    print(0)
# Judge status: Wrong Answer
s=input()
l=len(s)
k=int(input())
z=''
for i in range(l):
  t=123-ord(s[i])
  if t<=k:
    z+='a'
    k-=t
  else:
    z+=s[i]
v=ord(z[l-1])-97+k
z=z[:l-1]+chr(v%26+97)
print(z)
# Judge status: Wrong Answer
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
table = { "r": p, "s": r, "p": s }

score = [0] * n
for i in range(n):
    if i-k < 0:
        score[i] = table[t[i]]
        continue
    if score[i-k] != 0 and score[i-k] == table[t[i]]:
        score[i] = 0
    else:
        score[i] = table[t[i]]

print(sum(score))
# Judge status: Wrong Answer
X, A, B = map(int, input().split())

if B < A:
    print("delicious")
elif B <= (X + A):
    print("safe")
elif B >= (X + A + 1):
    print("dangerous")
# Judge status: Accepted
li=[0]*8
o=0
n,*a=map(int,open(0).read().split())
for i in a:
  if i>=3200:o+=1  
  else:li[i//400]=1
if sum(li)==0:print(1,min(o,8))
else:print(sum(li),(sum(li)+o))
# Judge status: Accepted
h,w =  map(int, input().split())

if (h == 1) or (w == 1):
    print(1)
elif (h*w)%2==0:
    print(int((h*w)/2))
else:
    print(int(((h*w)+1)/2))
# Judge status: Accepted
n, y = map(int, input().split())

for a in range(n+1):
    for b in range(n+1-a):
        c = n-a-b
        total = 10000*a + 5000*b + 1000*c
        if total==y:
            print("{0} {1} {2}".format(a,b,c))
            exit()

print("-1 -1 -1")
# Judge status: Accepted
a,b = map(int,input().split())

if a <= b: print(a)
else: print(a-1)
# Judge status: Wrong Answer
s = input().split()
float(s[0]) * float(s[1])
# Judge status: Wrong Answer
X = int(input())

i = 0
while X > 0:
  i += 1
  if X-i >= i + 1 or X == i:
    X -= i

print(i)
# Judge status: Accepted
abcd = list(input())
abcd = [int(i) for i in abcd]

for i in range(2**3):
  bag=["+"]*3
  #print("pattern {}: ".format(i), end="")
  for j in range(3):
    if ((i>>j) & 1):
      bag[j]="-"
  #print(bag)
  s=abcd[0]
  for ii in range(len(bag)):
    if bag[ii] == "+":
      s+=abcd[ii+1]
    else:
      s-=abcd[ii+1]
    #print(s)
    
  if s == 7:
    print("{}{}{}{}{}{}{}={}".format(abcd[0],bag[0],abcd[1],bag[1],abcd[2],bag[2],abcd[3],s))
    exit()
# Judge status: Accepted
p,q,r = map(int,input().split())


print(min([p+q,q+r,r+p]))
# Judge status: Accepted
import math
import itertools
N = int(input())
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
a = []
for i in range(1,N+1):
    a.append(i)
junn = list(itertools.permutations(a))
flag = 0
for i in range(math.factorial(N)):
    if p == list(junn[i]):
        pp = i
        if flag == 1:
            break
        flag = 1
    if q == list(junn[i]):
        qq = i
        if flag == 1:
            break
        flag = 1
print(abs(pp-qq))
# Judge status: Accepted
n, m = map(int, input().split())

if n * 2 >= m:
    print(m//2)
    exit()
else:
    m -= n * 2

print(n + (m // 4))
# Judge status: Accepted
#バスが運行するかどうか Yes　運航する
S=input()
if S[0]==S[1] and S[0]==S[2]:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
a = [0]
a.extend(list(map(int,input().split())))
nums = [0]*(n+1)
for i in a:
    nums[i] += 1

ans = '\n'.join(map(str,nums[1:]))
print(ans)
# Judge status: Accepted
import collections
N = int(input())

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

#print(collections.Counter(A))
c = collections.Counter(A)
count = 0
for i in c:
    count+=c[i]%2
print(count)
# Judge status: Wrong Answer
s = input()
word = []

for i in s:
    if (i not in word):
        word.append(i)
    else:
        print('no')

print('yes')
# Judge status: Accepted
A,B,C,K = map(int,input().split())
ans = 0
if A >= K:
    print(K)
elif A<K and A+B>K:
    print(A)
else:
    print(2*A+B-K)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
k = a - b + 1 + n
ans = 1
for i in range(n):
  ans *= (k-i)
for i in range(n):
  ans  = ans//(n-i)
print(ans)
# Judge status: Accepted
x,y = [int(i) for i in input().split()]
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

if x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A,B=map(int,input().split())
total=0
i=0
if B==1:
  print(0)
else:
  while B>total:
    i+=1
    total=A*i-(i-1)
  print(i)
# Judge status: Wrong Answer
import numpy as np

n = int(input())
a = list(map(int,input().split()))
a = np.array(a,dtype=np.int64)
point = 0
mod = 10**9+7

b = [((a>>i)&1).sum() for i in range(61)]
c = [n-b[i] for i in range(61)]

point = 0

for i in range(61):
    point += 2**i*b[i]*c[i]%mod

print(point%mod)
# Judge status: Accepted
import math

n = int(input())
base = [int(input()) for i in range(5)]

time = math.ceil(n / base[0])
base_min = base[0]

for i in range(1,5):
  if base_min <= base[i]:
    time = time + 1
  elif base[i] < base_min:
    time = time + math.ceil( (n - base[i]*(math.ceil(n/base_min)-1) )/base[i]) 
    base_min = base[i]
print(time)
# Judge status: Accepted
S = list(input())
T = list(input())
T.pop(-1)
if S==T:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))

def GCD(x,y):
    if y==0:
        return x
    return GCD(y,x%y)
lcm = 1
for i in A:
    lcm = lcm*i*pow(GCD(lcm,i),MOD-2,MOD)
ans = 0
for i in A:
    ans += lcm*pow(i,MOD-2,MOD)
    ans %= MOD
print(ans)
# Judge status: Wrong Answer
N = int(input())
List = [int(i) for i in input().split(" ")]
Max = max(List)
l = 0
for i in range(N):
    if List[i]!=Max:
        l+=List[i]

if Max<l:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N,K=map(int,input().split())
p=list(map(int,input().split()))
ans=(sum(p[0:K])+K)/2
temp=ans
for i in range(1,N-K+1):
    temp-=(p[i-1]+1)/2
    temp+=(p[i+K-1]+1)/2
    if temp>ans:
        ans=temp
print(ans)
# Judge status: Accepted
k,x = map(int,input().split())	
start = x-k+1
for i in range(start,start+2*k-1,1):
    print(i,end=" ")
# Judge status: Accepted
X = int(input())
a = X // 100
r = X % 100
ans = '1' if r <= 5*a else '0'
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
if a>12:
    ans = b
elif a>5:
    ans = b//2
else:
    ans = 0
print(ans)
# Judge status: Accepted
S=input()

ans=0
temp=0
l=['A','C','G','T']

for i in range(len(S)):
  if S[i] in l:
    temp+=1
    ans=max(temp,ans)
  else:
    temp=0

print(ans)
# Judge status: Wrong Answer
a,b,c = map(int ,input().split())

if a == b+c or b == a+c or c == a+b:
  print("YES")
else :
  print("NO")
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
if A%2==0 or B%2==0 or C%2==0:
    print(0)
else:
    cmin = ((A+1)//2-A//2)*B*C
    cmin = min(cmin,((B+1)//2-B//2)*A*C)
    Cmin = min(cmin,((C+1)//2-C//2)*B*A)
    print(cmin)