Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)

### FIXED CODE ###

from collections import defaultdict

N = input().strip()
K = int(input().strip())
lenN = len(N)

memo = defaultdict(lambda :defaultdict(lambda :defaultdict(int)))
def f(keta, flag, k):
    if keta == lenN-1:
        if k == K:
            return 1
        else:
            return 0
    if keta in memo and flag in memo[keta] and k in memo[keta][flag]:
        return memo[keta][flag][k]
    nketa = keta + 1
    maxi = int(N[nketa]) if flag else 9
    res = 0
    for i in range(maxi+1):
        nflag = flag and (int(N[nketa]) == i)
        nk = k if i == 0 else k + 1
        if nk > K:
            continue
        res += f(nketa, nflag, nk)
    memo[keta][flag][k] = res
    return res

print(f(-1, True, 0))
N = int(input())
strX = input()

decX = int(strX,2)
cnt = strX.count('1')

pop_p = decX % (cnt + 1)
pop_m = decX % (cnt - 1)

for i in range(0,N):
  if strX[i] == '0':
    pop = (2**(N-1-i) + pop_p) % (cnt + 1)
    Ans = 1
    
  elif strX[i] == '1' and cnt == 1:
    pop = 0
    Ans = 0
    
  else:
    pop = (2**(N-1-i) - pop_m) % (cnt - 1)
    Ans = 1
  
  while pop > 0:
    wkcnt = bin(pop).count('1')
    pop = pop % wkcnt
    Ans += 1
  
  print(Ans)


### FIXED CODE ###

N = int(input())
strX = input()

#10進数に変換
decX = int(strX,2)

#1の数をカウント
pop_c = strX.count('1')

# X % popcount+1
f_p = decX % (pop_c + 1)

# X % popcount-1(0になる時は0)
if pop_c == 1:
  f_m = 0
else:
  f_m = decX % (pop_c - 1)

for i in range(0,N):
  if strX[i] == '0':
    pop_a = (f_p + pow(2,(N-1-i),(pop_c + 1))) % (pop_c + 1) 
    Ans = 1
    
  elif pop_c == 1:
    pop_a = 0
    Ans = 0
    
  else:
    pop_a = f_m - (pow(2,(N-1-i),(pop_c - 1)))
    if pop_a < 0:
      pop_a = pop_a + pop_c - 1
    Ans = 1
  
  while pop_a > 0:
    wkpop = bin(pop_a).count('1')
    pop_a = pop_a % wkpop
    Ans += 1
  
  print(Ans)
ああ

### FIXED CODE ###

S = input()

if S[0] == "9" or S[1] == "9":
    print("Yes") 
elif S[0] ==9 and S[1] == "9":
    print("Yes")
else:
    print("No")
s = input()
print(S)

### FIXED CODE ###

s = input()
bonlist = ["3"]
ponlist = ["0","1","6","8"]
if str(s)[-1] in bonlist:
  	print("bon")
elif str(s)[-1] in ponlist:
  	print("pon")
else:
  	print("hon")
A = list(map(int,input().split()))
ans = []
a = abs(A(0)-A(1))+abs(A(1)-A(2))##0→1→2
b = abs(A(0)-A(2))+abs(A(2)-A(1))##0→2→1
c = abs(A(1)-A(0))+abs(A(0)-A(2))##1→0→2
ans.append(a)
ans.append(b)
ans.append(c)
print(min(ans))


### FIXED CODE ###

A = list(map(int,input().split()))
ans = []
a = abs(A[0]-A[1])+abs(A[1]-A[2])##0→1→2
b = abs(A[0]-A[2])+abs(A[2]-A[1])##0→2→1
c = abs(A[1]-A[0])+abs(A[0]-A[2])##1→0→2
ans.append(a)
ans.append(b)
ans.append(c)
print(min(ans))
a,b,c,d,e,k = [int(input) for i in range(6)]
print('Yay!' if e-a<=k else ':(')

### FIXED CODE ###

I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N,M = inputIL()
S = inputS()

if "1"*M in S:
  print(-1)
  exit()  

if M>=N:
  print(N)
  exit()
  
  
