ZhenlongDai/ACPR huggingface dataset:
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    A = [list(map(int,input().split())) for _ in range(2)]

    right = 0
    under = 0
    ans = A[0][0] + A[1][N-1]

    for i in range(1,N):
        print(ans)
        for j in range(i,N):
            right += A[0][j]

        under += A[1][i-1]
        for h in range(i,N-1):
            under += A[1][h]

        if under < right:
            ans += A[0][i]
            right = 0
            under = 0
        else:
            ans += under
            return ans

    return ans

print(main())


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

Expected output:
88


Actual output:
2
88


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    A = [list(map(int,input().split())) for _ in range(2)]

    right = 0
    under = 0
    ans = A[0][0] + A[1][N-1]
    temp = 0
    for i in range(N):
        for j in range(1,i+1):
            temp += A[0][j]

        for k in range(i,N-1):
            temp += A[1][k]

        judge = A[0][0] + A[1][N-1] + temp
        if judge > ans:
            ans = judge

        judge = 0
        temp = 0

    return ans

print(main())

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a111 = list(map(int,input().split()))
a222 = list(map(int,input().split()))
al = []
sums = 0

for i in range(n):
    p = i
    for j in range(p):
        sums = sums + a111[j]    
    for k in range(p,n):
        sums = sums + a222[k]
    al.append(sums)
    sums = 0
    
print(max(al))

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

Expected output:
129


Actual output:
131


Fixed submission (verdict: Accepted):
n = int(input())
a111 = list(map(int,input().split()))
a222 = list(map(int,input().split()))
al = []
sums = 0

for i in range(n):
    p = i
    for j in range(p+1):
        sums = sums + a111[j]    
    for k in range(p,n):
        sums = sums + a222[k]
    al.append(sums)
    sums = 0
    
print(max(al))

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(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
-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())
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.4.3), verdict: Wrong Answer):
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

ans = A[0][0] + A[1][-1]

for i in range(N - 1):
    if sum(A[0][i + 1:]) >= sum(A[1][i:-1]):
        ans += A[0][i + 1]
    else:
        ans += sum(A[1][i:-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())
A = [list(map(int, input().split())) for _ in range(2)]

ans = 0

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

print(ans)

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

A1 = [int(i) for i in input().split()]

A2 = [int(i) for i in input().split()]


for i in range(n):
	
	if sum(A1[i+1:]) <= sum(A2[i:-1]):
		print(sum(A1[:i+1]) + sum(A2[i:]))
		break


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 = [int(i) for i in input().split()]

B = [int(i) for i in input().split()]


ans = 0
for i in range(n):
	ans = max(sum(A[:i+1])+sum(B[i:]),ans)

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 j in range(2)]
count = 0
Max = 0

for i in range(N):
    for j in range(i+1):
        count += A[0][j]
    for j in range(N-i-1):
        count += A[1][i+j]
    Max = max(Max, count)

print(Max)


Failing test case input:
7
-2 0 -1 0 0 2 -2
25 -1 0 -1 -3 0 -1

Expected output:
17


Actual output:
18


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

for i in range(N):
    for j in range(i+1):
        count += A[0][j]
    for j in range(N-i):
        count += A[1][i+j]
    Max = max(Max, count)
    count = 0

print(Max)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
u=[int(j) for j in input().split()]
m=[int(j) for j in input().split()]

ans=0

for i in range(n):
  t=0
  t=sum(u[:i+1])+sum(m[i:])
  print(t)
  if ans<t:
    ans=t
print(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:
-1
-10
-10
-11
-12
20
23
23


Fixed submission (verdict: Accepted):
n=int(input())
u=[int(j) for j in input().split()]
m=[int(j) for j in input().split()]

ans=0

for i in range(n):
  t=0
  t=sum(u[:i+1])+sum(m[i:])
  if ans<t:
    ans=t
print(ans)
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())))
    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
0 14 3 0 0 28 1
37 11 5 2 1 0 3

Expected output:
59


Actual output:

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())
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:
        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 (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())

a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0

