Harryxun/stf_run huggingface dataset:
N = int(input())
count = 0

for a in range(1, N):
  tmp = (N-1) // a
  if a <= (N) // 2:
    count += tmp
  else:
    count += 1          

print(count)

### FIXED CODE ###

S = input()

if S[-1] == 's':
  print(S + 'es')
else:
  print(S + 's')
print(int(input())%%3)

### FIXED CODE ###

print(int(input())//3)
if __name__ == '__main__':
    n, m, x = list(map(int, input().split()))

    c = []
    a = []

    for i in range(n):
        c_temp, *a_temp = list(map(int, input().split()))  
        c.append(c_temp)
        a.append(a_temp)

    INF = float("inf")
    ans = INF

    for bit in range(1 << n):
        price = calc_price(bit) 
        ans = min(ans, price) 

    if ans == INF:
        print(-1)
    else:
        print(ans)

def calc_price(bit):
    price_total = 0 
    learn_total = [0] * m 

    for i in range(n):
        if (bit >> i) & 1:  
            price_total += c[i]  
            learn = a[i]  
            for j, la in enumerate(learn): 
                learn_total[j] += la

   
    if check(learn_total):
        return price_total 
    else:
        return INF 

def check(learn_total):
    for i in range(m):
        if learn_total[i] < x:
            return False  
    return True 

### FIXED CODE ###

def check(learn_total):
    for i in range(m):
        if learn_total[i] < x:
            return False  
    return True 

def calc_price(bit):
    price_total = 0 
    learn_total = [0] * m 

    for i in range(n):
        if (bit >> i) & 1:  
            price_total += c[i]  
            learn = a[i]  
            for j, la in enumerate(learn): 
                learn_total[j] += la

   
    if check(learn_total):
        return price_total 
    else:
        return INF

if __name__ == '__main__':
    n, m, x = list(map(int, input().split()))

    # 空のリストを作って、appendで追加していきます
    c = []  # 参考書の値段です
    a = []  # 各参考書に入る理解度です

    for i in range(n):
        c_temp, *a_temp = list(map(int, input().split()))  # こうすると、2つ目以降をリストで受け取れます
        c.append(c_temp)
        a.append(a_temp)

    INF = float("inf")
    ans = INF

    for bit in range(1 << n):
        price = calc_price(bit)  # 条件を満たすならそのときの値段、満たさないならINFが返ってきます
        ans = min(ans, price)  # 答えを更新します

    if ans == INF:
        print(-1)  # どうやっても条件を満たせなかった
    else:
        print(ans)
s = [str(x) for x in input().split(',')]
k = int(input())
print(s[k-1])

### FIXED CODE ###

s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(s[k-1])
def fragOptimalJump(h,n):
    dp=[0]*(n+1)
    dp[2]=abs(h[1]-h[2])
    for i in range(3,n+1):
        min=10000
        p=1
        j=1
        while j<i:
            d=dp[j]+abs(h[i]-h[j])
            if d<min:
                min=d
            p=p*2
            j=p
            
        dp[i]=min
    return dp[n]

N,k=input().split()
N,k=int(N),int(k)
H=[0]*(N+1)
read = [int(n) for n in input().split()]
H=[0]+read
print(H)
print(fragOptimalJump(H,N,k))

### FIXED CODE ###

def fragOptimalJump(h,n):
    dp=[0]*(n+1)
    dp[2]=abs(h[1]-h[2])
    for i in range(3,n+1):
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
    return dp[n]
  
N=int(input())
read = [int(n) for n in input().split()]
H=[0]+read
print(fragOptimalJump(H,N))
from itertools import accumulate

H, W, K = map(int, input().split())
s = [input() for _ in range(H)]

ans = []
acc = 0
l = 0
for i in s:
    cnt = i.count("#")
    if cnt == 0:
        if not ans:
            l += 1
        else:
            ans.append(ans[-1])
    else:
        k = [0] * W
        for j in range(W):
            if i[j] == "#":
                k[j] = 1
        k = list(accumulate(k))
        for j in range(W):
            if k[j] == 0:
                k[j] = 1
            k[j] += acc
        ans.append(k)
    if l >= 1:
        for _ in range(l):
            ans.append(ans[-1])
        l = 0
    acc += cnt
        
for i in ans:
    print(" ".join(map(str, i)))

### FIXED CODE ###

from itertools import accumulate

H, W, K = map(int, input().split())
s = [input() for _ in range(H)]

ans = []
acc = 0
l = 0
for i in s:
    cnt = i.count("#")
    if cnt == 0:
        if not ans:
            l += 1
        else:
            ans.append(ans[-1])
    else:
        k = [0] * W
        for j in range(W):
            if i[j] == "#":
                k[j] = 1
        k = list(accumulate(k))
        for j in range(W):
            if k[j] == 0:
                k[j] = 1
            k[j] += acc
        ans.append(k)
    if ans and l >= 1 :
        for _ in range(l):
            ans.append(ans[-1])
        l = 0
    acc += cnt
        
for i in ans:
    print(" ".join(map(str, i)))
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    a = list(map(int, input().split()))
    #使う本数の種類
    b = set()
    matti = [2,5,5,4,5,6,3,7,6]
    for i in a:
        b.add(matti[i-1])

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

    keta = dp[-1]
    res = []
    a.sort(reverse=True)
    cnt = n
    while cnt>0:
        for i in a:
            if dp[cnt]-dp[cnt-matti[i-1]]==1:
                res.append(str(i))
                cnt -= matti[i-1]
                break
    print(''.join(res))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    a = list(map(int, input().split()))
    #使う本数の種類
    b = set()
    matti = [2,5,5,4,5,6,3,7,6]
    for i in a:
        b.add(matti[i-1])

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

    keta = dp[-1]
    res = []
    a.sort(reverse=True)
    cnt = n
    while cnt>0:
        for i in a:
            if cnt >= matti[i-1]:
                if dp[cnt]-dp[cnt-matti[i-1]]==1:
                    res.append(str(i))
                    cnt -= matti[i-1]
                    break
    print(''.join(res))


if __name__ == '__main__':
    main()
N,K = map(int,input().split())
print(K * ((K-1) ** (N-1)))


### FIXED CODE ###

mylist = input().split()
print(len(set(mylist)))
import collections

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

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        if 2*j-i>N:
            continue
        if (S[i] != S[j]) and (S[i]!=S[2*j-i]) and (S[j]!=S[2*j-i]):
            count+=1
    
print(lenR*lenG*lenB-count)

### FIXED CODE ###

import collections

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

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        k=2*j-i
        if k>=N:
            continue
        else:
            if (S[i] != S[j]) and (S[i]!=S[k]) and (S[j]!=S[k]):
                count+=1
    
print(lenR*lenG*lenB-count)
import copy

#N = int(input())
#A = list(map(int,input().split()))
N = 5
A = [3,3,3,3,3]


nCr = {}
def cmb(n,r):
    if r > n:
        return 0
    if r == 0 or r == n:
        return 1
    if r == 1:
        return n
    if (n,r) not in nCr:
        return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

mem_cnt = [0] * N
set_a = set(A)
for c in list(set_a):
    mem_cnt[c] = A.count(c)

for k in A:
    ret = 0
    for v in mem_cnt:
        x = v
        ret += cmb(x,2)
    print(ret)


### FIXED CODE ###

from collections import Counter

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

cnt = Counter(A)
s = 0
for v in cnt.values():
    s += v*(v-1)//2

for a in A:
    print(s - (cnt[a]-1))
uantity = int(input())
block = list(map(int,input().rstrip().split(" ")))

print(block)

num = 1
for i in block:
    if i == num:
        num += 1

if num == 1:
    print(0)
else:
    print(quantity - num + 1)
    

### FIXED CODE ###

quantity = int(input())
block = list(map(int,input().rstrip().split(" ")))

num = 1
for i in block:
    if i == num:
        num += 1

if num == 1:
    print(-1)
else:
    print(quantity - num + 1)
n=int(input())
ac,wa,tle,re=0,0,0,0
for i in range(n):
  hoge=input()
  if(hoge="AC"):
    ac+=1
  elif(hoge="WA"):
    wa+=1
  elif(hoge="TLE"):
    tle+=1
  elif(hoge="RE"):
    re+=1
    
print("AC x "+ac)
print("WA x "+wa)
print("TLE x "+tle)
print("RE x "+re)

### FIXED CODE ###

n=int(input())
ac,wa,tle,re=0,0,0,0
for i in range(n):
  hoge=input()
  if(hoge=="AC"):
    ac+=1
  elif(hoge=="WA"):
    wa+=1
  elif(hoge=="TLE"):
    tle+=1
  elif(hoge=="RE"):
    re+=1
    
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))
S = input()
if S[3] == S[4] and S[5] == S[6] :
    print( 'Yes' )
