peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
ans=int(input().strip('\n'))
if ans!=2:
    flag=True
    while flag:
        for i in range(2,math.ceil(math.sqrt(ans))+1):
            if ans%i==0:
                flag=False
                break
        if flag:
            break
        else:
            flag=True
            ans+=1
print(ans)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

from fractions import gcd
n = ii()
A = iil()
cd = A[0]
for item in A:
    cd = gcd(cd,item)
print(cd)
# Judge status: Accepted
N=int(input())
*D,=map(int,input().split())
D.sort()
print((D[N//2]-D[N//2-1])*(N%2==0))
# Judge status: Wrong Answer
N, T = map(int, input().split())
List = []
List2 = []
min = 1000

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List[n][0]

if min == 1000:
    print('TLE')
else:
    print(min)
# Judge status: Accepted
a, b, c = map(int,input().split())
l = b+c
ans = l - a
if ans <0:
    print(0)
else:
    print(ans)
# Judge status: Accepted
n, m = map(int, input().split())


A = [[1, 1]] + [[0, 1] for _ in range(n-1)]

for _ in range(m):
    x, y = map(lambda x: int(x) - 1, input().split())
    A[x][1] -= 1
    A[y][1] += 1
    if A[x][0]:
        A[y][0] = 1

    if A[x][1] == 0:
        A[x][0] = 0

print(sum(a[0] for a in A))
# Judge status: Accepted
s=set()
for i in range(int(input())):
    s.add(input())
print(len(s))
# Judge status: Accepted
a, s, c = map(str, raw_input() .split())
print a[0]+s[0]+c[0]
# Judge status: Accepted
w = str(input())
List = [w[i] for i in range(len(w))]
lis = sorted(List)
#print(lis)
uni = list(set(lis))
#print(uni)
ans = []
q = 0
for i in range(len(uni)):
    p = lis.count(uni[i])
    ans.append(p)
for j in range(len(ans)):
    q += ans[j]%2
if q == 0:
    print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline

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

ans = 0
height = A[0]
for i in range(1, N):
    h = A[i]
    if h < height:
        ans += height - h

    height = max(height, h)


print(ans)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
P=A[0]
for i in range(2,N):
  P+=min(A[i-1],A[i-2])
print(P)
# Judge status: Accepted
import math
N, M = map(int, input().split())

ans = 0

if N > math.floor(M / 2):
  ans = math.floor(M / 2)
else:
  ans = N + math.floor((M - N * 2) / 4)

print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
S=input()
s=list(S)
s[K-1]=s[K-1].lower()
a=''.join(s)
print(a)
# Judge status: Accepted
import math
source = input().split()
N, D = int(source[0]), int(source[1])
X = []
Y = []
validPoints = 0
for i in range(N):
    point = input().split()
    X.append(int(point[0]))
    Y.append(int(point[1]))

for j in range(len(X)):
    distance = math.sqrt(pow(X[j], 2) + pow(Y[j], 2))
    if distance <= D:
        validPoints += 1
print(validPoints)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
c4 = 0
ce = 0
for i in a:
	if i%4 == 0:
		c4 += 1
	elif i%2 == 0:
		ce += 0.5
if (c4+int(ce)) >= n//2:
	print ("Yes")
else:
	print ("No")
# Judge status: Wrong Answer
import math
n = int(input())
x = []
y = []
z = []

for i in range(n):
    z.append(list(map(int, input().split())))
    x.append(z[i][0])
    y.append(z[i][1])

D = 0
for i in range(n):
    for j in range(n):
        if i < j:
            continue
        D += math.sqrt((x[i]-x[j])**2 + (y[i] - y[j])**2)

print(D*(n-1)/n)
# Judge status: Accepted
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    a=bisect.bisect_left(L,L[i]+L[j])
    ans+=(a-j-1)
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if (500*i)+(100*j)+(50*k) == x:
                ans += 1

print(ans)
# Judge status: Accepted

list_1 = [int(input()) for i in range(5)]
list_2 = []

for k in list_1:
    num_to_10 = 0
    if k % 10 == 0:
        list_2.append(0)
        continue
    while k % 10 != 0:
        k += 1
        num_to_10 += 1
    list_2.append(num_to_10)

last_dish_ind = list_2.index(max(list_2))
last_dish_time = list_1[last_dish_ind]
del list_1[last_dish_ind]
del list_2[last_dish_ind]
time = sum(list_1) + sum(list_2) + last_dish_time
print(time)
# Judge status: Wrong Answer
mod=2019
n=1
A=[1]
for k in range(1, 400):
    n=n*10%mod
    if n in A:
        break
    else:
        A.append(n)
S=input()
count=0
mod2=len(A)
B=[0]
B.append(int(S[-1]))
if len(S)>3:
    for k in range(2,len(S)+1):
        if (B[-1]+int(S[-k])*A[(k-1)%mod2])%mod in B:
            count+=1
        B.append((B[-1]+int(S[-k])*A[(k-1)%mod2])%mod)

    
print(count)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
S = [0]
for i in range(N):
    S.append(A[i] + S[i])
ans = float('inf')
for i in range(1, N):
    ans = min(ans, abs((S[i] - S[0]) - (S[N] - S[i])))
print(ans)
# Judge status: Accepted
s,t = list(map(str, input().split()))
print("".join([t,s]))
# Judge status: Accepted
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if abs(a-b) <= t*(v-w):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
d = input()
if int(d[5] + d[6]) <= 4:
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
S = input()
S = S.replace('2017', '2018')
print(S)
# Judge status: Accepted
names = input().split()
print("".join([a[0] for a in names]))
# Judge status: Accepted
n,d=map(int,input().split())
x = [list(map(int, input().split())) for _ in range(n)] 

ans=0

for i in range(n):
    for j in range(i+1,n):
        wrk=0    
        for k in range(d):
            #print(i,j,k)
            wrk+=(x[i][k]-x[j][k])**2
        #print(wrk**0.5)
        if wrk**0.5%1==0:
            ans+=1
print(ans)
# Judge status: Wrong Answer
n = input()
for ni in n:
    if ni == '7':
        print('YES')
        quit()
print('NO')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
import itertools
ACU=itertools.accumulate(A)
B=list(ACU)
MAX=B[-1]
tmp=10**10
for i in B:
  tmp=min(tmp,abs(2*i-MAX))
print(tmp)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

lst = [a * c, a * d, b * c, b * d]

print(max(lst))
# Judge status: Wrong Answer
def main():
  import sys
  from collections import deque
  n=int(input())
  v=list(map(int,sys.stdin.read().split()))
  w=deque(sorted(v))
  ans=(w.popleft()+w.popleft())/2
  for i in range(n-2):
    ans+=w.popleft()/2
  print(ans)
if __name__=="__main__":
  main()
# Judge status: Accepted
n = int(input());
told,xold,yold = 0,0,0; 
ans = 'Yes';
for i in range(n) :
    tnew,xnew,ynew = [int(x) for x in input().split()];
    dis = abs(xnew-xold) + abs(ynew-yold);
    diff = tnew - told;
    if (diff - dis)%2 == 1 or diff < dis :
        ans = 'No';
        break;
    else :
        told,xold,yold = tnew,xnew,ynew;

print(ans);
# Judge status: Accepted
a,b,c = map(int, input().split())
ans = 0
for i in range(a,b+1):
    if i % c == 0:
        ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()
r = 0
s = 0
ans = 0
for i in range(3):
    if S[i] == 'R':
        r = r + 1
    else:
        if r > ans:
            ans = r
print (ans)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())

NumberOfRotations = int(n/(a+b))
surplus = n%(a+b)

ans = 0

if NumberOfRotations == 0:
    if a > n:
        print(surplus)
        exit
    else:
        print(a)
        exit

ans = a*NumberOfRotations
if a > n - ((a+b)*NumberOfRotations):
    print(ans+surplus)
else:
    print(ans+a)
# Judge status: Accepted
X = int(input())
i = 0
deposit = 100
while deposit < X:
    deposit = int(deposit * 1.01)
    i += 1
    
print(i)
# Judge status: Wrong Answer
s=input()
c=0
d=0
t=len(s)
if t%2==0:
  for i in range(int(t/2)):
    if s[i]!=s[t-i-1]:
      c+=1
  print(c)
else:
  for _ in range(int((t-1)/2)):
    if s[_]!=s[t-2-_]:
      d+=1
    print(d)
# Judge status: Accepted
a,b,c = map(int, input().split())
for x in range(10000):
  if (a*x)%b == c:
    print('YES')
    exit()
print('NO')
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))

