peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

for i in range(K,N):
    if A[i-K] < A[i]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
S = list(input())
ans = 100000
for i in range(len(S)-2):
    ans = min(ans,abs(753-int(''.join(S[i:i+3]))))
for i in range(len(S)-3):
    ans = min(ans,abs(753-int(''.join(S[i:i+4]))))
print(ans)
# Judge status: Accepted
def training(N) :
  power = 1
  for i in range(1, N + 1) : 
    power = (power * i) % (10 ** 9 + 7)
    
  return power

N = int(input())

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

bc = b//c
bd = b//d

import math
bcd = c*d/math.gcd(c,d)

ac = (a-1)//c
ad = (a-1)//d
acd = c*d//math.gcd(c,d)

ans = (b-(bc+bd-bcd))-((a-1)-(ac+ad-acd))

print(int(ans))
# Judge status: Accepted
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            v = i*i+j*j+k*k+i*j+j*k+k*i;
            if v < 10050:
                ans[v] += 1
for i in range(n):
    print(ans[i+1])
# Judge status: Wrong Answer
s = str(input())
a = [0]
l = len(s)
k = 0
for i in range(l):
  if(s[i]=="<"):
    a.append(a[-1]+1)
  else:
    a.append(a[-1]-1)
  k = min(a[-1],k)
ans = sum(a)
if(k<0):
  ans += (l+1)*abs(k)
print(ans)
# Judge status: Accepted
n,k,q =map(int,input().split())
a_li = [int(input()) for _ in range(q)]
from collections import Counter
c = Counter(a_li)
for x in range(n):
    if q-k<0:
        print('Yes')
    else:
        if c[x+1]>q-k:
            print('Yes')
        else:
            print('No')