else :
    print( 'No' )

### FIXED CODE ###

S = input()
if S[2] == S[3] and S[4] == S[5]:
    print( 'Yes' )
else :
    print( 'No' )
import math
num_max = 10000000
isPrimeNum = [True for i in range(0,num_max+1)]

isPrimeNum[0] == False
isPrimeNum[1] == False

for i in range(2, int(math.sqrt(num_max))+1):
    if isPrimeNum[i] == True:
        for j in range (i**2, num_max, i):
            isPrimeNum[j] = False
        


num_len = int(input())
cnt = 0
for i in range(num_len):
    num = int(input())
    if isPrimeNum[num]==True:
        cnt = cnt + 1

print(str(cnt))

### FIXED CODE ###

def isPrimeNum(in_num):
    if in_num <= 1:
        return False
    elif in_num == 2:
        return True
    elif in_num % 2 == 0:
        return False
    else:
        if pow(2, in_num-1, in_num) == 1:
            return True
        else:
            return False


num_len = int(input())
cnt = 0
for i in range(num_len):
    num = int(input())
    if isPrimeNum(num)==True:
        cnt = cnt + 1

print(str(cnt))
n = int(input())
sum = 0
for k in range(1,n+1):
  y = n // i
  sum += y*(y+1)*i//2
print(sum)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1, n + 1):
    y = n // i
    ans += y * (y + 1) * i // 2