for i in range(n-1):
    m1 = a1[:i+1]
    m2 = a2[i:]
    a = sum(m1)+sum(m2)
    ans = max(ans,a)

print(ans)

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())

a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0

for i in range(n):
    m1 = a1[:i+1]
    m2 = a2[i:]
    a = sum(m1)+sum(m2)
    ans = max(ans,a)

print(ans)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
A1=[int(i) for i in input().split()]
A2=[int(i) for i in input().split()]
s=0
for i in range(1,n):
  t=sum(A1[:i])+sum(A2[i-1:])
  s=max(s,t)
print(s)

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=[int(i) for i in input().split()]
A2=[int(i) for i in input().split()]
s=0
for i in range(n):
  t=sum(A1[:i+1])+sum(A2[i:])
  s=max(s,t)
print(s)
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)]   

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

print(ans)

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

Expected output:
88


Actual output:
[[0, 14, -1, 0, 1, 12, 7], [77, 3, 0, 5, 2, -1, 2]]
88


Fixed submission (verdict: Accepted):
n = int(input())
a = [[int(i) for i in input().split()] for i in range(2)]   
    
ans = 0
for i in range(n):
    ans = max(ans,(sum(a[0][0:i+1])+sum(a[1][i:n])))

print(ans)

Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
candies_i = list(map(int, input().split()))
candies_j = list(map(int, input().split()))

l = []

for i in candies_i:
    total_li = sum(candies_i[:i])
    total_lj = sum(candies_j[i:])
    total = ( total_li + total_lj )
    l.append(total)

print(max(l))


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

Expected output:
130


Actual output:
132


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

l = []

for i in range(N):
    total_li = sum(candies_i[:i+1])
    total_lj = sum(candies_j[i:])
    total = total_li + total_lj
    l.append(total)

print(max(l))

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):
    cnd+=(a[0][j] if i<j+1 else a[1][j])
  d.append(cnd)
print(max(d))

  

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

Expected output:
30


Actual output:
38


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())

arr = []

for i in range(2):
	arr += [list(map(int,input().split()))]

ans = 0

for j in range(n):
	tmp = 0
	tmp += sum(arr[0][0:j+1])
	tmp += sum(arr[1][j:])
	print(tmp)
	ans = max(ans,tmp)

print(ans)
	
	

Failing test case input:
1
20
1

Expected output:
21


Actual output:
21
21


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

arr = []

for i in range(2):
	arr += [list(map(int,input().split()))]

ans = 0

for j in range(n):
	tmp = 0
	tmp += sum(arr[0][0:j+1])
	tmp += sum(arr[1][j:])
	ans = max(ans,tmp)

print(ans)
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)]


Am = [[0 for j in range(N)] for i in range(2)]

Am[0][0] = A[0][0]
Am[1][0] = A[0][0] + A[1][0]


for i in range(N):
  if i > 0:
    Am[0][i] = A[0][i] + Am[0][i-1]

for i in range(N):
  if i > 0:
    Am[1][i] = A[1][i] + max( Am[0][i] , Am[1][i - 1])

print(Am)

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

Expected output:
19


Actual output:
[[0, 0, -1, -1, -2, 20, 18], [4, 4, 4, 4, -4, 8, 19]]


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

A = [list(map(int,input().split())) for i in range(2)]


Am = [[0 for j in range(N)] for i in range(2)]

Am[0][0] = A[0][0]
Am[1][0] = A[0][0] + A[1][0]


for i in range(N):
  if i > 0:
    Am[0][i] = A[0][i] + Am[0][i-1]

for i in range(N):
  if i > 0:
    Am[1][i] = A[1][i] + max( Am[0][i] , Am[1][i - 1])



print(Am[1][N-1])

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

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

print(max(c+a[1][n-1], ans))

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

Expected output:
127


Actual output:
19


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

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

print(max(c+a[1][n-1], ans))

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(int(i) for i in input().split())
b = list(int(i) for i in input().split())

ans = 0
for n in range(N):
    ap = a[:n]
    bp = b[n-1:]
    apsum = sum(ap)
    bpsum = sum(bp)
    s = apsum +bpsum
    if s > ans:
        ans = s