# Judge status: Accepted
n = int(input())
print(1-(n//2)/n)
# Judge status: Accepted
import sys
import numpy as np
input = sys.stdin.readline

MOD = 10**9 + 7

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

ans = 0
for n in range(64):
	Anb = (A >> n) & 1
	cnt_one = np.count_nonzero(Anb)
	cnt_zero = N - cnt_one
	x = cnt_one * cnt_zero
	for i in range(n):
		x *= 2
		x %= MOD
	ans = (ans+x)%MOD
print(ans)
# Judge status: Accepted
import numpy as np


def solve():
    N, K = map(int, input().split())
    h = np.array(list(map(int, input().split())))
    dp = np.full(N, 10**9, dtype=np.int)
    dp[0] = 0

    for i in range(1, N):
        dp[i:i + K] = np.fmin(
            dp[i:i + K],
            dp[i - 1] + np.abs(h[i:i + K] - h[i - 1])
        )
    return dp[-1]


if __name__ == "__main__":
    print(solve())
# Judge status: Wrong Answer
##C
L = int(input())
(L/3)**3
# Judge status: Accepted
S = input()
hitachi = 'hi'
i = 1
 
while True:
    corect = hitachi * i
    if S == corect:
        print('Yes')
        break
    i += 1
    if i == 20:
        print('No')
        break
# Judge status: Accepted
from collections import Counter
c = Counter(list(input()))
if len(c) == 1:
  if list(c.values())[0] == 1:
    print('YES')
  else:
    print('NO')
elif len(c) == 2:
  if all(v == 1 for v in c.values()):
    print('YES')
  else:
    print('NO')
else:
  if max(c.values()) >= min(c.values()) + 2:
    print('NO')
  else:
    print('YES')
# Judge status: Wrong Answer
n = int(input())

cnt, now = 1, 0
ans = ''
for i in range(100):
    if n == now:
        break
    if (n - now) % (2**(i + 1)) != 0:
        ans = ans + '1'
        now += pow(-2, i)
    else:
        ans = ans + '0'
print(ans[::-1])
# Judge status: Accepted
n,m = map(int,input().split())
if m >= 2*n:
    m -= 2*n
    print(n+int(m/4))
else:
    print(int(m/2))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
count_4=0
count_2=0
count_1=0
for i in A:
    if i%4==0:
        count_4+=1
    elif i%2==0:
        count_2+=1
    else:
        count_1+=1
if count_2<2:
    if count_1+count_2<=count_4:
        print("Yes")
    else:
        print("No")
else:
    if count_1<=count_4:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
N = int(input())

num = 0

for i in range(N+1):
  g = N -i
  a=sum(map(int,list(str(g))))
  b=sum(map(int,list(str(i))))
  ans =  a + b
  if ans == 0:
    num += ans
  elif num >= ans:
    num += ans
  else:
    continue

    
print(num)
# Judge status: Accepted
n=int(input())
ans=(n*(n-1))//2
print(ans)
# Judge status: Accepted
s = set(list(input()))
strings = [chr(i) for i in range(97, 97+26)]

for i in strings:
    if not i in s:
        print(i)
        exit()
print(None)
# Judge status: Wrong Answer
a,b,c,d = map(int, input().split())

if a//d >= b//c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
import math

N = int(input())

a = N//11*2
if N%11 == 0:
    print(N//11*2)
else:
    print(N//11*2+(1 if N%11<7 else 2))
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())

total=0
for i in range(N):
  total ^= A[i]
  
print(*[total^A[i] for i in range(N)])
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))

mm = 0
for x in X:
    mm += x**2

for i in range(min(X), max(X) + 1):
    s = 0
    for x in X:
        s += (x - i)**2

    if s < mm:
        mm = s

print(mm)
# Judge status: Accepted
n = int(input())
init = int(pow(10, 9))
dp = [[init, init, init] for _ in range(n)]
dp[0] = list(map(int, input().split()))
for i in range(1, n):
    line = list(map(int, input().split()))
    dp[i][0] = line[0] + max(dp[i-1][1], dp[i-1][2])
    dp[i][1] = line[1] + max(dp[i-1][0], dp[i-1][2])
    dp[i][2] = line[2] + max(dp[i-1][0], dp[i-1][1])
print(max(dp[-1]))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(sum(a[n::2]))
# Judge status: Wrong Answer
n, m = map(int, input().split())

if n == m:
	print("AC")
else:
	print("WA")
# Judge status: Accepted
H1, M1, H2, M2, K = map(int, input().split())
diff = 60 * H2 + M2 - (60 * H1 + M1)
print(max(0, diff - K))
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
for i in range(N-M):
    for j in range(N-M):
        c = 1
        for k in range(M):
            if A[i+k][j:j+M] != B[k]:
                c = 0
        if c == 1:
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
import sys

N = str(input())

n = list(map(int, N))

if sum(n) == 0:
    print('No')
elif sum(n) % 9 != 0:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
S=input().split("/")
if int(S[0])>=2019 and int(S[1])>=5:
    print("TBD")
else:
    print("heisei")
# Judge status: Accepted
import re


a = input()

if re.match(r"[A-Z]", a):
    print("A")
else:
    print("a")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a+b==c or b+c==a or a+c==b:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n,k = map(int,input().split())
print(0 if n%k == 0 else 1)
# Judge status: Wrong Answer
N = input()

sum = sum([int(i) for i in N])
if sum % 9 == 0:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
s = list(input())
k = int(input())
for i in range(len(s)):
    if s[i] != "a" and (123-ord(s[i])) <= k:
        k -= (123-ord(s[i]))
        s[i] = "a"
    if i == len(s)-1:
        s[i] = (chr((((ord(s[i])+(k%26))-97)%26)+97))
print("".join(s))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7

ans = 0
for i in range(60):
    c = sum([1 for ai in a if (ai >> i) & 1])
    ans += (1 << i) * c * (n-c)
    ans %= mod
print(ans)
# Judge status: Wrong Answer
N,M = map(int, input().split())

A=[]
for i in range(N):
  x = [int(i) for i in input().split()]
  A = A + x[1:]

ans = 0
from collections import Counter
for k,v in Counter(A).items():
  print(k,v)
  if v==N: ans += 1

print(ans)
# Judge status: Accepted
#frog1からジャンプの回数が変数kになった
n,k=map(int,input().split())
h=list(map(int,input().split()))
INF=float('INF')
dp=[INF]*n
dp[0]=0
for i in range(1,n):
    for j in range(1,k+1):
        if i-j<0:#out of indexを防ぐ
            continue
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))#dp[i]と大小を比較する
print(dp[n-1])
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A)
m1 = B[-1]
m2 = B[-2]
ANS = [m1 if x == m1 else m2 for x in A]
print('\n'.join(map(str,ANS)))
# Judge status: Accepted

import numpy as np
H, N = list(map(int, input().split()))
A = np.empty(N, int)
B = np.empty(N, int)
for i in range(N):
    A[i], B[i] = list(map(int, input().split()))