max_n = [0 for i in range(N+1)]

for i in range(1,N+1):
  s = S[max(0,i-M):i]
  l = len(s)
  if l == 0:
    continue
  mask = (1<<l) -1
  b = (~int(s, 2)) & mask

  max_n[i] = math.floor(math.log(b)/math.log(2))+1
  
now = N
deme = []
while now != 0:
  x = max_n[now]
  now = now-x
  deme.append(x)

print(*deme[::-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline

import math
import bisect

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

if "1"*M in S:
  print(-1)
  exit()  

S = [int(S[i]) for i in range(N+1)]

L = [(1<<i) -1 for i in range(1,M+1)]

max_n = [0]
mask = (1<<M) -1
b = 0
for i in range(N):
  b = ((b<<1) + (1- S[i])) & mask
  max_n.append(bisect.bisect_left(L,b)+1)

now = N
deme = []
while now != 0:
  x = max_n[now]
  now -= x
  deme.append(x)
print(*deme[::-1])
from heapq import heapify,heappush,heappop
N, K = map(int,input().split())
A = list(map(int, input().split()))
MOD =1_000_000_007

B = [a for a in A if a > 0]
C = [a for a in A if a<= 0]
B.sort()
C.sort(reverse = True)
ans = 1
if N == K:
  for a in A:
    ans *= a
    ans %= MOD
elif len(B) == 0 and K % 2 == 1:
  for i in range(K):
    ans *= C[i]
    ans %= MOD
else:
  if K % 2 == 1:
    ans *= B[-1]
    B.pop()
    K -= 1
  i = 0 
  j = 0
  k = 0
  while k < K:
    if len(C) < 2 or B[-1-j]*B[-2-j] > C[j] * C[j+1]:
      ans *= B[-1]*B[-2]
      ans %= MOD
      B.pop()
      B.pop()
    else:
      ans *= C[-1]*C[-2]
      ans %= MOD
      C.pop()
      C.pop()
    print(B,C)
    k += 2

print(ans)

### FIXED CODE ###

from heapq import heapify,heappush,heappop
N, K = map(int,input().split())
A = list(map(int, input().split()))
MOD =1_000_000_007

B = [a for a in A if a > 0]
C = [a for a in A if a<= 0]
B.sort()
C.sort(reverse = True)
ans = 1
if N == K:
  for a in A:
    ans *= a
    ans %= MOD
elif len(B) == 0 and K % 2 == 1:
  for i in range(K):
    ans *= C[i]
    ans %= MOD
else:
  if K % 2 == 1:
    ans *= B[-1]
    B.pop()
    K -= 1
  i = 0 
  j = 0
  k = 0
  while k < K:
    #print(B,C)
    flag = 0 #Bから二つとる時に0,Cから二つとる時に1,それ以外2
    if len(B) >= 2 and len(C) >= 2 and B[-1]*B[-2] < C[-1]*C[-2]:
      flag = 1
    elif len(B) <= 1 and len(C) >= 2:
      flag = 1
    elif len(B) == 1 and len(C) == 1:
      flag = 2
      
    if flag == 0:  
      ans *= B[-1]*B[-2]
      ans %= MOD
      B.pop()
      B.pop()
    
    elif flag == 1:
      ans *= C[-1]*C[-2]
      ans %= MOD
      C.pop()
      C.pop()
      
    elif flag == 2:
      ans *= C[-1]*B[-1]
      ans %= MOD
      B.pop()
      C.pop()
    
    k += 2

print(ans)
k,x = map(int, input())

a = min(-1000000,x - (k-1))
b = max(1000000,x+(k-1))

L = [i for i in range(a,b+1)]
print(" ".join(L))

### FIXED CODE ###

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

a = max(-1000000,x - (k-1))
b = min(1000000,x+(k-1))

L = [str(i) for i in range(a,b+1)]
print(" ".join(L))
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    elif m == -1 or f == -1:
        print("F")

    elif m + f >= 80:
        print("A")

    elif 65 <= m + f < 80:
        print("B")

    elif 50 <= m + f < 65:
        print("C")

    elif 30 <= m + f < 50:
        if r > 50:
            print("C")
        else:
            print("D")

    else
        print("F")

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    elif m == -1 or f == -1:
        print("F")

    elif m + f >= 80:
        print("A")

    elif 65 <= m + f < 80:
        print("B")

    elif 50 <= m + f < 65:
        print("C")

    elif 30 <= m + f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")

    elif m + f < 30:
        print("F")

    elif m + f < 30:
        print("F")
h, w = map(int, input().split())
def calculate_t(x, y):
    min_d = 1e12
    for i in range(x):
        s1 = (y//2)*i
        s2 = y*(x-i)
        s3 = (y-y//2)*i
        min_d = min(min_d, max(s1,s2,s3) - min(s1,s2,s3))
    return min_d
def calculate_3(x, y):
    for i in range(x):
        w1 = i
        w2 = (x-i)//2
        x3 = x - w1 -w2
        return min(w1, w2, w3)*y
if (h*w)%3 == 0:
    print(0)
else:
    d1 = calculate_t(h,w)
    d2 = calculate_t(w,h)
    d3 = calculate_3(h,w)
    d4 = calculate_3(w,h)
    print(min(d1,d2,d3,d4))

### FIXED CODE ###

h, w = map(int, input().split())
def calculate_t(x, y):
    min_d = 1e12
    for i in range(x):
        s1 = (y//2)*i
        s2 = y*(x-i)
        s3 = (y-y//2)*i
        min_d = min(min_d, max(s1,s2,s3) - min(s1,s2,s3))
    return min_d
def calculate_3(x, y):
    min_d = 1e12
    for i in range(x):
        w1 = i
        w2 = (x-i)//2
        w3 = x - w1 -w2
        min_d = min(min_d, (max(w1,w2,w3)-min(w1,w2,w3))*y)
    return min_d
if (h*w)%3 == 0:
    print(0)
else:
    d1 = calculate_t(h,w)
    d2 = calculate_t(w,h)
    d3 = calculate_3(h,w)
    d4 = calculate_3(w,h)
    print(min(d1,d2,d3,d4))
S = Input()
N,A,B = S.split(' ')
N = int(N)
A = int(A)
B = int(B)
ans = N //(A+B) * A
left = N % (A+B)
if left > A:
    ans += A
else:
    ans += left
print(ans)

### FIXED CODE ###

S = input()
N,A,B = S.split(' ')
N = int(N)
A = int(A)
B = int(B)
ans = N //(A+B) * A
left = N % (A+B)
if left > A:
    ans += A
else:
    ans += left
print(ans)
n = int(input())
s = [input() for _ in range(n)]
count = []
max_list = []

for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count) and not (s[i] in max_list):
        max_list.append(s[i])

max_list = sorted(max_list)
for item in max_list:
    print(item)

### FIXED CODE ###

from collections import deque
k = int(input())
q = deque([i for i in range(1, 10)])
if k <= 9:
    print(k)
    quit()

k -= 9

while k > 0:
    a = q.popleft()
    b = a % 10
    if b == 0:
        q.append(10*a)
        q.append(10*a + 1)
        k -= 2
    elif b != 0 and b != 9:
        q.append(10*a + b - 1)
        q.append(10*a + b)
        q.append(10*a + b + 1)
        k -= 3
    elif b == 9:
        q.append(10*a + b-1)
        q.append(10*a + b)
        k -= 2

if k == 0:
    print(q[-1])
elif k == -1:
    print(q[-2])
elif k == -2:
    print(q[-3])
import numpy as np
n,k = map(int,input().split())
s = list(input())

l0 = []
l1 = []
pred = s[0]
if s[0] == "0":
    l0.append(1)
    l1.append(0)
else:
    l1.append(1)

for i in range(1,n):
    if pred == s[i]:
        if s[i] == "0":
            l0[-1] += 1
        else:
            l1[-1] += 1
    else:
        if s[i] == "0":
            l0.append(1)
        else:
            l1.append(1)
    pred = s[i]
if s[-1] == "0":    
    l1.append(0)

if k >= len(l0):
    print(n)
else:
    while (k>0 and len(l0)>0):
        n0 = len(l0)
        nl0 = []
        for i in range(n0):
            nl0.append(l0[i]+l1[i]+l1[i+1])
        nl0 = np.array(nl0)
        key = np.argmax(nl0)
        l1[key] += l0[key] + l1[key+1]
        del l0[key]
        del l1[key+1]
        k -= 1
    print(max(l1))


### FIXED CODE ###

n,k = map(int,input().split())
s = list(input())
 
l0 = []
l1 = []
pred = s[0]
if s[0] == "0":
    l0.append(1)
    l1.append(0)
else:
    l1.append(1)
 
for i in range(1,n):
    if pred == s[i]:
        if s[i] == "0":
            l0[-1] += 1
        else:
            l1[-1] += 1
    else:
        if s[i] == "0":
            l0.append(1)
        else:
            l1.append(1)
    pred = s[i]
if s[-1] == "0":    
    l1.append(0)
 
ans = sum(l0[:k])+sum(l1[:k+1])
tmp = ans
for i in range(k,min(len(l0),len(l1))):
    tmp -= l0[i-k]
    tmp -= l1[i-k]
    tmp += l0[i]
    tmp += l1[i+1]
    ans = max(ans, tmp)
print(ans)
import sys


for line in sys.stdin:
    xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
    if (xa1 <= xb1 <= xa2 or xb1 <= xa1 <= xb2) and (yb1 <= ya2 <= yb2 or ya1 <= yb2 <= ya2):
        print 'YES'
    else:
        print 'NO'

### FIXED CODE ###


import sys


for line in sys.stdin:
    xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.strip().split(' '))
    if ((xb1<=xa1 and xa1<=xb2) or (xa1<=xb1 and xb1<=xa2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
        print 'YES'
    else:
        print 'NO'
import numpy as np
n,t=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(n)]

dp=[[0]*(t) for i in range(n)]
x=[[0]*(t) for j in range(n)]
s.sort()


p=s[-1]
del(s[-1])


for i in range(n-1):
    for j in range(t):

        if j-s[i][0]>=0:
            dp[i+1][j]=max(dp[i][j],dp[i][j-s[i][0]]+s[i][1])
            if dp[i+1][j]>dp[i][j]:
                x[i+1][j]=str(x[i][j-s[i][0]])+str(i)
            else:
                x[i+1][j]=x[i][j]

        else:
            dp[i+1][j]=dp[i][j]
            x[i+1][j]=x[i][j]
count=0

v=[]
for i in x[n-1][-1]:
    count+=1
    if count==1:
        continue
    v.append(int(i))


ans=p[1]
for i in range(n-1):
    if v.count(i)==1:
        continue

    ans=max(ans,s[i][1])



print(dp[n-1][-1]+ans)



### FIXED CODE ###

n,t=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(n)]

dp=[[0]*(t) for i in range(n+1)]
s.sort()


for i in range(n):
    for j in range(t):
        if j-s[i][0]>=0:
            dp[i+1][j]=max(dp[i][j],dp[i][j-s[i][0]]+s[i][1])

        else:
            dp[i+1][j]=dp[i][j]

ans=0
for i in range(n):
    ans=max(ans,dp[i][t-1]+s[i][1])

print(ans)
a.b = map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")


### FIXED CODE ###

a,b = map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")
N=int(input())
S=input()

# Zアルゴリズムで解く

c=0
max_num=0
A=[0 for i in range(length-max_num)]

for sub in range(len(S)):
    subS = S[sub:]
    length = len(subS)
    if length <= max_num:
        break

    for i in range(1,length-max_num):
        if i+ A[i-c] < c+A[c]:
            A[i] = A[i-c]
        else:
            j=max(0,c+A[c]-i)
            while i+j<length and subS[j]==subS[i+j]:
                j+=1
            A[i]=j
            if max_num<A[i] and i>=A[i]:
                max_num = A[i]
print(max_num)

### FIXED CODE ###

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

# Zアルゴリズムで解く

def z_algorithm(S):
    N=len(S)
    A = [N] + [0]*(N-1)
    
    left=1
    length=0
    
    while left < N:
        
        # prefixが同じ間length加算
        while left + length < N and S[length] == S[left+length]:
            length += 1
        
        # prefixの一致数保存
        A[left] = length
        
        # 一文字一致していなければ戻る
        if length == 0:
            left+=1
            continue
        
        # lengthの分だけleftとindexの間を埋めていく(はみ出ていないとこまで)
        k=1
        while k+left < N and k+A[k]<length:
            A[left+k] = A[k]
            k += 1
            
        left += k
        length -= k
    return A

c=0
max_num=0
for sub in range(len(S)):
    subS = S[sub:]
    A=z_algorithm(subS)
    for i,a in enumerate(A):
        if i>=a and max_num<a:
            max_num=a
print(max_num)
N,Y = map(int,input().split())
A = list(range(0,N+1))
B = list(range(0,N-A+1))
a=-1
b=-1
c=-1
for i in A:
    for j in B:
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
a=str(a)
b=str(b)
c=str(c)
print(a+" "+b+" "+c)

### FIXED CODE ###

N,Y = map(int,input().split())
A = list(range(0,N+1))
a=-1
b=-1
c=-1
for i in A:
    for j in list(range(0,N-i+1)):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
print(a,b,c)
S = list(input())
Q = int(input())
l_list = []
r_list = []
flag = True
for i in range(Q):
    A = list(map(str, input().split()))
    if len(A)==1:
        flag = not flag
    else:
        if flag:
            if A[1]=="1":
                l_list.appendleft(A[2])
            else:
                r_list.append(A[2])
        else:
            if A[1]=="1":
                r_list.append(A[2])
            else:
                l_list.appendleft(A[2])
if flag:
    print("".join(l_list)+"".join(S)+"".join(r_list))
else:
    print("".join(r_list[::-1])+"".join(S[::-1])+"".join(l_list[::-1]))

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
flag = True
for i in range(Q):
    A = list(map(str, input().split()))
    if len(A)==1:
        flag = not flag
    else:
        if flag:
            if A[1]=="1":
                S.appendleft(A[2])
            else:
                S.append(A[2])
        else:
            if A[1]=="1":
                S.append(A[2])
            else:
                S.appendleft(A[2])
S = "".join(S)
if flag:
    print(S)
else:
    print(S[::-1])
num = int(input())
lens = [int(a) for a in input().split(' ')]
max_len = max(len)
lens.remove(max_len)
sum_lens = sum(lens)

if max_len < sum_lens:
  print('Yes')
else:
  print('No')  

### FIXED CODE ###

num = int(input())
lens = [int(a) for a in input().split(' ')]
max_len = max(lens)
lens.remove(max_len)
sum_lens = sum(lens)
 
if max_len < sum_lens:
  print('Yes')
else:
  print('No')
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, readlines().split())
x = M * (M - 1) // 2
x += N * (N - 1) // 2
print(x)

### FIXED CODE ###

N, M = map(int,input().split())
a = N * (N - 1) / 2 + M * (M - 1) / 2
print(int(a))
import sys
cnt = 1

while 1
	num=sys.stdin.readline().strip()
	if num = "0":
		break;
	print('Case {0}: {1}'.format(cnt, num))
	cnt+=1

### FIXED CODE ###

import sys
cnt = 1

while 1:
  num=sys.stdin.readline().strip()
  if num == "0":
    break
  print('Case {0}: {1}'.format(cnt, num))
  cnt+=1
#2019/10/04
time = list(map(int, open(0).read().split()))
# print(time)

time_residual = [i%10 for i in time]
# print(time_residual)

time_residual_notZero = [i for i in time_residual if i%10 != 0 ]
# print(time_residual_notZero)

ans = sum([-(-i//10)*10 for i in time]) + min(time_residual_notZero) - 10
#print(ans)

### FIXED CODE ###

#2019/10/04
time = list(map(int, open(0).read().split()))
# print(time)

time_residual = [i%10 for i in time]
# print(time_residual)

time_residual_notZero = [i for i in time_residual if i%10 != 0 ]
# print(time_residual_notZero)

if(time_residual_notZero != []):
    ans = sum([-(-i//10)*10 for i in time]) + min(time_residual_notZero) - 10
else:
    ans = sum(time)
print(ans)
a = list(map(int, input().split()))
a.sort()
if a < 9:
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
if a[1] < 9:
    print("Yay!")
else:
    print(":(")
a=input()
print(int(a+a**2+a**3))


### FIXED CODE ###

a=input()
a=int(a)
print(int(a+a**2+a**3))
b = input()
if b = 'A':
    print('T')
elif b = 'C':
    print('G')
elif b = 'G':
    print('C')
else:
    print('A')

### FIXED CODE ###

b=input()
print('T' if b=='A' else 'A' if b=='T' else 'G' if b=='C' else 'C')
a,b,c = map(int,input())

if a+b >= c:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

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

if a+b >= c:
  print("Yes")
else:
  print("No")
import collections
n=int(input())
c=[0]*3
alphabet=set()
for i in range(n):
    s=input()
    counter=collections.Counter(s)
    c[i]=counter
    for moji in s:
        if(moji not in alphabet):
            alphabet.add(moji)
alphabet=sorted(alphabet)
text=''
for moji in alphabet:
    count1=c[0][moji]
    count2=c[1][moji]
    count3=c[2][moji]
    text+=moji*min(count1,count2,count3)
print(text)



### FIXED CODE ###

import collections
n=int(input())
c=[0]*n
alphabet=set()
for i in range(n):
    s=input()
    counter=collections.Counter(s)
    c[i]=counter
    for moji in s:
        if(moji not in alphabet):
            alphabet.add(moji)
alphabet=sorted(alphabet)
text=''
for moji in alphabet:
    count=10000
    for i in range(n):
        if(count>c[i][moji]):
            count=c[i][moji]
    text+=moji*count
print(text)
a,b,c,k=map(int,input().split())

if k%2 == 0:
  if abs(a-b)<=10**18:print(a-b)
  else:print("Unfair")
   
else:
    if ans(b-a)<=10*18:print(b-a)
    else:print("Unfair")

### FIXED CODE ###

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

if k%2 == 0 and abs(a-b)<=10**18:print(a-b)
elif k%2 != 0 and abs(b-a)<=10**18:print(b-a)
else:print("Unfair")
import sys


def solve():
    MOD = 998244353
    N, *d_l = map(int, open(0).read().split())
    ans = 1
    
    if d_l[0] != 0:
        print(0)
        sys.exit()
    
    d_max = max(d_l)
    count_l = [d_l.count(1)]
    for i in range(2, d_max+1):
        count_l.append(d_l.count(i))
        ans *= count_l[i-2] ** count_l[i-1]
    print(ans%MOD)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

def solve():
    N = int(input())
    ans = 0
    if N % 2 == 0:
        ans = N // 2 - 1
    else:
        ans = N // 2
    print(ans)


if __name__ == '__main__':
    solve()
A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = [0 for i in range(M)]
y = [0 for i in range(M)]
c = [0 for i in range(M)]
for i in range(M):
  x[i], y[i], c[i] = map(int, input().split())
non_coupon_val = min(a) + min(b)
coupon_val_arr = [0 for i in range(M)]
for i in range(M):
  coupon_val_arr[i] = a[x[i]] + b[y[i]] - c[i]
coupon_val = min(coupon_val_arr)
print(min([non_coupon_val, coupon_val]))

### FIXED CODE ###

A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = [0 for i in range(M)]
y = [0 for i in range(M)]
c = [0 for i in range(M)]
for i in range(M):
  x[i], y[i], c[i] = map(int, input().split())
non_coupon_val = min(a) + min(b)
coupon_val_arr = [0 for i in range(M)]
for i in range(M):
  coupon_val_arr[i] = a[x[i]-1] + b[y[i]-1] - c[i]
coupon_val = min(coupon_val_arr)
print(min([non_coupon_val, coupon_val]))
a=int(input())
b=int(input())
if a*b%2==0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a*b%2==0:
    print("Even")
else:
    print("Odd")
x = list(map(int,input()))
for i in range(5):
  if x[i]==0:
    print(i+1)

### FIXED CODE ###

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

for i in range(5):
  if X[i]==0:
    print(i+1)