print(ans)
from fractions import gcd
from functools import reduce

mod = 10 ** 9 + 7

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

# print('input >>')
N = int(input())
A = list(map(int,(input().split())))

lcmn = lcm(*A)

ans = 0
for A_ in A:
    ans += (lcmn / A_) % mod

# print('-----output-----')
print(int(ans%mod))

### FIXED CODE ###

from fractions import gcd
from functools import reduce

mod = 10 ** 9 + 7

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

# print('input >>')
N = int(input())
A = list(map(int,(input().split())))

lcmn = lcm(A)

ans = 0
for i in range(len(A)):
    ans += lcmn // A[i]

# print('-----output-----')
print(int(ans%mod))
from collections import Counter
N = int(input())
s = [input() for i in range(N)]
c = collections.Counter(s)
print(len(c))

### FIXED CODE ###

from collections import Counter
N = int(input())
s = [input() for i in range(N)]
c = Counter(s)
print(len(c))
pointTree = []

def sumTree(index, children, prev):
    sumPoint = (point[index] if index in point else 0) + prev
    pointTree.append(sumPoint)
    
    for key in children:
        sumTree(key, tree[key], sumPoint)    

if __name__ == "__main__":
    tree = {}
    point = {}
    N, Q = map(int, input().split(' '))
    for i in [input() for i in range(N-1)]:
        A, B = map(int, i.split(' '))
        if A in tree:
            tree[A].append(B)
        else:
            tree[A] = [B]
        if B not in tree:
            tree[B] = []

    for i in [input() for i in range(Q)]:
        A, B = map(int, i.split(' '))
        if A in point:
            point[A] += B
        else:
            point[A] = B

    sumTree(1, tree[1], 0)
    print(' '.join(map(str, pointTree)))

### FIXED CODE ###

from collections import deque
 
if __name__ == "__main__":
    N, q = map(int, input().split())
    links = [[] for _ in range(N)]
    
    for i in range(N - 1):
        a, b = map(int, input().split())
        links[a - 1].append(b - 1)
        links[b - 1].append(a - 1)
    
    ans = [0] * N
    for i in range(q):
        p, x = map(int, input().split())
        ans[p - 1] += x

    deq = deque([0])
    visited = [False] * N
    while deq:
        parent = deq.popleft()
        link = links[parent]
        for v in link:
            if not visited[v]:
                ans[v] += ans[parent]
                deq.append(v)
        visited[parent] = True
    
    print(*ans)
N = int(input())
s = []
t = []
for _ in range(N):
  tmp = int(input())
  s.append(tmp)
  if tmp % 10 != 0:
    t.append(tmp)