DP = np.empty(H+1, int)
DP[0] = 0
for i in range(1, H+1):
    I = i-A;
    I[I<0] = 0
    DP[i] = np.min(DP[I] + B)
    
print(DP[H])
# Judge status: Accepted
x = int(input())
ans = [1]
for i in range(2, 40):
    for j in range(2, 10):
        if i**j <= x:
            ans.append(i**j)
        else:
            break

ans.sort()
print(ans[-1])
# Judge status: Accepted
S= input()
T= input()

L= len(S)

ans = 0
for n in range(L):
  if S[n] != T[n]:
    ans += 1
    
print(ans)
# Judge status: Accepted
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

import statistics as st

n = ii()
a = []
b = []
for i in range(n):
    aa,bb = mi()
    a.append(aa)
    b.append(bb)

a.sort()
b.sort()

minmed = st.median(a)
maxmed = st.median(b)

if len(a) %2 == 0:
    ans = maxmed*2 - minmed*2 + 1
else:
    ans = maxmed-minmed+1
print(int(ans) )
# Judge status: Accepted
n = int(input())
ans = n * (n - 1) // 2
print(ans)
# Judge status: Accepted
s = input()
red = s.count("0")
blue = s.count("1")
print(min(red,blue) * 2)
# Judge status: Accepted
import fractions

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

def lcm(a,b):
    y = a*b / fractions.gcd(a,b)
    return int(y)

print(lcm(A,B))
# Judge status: Accepted
S = input().split()
print(''.join([s[0].upper() for s in S]))
# Judge status: Accepted
import bisect
N,M = map(int,input().split())
A = [[] for _ in range(N)] #重複がある場合にはsetにする？
original = []
for i in range(M):
  a,b = map(int,input().split())
  a-=1 #県を0indexに直す
  A[a].append(b)
  original.append((a,b))
for X in A:
  X.sort()
#print(A)
for i in range(M):
  ken,now = original[i]
  ID = bisect.bisect_left(A[ken],now)
  ken += 1; ID+=1
  ans = "0"*(6-len(str(ken)))+str(ken)+"0"*(6-len(str(ID)))+str(ID)
  print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
if N==1 and M==0:
  print(0)
  import sys
  sys.exit()
ans = [-1]*N
for i in range(M):
  s,c = map(int,input().split())
  if ans[s-1]!=-1 and ans[s-1]!=c:
    print(-1)
    break
  ans[s-1] = c
else:
  for i in range(N):
    if ans[i]==-1:
      if i!=0:
        ans[i] = 0
      else:
        ans[i] = 1
    ans[i] = str(ans[i])
  a = ''.join(ans)
  if a[0]=='0' and len(a)>1:
    print(-1)
  else:
    print(a)
# Judge status: Wrong Answer
x, y = list(map(int, input().split()))

b = y // 2
a = y // 4


if y % 2 != 0:
    print("No")
else:
    if a <= x <= b:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
o=input()
e=input()
n=max(len(o),len(e))
ans=''
for i in range(n):
    if len(o)>len(e):
        ans+=o[i]
        if i!=n-1:
            ans+=e[i]
    else:
        ans+=o[i]
        ans+=e[i]       
print(ans)
# Judge status: Accepted
import math
X = int(input())

def prime(a):
    for i in range(2, math.floor(math.sqrt(a)) + 1):
        if a % i == 0:
            return True
    return False

while prime(X):
    X += 1
print(X)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
total = 1000
kabu = 0
 
for i in range(N-1):
    if (A[i] < A[i+1]):
        kabu += total//A[i]
        total -= kabu*A[i]
    elif(A[i]==A[i+1]):
        pass
    elif(A[i] > A[i+1]):
        total += (kabu*A[i])
        kabu = 0
 
 
#最後
i += 1
total += (kabu * A[i])
kabu = 0
print(total)
# Judge status: Wrong Answer
a,b,x = map(int,input().split())
if a + b >= x:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n=int(input())
a=[int(x) for x in input().split()]

b=[0]*n
b[0]=a[0]
for i in range(n-1):
  b[i+1]=b[i]+a[i+1]

c=0
for j in range(n-1):
  c+=a[j]*(b[n-1]-b[j])
  
print(c%(10**9+7))
# Judge status: Wrong Answer
num = [int(s) for s in input().split()]