total = 0

for num in a:
    total = total ^ num

for num in a:
    print(total ^ num,end=" ")

print('')
# Judge status: Accepted
a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0 else "Impossible")
# Judge status: Accepted
import sys
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]

from collections import Counter
asz = Counter(a)

ans = 0
for i in asz :
    if i < asz[i] :
        ans += asz[i] - i
    elif i > asz[i] :
        ans += asz[i]

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
if len(a) != len(set(a)):
  print("NO")
else:
  print("YES")
# Judge status: Accepted
import math

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

print(math.ceil((n-1)/(k-1)))
# Judge status: Accepted
n = int(input())
if n == 1:
  print('1')
else:
  for i in range(n):
    if 2**i <= n and 2**(i+1) > n:
      print(2**i)
      break
# Judge status: Wrong Answer
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
per=list(itertools.permutations(range(1,n+1)))
a=0
b=0
for num,i in enumerate(per):
    if i==p: a=num
    elif i==q: b=num
print(abs(a-b))
# Judge status: Accepted
N, M = [int(x) for x in input().split(" ")]
print("Yes" if N == M else "No")
# Judge status: Accepted
from collections import Counter

n=int(input())
s=input()

mod=10**9+7

ans=1

c=Counter(s)

for v in c.values():
  ans*=v+1
  ans%=mod

