ZhenlongDai/ACPR huggingface dataset:
Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
List = []
for i in range (2):
  List.append(list(map(int, input().split())))
sumList1 = [0]*N
sumList2 = [0]*N
for i in range(N):
  if i == 0:
    sumList1[i] = List[0][i]
    sumList2[N-1-i] = List[1][N-1-i]
  else:
    sumList1[i] = List[0][i]+sumList1[i-1]
    sumList2[N-1-i] = List[1][i]+sumList2[N-i]
res = 0
for i in range(N):
  res = max(sumList1[i]+sumList2[i],res)
print(res)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -1 0 7 -8 -1 0

Expected output:
131


Actual output:
19


Fixed submission (verdict: Accepted):
N = int(input())
List = []
for i in range (2):
  List.append(list(map(int, input().split())))
sumList1 = [0]*N
sumList2 = [0]*N
for i in range(N):
  if i == 0:
    sumList1[i] = List[0][i]
    sumList2[N-1-i] = List[1][N-1-i]
  else:
    sumList1[i] = List[0][i]+sumList1[i-1]
    sumList2[N-1-i] = List[1][N-1-i]+sumList2[N-i]
res = 0
for i in range(N):
  res = max(sumList1[i]+sumList2[i],res)
print(res)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = 5
a = [list(map(int, input().split())) for _ in range(2)]
count = 0

for i in range(n):
    x = sum(a[0][:n-i]) + sum(a[1][n-i-1:])
    
    if count < x:
        count = x

print(count)


Failing test case input:
4
1 1 0 1
1 1 1 1

Expected output:
5


Actual output:
7


Fixed submission (verdict: Accepted):
n = int(input())
a = [list(map(int, input().split())) for _ in range(2)]
count = 0

for i in range(n):
    x = sum(a[0][:n-i]) + sum(a[1][n-i-1:])
    
    if count < x:
        count = x

print(count)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]

A = [l1, l2]

print (A)

max_candy = 0
for i in range(N):
    temp = 0
    temp += sum(A[0][0:i+1])
    temp += sum(A[1][i:])
    if temp > max_candy:
        max_candy = temp

print(max_candy)


Failing test case input:
7
0 14 -1 0 2 6 4
50 2 1 5 1 -1 2

Expected output:
60


Actual output:
[[0, 14, -1, 0, 2, 6, 4], [50, 2, 1, 5, 1, -1, 2]]
60


Fixed submission (verdict: Accepted):
N = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]

A = [l1, l2]
max_candy = 0
for i in range(N):
    temp = 0
    temp += sum(A[0][0:i+1])
    temp += sum(A[1][i:])
    if temp > max_candy:
        max_candy = temp

print(max_candy)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
a_u = list(map(int, input().split()))
a_d = list(map(int, input().split()))

num = a_d.pop()

for i in range(n):
    num += a_u.pop(0)
    if sum(a_u) <= sum(a_d):
        num += sum(a_d)
        break
    a_d.pop(0)

print(num)

Failing test case input:
5
3 2 0 4 1
0 2 1 2 1

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):


n = int(input())
a_u = list(map(int, input().split()))
a_d = list(map(int, input().split()))

num_list = []

for i in range(n):
    num_list.append(sum(a_u[:i+1]) + sum(a_d[i:]))

print(max(num_list))
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = 0
tmp =0
for i in range(N - 1):
    tmp = max(tmp, sum(A1[0][i + 1:]) + sum(A1[1][i:]))

print(tmp)


Failing test case input:
7
-2 -1 1 0 1 19 1
136 -1 0 7 -8 -1 0

Expected output:
131


Actual output:
154


Fixed submission (verdict: Accepted):
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = 0
tmp =0
for i in range(N):
    tmp = max(tmp, sum(A1[0][:i + 1]) + sum(A1[1][i:]))

print(tmp)

Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = []

for n in range(N):
  ame = 0
  for i in range(n+1):
    ame += A1[i]
  for j in range(n, N):
    ame += A2[j]
  ans.append(ame)
  
print(ans)

Failing test case input:
7
-1 4 -1 0 2 34 1
136 2 -4 6 -1 -1 0

Expected output:
137


Actual output:
[137, 5, 2, 6, 2, 37, 39]


Fixed submission (verdict: Accepted):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = []

for n in range(N):
  ame = 0
  for i in range(n+1):
    ame += A1[i]
  for j in range(n, N):
    ame += A2[j]
  ans.append(ame)
  
print(max(ans))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [[int(i) for i in input().split()]for j in range(2)]

ans = 0
for i in range(N):
    b = 0
    b = sum(A[0][:i]) + sum(A[1][i-1:])
    ans = max(b, ans)
print(ans)

Failing test case input:
1
1
0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
A = [[int(i) for i in input().split()]for j in range(2)]

ans = 0
for i in range(N):
    b = 0
    b = sum(A[0][:i+1]) + sum(A[1][i:])
    ans = max(b, ans)
print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
l1=input().split(' ')
l2=input().split(' ')

max=0
for i in range(N):
	sum=0
	for j in range(i+1):
		sum+=int(l1[j])
	for k in range(N-i):
		sum+=int(l2[k])

	if max<sum:
		max=sum

Failing test case input:
7
-2 4 0 0 1 33 0
50 2 0 6 -1 -1 0

Expected output:
54


Actual output:

Fixed submission (verdict: Accepted):
N=int(input())
l1=input().split(' ')
l2=input().split(' ')

max=0
for i in range(N):
	sum=0
	for j in range(i+1):
		sum+=int(l1[j])
	for k in range(i,N):
		sum+=int(l2[k])

	if max<sum:
		max=sum

print(max)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A1 = tuple(map(int, input().split()))
A2 = tuple(map(int, input().split()))

from itertools import accumulate
A1S = [0] + list(accumulate(A1))
A2S = [0] + list(accumulate(A2))