ans = sum(s)

if s % 10 != 0:
  print(ans)
else:
  print(ans - min(t))

### FIXED CODE ###

N = int(input())
s = []
t = []
for _ in range(N):
  tmp = int(input())
  s.append(tmp)
  if tmp % 10 != 0:
    t.append(tmp)

ans = sum(s)

if ans % 10 != 0:
  print(ans)
else:
  if not t:
    print(0)
  else:
  	print(ans - min(t))
n,p=map(int,input().split())
for i in range(2,1000001):
  if p%(i**n)==0:
    x=i
print(x)

### FIXED CODE ###

n,p=map(int,input().split())
t=int(p**(1/n))
x=1
if n<50:
  for i in range(t+1,0,-1):
    if p%(i**n)==0:
      x=i
      break
  print(x)
else:
  print(1)
# import math
# import numpy as np

# S = input()
# N = int(input())
H, N = map(int, input().split())
# A = list(map(int, input().split()))
# B = [int(input()) for _ in range(n)]
# A = []
# B = []
# for _ in range(N):
#     a, b = list(map(int, input().split()))
#     A.append(a)
#     B.append(b)

# 二次元配列
# [[inf, inf, inf], [inf, inf, inf]]
# dp = [[float('inf')] * (H + 1) for i in range(N + 1)]

INF = 10 ** 18
dp = [INF] * (H + 1)
dp[0] = 0

def solve():
    for i in range(N):
        a, b = list(map(int, input().split()))

        for j in range(H):
            nj = min(j + a, H)
            dp[nj] = min(dp[nj], dp[j] + b)
    return dp[H]

print(solve())


### FIXED CODE ###

def solve():
    N, M = map(int, input().split())
    return N // M if N % M == 0 else N //M + 1

print(solve())
w,h,x,y = map(int,input().split())


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1;a = 2/0
print(w*h/2,num)


### FIXED CODE ###

w,h,x,y = map(int,input().split())


num = 0

if w/2 == x and h/2 == y:
  num = 1
print(w*h/2,num)
N,M= map(int, input().split())
a = list(map(int,input().split()))
total = 0
for i in range(len(a)):
  total += a[i]

if a[M]<total/(4*M):
  print("No")
else:
  print("Yes")

### FIXED CODE ###

N,M= map(int, input().split())
a = list(map(int,input().split()))
b = sorted(a,reverse = True)
total = 0
for i in range(len(b)):
  total += b[i]

if b[M-1]<total/(4*M):
  print("No")
else:
  print("Yes")
n,d = list(map(int, input().split()))
c=0
d *= d
for i in range(n):
  x,y = list(map(int, input().split()))
  x *= x
  y *= y
  y += x
  if y <= d:
    c += 1
print(c)

### FIXED CODE ###

k = int(input())
d1 = k % 10
mae = 0
sd = [0]*10
cnt = 0
if not d1 in (1, 3, 7, 9):
  print(-1)
  exit()
for i in range(1,10) :
  sd[d1 * i % 10] = i
#print(sd)

for j in range(999999):
  d2 = 7 - mae % 10
  s = str(sd[d2] * k + mae)
#  print("mae ", mae,"",sd[d2] * k )
#  print("s1=",s)
  for i in range(len(s)-1, -1, -1):
#    print("s[",i,"]=",s[i])
    if (s[i]) == "7":
      cnt += 1
    else:
      s = s[0:i+1]
      mae = int(s)
#      print("s2=",s)
      break
#    print("i= ",i)
    if i == 0 :
      print(cnt)
      exit()
s = input()
if s == 'AAA' or s == 'BBB':
  print('No')
  
  else:
    print('Yes')

### FIXED CODE ###

s=input()
if s=='AAA' or s=='BBB':
    print('No')
else:
    print('Yes')
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
g = []
for i in range(n):
    g.append([])
for i in range(m):
    u, v = na()
    g[u-1].append(v-1)

s, t = na()
s -= 1;
t -= 1

ds = [[9999999999] * n for i in range(3)]
ds[0][s] = 0

q = Queue()
q.put((0, s))
while not q.empty():
    r, cur = q.get_nowait()
    nr = (r+1) % 3
    for e in g[cur]:
        # print(nr, e)
        if ds[nr][e] > ds[r][cur] + 1:
            ds[nr][e] = ds[r][cur] + 1
            q.put((nr, e))