com = 1
tes = 2
if max(num)%min(num) == 0:
  print(max(num))
else:
  while tes < min(num)/2 +1:
    if min(num)%tes == 0 and max(num)%tes == 0:
      com *= tes
      num = [int(n/tes) for n in num]
    else:
      tes += 1

print(com*min(num)*max(num))
# Judge status: Wrong Answer
import math 

n = int(input())

for i in range(n+1,1,-1):
  #print(i)
  if int((math.sqrt(i)))**2 == i:
    print(i)
    break
# Judge status: Accepted
arr = [0]*5
for i in range(5):
    arr[i] = int(input())
time = 0
for ar in arr:
    time += (-(-ar//10))*10
amari = []
for i in arr:
    amari.append(i%10)
amari.sort()
while 0 in amari:
    amari.remove(0)
if amari == []:
    amari.append(10)
print(time - (10-amari[0]))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
Alice = 0
Bob = 0
for i in range(N):
  if i % 2 == 0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice - Bob)
# Judge status: Wrong Answer
#その10

O = str(input())
E = str(input())
P = []
for i in range(len(O)):
    print(P)
    print(i)
    P.append(O[i])
    if i < len(E):
        P.append(E[i])
print(''.join(P))
# Judge status: Wrong Answer
from math import floor,sqrt
import sys
a,b,n=map(int,input().split())
t1=floor((a*(n-1))/b)-a*floor((n-1)/b)
t2=floor(a*n/b)-a*floor(n/b)
print(max(t1,t2))
# Judge status: Accepted
n,l = (int(x) for x in input().split())

dict = []
for i in range(0,n):
    str = input()
    dict.append(str)
    # print(i)
# print(dict)
dict.sort()
# print(dict)
print("".join(dict))
# Judge status: Wrong Answer
n = int(input())
if n % 2 == 1:
  ans = 0
else:
  ans = int(n // 10) + int(n // 50) + int(n // 250)
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
flag=False
for i in range(x):
    c=2*i+4*(x-i)
    C=4*i+2*(x-i)
    if c==y or C==y:
        flag=True
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
def inpl(): return list(map(int, sys.stdin.readline().split()))
n = int(sys.stdin.readline())
a = inpl()
dic ={}
res = 0
for i in range(n):
    res += dic.get(i - a[i], 0)
    dic[i + a[i]] = dic.get(i + a[i], 0) + 1

print(res)
# Judge status: Accepted
N,X,Y=map(int,input().split())

X-=1
Y-=1
A=[0]*(N-1)
for i in range(N-1):
    for j in range(i+1,N):
        a=min(j-i,abs(j-Y)+1+abs(X-i))
        A[a-1]+=1

for i in A:
    print(i)
# Judge status: Accepted
N = int(input())
S = list(input())
ans = 'No'
n = int(N / 2)
if S[:n] == S[n:]:
    ans = 'Yes'
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a = []
foods = set(range(1, m+1))
for i in range(n):
  ki, *ai = list(map(int, input().split()))
  a.append(set(ai))
for i in range(n):
  foods &= a[i]
print(len(foods))
# Judge status: Accepted
N=int(input())

A=sorted([int(x) for x in input().split()],reverse=True)
if A[-1]==0:
  print(0)
else:
  m=1
  for a in A:
    m*=a
    if m>10**18:
      break
  print(m if m<=10**18 else -1)
# Judge status: Accepted
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for _ in range(n):
  b=int(input())
  for i in range(3):
    for j in range(3):
      if a[i][j]==b:
        a[i][j]=-1
for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]==-1:
    print('Yes')
    exit()
  if a[0][i]==a[1][i]==a[2][i]==-1:
    print('Yes')
    exit()
if a[0][0]==a[1][1]==a[2][2]==-1 or a[0][2]==a[1][1]==a[2][0]==-1:
  print('Yes')
  exit()
print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())
if a + b >= c: print("Yes")
else: print("No")
# Judge status: Accepted
d,t,s=map(int,input().split())

print("Yes" if t*s>=d else "No")
# Judge status: Accepted
abc = list(map(int,input().split()))

if abc == [5,5,7]:
    print('YES')
    exit()
if abc == [7,5,5]:
    print('YES')
    exit()
if abc == [5,7,5]:
    print('YES')
    exit()
print('NO')
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
if b<a:
  print(0)
  exit()
  