for i in range(1, n+1):
    if A1S[-1] - A1S[i] <= A2S[-1] - A2S[i]:
        break

print(A1S[i] + A2S[-1] - A2S[i-1])


Failing test case input:
7
-2 -1 0 0 1 23 1
73 -1 0 0 -8 -1 2

Expected output:
63


Actual output:
22


Fixed submission (verdict: Accepted):
n = int(input())
A1 = tuple(map(int, input().split()))
A2 = tuple(map(int, input().split()))

from itertools import accumulate
A1S = [0] + list(accumulate(A1))
A2S = [0] + list(accumulate(A2))

ma = 0
for i in range(1, n+1):
    ma = max(ma, A1S[i] + A2S[-1] - A2S[i-1])
print(ma)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

a = [list(map(int,input().split())) for i in range(2)]
saidaiti = []
for i in range(N):
     saidaiti.append(sum(a[0][:i+1]+a[1][i:]))
     print(a[0][:i+1])
     print(a[1][i:])
print(max(saidaiti))

Failing test case input:
4
1 1 1 1
1 1 1 1

Expected output:
5

Actual output:
[1]
[1, 1, 1, 1]
[1, 1]
[1, 1, 1]
[1, 1, 1]
[1, 1]
[1, 1, 1, 1]
[1]
5


Fixed submission (verdict: Accepted):
N = int(input())

a = [list(map(int,input().split())) for i in range(2)]
saidaiti = []
for i in range(N):
     saidaiti.append(sum(a[0][:i+1]+a[1][i:]))
print(max(saidaiti))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

max = 0
for i in range(n):
        max_rep = 0
        max_rep += sum(l1[0:i]) + sum(l2[i-1:])
        if max < max_rep: max = max_rep

print(max)

Failing test case input:
7
0 2 -1 0 -2 30 -8
11 0 1 -1 -2 -11 1

Expected output:
22


Actual output:
19


Fixed submission (verdict: Accepted):
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

max = 0
for i in range(1, n+1):
        max_rep = 0
        max_rep += sum(l1[0:i]) + sum(l2[i-1:])
        if max < max_rep: max = max_rep

print(max)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def test():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    c = max(a)
    d = 0; ans = 0
    for i,k in enumerate(a):
        if k == c:
            d = max(d,i)
    ans += sum(a[:d+1])
    ans += sum(b[d:])
    print(ans)


if __name__ == "__main__":
    test()


Failing test case input:
7
0 14 -1 -1 2 6 2
50 2 0 4 1 -1 13

Expected output:
69


Actual output:
33


Fixed submission (verdict: Accepted):
def test():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    d = []; ans = 0
    for i in range(n):
        ans = sum(a[:i+1])
        ans += sum(b[i:])
        d.append(ans)
    print(max(d))


if __name__ == "__main__":
    test()
Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
res = 0
for i in range(n):
  c = 0
  for j in range(n):
    if j <= i:
      c += a[j]
    else:
      c += b[j]
  res = max(res,c)
print(res)

Failing test case input:
7
3 3 4 5 4 5 3
5 3 8 4 2 3 2

Expected output:
30


Actual output:
27


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
res = 0
for i in range(n):
  c = 0
  for j in range(n):
    if j < i:
      c += a[j]
    elif j == i:
      c += a[j]
      c += b[j]
    else:
      c += b[j]
  res = max(res,c)
print(res)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = [int(x) for x in readline().split()]
B = [int(x) for x in readline().split()]

Acum = list(itertools.accumulate(A))
Bcum = list(itertools.accumulate(B))
print(Acum)
print(Bcum)
ans = 0
for i in range(N):
    if i - 1 >= 0:
        ans = max(ans, Acum[i] + Bcum[-1] - Bcum[i - 1])
    else:
        ans = max(ans, Acum[i] + Bcum[-1])
print(ans)


Failing test case input:
7
-1 4 -1 0 2 34 0
136 2 0 6 -1 -1 0

Expected output:
141


Actual output:
[-1, 3, 2, 2, 4, 38, 38]
[136, 138, 138, 144, 143, 142, 142]
141


Fixed submission (verdict: Accepted):
import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = [int(x) for x in readline().split()]
B = [int(x) for x in readline().split()]

Acum = list(itertools.accumulate(A))
Bcum = list(itertools.accumulate(B))
ans = 0
for i in range(N):
    if i - 1 >= 0:
        ans = max(ans, Acum[i] + Bcum[-1] - Bcum[i - 1])
    else:
        ans = max(ans, Acum[i] + Bcum[-1])
print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]
res = 0
for i in range(1, N):
    temp = sum(A[0][:i]) + sum(A[1][i-1:])
    if temp > res: res = temp
print(res)

Failing test case input:
7
1 1 -1 0 -1 30 -2
6 0 0 0 -8 -4 1

Expected output:
29


Actual output:
27


Fixed submission (verdict: Accepted):
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]
res = 0
for i in range(N):
    temp = sum(A[0][:i+1]) + sum(A[1][i:])
    if temp > res: res = temp
print(res)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A1 = input().split()
A2 = input().split()

max_point = 0
point = int(A1[0])
for i in range(N):
    for j in range(i):
        point += int(A1[j])
    for j in range(N-i):
        point += int(A2[i+j])

    if(point > max_point):
        max_point = point
    point = int(A1[0])


print(max_point)

Failing test case input:
7
0 0 -1 0 -1 30 -2
4 0 0 0 -8 -4 1

Expected output:
27


Actual output:
29


Fixed submission (verdict: Accepted):
N = int(input())
A1 = input().split()
A2 = input().split()

max_point = 0
point = int(A1[0])
for i in range(N):
    for j in range(i):
        point += int(A1[1+j])
    for j in range(N-i):
        point += int(A2[i+j])

    if(point > max_point):
        max_point = point
    point = int(A1[0])