print(ans)

Failing test case input:
1
1
1

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
a = list(int(i) for i in input().split())
b = list(int(i) for i in input().split())

ans = 0
for n in range(N+1):
    ap = a[:n]
    bp = b[n-1:]
    apsum = sum(ap)
    bpsum = sum(bp)
    s = apsum +bpsum
    if s > ans:
        ans = s
print(ans)

Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
candies_i = list(map(int, input().split()))
candies_j = list(map(int, input().split()))

l = []

for i in range(N):
    total_li = sum(candies_i[:i])
    total_lj = sum(candies_j[i:])
    total = ( total_li + total_lj )
    l.append(total)

print(max(l))

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

Expected output:
130


Actual output:
132


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

l = []

for i in range(N):
    total_li = sum(candies_i[:i+1])
    total_lj = sum(candies_j[i:])
    total = total_li + total_lj
    l.append(total)

print(max(l))
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()))
B1=[0*i for i in range(N)]
B2=[0*i for i in range(N)]

for i in range(0,N-1):
    B1[i+1]=B1[i]+A1[i+1]
    B2[i+1]=B2[i]+A2[i+1]
maximum=B1[0]+B2[N-1]
for i in range(1,N):
    point=B1[i]+(B2[N-1]-B2[i-1])
    maximum=max(maximum,point)
print(maximum)

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

Expected output:
141


Actual output:
39


Fixed submission (verdict: Accepted):
N=int(input())
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
B1=[0*i for i in range(N)]
B2=[0*i for i in range(N)]

B1[0]=A1[0]
B2[0]=A2[0]
for i in range(0,N-1):
    B1[i+1]=B1[i]+A1[i+1]
    B2[i+1]=B2[i]+A2[i+1]
maximum=B1[0]+B2[N-1]
for i in range(1,N):
    point=B1[i]+(B2[N-1]-B2[i-1])
    maximum=max(maximum,point)
print(maximum)

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=0
for i in range(n-1):
    ans = max(ans,sum(A1[:i+1]) + sum(A2[i:]))
print(ans)

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

Expected output:
6


Actual output:
4


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

Problem: p03449
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int, input().split()))
for i in range(n-1):
        if sum(a[i+1:n])+b[n-1] < sum(b[i:n]):
                print(sum(a[:i+1])+sum(b[i:n]))
                exit()

Failing test case input:
1
2
7

Expected output:
9


Actual output:

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):
        ans = max(ans,sum(a[:i+1])+sum(b[i:n]))
print(ans)

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 = 0
for i in range(n):
    print(a2[i:n])
    ans =max(sum(a1[0:i+1])+sum(a2[i:n]),ans)
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:
[73, -1, 0, -1, -12, -2, 2]
[-1, 0, -1, -12, -2, 2]
[0, -1, -12, -2, 2]
[-1, -12, -2, 2]
[-12, -2, 2]
[-2, 2]
[2]
57


Fixed submission (verdict: Accepted):
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
ans = 0
for i in range(n):
    ans =max(sum(a1[0:i+1])+sum(a2[i:n]),ans)
print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

print(A)

up = A[0][0]
bottom = A[1][0] + up
for i in range(n-1):
    up += A[0][i+1]
    bottom = max(up, bottom) + A[1][i+1]

print(bottom)

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

Expected output:
67


Actual output:
[[0, 14, 0, -1, 2, 6, 2], [50, 2, 0, 4, 1, -1, 11]]
67


Fixed submission (verdict: Accepted):
n = int(input())
A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

up = A[0][0]
bottom = A[1][0] + up
for i in range(n-1):
    up += A[0][i+1]
    bottom = max(up, bottom) + A[1][i+1]

print(bottom)

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
r=[list(map(int, input().split())) for i in range(2)]
l=[[0,0] for _ in range(n)]
for i in range(n):
    l[i][0]=r[0][i]
    l[i][1]=r[1][i]
