map int input split list map int input split for in range list for in

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x,y=map(int,input().split())
a=[list(map(int, input().split())) for i in range (x)]
b=[list([0]*(y)) for i in range (x)]
i=0
for i in range(x):
for j in range(y):
if i>0:
b[i][j]=b[i-1][j]
if j>0:
if b[i][j-1]<b[i][j] or i==0:
b[i][j]=b[i][j-1]
b[i][j]+=a[i][j]
print(b[-1][-1])