print(max_point)

Problem: p03449
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))

mi=min(sum(a1[1:]),sum(a2[:-1]))
for i in range(2,n-1):
    tmp=sum(a1[i:])+sum(a2[:i-1])
    if tmp<mi: mi=tmp
print(sum(a1)+sum(a2)-mi)

Failing test case input:
7
0 2 -1 0 -2 30 -8
11 0 1 -1 -2 -6 1

Expected output:
24


Actual output:
22


Fixed submission (verdict: Accepted):
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))

mi=min(sum(a1[1:]),sum(a2[:-1]))

for i in range(2,n):
    tmp=sum(a1[i:])+sum(a2[:i-1])
    mi=min(tmp,mi)
print(sum(a1)+sum(a2)-mi)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


from functools import reduce
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if n==1:
    print(a[0]+b[0])
else:
    l = [0 for _ in range(n-1)]
    for i in range(n-1):
        l[i] = a[i+1]-b[i]
    print(a[0]+sum(b)+max([sum(l[:j+1]) for j in range(n-1)]))


Failing test case input:
7
-2 -1 0 0 1 23 1
73 -1 0 -1 -8 -1 2

Expected output:
62


Actual output:
24


Fixed submission (verdict: Accepted):


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

if n==1:
    print(a[0]+b[0])
else:
    l = [0 for _ in range(n-1)]
    for i in range(n-1):
        l[i] = a[i+1]-b[i]
    if max([sum(l[:j+1]) for j in range(n-1)]) > 0:
        print(a[0]+sum(b)+max([sum(l[:j+1]) for j in range(n-1)]))
    else:
        print(a[0]+sum(b))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
msum = 0

for i in range(n):
  sum = 0
  for j in range(i + 1):
    sum += a1[j]
  for i in range(i, n):
    sum += a2[j]
  if msum < sum:
    msum = sum
print(msum)

Failing test case input:
5
6 2 0 4 1
0 2 1 2 1

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
msum = 0

for i in range(n):
  sum = 0
  for j in range(i + 1):
    sum += a1[j]
    
  for j in range(i, n):
    sum += a2[j]
    
  
  
  if msum < sum:
    msum = sum
print(msum)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

A1, A2 = list(map(int, input().split())), list(map(int, input().split()))

print(max([A1[0] + sum(A1[:i] + A2[i:]) for i in range(N)]))


Failing test case input:
7
0 0 -1 0 -1 22 -2
4 0 0 0 -8 -12 1

Expected output:
19


Actual output:
21


Fixed submission (verdict: Accepted):
N = int(input())

A1, A2 = list(map(int, input().split())), list(map(int, input().split()))

print(max([sum(A1[:i + 1] + A2[i:]) for i in range(N)]))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

candies1 = list(map(int, input().split()))
candies2 = list(map(int, input().split()))
num = 0

for i in range(N):
    tmp = 0
    tmp += sum(candies1[:i])
    tmp += sum(candies2[i-1:N])
    if  num < tmp:
        num = tmp

print(num)

Failing test case input:
7
0 0 -1 0 -1 30 -2
4 0 0 0 -8 -4 1

Expected output:
27


Actual output:
25


Fixed submission (verdict: Accepted):
N = int(input())

candies1 = list(map(int, input().split()))
candies2 = list(map(int, input().split()))
num = 0

for i in range(N):
    tmp = 0
    tmp += sum(candies1[:i+1])
    tmp += sum(candies2[i:N])
    if  num < tmp:
        num = tmp

print(num)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[]
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.append(b)
a.append(c)
d=[]
for i in range(n):
  cnd=a[0][i]
  for j in range(n):
    if i<j+1:
      cnd+=a[0][j]
    else:
      cnd+=a[1][j]
  d.append(cnd)
print(max(d))

  


Failing test case input:
7
-2 -1 1 0 1 19 1
120 -1 0 7 -8 -1 1

Expected output:
116


Actual output:
157


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.append(b)
a.append(c)
d=[]
cnd=a[0][0]
for i in range(n):
  for j in range(n):
    if i>j:
      cnd+=a[0][j]
    else:
      cnd+=a[1][j]
  d.append(cnd)
  cnd=a[0][min(n-1,i+1)]
print(max(d))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
fld = [list(map(int, input().split())) for _ in range(2)]
score_max = 0

for i in range(n):
  score = fld[0][0]
  y = x = 0
  for j in range(n):
    if j == i:
      y += 1
    else:
      x += 1
    score += fld[y][x]

print(score)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -2 0 7 -8 -2 0

Expected output:
129


Actual output:
19


Fixed submission (verdict: Accepted):
n = int(input())
fld = [list(map(int, input().split())) for _ in range(2)]
score_max = 0

for i in range(n):
  score = fld[0][0]
  y = x = 0
  for j in range(n):
    if j == i:
      y += 1
    else:
      x += 1
    score += fld[y][x]
  score_max = max(score_max, score)

print(score_max)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
line=[line1,line2]
point=0
place=0
def judge(i):
  status1=0
  status2=0
  possible=1
  for k in range(n-i-1):
    status1+=line[0][i+k+1]
    status2+=line[1][i+k]
    if status1>=status2:
      possible=0
      break
  return possible
for i in range(n):
  point+=line[place][i]
  if judge(i)==1:
    place=1
    point+=line[place][i]
print(point)


Failing test case input:
7
0 14 0 -1 2 6 1
50 2 0 4 1 0 11

Expected output:
68


Actual output:
79


Fixed submission (verdict: Accepted):
n=int(input())
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
line=[line1,line2]
point=0
place=0
def judge(i):
  status1=0
  status2=0
  possible=1
  for k in range(n-i-1):
    status1+=line[0][i+k+1]
    status2+=line[1][i+k]
    if status1>=status2:
      possible=0
      break
  return possible
