peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
ans = float("inf")

for i in range(min(A),max(A)+1):
    cost = 0
    
    for j in A:
        cost += (j-i)**2
        
    ans = min(ans,cost)
    
print(ans)
# Judge status: Wrong Answer
x = int(input())

def is_prime(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True

for i in range(x, 10 ** 5):
    if is_prime(i):
        print(i)
        exit()
# Judge status: Accepted
from fractions import gcd
A,B = map(int,input().split())
g = gcd(A,B)

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

fs = factorize(g)

print(len(fs) + 1)
# Judge status: Accepted
a,b,x=map(int,input().split())

ap=a//x
bp=b//x

ans=bp-ap
if a%x==0:
  ans+=1

print(ans)
# Judge status: Accepted
n, k, s = map(int, input().split())

#%%
billion = 1000000000

if s == billion:
    front = [s] * k
    back = [1] * (n - k)
else:
    front = [s] * k
    back = [s+1] * (n - k)

front.extend(back)
print(*front)
# Judge status: Wrong Answer
a, b, c, d = map(lambda x: int(x), input().split())
 
if abs(a - c) <= d:
  print('Yes1')
elif abs(a - b) <= d and abs(b - c) <= d:
  print('Yes2')
else:
  print('No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
    ans[a[i]-1]+=(i+1)
    ans[a[i]-1]=str(ans[a[i]-1])
print(" ".join(ans))
# Judge status: Accepted
#pypyで通らないと思ったけど普通に通るやん
'''
Created on 2020/09/19

@author: harurun
'''

def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=0
  for i in range(1,N):
    for j in range(1,N+1):
      if N-i*j>0:ans+=1
      else:break
  print(ans)
  return
main()
# Judge status: Accepted
from itertools import accumulate
N = int(input())
a = tuple(map(int,input().split()))
s = list(accumulate(a))
b = [0]*(N+1)
if N == 0 and a[0] > 1:
    print(-1)
    exit()
if a[0] == 0:
    b[0] = 1
ans = 1
flag = 0
for d in range(1,N+1):
    b[d] = b[d-1]-a[d]
    tmp = min(s[-1]-s[d],2*b[d-1]-a[d])
    if b[d] > tmp or tmp < 0:
        flag = 1
        break
    else:
        b[d] = tmp
if flag:
    print(-1)
else:
    print(s[-1]+sum(b))
# Judge status: Wrong Answer
H, A = map(int, input().split())
ans = H // A + 1
print(ans)
# Judge status: Wrong Answer
a,b,c,k = map(int,input().split())
if a >= k:
	print(k)
elif a+b >=k:
	print(k)
else:
    print(a*1+b*0 +(k-a-b)*(-1))
# Judge status: Accepted
var = (input())
end = var[-1]
end = int(end)

hon_list = [2, 4, 5, 7, 9]
pon_list = [0, 1, 6, 8]
bon_list = [3]

HON = "hon"
PON = "pon"
BON = "bon"

if end in hon_list:
    print(HON)
elif end in pon_list:
    print(PON)
elif end in bon_list:
    print(BON)
# Judge status: Wrong Answer
line = input()
a, b = [int(n) for n in line.split()]

soma0= a + b

soma1 = a 
a = a-1
soma1 = soma1 + a 
a = a-1 

soma2 = b
b = a-1
soma2 = soma2 + b
b = b-1

if soma0>=soma1 and soma0>=soma2:
    print(soma0)

elif soma1>=soma0 and soma1>=soma2:
    print(soma1)

else:
    print(soma2)
# Judge status: Wrong Answer
N,M=[int(i) for i in input().split()]
PY=[[] for _ in range(N)]
py=[]

for i in range(M):
    p,y=[int(i) for i in input().split()]
    p-=1
    py.append((p,y))
    PY[p].append(y)

for i in range(N):
    PY[i].sort()

for i in range(M):
    p,y=py.pop(0)
    #print(PY[p].index(y))
    p_zero=6-len(str(p))
    y_zero=6-len(str(PY[p].index(y)))
    print("0"*p_zero + str(p+1) + "0"*y_zero + str(PY[p].index(y)+1))
# Judge status: Accepted
a = input()

if a.isupper():
    print("A")

else:
    print("a")
# Judge status: Accepted
import itertools
import sys
input = sys.stdin.readline

S = input().rstrip('\n')
N = len(S)

print(2*min(S.count('0'), S.count('1')))

# for i in itertools.count():
#     # print(S)
#     S = S.replace('01', '').replace('10', '')
#     if not S:
#         break
#     if S.count('0') == 0 or S.count('1') == 0:
#         break

# print(N-len(S))
# Judge status: Wrong Answer
s = int(input())

arr = [int(i) for i in input().split(maxsplit=(s - 1))]

a = []
n = -1

for i in arr:
    if i % 2 == 0:
        a.append(i)


for i in a:
    n = 0
    if i % 3 != 0 and i % 5 != 0:
        n = 1
        print('DENIED')
        break

if n != 0:
    exit()

if n == 0:
    print('APPROVED')
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    seq = sum(int(j) for j in str(i))
    if a <= seq <= b:
        ans += i
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = [int(input()) for i in range(N)]
max = sum(S)
i = 0
while True:
	if max % 10 != 0:
		print(max)
		exit()
	else:
		S.sort()
		max -= S[i]
		i += 1
		if max <= 0:
			print(0)
			exit()
# Judge status: Wrong Answer
N = input()
P = input().split(' ')
count = 0
PM = min(P)
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = Pi

    elif Pmin< P[i]:
        pass
    else:
        count = count +1
        Pmin = Pi
print(count)
# Judge status: Accepted
s=input()
Acnt = 0
Zcnt = len(s)-1
while 1:
    if s[Acnt] == 'A':
        Acnt += 1
        break
    else:
        Acnt += 1
while 1:
    if s[Zcnt] == 'Z':
        Zcnt += 1
        break
    else:
        Zcnt -= 1
print(Zcnt-Acnt+1)
# Judge status: Accepted
N = int(input())
ans = 0
if N > 10:
    ans = N - (int(N / 10) * 10)
else:
    ans = N

if ans == 3:
    print('bon')
elif ans == 0 or ans == 1 or ans == 6 or ans == 8:
    print('pon')
else:
    print('hon')
# Judge status: Accepted
a,b,c,k = map(int,input().split())

ans = 0
ans += min(a, k)
k -= a
k -= b
ans -= max( k, 0)

print(ans)
# Judge status: Accepted
n = int(input())
la = [int(w) for w in input().split()]

ans = sum([abs(w)for w in la])
if len([w for w in la if w < 0]) % 2 == 0:
    print(ans)
    exit()

sla = sorted([abs(w)for w in la])
ans -= sla[0]*2
print(ans)
# Judge status: Accepted
from collections import Counter as C

_ = input()
a = C([int(x) for x in input().split()])

ans = 0
for k in a:
    ans = max(ans, a[k-1] + a[k] + a[k+1])
else:
    print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))