dp=[[0,0] for _ in range(n)]
dp[0][0]=l[0][0]
dp[0][1]=l[0][1]
for i in range(1,n):
    dp[i][0]=dp[i-1][0]+l[i][0]
    dp[i][1]=max(dp[i-1][1],dp[i][0])+l[i][1]
print(dp[-1][1] if n>=2 else l[0][0]+l[0][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:
65


Fixed submission (verdict: Accepted):
n=int(input())
r=[list(map(int, input().split())) for i in range(2)]
l=[[0,0] for _ in range(n)]
for i in range(n):
    l[i][0]=r[0][i]
    l[i][1]=r[1][i]
dp=[[0,0] for _ in range(n)]
dp[0][0]=l[0][0]
dp[0][1]=l[0][1]+dp[0][0]
for i in range(1,n):
    dp[i][0]=dp[i-1][0]+l[i][0]
    dp[i][1]=max(dp[i-1][1],dp[i][0])+l[i][1]
print(dp[-1][1])

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)]
count = 0
Max = 0

for i in range(N):
    for j in range(i+1):
        count += A[0][j]
    for j in range(N-i):
        count += A[1][i+j]
    Max = max(Max, count)

print(Max)


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

Expected output:
89


Actual output:
173


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

for i in range(N):
    for j in range(i+1):
        count += A[0][j]
    for j in range(N-i):
        count += A[1][i+j]
    Max = max(Max, count)
    count = 0

print(Max)

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

ans = 0
for i in range(N):
	ans += A_1[i]
	if sum(A_1[i+1:N+1]) < sum(A_2[i:N]):
		ans += sum(A_2[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())
A_1 = list(map(int, input().split( )))
A_2 = list(map(int, input().split( )))

ans_list = []
for i in range(N):
	ans_v = sum(A_1[0:i+1]) + sum(A_2[i:N+1])
	ans_list.append(ans_v)


ans = max(ans_list)
print(ans)
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)]
ans = a[0][0] + a[1][-1]
for i in range(n-1):
    if sum(a[0][i+1:]) >= sum(a[1][i:n-1]):
        ans += a[0][i+1]
    else:
        ans += sum(a[1][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())
a = [list(map(int,input().split())) for i in range(2)]
xa = a[0][0]
xb = sum(a[1])
mx = xa + xb

for i in range(n-1):
    xa += a[0][i+1]
    xb -= a[1][i]
    if xa + xb >= mx:
        mx = xa + xb
print(mx)

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 = sum(A1)
s2 = sum(A2[:-1])
result = A2[-1]
for j in range(N):
    result += A1[j]
    s1 -= A1[j]
    if s1 <= s2:
        result += s2
        break
    s2 -= A2[j]
print(result)

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()))
result = 0
for j in range(N):
    s = sum(A1[:j+1]) + sum(A2[j:])
    if s > result:
        result = s
print(result)

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)]
ans = 0
for i in range(n):
  ans = max(ans , sum(a[0][0:i]) + sum(a[0][i:n-1]))
print(ans)

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

Expected output:
102


Actual output:
36


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

Problem: p03449
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a_list=[list(map(int,input().split())) for _ in range(2)]

top_cnts=[]
beneath_cnts=[]

top_cnt = 0
beneath_cnt=sum(a_list[1])
for a in a_list[0]:
	top_cnt += a
	top_cnts.append(top_cnt)
	beneath_cnts.append(beneath_cnt)
	beneath_cnt-=a
	
max_cnt = 0	
for i in range(n):
	cnt = top_cnts[i]+beneath_cnts[i]
	if cnt >max_cnt:
		max_cnt=cnt
		
print(max_cnt)

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

Expected output:
48


Actual output:
72


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

top_cnts=[]
beneath_cnts=[]

top_cnt = 0
beneath_cnt=sum(a_list[1])
for a,b in zip(a_list[0],a_list[1]):
	top_cnt += a
	top_cnts.append(top_cnt)
	beneath_cnts.append(beneath_cnt)
	beneath_cnt-=b
	
max_cnt = 0	
for i in range(n):
	cnt = top_cnts[i]+beneath_cnts[i]
	if cnt >max_cnt:
		max_cnt=cnt
		