if a==b:
  print(1)
  exit()
  

n-=2

if n<0:
  print(0)

if n==0:
  print(1)

print(b*n-a*n+1)
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]
from collections import Counter
counter = dict(Counter(A))
ans = 0
for a in A:
    if counter[a] % 2 == 1:
        ans += 1
print(ans)
# Judge status: Accepted
s = input()

a = s.count("a")
b = s.count("b")
c = s.count("c")

check = min(a,b,c) + 1

if check  < a or check  < b or check  < c:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
x, y = map(int,input().split())

# 鶴をp羽とする

p = 0

for p in range(x+1):
  if 2*p + 4*(x-p) - y == 0:
    p=x+5
    break
  else:
    x=x


if p==x+5:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, X = map(int,input().split())
A = map(int,input().split())

s = 0

def gcd(a,b):
  if b == 0:
    return a
  return gcd(b,a%b)

for i in A:
  s = gcd(abs(X-i), s)
  
print(s)
# Judge status: Accepted
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N)]
cd = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    ans = []
    for j in range(M):
        ans.append(abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1]))
    minans = min(ans)
    print(ans.index(minans)+1)
# Judge status: Wrong Answer
n = int(input())
As = list(map(int, input().split()))
h = 0
for i in range(n - 1):
  d = As[i + 1] - As[i]
  if d > 0:
    h += d
print(h)
# Judge status: Accepted
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

ans = 0
N = Int()

for i in range(1,N+1):
    if i%3!=0 and i%5!=0:
        ans += i
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, x = map(int, input().split())
a = list(map(int, input().split()))
res = 0
for i in range(1, N):
  if a[i - 1] + a[i] > x:
    t = a[i - 1] + a[i] - x
    res += t
    if t > a[i]:
      t -= a[i]
      a[i] = 0
      a[i - 1] -= t
    else:
      a[i] -= t
print(res)
# Judge status: Wrong Answer
A,B,X = map(int,input().split())

print('YES' if B >= X else 'NO')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(1, n, 2):
  if a[i] % 2 == 1:
    ans += 1

print(ans)
# Judge status: Wrong Answer
L, R = map(int, input().split())

def mod(num):
    return num % 2019


#  (2019a + x)(2019b + y) = 2019(n) + xy

if mod(L) * mod(R) == 0:
    print(0)

elif L // 2019 != R // 2019:
    print(0)

else:
    print(min(mod(L * (L + 1)), mod((R - 1) * R)))
# Judge status: Accepted
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, 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

    a,b,c = map(int, input().split())
    if a<c<b or b<c<a:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
s=list(input())
t=list(input())

n=len(s)
ch=0
ch1=0
ans=0

d={}
d1={}

st=1
st1=1

s_new=[]
t_new=[]

for i in range(n):
  if s[i] not in d:
    d[s[i]]=st
    st+=1
    
for g in range(n):
  if t[g] not in d1:
    d1[t[g]]=st1
    st1+=1
    
for h in range(n):
  s_new.append(d[s[h]])
  t_new.append(d1[t[h]])
  
if s_new==t_new:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
MOD = 10**9+7
n = int(input())
print(pow(10, n, MOD)-2*pow(9, n, MOD)+pow(8, n, MOD))
# Judge status: Accepted
import sys
input = sys.stdin.readline

n,m = map(int,input().split())
A = list(map(int,input().split()))
BC = [tuple(map(int,input().split())) for i in range(m)]
BC = sorted(BC,key=lambda x:-x[1])
cnt = 0
flag = True
while True:
    for b,c in BC:
        A += [c]*b
        cnt += b
        if cnt > n:
            break
    break
A = sorted(A,reverse=True)
print(sum(A[:n]))
# Judge status: Accepted
n = int(input())

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

y = sorted(x)