dic = {}
B = []
for a in A:
  if a in dic:
    dic[a] += 1
  else:
    dic[a] = 1
for v in dic.values():
  B.append(v)
B.sort()
if len(B) <= K:
  print(0)
else:
  print(sum(B[K:]))
# Judge status: Wrong Answer
import math 
X=int(input())
max_num=0
for i in range(1,10):
  tei=math.floor(X**(1/i))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

cnt=0

for i in range(n):
  if a[n-i]>=b[n-1-i]:
    cnt+=b[n-1-i]
  else:    
    if a[n-1-i]-(b[n-1-i]-a[n-i])>=0:
      a[n-1-i]-=b[n-1-i]-a[n-i]
      cnt+=b[n-1-i]
    else:
      cnt+=a[n-i]+a[n-1-i]
      a[n-i]=0
      
print(cnt)
# Judge status: Accepted
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

A = [[0] + [sum(A[i][:j+1]) for j in range(N)] for i in range(2)]
print(max([A[0][j] + A[1][-1] - A[1][j-1] for j in range(1, N + 1)]))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))

if 0 in A:
    S=0
    for a in A:
        S+=abs(a)
    print(S)
else:
    X=0
    S=0
    for a in A:
        X+=(a<0)
        S+=abs(a)

    if X%2==0:
        print(S)
    else:
        b=min(A,key=lambda x:abs(x))
        print(S-2*b)
# Judge status: Wrong Answer
N, K = map(int, input().split())
Alist = list(map(int, input().split()))
if K >= N:
    print(1)
else:
    from math import ceil
    one = Alist.index(1)
    left = N
    right = N - one - 1
    print(ceil(left % K) + ceil(right % K))
# Judge status: Wrong Answer
s = str(input())

if s[1]== "R" and s[2]=="R" and s[0]== "R":
  print(3)
elif s[1] == "S" and s[2] == "S" and s[0] == "S":
  print(0)