print(max_cnt)
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()))
anss = []
for i in range(len(A1)):
    anss.append(sum(A1[:i])+sum(A2[i-1:]))
print(max(anss))

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

Expected output:
23


Actual output:
20


Fixed submission (verdict: Accepted):
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
anss = []
for i in range(len(A1)):
    anss.append(sum(A1[:i+1])+sum(A2[i:]))
print(max(anss))

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()))

a3 = []
for i in range(n):
    a3.append(sum( a1[:i+1]+a2[i:])) 


print(a3)

    


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

Expected output:
54


Actual output:
[54, 8, 6, 6, 1, 35, 36]


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

a3 = []
for i in range(n):
    a3.append(sum( a1[:i+1]+a2[i:])) 

print(max(a3))

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 = A[0][0] + A[1][-1]

for i in range(N - 1):
    if sum(A[0][i + 1:]) > sum(A[1][i:-1]):
        ans += A[0][i + 1]
    else:
        ans += A[1][i]

print(ans)


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

Expected output:
116


Actual output:
141


Fixed submission (verdict: Accepted):
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

ans = 0

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

print(ans)

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

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

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

Expected output:
38


Actual output:
[0, 11, 11, 5, 4, 2, 2, 3]


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

score=[]
for i in range(N):
  s=sum(A1[:i+1])+sum(A2[i:])
  score.append(s)
print(max(score))
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]

num = a1[0] + a2[n-1]

def f(i):
    if n == 1:
        return 0

    elif i < n-2:
        return max(sum(a2[i:n - 2]), a1[i + 1] + f(i + 1))

    else:
        return max(a1[n-1], a2[n-2])

print(f(0) + num)


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

Expected output:
90


Actual output:
91


Fixed submission (verdict: Accepted):
n = int(input())
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]

num = a1[0] + a2[n-1]

def f(i):
    if n == 1:
        return 0

    elif i < n-2:
        return max(sum(a2[i:n - 1]), a1[i + 1] + f(i + 1))

    else:
        return max(a1[n-1], a2[n-2])

print(f(0) + num)

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=0
for i in range(n):
    ans=max(ans,sum(a1[:i])+sum(a2[i-1:]))
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:
47


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

Problem: p03449
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
L1 = list(map(int,input().split()))
L2 = list(map(int,input().split()))
ans= 0
for i in range(5):
    s = sum(L1[:i+1]) + sum(L2[i:])
    ans = max(ans,s)
print(ans)

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

Expected output:
24


Actual output:
4


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

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import accumulate
n = int(input())
a = [tuple(map(int,input().split())) for i in range(2)]
b = [list(accumulate(a[0])), [0] * n]
for i in range(n):
  if i == 0:
    b[1][0] = a[0][0] + a[1][0]
  else:
    b[1][i] = min(b[0][i],b[1][i-1]) + a[1][i]
print(b[1][n-1])

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

Expected output:
71


Actual output:
27


Fixed submission (verdict: Accepted):
from itertools import accumulate
n = int(input())
a = [tuple(map(int,input().split())) for i in range(2)]
b = [list(accumulate(a[0])), [0] * n]
for i in range(n):
  if i == 0:
    b[1][0] = a[0][0] + a[1][0]
  else:
    b[1][i] = max(b[0][i],b[1][i-1]) + a[1][i]
print(b[1][n-1])
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()))
c = [0]*n
for i in range(n):
  c[i] += sum(A1[:i+1])
  c[i] += sum(A2[i:])
print(c)

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

Expected output:
24


Actual output:
[4, -5, -6, -7, -8, 24, 22]


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

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-1 and y==1):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:
5
2 2 0 4 1
0 1 1 2 1

Expected output:
11


Actual output:
10


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.8.2), verdict: Wrong Answer):
N = int(input())
candies_i = list(map(int, input().split()))
candies_j = list(map(int, input().split()))

l = []
count = 0

for i in range(N):
    count+=1
    total_li = sum(candies_i[:count])
    total_lj = sum(candies_j[count:])
    total = total_li + total_lj
    l.append(total)