for i in range(n):
  point+=line[place][i]
  if place==0 and judge(i)==1:
    place=1
    point+=line[place][i]
print(point)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a1list = list(map(int, input().split()))
a2list = list(map(int, input().split()))

countlist = []
for i in range(n):
  p = sum(a1list[0:i]) + sum(a2list[i:n-1])
  countlist.append(p)
  
print(max(countlist))

Failing test case input:
1
2
7

Expected output:
9


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
a1list = list(map(int, input().split()))
a2list = list(map(int, input().split()))

countlist = []
for i in range(n):
  p = sum(a1list[0:i+1]) + sum(a2list[i:n])
  countlist.append(p)
  
print(max(countlist))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))

ttl = 0
li1 = []
for i in range(n):
    ttl += a1[i]
    li1.append(ttl)

ttl = 0
li2 = []
for i in range(1,n+1):
    ttl += a2[i*(-1)]
    li2.append(ttl)

ans = 0
for i in range(n):
    print(li1[i]+li2[i])
    ans = max(ans,li1[i]+li2[(i+1)*(-1)])

print(ans)

Failing test case input:
7
-2 -1 0 0 1 24 0
136 0 0 -1 -12 -2 2

Expected output:
121


Actual output:
0
-3
-15
-16
-15
9
145
121


Fixed submission (verdict: Accepted):
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))

ttl = 0
li1 = []
for i in range(n):
    ttl += a1[i]
    li1.append(ttl)

ttl = 0
li2 = []
for i in range(1,n+1):
    ttl += a2[i*(-1)]
    li2.append(ttl)

ans = 0
for i in range(n):
    
    ans = max(ans,li1[i]+li2[(i+1)*(-1)])

print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

p=sum(P)-P[0]
n=sum(N)-N[-1]

count=P[0]+N[-1]
for i in range(X-1):
    if p<n:
        print(n+count)
        exit()
    else:
        count+=P[i+1]
    p-=P[i+1]
    n-=N[i]
    
print(count)



Failing test case input:
7
3 3 4 5 4 5 3
5 3 8 4 0 5 2

Expected output:
31


Actual output:
30


Fixed submission (verdict: Accepted):


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

a=sum(A)-A[0]
b=sum(B)-B[-1]

if N==1:
    print(A[0]+B[0])
    exit()

ans=0
const=A[0]+B[-1]
for i in range(N-1):
    ans=max(ans,a+const,b+const)
    a-=A[i+1]
    b-=B[i]
    const+=A[i+1]

print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
	if sum(A[i+1:]) + B[N-1] <= sum(B[i:]):
		print(ans + A[i] + sum(B[i:]))
		exit()
	else:
		ans += A[i]
print(ans)

Failing test case input:
5
6 2 0 4 1
0 2 1 2 1

Expected output:
15


Actual output:
14


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
	num = sum(A[:i+1]) + sum(B[i:])
	ans = max(ans,num)
print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[[int(i) for i in input().split()] for i in range(2)]
koho=[]
for i in range(n):
    if i==0:
        cnt=a[0][0]+sum(a[0][0:i])+sum(a[1][i:])
    else:
        cnt=sum(a[0][0:i])+sum(a[1][i:])
    koho.append(cnt)
print(max(koho))

Failing test case input:
7
1 0 -1 0 -1 30 -2
6 0 0 0 -8 -4 1

Expected output:
28


Actual output:
30


Fixed submission (verdict: Accepted):
n=int(input())
a=[[int(i) for i in input().split()] for i in range(2)]
koho=[]
for i in range(n):
    if i==0:
        cnt=a[0][0]+sum(a[0][0:i])+sum(a[1][i:])
    else:
        cnt=sum(a[0][0:i+1])+sum(a[1][i:])
    koho.append(cnt)
print(max(koho))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
from itertools import accumulate

N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

AC1 = list(accumulate(A1))
AC2 = list(accumulate(A2))


ans = 0
if N == 1:
    print(AC1[0] +AC2[0])
else:
    for i in range(N):
        ans = max(ans,AC1[i] + (AC2[-1] - AC2[i-1]))
    print(ans)

Failing test case input:
7
3 4 2 4 3 6 2
11 6 15 4 1 2 3

Expected output:
45


Actual output:
38


Fixed submission (verdict: Accepted):
from itertools import accumulate

N = int(input())
A1 = list(accumulate(map(int, input().split())))
A2 = list(accumulate(map(int, input().split())))

ans = A1[0] + A2[N-1]
for i in range(1,N):
    ans = max(ans,A1[i] + A2[N-1] - A2[i-1])
print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
n1 = list(map(int,input().strip().split(' ')))
n2 = list(map(int,input().strip().split(' ')))

path = []
path.append(n1)
path.append(n2)

sum_list = []

for i in range(n):
    sum = 0
    for j in range(i+1):
        sum += path[0][j]

    for k in range(i,n):
        sum += path[1][k]
    
    sum_list.append(sum)
    
print(sum_list)
print(max(sum_list))

Failing test case input:
7
0 4 -1 4 2 16 1
136 4 -4 6 0 -1 -1

Expected output:
140


Actual output:
[140, 8, 3, 11, 7, 23, 25]
140


Fixed submission (verdict: Accepted):
n = int(input())
n1 = list(map(int,input().strip().split(' ')))
n2 = list(map(int,input().strip().split(' ')))

path = []
path.append(n1)
path.append(n2)

sum_list = []

for i in range(n):
    sum = 0
    for j in range(i+1):
        sum += path[0][j]

    for k in range(i,n):
        sum += path[1][k]
    
    sum_list.append(sum)
    
print(max(sum_list))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans1 = []
ans2 = []

for x in range(N):
    if x == 0:
        ans1.append(A1[x])
        ans2.append(A1[x] + A2[x])
    else:
        ans1.append(ans1[x - 1] + A1[x - 1])
        ans2.append(max(ans1[x], ans2[x - 1]) + A2[x])
