문제: https://www.acmicpc.net/problem/11048
import sys
read = lambda : sys.stdin.readline().strip()
n, m = map(int, input().split())
maze = [[0]*(m+1)]
for _ in range(n):
maze.append([0]+list(map(int, input().split())))
for i in range(1,n+1):
for j in range(1,m+1):
maze[i][j] += max(maze[i][j-1], maze[i-1][j], maze[i-1][j-1])
print(maze[n][m])