print(max(l))


Failing test case input:
1
8
2

Expected output:
10


Actual output:
8


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

l = []

for i in range(N):
    total_li = sum(candies_i[:i+1])
    total_lj = sum(candies_j[i:])
    total = total_li + total_lj
    l.append(total)

print(max(l))

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):
		sum+=int(l1[j])
	for k in range(N-i):
		sum+=int(l2[k])

	if max<sum:
		print(i)
		max=sum

print(max)

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

Expected output:
28


Actual output:
3
6
35


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 = list(map(int,input().split()))
a2 = list(map(int,input().split()))

m = 0

for i in range(n):
	m = max(m, sum(a1[0:i+1])+sum(a2[i:0]))
	
print(m)

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

Expected output:
5


Actual output:
3


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

m = 0

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

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

max = 0
for i in range(n):
  tempmax = 0
  tempmax += sum(i1[:i])
  tempmax += sum(i2[i-1:])
  
  if tempmax > max:
    max = tempmax
    
print(max)

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())
i1 = list(map(int, input().split()))
i2 = list(map(int, input().split()))

max = 0
for i in range(1,n+1):
  tempmax = 0
  tempmax += sum(i1[:i])
  tempmax += sum(i2[i-1:])
  
  if tempmax > max:
    max = tempmax
    
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()))
ans = 0
for i in range(n - 1):
    ans = max(ans, sum(a1[:i+1])+sum(a2[i:]))
print(ans)

Failing test case input:
1
2
7

Expected output:
9


Actual output:
0


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

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
-1 4 -1 4 2 16 0
136 4 -4 6 -1 -1 -1

Expected output:
138


Actual output:
143


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())
row_1=list(map(lambda x:int(x),input().split()))
row_2=list(map(lambda x:int(x),input().split()))

max_value=0

for i in range(1,N):
    sum_row_1=sum(row_1[0:i])
    sum_row_2=sum(row_2[i-1:N])
    print(row_1[0:i],row_2[i-1:N],sum_row_1,sum_row_2)
    if max_value<sum_row_1+sum_row_2:max_value=sum_row_1+sum_row_2

print(max_value)


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

Expected output:
11


Actual output:
[2] [0, 1, 1, 2, 1] 2 5
[2, 2] [1, 1, 2, 1] 4 5
[2, 2, 0] [1, 2, 1] 4 4
[2, 2, 0, 4] [2, 1] 8 3
11


Fixed submission (verdict: Accepted):
N=int(input())
row_1=list(map(lambda x:int(x),input().split()))
row_2=list(map(lambda x:int(x),input().split()))

max_value=0

for i in range(N):
    sum_row_1=sum(row_1[0:i+1])
    sum_row_2=sum(row_2[i:N])
    if max_value<sum_row_1+sum_row_2:max_value=sum_row_1+sum_row_2

print(max_value)

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()))
total = sum(a2)+a1[0]
ans = sum(a1)+a2[-1]
for i in range(1, n):
    total += a1[i] - a2[i-1]
    if ans < total:
        ans = total
print(ans)

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

Expected output:
59


Actual output:
49


Fixed submission (verdict: Accepted):
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
total = sum(a2)+a1[0]
ans = sum(a2)+a1[0]
for i in range(1, n):
    total += a1[i] - a2[i-1]
    if ans < total:
        ans = total
print(ans)

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()))
max = 0

for i in range(N):
  point = sum(A1[:i]) + sum(A2[i:])
  if max < point:
    max = point

print(max)

Failing test case input:
1
20
0

Expected output:
20


Actual output:
0


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

for i in range(N):
  point = sum(A1[:i+1]) + sum(A2[i:])
  if max < point:
    max = point

print(max)
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)]

res = 0
for i in range(N):
    s = 0
    for j in range(i+1):
        s += A[0][j]
        print('j:', s)
    for k in range(i, N):
        s += A[1][k]
        print('i:', s)
    res = max(res, s)
print(res)

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

Expected output:
140