print(ans2[N - 1])


Failing test case input:
5
0 2 1 1 1
0 1 1 0 2

Expected output:
7


Actual output:
6


Fixed submission (verdict: Accepted):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans1 = []
ans2 = []

for x in range(N):
    if x == 0:
        ans1.append(A1[x])
        ans2.append(A1[x] + A2[x])
    else:
        ans1.append(ans1[x - 1] + A1[x])
        ans2.append(max(ans1[x], ans2[x - 1]) + A2[x])
print(ans2[N - 1])

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
N=int(input())
A=list(itertools.accumulate(map(int,input().split())))
B=[0]+list(itertools.accumulate(map(int,input().split())))
max([A[i]+B[-1]-B[i] for i in range(N)])

Failing test case input:
7
0 14 3 0 0 28 1
37 11 5 2 1 0 3

Expected output:
59


Actual output:

Fixed submission (verdict: Accepted):
import itertools
N=int(input())
A=list(itertools.accumulate(map(int,input().split())))
B=[0]+list(itertools.accumulate(map(int,input().split())))
print(max([A[i]+B[-1]-B[i] for i in range(N)]))
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[]
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.append(b)
a.append(c)
d=[]
cnd=a[0][0]
for i in range(n):
  for j in range(n):
    if i<j+1:
      cnd+=a[0][j]
    else:
      cnd+=a[1][j]
  d.append(cnd)
  cnd=a[0][min(n-1,i+1)]
print(max(d))

  


Failing test case input:
7
0 2 -1 1 1 12 7
77 3 0 5 2 -1 3

Expected output:
89


Actual output:
118


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.append(b)
a.append(c)
d=[]
cnd=a[0][0]
for i in range(n):
  for j in range(n):
    if i>j:
      cnd+=a[0][j]
    else:
      cnd+=a[1][j]
  d.append(cnd)
  cnd=a[0][min(n-1,i+1)]
print(max(d))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

sum_A1 = sum(A1)
sum_A2 = sum(A2)

ans = 0

for i in range(N):
    sum_A1 -= A1[i]
    ans += A1[i]
    if sum_A1 < sum_A2:
        break
    sum_A2 -= A2[i]

ans += sum_A2

print(ans)

Failing test case input:
5
3 2 0 4 1
0 2 1 2 1

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

sum_A1 = sum(A1)
sum_A2 = sum(A2)

ans = 0

for i in range(N - 1):
    A1[i+1] += A1[i]

A2[0] += A1[0]

for i in range(N - 1):
    A2[i+1] += max(A1[i+1], A2[i])

print(A2[N - 1])

Problem: p03449
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
ans = sum(p)+q[n-1]
for i in range(2, n):
  tmp = ans + q[n-i] - p[n-i+1]
  ans = max(ans, tmp)
print(ans)

Failing test case input:
7
-2 -1 0 0 1 24 0
166 0 -1 -2 -11 -1 2

Expected output:
151


Actual output:
24


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
ans = sum(p)+q[n-1]
tmp = ans
for i in range(n-1):
  tmp = tmp + q[n-i-2] - p[n-i-1]
  ans = max(ans, tmp)
print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = 0
tmp =0
for i in range(N - 1):
    tmp = max(tmp, sum(A1[0][:i + 1]) + sum(A1[1][i:]))

print(tmp)


Failing test case input:
1
2
6

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = 0
tmp =0
for i in range(N):
    tmp = max(tmp, sum(A1[0][:i + 1]) + sum(A1[1][i:]))

print(tmp)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

n = int(sys.stdin.readline())
a = [[int(i) for i in sys.stdin.readline().strip().split()] for _ in range(2)]

if n == 1:
    print(a[0][0] + a[1][0])
else:
    count = a[0][0]
    for i in range(n):
        if i == n - 1:
            count += a[1][n-1]
            break

        top = sum(a[0][i+1:])
        bottom = sum(a[1][i:n-1])

        if bottom > top:
            count += (bottom + a[1][n-1])
            break
        count += a[0][i+1]
    print(count)


Failing test case input:
7
3 3 4 5 4 5 3
5 3 8 4 0 5 2

Expected output:
31


Actual output:
30


Fixed submission (verdict: Accepted):
import sys

n = int(sys.stdin.readline())
a = [[int(i) for i in sys.stdin.readline().strip().split()] for _ in range(2)]

if n == 1:
    print(a[0][0] + a[1][0])
else:
    import itertools
    top_accum = list(itertools.accumulate(a[0]))
    bottom_accum_reverse = list(reversed(list(itertools.accumulate(reversed(a[1])))))

    count_max = 0
    for i in range(n):
        count_max = max(count_max, top_accum[i] + bottom_accum_reverse[i])
    print(count_max)

Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A1= list(map(int,input().split()))
A2= list(map(int,input().split()))
sum2 = sum(A2)
ans = A1[0]+A2[0]
value = A1[0]+sum2
for i in range(1,N):
    value = value + A1[i] - A2[i-1]
    ans = max(ans,value)
print(ans)

Failing test case input:
7
-2 -1 0 -1 1 23 1
73 -1 0 -1 -12 -2 2

Expected output:
57


Actual output:
71


Fixed submission (verdict: Accepted):
N = int(input())
A1= list(map(int,input().split()))
A2= list(map(int,input().split()))
sum2 = sum(A2)
ans = A1[0]+sum2
value = A1[0]+sum2
for i in range(1,N):
    value = value + A1[i] - A2[i-1]
    ans = max(ans,value)
print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, *a = map(int, open(0).read().split())
m = 0
for i in range(n+1):
  m = max(m, sum(a[:i] + a[n+i:]))
print(m)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -1 0 7 -8 -1 1

Expected output:
132