if ds[0][t] >= 0:
    print(ds[0][t]//3)
else:
    print(-1)


### FIXED CODE ###

import sys
from queue import Queue

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
g = []
for i in range(n):
    g.append([])
for i in range(m):
    u, v = na()
    g[u-1].append(v-1)

s, t = na()
s -= 1;
t -= 1

ds = [[9999999999] * n for i in range(3)]
ds[0][s] = 0

q = Queue()
q.put((0, s))
while not q.empty():
    r, cur = q.get_nowait()
    nr = (r+1) % 3
    for e in g[cur]:
        # print(nr, e)
        if ds[nr][e] > ds[r][cur] + 1:
            ds[nr][e] = ds[r][cur] + 1
            q.put((nr, e))
if ds[0][t] < 99999999:
    print(ds[0][t]//3)
else:
    print(-1)
a,b,c,d = map(int, input().split())
if (a+b) > (c,d):
    print('Left')
if (a+b) == (c,d):
    print('Balanced')
if (a+b) < (c,d):
    print('Right')


### FIXED CODE ###

a,b,c,d = map(int, input().split())
if (a+b) > (c+d):
    print('Left')
if (a+b) == (c+d):
    print('Balanced')
if (a+b) < (c+d):
    print('Right')
N = int(input())
A = list(map(int, input().split()))

A.sort()
print(A)
for i in range(N // 2 + 1):
    # print(A[i])
    # print(A[i+1])
    
    if A[i] == A[i+1]:
        print("NO")
        exit()
    elif A[-1-i] == A[-2-i]:
        print("NO")
        exit()

print("YES")


### FIXED CODE ###

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

A.sort()
# print(A)
# print(N//2)
for i in range(N // 2):
    # print(i)
    # print(A[i])
    # print(A[i+1])
    
    if A[i] == A[i+1]:
        print("NO")
        exit()
    elif A[-1-i] == A[-2-i]:
        print("NO")
        exit()

print("YES")
from itertools import accumulate


class CoeffTable:
    def __init__(self, n):
        self.n = n
        if n == 2:
            (self.p2, self.p1, self.m1, self.m2) = (0, 1, 1, 0)
        if n % 2 == 0:
            self.p1 = self.m1 = 1
            self.p2 = self.m2 = (n - 1) // 2
        else:
            self.p1 = 0
            self.m1 = 2
            self.p2 = (n - 1) // 2
            self.m2 = (n - 2) // 2
        if self.p2 + self.p1 + self.m1 + self.m2 != n:
            raise ValueError(f"n = {n}, {str(self)}")

    def reverse(self):
        (self.p2, self.p1, self.m1, self.m2) = (
            self.m2,
            self.m1,
            self.p1,
            self.p2,
        )

    def cumsum(self):
        return list(accumulate([self.p2, self.p1, self.m1, self.m2]))

    def __str__(self):
        return (
            f"(p2, p1, m1, m2) = ({self.p2}, {self.p1}, {self.m1}, {self.m2})"
        )


def main(n, seq):
    seq = sorted(seq, reverse=True)
    coeff = CoeffTable(n)
    cm = coeff.cumsum()
    ans1 = (
        2 * sum(seq[0 : cm[0]])
        + 1 * sum(seq[cm[0] : cm[1]])
        - 1 * sum(seq[cm[1] : cm[2]])
        - 2 * sum(seq[cm[2] : cm[3]])
    )
    coeff.reverse()
    rcm = coeff.cumsum()
    ans2 = (
        2 * sum(seq[0 : rcm[0]])
        + 1 * sum(seq[rcm[0] : rcm[1]])
        - 1 * sum(seq[rcm[1] : rcm[2]])
        - 2 * sum(seq[rcm[2] : rcm[3]])
    )
    ans = max(ans1, ans2)
    print(ans)
    return


if __name__ == "__main__":
    n = int(input())
    sample = []
    for _ in range(n):
        sample.append(int(input()))
    main(n, sample)


### FIXED CODE ###

from itertools import accumulate


class CoeffTable:
    def __init__(self, n):
        self.n = n
        if n == 2:
            (self.p2, self.p1, self.m1, self.m2) = (0, 1, 1, 0)
        if n % 2 == 0:
            self.p1 = self.m1 = 1
            self.p2 = self.m2 = (n - 1) // 2
        else:
            self.p1 = 0
            self.m1 = 2
            self.p2 = (n - 1) // 2
            self.m2 = (n - 2) // 2

    def reverse(self):
        (self.p2, self.p1, self.m1, self.m2) = (
            self.m2,
            self.m1,
            self.p1,
            self.p2,
        )

    def cumsum(self):
        return list(accumulate([self.p2, self.p1, self.m1, self.m2]))



def main(n, seq):
    seq = sorted(seq, reverse=True)
    coeff = CoeffTable(n)
    cm = coeff.cumsum()
    ans1 = (
        2 * sum(seq[0 : cm[0]])
        + 1 * sum(seq[cm[0] : cm[1]])
        - 1 * sum(seq[cm[1] : cm[2]])
        - 2 * sum(seq[cm[2] : cm[3]])
    )
    coeff.reverse()
    rcm = coeff.cumsum()
    ans2 = (
        2 * sum(seq[0 : rcm[0]])
        + 1 * sum(seq[rcm[0] : rcm[1]])
        - 1 * sum(seq[rcm[1] : rcm[2]])
        - 2 * sum(seq[rcm[2] : rcm[3]])
    )
    ans = max(ans1, ans2)
    print(ans)
    return


if __name__ == "__main__":
    n = int(input())
    sample = []
    for _ in range(n):
        sample.append(int(input()))
    main(n, sample)
import bisect

f_inf = float('inf')


def cal(syurui, d, index):
    if d == 'e':
        return syurui[index]
    elif d == 'w':
        return syurui[index - 1]


A, B, Q = map(int, input().split())
s = [int(input()) for i in range(A)]
s.sort()
t = [int(input()) for i in range(B)]
t.sort()
ｓ.insert(0, -f_inf)
t.insert(0, -f_inf)
ｓ.append(f_inf)
t.append(f_inf)

for i in range(Q):
    x = int(input())
    s_index = bisect.bisect_left(s, x)
    t_index = bisect.bisect_left(t, x)
    print(min(max(abs(x-s[s_index]), abs(x-t[t_index])), max(abs(x-s[s_index-1]), abs(x-t[t_index-1])), 2*abs(x-s[s_index-1])+abs(x-t[t_index]), 2*abs(x-s[s_index])+abs(x-t[t_index-1]), abs(x-s[s_index-1])+2*abs(x-t[t_index]), abs(x-s[s_index])+2*abs(x-t[t_index-1])))


### FIXED CODE ###

S = list(map(int, input().split('/')))

if 1 <= S[1] <= 4:
    print('Heisei')
elif S[1] == 4 and S[2] == 30:
    print('Heisei')
else:
    print('TBD')
s = list(input())
z = s.copy()
arr = []
result = []
req = list("AKIHABARA")
if s == []:
    print("NO")
    exit()
while s.count("A") >= 1:
    result.append(s.index("A"))
    s.remove("A")
m = "".join(z)
k = z.index("K")
for d in range(len(result)-1):
    if result[d] - result[d+1] == 0:
        print("NO")
        exit()
    else:
        arr.append("T")
if s == ['K', 'I', 'H', 'B', 'R'] and s.count("A") <= 4 and "KIH" in m:
    if "T" in arr or arr == [] or len(result) == 1:
        print("YES")
else:
    print("NO")

### FIXED CODE ###

import re
print("YES" if re.match(r"^A?KIHA?BA?RA?$", input()) else "NO")
N, M = map(int, input().split())
broken_data = [int(input()) for _ in range(M) ]
ans = 0
 
memo = [-1] * (N+1)
def countWays(n):
    if n < 0 or (n in broken_data):
        return 0
    elif n == 0:
        return 1
    else:
        if memo[n] > -1:
            return memo[n]
        else:
            memo[n] = ( countWays(n-1) + countWays(n-2) ) % 1000000007
            return memo[n]
 
print(countWays(N))

### FIXED CODE ###

data = list(map(int, input().split()))
data.sort()
print(data[0] + data[1])
A,B = int(input()),int(input())
print('Yes' if A&B&1 else 'No')

### FIXED CODE ###

A,B = map(int,input().split())
print('Yes' if A&B&1 else 'No')