elif s[1] == "S" and s[0]=="R":
  print(1)
elif s[1] =="S" and s[2]=="R":
  print(1)
elif s[1] == "S" and s[0]=="R":
  print(1)
elif s[1] =="R":
  if s[0] =="R" or s[2]=="R":
    print(2)
# Judge status: Accepted
a,b,x=map(int, input().split())
print(b//x-(a-1)//x)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
D=0
for i in range(N-1):
  a=A[i]
  b=A[i+1]
  if a>=0:
    D+=a
  else:
    A[i]=a*(-1)
    A[i+1]=b*(-1)
    D+=a*(-1)
D+=A[N-1]
x=A[N-2]+A[N-1]
E=D-2*x
print(max(D,E))
# Judge status: Accepted
n = int(input())
order = list(map(int, input().split()))
satisfaction = list(map(int, input().split()))
addition = list(map(int, input().split()))

index = order[0]
ans = 0

for i in order:
    ans += satisfaction[i-1]
    if i-1 == index:
        ans += addition[i-2]
    index = i

print(ans)
# Judge status: Accepted
s=input()
dp0=[0]*(len(s)+1)
dp1=[0]*(len(s)+1)
dp1[0]=1
for i in range(1,len(s)+1):
  n=int(s[i-1:i])
  dp0[i]=min(dp0[i-1]+n,dp1[i-1]+10-n)
  dp1[i]=min(dp0[i-1]+(1 if n+1==10 else n+1),dp1[i-1]+10-n-1)
print(dp0[-1])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
T = 0
S = sum(A)

ans = 10**18
for a in A[:-1]:
    T += a
    S -= a
    ans = min(ans, abs(T - S))

print(ans)
# Judge status: Accepted
X = int(input())
if X == 3 or X == 5 or X == 7:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
import math

def main():
    n = int(input())
    m = math.sqrt(n)
    ans = []
    for i in range(1, int(m) + 1):
        div = n / i
        if not float.is_integer(div):
            continue
        ans.append((div+i)-2)

    print(min(ans))


if __name__ == '__main__':
    main()
# Judge status: Accepted
from math import comb
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))

n0 = 0
n1 = 0

for i in range(n):
    if a[i] % 2 == 0:
        n0 += 1
    else:
        n1 += 1

x = 0
if p == 0:
    for i in range(0, n1+1, 2):
        x += comb(n1, i)
else:
    for i in range(1, n1+1, 2):
        x += comb(n1, i)

print(2**n0 * x)
# Judge status: Wrong Answer
a, b, c = list(map(int, input().split()))
if a % 2 == 1 and b % 2 == 1 and c % 2 == 1:
    if a != 1:
        print(b * c)
    elif b != 1:
        print(a * c)
    else:
        print(a * b)
else:
    print(0)
# Judge status: Accepted
t=str(input())
print(t.replace("?","D"))
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = c + b - a
if ans >= 0:
    print(ans)
else:
    print(0)
# Judge status: Wrong Answer
def main():
    import fractions
    import math
    A, B = map(int, input().split())

    gcd = fractions.gcd(A, B)

    tmp = gcd
    primes = set()
    for i in range(2, math.ceil(gcd**(1/2)) + 1):
        if tmp % i == 0:
            while(tmp % i == 0):
                tmp = tmp//i
            primes.add(i)
    if len(primes) == 0 and gcd != 1:
        primes.add(gcd)
    print(len(primes) + 1)

main()
# Judge status: Wrong Answer
import math
n, m = map(int, input().split())
mod = 10 ** 9 + 7

if abs(n - m) < 2:
  res = 2 * math.factorial(n) * math.factorial(m)
  print(res % mod)
else:
  print(0)
# Judge status: Wrong Answer
import math
 
N = int(input())
Pi = list(map(int,input().split()))
Qi = list(map(int,input().split()))
 
a = 0
b = 0
 
numcheck = [1 for i in range(N)]
numcheck[Pi[0]-1] = 0
a = math.factorial(N-1)*(Pi[0]-1) 
for n in range(1,N):
  num = Pi[n]
  numcheck[num-1] = 0
# Judge status: Wrong Answer
N, L = [int(i) for i in input().split(' ')]

words = [input() for i in range(N)]

words.sort(key=lambda x: x[0])

for word in words:
    print(word, end = ' ')
# Judge status: Accepted
import decimal