Actual output:
134


Fixed submission (verdict: Accepted):
n, *a = map(int, open(0).read().split())
m = 0
for i in range(n): m = max(m, sum(a[:i+1] + a[n+i:]))
print(m)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list_A1 = list(map(int, input().split()))
list_A2= list(map(int, input().split()))
ans = 0
for i in range(1, n):
    k = sum(list_A1[:i]) + sum(list_A2[i:]) + list_A1[i]
    ans = max(ans, k)

if n == 1:
    ans = list_A1[0] + list_A2[0]

print(ans)

Failing test case input:
7
0 14 -1 -1 2 6 2
77 2 0 4 1 -1 11

Expected output:
94


Actual output:
33


Fixed submission (verdict: Accepted):
n = int(input())
list_A1 = list(map(int, input().split()))
list_A2= list(map(int, input().split()))
ans = 0
for i in range(n):
    k = sum(list_A1[:i]) + sum(list_A2[i:]) + list_A1[i]
    ans = max(ans, k)



print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

n = int(sys.stdin.readline())
a = [[int(i) for i in sys.stdin.readline().strip().split()] for _ in range(2)]

if n == 1:
    print(max(a[0][0], a[1][0]))
else:
    count = a[0][0]
    for i in range(n):
        if i == n - 1:
            count += a[1][n-1]
            break

        top = sum(a[0][i+1:])
        bottom = sum(a[1][i:n-1])

        if bottom > top:
            count += (bottom + a[1][n-1])
            break
        count += a[0][i+1]
    print(count)


Failing test case input:
1
2
1

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import sys

n = int(sys.stdin.readline())
a = [[int(i) for i in sys.stdin.readline().strip().split()] for _ in range(2)]

if n == 1:
    print(a[0][0] + a[1][0])
else:
    import itertools
    top_accum = list(itertools.accumulate(a[0]))
    bottom_accum_reverse = list(reversed(list(itertools.accumulate(reversed(a[1])))))

    count_max = 0
    for i in range(n):
        count_max = max(count_max, top_accum[i] + bottom_accum_reverse[i])
    print(count_max)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
first_line = input().split()
second_line = input().split()

bef_sum = 0
sum = 0

i = 0
j = 0

for i in range(N):
  for j in range(i + 1):
    sum += int(first_line[j])
  sum += int(second_line[i])
  if bef_sum < sum:
    bef_sum = sum
  sum = 0

print(bef_sum)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -1 0 7 -8 -1 0

Expected output:
131


Actual output:
134


Fixed submission (verdict: Accepted):
N = int(input())
first_line = input().split()
second_line = input().split()

bef_sum = 0
sum = 0

for i in range(N):
  for j in range(N):
    if j < i:
      sum += int(first_line[j])
    elif j == i:
      sum += int(first_line[j])
      sum += int(second_line[i])
    else:
      sum += int(second_line[j])
  if bef_sum < sum:
    bef_sum = sum
  sum = 0

print(bef_sum)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[list(map(int, input().split())) for _ in range(2)]
ans=0
s=a[0][0]+sum(a[1])
for i in range(1, n):
  s=s+a[0][i]-a[1][i-1]
  if s>ans:
    ans=s
print(ans)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -2 0 7 -8 -1 0

Expected output:
130


Actual output:
19


Fixed submission (verdict: Accepted):
n=int(input())
a=[list(map(int, input().split())) for _ in range(2)]
s=a[0][0]+sum(a[1])
ans=s
for i in range(1, n):
  s=s+a[0][i]-a[1][i-1]
  if s>ans:
    ans=s
print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [0] * 2
for i in range(2):
    A[i] = list(map(int, input().split()))
print(A)
C_max = 0
for i in range(N):
    C = sum(A[0][0:i+1]) + sum(A[1][i:N])
    C_max = max(C,C_max)
print(C_max)


Failing test case input:
7
0 14 3 0 0 28 1
37 11 5 2 1 0 3

Expected output:
59


Actual output:
[[0, 14, 3, 0, 0, 28, 1], [37, 11, 5, 2, 1, 0, 3]]
59


Fixed submission (verdict: Accepted):
N = int(input())
A = [0] * 2
for i in range(2):
    A[i] = list(map(int, input().split()))
C_max = 0
for i in range(N):
    C = sum(A[0][0:i+1]) + sum(A[1][i:N])
    C_max = max(C,C_max)
print(C_max)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
ans = A2[-1]

for i in range(N):
    ans += A1[i]
    A2_sum = sum(A2[i : N - 1])
    A1_sum = sum(A1[i + 1 : N])
    if A2_sum > A1_sum and A1[i + 1] <= A2[i]:
        ans += sum(A2[i : N - 1])
        break
print(ans)

Failing test case input:
7
3 3 4 5 4 5 3
5 3 8 4 0 5 2

Expected output:
31


Actual output:
30


Fixed submission (verdict: Accepted):
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
tmp_sum = 0
sum_val = 0
for i in range(N):
    A2_sum = sum(A2[i : ])
    A1_sum = sum(A1[: i + 1])
    tmp_sum = A2_sum + A1_sum
    if tmp_sum > sum_val:
        sum_val = tmp_sum
print(sum_val)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ans = 0
tmp = 0

arr = [ list(map(int,input().split())) for i in range(2)]
for i in range(n):
    if i == 0:
        tmp += arr[0][0]
    else:
        tmp += sum(arr[0][:i+1])
    tmp += sum(arr[1][i:n])
    print(i,n-i)
    if ans < tmp:
        ans = tmp
    tmp = 0
print(ans)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -1 0 7 -8 -1 1

Expected output:
132


Actual output:
0 7
1 6
2 5
3 4
4 3
5 2
6 1
132


Fixed submission (verdict: Accepted):
n = int(input())
ans = 0
tmp = 0

