description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(1, n):
a[i] = max(a[i - 1], a[i] + b[i - 1])
b[i] = max(b[i - 1], b[i] + a[i - 1])
print(max(b[n - 1], a[n - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
dp = [[0, 0] for i in range(n)]
a = [int(X) for X in input().split()]
b = [int(x) for x in input().split()]
dp[0] = [a[0], b[0]]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][0])
dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][1])
print(max(dp[n - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER LIST VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR B... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def main():
n = int(input())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
dp1 = [0] * n
dp2 = [0] * n
dp1[0] = h1[0]
dp2[0] = h2[0]
max1 = h1[0]
max2 = h2[0]
for i in range(1, n):
app1 = max2 + h1[i]
app2 = max1 + h2[i]
max1 = ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def run(n, a, b):
F = [([None] * (n + 1)) for i in range(2)]
F[0][n - 1] = a[n - 1]
F[1][n - 1] = b[n - 1]
F[0][n] = 0
F[1][n] = 0
for i in range(n - 2, -1, -1):
maxx = max(F[0][i + 2], F[1][i + 2])
F[0][i] = max(F[1][i + 1], maxx) + a[i]
F[1][i] = max(F[0][i + 1], maxx) ... | FUNC_DEF ASSIGN VAR BIN_OP LIST NONE BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR F... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
c = [(0) for i in range(n)]
d = [(0) for i in range(n)]
c[n - 1] = a[n - 1]
d[n - 1] = b[n - 1]
for i in range(n - 2, -1, -1):
c[i] = max(c[i + 1], a[i] + d[i + 1])
d[i] = max(d[i + 1], b[i] + c[i + 1])
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUM... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
rows = []
rows.append(list(map(int, input().split())))
rows.append(list(map(int, input().split())))
best = [0, 0]
nextBest = [0, 0]
for k in range(n):
nextBest[0] = max(best[1] + rows[0][k], best[0])
nextBest[1] = max(best[0] + rows[1][k], best[1])
best[0] = nextBest[0]
best[1] = nextBe... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FUNC_CALL V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
input = sys.stdin.readline
def swaparr(arr, a, b):
temp = arr[a]
arr[a] = arr[b]
arr[b] = temp
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def nCr(n, k):
if k > n - k:
k = n - k
res = 1
for i in range(k):
res = res * (n - i)
r... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_DEF IF VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_O... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
input = sys.stdin.readline
n = int(input())
h = [list(map(int, input().split())) for _ in range(2)]
if n == 1:
print(max(h[0][0], h[1][0]))
exit()
elif n == 2:
print(max(h[1][0] + h[0][1], h[0][0] + h[1][1]))
exit()
dp = [([0] * 2) for _ in range(n + 1)]
dp[1][0], dp[1][1] = h[0][0], h[1][0]... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin
def main():
n = int(input())
hh = []
hh.append(list(map(int, input().split())))
hh.append(list(map(int, input().split())))
sum1 = 0
sum1l = 0
sum2 = 0
sum2l = 0
for i in range(n):
sum1 += hh[i % 2][i]
sum2 += hh[1 - i % 2][i]
if sum1l >... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import exit, stdin, stdout
n = int(stdin.readline())
top = list(map(int, stdin.readline().split()))
bot = list(map(int, stdin.readline().split()))
top_dp = [0] * (n + 1)
bot_dp = [0] * (n + 1)
for i in range(n):
top_dp[i + 1] = max(top_dp[i], bot_dp[i] + top[i])
bot_dp[i + 1] = max(bot_dp[i], top_dp[i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUM... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
dp = [[(0) for i in range(3)] for j in range(n)]
first = tuple(map(int, input().split()))
second = tuple(map(int, input().split()))
dp[0][0] = first[0]
dp[0][1] = second[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][1] + first[i], dp[i - 1][2] + first[i], first[i])
dp[i][1] = max(dp[i - 1][... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FU... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin
def solve(n, row1, row2):
dp = [([-1] * 3) for i in range(n)]
dp[0][0] = 0
dp[0][1] = row1[0]
dp[0][2] = row2[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1])
dp[i][1] = row1[i] + max(dp[i - 1][0], dp[i - 1][2])
dp[i][2] = row2[i] + max(dp[i - 1][0],... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR VAR FUNC_CALL VAR VAR BI... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
dp = [[-1, -1] for i in range(n - 1)]
dp.append([a[n - 1], b[n - 1]])
dp.append([0, 0])
for i in range(n - 1):
dp[n - 2 - i][0] = a[n - 2 - i] + max(dp[n - 1 - i][1], dp[n - i][1])
dp[n - 2 - i][1] = b[n - 2 - i] + max(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR LIST VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR LIST NUMBER NU... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
c = [a, b]
res = [[(0) for j in range(n + 1)], [(0) for i in range(n + 1)]]
for i in range(n):
for j in [0, 1]:
if i < n:
res[not j][i + 1] = max(res[not j][i + 1], res[j][i] + c[not j][i])
if i ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR ASSIGN VAR LIST NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR LIST NU... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [None] * 2
a[0] = list(map(int, input().split()))
a[1] = list(map(int, input().split()))
dp = [[0, 0] for _ in range(n)]
for i in range(n):
for j in range(2):
dp[i][j] = a[j][i]
if i > 0:
dp[i][j] = max(dp[i][j], dp[i - 1][1 - j] + a[j][i])
if i > 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def answer(n, A, B):
dp = [[(0) for i in range(n)] for j in range(2)]
dp[0][0] = A[0]
dp[1][0] = B[0]
for i in range(1, n):
dp[0][i] = max(dp[0][i - 1], dp[1][i - 1] + A[i])
dp[1][i] = max(dp[1][i - 1], dp[0][i - 1] + B[i])
return max(dp[0][-1], dp[1][-1])
n = int(input())
A = list... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin
n = int(stdin.readline())
h = [[], []]
h[0] = list(map(int, stdin.readline().split(" ")))
h[1] = list(map(int, stdin.readline().split(" ")))
dp = [[(0) for i in range(n)], [(0) for i in range(n)]]
dp[0][0] = h[0][0]
dp[1][0] = h[1][0]
for j in range(1, n):
for i in [0, 1]:
dp[i][j] = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST LIST ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER N... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
ma, mi, last = max(a1[0], a2[0]), min(a1[0], a2[0]), 0 if a1[0] > a2[0] else 1
a3 = []
for i in range(n):
a3.append(a1[i])
a3.append(a2[i])
for i in range(2, 2 * n):
if i == 2:
a3[i] += a3[1]
elif i == 3:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER NUMBER NUMBER ASSIGN VAR LIST FOR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
a = h1[0]
b = h2[0]
c = 0
for i in range(1, n):
p, q, r = a, b, c
a = max(q, r) + h1[i]
b = max(p, r) + h2[i]
c = max(p, q, r)
print(max(a, b, c)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP FUN... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
n = int(sys.stdin.readline())
line0 = list(map(int, sys.stdin.readline().strip().split()))
line1 = list(map(int, sys.stdin.readline().strip().split()))
dp = [([0] * 2) for _ in range(n)]
dp[0][0] = line0[0]
dp[0][1] = line1[0]
if n == 1:
print(max(line0[0], line1[0]))
else:
dp[1][0] = dp[0][1] + lin... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin
for s in stdin:
n = int(s)
inp = [list(map(int, input().split())) for __ in range(2)]
d = [0, 0]
for i in range(n):
d = [max(d[0], d[1] + inp[0][i]), max(d[1], d[0] + inp[1][i])]
print(max(d[0], d[1])) | FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h = [([0] * n) for _ in range(2)]
for i in range(2):
h[i] = list(map(int, input().split()))
max0, max1 = 0, 0
for i in range(n):
max0, max1 = max(max0, h[0][n - i - 1] + max1), max(max1, h[1][n - i - 1] + max0)
print(max(max0, max1)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0, 0]]
dp[0][0] = a[0]
dp[0][1] = b[0]
for i in range(1, n):
t1 = max(dp[-1][0], dp[-1][1] + a[i])
t2 = max(dp[-1][1], dp[-1][0] + b[i])
dp.append([t1, t2])
print(max(dp[-1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
row1 = list(map(int, input().strip().split()))
row2 = list(map(int, input().strip().split()))
row1maxptr = n - 1
row2maxptr = n - 1
for i in range(n - 2, -1, -1):
row1[i] += row2[row2maxptr]
row2[i] += row1[row1maxptr]
if row1[i] > row1[row1maxptr]:
row1maxptr = i
if row2[i] > r... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR VAR VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | input()
a = []
for i in range(2):
a.append([int(i) for i in input().split()])
dp = [[(0) for i in range(len(a[0]) + 4)] for _ in range(2)]
if len(a[0]) == 1:
print(max(a[0][0], a[1][0]))
exit(0)
for i in range(len(a[0])):
dp[0][i] = max(dp[1][i - 1], dp[1][i - 2]) + a[0][i]
dp[1][i] = max(dp[0][i - ... | EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR N... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h = [list(map(int, input().split())), list(map(int, input().split()))]
dp = [([0] * n) for i in range(2)]
if n == 1:
print(max(h[0][0], h[1][0]))
else:
dp[0][0] = h[0][0]
dp[1][0] = h[1][0]
dp[0][1] = dp[1][0] + h[0][1]
dp[1][1] = dp[0][0] + h[1][1]
for i in range(2, n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a0, a1, b0, b1 = 0, a[0], 0, b[0]
for k in range(1, n):
a2 = a[k] + max(b0, b1)
b2 = b[k] + max(a0, a1)
a0, a1, b0, b1 = a1, a2, b1, b2
print(max(a1, b1)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR VAR VAR ASSIGN ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [0, 0]
(*a[0],) = map(int, input().split())
(*a[1],) = map(int, input().split())
dp = [[0, 0] for i in range(n + 1)]
for i in range(n):
for j in [0, 1]:
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j ^ 1] + a[j][i])
print(max(dp[n - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR LIST NUMBER NUMBER ASSIGN VAR V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def basekt(p1, p2):
him = [0] * len(p1)
us = [0] * len(p2)
him[0] = p1[0]
us[0] = p2[0]
for i in range(1, len(p1)):
him[i] = max(him[i - 1], p1[i] + us[i - 1])
us[i] = max(us[i - 1], p2[i] + him[i - 1])
return max(max(him), max(us))
a = input()
lst1 = list(map(int, input().stri... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def dp():
arr = [[(0) for j in range(3)] for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(3):
if j == 1:
first = a[i - 1] + arr[i - 1][0]
second = b[i - 1] + arr[i - 1][2]
third = arr[i - 1][1]
arr[i][j] = max(fir... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSI... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [0] * (a + 10)
dp[1] = b[0]
dp1 = [0] * (a + 10)
dp1[1] = c[0]
max0 = dp[1]
max1 = dp1[1]
for i in range(2, a + 1):
dp[i] = max1 + b[i - 1]
dp1[i] = max0 + c[i - 1]
max0 = max(max0, dp[i])
max1 = max(max1, dp1[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [None] * 3
a[0] = [int(o) for o in input().split()]
a[1] = [int(o) for o in input().split()]
a[2] = [(0) for i in range(n)]
dp = [[(-float("inf")) for i in range(3)] for j in range(n + 1)]
for i in range(n):
for j in range(3):
dp[i + 1][j] = max(dp[i][j - 1] + a[j][i], dp[i][j - 2] + a[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
ao = list(map(int, input().split()))
bo = list(map(int, input().split()))
if n == 1:
print(max(ao[0], bo[0]))
elif n == 2:
print(max(ao[0] + bo[1], ao[1] + bo[0]))
else:
a = []
b = []
a.extend([ao[0], ao[1] + bo[0]])
b.extend([bo[0], bo[1] + ao[0]])
for i in range(2, n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER BI... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | R = lambda: map(int, input().split())
input()
a = b = 0
for x, y in zip(R(), R()):
a, b = max(a, b + x), max(b, a + y)
print(max(a, b)) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
A = []
for _ in range(2):
a = list(map(int, input().split()))
A.append(a)
dp = [[([0] * N) for _ in range(2)] for _ in range(2)]
dp[0][0][0] = 0
dp[0][1][0] = A[1][0]
dp[1][0][0] = A[0][0]
dp[1][1][0] = 0
for k in range(1, N):
... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h0 = [int(x) for x in input().split()]
h1 = [int(x) for x in input().split()]
dp = [([0] * n) for _ in range(3)]
dp[0][0] = h0[0]
dp[1][0] = h1[0]
for i in range(1, n):
dp[0][i] = max(dp[1][i - 1] + h0[i], dp[2][i - 1] + h0[i], h0[i])
dp[1][i] = max(dp[0][i - 1] + h1[i], dp[2][i - 1] + h1[i], h... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASS... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
dp = [[0, 0, 0] for _ in range(n)]
dp[0] = [r1[0], r2[0], 0]
for i in range(1, n):
last = dp[i - 1]
dp[i][0] = max(last[1], last[2]) + r1[i]
dp[i][1] = max(last[0], last[2]) + r2[i]
dp[i][2] = max(last[0], last[1]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER LIST VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASS... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h = [list(map(int, input().split())), list(map(int, input().split()))]
if n == 1:
if h[0][0] > h[1][0]:
print(h[0][0])
else:
print(h[1][0])
else:
emp = []
for i in range(n + 1):
emp.append([0, 0])
emp[1][0] = h[0][0]
emp[1][1] = h[1][0]
for i in range... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR FU... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
dp1 = [a[0]] + [0] * (n - 1)
dp2 = [b[0]] + [0] * (n - 1)
for i in range(1, n):
dp1[i] = max(dp2[i - 1] + a[i], dp1[i - 1])
dp2[i] = max(dp1[i - 1] + b[i], dp2[i - 1])
print(max(dp1[n - 1], dp2[n - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUM... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | inputs = int(input())
row1 = input().split()
row2 = input().split()
up = 1
down = 2
i = 0
for element in row1:
row1[i] = int(element)
i += 1
i = 0
for element in row2:
row2[i] = int(element)
i += 1
i = 0
temp = [0, 0, 0]
prev = []
for i in range(inputs):
prev.append([0, 0, 0])
for i in range(inputs)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
s = [[*map(int, input().split())], [*map(int, input().split())]]
dp = [[0] * n, [0] * n]
dp[0][0] = s[0][0]
dp[1][0] = s[1][0]
if n == 1:
exit(print(max(dp[0][0], dp[1][0])))
dp[0][1] = s[0][1] + s[1][0]
dp[1][1] = s[1][1] + s[0][0]
for i in range(2, n):
for j in range(2):
dp[j][i] = ma... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = list(zip(a, b))
dp = [[None, None] for i in range(n)]
dp[n - 1][0] = a[n - 1][0]
dp[n - 1][1] = a[n - 1][1]
for i in range(n - 2, -1, -1):
if a[i][0] + dp[i + 1][1] > dp[i + 1][0]:
dp[i][0] = a[i][0] + dp[i + 1][1]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST NONE NONE VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR N... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | a = int(input())
b = []
c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
dp = [[(0) for i in range(a + 1)] for i in range(2)]
for i in range(1, a + 1):
for j in range(2):
dp[j][i] = max(dp[1 - j][i - 1] + c[j][i - 1], dp[j][i - 1])
print(max(dp[0][-1], dp[1][-1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h1 = []
h2 = []
for c in input().split():
h1.append(int(c))
for c in input().split():
h2.append(int(c))
max_ht = [([0] * 3) for i in range(n)]
max_ht[0][0] = h1[0]
max_ht[0][1] = h2[0]
for i in range(1, n):
max_ht[i][0] = max(max_ht[i - 1][1], max_ht[i - 1][2]) + h1[i]
max_ht[i][1] = ma... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBE... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
RI = lambda: [int(x) for x in sys.stdin.readline().split()]
ri = lambda: sys.stdin.readline().strip()
n = int(ri())
a = RI()
b = RI()
dpa = [0] * (len(a) + 1)
dpb = [0] * (len(a) + 1)
for i in range(len(a)):
if i == 0:
dpa[1] = a[i]
dpb[1] = b[i]
else:
dpa[i + 1] = max(dpb[i ... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | inc1 = [0]
inc2 = [0]
a = int(input())
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
inc1.append(s1[0])
inc2.append(s2[0])
for i in range(1, len(s1)):
r = max(inc1[-1] + s2[i], max(inc1[-2], inc2[-2]) + s2[i])
l = max(inc2[-1] + s1[i], max(inc1[-2], inc2[-2]) + s1[i])
inc2.append... | ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = []
for _ in range(2):
a.append([int(i) for i in input().split()])
dp = [[(0) for _ in range(n)] for _ in range(2)]
dp[0][0] = a[0][0]
dp[1][0] = a[1][0]
for j in range(1, n):
for i in range(2):
x = 0
if j - 1 >= 0:
x = max(x, dp[1 - i][j - 1])
if j - 2 >=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h1 = [int(i) for i in input().split()]
h2 = [int(i) for i in input().split()]
for i in range(n):
mx2 = -1
if i > 1:
h1m = max(h2[i - 1], h2[i - 2])
h1[i] += h1m
h2m = max(h1[i - 1], h1[i - 2])
h2[i] += h2m
elif i == 1:
h1[i] += h2[i - 1]
h2[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
dp = []
for i in range(2):
dp.append(list(map(int, input().split())))
dp[0].insert(0, 0)
dp[0].insert(0, 0)
dp[1].insert(0, 0)
dp[1].insert(0, 0)
for i in range(2, n + 2):
for k in range(2):
if k == 0:
dp[k][i] = max(dp[1][i - 1], dp[1][i - 2]) + dp[k][i]
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER F... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
ar = list(map(int, input().split()))
br = list(map(int, input().split()))
flag = True
dp = [0] * n
dp1 = [0] * n
dp[0] = ar[0]
dp1[0] = br[0]
for i in range(1, n):
if i < 2:
dp[i] = max(dp1[i - 1] + ar[i], dp[i], ar[i])
dp1[i] = max(dp[i - 1] + br[i], dp1[i], br[i])
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
arr_1 = list(map(int, input().split()))
arr_2 = list(map(int, input().split()))
if n == 1:
print(max(arr_1[0], arr_2[0]))
else:
dp_1 = []
dp_2 = []
dp_1.append(max(arr_1[0] + arr_2[1], arr_2[0]))
dp_2.append(max(arr_2[0] + arr_1[1], arr_1[0]))
temp_1 = 1
temp_2 = 2
for i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NU... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | t = int(input())
a = [int(x) for x in input().split(" ")]
b = [int(x) for x in input().split(" ")]
lst1 = [-1] * t
lst2 = [-1] * t
lst1[t - 1] = a[t - 1]
lst2[t - 1] = b[t - 1]
a_max = a[t - 1]
b_max = b[t - 1]
for i in range(t - 2, -1, -1):
lst1[i] = a[i] + b_max
lst2[i] = b[i] + a_max
b_max = max(lst2[i],... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR B... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
mat = []
for i in range(2):
mat.append(list(map(int, input().split())))
dp = [([0] * n) for i in range(2)]
dp[0][0] = mat[0][0]
dp[1][0] = mat[1][0]
if n == 1:
print(max(dp[0][n - 1], dp[1][n - 1]))
else:
dp[0][1] = dp[1][0] + mat[0][1]
dp[1][1] = dp[0][0] + mat[1][1]
if n == 2:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER IF VAR NUMBER EX... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | q = int(input())
w = list(map(int, input().split()))
e = list(map(int, input().split()))
mw = [0] * q
me = [0] * q
mw[0] = w[0]
me[0] = e[0]
for i in range(q - 2):
if mw[i] + e[i + 1] > me[i + 1]:
me[i + 1] = mw[i] + e[i + 1]
if mw[i] + e[i + 2] > me[i + 2]:
me[i + 2] = mw[i] + e[i + 2]
if m... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
sys.setrecursionlimit(1000000)
l = int(sys.stdin.readline().strip())
first = list(map(int, sys.stdin.readline().split()))
second = list(map(int, sys.stdin.readline().split()))
maxHi = [-1] * l * 2
def maxH(i, even):
if i >= l:
return 0
if maxHi[i * 2 + (0 if even else 1)] > -1:
ret... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER VAR NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR BIN_OP BIN_OP V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
ans = [[0, 0] for _ in range(n + 2)]
for i in range(n):
z = max(ans[i - 2])
y = ans[i - 1][1] + a[0][i]
y = max(y, z + a[0][i])
ans[i][0] = y
y = ans[i - 1][0] + a[1][i]
y = max(y, z + a[1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = []
b = []
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0, 0] for _ in range(n)]
for i in range(n):
if i == 0:
dp[0][0] = a[0]
dp[0][1] = b[0]
else:
dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][0])
dp[i][1] = max(dp[i - 1][0]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER NUMBE... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
l = list(map(int, input().strip().split()))
m = list(map(int, input().strip().split()))
a = []
for i in range(n):
a.append(l[i])
a.append(m[i])
dp = [[l[0], False], [m[0], True]]
counter = False
m = max(dp[-1][0], dp[-2][0])
for i in range(2, 2 * n):
if not counter:
dp.append([max(d... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST LIST VAR NUMBER... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def line(conv=int, fl=0):
inp = input().split()
if len(inp) == 1 and not fl:
return conv(inp[0])
return map(conv, inp)
n = line()
h = [list(line(fl=1)), list(line(fl=1))]
a = zip(*h)
m = [0, 0]
for a0, a1 in a:
nm = [0, 0]
nm[0] = max(m[0], m[1] + a0)
nm[1] = max(m[1], m[0] + a1)
m... | FUNC_DEF VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER VAR RETURN FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER FO... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
(*a,) = map(int, input().split())
(*b,) = map(int, input().split())
aa = []
bb = []
ma = int(0)
mb = int(0)
for i in range(n):
aa.append(mb + a[i])
bb.append(ma + b[i])
if aa[i] > ma:
ma = aa[i]
if bb[i] > mb:
mb = bb[i]
print(max(ma, mb)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
k = []
for i in range(2):
vs = list(map(int, input().split()))
vs = [0] + vs
k.append(vs)
f = [0] * (n + 1)
s = [0] * (n + 1)
f[1] = k[0][1]
s[1] = k[1][1]
for i in range(2, n + 1):
f[i] = max(s[i - 1], s[i - 2]) + k[0][i]
s[i] = max(f[i - 1], f[i - 2]) + k[1][i]
ans = 0
for i in f:... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBE... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def optimize(A, B, n):
F = [[None for x in range(n + 1)] for y in range(3)]
for i in range(1, 3):
F[i][0] = 0
F[1][1] = A[1]
F[2][1] = B[1]
for i in range(2, n + 1):
F[1][i] = max(F[2][i - 1] + A[i], F[2][i - 2] + A[i])
F[2][i] = max(F[1][i - 1] + B[i], F[1][i - 2] + B[i])
... | FUNC_DEF ASSIGN VAR NONE VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUM... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp1, dp2, dp3 = [0] * n, [0] * n, [0] * n
dp1[0], dp2[0], dp3[0] = a[0], b[0], 0
for i in range(1, n):
dp1[i] = max(dp2[i - 1] + a[i], dp3[i - 1], dp1[i - 1])
dp2[i] = max(dp1[i... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def solve():
n = int(input())
h = [[(0) for i in range(n)], [(0) for i in range(n)]]
h[0] = list(map(int, input().split()))
h[1] = list(map(int, input().split()))
dp = [[0, 0] for i in range(n)]
for i in range(n):
if i == 0:
dp[i][0] = h[0][0]
dp[i][1] = h[1][0]
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin, stdout
read = lambda: map(int, stdin.readline().split())
I = lambda: stdin.readline()
n = int(I())
arr = [tuple(read()) for i in range(2)]
dp = [[(0) for i in range(3)] for i in range(n + 1)]
for i in range(n - 1, -1, -1):
dp[i][0] = max(dp[i + 1][2], arr[1][i] + dp[i + 1][1])
dp[i][1] =... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
row = [list(map(int, input().split())), list(map(int, input().split()))]
maX = [row[0][0], row[1][0]]
for i in range(1, n):
curr = [maX[1] + row[0][i], maX[0] + row[1][i]]
if curr[0] > maX[0]:
maX[0] = curr[0]
if curr[1] > maX[1]:
maX[1] = curr[1]
print(max(maX[0], maX[1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR LIST BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
l = [list(map(int, input().split())), list(map(int, input().split()))]
c = [[l[i][j] for j in range(n)] for i in range(2)]
for i in range(n - 1, -1, -1):
for j in range(0, 2):
if i == n - 1:
c[j][i] = l[j][i]
continue
v = [l[j][i]]
if i + 1 < n:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
def main():
n = int(sys.stdin.readline().strip())
r1 = [int(s) for s in sys.stdin.readline().strip().split()]
r2 = [int(s) for s in sys.stdin.readline().strip().split()]
r1_max = 0
r2_max = 0
for p1, p2 in zip(r1, r2):
v1 = max(r1_max, r2_max + p1)
v2 = max(r2_max, r... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h = []
h.append(list(map(int, input().split())))
h.append(list(map(int, input().split())))
d = []
c = []
b = []
for i in range(n):
d.append(0)
c.append(0)
b.append(d)
b.append(c)
b[0][n - 1] = h[0][n - 1]
b[1][n - 1] = h[1][n - 1]
i = n - 2
while i > -1:
b[0][i] = max(h[0][i] + b[1][i + 1],... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def main():
n = int(input())
h = [list(map(int, input().split())) for i in range(2)]
x, y = 0, 0
for i in range(n):
a, b = max(x, y + h[0][i]), max(y, x + h[1][i])
x, y = a, b
print(max(x, y))
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR VAR VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def solve4(line1, line2):
memo = {}
memo[True, len(line1) - 1] = line1[len(line1) - 1]
memo[False, len(line1) - 1] = line2[len(line1) - 1]
for i in range(len(line1) - 2, -1, -1):
optionPeek = memo[False, i + 1] + line1[i]
optionSkip = memo[True, i + 1]
memo[True, i] = max(optionP... | FUNC_DEF ASSIGN VAR DICT ASSIGN VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 1
while i < len(a):
if b[i] + a[i - 1] >= b[i - 1]:
b[i] = b[i] + a[i - 1]
else:
b[i] = b[i - 1]
if a[i] + b[i - 1] >= a[i - 1]:
a[i] = a[i] + b[i - 1]
else:
a[i] = a[i - 1]
i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_O... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a, b = [int(x) for x in input().split()], [int(x) for x in input().split()]
if n == 1:
print(max(a[0], b[0]))
else:
ps, qs = [0] * n, [0] * n
ps[-1], ps[-2], qs[-1], qs[-2] = a[-1], a[-2] + b[-1], b[-1], b[-2] + a[-1]
for j in range(n - 3, -1, -1):
ps[j] = a[j] + max(qs[j + 1], ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
row_1 = list(map(int, input().split()))
row_2 = list(map(int, input().split()))
dp_flg1 = [(0) for _ in range(n + 2)]
dp_flg2 = [(0) for _ in range(n + 2)]
for i in range(n):
dp_flg2[i + 2] = max(dp_flg1[i + 1] + row_2[i], dp_flg1[i] + row_2[i])
dp_flg1[i + 2] = max(dp_flg2[i + 1] + row_1[i], d... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BI... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
first = list(map(int, input().split()))
second = list(map(int, input().split()))
dp_first = [0] * n
dp_second = [0] * n
dp_first[0] = first[0]
dp_second[0] = second[0]
for i in range(1, n):
dp_first[i] = max(
dp_first[i - 1],
first[i] + dp_second[i - 1],
first[i] + dp_second... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | dp = {}
n = int(input())
h1 = input().split()
for i in range(n):
h1[i] = int(h1[i])
h2 = input().split()
for i in range(n):
h2[i] = int(h2[i])
dp[n - 1, 1] = h1[i]
dp[n - 1, 2] = h2[i]
for i in range(n - 2, -1, -1):
dp[i, 1] = max(h1[i] + dp[i + 1, 2], dp[i + 1, 1])
dp[i, 2] = max(h2[i] + dp[i + 1, 1], ... | ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUM... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
ch1 = input()
ch2 = input()
L0 = [int(i) for i in ch1.split()]
L1 = [int(i) for i in ch2.split()]
for i in range(1, n):
if i == 1:
L0[1] += L1[0]
L1[1] += L0[0]
else:
L0[i] += max(L1[i - 1], L1[i - 2])
L1[i] += max(L0[i - 1], L0[i - 2])
print(max(L0[n - 1], L1[n ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import setcheckinterval, stdin
setcheckinterval(1000)
iin = lambda: int(stdin.readline())
lin = lambda: list(map(int, stdin.readline().split()))
n = iin()
a = lin()
b = lin()
for i in range(n - 2, -1, -1):
a[i] = max(a[i] + b[i + 1], a[i + 1])
b[i] = max(b[i] + a[i + 1], b[i + 1])
print(max(*a, *b)) | EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
m1, m2 = 0, 0
for i in range(n - 1, -1, -1):
x1, x2 = l1[i] + m2, l2[i] + m1
if x1 > m1:
m1 = x1
if x2 > m2:
m2 = x2
print(max(m1, m2)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR IF VAR VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h = [0, 1]
for i2 in range(2):
h[i2] = [int(i) for i in input().split()]
a = [[(0) for i in range(n)] for i in range(2)]
if n == 1:
print(max(h[0][0], h[1][0]))
else:
a[0][0] = h[0][0]
a[1][0] = h[1][0]
a[0][1] = h[0][1] + a[1][0]
a[1][1] = h[1][1] + a[0][0]
for i in range(2... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NU... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if n == 1:
print(max(a[0], b[0]))
else:
up_dp = []
do_dp = []
up_dp.append(a[0])
up_dp.append(b[0] + a[1])
do_dp.append(b[0])
do_dp.append(a[0] + b[1])
for i in range(2, n):
do_dp.append(max(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
H0 = list(map(int, input().split()))
H1 = list(map(int, input().split()))
if n == 1:
print(max(H0[0], H1[0]))
exit()
dp = [0] * 3
dp[0] = H0[0]
dp[1] = H1[0]
dp[2] = 0
for i in range(1, n):
nx = [0] * 3
nx[2] = max(dp[0], dp[1])
nx[0] = max(nx[0], dp[1] + H0[i], dp[2] + H0[i])
n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def solve():
n = int(input())
h_1 = list(map(int, input().split()))
h_2 = list(map(int, input().split()))
dp_1, dp_2, dp_3 = 0, 0, 0
for i in range(n):
t_dp_1, t_dp_2, t_dp_3 = (
max(dp_2 + h_1[i], dp_3 + h_1[i]),
max(dp_1 + h_2[i], dp_3 + h_2[i]),
max(dp_... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR F... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | try:
while True:
n = int(input())
a = [[0]] * 2
a[0] = list(map(int, input().split()))
a[0].insert(0, 0)
a[1] = list(map(int, input().split()))
a[1].insert(0, 0)
suma = maxa = a[0][1]
sumb = maxb = a[1][1]
for i in range(2, n + 1):
... | WHILE NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST LIST NUMBER NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER NUMBE... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def fun(n, a, b):
ans = a[0], b[0], 0
for i in range(1, n):
ans = (
max(ans[1], ans[2]) + a[i],
max(ans[0], ans[2]) + b[i],
max(ans[0], ans[1]),
)
return max(ans)
t = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
pr... | FUNC_DEF ASSIGN VAR VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def main():
n = int(input())
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
for i in range(1, n):
a[i % 2][i] = max(a[(i + 1) % 2][i - 1] + a[i % 2][i], a[i % 2][i - 1])
a[(i + 1) % 2][i] = max(
a[i % 2][i - 1] + a[(i + 1) % 2][... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | def basketball_team(n, heights1, heights2):
cache1 = [None for __ in range(n)]
cache2 = [None for __ in range(n)]
for idx in range(n - 1, -1, -1):
if idx == n - 1:
cache1[idx] = heights1[idx]
cache2[idx] = heights2[idx]
elif idx == n - 2:
cache1[idx] = hei... | FUNC_DEF ASSIGN VAR NONE VAR FUNC_CALL VAR VAR ASSIGN VAR NONE VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
row = [[]]
row.append(list(map(int, input().split())))
row.append(list(map(int, input().split())))
dp = [([None] * 3) for i in range(n + 7)]
def compute(i, idx):
take_0 = dp[i + 1][0]
take_1 = row[1][i] + dp[i + 1][1]
take_2 = row[2][i] + dp[i + 1][2]
if idx == 0:
dp[i][idx] =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR VAR BIN_OP VAR NUMB... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | I = lambda: map(int, input().split())
(n,) = I()
a = (*I(),)
b = (*I(),)
c = d = i = 0
while i < n:
c, d = max(d + a[i], c), max(c + b[i], d)
i += 1
print(max(c, d)) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | import sys
input = sys.stdin.readline
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
dp = [0] * n
dp[-1] = [l1[-1], l2[-1]]
if n >= 2:
dp[-2] = [l1[-2] + l2[-1], l2[-2] + l1[-1]]
for i in range(-3, -n - 1, -1):
ind = i
k = max(dp[ind + 1][1] + l1[ind]... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER LIST VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER LIST BIN_OP VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
m = [([-1] * 3) for i in range(n)]
m[0][0], m[0][1], m[0][2] = 0, h1[0], h2[0]
for i in range(1, n):
m[i][0] = max(m[i - 1][0], m[i - 1][1], m[i - 1][2])
m[i][1] = max(h1[i] + m[i - 1][2], h1[i] + m[i - 1][0])
m[i][2]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER NUMBER VAR NUMBER VAR NUMBE... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
h1 = [int(x) for x in input().split()]
h2 = [int(x) for x in input().split()]
prev_U, prev_D, prev_O = 0, 0, 0
U, D, O = 0, 0, 0
for i in range(n):
prev_U = U
prev_D = D
prev_O = O
if i == 0:
U = h1[0]
D = h2[0]
O = 0
else:
U = max(prev_D, prev_O) + h... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER AS... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
ranges = {}
ranges[1] = list(map(int, input().split()))
ranges[2] = list(map(int, input().split()))
f1 = [0]
f2 = [0]
f3 = [0]
for i in range(1, n + 1):
f3.append(max(f1[i - 1], f2[i - 1]))
f2.append(max(f1[i - 1] + ranges[2][i - 1], f3[i - 1] + ranges[2][i - 1]))
f1.append(max(f2[i - 1] + ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER E... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [] * 2
for i in range(2):
tmp = list(map(int, input().split()))
a.append(tmp)
if n == 1:
print(max(a[0][0], a[1][0]))
else:
f = [([0] * n) for i in range(2)]
f[0][0] = a[0][0]
f[1][0] = a[1][0]
f[0][1] = f[1][0] + a[0][1]
f[1][1] = f[0][0] + a[1][1]
ans = max(f[0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL V... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
dp = []
for i in range(2):
dp.append([0] + [(0) for i in range(n)])
for i in range(1, n + 1):
dp[0][i] = max(dp[0][i - 1], dp[1][i - 1] + s1[i - 1])
dp[1][i] = max(dp[1][i - 1], dp[0][i - 1] + s2[i - 1])
print(max(dp[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
one = [int(x) for x in input().split()]
two = [int(x) for x in input().split()]
dp = {(0, 1, 1): one[0], (0, 1, 0): two[0], (0, 2, 1): two[0], (0, 2, 0): one[0]}
for i in range(1, n):
dp[i, 1, 1] = max(dp[i - 1, 2, 1], dp[i - 1, 1, 0]) + one[i]
dp[i, 1, 0] = max(
dp[i - 1, 2, 1], dp[i -... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR N... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | from sys import stdin, stdout
def ai():
return list(map(int, input().split()))
def ei():
return map(int, input().split())
def ip():
return int(stdin.readline())
def op(ans):
return stdout.write(str(ans) + "\n")
n = ip()
first = ai()
second = ai()
dp1 = first[0]
dp2 = second[0]
for i in range(1... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VA... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dp1 = [0] * N
dp2 = [0] * N
dp1[0] = A[0]
dp2[0] = B[0]
if N > 1:
dp1[1] = dp2[0] + A[1]
dp2[1] = dp1[0] + B[1]
for i in range(2, N):
dp1[i] = max(A[i] + dp2[i - 1], A[i] + dp2[i - 2])
dp2[i] = max(B[i] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if n == 1:
print(max(a[0], b[0]))
elif n == 2:
print(max(a[0] + b[1], b[0] + a[1]))
else:
dp = [[a[0], b[0]], [b[0] + a[1], a[0] + b[1]]]
for i in range(2, n):
dp.append(
[max(dp[-1][1], max(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR ... |
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $n$ people in each row). Students are numbered from $1$ to $n$ in each row in... | n = int(input())
l = [[int(j) for j in input().split()] for i in range(2)]
d1 = [0] * (n + 1)
d2 = [0] * (n + 1)
d1[0] = l[0][0]
d2[0] = l[1][0]
for i in range(1, n):
d1[i] = max(d1[i - 1], d2[i - 1] + l[0][i])
d2[i] = max(d2[i - 1], d1[i - 1] + l[1][i])
print(max(d1[n - 1], d2[n - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.