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... | import sys
n = int(sys.stdin.readline())
h1 = list(map(int, sys.stdin.readline().split()))
h2 = list(map(int, sys.stdin.readline().split()))
best_last_up = [0] * (n + 2)
best_last_down = [0] * (n + 2)
for i in range(n):
best_last_up[i + 1] = max(best_last_up[i + 1], best_last_down[i] + h1[i])
best_last_up[i + ... | IMPORT 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 ... |
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()))
dp1 = [0] * len(l1)
dp2 = [0] * len(l2)
dp1[0] = l1[0]
dp2[0] = l2[0]
if n >= 2:
dp1[1] = l2[0] + l1[1]
dp2[1] = l1[0] + l2[1]
for i in range(2, n):
dp1[i] = max(dp2[i - 1], max(dp1[i - 2], dp2[i - 2])) + l1[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 FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER 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... | from sys import stdin
def solution2():
input = stdin.readline
n = int(input())
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
a = a1 = arr1[0]
b = b1 = arr2[0]
c = c1 = 0
for i in range(1, n):
a1 = max(b + arr1[i], c + arr1[i])
b1 = ma... | FUNC_DEF ASSIGN VAR VAR 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 ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL 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())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
DP = [([0] * n) for _ in range(2)]
DP[0][0] = A[0]
DP[1][0] = B[0]
for i in range(1, n):
DP[0][i] = max(A[i] + DP[1][i - 1], DP[0][i - 1])
DP[1][i] = max(B[i] + DP[0][i - 1], DP[1][i - 1])
print(max(DP[0][n - 1], DP[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 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())
row_one = [int(height) for height in input().split(" ")]
row_two = [int(height) for height in input().split(" ")]
if n == 1:
print(max(row_one[0], row_two[0]))
elif n == 2:
print(max(row_one[0] + row_two[1], row_one[1] + row_two[0]))
else:
row_one[1] = row_one[1] + row_two[0]
row_two[1]... | 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 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 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 = list(map(int, input().split()))
b = list(map(int, input().split()))
if n == 1:
print(max(a[0], b[0]))
else:
dpa = [0] * n
dpb = [0] * n
dpa[0] = a[0]
dpb[0] = b[0]
dpa[1] = dpb[0] + a[1]
dpb[1] = dpa[0] + b[1]
i = 2
while i < n:
dpa[i] = max(dpb[i - 1], 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 IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR 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... | import sys
num = int(input())
row1 = [int(i) for i in input().split()]
row2 = [int(i) for i in input().split()]
if num == 1:
print(max(row1[0], row2[0]))
sys.exit()
row1.reverse()
row2.reverse()
dp = [[row1[0], row2[0]], [row2[0] + row1[1], row1[0] + row2[1]]]
for i in range(2, num):
top = max(dp[-1][1] + ... | IMPORT 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 EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST LIST 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... | n = int(input())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
x = [0] * (n + 1)
y = [0] * (n + 1)
x[1] = h1[0]
y[1] = h2[0]
for i in range(1, n):
x[i + 1] = max(y[i], y[i - 1]) + h1[i]
y[i + 1] = max(x[i], x[i - 1]) + h2[i]
ans = max(x[n], y[n])
print(ans) | 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 ASSIGN VAR NUMBER 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())
l1 = [int(s) for s in input().split()]
l2 = [int(s) for s in input().split()]
if n == 1:
print(max(l1[0], l2[0]))
elif n == 2:
print(max(l1[0] + l2[1], l2[0] + l1[0]))
else:
re1 = [0] * n
re2 = [0] * n
re1[0] = l1[0]
re2[0] = l2[0]
re1[1] = re2[0] + l1[1]
re2[1] = re1[0]... | 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())
li1 = list(map(int, input().split()))
li2 = list(map(int, input().split()))
max1 = li1[0]
max2 = li2[0]
for i in range(1, n):
max1e = max(max2 + li1[i], max1)
max2e = max(max1 + li2[i], max2)
max1 = max1e
max2 = max2e
print(max(max1, max2)) | 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 FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN 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())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if n == 1:
print(max(x[0], y[0]))
else:
x[-2] += y[-1]
y[-2] += x[-1]
for i in range(3, n + 1):
x[-i] += max(y[-i + 1], y[-i + 2])
y[-i] += max(x[-i + 1], x[-i + 2])
print(max(x[0], y[0])) | 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 VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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... | R = lambda: map(int, input().split())
n = int(input())
a = b = c = d = 0
for x, y in zip(R(), R()):
a, b, c, d = c, d, max(x + b, x + d), max(y + a, y + c)
print(max(c, d)) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_C... |
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 solution():
input = stdin.readline
n = int(input())
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
dp1 = [0] * n
dp2 = [0] * n
dp3 = [0] * n
dp1[0] = arr1[0]
dp2[0] = arr2[0]
for i in range(1, n):
dp1[i] = max... | FUNC_DEF ASSIGN VAR VAR 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 ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN 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())
a = input()
A = list(map(int, list(a.split())))
b = input()
B = list(map(int, list(b.split())))
if n > 2:
dp = [[(0) for i in range(n)] for j in range(4)]
dp[1][0] = A[0]
dp[2][0] = B[0]
dp[1][1] = A[1] + dp[2][0]
dp[2][1] = B[1] + dp[1][0]
dp[3][1] = max(dp[1][0], dp[2][0])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR 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())
above = [int(x) for x in input().split()]
below = [int(x) for x in input().split()]
taken_above = [above[0]]
taken_below = [below[0]]
taken_none = [0]
for i in range(1, n):
taken_above.append(max(taken_below[i - 1] + above[i], taken_none[i - 1] + above[i]))
taken_below.append(max(taken_above[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 NUMBER ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP 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... | n = int(input())
p = [[0] * (n + 1)] + [([0] + list(map(int, input().split()))) for _ in range(2)]
t = [([0] * (n + 1)) for _ in range(3)]
t[1][1], t[2][1] = p[1][1], p[2][1]
for i in range(2, n + 1):
t[0][i] = max(t[1][i - 1], t[2][i - 1])
t[1][i] = p[1][i] + max(t[0][i - 1], t[2][i - 1])
t[2][i] = p[2][i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER 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())) for i in range(2)]
for i in range(n - 1):
for t in range(2):
h[t][i + 1] = max(h[t][i + 1] + h[t ^ 1][i], h[t][i])
print(max(h[0][-1], h[1][-1])) | 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 FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR VAR 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... | n = int(input())
heights1 = [int(ele) for ele in input().split(" ")]
heights2 = [int(ele) for ele in input().split(" ")]
bestdp1 = [0] * n
bestdp2 = [0] * n
bestdp1[0] = heights1[0]
bestdp2[0] = heights2[0]
for index in range(1, n):
bestdp1[index] = max(bestdp2[max(index - 3, 0) : index]) + heights1[index]
best... | 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 NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL 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 f(l1, l2, index=0, currsum=0, prev=0, memo=dict()):
key = index, currsum, prev
if key in memo:
return memo[key]
if index == len(l1):
return currsum
if prev == 0:
to_return = max(
f(l1, l2, index + 1, currsum + l1[index], 1, memo),
f(l1, l2, index + 1, ... | FUNC_DEF NUMBER NUMBER NUMBER FUNC_CALL VAR ASSIGN VAR VAR VAR VAR IF VAR VAR RETURN VAR VAR IF VAR FUNC_CALL VAR VAR RETURN VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR NUMBER 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 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
if n == 1:
print(max(h1[0], h2[0]))
exit(0)
x1 = [0] * n
x2 = [0] * n
x1[0] = h1[0]
x2[0] = h2[0]
x1[1] = x2[0] + h1[1]
x2[1] = x1[0] + h2[1]
for i in range(2, n):
if i % 2:
x1[i] = h1[i] + max(x2[i - 1], x2[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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR 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... | from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
n = int(cin())
h1 = list(map(int, cin().split()))
h2 = list(map(int, cin().split()))
x, y, temp = 0, 0, 0
for i in range(n):
x2 = max(y + h1[i], h1[i], temp + h1[i])
y2 = max(x + h2[i], h2[i], temp + h2[i])
temp = max(x, y)
x = x2
... | ASSIGN VAR VAR 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 NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR 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... | n = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
A = a[n - 1]
B = b[n - 1]
for i in range(n - 2, -1, -1):
lA = A
lB = B
A = max(a[i] + lB, lA)
B = max(b[i] + lA, lB)
print(max(A, B)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN 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... | n = int(input())
line_1 = list(map(int, input().split(" ")))
line_2 = list(map(int, input().split(" ")))
dp_1 = [0] * n
dp_1[0] = line_1[0]
dp_2 = [0] * n
dp_2[0] = line_2[0]
dp_3 = [0] * n
for i in range(1, n):
dp_1[i] = max(dp_2[i - 1] + line_1[i], dp_3[i - 1] + line_1[i], line_1[i])
dp_2[i] = max(dp_1[i - 1]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER 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())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
if n == 1:
print(max(h1[0], h2[0]))
elif n == 2:
print(max(h1[0] + h2[1], h1[1] + h2[0]))
else:
j = 2
c1 = h1[0] + h2[1]
c2 = h1[1] + h2[0]
c3 = h1[0]
c4 = h2[0]
for i in range(j, n):
c1, 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 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... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [0, 0]
for i in range(n):
v1 = max(dp[0], dp[1] + a[i])
v2 = max(dp[1], dp[0] + b[i])
dp[0], dp[1] = v1, v2
print(max(dp[0], 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 NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER 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())
l = [list(map(int, input().split())), list(map(int, input().split()))]
m = [0, 0]
for i in range(n - 1, -1, -1):
mm = [0, 0]
for j in range(2):
l[j][i] += m[j ^ 1]
mm[j] = max(m[j], l[j][i])
m = mm
print(max(m)) | 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 NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR 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... | N = int(input())
a = []
for i in range(2):
a.append(list(map(int, input().split())))
dp = [([0] * 2) for _ in range(N)]
for i in range(2):
dp[0][i] = a[i][0]
for i in range(N):
for j in range(2):
if i % 2 == 0:
if i >= 1:
dp[i][j] = max(dp[i][j], dp[i - 1][j] + a[j][i])
... | 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 NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR 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())
team1 = list(map(int, input().split()))
team2 = list(map(int, input().split()))
team1 = [0, 0] + team1
team2 = [0, 0] + team2
ans1 = [0, 0]
ans2 = [0, 0]
for i in range(2, n + 2):
ans1.append(
max(ans1[i - 2] + team1[i], ans2[i - 2] + team1[i], ans2[i - 1] + team1[i])
)
ans2.append(... | 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 ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR 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 = 0
row = list()
value = list()
n = int(input())
row.append(list(map(int, input().split())))
row.append(list(map(int, input().split())))
value.append([0] * n)
value.append([0] * n)
for i in range(n - 1, -1, -1):
if i == n - 1:
value[0][i] = row[0][i]
value[1][i] = row[1][i]
else:
value... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR 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 EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR EXPR FUNC_CALL 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())
str1 = input().split()
str2 = input().split()
str1 = [int(i) for i in str1]
str2 = [int(i) for i in str2]
arr1 = str1.copy()
arr2 = str2.copy()
if n > 1:
arr1[1] += arr2[0]
arr2[1] += arr1[0]
for i in range(2, n):
add1 = max(arr2[i - 2], arr2[i - 1])
add2 = max(arr1[i - 2], arr1[i - 1])... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR 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
from itertools import repeat
dp = None
n = None
arr = None
def func(ind, row):
if ind == n:
return 0
if dp[row][ind] != -1:
return dp[row][ind]
dp[row][ind] = max(func(ind + 1, row), arr[row][ind] + func(ind + 1, row ^ 1))
return dp[row][ind]
def solve():
global n, dp... | IMPORT ASSIGN VAR NONE ASSIGN VAR NONE ASSIGN VAR NONE FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN VAR VAR VAR FUNC_DEF 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... | n = int(input())
h1 = [int(i) for i in input().split()]
h2 = [int(i) for i in input().split()]
for i in range(1, n):
if i == 1:
h1[i] += h2[i - 1]
h2[i] += h1[i - 1]
else:
h1[i] += max(h2[i - 1], h1[i - 2], h2[i - 2])
h2[i] += max(h1[i - 1], h2[i - 2], h1[i - 2])
print(max(h1[-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 FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP VAR 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... | n = int(input())
arr_0 = [int(i) for i in filter(None, input().split(" "))]
arr_1 = [int(i) for i in filter(None, input().split(" "))]
arr = [arr_0, arr_1]
end = [[0] * n, [0] * n]
if n == 1:
print(max([arr[0][0], arr[1][0]]))
elif n == 2:
print(max(arr[0][0] + arr[1][1], arr[1][0] + arr[0][1]))
else:
for i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NONE FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NONE FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST VAR VAR ASSIGN VAR LIST BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR IF 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... | n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l = []
a = b = 0
for i in range(n):
l.append((l1[i], l2[i]))
su0, su1 = l[0]
for i in range(1, n):
a, b, su0, su1 = su0, su1, max(b, su1) + l[i][0], max(a, su0) + l[i][1]
print(max(su0, su1)) | 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 ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR 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... | R = lambda: map(int, input().split())
n = int(input())
arr = [[], []]
arr[0] = [0] + list(R())
arr[1] = [0] + list(R())
dp = [[(0) for i in range(n + 2)] for _ in range(2)]
dp[0][1] = arr[0][1]
dp[1][1] = arr[1][1]
for i in range(2, n + 1):
dp[0][i] = max(dp[0][i - 2], dp[1][i - 2], dp[1][i - 1]) + arr[0][i]
dp... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST LIST ASSIGN VAR NUMBER BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER 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... | n = int(input())
a = [list(map(int, input().split())), list(map(int, input().split()))]
res = [[a[0][0]], [a[1][0]]]
if n > 1:
res[0].append(a[1][0] + a[0][1])
res[1].append(a[0][0] + a[1][1])
for i in range(2, n):
res[0].append(max(res[1][-1], res[1][-2]) + a[0][i])
res[1].append(max(res[0][-2], res[0]... | 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 LIST VAR NUMBER NUMBER LIST VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR 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... | n = int(input())
l = [list(map(int, input().split())) for _ in range(2)]
dp = [([0] * 2) for _ in range(n + 1)]
for i in range(n):
dp[i + 1][0] = max(dp[i][0], dp[i][1] + l[0][i])
dp[i + 1][1] = max(dp[i][1], dp[i][0] + l[1][i])
print(max(dp[n])) | 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 BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR VAR NUMBER BIN_OP VAR 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... | a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [[] for x in range(a)]
for x in range(a):
dp[x].append(b[x])
dp[x].append(c[x])
for x in range(a - 1):
dp[x + 1][0] = max(dp[x][0], dp[x][1] + dp[x + 1][0])
dp[x + 1][1] = max(dp[x][1], dp[x][0] + dp[x + 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 LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR 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... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
f1 = [0] * (n + 3)
f2 = [0] * (n + 3)
f1[1] = a[0]
f2[1] = b[0]
for i in range(1, n):
f2[i + 1] = max(f2[i], max(f1[i - 1] + b[i], f1[i] + b[i]))
f1[i + 1] = max(f1[i], max(f2[i - 1] + a[i], f2[i] + a[i]))
print(max(f1[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 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 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 = list(map(int, input().split()))
b = list(map(int, input().split()))
memo = {}
def f(a, b, i, is_last_el_a, memo):
if (i, is_last_el_a) in memo:
return memo[i, is_last_el_a]
if i == 0:
if is_last_el_a:
memo[i, is_last_el_a] = a[0]
else:
memo[... | 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 DICT FUNC_DEF IF VAR VAR VAR RETURN VAR VAR VAR IF VAR NUMBER IF VAR ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER RETURN ... |
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 input():
return sys.stdin.readline().strip()
def dinput():
return int(input())
def tinput():
return input().split()
def rinput():
return map(int, tinput())
def rt(a, s):
t = ""
for i in range(len(s)):
t = t + a[i] + s[i]
return int(t)
def main():
n = di... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR RETURN FUNC_CALL VAR VAR 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())
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
dp = [[(0) for i in range(n)] for j in range(2)]
dp[0][n - 1] = a1[n - 1]
dp[1][n - 1] = a2[n - 1]
if n > 1:
dp[0][n - 2] = a1[n - 2] + a2[n - 1]
dp[1][n - 2] = a2[n - 2] + a1[n - 1]
for i in range(n - 3, -1, -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 NUMBER VAR FUNC_CALL VAR VAR 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_... |
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())
heights = []
heights.append([int(x) for x in stdin.readline().split()])
heights.append([int(x) for x in stdin.readline().split()])
maxes = [([0] * n) for i in range(2)]
maxes[0][n - 1] = heights[0][n - 1]
maxes[1][n - 1] = heights[1][n - 1]
old_top_max = maxes[0][n - 1]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL 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 BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR 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())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
l = [h1, h2]
dp = [[(0) for i in range(3)] for j in range(n + 1)]
for i in range(1, n + 1):
dp[i][0] = max(dp[i - 1])
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + l[0][i - 1]
dp[i][2] = max(dp[i - 1][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 LIST VAR VAR 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 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... | n = int(input())
l = [[0], [0]]
topmax = 0
botmax = 0
l[0].extend(list(map(int, input().split())))
l[1].extend(list(map(int, input().split())))
for i in range(1, n + 1):
l[0][i] = l[0][i] + botmax
l[1][i] = l[1][i] + topmax
topmax = max(topmax, l[0][i])
botmax = max(botmax, l[1][i])
print(max(topmax, bo... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER 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... | def basketball(n, r1, r2):
dpi1 = 0
dpi2 = 0
dpi3 = 0
for i in range(n):
dpi_1 = dpi1
dpi_2 = dpi2
dpi1 = max(dpi2 + r1[i], dpi3 + r1[i])
dpi2 = max(dpi_1 + r2[i], dpi3 + r2[i])
dpi3 = max(dpi_1, dpi_2)
return max(dpi1, dpi2)
t = int(input())
a1 = list(map(i... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR ASSIGN 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())
s = [int(i) for i in input().split()]
ss = [int(i) for i in input().split()]
dp = [0] * n
dpp = [0] * n
if n > 1:
for i in range(0, n):
dp[i] = max(dpp[i - 1], dpp[i - 2]) + s[i]
dpp[i] = max(dp[i - 1], dp[i - 2]) + ss[i]
print(max(dp[-1], dpp[-1]))
else:
print(max(s[0], ss[... | 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 ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR 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... | n = int(input())
r1 = list(map(int, input().split(" ")))
r2 = list(map(int, input().split(" ")))
given = [[0, 0] for x in range(n)]
array = [[0, 0, 0] for x in range(n)]
for i in range(n):
given[i][0] = r1[i]
given[i][1] = r2[i]
if n == 1:
print(max(given[0]))
if n == 2:
print(max(given[0][0] + given[1]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER VAR FUNC_CALL VAR VAR 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... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [a[0], b[0], 0]
for i in range(n - 1):
dp_1 = max(dp[1], dp[2]) + a[i + 1]
dp_2 = max(dp[0], dp[2]) + b[i + 1]
dp_3 = max(dp[0], dp[1])
dp = [dp_1, dp_2, dp_3]
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 VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR BIN_... |
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().split())) + [0]
row2 = list(map(int, input().split())) + [0]
row1[1] += row2[0]
row2[1] += row1[0]
for i in range(2, n):
row1[i] += max(row2[i - 1], row2[i - 2])
row2[i] += max(row1[i - 1], row1[i - 2])
print(max(row1[n - 1], row2[n - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR FUNC_CALL VAR VAR 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... | def calc_max_height_team(n, t1, t2):
mht = [[(0) for i in range(n)] for j in range(3)]
if n == 1:
return max(t1[0], t2[0])
mht[0][0] = t1[0]
mht[1][0] = t2[0]
mht[2][0] = 0
for i in range(1, n):
mht[0][i] = max(mht[1][i - 1] + t1[i], mht[2][i - 1] + t1[i])
mht[1][i] = max... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER RETURN FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP 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... | CHOSE_A = 0
CHOSE_B = 1
CHOSE_NEITHER = 2
n = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
memo = []
for i in range(n):
memo.append([-1, -1, -1])
memo[n - 1][CHOSE_B] = a[n - 1]
memo[n - 1][CHOSE_A] = b[n - 1]
memo[n - 1][CHOSE_NEITHER] = max(a[n - 1], b[n - 1])
for i i... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST 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... | n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
dp = [[0, 0] for j in range(n + 1)]
dp[0][0] = a1[0]
dp[0][1] = a2[0]
if n > 2:
dp[1][0] = a1[1] + a2[0]
dp[1][1] = a1[0] + a2[1]
for i in range(2, n):
dp[i][0] = max(
dp[i - 1][1] + a1[i], max(dp[i - 2][0], 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 LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER IF 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... | import sys
n = int(sys.stdin.readline().strip())
h1 = list(map(int, sys.stdin.readline().strip().split()))
h2 = list(map(int, sys.stdin.readline().strip().split()))
m1 = 0
n1 = h1[0]
m2 = 0
n2 = h2[0]
for i in range(1, n):
m1, n1, m2, n2 = n1, h1[i] + max([m2, n2]), n2, h2[i] + max([m1, n1])
print(max([n1, n2])) | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL 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... | I = lambda: int(input())
IL = lambda: list(map(int, input().split()))
IF = lambda: list(map(float, input().split()))
n = I()
A = IL()
B = IL()
S = [A[0], B[0], 0]
for i in range(1, n):
S = [max(S[1], S[2]) + A[i], max(S[0], S[2]) + B[i], max(S[0], S[1])]
print(max(S)) | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL 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())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mat = [[(0) for j in range(2)] for i in range(n)]
for i in range(n):
mat[i][0] = a[i]
mat[i][1] = b[i]
dp = [[(0) for j in range(2)] for i in range(n)]
dp[0][0] = a[0]
dp[0][1] = b[0]
for i in range(1, n):
dp[i][0] ... | 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 NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER VAR VAR 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... | n = int(input())
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
ans = [[], []]
for i in range(n):
ans[0].append(0)
ans[1].append(0)
ans[0][0] = list1[0]
ans[1][0] = list2[0]
for i in range(1, n):
ans[0][i] = max(ans[0][i - 1], list1[i] + ans[1][i - 1])
ans[1][i] = max(an... | 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 LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER 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())
first = [int(i) for i in input().split()]
second = [int(i) for i in input().split()]
dp = [[0, 0] for i in range(n)]
dp[0][0] = first[0]
dp[0][1] = second[0]
for i in range(0, n - 1):
dp[i + 1][0] = max(dp[i][0], dp[i][1] + first[i + 1])
dp[i + 1][1] = max(dp[i][1], dp[i][0] + second[i + 1])
pr... | 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 VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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... | def safeaccess(arr, i):
if i >= len(arr) or i < 0:
return 0
return arr[i]
n = int(input())
array1 = [int(x) for x in input().split(" ")]
array2 = [int(x) for x in input().split(" ")]
dpa1 = [0] * n
dpa2 = [0] * n
maxnum = 0
for i in range(n):
dpa1[i] = max(
safeaccess(dpa2, i - 1) + array1... | FUNC_DEF IF VAR FUNC_CALL VAR VAR VAR NUMBER RETURN NUMBER RETURN VAR VAR 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 ... |
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 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
maxi_haut = [0]
maxi_bas = [0]
indice = len(l1) - 1
while indice >= 0:
tmp = l1[indice] + maxi_bas[-1]
maxi_haut.append(max(maxi_haut[-1], tmp))
tmp = l2[indice] + maxi_haut[-2]
maxi_bas.append(max(maxi_bas[-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 LIST NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR 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... | import sys
input = sys.stdin.readline
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
put1 = [a1[0]]
put2 = [a2[0]]
if n > 1:
put1.append(put2[0] + a1[1])
put2.append(put1[0] + a2[1])
for i in range(2, n):
p1 = max(put2[i - 1], put2[i - 2], put2[i - 3]) + a1[i]
... | 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 LIST VAR NUMBER ASSIGN VAR LIST VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER 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... | mod = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: map(int, input().split())
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
n = ii()
mx1r, mx2r = 0, 0
mx1, mx2 = 0, 0
for i, j in zip(il(), il()):
mx1 = max(mx2r + i, mx1r)
mx... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN 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 ASSIGN 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())
A = input().split()
A = list(map(int, A))
B = input().split()
B = list(map(int, B))
dym = [[0, 0] for i in range(N)]
for i in range(N):
if i == 0:
dym[i][0] = A[0]
dym[i][1] = B[0]
elif i == 1:
dym[i][0] = A[1] + B[0]
dym[i][1] = A[0] + B[1]
else:
dym... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR 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 solution(x, y):
d0 = [0] * len(x)
dx = [x[0]] * len(x)
dy = [y[0]] * len(x)
for k in range(1, len(x)):
d0[k] = max(dx[k - 1], dy[k - 1])
dx[k] = max(d0[k - 1], dy[k - 1]) + x[k]
dy[k] = max(d0[k - 1], dx[k - 1]) + y[k]
return max(d0[-1], dx[-1], dy[-1])
n = int(input())... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP 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())
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
if n > 1:
s1[1] = s2[0] + s1[1]
s2[1] = s1[0] + s2[1]
m = max(s1[0], s1[1], s2[0], s2[1])
for i in range(2, n):
s1[i] = max(s2[i - 1] + s1[i], s2[i - 2] + s1[i])
s2[i] = max(s1[i - 1] + s2[i], s1[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 ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR 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())
a1 = list(map(int, input().split(" ")))
a2 = list(map(int, input().split(" ")))
dp1 = [[0, 0] for _ in range(n)]
dp2 = [[0, 0] for _ in range(n)]
dp1[0][0] = a1[0]
dp2[0][0] = a2[0]
for i in range(1, n):
dp1[i][0] = max([dp1[i - 1][1], dp2[i - 1][0], dp2[i - 1][1]]) + a1[i]
dp1[i][1] = max([dp1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER 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, ar, ar2):
dp = [([-1] * 2) for i in range(n)]
dp[0][0] = ar[0]
dp[0][1] = ar2[0]
for i in range(1, n):
for j in range(2):
if j == 0:
dp[i][j] = max(dp[i][j], dp[i - 1][1] + ar[i])
if i > 1:
dp[i][j] = max(dp[i][j], dp[i... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR IF VAR NUMBER A... |
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 = input().split()
b = input().split()
table = [[(0) for i in range(3)] for j in range(n + 1)]
for i in range(n - 1, -1, -1):
table[i][0] = max(table[i][0], int(a[i]) + max(table[i + 1][1], table[i + 1][2]))
table[i][1] = max(table[i][1], int(b[i]) + max(table[i + 1][0], table[i + 1][2]))
... | 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 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 VAR VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER BIN_OP FUNC_CALL VAR 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... | n = int(input())
mat = []
mat.append(list(map(int, input().split())))
mat.append(list(map(int, input().split())))
dp = [[(0) for j in range(n)] for i in range(3)]
dp[1][0] = mat[0][0]
dp[2][0] = mat[1][0]
for i in range(1, n):
dp[0][i] = max(dp[0][i - 1], dp[1][i - 1], dp[2][i - 1])
dp[1][i] = max(dp[0][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 NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR 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... | x = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp1 = [(0) for n in range(x)]
dp2 = [(0) for n in range(x)]
dp3 = [(0) for n in range(x)]
dp1[0] = a[0]
dp2[0] = b[0]
for n in range(1, x):
dp1[n] = max(dp2[n - 1] + a[n], dp3[n - 1] + a[n])
dp2[n] = max(dp1[n - 1] + b[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 ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN 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())
ar1 = list(map(int, input().split()))
ar2 = list(map(int, input().split()))
dp1 = [0] * n
dp2 = [0] * n
dp1[0] = ar1[0]
dp2[0] = ar2[0]
for i in range(n - 1):
if i == n - 2:
dp2[i + 1] = max(dp1[i] + ar2[i + 1], dp2[i + 1])
dp1[i + 1] = max(dp2[i] + ar1[i + 1], dp1[i + 1])
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 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... | def f(a, b, n):
dpa = [0] * n
dpb = [0] * n
dpa[n - 1] = a[n - 1]
dpb[n - 1] = b[n - 1]
for i in range(n - 2, -1, -1):
dpa[i] = max(a[i] + dpb[i + 1], dpa[i + 1])
dpb[i] = max(b[i] + dpa[i + 1], dpb[i + 1])
return max(dpa[0], dpb[0])
n = int(input().strip())
a = list(map(int, i... | FUNC_DEF 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 BIN_OP VAR NUMBER 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 NUMBER 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... | import sys
sys.setrecursionlimit(2 * 10**5 + 1)
n = int(input())
a = [[int(x) for x in input().split()] for t in range(2)]
ans = [0, 0]
for i in range(n):
ans[0], ans[1] = max(ans[0], ans[1] + a[0][i]), max(ans[1], ans[0] + a[1][i])
print(max(ans)) | IMPORT EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER 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 LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR NUMBER 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... | for t in range(1):
n = int(input())
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
dp1 = [0] * n
dp1[0] = row1[0]
dp2 = [0] * n
dp2[0] = row2[0]
for i in range(1, n):
dp1[i] = max(dp2[i - 1] + row1[i], dp1[i - 1])
dp2[i] = max(dp1[i - 1] + r... | FOR VAR 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR 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())
h1 = [int(x) for x in input().split()]
h2 = [int(x) for x in input().split()]
h = [h1, h2]
x, y, z = h[0][0], h[1][0], 0
for i in range(1, n):
temp1 = x
temp2 = y
temp3 = z
x = max(temp2 + h[0][i], temp3 + h[0][i], h[0][i])
y = max(temp1 + h[1][i], temp3 + h[1][i], h[1][i])
z = ... | 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 VAR VAR VAR NUMBER NUMBER VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR 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())
a = input().split(" ")
b = input().split(" ")
for i in range(n):
a[i] = int(a[i])
b[i] = int(b[i])
F = [[0, 0]] * n
G = [[0, 0]] * n
F[0][0], F[0][1] = G[0][0], G[0][1] = a[0], b[0]
for i in range(1, n):
F[i][0] = G[i - 1][1] + a[i]
F[i][1] = G[i - 1][0] + b[i]
G[i][0] = max(G[i - 1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST LIST NUMBER NUMBER VAR ASSIGN VAR BIN_OP LIST LIST NUMBER NUMBER VAR ASSIG... |
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())
h0 = list(map(int, input().split()))
h1 = list(map(int, input().split()))
dp0, dp1 = [0] * (n + 5), [0] * (n + 5)
dp0[0], dp1[0] = h0[0], h1[0]
for i in range(1, n):
dp0[i] = max(dp1[i - 1], dp1[i - 2], dp0[i - 2]) + h0[i]
dp1[i] = max(dp0[i - 1], dp1[i - ... | 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 VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER 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())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
dp = [[([0] * 2) for _ in range(3)] for _ in range(n)]
dp[0][2][0] = arr1[0]
dp[0][2][1] = arr2[0]
for i in range(1, n):
dp[i][0][0] = dp[i - 1][1][0]
dp[i][0][1] = dp[i - 1][1][1]
dp[i][1][0] = dp[i - 1][2][0]
... | 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 NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER NUMBER VAR NUMBER ASSIGN VAR 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... | from sys import stdin, stdout
def INI():
return int(stdin.readline())
def INL():
return [int(_) for _ in stdin.readline().split()]
def INS():
return stdin.readline()
def MOD():
return pow(10, 9) + 7
def OPS(ans):
stdout.write(str(ans) + "\n")
def OPL(ans):
[stdout.write(str(_) + " ")... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING 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... | n = int(input())
h = [[] for _ in range(2)]
h[0] = list(map(int, input().split()))
h[1] = list(map(int, input().split()))
h[0].insert(0, 0)
h[1].insert(0, 0)
dp = [[(0) for __ in range(2)] for _ in range(n + 1)]
best_edge = [-1] * (n + 1)
dp[0][0] = h[0][0]
dp[0][1] = h[1][0]
dp[1][0] = dp[0][0] + h[0][1]
dp[1][1] = dp... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR 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 EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN 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 = input()
row1 = [x for x in map(int, input().split())]
row2 = [x for x in map(int, input().split())]
def largest_height(row1, row2):
largest_r1 = row1[0]
largest_r2 = row2[0]
for ind in range(1, len(row1)):
new_largest_r1 = max(largest_r1, largest_r2 + row1[ind])
new_largest_r2 = max(la... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR 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... | n = int(input())
h_t = list(map(int, input().split()))
h_b = list(map(int, input().split()))
dp_t = [0, h_t[0]]
dp_b = [0, h_b[0]]
if n > 1:
for i in range(1, n):
dp_t.append(max(dp_b[-1], dp_b[-2]) + h_t[i])
dp_b.append(max(dp_t[-2], dp_t[-3]) + h_b[i])
print(max(dp_t[-1], dp_b[-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 VAR NUMBER ASSIGN VAR LIST NUMBER VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP FUNC_C... |
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 = [int(i) for i in input().split(" ")]
l2 = [int(i) for i in input().split(" ")]
l = [l1, l2]
def find_max_dp():
dp = [[0] * n, [0] * n]
dp[0][0] = l[0][0]
dp[1][0] = l[1][0]
if n > 1:
dp[0][1] = l[0][1] + dp[1][0]
dp[1][1] = l[1][1] + dp[0][0]
for i in range(1,... | 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 LIST VAR VAR FUNC_DEF ASSIGN VAR LIST BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN 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... | n = int(input())
h = [None] * 2
h[0] = list(map(int, input().split()))
h[1] = list(map(int, input().split()))
top_max = h[0][0]
bot_max = h[1][0]
for col in range(1, n):
new_top_max = max(top_max, bot_max + h[0][col])
new_bot_max = max(bot_max, top_max + h[1][col])
top_max = new_top_max
bot_max = new_bo... | 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 VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER 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... | def selectTeam(H1, H2):
i = 0
n = len(H1)
amax = H1[i]
bmax = H2[i]
max1 = H1[i]
max2 = H2[i]
i = 1
while i < n:
amax = H1[i] + max2
bmax = H2[i] + max1
max1 = max(max1, amax)
max2 = max(max2, bmax)
i = i + 1
return max(amax, bmax)
n = int(in... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER R... |
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()))
r1 = [[l1[0], l1[0]]] + [[0, 1] for _ in range(n - 1)]
r2 = [[l2[0], l2[0]]] + [[0, 1] for _ in range(n - 1)]
result1, result2 = 0, 0
for i in range(n):
a = result1
result1 = max(result1, result2 + l1[i])
result2 = ma... | 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 LIST VAR NUMBER VAR NUMBER LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST LIST 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... | x = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
lol = []
for i in range(2):
lol.append([0] * x)
lol[0][0] = a[0]
lol[1][0] = b[0]
if x > 1:
lol[0][1] = lol[1][0] + a[1]
lol[1][1] = lol[0][0] + b[1]
for i in range(2, x):
lol[0][i] = max(lol[1][i - 1] + a[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 LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER 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... | def dp_solve(h):
n = len(h[0])
memo = {}
def solve(r, c):
if (r, c) in memo.keys():
return memo[r, c]
if c == n - 1:
return h[r][c]
elif c == n - 2:
return h[r][c] + h[1 - r][c + 1]
else:
m = h[r][c] + max(solve(1 - r, c + 1), ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR DICT FUNC_DEF IF VAR VAR FUNC_CALL VAR RETURN VAR VAR VAR IF VAR BIN_OP VAR NUMBER RETURN VAR VAR VAR IF VAR BIN_OP VAR NUMBER RETURN BIN_OP VAR VAR VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP 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... | CHOSE_A = 0
CHOSE_B = 1
CHOSE_NEITHER = 2
n = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
memo = []
for i in range(n):
memo.append([-1, -1, -1])
chose_b = a[n - 1]
chose_a = b[n - 1]
chose_neither = max(a[n - 1], b[n - 1])
for i in range(n - 2, -1, -1):
choose_a = ... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST 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... | n = int(input())
h1 = list(map(int, input().split()))
h2 = list(map(int, input().split()))
if n > 1:
h12 = [0] * n
h22 = [0] * n
h12[0] = h1[0]
h22[0] = h2[0]
h12[1] = max(h12[0], h22[0] + h1[1])
h22[1] = max(h22[0], h12[0] + h2[1])
for i in range(2, n):
h12[i] = max(h12[i - 1], h22[... | 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 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 ... |
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())
matrix = []
arr = [int(i) for i in input().split()]
arr1 = [int(i) for i in input().split()]
matrix.append(arr)
matrix.append(arr1)
dp = [[(0) for i in range(n)] for j in range(2)]
dp[0][0] = matrix[0][0]
dp[1][0] = matrix[1][0]
for i in range(1, n):
if i >= 2:
dp[0][i] = max(matrix[0][i] +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER 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... | def solve(n, queue1, queue2):
ans1 = [0] * n
ans2 = [0] * n
ans1[n - 1] = queue1[n - 1]
ans2[n - 1] = queue2[n - 1]
for index in range(n - 2, -1, -1):
temp = queue1[index] + ans2[index + 1]
ans1[index] = max(temp, ans1[index + 1])
temp = queue2[index] + ans1[index + 1]
... | FUNC_DEF 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 BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR 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 = list(map(int, input().split()))
b = list(map(int, 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:
dp1 = [0] * (n + 1)
dp2 = [0] * (n + 1)
dp0 = [0] * (n + 1)
dp1[1] = a[0]
dp2[1] = b[0]
dp0[1] = 0
dp1[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 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... | def is_safe(i, j, n):
if i >= 0 and i < n and j >= 0 and j < n:
return True
return False
n = int(input())
mat = [list(map(int, input().split())), list(map(int, input().split()))]
dp = [[0] * (n + 1), [0] * (n + 1)]
for i in range(n):
dp[0][i + 1] = max(dp[1][i] + mat[0][i], dp[0][i])
dp[1][i +... | FUNC_DEF IF VAR NUMBER VAR VAR VAR NUMBER VAR VAR RETURN NUMBER RETURN NUMBER 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 BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN... |
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())
num = []
num.append(list(map(int, input().split())))
num.append(list(map(int, input().split())))
value = []
dp = [[(0) for _ in range(n)] for _ in range(2)]
dp[0][0] = num[0][0]
dp[1][0] = num[1][0]
for i in range(1, n):
dp[0][i] = max(dp[0][i - 1], num[0][i] + dp[1][i - 1])
dp[1][i] = max(dp[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 NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER 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... | maxe = 0
def recur(arr, m, n, flag):
global maxe
if m >= len(arr):
if n > maxe:
maxe = n
return 0
return recur(arr, m + 1, n, flag) + recur(arr, m + 1, n + arr[m][flag], 1 - flag)
n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
a... | ASSIGN VAR NUMBER FUNC_DEF IF VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR RETURN NUMBER RETURN BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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... | from sys import stdin
input = stdin.readline
n = int(input())
ar1 = list(map(int, input().split()))
ar2 = list(map(int, input().split()))
dp = [[0, 0] for i in range(n)]
dp[0][0] = ar1[0]
dp[0][1] = ar2[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + ar1[i])
dp[i][1] = max(dp[i - 1][1], dp... | 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 LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER 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... | n = int(input())
arr1 = [int(p) for p in input().split()]
arr2 = [int(p) for p in input().split()]
ans1 = [0] * n
ans2 = [0] * n
if n == 1:
print(max(arr1[0], arr2[0]))
exit()
ans1[0] = arr1[0]
ans2[0] = arr2[0]
ans1[1] = arr1[1] + ans2[0]
ans2[1] = arr2[1] + ans1[0]
for i in range(2, n):
ans1[i] = max(ans2... | 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 ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR 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())
left = list(map(int, input().split()))
right = list(map(int, input().split()))
sequences = [(0, 0)]
for i in range(n):
new = []
m = {(0): 0, (1): 0, (2): 0}
for s in sequences:
new.append((0, s[1]))
m[0] = max(m[0], s[1])
if not s[0] == 1:
new.append((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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR VAR EXPR ... |
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())), list(map(int, input().split()))]
m = [a[0][-1], a[1][-1]]
for i in list(range(n - 1))[::-1]:
m[0], m[1] = max(m[0], m[1] + a[0][i]), max(m[1], m[0] + a[1][i])
print(max(m[0], m[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 FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER FUNC_CALL V... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.