slist =  input().split()
a = int(slist[0])
b = decimal.Decimal(slist[1])
print(int(a*b))
# Judge status: Accepted
n = input()

if n.count("9") > 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = input()
s1 = s.split("/")

ans = "Heisei"
if int(s1[0]) >= 2019:
    if int(s1[1]) >= 5:
        ans = "TBD"

print(ans)
# Judge status: Accepted
n = int(input())
s = input()
if s == s[:n//2] + s[:n//2]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
for i in range(k):
    ans+=(p[i]+1)/2

tmp=ans
for i in range(k,n):

    tmp-=(p[i-k]+1)/2
    tmp+=(p[i]+1)/2
    ans=max(ans,tmp)
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())

result = 0
result += N // (A + B) * A
result += min(N % (A + B), A)
print(result)
# Judge status: Wrong Answer
s=input()
k=int(input())
m=len(s)

word={j:26-i for i,j in enumerate([chr(_) for _ in range(97,97+26)])}
number={i:j for i,j in enumerate(chr(_) for _ in range(97,97+26))}
ans=""

for i,j in enumerate(s):
    if word[j]<=k:
        k -=word[j]
        ans +="a"
    elif i==m-1 and k>0:
        k %=26
        if k>word[j]:ans +=number[k-word[j]]
        else:ans +=number[26-word[j]+k]
    else:ans +=j

print(ans)
# Judge status: Wrong Answer
def main():
    X = input()
    len_X = len(X)
    right_T = X.rfind("T")
    S_Count = X[:right_T].count("S")
    ans = len_X - S_Count*2
    print(ans)
if __name__ == "__main__":
    main()
# Judge status: Accepted
n = input()
n = int(n)
if n % 2 != 0:
  print(int(n/2)+1)
else:
  print(int(n/2))
# Judge status: Accepted
a,b,c = map(int, input().split())

print(str(c)+" "+str(a)+" "+str(b))
# Judge status: Accepted
n=int(input())

print(n*(n-1)//2)
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())

for i in range(A, B + 1):
    if i % K == 0:
        print("OK")
        break
else:
    print("NG")
# Judge status: Accepted
mod = 10 ** 9 + 7

def calc(n,r):
    x = 1
    y = 1
    for i in range(r):
        x *= n - i
        x %= mod
        y *= i + 1
        y %= mod
    return x * pow(y, mod - 2, mod) % mod

n, a, b = map(int, input().split())
res = pow(2, n, mod) - 1
 
for i in [a, b]:
    res -= calc(n, i)
print(res % mod)
# Judge status: Wrong Answer
# 最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