for i in x:
    if y[(n+1)//2-1] >= i:
        print(y[(n+1)//2])
    else:
        print(y[(n+1)//2-1])
# Judge status: Accepted
N = int(input())
l1 = [int(i) for i in input().split(" ")]
l2 = [int(i) for i in input().split(" ")]
l1_sum = l1[0]
l2_sum = sum(l2)
Max = l1_sum + l2_sum
for i in range(1,N):
    l1_sum += l1[i]
    l2_sum -= l2[i-1]
    if Max<l1_sum+l2_sum:
        Max = l1_sum+l2_sum
print(Max)
# Judge status: Accepted
#!/usr/bin/env python

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

a = sorted(a)
if x < a[0]:
    print(0)
    exit()

cnt = 0 
al = False
for i in range(n):
    if x >= a[i]:
        x -= a[i]
        cnt += 1
    else:
        break
    if i == n-1:
        al = True

if al: 
    if x > 0:
        ans = cnt-1
    else:
        ans = cnt 
else:
    ans = cnt 

print(ans)
# Judge status: Wrong Answer
A,B,T = map(int,input().split())

print((T+0.5)//A * B)
# Judge status: Wrong Answer
s = str(input())
t = str(input())
lst = []
i= 0
for ss in range(len(s)-len(t)+1):
  flg = 1
  i= 0
  for tt in range(len(t)):
    now = ss + tt
    if s[now] == t[tt] or s[now] == '?':
      pass
    else:
      flg = 0
  if flg:
    ns = list(s)
    ns[ss:now+1] = list(t)
    lst.append(("").join(ns))
if lst:
  lst = [_.replace('?','a') for _ in lst]
  sorted(lst)
  print(lst[0])

else:
  print('UNRESTORABLE')
# Judge status: Accepted
a = int(input())
li = list(range(1, (a + 1)))
for i in range(a):
    if li[i] % 3 == 0 or li[i] % 5 == 0 or li[i] % 15 == 0:
        li[i] = 0
print(sum(li))
# Judge status: Accepted
s = input()

if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
import copy
n = int(input())
s0 = list(input())
s1 = copy.deepcopy(s0)
ans0, ans1 = 0, 0
for i in range(n-1, 0, -1):
    if s0[i] == '.' and s0[i-1] == '#':
        ans0 += 1
        s0[i] = '#'

for i in range(n-1, 0, -1):
    if s1[i] == '.' and s1[i-1] == '#':
        ans1 += 1
        s1[i-1] = '.'

print(min(ans0, ans1))
# Judge status: Wrong Answer
S = input()

def judge(x):
  if reversed(x) == x and x[0] == x[2] and x[-3] == x[-1]:
    return "Yes"
  else:
    return "No"
  
print(judge(S))
# Judge status: Accepted
n = int(input())
up = list(map(int,input().split()))
dw = list(map(int,input().split()))
ans = up[0]+sum(dw)
tmp = up[0]+sum(dw)
for i in range(1,n):
  tmp = tmp+up[i]-dw[i-1]
  ans = max(tmp,ans)
print(ans)
# Judge status: Accepted
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    X = int(input())
    C = X // 100
    if X >= C * 100 and X <= C * 105:
        print(1)
    else:
        print(0)

if __name__=="__main__":
    main()
# Judge status: Accepted
S = input()

for i in range(200):
  S = S[:len(S)-1]
  if S[len(S)//2:]==S[:len(S)//2]:
    print(len(S))
    exit()
# Judge status: Accepted
a, b, x = map(int, input().split())
if a <= x and x <= a+ b:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
import math
x,y = map(int,input().rstrip().split(' '))
n = int(math.log2(y//x))
print(n+1)
# Judge status: Accepted
a = int(input())
num_list = []
for i in range(a):
    i +=1
    if i%3 != 0:
        if i%5 != 0:
            num_list.append(i)
print(sum(num_list))
# Judge status: Accepted
*a,=map(int,open(0).read().split());print('YNeos'[all(t-set(a.index(b)for b in a[10:])for t in({0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])
# Judge status: Accepted
N, M = map(int, input().split(' '))

if N == 1 and M == 1:
    print(1)
elif N == 1 or M == 1:
    print(max(0, M * N - 2))
else:
    print(max(0, N * M - (2 * (N + M - 2))))
# Judge status: Accepted
N=str(input())
print('Yes' if N[0]=='9' or N[1]=='9' else 'No')
# Judge status: Wrong Answer
n,m= list(map(int, input().split()))
def kouyaku(x,y):
    table=[]
    z=min(x,y)
    for i in range(2,z+1):
        if x%i==0 and y%i==0:
            table.append(i)
    table = list(set(table))   
    return table
k=kouyaku(n,m)
ans=0
for j in range(len(k)-1):
    for z in range(j+1,len(k)):
        if k[j]%k[z]!=0:
            ans+=1
ans+=len(k)
print(ans)