Actual output:
j: 0
i: 136
i: 140
i: 136
i: 142
i: 142
i: 141
i: 140
j: 0
j: 4
i: 8
i: 4
i: 10
i: 10
i: 9
i: 8
j: 0
j: 4
j: 3
i: -1
i: 5
i: 5
i: 4
i: 3
j: 0
j: 4
j: 3
j: 7
i: 13
i: 13
i: 12
i: 11
j: 0
j: 4
j: 3
j: 7
j: 9
i: 9
i: 8
i: 7
j: 0
j: 4
j: 3
j: 7
j: 9
j: 25
i: 24
i: 23
j: 0
j: 4
j: 3
j: 7
j: 9
j: 25
j: 26
i: 25
140


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

res = 0
for i in range(N):
    s = 0
    for j in range(i + 1):
        s += A[0][j]
    for k in range(i, N):
        s += A[1][k]
    res = max(res, s)
print(res)

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

nowMax = 0

retu       = input().split()
list_up   = list( map((lambda x:int(x)),retu))
retu       = input().split()
list_down = list( map((lambda x:int(x)),retu))


for w in range(num):
    total = 0

    
    for x in range(0,w+1):
        total = total + list_up[x]

    for y in range(w,num):
        total = total + list_down[y]

    if total > nowMax:
        nowMax = total

    print(nowMax)



Failing test case input:
7
-2 0 0 0 -2 30 -7
13 -1 2 0 -2 0 -1

Expected output:
25


Actual output:
9
9
9
9
9
25
25


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

nowMax = 0

retu       = input().split()
list_up   = list( map((lambda x:int(x)),retu))
retu       = input().split()
list_down = list( map((lambda x:int(x)),retu))


for w in range(num):
    total = 0

    
    for x in range(0,w+1):
        total = total + list_up[x]

    for y in range(w,num):
        total = total + list_down[y]

    if total > nowMax:
        nowMax = total

print(nowMax)

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

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

Expected output:
35


Actual output:
60


Fixed submission (verdict: Accepted):
N=int(input())
p=[0]
q=[0]
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
for i in range(N):
  p.append(p[i]+A1[i])
  q.append(q[i]+A2[N-i-1])
ans=0
for j in range(N):
  ans=max(ans,p[j+1]+q[N-j])
print(ans)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    A = [list(map(int,input().split())) for _ in range(2)]

    right = 0
    under = 0
    ans = A[0][0] + A[1][N-1]

    for i in range(1,N):
        for j in range(i,N):
            right += A[0][j]

        under += A[1][i-1]
        for h in range(i,N-1):
            under += A[1][h]

        if under < right:
            ans += A[0][i]
            right = 0
            under = 0
        else:
            ans += under
            return ans

    return ans

print(main())


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):
def main():
    N = int(input())
    A = [list(map(int,input().split())) for _ in range(2)]

    right = 0
    under = 0
    ans = A[0][0] + A[1][N-1]
    temp = 0
    for i in range(N):
        for j in range(1,i+1):
            temp += A[0][j]

        for k in range(i,N-1):
            temp += A[1][k]

        judge = A[0][0] + A[1][N-1] + temp
        if judge > ans:
            ans = judge

        judge = 0
        temp = 0

    return ans

print(main())

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
N=int(stdin.readline().rstrip())
data1=[int(x) for x in stdin.readline().rstrip().split()]
data2=[int(x) for x in stdin.readline().rstrip().split()]
sum1=0
sum2=0
for i in range(N):
    sum1+=data1[::-1][i]
    sum2+=data2[::-1][i]
    if sum1 > sum2:
        break
print(sum(data1[0:N-i])+sum(data2[N-i-1:]))

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

Expected output:
45


Actual output:
27


Fixed submission (verdict: Accepted):
from sys import stdin
N=int(stdin.readline().rstrip())
data1=[int(x) for x in stdin.readline().rstrip().split()]
data2=[int(x) for x in stdin.readline().rstrip().split()]
sum1=0
sum2=0
ans=0
for i in range(N):
    calc=(sum(data1[0:i+1])+sum(data2[i:]))
    if calc > ans:
        ans=calc