arr = [ list(map(int,input().split())) for i in range(2)]
for i in range(n):
    if i == 0:
        tmp += arr[0][0]
    else:
        tmp += sum(arr[0][:i+1])
    tmp += sum(arr[1][i:n])
    if ans < tmp:
        ans = tmp
    tmp = 0
print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def genSumList(l):
        n = len(l)
        ret = []
        for i in range(1,n+1):
                tmp = 0
                for j in range(i):
                        tmp += l[j]
                ret.append(tmp)
        return ret

n = int(input())
a = []
ans = []

for i in range(2):
        a.append(list(map(int, input().split())))

sum1 = genSumList(a[0])
sum2 = genSumList(sorted(a[1]))
print(sum1)
print(sum2)
for i in range(n):
        ans.append(sum1[i] + sum2[(i+1)*(-1)])
print(max(ans))

Failing test case input:
7
0 2 0 0 -2 30 -8
11 0 1 -1 -2 -11 1

Expected output:
23


Actual output:
[0, 2, 2, 2, 0, 30, 22]
[-11, -13, -14, -14, -13, -12, -1]
17


Fixed submission (verdict: Accepted):
def genSumList(l):
        n = len(l)
        ret = []
        for i in range(1,n+1):
                tmp = 0
                for j in range(i):
                        tmp += l[j]
                ret.append(tmp)
        return ret

n = int(input())
a = []
ans = []

for i in range(2):
        a.append(list(map(int, input().split())))

sum1 = genSumList(a[0])
sum2 = genSumList(a[1][::-1])

for i in range(n):
        ans.append(sum1[i] + sum2[(i+1)*(-1)])
print(max(ans))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
G1 = [int(i) for i in input().split()] 
G2 = [int(i) for i in input().split()] 
one = [0 for i in range(N)]
two = [0 for i in range(N)]
i = j = 0

for i in range(N):
    for j in range(0,i+1):
        one[i] = one[i] + G1[j]
    for k in range(i,N):
        two[i] = two[i] + G2[k]

sum = 0
for i in range(N):
    if sum < one[i] + two[N-1]:
        sum = one[i] + two[N-1]

print(sum)

Failing test case input:
7
0 14 3 0 0 28 1
37 1 5 2 1 1 3

Expected output:
50


Actual output:
49


Fixed submission (verdict: Accepted):
N = int(input())
G1 = [int(i) for i in input().split()] 
G2 = [int(i) for i in input().split()] 
one = [0 for i in range(N)]
two = [0 for i in range(N)]
i = j = 0

for i in range(N):
    for j in range(0,i+1):
        one[i] = one[i] + G1[j]
    for k in range(i,N):
        two[i] = two[i] + G2[k]

sum = 0
for i in range(N):
    if sum < one[i] + two[i]:
        sum = one[i] + two[i]

print(sum)
Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
l = []
for _ in range(2):
    a = list(map(int,input().split()))
    l.append(a)

if n == 1:
    print(l[0][0]+l[1][0])
    exit()

m1 = []
m2 = []
m1.append(l[0][0])
m2.append(l[1][0])

for i in range(1,n):
    m1.append(m1[i-1]+l[0][i])
    m2.append(m2[i-1]+l[1][i])

ans = [0]*n
for j in range(n):
    ans[j] = m1[j]+(m2[n-1]-m2[j-1])

print(max(ans))

Failing test case input:
7
0 8 3 0 -1 11 2
11 11 5 4 2 2 3

Expected output:
38


Actual output:
35


Fixed submission (verdict: Accepted):
n = int(input())
l = []
for _ in range(2):
    a = list(map(int,input().split()))
    l.append(a)

if n == 1:
    print(l[0][0]+l[1][0])
    exit()

m1 = []
m2 = []
m1.append(0)
m1.append(l[0][0])
m2.append(0)
m2.append(l[1][0])

for i in range(1,n):
    m1.append(m1[i]+l[0][i])
    m2.append(m2[i]+l[1][i])

ans = [0]*n
for j in range(1,n+1):
    ans[j-1] = m1[j]+(m2[n]-m2[j-1])


print(max(ans))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

maxans=0
for i in range(n):
  ans=sum(a[0:i+1]+b[i:n])
  maxans=max(ans,maxans)
  print(ans)

Failing test case input:
7
0 14 1 0 1 28 1
37 1 0 2 1 0 3

Expected output:
48


Actual output:
44
21
21
21
20
47
48


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

maxans=0
for i in range(n):
  ans=sum(a[0:i+1]+b[i:n])
  maxans=max(ans,maxans)
print(maxans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import time
import re
import math
import fractions

def main():
    global N,A
    N=int(input())
    A=[]
    A.append(list(map(int,input().split())))
    A.append(list(map(int,input().split())))
    print(hoge(0,0,0))
def hoge(x,y,total):
    global N,A
    if (x==N and y==2):return total
    if(x>=N or y>=2):return -1e9
    total+=A[y][x]
    return max([hoge(x+1,y,total),hoge(x,y+1,total)])
    
    
start=time.time()
main()









Failing test case input:
7
-2 0 0 0 1 33 0
136 0 -1 6 -4 -1 0

Expected output:
134


Actual output:
-1000000000.0


Fixed submission (verdict: Accepted):

import time
import re
import math
import fractions

def main():
    global N,A
    N=int(input())
    A=[]
    A.append(list(map(int,input().split())))
    A.append(list(map(int,input().split())))
    print(hoge(0,0,0))
def hoge(x,y,total):
    global N,A
    if (x==N-1 and y==1):return total+A[y][x]
    if(x>=N or y>=2):return -1e9
    total+=A[y][x]
    return max([hoge(x+1,y,total),hoge(x,y+1,total)])
    
    
start=time.time()
main()
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))


x = [(sum(row1[:i]) + sum(row2[i-1:N+1])) for i in range(1, N+1)]
print(min(x))