N, M = map(int, input().split())
A = list(map(int, input().split()))
x = A[0] // 2
for a in A[1:]:
    x = lcm(x, a // 2)
ans = M // x
print(ans - ans // 2)
# Judge status: Accepted
from bisect import bisect,bisect_left
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
tmp=0
for i in b:
    dd=bisect_left(a,i)*(n-bisect(c,i))
    tmp+=dd
print(tmp)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B, C = mapint()
print(A*B//2)
# Judge status: Accepted
n=int(input())
money=1000
while True:
    if money>=n:
        print(money-n)
        break
    money+=1000
# Judge status: Accepted
n, d = map(int, input().split())

ans = n//(2*d+1)
print(ans if n%(2*d+1) == 0 else ans+1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
s = set(a)
if len(a) == len(s):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
N, K = map(int, input().split())
ls1 = list(map(int, input().split()))
d = dict()
ls2 = ['r', 's', 'p']
for x, y in zip(ls1, ls2):
    d[y] = x
T = input()

S = T.translate(str.maketrans({'r': 'p', 's': 'r', 'p': 's'}))
ans = 0
for i in range(K):
    cur = ''
    for j in range(i, N, K):
        if cur != S[j]:
            ans += d[S[j]]
            cur = S[j]
        else:
            cur = ''
print(ans)
# Judge status: Accepted
S=input()
al=[chr(ord('a') + i) for i in range(26)]
ss=set(al)

for str in S:
  if str in ss:
    ss.remove(str)

if len(ss)>0:
  print(sorted(ss)[0])
else:
  print("None")
# Judge status: Wrong Answer
s = input()
t = input()

maiores = []
maior = 0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            maior += 1
            if j == len(t)-1:
                maiores.append(maior)
        else:
            maiores.append(maior)
            maior = 0

print(len(t) - max(maiores))
# Judge status: Wrong Answer
n = int(input())
p = [int(i) for i in input().split()]
liI = [int(j) for j in range(1,n+1)]
count = 0
for i in range(1,n):
    if p[i-1] == liI[i]:
        cha = p[i-1]
        p[i-1] = p[i]
        p[i] = cha
        count+=1
print(count)
# Judge status: Accepted
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table




def main():
    n = int(input())
    tmp = num_divisors_table(n + 2)
    ans = 0
    for i in range(1, n + 1):
        ans += tmp[i]*i
    print(ans)
    return


if __name__ == "__main__":
    main()
# Judge status: Accepted
import math
s = int(input())

x1 = 10**9
y2 = math.ceil(s/10**9)
x2 = 1
y1 = x1*y2 - s

print(0,0,x1,y1,x2,y2)
# Judge status: Wrong Answer
s=['a','i','o','u','e']
x=input()
falg=0
for i in s:
    if (i==x):
        falg=1
        break
if falg==0:
    print('consonant.g')
else:
    print("vowel.")
# Judge status: Accepted
n,m=map(int,input().split());print(next(v for v in range(m//n,-1,-1)if m%v==0))
# Judge status: Accepted
k, x = map(int, input().split())
if 500*k >= x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))

if 2 in a:
    two_cnt=1
else:
    two_cnt=0

other_cnt=len([i for i in a if i % 2 != 0])
four_cnt=len([i for i in a if i % 4 == 0])

if two_cnt==0:
    if other_cnt<=four_cnt+1:
        print('Yes')
    else:
        print('No')
else:
    if other_cnt<=four_cnt:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
x = int(input())
mx = 0
for b in range(1, int(1000 ** 0.5) + 1):
    for p in range(2, 10):
        if mx < b ** p <= x:
            mx = b ** p
print(mx)
# Judge status: Wrong Answer
import math
N,M=map(int,input().split())

P=math.ceil(M**0.5)
ans=1
i=1

while i<=P:
  if M%i==0:
    j = M//i
    if j>=N:
      ans=j
  i +=1
      
print(ans)
# Judge status: Wrong Answer
s = list(input())
b = s[0]
count = 1
for i in s[1:]:
    if i != b:
        count += 1
        b = i
    else:
        b += i

if len(b) == 2:
    print(count+1)
else:
    print(count)
# Judge status: Wrong Answer
N = int(input())

if N % 2 == 1:
    print(0)
else:
    n = 0
    i = 1
    while True:
        n += N // 10**i
        if N < 10**i:
            break
        i += 1
    print(n)
# Judge status: Wrong Answer
import math
A,B,H,M = map(int,input().split())

rad = H*30 - M * 6 if (H/12) > (M/60) else  M * 6 -H*30
print(((B**2) +( A **2 )- (2 * B * A )* (math.cos(math.radians(rad))))**0.5)
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a.sort()
print(a)
cnt=0
if a[0]==a[1]==a[2]:
  print(0)
  exit()
if a[0]==[1]:
  print(a[2]-a[1])
  exit()
if a[1]==a[2]:
  if (a[2]-a[0])%2==0:
    print((a[2]-a[0])//2)
    exit()
  else:
    print(a[2]-a[0]+1)
    exit()
cnt+=a[2]-a[1]
a[0]+=cnt
if (a[2]-a[0])%2==0:
  cnt+=(a[2]-a[0])//2
else:
  cnt+=(a[2]-a[0])//2+1
print(cnt)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
if (a - b) % 2 == 0:
    print(abs(a - b) // 2)
else:
    if a < b:
        print(abs(b - (a - 1) - 1) // 2 + 2)
    else:
        print(abs(a - (b - 1) - 1) // 2 + 2)
# Judge status: Accepted
a,b,c = map(int,input().split())
if b//a >= c:
  print(int(c))
else:
  print(int(b//a))
# Judge status: Accepted
w = {'SUN': 7,'MON': 6,'TUE': 5,'WED': 4,'THU': 3,'FRI': 2,'SAT':1}
s = input()
print(w[s])
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
B=sorted(A)
cnt=0
for i in range(n):
  if A[i]!=B[i]:
    cnt+=1
print('YES' if cnt<=2 else 'NO')
# Judge status: Wrong Answer
a,b=map(int,input().split())
z = b // a
if z==0:
    print('1')
else:
    b -= a
    a -= 1
    y = b % a
    if y==0:
        print(1 + b//a)
    else:
        print(2 + b//a)
# Judge status: Wrong Answer
N,K = map(int,input().split())
c = 0
listA = []
for k in range(1,K+1):
    d = int(input())
    listA += list(map(int,input().split()))
    
for n in range(1,N+1):
    if n in listA:
        c += 1
print(c)
# Judge status: Wrong Answer
N,C = map(int,input().split(' '))

print((100 ** N) * C)
# Judge status: Accepted
s = input()
l = ('a', 'e', 'i', 'o', 'u')

if s in l:
  print('vowel')
else:
  print('consonant')
# Judge status: Accepted
#入力
n=int(input())
a=list(map(int,input().split()))
#dpテーブル dp[i-1]はi番目の箱に入っているボールの数
dp=[0 for i in range(n)]
#初期条件
dp[n-1]=a[n-1]

for i in range(n,0,-1):
  num=0
  for j in range(i*2,n+1,i):
    num=num+dp[j-1]
  if num%2==a[i-1]:
    dp[i-1]=0
  else:
    dp[i-1]=1

print(dp.count(1))
for i in range(n):
  if dp[i]==1:
    print(i+1,end=" ")
# Judge status: Accepted
N=int(input())
*A1,=map(int,input().split())
*A2,=map(int,input().split())

ans=[0]*N
i=0
while i<N:
    ans[i]+=sum(A1[:i+1])
    ans[i]+=sum(A2[i:])
    i+=1

print(max(ans))
# Judge status: Accepted
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
num=float("inf")
ans=0
for i in range(N):
    H[i]=T-0.006*H[i]
    if abs(A-H[i])<num:
        ans=i+1
        num=abs(A-H[i])
print(ans)
# Judge status: Accepted
import sys

K = int(input())

seven = 0
for i in range(K+2):
    seven += (7 * pow(10, i, K)) % K
    seven %= K    
    if seven == 0:
        print(i+1)
        sys.exit()

print(-1)
# Judge status: Accepted
# 符号の数について、-が偶数だった場合、全てを打ち消せる
# 奇数だった場合、どれか一つが残る。
# `..,+,-,+,..`を→移動←移動できるので

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    ret = sum(abs(a) for a in A)
    num_neg = sum(a < 0 for a in A)
    min_abs_A = min(abs(a) for a in A)
    if num_neg % 2 == 1:
        ret -= 2*min_abs_A
        
    print(ret)
    
solve()
# Judge status: Accepted
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

b=math.ceil((n-1)/(k-1))
print(b)
# Judge status: Accepted
s=input()

if s=="ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Wrong Answer
import bisect

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort
b.sort
c.sort
ans = 0

for i in range(len(c)):
    b_M = bisect.bisect_left(b, c[i])
    for j in range(b_M):
        a_M = bisect.bisect_left(a, b[j])
        ans += a_M
print(ans)
# Judge status: Accepted
import math
x = int(input())
money = 100
count = 0
while (money <x):
    money = math.floor(money*1.01)
    count +=1

print(count)
# Judge status: Wrong Answer
K=int(input())
if K%2==0:
	print(-1)
else:
	seven=0
	m=0
	count=1
	for i in range(K+1):
		m=(m*10+7)%K
		if m==0:
			print(count)
			break
		count+=1
# Judge status: Accepted
S=input()

if S=='ARC':
    print('ABC')
elif S == 'ABC':
    print('ARC')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())

for _ in range(k):
  if a >= b:
    b = b ** 2
  elif b >= c:
    c = c ** 2
    
if a < b < c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
x = int(input())
job = []
time = []
for i in range(x):
    j, t = list(map(int, input().split()))
    job.append(j)
    time.append(t)
jt = 0
tt = 0
f = 0
for i in range(x):
    if job[i] >= time[i]:
        pass
    else:
        print("No")
        f = 1
        break
    jt += job[i]
    if tt < time[i]:
        tt = time[i]
    if jt > tt:
        f = 1
        print("No")
        break
if f == 0:
    print("Yes")
# Judge status: Wrong Answer
a = list(map(int,input().split()))
hanbun = int(sum(a)/2)
isOK = False
if hanbun!=0:
    for i in range(3):
        if hanbun==a[i]:
            isOK = True
if isOK:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
cnt = 0
n = int(input())
for i in range(n):
    n,m = map(int,input().split())
    if n == m:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
n=int(input())
p=list(map(int, input().split()))
t=0
for i in range(n):
    if i!=0 and i!=n-1:
      l=[p[i-1], p[i], p[i+1]]
      l.sort()
      if l[1]==p[i]:
          t+=1
print(t)