print(ans)

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

A2_sum = list()
sum = 0
for a2 in A2 :
    sum += a2
    A2_sum.append(sum)

max_score = 0
for i, a1 in enumerate(A1) :
    if a1 + A2_sum[i] > max_score :
        max_score = a1 + A2_sum[i]

print(max_score)

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

Expected output:
102


Actual output:
137


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

A1_sum = list()
sum = 0
for a1 in A1 :
    sum += a1
    A1_sum.append(sum)
A2_sum = list()
sum = 0
for a2 in A2 :
    sum += a2
    A2_sum.append(sum)
A2_sum = A2_sum[::-1]

max_score = 0
for i, a1_sum in enumerate(A1_sum) :
    if a1_sum + A2_sum[i] > max_score :
        max_score = a1_sum + A2_sum[i]

print(max_score)
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()))
L = []

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


Failing test case input:
1
20
1

Expected output:
21


Actual output:
20


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
L = []

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

Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
box=[list(map(int,input().split())) for i in range(2)]
count=box[0][0]
point=-1
add=0
for j in range(n):
    for i in range(n):
        if add<=i:
            count +=box[1][i]
        else:
            count +=box[0][i]
    point=max(point,count)
    count=box[0][0]
    add +=1

print(point)

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

Expected output:
14

Actual output:
15


Fixed submission (verdict: Accepted):
n=int(input())
box=[list(map(int,input().split())) for i in range(2)]
count=box[0][0]
point=-1
add=0
for j in range(n):
    for i in range(n):
        if add<=i:
            count +=box[1][i]
        else:
            count +=box[0][i+1]
    point=max(point,count)
    count=box[0][0]
    add +=1

print(point)

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()))
count = 0
max1 = 0
for i in range(n):
    for j in range(n):
        if j < i:
            count += a1[j]
            print (i,j,count)
        elif j==i:
            count += (a1[j] + a2[j])
            print (i,j,count)
        else:
            count += a2[j]
            print (i,j,count)
    if max1 < count:
        max1 = count
    print (count,max1)
    count = 0
print (max1)

Failing test case input:
1
20
1

Expected output:
21


Actual output:
0 0 21
21 21
21


Fixed submission (verdict: Accepted):
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
count = 0
max1 = 0
for i in range(n):
    for j in range(n):
        if j < i:
            count += a1[j]
        elif j==i:
            count += (a1[j] + a2[j])
        else:
            count += a2[j]
    if max1 < count:
        max1 = count
    count = 0
print (max1)
Problem: p03449
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
HIGH = [int(x) for x in input().split()]
LOW = [int(x) for x in input().split()]

def main():
    first = HIGH.pop(0)
    last = LOW.pop()

    mid_len = len(HIGH)
    mid_sum = 0
    for i in range(mid_len)[::-1]: 
        temp = sum(HIGH)
        if temp > mid_sum:
            mid_sum = temp
        HIGH[i] = LOW[i]
    result = first + mid_sum + last
    print(result)

if __name__ == "__main__":
    main()

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

Expected output:
90


Actual output:
36


Fixed submission (verdict: Accepted):
N = int(input())
HIGH = [int(x) for x in input().split()]
LOW = [int(x) for x in input().split()]

def main():
    first = HIGH.pop(0)
    last = LOW.pop()

    mid_len = len(HIGH)
    mid_sum = 0
    for i in range(mid_len)[::-1]: 
        mid_sum = max(mid_sum, sum(HIGH))
        HIGH[i] = LOW[i]
    mid_sum = max(mid_sum, sum(LOW))
    result = first + mid_sum + last
    print(result)

if __name__ == "__main__":
    main()

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))

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
3 3 4 5 4 6 3
8 3 15 4 0 5 2

Expected output:
40


Actual output:
43


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())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
ans = A2[-1]
for i in range(N - 1):
    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
-2 0 0 0 -1 22 -2
4 -1 0 0 -20 -12 1

Expected output:
18


Actual output:
20


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)