print(ans-1)
# Judge status: Accepted
N=int(input())
X = list(map(int, input().split()))
X.sort()
p = X[0]
min_power = float('inf')
while p <= X[-1]:
  power = 0
  for x in X:
    power += pow((x-p),2)
  min_power = min(min_power, power)
  p += 1
print(min_power)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
a, b = map(int,input().split())
print((a+b)//2+1)
# Judge status: Accepted
S=input()
if S=="Sunny":
    print("Cloudy")
if S=="Cloudy":
    print("Rainy")
if S=="Rainy":
    print("Sunny")
# Judge status: Accepted
a, b = map(int, input().split())
print(int((a+b)/2) if (a+b)%2==0 else int((a+b+1)/2))
# Judge status: Accepted
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
cnt = 0
check = 0
ans = 1

a.sort(reverse=True)
for i in range(n - 1):
    if a[cnt] == a[cnt + 1]:
        check += 1
        ans *= a[cnt]
        cnt += 2
        if check == 2:
            print(ans)
            exit()
    else:
        cnt += 1

    if cnt == n - 1:
        break
print(0)
# Judge status: Wrong Answer
n = int(input())
cnt = [0]*n
for i in range(n):
    a = int(input())
    cnt[i] += a

ans = 0
# 塔子
for i, j in zip(range(n-1), range(1, n)):
    x, y = cnt[i], cnt[j]
    z = min(x, y)
    ans += z
    cnt[i] -= z
    cnt[j] -= z

# 対子
for i in range(n):
    z = cnt[i] // 2
    ans += z
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

a = N * (N-1) // 2
b = M * (M-1) // 2

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

if (x < (a + b) and x >= a):
   print('YES')
else:
   print('NO')
# Judge status: Wrong Answer
s = input()
print('yes' if list(s) == set(s) else 'no')
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    h=int(input())
    cnt=0
    while h>1:
        h=h//2
        cnt+=1
    print(2**(cnt+1)-1)
resolve()
# Judge status: Accepted
n, l = map(int, input().split())
lst = []
for i in range(n):
    si = input()
    lst.append(si)
lst.sort()

ans = ''
for i in range(n):
    ans += lst[i]
print(ans)
# Judge status: Accepted
n, l = map(int, input().split())
ans = (l+(l+n-1))*n//2
if l > 0:
  ans -= l
if l+n-1 < 0:
  ans -= l+n-1
print(ans)
# Judge status: Accepted
n, m, x, y = map(int,input().split())
xList = list(map(int,input().split()))
yList = list(map(int,input().split()))

judge = sorted(xList,reverse=True)[0]+1

if judge <= sorted(yList)[0] and x < judge <= y:
  print("No War")
else:
  print("War")
# Judge status: Accepted
import sys
a, b = map(int, input().split())
s = input()

if s[:a].isdigit() and s[a] == '-' and s[a+1:].isdigit():
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
	N,K = map(int,input().split())
	A = input()
	from math import ceil
	print(1+ceil((N-K)/(K-1)))
main()
# Judge status: Accepted
n, k =map(int, input().split())
a = list(map(int, input().split()))

ans = int((n-1)/(k-1))

if ((n-1) % (k-1)) == 0:
    print(ans)
else:
    print(ans+1)
# Judge status: Accepted
n,k=list(map(int,input().split()))
print(-(-n//k)-(n//k))
# Judge status: Accepted
s=input()
if len(s)<=2:
    print(len(set(list(s))));exit()
dp=[0]*(len(s)+ 1)
dp[0]=0
dp[1]=1
dp[2]=(len(set(list(s[:2]))))

for i in range(3,1+len(s)):
    dp[i]=(dp[i-1]+1) if s[i-1]!=s[i-2]else (dp[i-3]+2)
print(dp[-1])
# Judge status: Wrong Answer
import math

N = int(input())

if N % 2 == 0:
    M = N/2
    print(M)
else:
    M = N/2 + 1
    print(math.floor(M))
# Judge status: Wrong Answer
box={}
n=int(input())
for i in range(n):
    v=input()
    if v in box:
        box[v]+=1
    else:
        box[v]=1
m=max(box.values())
f=[k for k,v in box.items() if v==m]
print('\n'.join(f))
# Judge status: Accepted
from math import gcd
k = int(input())
sum = 0
for a in range(k):
    for b in range(k):
        gcd_ab = gcd(a + 1, b + 1)
        for c in range(k):
            sum += gcd(gcd_ab, c + 1)
print(sum)
# Judge status: Wrong Answer
import math as m
def int_sqrt(n):
  def f(prev):
    while True:
      m = (prev + n / prev) / 2
      if m >= prev:
        return prev
    prev = m 
  return f(int(m.sqrt(n) * (1 + 1e-10)))
 
if __name__ == "__main__":
  a,b,c = map(int,input().split())
  if(int_sqrt(a)+int_sqrt(b) < int_sqrt(c)):
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
a,b,c=map(int,input().split())

def hantei(n1,n2,n3):
  ans="Yes"
  if n1==n2 and n2==n3:
    ans="No"
  if n1!=n2 and n2!=n3 and n3!=n1:
    ans="No"
  return ans

print(hantei(a,b,c))
# Judge status: Wrong Answer
import math
import copy

neko = 0
nuko = 0
inu = 0
n = int(input())
h = [int(x) for x in input().split()]
nya = h[0]
for i in h:
    if nya >= i:
        neko += 1
    else:
        neko = 0
    if neko > inu:
        inu = neko
    if nya <= i:
        nuko += 1
    else:
        nuko = 0
    if nuko > inu:
        inu = neko
    nya = i
print(inu)
# Judge status: Wrong Answer
#!/usr/bin/env python3

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

ans = 0
if (b-a)%2 == 0:
    ans = int((b-a)/2)
else:
    if a-1 >= n-b:
        ans = n-a
    else:
        ans = b-1

print(ans)
# Judge status: Wrong Answer
from math import sqrt
from fractions import gcd 
A, B = map(int,input().split())
Y = gcd(A, B)
ans = 1
if Y != 1:
    for i in range(2, min(Y+1,int(sqrt(Y))+2)):
        tmp = 0
        while True:
            if Y%i == 0:
                Y //= i
                tmp += 1
            else:
                if tmp > 0:
                    ans += 1
                break
    if ans == 1:
        ans += 1
print(ans)
# Judge status: Accepted
s = input()
ans = 0
total = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
        total += 1
    else:
        ans = max(ans, total)
        total = 0
print(max(ans, total))
# Judge status: Wrong Answer
import math
from functools import reduce
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    bit = 0
    for i in range(n):
        if a[i] % 2 != 0:
            bit = 1
            break
    if bit == 0:
        print(min(a))
    else:
        print(1)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
number = list(map(int, input().split()))
number.sort()
ans = 0
while number[2] != number[1]:
    number[1] += 1
    number[0] += 1
    ans += 1
diff = number[2] - number[0]
if diff % 2 == 0:
    ans += diff//2
else:
    ans += max(1, diff//2) + 1
print(ans)
# Judge status: Accepted
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
S =input().strip()
dif =[]
for i in range(len(S)-2):
    x =abs(int(S[i:i+3]) -753)
    dif.append(x)
print(min(dif))
# Judge status: Accepted
N, M = map(int, input().split())
A = input().split()
if sum(int(i) for i in A) > N:
    print(-1)
else:
    print(N - sum(int(i) for i in A))
# Judge status: Accepted
N, Y = [int(i) for i in input().rstrip().split(' ')]

cnt = [int(-1)for i in range(3)]
for A in range(N+1):
    for B in range(N+1 - A):
        C = N - A - B
        calc = A*10000 + B*5000 + C*1000
        if calc == Y:
            cnt = [A, B, C]
            break
    else:
        continue
    break
print(' '.join(map(str,cnt)))
# Judge status: Accepted
N,M=map(int,input().split())
A=[0 for i in range(N)]
flg=0

for i in range(M):
    s,c=map(int,input().split())
    if A[s-1]!=0 and A[s-1]!=c:
        flg=1
    if s==1 and c==0 and N!=1:
        flg=1
    if flg==0:
        A[s-1]=c

if flg==1:
    print(-1)
else:
    if A[0]==0:
        if N!=1:
            A[0]=1
    print(''.join(map(str,A)))
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
mod = 10**9+7
ans = 0
for i in range(60):
    cnt = 0
    for j in range(n):
        if a[j]>>i & 1 == 0: cnt += 1
    ans += pow(2,i,mod)*cnt*(n-cnt)
print(ans%mod)
# Judge status: Accepted
n = int(input())
a, b = [], []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x+y)
    b.append(x-y)

a.sort()
b.sort()

ans = max(a[-1]-a[0], b[-1]-b[0])
print(ans)
# Judge status: Wrong Answer
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A-1:C] or "##" in S[B-1:D]:
        return print("No")
    if D < C and "..." not in S[B-1:D]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
odd = []
even = []
ans = []

for i in range(n):
    if i % 2 == 0:
        odd.append(a[i])
    else:
        even.append(a[i])

if n == 1:
    print(a[0])
    exit()
else:
    if n % 2 == 0:
        even.reverse()
        ans = even + odd
    else:
        odd.reverse()
        ans = odd + even

print(ans)
# Judge status: Wrong Answer
import itertools
import bisect
n = int(input())
a=sorted(list(map(int, input().split())))
b=sorted(list(map(int, input().split())))
c=sorted(list(map(int, input().split())))
cnt=0

for i in range(0,len(c)):
    b_index=bisect.bisect_left(b,c[-i-1])
    print(b_index)
    for u in range(b_index):
        cnt+=bisect.bisect_left(a,b[b_index-1-u])
    
print(cnt)
# Judge status: Wrong Answer
ds = list(map(int, input().split()))
k = int(input())
sorted(ds)
print(sum(ds[:-1]) + ds[-1]*(2**k))
# Judge status: Wrong Answer
def main():
    n = int(input())
    f = [0 for i in range(n+1)]
    Max = n**0.5
    Max = int(Max//1) 
    for x in range(1,Max):
        for y in range(1,Max):
            for z in range(1,Max):
                tmp = x**2+y**2+z**2+x*y+y*z+x*z
                if tmp<n:
                    f[tmp] += 1
    for i in range(1,n+1):
        print(f[i])

main()
# Judge status: Accepted
#!/usr/bin/env python3
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

x = min(N, K)
y = max(0, N - K)
ans = X * x + Y * y
print(ans)
# Judge status: Accepted
n = int(input())
li = [0]*n
for i in range(n):
    d1,d2 = map(int,input().split())
    if d1==d2:
        li[i] = 1
lii = [0]*n
lii[0]=li[0]
for i in range(n-1):
    if li[i+1]==1:
        lii[i+1]=lii[i]+li[i+1]
    else:
        lii[i+1]=0

if max(lii)>=3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = str(input())
if s[-1] =='s':
    print(s+'es')
else:
    print(s+'s')
# Judge status: Wrong Answer
n,x,y = [int(i) for i in input().split()]
ans = []
for i in range(1,n):
  for j in range(i+1,n+1):
    chk = j-i
    if i<=x<y<=j:
      chk = min(chk,1+x-i+j-y)
    elif i<=x<j<y:
      chk = min(chk,x-i+1+y-j)
    elif x<i<y<=j:
      chk = min(chk,i-x+j-y+1)
    ans.append(chk)
    
import collections
c = collections.Counter(ans)
for i in range(1,n):
  print(c[i])
# Judge status: Accepted
def solve():
  ans = 0
  N, x = map(int, input().split())
  A = list(map(int, input().split()))
  if A[0]>x:
    ans += A[0]-x
    A[0] = x
  for i in range(1,N):
    if A[i]+A[i-1]>x:
      ans += A[i]+A[i-1]-x
      A[i] = x-A[i-1]
  return ans
print(solve())
# Judge status: Accepted
#!/usr/bin/env python3

s = str(input())
t = str(input())

if s == t[:-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
Xlist = list(map(int, input().split()))
Xlist.sort()

a = sum(Xlist)/N

a_m = int(a)
a_p = a_m + 1

if a - a_m < a_p - a:
    p = a_m
else:
    p = a_p

ans = 0
for i in range(N):
    ans += (Xlist[i] - p)**2

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

d=0

for i in range(c):
  d+=i
  
print(d-a)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cum = [0]
for i in range(n):
    cum.append(cum[i] + a[i])
#print(cum)

ans = int(1e10)
for i in range(1,n):
    dif = abs(cum[i] - (cum[n]- cum[i]))
    if ans > dif:
        ans = dif
print(ans)
# Judge status: Accepted
x = int(input())

divided_11 = x // 11
check_num = divided_11 * 11
ans = divided_11 * 2

if x % 11 == 0:
    print(ans)
else:
    while True:
        check_num += 6
        ans += 1
        if check_num >= x:
            print(ans)
            break
        check_num += 5
        ans += 1
        if check_num >= x:
            print(ans)
            break
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print(min(A*C, B))
# Judge status: Accepted
N,Y = map(int,input().split())
flg = 0
x = -1
y = -1
z = -1
for i in range(Y//10000+1):
    for j in range(min(N-i,Y//5000)+1):
        k = N-i-j
        if k>=0 and 10000*i+5000*j+k*1000==Y:
            flg = 1
            x = i
            y = j
            z = k
            break
    if flg==1:break
print(x,y,z)
# Judge status: Accepted
L = list(map(int,input().split()))
L.sort()
print(L[2] * 10 + L[1] + L[0])
# Judge status: Accepted
alp=[chr(i) for i in range(97, 97+26)]
inf=10000000
check=[inf]*26

n=int(input())
for i in range(n):
    s=input()
    ls=len(s)
    check_sub=[0]*26
    for j in range(ls):
        #print(s[j])
        check_sub[alp.index(s[j])]+=1
    for k in range(26):
        check[k]=min(check[k],check_sub[k])
    #print(check_sub)
ans=""
for i in range(26):
    #print(check[i])
    ans+=check[i]*alp[i]
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
lis = [0]*(10**5+2)

for i in a:
    lis[i-1]+= 1
    lis[i] +=1
    lis[i+1] +=1
print(max(set(lis)))
# Judge status: Accepted
N, D = map(int,input().split())

reach = D*2+1
import math
minimum = math.ceil(N/reach)
print(minimum)
# Judge status: Accepted
#ABC046
s = input().split()
print(len(set(s)))
# Judge status: Wrong Answer
c = str(input())
l = ["a", "e", "i", "o", "u"]
if c in l:
    print("vowel")

else:
    print("constant")
# Judge status: Accepted
INPUT = input().split()
D = int(INPUT[0])
T = int(INPUT[1])
S = int(INPUT[2])

if D/S <= T:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b = map(int, input().split())


def f(x):
    if x < 0:
        return -1
    elif x > 0:
        return 1
    else:
        return 0


if f(a) == 0 or f(b) == 0:
    ans = "Zero"
elif f(a) == -1 and f(b) == -1:
    diff = b - a
    if (diff + 1) % 2 == 0:
        ans = "Positive"
    else:
        ans = "Negative"
elif f(a) == 1 and f(b) == 1:
    ans = "Positive"
else:
    ans = "Zero"

print(ans)