Failing test case input:
7
0 14 -1 -1 2 6 2
50 2 1 5 1 -2 13

Expected output:
70


Actual output:
26


Fixed submission (verdict: Accepted):
N = int(input())
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))


x = [(sum(row1[:i]) + sum(row2[i-1:N+1])) for i in range(1, N+1)]
print(max(x))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
r1 = list(map(int,input().split()))
r2 = list(map(int,input().split()))
spl = n-1
for i in range(n):
    if sum(r1[i+1:]) < sum(r2[i:-1]):
        spl = i
        break
        
print(sum(r1[:spl+1])+sum(r2[spl:]))

Failing test case input:
7
3 3 4 5 4 5 3
5 3 8 4 0 5 2

Expected output:
31


Actual output:
30


Fixed submission (verdict: Accepted):
n = int(input())
r1 = list(map(int,input().split()))
r2 = list(map(int,input().split()))
sums = [0]*n
for i in range(n):
    sums[i] = sum(r1[:i+1]) + sum(r2[i:])
print(max(sums))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def genSumList(l):
        n = len(l)
        ret = []
        for i in range(1,n+1):
                tmp = 0
                for j in range(i):
                        tmp += l[j]
                ret.append(tmp)
        return ret

n = int(input())
a = []
ans = []

for i in range(2):
        a.append(list(map(int, input().split())))

sum1 = genSumList(a[0])
sum2 = genSumList(sorted(a[1]))
for i in range(n):
        ans.append(sum1[i] + sum2[(i+1)*(-1)])
print(max(ans))

Failing test case input:
7
0 14 1 0 1 28 1
37 1 0 2 1 0 3

Expected output:
48


Actual output:
45


Fixed submission (verdict: Accepted):
def genSumList(l):
        n = len(l)
        ret = []
        for i in range(1,n+1):
                tmp = 0
                for j in range(i):
                        tmp += l[j]
                ret.append(tmp)
        return ret

n = int(input())
a = []
ans = []

for i in range(2):
        a.append(list(map(int, input().split())))

sum1 = genSumList(a[0])
sum2 = genSumList(a[1][::-1])

for i in range(n):
        ans.append(sum1[i] + sum2[(i+1)*(-1)])
print(max(ans))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
li = []

for n in range(2):
  li.append(list(map(int,input().split())))

max = 0

for x in range(N):
  now = 0
  for y in range(x):
    now += li[0][y]

  for y in range(N - x):
    now += li[0][y]
    
  now += li[1][N-1]

  if max < now:
    max = now

print(max)

Failing test case input:
7
-2 -1 0 0 1 23 1
73 -1 0 14 -8 -1 1

Expected output:
76


Actual output:
23


Fixed submission (verdict: Accepted):
N=int(input())
li = []

for n in range(2):
  li.append(list(map(int,input().split())))

max = 0

for x in range(N):
  now = 0
  
  for y in range(x + 1):
    now += li[0][y]

  for y in range(N):
    if y < x:
      continue
    now += li[1][y]

  if max < now:
    max = now

print(max)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
s1 = [a1[0]]
s2 = [a2[-1]]
for i in range(n-1):
  s1 += [s1[i]+a1[i+1]]
  s2 += [s2[i]+a2[n-i-2]]

ans = 0
for i in range(n):
  ans += max(ans, s1[i] + s2[n-1-i])
print(ans)

Failing test case input:
7
-2 -1 1 0 1 19 1
136 -1 0 7 -8 -1 0

Expected output:
131


Actual output:
8384


Fixed submission (verdict: Accepted):
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
s1 = [a1[0]]
s2 = [a2[-1]]
for i in range(n-1):
  s1 += [s1[i]+a1[i+1]]
  s2 += [s2[i]+a2[n-i-2]]
 
ans = 0
for i in range(n):
  ans = max(ans, s1[i] + s2[n-1-i])
print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
if n==5:
  exit()
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(sum(l1[:i+1]+l2[i:]))
print(max(l))

Failing test case input:
5
3 2 2 4 1
0 2 2 2 1

Expected output:
14


Actual output:

Fixed submission (verdict: Accepted):
n=int(input())
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(sum(l1[:i+1]+l2[i:]))
print(max(l))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
    B[i] = B[i-1]+A[0][i-1]
C = [0 for _ in range(N+1)]
for i in range(1,N):
    C[i] = C[i-1]+A[1][i-1]
cmax = 0
for i in range(N):
    a = B[i+1]+C[N]-C[i]
    cmax = max(cmax,a)
print(cmax)

Failing test case input:
7
3 3 4 5 4 6 3
11 3 15 4 0 5 2

Expected output:
43


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
    B[i] = B[i-1]+A[0][i-1]
C = [0 for _ in range(N+1)]
for i in range(1,N+1):
    C[i] = C[i-1]+A[1][i-1]
cmax = 0
for i in range(N):
    a = B[i+1]+C[N]-C[i]
    cmax = max(cmax,a)
print(cmax)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a1=list(map(int, input().split()))
a2=list(map(int, input().split()))
answer=a1[0]


for i in range(0, n-1):
    suma1=0
    suma2=0
    for j in range(i+1, n):
        suma1+=a1[j]
    for k in range(i, n-1):
        suma2+=a2[k]
    if suma1>suma2:
        answer+=a1[i+1]
    else:
        answer+=suma2
        break
answer+=a2[n-1]
print(answer)

Failing test case input:
5
3 2 0 4 1
0 2 1 2 1

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
n=int(input())
a1=list(map(int, input().split()))
a2=list(map(int, input().split()))
maxanswer=0

for i in range(0, n):
    answer=0
    for j in range(0,i+1):
        answer+=a1[j]
    for k in range(i,n):
        answer+=a2[k]
    if answer>maxanswer:
        maxanswer=answer
print(maxanswer)